webpackJsonp(["vendor"],{ /***/ "../../../../css-loader/lib/css-base.js": /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /***/ "../../../../events/events.js": /***/ (function(module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. function EventEmitter() { this._events = this._events || {}; this._maxListeners = this._maxListeners || undefined; } module.exports = EventEmitter; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. EventEmitter.defaultMaxListeners = 10; // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function(n) { if (!isNumber(n) || n < 0 || isNaN(n)) throw TypeError('n must be a positive number'); this._maxListeners = n; return this; }; EventEmitter.prototype.emit = function(type) { var er, handler, len, args, i, listeners; if (!this._events) this._events = {}; // If there is no 'error' event listener then throw. if (type === 'error') { if (!this._events.error || (isObject(this._events.error) && !this._events.error.length)) { er = arguments[1]; if (er instanceof Error) { throw er; // Unhandled 'error' event } else { // At least give some kind of context to the user var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); err.context = er; throw err; } } } handler = this._events[type]; if (isUndefined(handler)) return false; if (isFunction(handler)) { switch (arguments.length) { // fast cases case 1: handler.call(this); break; case 2: handler.call(this, arguments[1]); break; case 3: handler.call(this, arguments[1], arguments[2]); break; // slower default: args = Array.prototype.slice.call(arguments, 1); handler.apply(this, args); } } else if (isObject(handler)) { args = Array.prototype.slice.call(arguments, 1); listeners = handler.slice(); len = listeners.length; for (i = 0; i < len; i++) listeners[i].apply(this, args); } return true; }; EventEmitter.prototype.addListener = function(type, listener) { var m; if (!isFunction(listener)) throw TypeError('listener must be a function'); if (!this._events) this._events = {}; // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (this._events.newListener) this.emit('newListener', type, isFunction(listener.listener) ? listener.listener : listener); if (!this._events[type]) // Optimize the case of one listener. Don't need the extra array object. this._events[type] = listener; else if (isObject(this._events[type])) // If we've already got an array, just append. this._events[type].push(listener); else // Adding the second element, need to change to array. this._events[type] = [this._events[type], listener]; // Check for listener leak if (isObject(this._events[type]) && !this._events[type].warned) { if (!isUndefined(this._maxListeners)) { m = this._maxListeners; } else { m = EventEmitter.defaultMaxListeners; } if (m && m > 0 && this._events[type].length > m) { this._events[type].warned = true; console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length); if (typeof console.trace === 'function') { // not supported in IE 10 console.trace(); } } } return this; }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.once = function(type, listener) { if (!isFunction(listener)) throw TypeError('listener must be a function'); var fired = false; function g() { this.removeListener(type, g); if (!fired) { fired = true; listener.apply(this, arguments); } } g.listener = listener; this.on(type, g); return this; }; // emits a 'removeListener' event iff the listener was removed EventEmitter.prototype.removeListener = function(type, listener) { var list, position, length, i; if (!isFunction(listener)) throw TypeError('listener must be a function'); if (!this._events || !this._events[type]) return this; list = this._events[type]; length = list.length; position = -1; if (list === listener || (isFunction(list.listener) && list.listener === listener)) { delete this._events[type]; if (this._events.removeListener) this.emit('removeListener', type, listener); } else if (isObject(list)) { for (i = length; i-- > 0;) { if (list[i] === listener || (list[i].listener && list[i].listener === listener)) { position = i; break; } } if (position < 0) return this; if (list.length === 1) { list.length = 0; delete this._events[type]; } else { list.splice(position, 1); } if (this._events.removeListener) this.emit('removeListener', type, listener); } return this; }; EventEmitter.prototype.removeAllListeners = function(type) { var key, listeners; if (!this._events) return this; // not listening for removeListener, no need to emit if (!this._events.removeListener) { if (arguments.length === 0) this._events = {}; else if (this._events[type]) delete this._events[type]; return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { for (key in this._events) { if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = {}; return this; } listeners = this._events[type]; if (isFunction(listeners)) { this.removeListener(type, listeners); } else if (listeners) { // LIFO order while (listeners.length) this.removeListener(type, listeners[listeners.length - 1]); } delete this._events[type]; return this; }; EventEmitter.prototype.listeners = function(type) { var ret; if (!this._events || !this._events[type]) ret = []; else if (isFunction(this._events[type])) ret = [this._events[type]]; else ret = this._events[type].slice(); return ret; }; EventEmitter.prototype.listenerCount = function(type) { if (this._events) { var evlistener = this._events[type]; if (isFunction(evlistener)) return 1; else if (evlistener) return evlistener.length; } return 0; }; EventEmitter.listenerCount = function(emitter, type) { return emitter.listenerCount(type); }; function isFunction(arg) { return typeof arg === 'function'; } function isNumber(arg) { return typeof arg === 'number'; } function isObject(arg) { return typeof arg === 'object' && arg !== null; } function isUndefined(arg) { return arg === void 0; } /***/ }), /***/ "../../../../freeice/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* jshint node: true */ var normalice = __webpack_require__("../../../../normalice/index.js"); /** # freeice The `freeice` module is a simple way of getting random STUN or TURN server for your WebRTC application. The list of servers (just STUN at this stage) were sourced from this [gist](https://gist.github.com/zziuni/3741933). ## Example Use The following demonstrates how you can use `freeice` with [rtc-quickconnect](https://github.com/rtc-io/rtc-quickconnect): <<< examples/quickconnect.js As the `freeice` module generates ice servers in a list compliant with the WebRTC spec you will be able to use it with raw `RTCPeerConnection` constructors and other WebRTC libraries. ## Hey, don't use my STUN/TURN server! If for some reason your free STUN or TURN server ends up in the list of servers ([stun](https://github.com/DamonOehlman/freeice/blob/master/stun.json) or [turn](https://github.com/DamonOehlman/freeice/blob/master/turn.json)) that is used in this module, you can feel free to open an issue on this repository and those servers will be removed within 24 hours (or sooner). This is the quickest and probably the most polite way to have something removed (and provides us some visibility if someone opens a pull request requesting that a server is added). ## Please add my server! If you have a server that you wish to add to the list, that's awesome! I'm sure I speak on behalf of a whole pile of WebRTC developers who say thanks. To get it into the list, feel free to either open a pull request or if you find that process a bit daunting then just create an issue requesting the addition of the server (make sure you provide all the details, and if you have a Terms of Service then including that in the PR/issue would be awesome). ## I know of a free server, can I add it? Sure, if you do your homework and make sure it is ok to use (I'm currently in the process of reviewing the terms of those STUN servers included from the original list). If it's ok to go, then please see the previous entry for how to add it. ## Current List of Servers * current as at the time of last `README.md` file generation ### STUN <<< stun.json ### TURN <<< turn.json **/ var freeice = module.exports = function(opts) { // if a list of servers has been provided, then use it instead of defaults var servers = { stun: (opts || {}).stun || __webpack_require__("../../../../freeice/stun.json"), turn: (opts || {}).turn || __webpack_require__("../../../../freeice/turn.json") }; var stunCount = (opts || {}).stunCount || 2; var turnCount = (opts || {}).turnCount || 0; var selected; function getServers(type, count) { var out = []; var input = [].concat(servers[type]); var idx; while (input.length && out.length < count) { idx = (Math.random() * input.length) | 0; out = out.concat(input.splice(idx, 1)); } return out.map(function(url) { //If it's a not a string, don't try to "normalice" it otherwise using type:url will screw it up if ((typeof url !== 'string') && (! (url instanceof String))) { return url; } else { return normalice(type + ':' + url); } }); } // add stun servers selected = [].concat(getServers('stun', stunCount)); if (turnCount) { selected = selected.concat(getServers('turn', turnCount)); } return selected; }; /***/ }), /***/ "../../../../freeice/stun.json": /***/ (function(module, exports) { module.exports = ["stun.l.google.com:19302","stun1.l.google.com:19302","stun2.l.google.com:19302","stun3.l.google.com:19302","stun4.l.google.com:19302","stun.ekiga.net","stun.ideasip.com","stun.schlund.de","stun.stunprotocol.org:3478","stun.voiparound.com","stun.voipbuster.com","stun.voipstunt.com","stun.voxgratia.org","stun.services.mozilla.com"] /***/ }), /***/ "../../../../freeice/turn.json": /***/ (function(module, exports) { module.exports = [] /***/ }), /***/ "../../../../hammerjs/hammer.js": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.7 - 2016-04-22 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */ (function(window, document, exportName, undefined) { 'use strict'; var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; var TEST_ELEMENT = document.createElement('div'); var TYPE_FUNCTION = 'function'; var round = Math.round; var abs = Math.abs; var now = Date.now; /** * set a timeout with a given scope * @param {Function} fn * @param {Number} timeout * @param {Object} context * @returns {number} */ function setTimeoutContext(fn, timeout, context) { return setTimeout(bindFn(fn, context), timeout); } /** * if the argument is an array, we want to execute the fn on each entry * if it aint an array we don't want to do a thing. * this is used by all the methods that accept a single and array argument. * @param {*|Array} arg * @param {String} fn * @param {Object} [context] * @returns {Boolean} */ function invokeArrayArg(arg, fn, context) { if (Array.isArray(arg)) { each(arg, context[fn], context); return true; } return false; } /** * walk objects and arrays * @param {Object} obj * @param {Function} iterator * @param {Object} context */ function each(obj, iterator, context) { var i; if (!obj) { return; } if (obj.forEach) { obj.forEach(iterator, context); } else if (obj.length !== undefined) { i = 0; while (i < obj.length) { iterator.call(context, obj[i], i, obj); i++; } } else { for (i in obj) { obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); } } } /** * wrap a method with a deprecation warning and stack trace * @param {Function} method * @param {String} name * @param {String} message * @returns {Function} A new function wrapping the supplied method. */ function deprecate(method, name, message) { var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n'; return function() { var e = new Error('get-stack-trace'); var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '') .replace(/^\s+at\s+/gm, '') .replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; var log = window.console && (window.console.warn || window.console.log); if (log) { log.call(window.console, deprecationMessage, stack); } return method.apply(this, arguments); }; } /** * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} target * @param {...Object} objects_to_assign * @returns {Object} target */ var assign; if (typeof Object.assign !== 'function') { assign = function assign(target) { if (target === undefined || target === null) { throw new TypeError('Cannot convert undefined or null to object'); } var output = Object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source !== undefined && source !== null) { for (var nextKey in source) { if (source.hasOwnProperty(nextKey)) { output[nextKey] = source[nextKey]; } } } } return output; }; } else { assign = Object.assign; } /** * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} dest * @param {Object} src * @param {Boolean} [merge=false] * @returns {Object} dest */ var extend = deprecate(function extend(dest, src, merge) { var keys = Object.keys(src); var i = 0; while (i < keys.length) { if (!merge || (merge && dest[keys[i]] === undefined)) { dest[keys[i]] = src[keys[i]]; } i++; } return dest; }, 'extend', 'Use `assign`.'); /** * merge the values from src in the dest. * means that properties that exist in dest will not be overwritten by src * @param {Object} dest * @param {Object} src * @returns {Object} dest */ var merge = deprecate(function merge(dest, src) { return extend(dest, src, true); }, 'merge', 'Use `assign`.'); /** * simple class inheritance * @param {Function} child * @param {Function} base * @param {Object} [properties] */ function inherit(child, base, properties) { var baseP = base.prototype, childP; childP = child.prototype = Object.create(baseP); childP.constructor = child; childP._super = baseP; if (properties) { assign(childP, properties); } } /** * simple function bind * @param {Function} fn * @param {Object} context * @returns {Function} */ function bindFn(fn, context) { return function boundFn() { return fn.apply(context, arguments); }; } /** * let a boolean value also be a function that must return a boolean * this first item in args will be used as the context * @param {Boolean|Function} val * @param {Array} [args] * @returns {Boolean} */ function boolOrFn(val, args) { if (typeof val == TYPE_FUNCTION) { return val.apply(args ? args[0] || undefined : undefined, args); } return val; } /** * use the val2 when val1 is undefined * @param {*} val1 * @param {*} val2 * @returns {*} */ function ifUndefined(val1, val2) { return (val1 === undefined) ? val2 : val1; } /** * addEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function addEventListeners(target, types, handler) { each(splitStr(types), function(type) { target.addEventListener(type, handler, false); }); } /** * removeEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function removeEventListeners(target, types, handler) { each(splitStr(types), function(type) { target.removeEventListener(type, handler, false); }); } /** * find if a node is in the given parent * @method hasParent * @param {HTMLElement} node * @param {HTMLElement} parent * @return {Boolean} found */ function hasParent(node, parent) { while (node) { if (node == parent) { return true; } node = node.parentNode; } return false; } /** * small indexOf wrapper * @param {String} str * @param {String} find * @returns {Boolean} found */ function inStr(str, find) { return str.indexOf(find) > -1; } /** * split string on whitespace * @param {String} str * @returns {Array} words */ function splitStr(str) { return str.trim().split(/\s+/g); } /** * find if a array contains the object using indexOf or a simple polyFill * @param {Array} src * @param {String} find * @param {String} [findByKey] * @return {Boolean|Number} false when not found, or the index */ function inArray(src, find, findByKey) { if (src.indexOf && !findByKey) { return src.indexOf(find); } else { var i = 0; while (i < src.length) { if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { return i; } i++; } return -1; } } /** * convert array-like objects to real arrays * @param {Object} obj * @returns {Array} */ function toArray(obj) { return Array.prototype.slice.call(obj, 0); } /** * unique array with objects based on a key (like 'id') or just by the array's value * @param {Array} src [{id:1},{id:2},{id:1}] * @param {String} [key] * @param {Boolean} [sort=False] * @returns {Array} [{id:1},{id:2}] */ function uniqueArray(src, key, sort) { var results = []; var values = []; var i = 0; while (i < src.length) { var val = key ? src[i][key] : src[i]; if (inArray(values, val) < 0) { results.push(src[i]); } values[i] = val; i++; } if (sort) { if (!key) { results = results.sort(); } else { results = results.sort(function sortUniqueArray(a, b) { return a[key] > b[key]; }); } } return results; } /** * get the prefixed property * @param {Object} obj * @param {String} property * @returns {String|Undefined} prefixed */ function prefixed(obj, property) { var prefix, prop; var camelProp = property[0].toUpperCase() + property.slice(1); var i = 0; while (i < VENDOR_PREFIXES.length) { prefix = VENDOR_PREFIXES[i]; prop = (prefix) ? prefix + camelProp : property; if (prop in obj) { return prop; } i++; } return undefined; } /** * get a unique id * @returns {number} uniqueId */ var _uniqueId = 1; function uniqueId() { return _uniqueId++; } /** * get the window object of an element * @param {HTMLElement} element * @returns {DocumentView|Window} */ function getWindowForElement(element) { var doc = element.ownerDocument || element; return (doc.defaultView || doc.parentWindow || window); } var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; var SUPPORT_TOUCH = ('ontouchstart' in window); var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); var INPUT_TYPE_TOUCH = 'touch'; var INPUT_TYPE_PEN = 'pen'; var INPUT_TYPE_MOUSE = 'mouse'; var INPUT_TYPE_KINECT = 'kinect'; var COMPUTE_INTERVAL = 25; var INPUT_START = 1; var INPUT_MOVE = 2; var INPUT_END = 4; var INPUT_CANCEL = 8; var DIRECTION_NONE = 1; var DIRECTION_LEFT = 2; var DIRECTION_RIGHT = 4; var DIRECTION_UP = 8; var DIRECTION_DOWN = 16; var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; var PROPS_XY = ['x', 'y']; var PROPS_CLIENT_XY = ['clientX', 'clientY']; /** * create new input type manager * @param {Manager} manager * @param {Function} callback * @returns {Input} * @constructor */ function Input(manager, callback) { var self = this; this.manager = manager; this.callback = callback; this.element = manager.element; this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager, // so when disabled the input events are completely bypassed. this.domHandler = function(ev) { if (boolOrFn(manager.options.enable, [manager])) { self.handler(ev); } }; this.init(); } Input.prototype = { /** * should handle the inputEvent data and trigger the callback * @virtual */ handler: function() { }, /** * bind the events */ init: function() { this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); }, /** * unbind the events */ destroy: function() { this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); } }; /** * create new input type manager * called by the Manager constructor * @param {Hammer} manager * @returns {Input} */ function createInputInstance(manager) { var Type; var inputClass = manager.options.inputClass; if (inputClass) { Type = inputClass; } else if (SUPPORT_POINTER_EVENTS) { Type = PointerEventInput; } else if (SUPPORT_ONLY_TOUCH) { Type = TouchInput; } else if (!SUPPORT_TOUCH) { Type = MouseInput; } else { Type = TouchMouseInput; } return new (Type)(manager, inputHandler); } /** * handle input events * @param {Manager} manager * @param {String} eventType * @param {Object} input */ function inputHandler(manager, eventType, input) { var pointersLen = input.pointers.length; var changedPointersLen = input.changedPointers.length; var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); input.isFirst = !!isFirst; input.isFinal = !!isFinal; if (isFirst) { manager.session = {}; } // source event is the normalized value of the domEvents // like 'touchstart, mouseup, pointerdown' input.eventType = eventType; // compute scale, rotation etc computeInputData(manager, input); // emit secret event manager.emit('hammer.input', input); manager.recognize(input); manager.session.prevInput = input; } /** * extend the data with some usable properties like scale, rotate, velocity etc * @param {Object} manager * @param {Object} input */ function computeInputData(manager, input) { var session = manager.session; var pointers = input.pointers; var pointersLength = pointers.length; // store the first input to calculate the distance and direction if (!session.firstInput) { session.firstInput = simpleCloneInputData(input); } // to compute scale and rotation we need to store the multiple touches if (pointersLength > 1 && !session.firstMultiple) { session.firstMultiple = simpleCloneInputData(input); } else if (pointersLength === 1) { session.firstMultiple = false; } var firstInput = session.firstInput; var firstMultiple = session.firstMultiple; var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; var center = input.center = getCenter(pointers); input.timeStamp = now(); input.deltaTime = input.timeStamp - firstInput.timeStamp; input.angle = getAngle(offsetCenter, center); input.distance = getDistance(offsetCenter, center); computeDeltaXY(session, input); input.offsetDirection = getDirection(input.deltaX, input.deltaY); var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); input.overallVelocityX = overallVelocity.x; input.overallVelocityY = overallVelocity.y; input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y; input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length > session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers); computeIntervalInputData(session, input); // find the correct target var target = manager.element; if (hasParent(input.srcEvent.target, target)) { target = input.srcEvent.target; } input.target = target; } function computeDeltaXY(session, input) { var center = input.center; var offset = session.offsetDelta || {}; var prevDelta = session.prevDelta || {}; var prevInput = session.prevInput || {}; if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { prevDelta = session.prevDelta = { x: prevInput.deltaX || 0, y: prevInput.deltaY || 0 }; offset = session.offsetDelta = { x: center.x, y: center.y }; } input.deltaX = prevDelta.x + (center.x - offset.x); input.deltaY = prevDelta.y + (center.y - offset.y); } /** * velocity is calculated every x ms * @param {Object} session * @param {Object} input */ function computeIntervalInputData(session, input) { var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction; if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { var deltaX = input.deltaX - last.deltaX; var deltaY = input.deltaY - last.deltaY; var v = getVelocity(deltaTime, deltaX, deltaY); velocityX = v.x; velocityY = v.y; velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; direction = getDirection(deltaX, deltaY); session.lastInterval = input; } else { // use latest velocity info if it doesn't overtake a minimum period velocity = last.velocity; velocityX = last.velocityX; velocityY = last.velocityY; direction = last.direction; } input.velocity = velocity; input.velocityX = velocityX; input.velocityY = velocityY; input.direction = direction; } /** * create a simple clone from the input used for storage of firstInput and firstMultiple * @param {Object} input * @returns {Object} clonedInputData */ function simpleCloneInputData(input) { // make a simple copy of the pointers because we will get a reference if we don't // we only need clientXY for the calculations var pointers = []; var i = 0; while (i < input.pointers.length) { pointers[i] = { clientX: round(input.pointers[i].clientX), clientY: round(input.pointers[i].clientY) }; i++; } return { timeStamp: now(), pointers: pointers, center: getCenter(pointers), deltaX: input.deltaX, deltaY: input.deltaY }; } /** * get the center of all the pointers * @param {Array} pointers * @return {Object} center contains `x` and `y` properties */ function getCenter(pointers) { var pointersLength = pointers.length; // no need to loop when only one touch if (pointersLength === 1) { return { x: round(pointers[0].clientX), y: round(pointers[0].clientY) }; } var x = 0, y = 0, i = 0; while (i < pointersLength) { x += pointers[i].clientX; y += pointers[i].clientY; i++; } return { x: round(x / pointersLength), y: round(y / pointersLength) }; } /** * calculate the velocity between two points. unit is in px per ms. * @param {Number} deltaTime * @param {Number} x * @param {Number} y * @return {Object} velocity `x` and `y` */ function getVelocity(deltaTime, x, y) { return { x: x / deltaTime || 0, y: y / deltaTime || 0 }; } /** * get the direction between two points * @param {Number} x * @param {Number} y * @return {Number} direction */ function getDirection(x, y) { if (x === y) { return DIRECTION_NONE; } if (abs(x) >= abs(y)) { return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; } return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; } /** * calculate the absolute distance between two points * @param {Object} p1 {x, y} * @param {Object} p2 {x, y} * @param {Array} [props] containing x and y keys * @return {Number} distance */ function getDistance(p1, p2, props) { if (!props) { props = PROPS_XY; } var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]]; return Math.sqrt((x * x) + (y * y)); } /** * calculate the angle between two coordinates * @param {Object} p1 * @param {Object} p2 * @param {Array} [props] containing x and y keys * @return {Number} angle */ function getAngle(p1, p2, props) { if (!props) { props = PROPS_XY; } var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]]; return Math.atan2(y, x) * 180 / Math.PI; } /** * calculate the rotation degrees between two pointersets * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} rotation */ function getRotation(start, end) { return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); } /** * calculate the scale factor between two pointersets * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} scale */ function getScale(start, end) { return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); } var MOUSE_INPUT_MAP = { mousedown: INPUT_START, mousemove: INPUT_MOVE, mouseup: INPUT_END }; var MOUSE_ELEMENT_EVENTS = 'mousedown'; var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; /** * Mouse events input * @constructor * @extends Input */ function MouseInput() { this.evEl = MOUSE_ELEMENT_EVENTS; this.evWin = MOUSE_WINDOW_EVENTS; this.pressed = false; // mousedown state Input.apply(this, arguments); } inherit(MouseInput, Input, { /** * handle mouse events * @param {Object} ev */ handler: function MEhandler(ev) { var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down if (eventType & INPUT_START && ev.button === 0) { this.pressed = true; } if (eventType & INPUT_MOVE && ev.which !== 1) { eventType = INPUT_END; } // mouse must be down if (!this.pressed) { return; } if (eventType & INPUT_END) { this.pressed = false; } this.callback(this.manager, eventType, { pointers: [ev], changedPointers: [ev], pointerType: INPUT_TYPE_MOUSE, srcEvent: ev }); } }); var POINTER_INPUT_MAP = { pointerdown: INPUT_START, pointermove: INPUT_MOVE, pointerup: INPUT_END, pointercancel: INPUT_CANCEL, pointerout: INPUT_CANCEL }; // in IE10 the pointer types is defined as an enum var IE10_POINTER_TYPE_ENUM = { 2: INPUT_TYPE_TOUCH, 3: INPUT_TYPE_PEN, 4: INPUT_TYPE_MOUSE, 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 }; var POINTER_ELEMENT_EVENTS = 'pointerdown'; var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive if (window.MSPointerEvent && !window.PointerEvent) { POINTER_ELEMENT_EVENTS = 'MSPointerDown'; POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; } /** * Pointer events input * @constructor * @extends Input */ function PointerEventInput() { this.evEl = POINTER_ELEMENT_EVENTS; this.evWin = POINTER_WINDOW_EVENTS; Input.apply(this, arguments); this.store = (this.manager.session.pointerEvents = []); } inherit(PointerEventInput, Input, { /** * handle mouse events * @param {Object} ev */ handler: function PEhandler(ev) { var store = this.store; var removePointer = false; var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; var isTouch = (pointerType == INPUT_TYPE_TOUCH); // get index of the event in the store var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { if (storeIndex < 0) { store.push(ev); storeIndex = store.length - 1; } } else if (eventType & (INPUT_END | INPUT_CANCEL)) { removePointer = true; } // it not found, so the pointer hasn't been down (so it's probably a hover) if (storeIndex < 0) { return; } // update the event in the store store[storeIndex] = ev; this.callback(this.manager, eventType, { pointers: store, changedPointers: [ev], pointerType: pointerType, srcEvent: ev }); if (removePointer) { // remove from the store store.splice(storeIndex, 1); } } }); var SINGLE_TOUCH_INPUT_MAP = { touchstart: INPUT_START, touchmove: INPUT_MOVE, touchend: INPUT_END, touchcancel: INPUT_CANCEL }; var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; /** * Touch events input * @constructor * @extends Input */ function SingleTouchInput() { this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; this.started = false; Input.apply(this, arguments); } inherit(SingleTouchInput, Input, { handler: function TEhandler(ev) { var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? if (type === INPUT_START) { this.started = true; } if (!this.started) { return; } var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { this.started = false; } this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH, srcEvent: ev }); } }); /** * @this {TouchInput} * @param {Object} ev * @param {Number} type flag * @returns {undefined|Array} [all, changed] */ function normalizeSingleTouches(ev, type) { var all = toArray(ev.touches); var changed = toArray(ev.changedTouches); if (type & (INPUT_END | INPUT_CANCEL)) { all = uniqueArray(all.concat(changed), 'identifier', true); } return [all, changed]; } var TOUCH_INPUT_MAP = { touchstart: INPUT_START, touchmove: INPUT_MOVE, touchend: INPUT_END, touchcancel: INPUT_CANCEL }; var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; /** * Multi-user touch events input * @constructor * @extends Input */ function TouchInput() { this.evTarget = TOUCH_TARGET_EVENTS; this.targetIds = {}; Input.apply(this, arguments); } inherit(TouchInput, Input, { handler: function MTEhandler(ev) { var type = TOUCH_INPUT_MAP[ev.type]; var touches = getTouches.call(this, ev, type); if (!touches) { return; } this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH, srcEvent: ev }); } }); /** * @this {TouchInput} * @param {Object} ev * @param {Number} type flag * @returns {undefined|Array} [all, changed] */ function getTouches(ev, type) { var allTouches = toArray(ev.touches); var targetIds = this.targetIds; // when there is only one touch, the process can be simplified if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { targetIds[allTouches[0].identifier] = true; return [allTouches, allTouches]; } var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target; // get target touches from touches targetTouches = allTouches.filter(function(touch) { return hasParent(touch.target, target); }); // collect touches if (type === INPUT_START) { i = 0; while (i < targetTouches.length) { targetIds[targetTouches[i].identifier] = true; i++; } } // filter changed touches to only contain touches that exist in the collected target ids i = 0; while (i < changedTouches.length) { if (targetIds[changedTouches[i].identifier]) { changedTargetTouches.push(changedTouches[i]); } // cleanup removed touches if (type & (INPUT_END | INPUT_CANCEL)) { delete targetIds[changedTouches[i].identifier]; } i++; } if (!changedTargetTouches.length) { return; } return [ // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches ]; } /** * Combined touch and mouse input * * Touch has a higher priority then mouse, and while touching no mouse events are allowed. * This because touch devices also emit mouse events while doing a touch. * * @constructor * @extends Input */ var DEDUP_TIMEOUT = 2500; var DEDUP_DISTANCE = 25; function TouchMouseInput() { Input.apply(this, arguments); var handler = bindFn(this.handler, this); this.touch = new TouchInput(this.manager, handler); this.mouse = new MouseInput(this.manager, handler); this.primaryTouch = null; this.lastTouches = []; } inherit(TouchMouseInput, Input, { /** * handle mouse and touch events * @param {Hammer} manager * @param {String} inputEvent * @param {Object} inputData */ handler: function TMEhandler(manager, inputEvent, inputData) { var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { return; } // when we're in a touch event, record touches to de-dupe synthetic mouse event if (isTouch) { recordTouches.call(this, inputEvent, inputData); } else if (isMouse && isSyntheticEvent.call(this, inputData)) { return; } this.callback(manager, inputEvent, inputData); }, /** * remove the event listeners */ destroy: function destroy() { this.touch.destroy(); this.mouse.destroy(); } }); function recordTouches(eventType, eventData) { if (eventType & INPUT_START) { this.primaryTouch = eventData.changedPointers[0].identifier; setLastTouch.call(this, eventData); } else if (eventType & (INPUT_END | INPUT_CANCEL)) { setLastTouch.call(this, eventData); } } function setLastTouch(eventData) { var touch = eventData.changedPointers[0]; if (touch.identifier === this.primaryTouch) { var lastTouch = {x: touch.clientX, y: touch.clientY}; this.lastTouches.push(lastTouch); var lts = this.lastTouches; var removeLastTouch = function() { var i = lts.indexOf(lastTouch); if (i > -1) { lts.splice(i, 1); } }; setTimeout(removeLastTouch, DEDUP_TIMEOUT); } } function isSyntheticEvent(eventData) { var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY; for (var i = 0; i < this.lastTouches.length; i++) { var t = this.lastTouches[i]; var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y); if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { return true; } } return false; } var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; // magical touchAction value var TOUCH_ACTION_COMPUTE = 'compute'; var TOUCH_ACTION_AUTO = 'auto'; var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented var TOUCH_ACTION_NONE = 'none'; var TOUCH_ACTION_PAN_X = 'pan-x'; var TOUCH_ACTION_PAN_Y = 'pan-y'; var TOUCH_ACTION_MAP = getTouchActionProps(); /** * Touch Action * sets the touchAction property or uses the js alternative * @param {Manager} manager * @param {String} value * @constructor */ function TouchAction(manager, value) { this.manager = manager; this.set(value); } TouchAction.prototype = { /** * set the touchAction value on the element or enable the polyfill * @param {String} value */ set: function(value) { // find out the touch-action by the event handlers if (value == TOUCH_ACTION_COMPUTE) { value = this.compute(); } if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; } this.actions = value.toLowerCase().trim(); }, /** * just re-set the touchAction value */ update: function() { this.set(this.manager.options.touchAction); }, /** * compute the value for the touchAction property based on the recognizer's settings * @returns {String} value */ compute: function() { var actions = []; each(this.manager.recognizers, function(recognizer) { if (boolOrFn(recognizer.options.enable, [recognizer])) { actions = actions.concat(recognizer.getTouchAction()); } }); return cleanTouchActions(actions.join(' ')); }, /** * this method is called on each input cycle and provides the preventing of the browser behavior * @param {Object} input */ preventDefaults: function(input) { var srcEvent = input.srcEvent; var direction = input.offsetDirection; // if the touch action did prevented once this session if (this.manager.session.prevented) { srcEvent.preventDefault(); return; } var actions = this.actions; var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; if (hasNone) { //do not prevent defaults if this is a tap gesture var isTapPointer = input.pointers.length === 1; var isTapMovement = input.distance < 2; var isTapTouchTime = input.deltaTime < 250; if (isTapPointer && isTapMovement && isTapTouchTime) { return; } } if (hasPanX && hasPanY) { // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent return; } if (hasNone || (hasPanY && direction & DIRECTION_HORIZONTAL) || (hasPanX && direction & DIRECTION_VERTICAL)) { return this.preventSrc(srcEvent); } }, /** * call preventDefault to prevent the browser's default behavior (scrolling in most cases) * @param {Object} srcEvent */ preventSrc: function(srcEvent) { this.manager.session.prevented = true; srcEvent.preventDefault(); } }; /** * when the touchActions are collected they are not a valid value, so we need to clean things up. * * @param {String} actions * @returns {*} */ function cleanTouchActions(actions) { // none if (inStr(actions, TOUCH_ACTION_NONE)) { return TOUCH_ACTION_NONE; } var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers // for different directions, e.g. horizontal pan but vertical swipe?) // we need none (as otherwise with pan-x pan-y combined none of these // recognizers will work, since the browser would handle all panning if (hasPanX && hasPanY) { return TOUCH_ACTION_NONE; } // pan-x OR pan-y if (hasPanX || hasPanY) { return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; } // manipulation if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { return TOUCH_ACTION_MANIPULATION; } return TOUCH_ACTION_AUTO; } function getTouchActionProps() { if (!NATIVE_TOUCH_ACTION) { return false; } var touchMap = {}; var cssSupports = window.CSS && window.CSS.supports; ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) { // If css.supports is not supported but there is native touch-action assume it supports // all values. This is the case for IE 10 and 11. touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true; }); return touchMap; } /** * Recognizer flow explained; * * All recognizers have the initial state of POSSIBLE when a input session starts. * The definition of a input session is from the first input until the last input, with all it's movement in it. * * Example session for mouse-input: mousedown -> mousemove -> mouseup * * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed * which determines with state it should be. * * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to * POSSIBLE to give it another change on the next cycle. * * Possible * | * +-----+---------------+ * | | * +-----+-----+ | * | | | * Failed Cancelled | * +-------+------+ * | | * Recognized Began * | * Changed * | * Ended/Recognized */ var STATE_POSSIBLE = 1; var STATE_BEGAN = 2; var STATE_CHANGED = 4; var STATE_ENDED = 8; var STATE_RECOGNIZED = STATE_ENDED; var STATE_CANCELLED = 16; var STATE_FAILED = 32; /** * Recognizer * Every recognizer needs to extend from this class. * @constructor * @param {Object} options */ function Recognizer(options) { this.options = assign({}, this.defaults, options || {}); this.id = uniqueId(); this.manager = null; // default is enable true this.options.enable = ifUndefined(this.options.enable, true); this.state = STATE_POSSIBLE; this.simultaneous = {}; this.requireFail = []; } Recognizer.prototype = { /** * @virtual * @type {Object} */ defaults: {}, /** * set options * @param {Object} options * @return {Recognizer} */ set: function(options) { assign(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state this.manager && this.manager.touchAction.update(); return this; }, /** * recognize simultaneous with an other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ recognizeWith: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { return this; } var simultaneous = this.simultaneous; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); if (!simultaneous[otherRecognizer.id]) { simultaneous[otherRecognizer.id] = otherRecognizer; otherRecognizer.recognizeWith(this); } return this; }, /** * drop the simultaneous link. it doesnt remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ dropRecognizeWith: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { return this; } otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); delete this.simultaneous[otherRecognizer.id]; return this; }, /** * recognizer can only run when an other is failing * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ requireFailure: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { return this; } var requireFail = this.requireFail; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); if (inArray(requireFail, otherRecognizer) === -1) { requireFail.push(otherRecognizer); otherRecognizer.requireFailure(this); } return this; }, /** * drop the requireFailure link. it does not remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ dropRequireFailure: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { return this; } otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); var index = inArray(this.requireFail, otherRecognizer); if (index > -1) { this.requireFail.splice(index, 1); } return this; }, /** * has require failures boolean * @returns {boolean} */ hasRequireFailures: function() { return this.requireFail.length > 0; }, /** * if the recognizer can recognize simultaneous with an other recognizer * @param {Recognizer} otherRecognizer * @returns {Boolean} */ canRecognizeWith: function(otherRecognizer) { return !!this.simultaneous[otherRecognizer.id]; }, /** * You should use `tryEmit` instead of `emit` directly to check * that all the needed recognizers has failed before emitting. * @param {Object} input */ emit: function(input) { var self = this; var state = this.state; function emit(event) { self.manager.emit(event, input); } // 'panstart' and 'panmove' if (state < STATE_ENDED) { emit(self.options.event + stateStr(state)); } emit(self.options.event); // simple 'eventName' events if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...) emit(input.additionalEvent); } // panend and pancancel if (state >= STATE_ENDED) { emit(self.options.event + stateStr(state)); } }, /** * Check that all the require failure recognizers has failed, * if true, it emits a gesture event, * otherwise, setup the state to FAILED. * @param {Object} input */ tryEmit: function(input) { if (this.canEmit()) { return this.emit(input); } // it's failing anyway this.state = STATE_FAILED; }, /** * can we emit? * @returns {boolean} */ canEmit: function() { var i = 0; while (i < this.requireFail.length) { if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { return false; } i++; } return true; }, /** * update the recognizer * @param {Object} inputData */ recognize: function(inputData) { // make a new copy of the inputData // so we can change the inputData without messing up the other recognizers var inputDataClone = assign({}, inputData); // is is enabled and allow recognizing? if (!boolOrFn(this.options.enable, [this, inputDataClone])) { this.reset(); this.state = STATE_FAILED; return; } // reset when we've reached the end if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { this.state = STATE_POSSIBLE; } this.state = this.process(inputDataClone); // the recognizer has recognized a gesture // so trigger an event if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { this.tryEmit(inputDataClone); } }, /** * return the state of the recognizer * the actual recognizing happens in this method * @virtual * @param {Object} inputData * @returns {Const} STATE */ process: function(inputData) { }, // jshint ignore:line /** * return the preferred touch-action * @virtual * @returns {Array} */ getTouchAction: function() { }, /** * called when the gesture isn't allowed to recognize * like when another is being recognized or it is disabled * @virtual */ reset: function() { } }; /** * get a usable string, used as event postfix * @param {Const} state * @returns {String} state */ function stateStr(state) { if (state & STATE_CANCELLED) { return 'cancel'; } else if (state & STATE_ENDED) { return 'end'; } else if (state & STATE_CHANGED) { return 'move'; } else if (state & STATE_BEGAN) { return 'start'; } return ''; } /** * direction cons to string * @param {Const} direction * @returns {String} */ function directionStr(direction) { if (direction == DIRECTION_DOWN) { return 'down'; } else if (direction == DIRECTION_UP) { return 'up'; } else if (direction == DIRECTION_LEFT) { return 'left'; } else if (direction == DIRECTION_RIGHT) { return 'right'; } return ''; } /** * get a recognizer by name if it is bound to a manager * @param {Recognizer|String} otherRecognizer * @param {Recognizer} recognizer * @returns {Recognizer} */ function getRecognizerByNameIfManager(otherRecognizer, recognizer) { var manager = recognizer.manager; if (manager) { return manager.get(otherRecognizer); } return otherRecognizer; } /** * This recognizer is just used as a base for the simple attribute recognizers. * @constructor * @extends Recognizer */ function AttrRecognizer() { Recognizer.apply(this, arguments); } inherit(AttrRecognizer, Recognizer, { /** * @namespace * @memberof AttrRecognizer */ defaults: { /** * @type {Number} * @default 1 */ pointers: 1 }, /** * Used to check if it the recognizer receives valid input, like input.distance > 10. * @memberof AttrRecognizer * @param {Object} input * @returns {Boolean} recognized */ attrTest: function(input) { var optionPointers = this.options.pointers; return optionPointers === 0 || input.pointers.length === optionPointers; }, /** * Process the input and return the state for the recognizer * @memberof AttrRecognizer * @param {Object} input * @returns {*} State */ process: function(input) { var state = this.state; var eventType = input.eventType; var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { return state | STATE_CANCELLED; } else if (isRecognized || isValid) { if (eventType & INPUT_END) { return state | STATE_ENDED; } else if (!(state & STATE_BEGAN)) { return STATE_BEGAN; } return state | STATE_CHANGED; } return STATE_FAILED; } }); /** * Pan * Recognized when the pointer is down and moved in the allowed direction. * @constructor * @extends AttrRecognizer */ function PanRecognizer() { AttrRecognizer.apply(this, arguments); this.pX = null; this.pY = null; } inherit(PanRecognizer, AttrRecognizer, { /** * @namespace * @memberof PanRecognizer */ defaults: { event: 'pan', threshold: 10, pointers: 1, direction: DIRECTION_ALL }, getTouchAction: function() { var direction = this.options.direction; var actions = []; if (direction & DIRECTION_HORIZONTAL) { actions.push(TOUCH_ACTION_PAN_Y); } if (direction & DIRECTION_VERTICAL) { actions.push(TOUCH_ACTION_PAN_X); } return actions; }, directionTest: function(input) { var options = this.options; var hasMoved = true; var distance = input.distance; var direction = input.direction; var x = input.deltaX; var y = input.deltaY; // lock to axis? if (!(direction & options.direction)) { if (options.direction & DIRECTION_HORIZONTAL) { direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; hasMoved = x != this.pX; distance = Math.abs(input.deltaX); } else { direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; hasMoved = y != this.pY; distance = Math.abs(input.deltaY); } } input.direction = direction; return hasMoved && distance > options.threshold && direction & options.direction; }, attrTest: function(input) { return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); }, emit: function(input) { this.pX = input.deltaX; this.pY = input.deltaY; var direction = directionStr(input.direction); if (direction) { input.additionalEvent = this.options.event + direction; } this._super.emit.call(this, input); } }); /** * Pinch * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). * @constructor * @extends AttrRecognizer */ function PinchRecognizer() { AttrRecognizer.apply(this, arguments); } inherit(PinchRecognizer, AttrRecognizer, { /** * @namespace * @memberof PinchRecognizer */ defaults: { event: 'pinch', threshold: 0, pointers: 2 }, getTouchAction: function() { return [TOUCH_ACTION_NONE]; }, attrTest: function(input) { return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); }, emit: function(input) { if (input.scale !== 1) { var inOut = input.scale < 1 ? 'in' : 'out'; input.additionalEvent = this.options.event + inOut; } this._super.emit.call(this, input); } }); /** * Press * Recognized when the pointer is down for x ms without any movement. * @constructor * @extends Recognizer */ function PressRecognizer() { Recognizer.apply(this, arguments); this._timer = null; this._input = null; } inherit(PressRecognizer, Recognizer, { /** * @namespace * @memberof PressRecognizer */ defaults: { event: 'press', pointers: 1, time: 251, // minimal time of the pointer to be pressed threshold: 9 // a minimal movement is ok, but keep it low }, getTouchAction: function() { return [TOUCH_ACTION_AUTO]; }, process: function(input) { var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTime = input.deltaTime > options.time; this._input = input; // we only allow little movement // and we've reached an end event, so a tap is possible if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { this.reset(); } else if (input.eventType & INPUT_START) { this.reset(); this._timer = setTimeoutContext(function() { this.state = STATE_RECOGNIZED; this.tryEmit(); }, options.time, this); } else if (input.eventType & INPUT_END) { return STATE_RECOGNIZED; } return STATE_FAILED; }, reset: function() { clearTimeout(this._timer); }, emit: function(input) { if (this.state !== STATE_RECOGNIZED) { return; } if (input && (input.eventType & INPUT_END)) { this.manager.emit(this.options.event + 'up', input); } else { this._input.timeStamp = now(); this.manager.emit(this.options.event, this._input); } } }); /** * Rotate * Recognized when two or more pointer are moving in a circular motion. * @constructor * @extends AttrRecognizer */ function RotateRecognizer() { AttrRecognizer.apply(this, arguments); } inherit(RotateRecognizer, AttrRecognizer, { /** * @namespace * @memberof RotateRecognizer */ defaults: { event: 'rotate', threshold: 0, pointers: 2 }, getTouchAction: function() { return [TOUCH_ACTION_NONE]; }, attrTest: function(input) { return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); } }); /** * Swipe * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. * @constructor * @extends AttrRecognizer */ function SwipeRecognizer() { AttrRecognizer.apply(this, arguments); } inherit(SwipeRecognizer, AttrRecognizer, { /** * @namespace * @memberof SwipeRecognizer */ defaults: { event: 'swipe', threshold: 10, velocity: 0.3, direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, pointers: 1 }, getTouchAction: function() { return PanRecognizer.prototype.getTouchAction.call(this); }, attrTest: function(input) { var direction = this.options.direction; var velocity; if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { velocity = input.overallVelocity; } else if (direction & DIRECTION_HORIZONTAL) { velocity = input.overallVelocityX; } else if (direction & DIRECTION_VERTICAL) { velocity = input.overallVelocityY; } return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; }, emit: function(input) { var direction = directionStr(input.offsetDirection); if (direction) { this.manager.emit(this.options.event + direction, input); } this.manager.emit(this.options.event, input); } }); /** * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur * between the given interval and position. The delay option can be used to recognize multi-taps without firing * a single tap. * * The eventData from the emitted event contains the property `tapCount`, which contains the amount of * multi-taps being recognized. * @constructor * @extends Recognizer */ function TapRecognizer() { Recognizer.apply(this, arguments); // previous time and center, // used for tap counting this.pTime = false; this.pCenter = false; this._timer = null; this._input = null; this.count = 0; } inherit(TapRecognizer, Recognizer, { /** * @namespace * @memberof PinchRecognizer */ defaults: { event: 'tap', pointers: 1, taps: 1, interval: 300, // max time between the multi-tap taps time: 250, // max time of the pointer to be down (like finger on the screen) threshold: 9, // a minimal movement is ok, but keep it low posThreshold: 10 // a multi-tap can be a bit off the initial position }, getTouchAction: function() { return [TOUCH_ACTION_MANIPULATION]; }, process: function(input) { var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTouchTime = input.deltaTime < options.time; this.reset(); if ((input.eventType & INPUT_START) && (this.count === 0)) { return this.failTimeout(); } // we only allow little movement // and we've reached an end event, so a tap is possible if (validMovement && validTouchTime && validPointers) { if (input.eventType != INPUT_END) { return this.failTimeout(); } var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; this.pTime = input.timeStamp; this.pCenter = input.center; if (!validMultiTap || !validInterval) { this.count = 1; } else { this.count += 1; } this._input = input; // if tap count matches we have recognized it, // else it has began recognizing... var tapCount = this.count % options.taps; if (tapCount === 0) { // no failing requirements, immediately trigger the tap event // or wait as long as the multitap interval to trigger if (!this.hasRequireFailures()) { return STATE_RECOGNIZED; } else { this._timer = setTimeoutContext(function() { this.state = STATE_RECOGNIZED; this.tryEmit(); }, options.interval, this); return STATE_BEGAN; } } } return STATE_FAILED; }, failTimeout: function() { this._timer = setTimeoutContext(function() { this.state = STATE_FAILED; }, this.options.interval, this); return STATE_FAILED; }, reset: function() { clearTimeout(this._timer); }, emit: function() { if (this.state == STATE_RECOGNIZED) { this._input.tapCount = this.count; this.manager.emit(this.options.event, this._input); } } }); /** * Simple way to create a manager with a default set of recognizers. * @param {HTMLElement} element * @param {Object} [options] * @constructor */ function Hammer(element, options) { options = options || {}; options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); return new Manager(element, options); } /** * @const {string} */ Hammer.VERSION = '2.0.7'; /** * default settings * @namespace */ Hammer.defaults = { /** * set if DOM events are being triggered. * But this is slower and unused by simple implementations, so disabled by default. * @type {Boolean} * @default false */ domEvents: false, /** * The value for the touchAction property/fallback. * When set to `compute` it will magically set the correct value based on the added recognizers. * @type {String} * @default compute */ touchAction: TOUCH_ACTION_COMPUTE, /** * @type {Boolean} * @default true */ enable: true, /** * EXPERIMENTAL FEATURE -- can be removed/changed * Change the parent input target element. * If Null, then it is being set the to main element. * @type {Null|EventTarget} * @default null */ inputTarget: null, /** * force an input class * @type {Null|Function} * @default null */ inputClass: null, /** * Default recognizer setup when calling `Hammer()` * When creating a new Manager these will be skipped. * @type {Array} */ preset: [ // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] [RotateRecognizer, {enable: false}], [PinchRecognizer, {enable: false}, ['rotate']], [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}], [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']], [TapRecognizer], [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']], [PressRecognizer] ], /** * Some CSS properties can be used to improve the working of Hammer. * Add them to this method and they will be set when creating a new Manager. * @namespace */ cssProps: { /** * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. * @type {String} * @default 'none' */ userSelect: 'none', /** * Disable the Windows Phone grippers when pressing an element. * @type {String} * @default 'none' */ touchSelect: 'none', /** * Disables the default callout shown when you touch and hold a touch target. * On iOS, when you touch and hold a touch target such as a link, Safari displays * a callout containing information about the link. This property allows you to disable that callout. * @type {String} * @default 'none' */ touchCallout: 'none', /** * Specifies whether zooming is enabled. Used by IE10> * @type {String} * @default 'none' */ contentZooming: 'none', /** * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. * @type {String} * @default 'none' */ userDrag: 'none', /** * Overrides the highlight color shown when the user taps a link or a JavaScript * clickable element in iOS. This property obeys the alpha value, if specified. * @type {String} * @default 'rgba(0,0,0,0)' */ tapHighlightColor: 'rgba(0,0,0,0)' } }; var STOP = 1; var FORCED_STOP = 2; /** * Manager * @param {HTMLElement} element * @param {Object} [options] * @constructor */ function Manager(element, options) { this.options = assign({}, Hammer.defaults, options || {}); this.options.inputTarget = this.options.inputTarget || element; this.handlers = {}; this.session = {}; this.recognizers = []; this.oldCssProps = {}; this.element = element; this.input = createInputInstance(this); this.touchAction = new TouchAction(this, this.options.touchAction); toggleCssProps(this, true); each(this.options.recognizers, function(item) { var recognizer = this.add(new (item[0])(item[1])); item[2] && recognizer.recognizeWith(item[2]); item[3] && recognizer.requireFailure(item[3]); }, this); } Manager.prototype = { /** * set options * @param {Object} options * @returns {Manager} */ set: function(options) { assign(this.options, options); // Options that need a little more setup if (options.touchAction) { this.touchAction.update(); } if (options.inputTarget) { // Clean up existing event listeners and reinitialize this.input.destroy(); this.input.target = options.inputTarget; this.input.init(); } return this; }, /** * stop recognizing for this session. * This session will be discarded, when a new [input]start event is fired. * When forced, the recognizer cycle is stopped immediately. * @param {Boolean} [force] */ stop: function(force) { this.session.stopped = force ? FORCED_STOP : STOP; }, /** * run the recognizers! * called by the inputHandler function on every movement of the pointers (touches) * it walks through all the recognizers and tries to detect the gesture that is being made * @param {Object} inputData */ recognize: function(inputData) { var session = this.session; if (session.stopped) { return; } // run the touch-action polyfill this.touchAction.preventDefaults(inputData); var recognizer; var recognizers = this.recognizers; // this holds the recognizer that is being recognized. // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED // if no recognizer is detecting a thing, it is set to `null` var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized // or when we're in a new session if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { curRecognizer = session.curRecognizer = null; } var i = 0; while (i < recognizers.length) { recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one. // 1. allow if the session is NOT forced stopped (see the .stop() method) // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one // that is being recognized. // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. // this can be setup with the `recognizeWith()` method on the recognizer. if (session.stopped !== FORCED_STOP && ( // 1 !curRecognizer || recognizer == curRecognizer || // 2 recognizer.canRecognizeWith(curRecognizer))) { // 3 recognizer.recognize(inputData); } else { recognizer.reset(); } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the // current active recognizer. but only if we don't already have an active recognizer if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { curRecognizer = session.curRecognizer = recognizer; } i++; } }, /** * get a recognizer by its event name. * @param {Recognizer|String} recognizer * @returns {Recognizer|Null} */ get: function(recognizer) { if (recognizer instanceof Recognizer) { return recognizer; } var recognizers = this.recognizers; for (var i = 0; i < recognizers.length; i++) { if (recognizers[i].options.event == recognizer) { return recognizers[i]; } } return null; }, /** * add a recognizer to the manager * existing recognizers with the same event name will be removed * @param {Recognizer} recognizer * @returns {Recognizer|Manager} */ add: function(recognizer) { if (invokeArrayArg(recognizer, 'add', this)) { return this; } // remove existing var existing = this.get(recognizer.options.event); if (existing) { this.remove(existing); } this.recognizers.push(recognizer); recognizer.manager = this; this.touchAction.update(); return recognizer; }, /** * remove a recognizer by name or instance * @param {Recognizer|String} recognizer * @returns {Manager} */ remove: function(recognizer) { if (invokeArrayArg(recognizer, 'remove', this)) { return this; } recognizer = this.get(recognizer); // let's make sure this recognizer exists if (recognizer) { var recognizers = this.recognizers; var index = inArray(recognizers, recognizer); if (index !== -1) { recognizers.splice(index, 1); this.touchAction.update(); } } return this; }, /** * bind event * @param {String} events * @param {Function} handler * @returns {EventEmitter} this */ on: function(events, handler) { if (events === undefined) { return; } if (handler === undefined) { return; } var handlers = this.handlers; each(splitStr(events), function(event) { handlers[event] = handlers[event] || []; handlers[event].push(handler); }); return this; }, /** * unbind event, leave emit blank to remove all handlers * @param {String} events * @param {Function} [handler] * @returns {EventEmitter} this */ off: function(events, handler) { if (events === undefined) { return; } var handlers = this.handlers; each(splitStr(events), function(event) { if (!handler) { delete handlers[event]; } else { handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); } }); return this; }, /** * emit event to the listeners * @param {String} event * @param {Object} data */ emit: function(event, data) { // we also want to trigger dom events if (this.options.domEvents) { triggerDomEvent(event, data); } // no handlers, so skip it all var handlers = this.handlers[event] && this.handlers[event].slice(); if (!handlers || !handlers.length) { return; } data.type = event; data.preventDefault = function() { data.srcEvent.preventDefault(); }; var i = 0; while (i < handlers.length) { handlers[i](data); i++; } }, /** * destroy the manager and unbinds all events * it doesn't unbind dom events, that is the user own responsibility */ destroy: function() { this.element && toggleCssProps(this, false); this.handlers = {}; this.session = {}; this.input.destroy(); this.element = null; } }; /** * add/remove the css properties as defined in manager.options.cssProps * @param {Manager} manager * @param {Boolean} add */ function toggleCssProps(manager, add) { var element = manager.element; if (!element.style) { return; } var prop; each(manager.options.cssProps, function(value, name) { prop = prefixed(element.style, name); if (add) { manager.oldCssProps[prop] = element.style[prop]; element.style[prop] = value; } else { element.style[prop] = manager.oldCssProps[prop] || ''; } }); if (!add) { manager.oldCssProps = {}; } } /** * trigger dom event * @param {String} event * @param {Object} data */ function triggerDomEvent(event, data) { var gestureEvent = document.createEvent('Event'); gestureEvent.initEvent(event, true, true); gestureEvent.gesture = data; data.target.dispatchEvent(gestureEvent); } assign(Hammer, { INPUT_START: INPUT_START, INPUT_MOVE: INPUT_MOVE, INPUT_END: INPUT_END, INPUT_CANCEL: INPUT_CANCEL, STATE_POSSIBLE: STATE_POSSIBLE, STATE_BEGAN: STATE_BEGAN, STATE_CHANGED: STATE_CHANGED, STATE_ENDED: STATE_ENDED, STATE_RECOGNIZED: STATE_RECOGNIZED, STATE_CANCELLED: STATE_CANCELLED, STATE_FAILED: STATE_FAILED, DIRECTION_NONE: DIRECTION_NONE, DIRECTION_LEFT: DIRECTION_LEFT, DIRECTION_RIGHT: DIRECTION_RIGHT, DIRECTION_UP: DIRECTION_UP, DIRECTION_DOWN: DIRECTION_DOWN, DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, DIRECTION_VERTICAL: DIRECTION_VERTICAL, DIRECTION_ALL: DIRECTION_ALL, Manager: Manager, Input: Input, TouchAction: TouchAction, TouchInput: TouchInput, MouseInput: MouseInput, PointerEventInput: PointerEventInput, TouchMouseInput: TouchMouseInput, SingleTouchInput: SingleTouchInput, Recognizer: Recognizer, AttrRecognizer: AttrRecognizer, Tap: TapRecognizer, Pan: PanRecognizer, Swipe: SwipeRecognizer, Pinch: PinchRecognizer, Rotate: RotateRecognizer, Press: PressRecognizer, on: addEventListeners, off: removeEventListeners, each: each, merge: merge, extend: extend, assign: assign, inherit: inherit, bindFn: bindFn, prefixed: prefixed }); // this prevents errors when Hammer is loaded in the presence of an AMD // style loader but by script tag, not by the loader. var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line freeGlobal.Hammer = Hammer; if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return Hammer; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof module != 'undefined' && module.exports) { module.exports = Hammer; } else { window[exportName] = Hammer; } })(window, document, 'Hammer'); /***/ }), /***/ "../../../../hark/hark.js": /***/ (function(module, exports, __webpack_require__) { var WildEmitter = __webpack_require__("../../../../wildemitter/wildemitter.js"); function getMaxVolume (analyser, fftBins) { var maxVolume = -Infinity; analyser.getFloatFrequencyData(fftBins); for(var i=4, ii=fftBins.length; i < ii; i++) { if (fftBins[i] > maxVolume && fftBins[i] < 0) { maxVolume = fftBins[i]; } }; return maxVolume; } var audioContextType; if (typeof window !== 'undefined') { audioContextType = window.AudioContext || window.webkitAudioContext; } // use a single audio context due to hardware limits var audioContext = null; module.exports = function(stream, options) { var harker = new WildEmitter(); // make it not break in non-supported browsers if (!audioContextType) return harker; //Config var options = options || {}, smoothing = (options.smoothing || 0.1), interval = (options.interval || 50), threshold = options.threshold, play = options.play, history = options.history || 10, running = true; //Setup Audio Context if (!audioContext) { audioContext = new audioContextType(); } var sourceNode, fftBins, analyser; analyser = audioContext.createAnalyser(); analyser.fftSize = 512; analyser.smoothingTimeConstant = smoothing; fftBins = new Float32Array(analyser.frequencyBinCount); if (stream.jquery) stream = stream[0]; if (stream instanceof HTMLAudioElement || stream instanceof HTMLVideoElement) { //Audio Tag sourceNode = audioContext.createMediaElementSource(stream); if (typeof play === 'undefined') play = true; threshold = threshold || -50; } else { //WebRTC Stream sourceNode = audioContext.createMediaStreamSource(stream); threshold = threshold || -50; } sourceNode.connect(analyser); if (play) analyser.connect(audioContext.destination); harker.speaking = false; harker.setThreshold = function(t) { threshold = t; }; harker.setInterval = function(i) { interval = i; }; harker.stop = function() { running = false; harker.emit('volume_change', -100, threshold); if (harker.speaking) { harker.speaking = false; harker.emit('stopped_speaking'); } analyser.disconnect(); sourceNode.disconnect(); }; harker.speakingHistory = []; for (var i = 0; i < history; i++) { harker.speakingHistory.push(0); } // Poll the analyser node to determine if speaking // and emit events if changed var looper = function() { setTimeout(function() { //check if stop has been called if(!running) { return; } var currentVolume = getMaxVolume(analyser, fftBins); harker.emit('volume_change', currentVolume, threshold); var history = 0; if (currentVolume > threshold && !harker.speaking) { // trigger quickly, short history for (var i = harker.speakingHistory.length - 3; i < harker.speakingHistory.length; i++) { history += harker.speakingHistory[i]; } if (history >= 2) { harker.speaking = true; harker.emit('speaking'); } } else if (currentVolume < threshold && harker.speaking) { for (var i = 0; i < harker.speakingHistory.length; i++) { history += harker.speakingHistory[i]; } if (history == 0) { harker.speaking = false; harker.emit('stopped_speaking'); } } harker.speakingHistory.shift(); harker.speakingHistory.push(0 + (currentVolume > threshold)); looper(); }, interval); }; looper(); return harker; } /***/ }), /***/ "../../../../inherits/inherits_browser.js": /***/ (function(module, exports) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor var TempCtor = function () {} TempCtor.prototype = superCtor.prototype ctor.prototype = new TempCtor() ctor.prototype.constructor = ctor } } /***/ }), /***/ "../../../../merge/merge.js": /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {/*! * @name JavaScript/NodeJS Merge v1.2.0 * @author yeikos * @repository https://github.com/yeikos/js.merge * Copyright 2014 yeikos - MIT license * https://raw.github.com/yeikos/js.merge/master/LICENSE */ ;(function(isNode) { /** * Merge one or more objects * @param bool? clone * @param mixed,... arguments * @return object */ var Public = function(clone) { return merge(clone === true, false, arguments); }, publicName = 'merge'; /** * Merge two or more objects recursively * @param bool? clone * @param mixed,... arguments * @return object */ Public.recursive = function(clone) { return merge(clone === true, true, arguments); }; /** * Clone the input removing any reference * @param mixed input * @return mixed */ Public.clone = function(input) { var output = input, type = typeOf(input), index, size; if (type === 'array') { output = []; size = input.length; for (index=0;index 1) { url = parts[1]; parts = parts[0].split(':'); // add the output credential and username output.username = parts[0]; output.credential = (input || {}).credential || parts[1] || ''; } output.url = protocol + url; output.urls = [ output.url ]; return output; }; /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/Mapper.js": /***/ (function(module, exports) { function Mapper() { var sources = {}; this.forEach = function (callback) { for (var key in sources) { var source = sources[key]; for (var key2 in source) callback(source[key2]); } ; }; this.get = function (id, source) { var ids = sources[source]; if (ids == undefined) return undefined; return ids[id]; }; this.remove = function (id, source) { var ids = sources[source]; if (ids == undefined) return; delete ids[id]; // Check it's empty for (var i in ids) { return false; } delete sources[source]; }; this.set = function (value, id, source) { if (value == undefined) return this.remove(id, source); var ids = sources[source]; if (ids == undefined) sources[source] = ids = {}; ids[id] = value; }; } ; Mapper.prototype.pop = function (id, source) { var value = this.get(id, source); if (value == undefined) return undefined; this.remove(id, source); return value; }; module.exports = Mapper; //# sourceMappingURL=Mapper.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/index.js": /***/ (function(module, exports, __webpack_require__) { /* * (C) Copyright 2014 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var JsonRpcClient = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/jsonrpcclient.js"); exports.JsonRpcClient = JsonRpcClient; //# sourceMappingURL=index.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/jsonrpcclient.js": /***/ (function(module, exports, __webpack_require__) { /* * (C) Copyright 2014 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var RpcBuilder = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/index.js"); var WebSocketWithReconnection = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/transports/webSocketWithReconnection.js"); Date.now = Date.now || function () { return +new Date; }; var PING_INTERVAL = 5000; var RECONNECTING = 'RECONNECTING'; var CONNECTED = 'CONNECTED'; var DISCONNECTED = 'DISCONNECTED'; var Logger = console; /** * * heartbeat: interval in ms for each heartbeat message, * sendCloseMessage : true / false, before closing the connection, it sends a closeSession message *
 * ws : {
 * 	uri : URI to conntect to,
 *  useSockJS : true (use SockJS) / false (use WebSocket) by default,
 * 	onconnected : callback method to invoke when connection is successful,
 * 	ondisconnect : callback method to invoke when the connection is lost,
 * 	onreconnecting : callback method to invoke when the client is reconnecting,
 * 	onreconnected : callback method to invoke when the client succesfully reconnects,
 * 	onerror : callback method to invoke when there is an error
 * },
 * rpc : {
 * 	requestTimeout : timeout for a request,
 * 	sessionStatusChanged: callback method for changes in session status,
 * 	mediaRenegotiation: mediaRenegotiation
 * }
 * 
*/ function JsonRpcClient(configuration) { var self = this; var wsConfig = configuration.ws; var notReconnectIfNumLessThan = -1; var pingNextNum = 0; var enabledPings = true; var pingPongStarted = false; var pingInterval; var status = DISCONNECTED; var onreconnecting = wsConfig.onreconnecting; var onreconnected = wsConfig.onreconnected; var onconnected = wsConfig.onconnected; var onerror = wsConfig.onerror; configuration.rpc.pull = function (params, request) { request.reply(null, "push"); }; wsConfig.onreconnecting = function () { Logger.debug("--------- ONRECONNECTING -----------"); if (status === RECONNECTING) { Logger.error("Websocket already in RECONNECTING state when receiving a new ONRECONNECTING message. Ignoring it"); return; } status = RECONNECTING; if (onreconnecting) { onreconnecting(); } }; wsConfig.onreconnected = function () { Logger.debug("--------- ONRECONNECTED -----------"); if (status === CONNECTED) { Logger.error("Websocket already in CONNECTED state when receiving a new ONRECONNECTED message. Ignoring it"); return; } status = CONNECTED; enabledPings = true; updateNotReconnectIfLessThan(); usePing(); if (onreconnected) { onreconnected(); } }; wsConfig.onconnected = function () { Logger.debug("--------- ONCONNECTED -----------"); if (status === CONNECTED) { Logger.error("Websocket already in CONNECTED state when receiving a new ONCONNECTED message. Ignoring it"); return; } status = CONNECTED; enabledPings = true; usePing(); if (onconnected) { onconnected(); } }; wsConfig.onerror = function (error) { Logger.debug("--------- ONERROR -----------"); status = DISCONNECTED; if (onerror) { onerror(error); } }; var ws = new WebSocketWithReconnection(wsConfig); Logger.debug('Connecting websocket to URI: ' + wsConfig.uri); var rpcBuilderOptions = { request_timeout: configuration.rpc.requestTimeout, ping_request_timeout: configuration.rpc.heartbeatRequestTimeout }; var rpc = new RpcBuilder(RpcBuilder.packers.JsonRPC, rpcBuilderOptions, ws, function (request) { Logger.debug('Received request: ' + JSON.stringify(request)); try { var func = configuration.rpc[request.method]; if (func === undefined) { Logger.error("Method " + request.method + " not registered in client"); } else { func(request.params, request); } } catch (err) { Logger.error('Exception processing request: ' + JSON.stringify(request)); Logger.error(err); } }); this.send = function (method, params, callback) { if (method !== 'ping') { Logger.debug('Request: method:' + method + " params:" + JSON.stringify(params)); } var requestTime = Date.now(); rpc.encode(method, params, function (error, result) { if (error) { try { Logger.error("ERROR:" + error.message + " in Request: method:" + method + " params:" + JSON.stringify(params) + " request:" + error.request); if (error.data) { Logger.error("ERROR DATA:" + JSON.stringify(error.data)); } } catch (e) { } error.requestTime = requestTime; } if (callback) { if (result != undefined && result.value !== 'pong') { Logger.debug('Response: ' + JSON.stringify(result)); } callback(error, result); } }); }; function updateNotReconnectIfLessThan() { Logger.debug("notReconnectIfNumLessThan = " + pingNextNum + ' (old=' + notReconnectIfNumLessThan + ')'); notReconnectIfNumLessThan = pingNextNum; } function sendPing() { if (enabledPings) { var params = null; if (pingNextNum == 0 || pingNextNum == notReconnectIfNumLessThan) { params = { interval: configuration.heartbeat || PING_INTERVAL }; } pingNextNum++; self.send('ping', params, (function (pingNum) { return function (error, result) { if (error) { Logger.debug("Error in ping request #" + pingNum + " (" + error.message + ")"); if (pingNum > notReconnectIfNumLessThan) { enabledPings = false; updateNotReconnectIfLessThan(); Logger.debug("Server did not respond to ping message #" + pingNum + ". Reconnecting... "); ws.reconnectWs(); } } }; })(pingNextNum)); } else { Logger.debug("Trying to send ping, but ping is not enabled"); } } /* * If configuration.hearbeat has any value, the ping-pong will work with the interval * of configuration.hearbeat */ function usePing() { if (!pingPongStarted) { Logger.debug("Starting ping (if configured)"); pingPongStarted = true; if (configuration.heartbeat != undefined) { pingInterval = setInterval(sendPing, configuration.heartbeat); sendPing(); } } } this.close = function () { Logger.debug("Closing jsonRpcClient explicitly by client"); if (pingInterval != undefined) { Logger.debug("Clearing ping interval"); clearInterval(pingInterval); } pingPongStarted = false; enabledPings = false; if (configuration.sendCloseMessage) { Logger.debug("Sending close message"); this.send('closeSession', null, function (error, result) { if (error) { Logger.error("Error sending close message: " + JSON.stringify(error)); } ws.close(); }); } else { ws.close(); } }; // This method is only for testing this.forceClose = function (millis) { ws.forceClose(millis); }; this.reconnect = function () { ws.reconnectWs(); }; } module.exports = JsonRpcClient; //# sourceMappingURL=jsonrpcclient.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/transports/index.js": /***/ (function(module, exports, __webpack_require__) { /* * (C) Copyright 2014 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var WebSocketWithReconnection = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/transports/webSocketWithReconnection.js"); exports.WebSocketWithReconnection = WebSocketWithReconnection; //# sourceMappingURL=index.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/transports/webSocketWithReconnection.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* * (C) Copyright 2013-2015 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var BrowserWebSocket = global.WebSocket || global.MozWebSocket; var Logger = console; /** * Get either the `WebSocket` or `MozWebSocket` globals * in the browser or try to resolve WebSocket-compatible * interface exposed by `ws` for Node-like environment. */ /*var WebSocket = BrowserWebSocket; if (!WebSocket && typeof window === 'undefined') { try { WebSocket = require('ws'); } catch (e) { } }*/ //var SockJS = require('sockjs-client'); var MAX_RETRIES = 2000; // Forever... var RETRY_TIME_MS = 3000; // FIXME: Implement exponential wait times... var CONNECTING = 0; var OPEN = 1; var CLOSING = 2; var CLOSED = 3; /* config = { uri : wsUri, useSockJS : true (use SockJS) / false (use WebSocket) by default, onconnected : callback method to invoke when connection is successful, ondisconnect : callback method to invoke when the connection is lost, onreconnecting : callback method to invoke when the client is reconnecting, onreconnected : callback method to invoke when the client succesfully reconnects, }; */ function WebSocketWithReconnection(config) { var closing = false; var registerMessageHandler; var wsUri = config.uri; var useSockJS = config.useSockJS; var reconnecting = false; var forcingDisconnection = false; var ws; if (useSockJS) { ws = new SockJS(wsUri); } else { ws = new WebSocket(wsUri); } ws.onopen = function () { logConnected(ws, wsUri); if (config.onconnected) { config.onconnected(); } }; ws.onerror = function (error) { Logger.error("Could not connect to " + wsUri + " (invoking onerror if defined)", error); if (config.onerror) { config.onerror(error); } }; function logConnected(ws, wsUri) { try { Logger.debug("WebSocket connected to " + wsUri); } catch (e) { Logger.error(e); } } var reconnectionOnClose = function () { if (ws.readyState === CLOSED) { if (closing) { Logger.debug("Connection closed by user"); } else { Logger.debug("Connection closed unexpectecly. Reconnecting..."); reconnectToSameUri(MAX_RETRIES, 1); } } else { Logger.debug("Close callback from previous websocket. Ignoring it"); } }; ws.onclose = reconnectionOnClose; function reconnectToSameUri(maxRetries, numRetries) { Logger.debug("reconnectToSameUri (attempt #" + numRetries + ", max=" + maxRetries + ")"); if (numRetries === 1) { if (reconnecting) { Logger.warn("Trying to reconnectToNewUri when reconnecting... Ignoring this reconnection."); return; } else { reconnecting = true; } if (config.onreconnecting) { config.onreconnecting(); } } if (forcingDisconnection) { reconnectToNewUri(maxRetries, numRetries, wsUri); } else { if (config.newWsUriOnReconnection) { config.newWsUriOnReconnection(function (error, newWsUri) { if (error) { Logger.debug(error); setTimeout(function () { reconnectToSameUri(maxRetries, numRetries + 1); }, RETRY_TIME_MS); } else { reconnectToNewUri(maxRetries, numRetries, newWsUri); } }); } else { reconnectToNewUri(maxRetries, numRetries, wsUri); } } } // TODO Test retries. How to force not connection? function reconnectToNewUri(maxRetries, numRetries, reconnectWsUri) { Logger.debug("Reconnection attempt #" + numRetries); ws.close(); wsUri = reconnectWsUri || wsUri; var newWs; if (useSockJS) { newWs = new SockJS(wsUri); } else { newWs = new WebSocket(wsUri); } newWs.onopen = function () { Logger.debug("Reconnected after " + numRetries + " attempts..."); logConnected(newWs, wsUri); reconnecting = false; registerMessageHandler(); if (config.onreconnected()) { config.onreconnected(); } newWs.onclose = reconnectionOnClose; }; var onErrorOrClose = function (error) { Logger.warn("Reconnection error: ", error); if (numRetries === maxRetries) { if (config.ondisconnect) { config.ondisconnect(); } } else { setTimeout(function () { reconnectToSameUri(maxRetries, numRetries + 1); }, RETRY_TIME_MS); } }; newWs.onerror = onErrorOrClose; ws = newWs; } this.close = function () { closing = true; ws.close(); }; // This method is only for testing this.forceClose = function (millis) { Logger.debug("Testing: Force WebSocket close"); if (millis) { Logger.debug("Testing: Change wsUri for " + millis + " millis to simulate net failure"); var goodWsUri = wsUri; wsUri = "wss://21.234.12.34.4:443/"; forcingDisconnection = true; setTimeout(function () { Logger.debug("Testing: Recover good wsUri " + goodWsUri); wsUri = goodWsUri; forcingDisconnection = false; }, millis); } ws.close(); }; this.reconnectWs = function () { Logger.debug("reconnectWs"); reconnectToSameUri(MAX_RETRIES, 1, wsUri); }; this.send = function (message) { ws.send(message); }; this.addEventListener = function (type, callback) { registerMessageHandler = function () { ws.addEventListener(type, callback); }; registerMessageHandler(); }; } module.exports = WebSocketWithReconnection; //# sourceMappingURL=webSocketWithReconnection.js.map /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../../../../webpack/buildin/global.js"))) /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/index.js": /***/ (function(module, exports, __webpack_require__) { /* * (C) Copyright 2014 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var defineProperty_IE8 = false; if (Object.defineProperty) { try { Object.defineProperty({}, "x", {}); } catch (e) { defineProperty_IE8 = true; } } // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () { }, fBound = function () { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } var EventEmitter = __webpack_require__("../../../../events/events.js").EventEmitter; var inherits = __webpack_require__("../../../../inherits/inherits_browser.js"); var packers = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/packers/index.js"); var Mapper = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/Mapper.js"); var BASE_TIMEOUT = 5000; function unifyResponseMethods(responseMethods) { if (!responseMethods) return {}; for (var key in responseMethods) { var value = responseMethods[key]; if (typeof value == 'string') responseMethods[key] = { response: value }; } ; return responseMethods; } ; function unifyTransport(transport) { if (!transport) return; // Transport as a function if (transport instanceof Function) return { send: transport }; // WebSocket & DataChannel if (transport.send instanceof Function) return transport; // Message API (Inter-window & WebWorker) if (transport.postMessage instanceof Function) { transport.send = transport.postMessage; return transport; } // Stream API if (transport.write instanceof Function) { transport.send = transport.write; return transport; } // Transports that only can receive messages, but not send if (transport.onmessage !== undefined) return; if (transport.pause instanceof Function) return; throw new SyntaxError("Transport is not a function nor a valid object"); } ; /** * Representation of a RPC notification * * @class * * @constructor * * @param {String} method -method of the notification * @param params - parameters of the notification */ function RpcNotification(method, params) { if (defineProperty_IE8) { this.method = method; this.params = params; } else { Object.defineProperty(this, 'method', { value: method, enumerable: true }); Object.defineProperty(this, 'params', { value: params, enumerable: true }); } } ; /** * @class * * @constructor * * @param {object} packer * * @param {object} [options] * * @param {object} [transport] * * @param {Function} [onRequest] */ function RpcBuilder(packer, options, transport, onRequest) { var self = this; if (!packer) throw new SyntaxError('Packer is not defined'); if (!packer.pack || !packer.unpack) throw new SyntaxError('Packer is invalid'); var responseMethods = unifyResponseMethods(packer.responseMethods); if (options instanceof Function) { if (transport != undefined) throw new SyntaxError("There can't be parameters after onRequest"); onRequest = options; transport = undefined; options = undefined; } ; if (options && options.send instanceof Function) { if (transport && !(transport instanceof Function)) throw new SyntaxError("Only a function can be after transport"); onRequest = transport; transport = options; options = undefined; } ; if (transport instanceof Function) { if (onRequest != undefined) throw new SyntaxError("There can't be parameters after onRequest"); onRequest = transport; transport = undefined; } ; if (transport && transport.send instanceof Function) if (onRequest && !(onRequest instanceof Function)) throw new SyntaxError("Only a function can be after transport"); options = options || {}; EventEmitter.call(this); if (onRequest) this.on('request', onRequest); if (defineProperty_IE8) this.peerID = options.peerID; else Object.defineProperty(this, 'peerID', { value: options.peerID }); var max_retries = options.max_retries || 0; function transportMessage(event) { self.decode(event.data || event); } ; this.getTransport = function () { return transport; }; this.setTransport = function (value) { // Remove listener from old transport if (transport) { // W3C transports if (transport.removeEventListener) transport.removeEventListener('message', transportMessage); else if (transport.removeListener) transport.removeListener('data', transportMessage); } ; // Set listener on new transport if (value) { // W3C transports if (value.addEventListener) value.addEventListener('message', transportMessage); else if (value.addListener) value.addListener('data', transportMessage); } ; transport = unifyTransport(value); }; if (!defineProperty_IE8) Object.defineProperty(this, 'transport', { get: this.getTransport.bind(this), set: this.setTransport.bind(this) }); this.setTransport(transport); var request_timeout = options.request_timeout || BASE_TIMEOUT; var ping_request_timeout = options.ping_request_timeout || request_timeout; var response_timeout = options.response_timeout || BASE_TIMEOUT; var duplicates_timeout = options.duplicates_timeout || BASE_TIMEOUT; var requestID = 0; var requests = new Mapper(); var responses = new Mapper(); var processedResponses = new Mapper(); var message2Key = {}; /** * Store the response to prevent to process duplicate request later */ function storeResponse(message, id, dest) { var response = { message: message, /** Timeout to auto-clean old responses */ timeout: setTimeout(function () { responses.remove(id, dest); }, response_timeout) }; responses.set(response, id, dest); } ; /** * Store the response to ignore duplicated messages later */ function storeProcessedResponse(ack, from) { var timeout = setTimeout(function () { processedResponses.remove(ack, from); }, duplicates_timeout); processedResponses.set(timeout, ack, from); } ; /** * Representation of a RPC request * * @class * @extends RpcNotification * * @constructor * * @param {String} method -method of the notification * @param params - parameters of the notification * @param {Integer} id - identifier of the request * @param [from] - source of the notification */ function RpcRequest(method, params, id, from, transport) { RpcNotification.call(this, method, params); this.getTransport = function () { return transport; }; this.setTransport = function (value) { transport = unifyTransport(value); }; if (!defineProperty_IE8) Object.defineProperty(this, 'transport', { get: this.getTransport.bind(this), set: this.setTransport.bind(this) }); var response = responses.get(id, from); /** * @constant {Boolean} duplicated */ if (!(transport || self.getTransport())) { if (defineProperty_IE8) this.duplicated = Boolean(response); else Object.defineProperty(this, 'duplicated', { value: Boolean(response) }); } var responseMethod = responseMethods[method]; this.pack = packer.pack.bind(packer, this, id); /** * Generate a response to this request * * @param {Error} [error] * @param {*} [result] * * @returns {string} */ this.reply = function (error, result, transport) { // Fix optional parameters if (error instanceof Function || error && error.send instanceof Function) { if (result != undefined) throw new SyntaxError("There can't be parameters after callback"); transport = error; result = null; error = undefined; } else if (result instanceof Function || result && result.send instanceof Function) { if (transport != undefined) throw new SyntaxError("There can't be parameters after callback"); transport = result; result = null; } ; transport = unifyTransport(transport); // Duplicated request, remove old response timeout if (response) clearTimeout(response.timeout); if (from != undefined) { if (error) error.dest = from; if (result) result.dest = from; } ; var message; // New request or overriden one, create new response with provided data if (error || result != undefined) { if (self.peerID != undefined) { if (error) error.from = self.peerID; else result.from = self.peerID; } // Protocol indicates that responses has own request methods if (responseMethod) { if (responseMethod.error == undefined && error) message = { error: error }; else { var method = error ? responseMethod.error : responseMethod.response; message = { method: method, params: error || result }; } } else message = { error: error, result: result }; message = packer.pack(message, id); } else if (response) message = response.message; else message = packer.pack({ result: null }, id); // Store the response to prevent to process a duplicated request later storeResponse(message, id, from); // Return the stored response so it can be directly send back transport = transport || this.getTransport() || self.getTransport(); if (transport) return transport.send(message); return message; }; } ; inherits(RpcRequest, RpcNotification); function cancel(message) { var key = message2Key[message]; if (!key) return; delete message2Key[message]; var request = requests.pop(key.id, key.dest); if (!request) return; clearTimeout(request.timeout); // Start duplicated responses timeout storeProcessedResponse(key.id, key.dest); } ; /** * Allow to cancel a request and don't wait for a response * * If `message` is not given, cancel all the request */ this.cancel = function (message) { if (message) return cancel(message); for (var message in message2Key) cancel(message); }; this.close = function () { // Prevent to receive new messages var transport = this.getTransport(); if (transport && transport.close) transport.close(); // Request & processed responses this.cancel(); processedResponses.forEach(clearTimeout); // Responses responses.forEach(function (response) { clearTimeout(response.timeout); }); }; /** * Generates and encode a JsonRPC 2.0 message * * @param {String} method -method of the notification * @param params - parameters of the notification * @param [dest] - destination of the notification * @param {object} [transport] - transport where to send the message * @param [callback] - function called when a response to this request is * received. If not defined, a notification will be send instead * * @returns {string} A raw JsonRPC 2.0 request or notification string */ this.encode = function (method, params, dest, transport, callback) { // Fix optional parameters if (params instanceof Function) { if (dest != undefined) throw new SyntaxError("There can't be parameters after callback"); callback = params; transport = undefined; dest = undefined; params = undefined; } else if (dest instanceof Function) { if (transport != undefined) throw new SyntaxError("There can't be parameters after callback"); callback = dest; transport = undefined; dest = undefined; } else if (transport instanceof Function) { if (callback != undefined) throw new SyntaxError("There can't be parameters after callback"); callback = transport; transport = undefined; } ; if (self.peerID != undefined) { params = params || {}; params.from = self.peerID; } ; if (dest != undefined) { params = params || {}; params.dest = dest; } ; // Encode message var message = { method: method, params: params }; if (callback) { var id = requestID++; var retried = 0; message = packer.pack(message, id); function dispatchCallback(error, result) { self.cancel(message); callback(error, result); } ; var request = { message: message, callback: dispatchCallback, responseMethods: responseMethods[method] || {} }; var encode_transport = unifyTransport(transport); function sendRequest(transport) { var rt = (method === 'ping' ? ping_request_timeout : request_timeout); request.timeout = setTimeout(timeout, rt * Math.pow(2, retried++)); message2Key[message] = { id: id, dest: dest }; requests.set(request, id, dest); transport = transport || encode_transport || self.getTransport(); if (transport) return transport.send(message); return message; } ; function retry(transport) { transport = unifyTransport(transport); console.warn(retried + ' retry for request message:', message); var timeout = processedResponses.pop(id, dest); clearTimeout(timeout); return sendRequest(transport); } ; function timeout() { if (retried < max_retries) return retry(transport); var error = new Error('Request has timed out'); error.request = message; error.retry = retry; dispatchCallback(error); } ; return sendRequest(transport); } ; // Return the packed message message = packer.pack(message); transport = transport || this.getTransport(); if (transport) return transport.send(message); return message; }; /** * Decode and process a JsonRPC 2.0 message * * @param {string} message - string with the content of the message * * @returns {RpcNotification|RpcRequest|undefined} - the representation of the * notification or the request. If a response was processed, it will return * `undefined` to notify that it was processed * * @throws {TypeError} - Message is not defined */ this.decode = function (message, transport) { if (!message) throw new TypeError("Message is not defined"); try { message = packer.unpack(message); } catch (e) { // Ignore invalid messages return console.debug(e, message); } ; var id = message.id; var ack = message.ack; var method = message.method; var params = message.params || {}; var from = params.from; var dest = params.dest; // Ignore messages send by us if (self.peerID != undefined && from == self.peerID) return; // Notification if (id == undefined && ack == undefined) { var notification = new RpcNotification(method, params); if (self.emit('request', notification)) return; return notification; } ; function processRequest() { // If we have a transport and it's a duplicated request, reply inmediatly transport = unifyTransport(transport) || self.getTransport(); if (transport) { var response = responses.get(id, from); if (response) return transport.send(response.message); } ; var idAck = (id != undefined) ? id : ack; var request = new RpcRequest(method, params, idAck, from, transport); if (self.emit('request', request)) return; return request; } ; function processResponse(request, error, result) { request.callback(error, result); } ; function duplicatedResponse(timeout) { console.warn("Response already processed", message); // Update duplicated responses timeout clearTimeout(timeout); storeProcessedResponse(ack, from); } ; // Request, or response with own method if (method) { // Check if it's a response with own method if (dest == undefined || dest == self.peerID) { var request = requests.get(ack, from); if (request) { var responseMethods = request.responseMethods; if (method == responseMethods.error) return processResponse(request, params); if (method == responseMethods.response) return processResponse(request, null, params); return processRequest(); } var processed = processedResponses.get(ack, from); if (processed) return duplicatedResponse(processed); } // Request return processRequest(); } ; var error = message.error; var result = message.result; // Ignore responses not send to us if (error && error.dest && error.dest != self.peerID) return; if (result && result.dest && result.dest != self.peerID) return; // Response var request = requests.get(ack, from); if (!request) { var processed = processedResponses.get(ack, from); if (processed) return duplicatedResponse(processed); return console.warn("No callback was defined for this message", message); } ; // Process response processResponse(request, error, result); }; } ; inherits(RpcBuilder, EventEmitter); RpcBuilder.RpcNotification = RpcNotification; module.exports = RpcBuilder; var clients = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/index.js"); var transports = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/clients/transports/index.js"); RpcBuilder.clients = clients; RpcBuilder.clients.transports = transports; RpcBuilder.packers = packers; //# sourceMappingURL=index.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/packers/JsonRPC.js": /***/ (function(module, exports) { /** * JsonRPC 2.0 packer */ /** * Pack a JsonRPC 2.0 message * * @param {Object} message - object to be packaged. It requires to have all the * fields needed by the JsonRPC 2.0 message that it's going to be generated * * @return {String} - the stringified JsonRPC 2.0 message */ function pack(message, id) { var result = { jsonrpc: "2.0" }; // Request if (message.method) { result.method = message.method; if (message.params) result.params = message.params; // Request is a notification if (id != undefined) result.id = id; } else if (id != undefined) { if (message.error) { if (message.result !== undefined) throw new TypeError("Both result and error are defined"); result.error = message.error; } else if (message.result !== undefined) result.result = message.result; else throw new TypeError("No result or error is defined"); result.id = id; } ; return JSON.stringify(result); } ; /** * Unpack a JsonRPC 2.0 message * * @param {String} message - string with the content of the JsonRPC 2.0 message * * @throws {TypeError} - Invalid JsonRPC version * * @return {Object} - object filled with the JsonRPC 2.0 message content */ function unpack(message) { var result = message; if (typeof message === 'string' || message instanceof String) { result = JSON.parse(message); } // Check if it's a valid message var version = result.jsonrpc; if (version !== '2.0') throw new TypeError("Invalid JsonRPC version '" + version + "': " + message); // Response if (result.method == undefined) { if (result.id == undefined) throw new TypeError("Invalid message: " + message); var result_defined = result.result !== undefined; var error_defined = result.error !== undefined; // Check only result or error is defined, not both or none if (result_defined && error_defined) throw new TypeError("Both result and error are defined: " + message); if (!result_defined && !error_defined) throw new TypeError("No result or error is defined: " + message); result.ack = result.id; delete result.id; } // Return unpacked message return result; } ; exports.pack = pack; exports.unpack = unpack; //# sourceMappingURL=JsonRPC.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/packers/XmlRPC.js": /***/ (function(module, exports) { function pack(message) { throw new TypeError("Not yet implemented"); } ; function unpack(message) { throw new TypeError("Not yet implemented"); } ; exports.pack = pack; exports.unpack = unpack; //# sourceMappingURL=XmlRPC.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/packers/index.js": /***/ (function(module, exports, __webpack_require__) { var JsonRPC = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/packers/JsonRPC.js"); var XmlRPC = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/packers/XmlRPC.js"); exports.JsonRPC = JsonRPC; exports.XmlRPC = XmlRPC; //# sourceMappingURL=index.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-utils-js/WebRtcPeer.js": /***/ (function(module, exports, __webpack_require__) { /* * (C) Copyright 2014-2015 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var freeice = __webpack_require__("../../../../freeice/index.js"); var inherits = __webpack_require__("../../../../inherits/inherits_browser.js"); var UAParser = __webpack_require__("../../../../ua-parser-js/src/ua-parser.js"); var uuid = __webpack_require__("../../../../uuid/index.js"); var hark = __webpack_require__("../../../../hark/hark.js"); var EventEmitter = __webpack_require__("../../../../events/events.js").EventEmitter; var recursive = __webpack_require__("../../../../merge/merge.js").recursive.bind(undefined, true); var sdpTranslator = __webpack_require__("../../../../sdp-translator/lib/index.js"); var logger = window.Logger || console; // var gUM = navigator.mediaDevices.getUserMedia || function (constraints) { // return new Promise(navigator.getUserMedia(constraints, function (stream) { // videoStream = stream // start() // }).eror(callback)); // } /*try { require('kurento-browser-extensions') } catch (error) { if (typeof getScreenConstraints === 'undefined') { logger.warn('screen sharing is not available') getScreenConstraints = function getScreenConstraints(sendSource, callback) { callback(new Error("This library is not enabled for screen sharing")) } } }*/ var MEDIA_CONSTRAINTS = { audio: true, video: { width: 640, framerate: 15 } }; // Somehow, the UAParser constructor gets an empty window object. // We need to pass the user agent string in order to get information var ua = (window && window.navigator) ? window.navigator.userAgent : ''; var parser = new UAParser(ua); var browser = parser.getBrowser(); var usePlanB = false; if (browser.name === 'Chrome' || browser.name === 'Chromium') { logger.debug(browser.name + ": using SDP PlanB"); usePlanB = true; } function noop(error) { if (error) logger.error(error); } function trackStop(track) { track.stop && track.stop(); } function streamStop(stream) { stream.getTracks().forEach(trackStop); } /** * Returns a string representation of a SessionDescription object. */ var dumpSDP = function (description) { if (typeof description === 'undefined' || description === null) { return ''; } return 'type: ' + description.type + '\r\n' + description.sdp; }; function bufferizeCandidates(pc, onerror) { var candidatesQueue = []; pc.addEventListener('signalingstatechange', function () { if (this.signalingState === 'stable') { while (candidatesQueue.length) { var entry = candidatesQueue.shift(); this.addIceCandidate(entry.candidate, entry.callback, entry.callback); } } }); return function (candidate, callback) { callback = callback || onerror; switch (pc.signalingState) { case 'closed': callback(new Error('PeerConnection object is closed')); break; case 'stable': if (pc.remoteDescription) { pc.addIceCandidate(candidate, callback, callback); } break; default: candidatesQueue.push({ candidate: candidate, callback: callback }); } }; } /* Simulcast utilities */ function removeFIDFromOffer(sdp) { var n = sdp.indexOf("a=ssrc-group:FID"); if (n > 0) { return sdp.slice(0, n); } else { return sdp; } } function getSimulcastInfo(videoStream) { var videoTracks = videoStream.getVideoTracks(); if (!videoTracks.length) { logger.warn('No video tracks available in the video stream'); return ''; } var lines = [ 'a=x-google-flag:conference', 'a=ssrc-group:SIM 1 2 3', 'a=ssrc:1 cname:localVideo', 'a=ssrc:1 msid:' + videoStream.id + ' ' + videoTracks[0].id, 'a=ssrc:1 mslabel:' + videoStream.id, 'a=ssrc:1 label:' + videoTracks[0].id, 'a=ssrc:2 cname:localVideo', 'a=ssrc:2 msid:' + videoStream.id + ' ' + videoTracks[0].id, 'a=ssrc:2 mslabel:' + videoStream.id, 'a=ssrc:2 label:' + videoTracks[0].id, 'a=ssrc:3 cname:localVideo', 'a=ssrc:3 msid:' + videoStream.id + ' ' + videoTracks[0].id, 'a=ssrc:3 mslabel:' + videoStream.id, 'a=ssrc:3 label:' + videoTracks[0].id ]; lines.push(''); return lines.join('\n'); } /** * Wrapper object of an RTCPeerConnection. This object is aimed to simplify the * development of WebRTC-based applications. * * @constructor module:kurentoUtils.WebRtcPeer * * @param {String} mode Mode in which the PeerConnection will be configured. * Valid values are: 'recv', 'send', and 'sendRecv' * @param localVideo Video tag for the local stream * @param remoteVideo Video tag for the remote stream * @param {MediaStream} videoStream Stream to be used as primary source * (typically video and audio, or only video if combined with audioStream) for * localVideo and to be added as stream to the RTCPeerConnection * @param {MediaStream} audioStream Stream to be used as second source * (typically for audio) for localVideo and to be added as stream to the * RTCPeerConnection */ function WebRtcPeer(mode, options, callback) { if (!(this instanceof WebRtcPeer)) { return new WebRtcPeer(mode, options, callback); } WebRtcPeer.super_.call(this); if (options instanceof Function) { callback = options; options = undefined; } options = options || {}; callback = (callback || noop).bind(this); var self = this; var localVideo = options.localVideo; var remoteVideo = options.remoteVideo; var videoStream = options.videoStream; var audioStream = options.audioStream; var mediaConstraints = options.mediaConstraints; var connectionConstraints = options.connectionConstraints; var pc = options.peerConnection; var sendSource = options.sendSource || 'webcam'; var dataChannelConfig = options.dataChannelConfig; var useDataChannels = options.dataChannels || false; var dataChannel; var guid = uuid.v4(); var configuration = recursive({ iceServers: freeice() }, options.configuration); var onicecandidate = options.onicecandidate; if (onicecandidate) this.on('icecandidate', onicecandidate); var oncandidategatheringdone = options.oncandidategatheringdone; if (oncandidategatheringdone) { this.on('candidategatheringdone', oncandidategatheringdone); } var simulcast = options.simulcast; var multistream = options.multistream; var interop = new sdpTranslator.Interop(); var candidatesQueueOut = []; var candidategatheringdone = false; Object.defineProperties(this, { 'peerConnection': { get: function () { return pc; } }, 'id': { value: options.id || guid, writable: false }, 'remoteVideo': { get: function () { return remoteVideo; } }, 'localVideo': { get: function () { return localVideo; } }, 'dataChannel': { get: function () { return dataChannel; } }, /** * @member {(external:ImageData|undefined)} currentFrame */ 'currentFrame': { get: function () { // [ToDo] Find solution when we have a remote stream but we didn't set // a remoteVideo tag if (!remoteVideo) return; if (remoteVideo.readyState < remoteVideo.HAVE_CURRENT_DATA) throw new Error('No video stream data available'); var canvas = document.createElement('canvas'); canvas.width = remoteVideo.videoWidth; canvas.height = remoteVideo.videoHeight; canvas.getContext('2d').drawImage(remoteVideo, 0, 0); return canvas; } } }); // Init PeerConnection if (!pc) { pc = new RTCPeerConnection(configuration); if (useDataChannels && !dataChannel) { var dcId = 'WebRtcPeer-' + self.id; var dcOptions = undefined; if (dataChannelConfig) { dcId = dataChannelConfig.id || dcId; dcOptions = dataChannelConfig.options; } dataChannel = pc.createDataChannel(dcId, dcOptions); if (dataChannelConfig) { dataChannel.onopen = dataChannelConfig.onopen; dataChannel.onclose = dataChannelConfig.onclose; dataChannel.onmessage = dataChannelConfig.onmessage; dataChannel.onbufferedamountlow = dataChannelConfig.onbufferedamountlow; dataChannel.onerror = dataChannelConfig.onerror || noop; } } } pc.addEventListener('icecandidate', function (event) { var candidate = event.candidate; if (EventEmitter.listenerCount(self, 'icecandidate') || EventEmitter.listenerCount(self, 'candidategatheringdone')) { if (candidate) { var cand; if (multistream && usePlanB) { cand = interop.candidateToUnifiedPlan(candidate); } else { cand = candidate; } self.emit('icecandidate', cand); candidategatheringdone = false; } else if (!candidategatheringdone) { self.emit('candidategatheringdone'); candidategatheringdone = true; } } else if (!candidategatheringdone) { // Not listening to 'icecandidate' or 'candidategatheringdone' events, queue // the candidate until one of them is listened candidatesQueueOut.push(candidate); if (!candidate) candidategatheringdone = true; } }); pc.ontrack = options.onaddstream; pc.onnegotiationneeded = options.onnegotiationneeded; this.on('newListener', function (event, listener) { if (event === 'icecandidate' || event === 'candidategatheringdone') { while (candidatesQueueOut.length) { var candidate = candidatesQueueOut.shift(); if (!candidate === (event === 'candidategatheringdone')) { listener(candidate); } } } }); var addIceCandidate = bufferizeCandidates(pc); /** * Callback function invoked when an ICE candidate is received. Developers are * expected to invoke this function in order to complete the SDP negotiation. * * @function module:kurentoUtils.WebRtcPeer.prototype.addIceCandidate * * @param iceCandidate - Literal object with the ICE candidate description * @param callback - Called when the ICE candidate has been added. */ this.addIceCandidate = function (iceCandidate, callback) { var candidate; if (multistream && usePlanB) { candidate = interop.candidateToPlanB(iceCandidate); } else { candidate = new RTCIceCandidate(iceCandidate); } logger.debug('Remote ICE candidate received', iceCandidate); callback = (callback || noop).bind(this); addIceCandidate(candidate, callback); }; this.generateOffer = function (callback) { callback = callback.bind(this); var offerAudio = true; var offerVideo = true; // Constraints must have both blocks if (mediaConstraints) { offerAudio = (typeof mediaConstraints.audio === 'boolean') ? mediaConstraints.audio : true; offerVideo = (typeof mediaConstraints.video === 'boolean') ? mediaConstraints.video : true; } var browserDependantConstraints = { offerToReceiveAudio: (mode !== 'sendonly' && offerAudio), offerToReceiveVideo: (mode !== 'sendonly' && offerVideo) }; //FIXME: clarify possible constraints passed to createOffer() /*var constraints = recursive(browserDependantConstraints, connectionConstraints)*/ var constraints = browserDependantConstraints; logger.debug('constraints: ' + JSON.stringify(constraints)); pc.createOffer(constraints).then(function (offer) { logger.debug('Created SDP offer'); offer = mangleSdpToAddSimulcast(offer); return pc.setLocalDescription(offer); }).then(function () { var localDescription = pc.localDescription; logger.debug('Local description set', localDescription.sdp); if (multistream && usePlanB) { localDescription = interop.toUnifiedPlan(localDescription); logger.debug('offer::origPlanB->UnifiedPlan', dumpSDP(localDescription)); } callback(null, localDescription.sdp, self.processAnswer.bind(self)); }).catch(callback); }; this.getLocalSessionDescriptor = function () { return pc.localDescription; }; this.getRemoteSessionDescriptor = function () { return pc.remoteDescription; }; function setRemoteVideo() { if (remoteVideo) { var stream = pc.getRemoteStreams()[0]; var url = stream ? URL.createObjectURL(stream) : ''; remoteVideo.pause(); remoteVideo.src = url; remoteVideo.load(); logger.debug('Remote URL:', url); } } this.showLocalVideo = function () { localVideo.src = URL.createObjectURL(videoStream); localVideo.muted = true; }; this.send = function (data) { if (dataChannel && dataChannel.readyState === 'open') { dataChannel.send(data); } else { logger.warn('Trying to send data over a non-existing or closed data channel'); } }; /** * Callback function invoked when a SDP answer is received. Developers are * expected to invoke this function in order to complete the SDP negotiation. * * @function module:kurentoUtils.WebRtcPeer.prototype.processAnswer * * @param sdpAnswer - Description of sdpAnswer * @param callback - * Invoked after the SDP answer is processed, or there is an error. */ this.processAnswer = function (sdpAnswer, callback) { callback = (callback || noop).bind(this); var answer = new RTCSessionDescription({ type: 'answer', sdp: sdpAnswer }); if (multistream && usePlanB) { var planBAnswer = interop.toPlanB(answer); logger.debug('asnwer::planB', dumpSDP(planBAnswer)); answer = planBAnswer; } logger.debug('SDP answer received, setting remote description'); if (pc.signalingState === 'closed') { return callback('PeerConnection is closed'); } pc.setRemoteDescription(answer, function () { setRemoteVideo(); callback(); }, callback); }; /** * Callback function invoked when a SDP offer is received. Developers are * expected to invoke this function in order to complete the SDP negotiation. * * @function module:kurentoUtils.WebRtcPeer.prototype.processOffer * * @param sdpOffer - Description of sdpOffer * @param callback - Called when the remote description has been set * successfully. */ this.processOffer = function (sdpOffer, callback) { callback = callback.bind(this); var offer = new RTCSessionDescription({ type: 'offer', sdp: sdpOffer }); if (multistream && usePlanB) { var planBOffer = interop.toPlanB(offer); logger.debug('offer::planB', dumpSDP(planBOffer)); offer = planBOffer; } logger.debug('SDP offer received, setting remote description'); if (pc.signalingState === 'closed') { return callback('PeerConnection is closed'); } pc.setRemoteDescription(offer).then(function () { return setRemoteVideo(); }).then(function () { return pc.createAnswer(); }).then(function (answer) { answer = mangleSdpToAddSimulcast(answer); logger.debug('Created SDP answer'); return pc.setLocalDescription(answer); }).then(function () { var localDescription = pc.localDescription; if (multistream && usePlanB) { localDescription = interop.toUnifiedPlan(localDescription); logger.debug('answer::origPlanB->UnifiedPlan', dumpSDP(localDescription)); } logger.debug('Local description set', localDescription.sdp); callback(null, localDescription.sdp); }).catch(callback); }; function mangleSdpToAddSimulcast(answer) { if (simulcast) { if (browser.name === 'Chrome' || browser.name === 'Chromium') { logger.debug('Adding multicast info'); answer = new RTCSessionDescription({ 'type': answer.type, 'sdp': removeFIDFromOffer(answer.sdp) + getSimulcastInfo(videoStream) }); } else { logger.warn('Simulcast is only available in Chrome browser.'); } } return answer; } /** * This function creates the RTCPeerConnection object taking into account the * properties received in the constructor. It starts the SDP negotiation * process: generates the SDP offer and invokes the onsdpoffer callback. This * callback is expected to send the SDP offer, in order to obtain an SDP * answer from another peer. */ function start() { if (pc.signalingState === 'closed') { callback('The peer connection object is in "closed" state. This is most likely due to an invocation of the dispose method before accepting in the dialogue'); } if (videoStream && localVideo) { self.showLocalVideo(); } if (videoStream) { pc.addStream(videoStream); } if (audioStream) { pc.addStream(audioStream); } // [Hack] https://code.google.com/p/chromium/issues/detail?id=443558 var browser = parser.getBrowser(); if (mode === 'sendonly' && (browser.name === 'Chrome' || browser.name === 'Chromium') && browser.major === 39) { mode = 'sendrecv'; } callback(); } if (mode !== 'recvonly' && !videoStream && !audioStream) { function getMedia(constraints) { if (constraints === undefined) { constraints = MEDIA_CONSTRAINTS; } navigator.mediaDevices.getUserMedia(constraints).then(function (stream) { videoStream = stream; start(); }).catch(callback); } if (sendSource === 'webcam') { getMedia(mediaConstraints); } else { getScreenConstraints(sendSource, function (error, constraints_) { if (error) return callback(error); constraints = [mediaConstraints]; constraints.unshift(constraints_); getMedia(recursive.apply(undefined, constraints)); }, guid); } } else { setTimeout(start, 0); } this.on('_dispose', function () { if (localVideo) { localVideo.pause(); localVideo.src = ''; localVideo.load(); //Unmute local video in case the video tag is later used for remote video localVideo.muted = false; } if (remoteVideo) { remoteVideo.pause(); remoteVideo.src = ''; remoteVideo.load(); } self.removeAllListeners(); if (window.cancelChooseDesktopMedia !== undefined) { window.cancelChooseDesktopMedia(guid); } }); } inherits(WebRtcPeer, EventEmitter); function createEnableDescriptor(type) { var method = 'get' + type + 'Tracks'; return { enumerable: true, get: function () { // [ToDo] Should return undefined if not all tracks have the same value? if (!this.peerConnection) return; var streams = this.peerConnection.getLocalStreams(); if (!streams.length) return; for (var i = 0, stream; stream = streams[i]; i++) { var tracks = stream[method](); for (var j = 0, track; track = tracks[j]; j++) if (!track.enabled) return false; } return true; }, set: function (value) { function trackSetEnable(track) { track.enabled = value; } this.peerConnection.getLocalStreams().forEach(function (stream) { stream[method]().forEach(trackSetEnable); }); } }; } Object.defineProperties(WebRtcPeer.prototype, { 'enabled': { enumerable: true, get: function () { return this.audioEnabled && this.videoEnabled; }, set: function (value) { this.audioEnabled = this.videoEnabled = value; } }, 'audioEnabled': createEnableDescriptor('Audio'), 'videoEnabled': createEnableDescriptor('Video') }); WebRtcPeer.prototype.getLocalStream = function (index) { if (this.peerConnection) { return this.peerConnection.getLocalStreams()[index || 0]; } }; WebRtcPeer.prototype.getRemoteStream = function (index) { if (this.peerConnection) { return this.peerConnection.getRemoteStreams()[index || 0]; } }; /** * @description This method frees the resources used by WebRtcPeer. * * @function module:kurentoUtils.WebRtcPeer.prototype.dispose */ WebRtcPeer.prototype.dispose = function () { logger.debug('Disposing WebRtcPeer'); var pc = this.peerConnection; var dc = this.dataChannel; try { if (dc) { if (dc.signalingState === 'closed') return; dc.close(); } if (pc) { if (pc.signalingState === 'closed') return; pc.getLocalStreams().forEach(streamStop); // FIXME This is not yet implemented in firefox // if(videoStream) pc.removeStream(videoStream); // if(audioStream) pc.removeStream(audioStream); pc.close(); } } catch (err) { logger.warn('Exception disposing webrtc peer ' + err); } this.emit('_dispose'); }; // // Specialized child classes // function WebRtcPeerRecvonly(options, callback) { if (!(this instanceof WebRtcPeerRecvonly)) { return new WebRtcPeerRecvonly(options, callback); } WebRtcPeerRecvonly.super_.call(this, 'recvonly', options, callback); } inherits(WebRtcPeerRecvonly, WebRtcPeer); function WebRtcPeerSendonly(options, callback) { if (!(this instanceof WebRtcPeerSendonly)) { return new WebRtcPeerSendonly(options, callback); } WebRtcPeerSendonly.super_.call(this, 'sendonly', options, callback); } inherits(WebRtcPeerSendonly, WebRtcPeer); function WebRtcPeerSendrecv(options, callback) { if (!(this instanceof WebRtcPeerSendrecv)) { return new WebRtcPeerSendrecv(options, callback); } WebRtcPeerSendrecv.super_.call(this, 'sendrecv', options, callback); } inherits(WebRtcPeerSendrecv, WebRtcPeer); function harkUtils(stream, options) { return hark(stream, options); } exports.bufferizeCandidates = bufferizeCandidates; exports.WebRtcPeerRecvonly = WebRtcPeerRecvonly; exports.WebRtcPeerSendonly = WebRtcPeerSendonly; exports.WebRtcPeerSendrecv = WebRtcPeerSendrecv; exports.hark = harkUtils; //# sourceMappingURL=WebRtcPeer.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/KurentoUtils/kurento-utils-js/index.js": /***/ (function(module, exports, __webpack_require__) { /* * (C) Copyright 2014 Kurento (http://kurento.org/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * This module contains a set of reusable components that have been found useful * during the development of the WebRTC applications with Kurento. * * @module kurentoUtils * * @copyright 2014 Kurento (http://kurento.org/) * @license ALv2 */ var WebRtcPeer = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-utils-js/WebRtcPeer.js"); exports.WebRtcPeer = WebRtcPeer; //# sourceMappingURL=index.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenVidu/OpenVidu.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; /* * (C) Copyright 2017 OpenVidu (http://openvidu.io/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var OpenViduInternal_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/OpenViduInternal.js"); var Session_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenVidu/Session.js"); var Publisher_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenVidu/Publisher.js"); var OpenViduError_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/OpenViduError.js"); var adapter = __webpack_require__("../../../../webrtc-adapter/src/js/adapter_core.js"); var screenSharingAuto = __webpack_require__("../../../../openvidu-browser/lib/ScreenSharing/Screen-Capturing-Auto.js"); if (window) { window["adapter"] = adapter; } var OpenVidu = /** @class */ (function () { function OpenVidu() { this.openVidu = new OpenViduInternal_1.OpenViduInternal(); console.info("'OpenVidu' initialized"); } ; OpenVidu.prototype.initSession = function (param1, param2) { if (this.checkSystemRequirements()) { if (typeof param2 == "string") { return new Session_1.Session(this.openVidu.initSession(param2), this); } else { return new Session_1.Session(this.openVidu.initSession(param1), this); } } else { alert("Browser not supported"); } }; OpenVidu.prototype.initPublisher = function (parentId, cameraOptions, callback) { if (this.checkSystemRequirements()) { this.openVidu.storedPublisherOptions = cameraOptions; var publisher_1; if (cameraOptions != null) { cameraOptions.audio = cameraOptions.audio != null ? cameraOptions.audio : true; cameraOptions.video = cameraOptions.video != null ? cameraOptions.video : true; if (!cameraOptions.screen) { // Webcam and/or microphone is being requested var cameraOptionsAux = { sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true, sendVideo: cameraOptions.video != null ? cameraOptions.video : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, data: true, mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions) }; cameraOptions = cameraOptionsAux; publisher_1 = new Publisher_1.Publisher(this.openVidu.initPublisherTagged(parentId, cameraOptions, callback), parentId, false); console.info("'Publisher' initialized"); return publisher_1; } else { publisher_1 = new Publisher_1.Publisher(this.openVidu.initPublisherScreen(parentId, callback), parentId, true); if (adapter.browserDetails.browser === 'firefox' && adapter.browserDetails.version >= 52) { screenSharingAuto.getScreenId(function (error, sourceId, screenConstraints) { cameraOptions = { sendAudio: cameraOptions.audio, sendVideo: cameraOptions.video, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, data: true, mediaConstraints: { video: screenConstraints.video, audio: false } }; publisher_1.stream.configureScreenOptions(cameraOptions); console.info("'Publisher' initialized"); }); return publisher_1; } else if (adapter.browserDetails.browser === 'chrome') { // Screen is being requested /*screenSharing.isChromeExtensionAvailable((availability) => { switch (availability) { case 'available': console.warn('EXTENSION AVAILABLE!!!'); screenSharing.getScreenConstraints((error, screenConstraints) => { if (!error) { console.warn(screenConstraints); } }); break; case 'unavailable': console.warn('EXTENSION NOT AVAILABLE!!!'); break; case 'isFirefox': console.warn('IT IS FIREFOX!!!'); screenSharing.getScreenConstraints((error, screenConstraints) => { if (!error) { console.warn(screenConstraints); } }); break; } });*/ screenSharingAuto.getScreenId(function (error, sourceId, screenConstraints) { if (error === 'not-installed') { var error_1 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_EXTENSION_NOT_INSTALLED, 'https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk'); console.error(error_1); if (callback) callback(error_1); return; } else if (error === 'permission-denied') { var error_2 = new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED, 'You must allow access to one window of your desktop'); console.error(error_2); if (callback) callback(error_2); return; } cameraOptions = { sendAudio: cameraOptions.audio != null ? cameraOptions.audio : true, sendVideo: cameraOptions.video != null ? cameraOptions.video : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, data: true, mediaConstraints: { video: screenConstraints.video, audio: false } }; publisher_1.stream.configureScreenOptions(cameraOptions); }, function (error) { console.error('getScreenId error', error); return; }); console.info("'Publisher' initialized"); return publisher_1; } else { console.error('Screen sharing not supported on ' + adapter.browserDetails.browser); } } } else { cameraOptions = { sendAudio: true, sendVideo: true, activeAudio: true, activeVideo: true, data: true, mediaConstraints: { audio: true, video: { width: { ideal: 1280 } } } }; publisher_1 = new Publisher_1.Publisher(this.openVidu.initPublisherTagged(parentId, cameraOptions, callback), parentId, false); console.info("'Publisher' initialized"); return publisher_1; } } else { alert("Browser not supported"); } }; OpenVidu.prototype.checkSystemRequirements = function () { var browser = adapter.browserDetails.browser; var version = adapter.browserDetails.version; //Bug fix: 'navigator.userAgent' in Firefox for Ubuntu 14.04 does not return "Firefox/[version]" in the string, so version returned is null if ((browser == 'firefox') && (version == null)) { return 1; } if (((browser == 'chrome') && (version >= 28)) || ((browser == 'edge') && (version >= 12)) || ((browser == 'firefox') && (version >= 22))) { return 1; } else { return 0; } }; OpenVidu.prototype.getDevices = function (callback) { navigator.mediaDevices.enumerateDevices().then(function (deviceInfos) { callback(null, deviceInfos); })["catch"](function (error) { console.error("Error getting devices", error); callback(error, null); }); }; OpenVidu.prototype.enableProdMode = function () { console.log = function () { }; console.debug = function () { }; console.info = function () { }; console.warn = function () { }; }; return OpenVidu; }()); exports.OpenVidu = OpenVidu; //# sourceMappingURL=OpenVidu.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenVidu/Publisher.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var EventEmitter = __webpack_require__("../../../../wolfy87-eventemitter/EventEmitter.js"); var Publisher = /** @class */ (function () { function Publisher(stream, parentId, isScreenRequested) { this.ee = new EventEmitter(); this.accessAllowed = false; this.isScreenRequested = false; this.stream = stream; this.isScreenRequested = isScreenRequested; // Listens to the deactivation of the default behaviour upon the deletion of a Stream object this.ee.addListener('stream-destroyed-default', function (event) { event.stream.removeVideo(); }); if (document.getElementById(parentId) != null) { this.element = document.getElementById(parentId); } } Publisher.prototype.publishAudio = function (value) { this.stream.getWebRtcPeer().audioEnabled = value; }; Publisher.prototype.publishVideo = function (value) { this.stream.getWebRtcPeer().videoEnabled = value; }; Publisher.prototype.destroy = function () { this.session.unpublish(this); this.stream.dispose(); this.stream.removeVideo(this.element); return this; }; Publisher.prototype.subscribeToRemote = function () { this.stream.subscribeToMyRemote(); }; Publisher.prototype.on = function (eventName, callback) { var _this = this; this.ee.addListener(eventName, function (event) { if (event) { console.info("Event '" + eventName + "' triggered by 'Publisher'", event); } else { console.info("Event '" + eventName + "' triggered by 'Publisher'"); } callback(event); }); if (eventName == 'streamCreated') { if (this.stream.isPublisherPublished) { this.ee.emitEvent('streamCreated', [{ stream: this.stream }]); } else { this.stream.addEventListener('stream-created-by-publisher', function () { _this.ee.emitEvent('streamCreated', [{ stream: _this.stream }]); }); } } if (eventName == 'videoElementCreated') { if (this.stream.isVideoELementCreated) { this.ee.emitEvent('videoElementCreated', [{ element: this.stream.getVideoElement() }]); } else { this.stream.addEventListener('video-element-created-by-stream', function (element) { _this.id = element.id; _this.ee.emitEvent('videoElementCreated', [{ element: element.element }]); }); } } if (eventName == 'videoPlaying') { var video = this.stream.getVideoElement(); if (!this.stream.displayMyRemote() && video && video.currentTime > 0 && video.paused == false && video.ended == false && video.readyState == 4) { this.ee.emitEvent('videoPlaying', [{ element: this.stream.getVideoElement() }]); } else { this.stream.addEventListener('video-is-playing', function (element) { _this.ee.emitEvent('videoPlaying', [{ element: element.element }]); }); } } if (eventName == 'remoteVideoPlaying') { var video = this.stream.getVideoElement(); if (this.stream.displayMyRemote() && video && video.currentTime > 0 && video.paused == false && video.ended == false && video.readyState == 4) { this.ee.emitEvent('remoteVideoPlaying', [{ element: this.stream.getVideoElement() }]); } else { this.stream.addEventListener('remote-video-is-playing', function (element) { _this.ee.emitEvent('remoteVideoPlaying', [{ element: element.element }]); }); } } if (eventName == 'accessAllowed') { if (this.stream.accessIsAllowed) { this.ee.emitEvent('accessAllowed'); } else { this.stream.addEventListener('access-allowed-by-publisher', function () { _this.ee.emitEvent('accessAllowed'); }); } } if (eventName == 'accessDenied') { if (this.stream.accessIsDenied) { this.ee.emitEvent('accessDenied'); } else { this.stream.addEventListener('access-denied-by-publisher', function () { _this.ee.emitEvent('accessDenied'); }); } } }; return Publisher; }()); exports.Publisher = Publisher; //# sourceMappingURL=Publisher.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenVidu/Session.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var Subscriber_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenVidu/Subscriber.js"); var EventEmitter = __webpack_require__("../../../../wolfy87-eventemitter/EventEmitter.js"); var Session = /** @class */ (function () { function Session(session, openVidu) { var _this = this; this.session = session; this.openVidu = openVidu; this.ee = new EventEmitter(); this.sessionId = session.getSessionId(); // Listens to the deactivation of the default behaviour upon the deletion of a Stream object this.session.addEventListener('stream-destroyed-default', function (event) { event.stream.removeVideo(); }); // Listens to the deactivation of the default behaviour upon the disconnection of a Session this.session.addEventListener('session-disconnected-default', function () { var s; for (var _i = 0, _a = _this.openVidu.openVidu.getRemoteStreams(); _i < _a.length; _i++) { s = _a[_i]; s.removeVideo(); } if (_this.connection) { for (var streamId in _this.connection.getStreams()) { _this.connection.getStreams()[streamId].removeVideo(); } } }); // Sets or updates the value of 'connection' property. Triggered by SessionInternal when succesful connection this.session.addEventListener('update-connection-object', function (event) { _this.connection = event.connection; }); } Session.prototype.connect = function (param1, param2, param3) { // Early configuration to deactivate automatic subscription to streams if (param3) { this.session.configure({ sessionId: this.session.getSessionId(), participantId: param1, metadata: this.session.stringClientMetadata(param2), subscribeToStreams: false }); this.session.connect(param1, param3); } else { this.session.configure({ sessionId: this.session.getSessionId(), participantId: param1, metadata: '', subscribeToStreams: false }); this.session.connect(param1, param2); } }; Session.prototype.disconnect = function () { var _this = this; this.openVidu.openVidu.close(false); this.session.emitEvent('sessionDisconnected', [{ preventDefault: function () { _this.session.removeEvent('session-disconnected-default'); } }]); this.session.emitEvent('session-disconnected-default', [{}]); }; Session.prototype.publish = function (publisher) { var _this = this; if (!publisher.stream.isPublisherPublished) { if (publisher.isScreenRequested) { if (!publisher.stream.isScreenRequestedReady) { publisher.stream.addOnceEventListener('screen-ready', function () { _this.streamPublish(publisher); }); } else { this.streamPublish(publisher); } } else { this.streamPublish(publisher); } } else { var mypublisher_1 = this.openVidu.initPublisher(publisher.stream.getParentId(), this.openVidu.openVidu.storedPublisherOptions); if (mypublisher_1.isScreenRequested && !mypublisher_1.stream.isScreenRequestedReady) { mypublisher_1.stream.addOnceEventListener('screen-ready', function () { _this.streamPublish(mypublisher_1); }); } else { this.streamPublish(mypublisher_1); } } }; Session.prototype.streamPublish = function (publisher) { publisher.session = this; publisher.stream.publish(); }; Session.prototype.unpublish = function (publisher) { this.session.unpublish(publisher); }; Session.prototype.on = function (eventName, callback) { this.session.addEventListener(eventName, function (event) { if (event) { console.info("Event '" + eventName + "' triggered by 'Session'", event); } else { console.info("Event '" + eventName + "' triggered by 'Session'"); } callback(event); }); }; Session.prototype.once = function (eventName, callback) { this.session.addOnceEventListener(eventName, function (event) { callback(event); }); }; Session.prototype.off = function (eventName, eventHandler) { this.session.removeListener(eventName, eventHandler); }; Session.prototype.subscribe = function (param1, param2, param3) { // Subscription this.session.subscribe(param1); var subscriber = new Subscriber_1.Subscriber(param1, param2); param1.playOnlyVideo(param2, null); return subscriber; }; Session.prototype.unsubscribe = function (subscriber) { this.session.unsubscribe(subscriber.stream); subscriber.stream.removeVideo(); }; Session.prototype.signal = function (signal, completionHandler) { var signalMessage = {}; if (signal.to && signal.to.length > 0) { var connectionIds = []; for (var i = 0; i < signal.to.length; i++) { connectionIds.push(signal.to[i].connectionId); } signalMessage['to'] = connectionIds; } else { signalMessage['to'] = []; } signalMessage['data'] = signal.data ? signal.data : ''; signalMessage['type'] = signal.type ? signal.type : ''; this.openVidu.openVidu.sendMessage(JSON.stringify(signalMessage)); }; return Session; }()); exports.Session = Session; //# sourceMappingURL=Session.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenVidu/Subscriber.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var EventEmitter = __webpack_require__("../../../../wolfy87-eventemitter/EventEmitter.js"); var Subscriber = /** @class */ (function () { function Subscriber(stream, parentId) { this.ee = new EventEmitter(); this.stream = stream; if (document.getElementById(parentId) != null) { this.element = document.getElementById(parentId); } } Subscriber.prototype.on = function (eventName, callback) { var _this = this; this.ee.addListener(eventName, function (event) { if (event) { console.info("Event '" + eventName + "' triggered by 'Subscriber'", event); } else { console.info("Event '" + eventName + "' triggered by 'Subscriber'"); } callback(event); }); if (eventName == 'videoElementCreated') { if (this.stream.isVideoELementCreated) { this.ee.emitEvent('videoElementCreated', [{ element: this.stream.getVideoElement() }]); } else { this.stream.addOnceEventListener('video-element-created-by-stream', function (element) { console.warn("Subscriber emitting videoElementCreated"); _this.id = element.id; _this.ee.emitEvent('videoElementCreated', [{ element: element }]); }); } } if (eventName == 'videoPlaying') { var video = this.stream.getVideoElement(); if (!this.stream.displayMyRemote() && video && video.currentTime > 0 && video.paused == false && video.ended == false && video.readyState == 4) { this.ee.emitEvent('videoPlaying', [{ element: this.stream.getVideoElement() }]); } else { this.stream.addOnceEventListener('video-is-playing', function (element) { _this.ee.emitEvent('videoPlaying', [{ element: element.element }]); }); } } }; return Subscriber; }()); exports.Subscriber = Subscriber; //# sourceMappingURL=Subscriber.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenVidu/index.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } exports.__esModule = true; __export(__webpack_require__("../../../../openvidu-browser/lib/OpenVidu/OpenVidu.js")); __export(__webpack_require__("../../../../openvidu-browser/lib/OpenVidu/Session.js")); __export(__webpack_require__("../../../../openvidu-browser/lib/OpenVidu/Publisher.js")); __export(__webpack_require__("../../../../openvidu-browser/lib/OpenVidu/Subscriber.js")); __export(__webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/Stream.js")); __export(__webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/Connection.js")); //# sourceMappingURL=index.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenViduInternal/Connection.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var Stream_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/Stream.js"); var Connection = /** @class */ (function () { function Connection(openVidu, local, room, options) { this.openVidu = openVidu; this.local = local; this.room = room; this.options = options; this.streams = {}; console.info("'Connection' created (" + (local ? "local" : "remote") + ")" + (local ? "" : ", with 'connectionId' [" + (options ? options.id : '') + "] ")); if (options) { this.connectionId = options.id; this.data = options.metadata; if (options.streams) { this.initStreams(options); } } } Connection.prototype.addStream = function (stream) { this.streams[stream.streamId] = stream; this.room.getStreams()[stream.streamId] = stream; }; Connection.prototype.removeStream = function (key) { delete this.streams[key]; delete this.room.getStreams()[key]; delete this.streamsOpts; }; Connection.prototype.getStreams = function () { return this.streams; }; Connection.prototype.dispose = function () { for (var key in this.streams) { this.streams[key].dispose(); } }; Connection.prototype.sendIceCandidate = function (candidate) { console.debug((this.local ? "Local" : "Remote"), "candidate for", this.connectionId, JSON.stringify(candidate)); this.openVidu.sendRequest("onIceCandidate", { endpointName: this.connectionId, candidate: candidate.candidate, sdpMid: candidate.sdpMid, sdpMLineIndex: candidate.sdpMLineIndex }, function (error, response) { if (error) { console.error("Error sending ICE candidate: " + JSON.stringify(error)); } }); }; Connection.prototype.initStreams = function (options) { for (var _i = 0, _a = options.streams; _i < _a.length; _i++) { var streamOptions = _a[_i]; var streamOpts = { id: streamOptions.id, connection: this, sendAudio: streamOptions.sendAudio, sendVideo: streamOptions.sendVideo, recvAudio: (streamOptions.audioActive == undefined ? true : streamOptions.audioActive), recvVideo: (streamOptions.videoActive == undefined ? true : streamOptions.videoActive), typeOfVideo: streamOptions.typeOfVideo, activeAudio: streamOptions.activeAudio, activeVideo: streamOptions.activeVideo, data: streamOptions.data, mediaConstraints: streamOptions.mediaConstraints }; var stream = new Stream_1.Stream(this.openVidu, false, this.room, streamOpts); this.addStream(stream); this.streamsOpts = streamOpts; } console.info("Remote 'Connection' with 'connectionId' [" + this.connectionId + "] is now configured for receiving Streams with options: ", this.streamsOpts); }; return Connection; }()); exports.Connection = Connection; //# sourceMappingURL=Connection.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenViduInternal/OpenViduError.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var OpenViduErrorName; (function (OpenViduErrorName) { OpenViduErrorName["CAMERA_ACCESS_DENIED"] = "CAMERA_ACCESS_DENIED"; OpenViduErrorName["MICROPHONE_ACCESS_DENIED"] = "MICROPHONE_ACCESS_DENIED"; OpenViduErrorName["SCREEN_CAPTURE_DENIED"] = "SCREEN_CAPTURE_DENIED"; OpenViduErrorName["NO_VIDEO_DEVICE"] = "NO_VIDEO_DEVICE"; OpenViduErrorName["NO_INPUT_DEVICE"] = "NO_INPUT_DEVICE"; OpenViduErrorName["SCREEN_EXTENSION_NOT_INSTALLED"] = "SCREEN_EXTENSION_NOT_INSTALLED"; OpenViduErrorName["GENERIC_ERROR"] = "GENERIC_ERROR"; })(OpenViduErrorName = exports.OpenViduErrorName || (exports.OpenViduErrorName = {})); var OpenViduError = /** @class */ (function () { function OpenViduError(name, message) { this.name = name; this.message = message; } return OpenViduError; }()); exports.OpenViduError = OpenViduError; //# sourceMappingURL=OpenViduError.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenViduInternal/OpenViduInternal.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; /* * (C) Copyright 2017 OpenVidu (http://openvidu.io/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var SessionInternal_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/SessionInternal.js"); var OpenViduError_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/OpenViduError.js"); var Stream_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/Stream.js"); var RpcBuilder = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-jsonrpc/index.js"); var OpenViduInternal = /** @class */ (function () { function OpenViduInternal() { this.remoteStreams = []; } ; /* NEW METHODS */ OpenViduInternal.prototype.initSession = function (sessionId) { console.info("'Session' initialized with 'sessionId' [" + sessionId + "]"); this.session = new SessionInternal_1.SessionInternal(this, sessionId); return this.session; }; OpenViduInternal.prototype.initPublisherTagged = function (parentId, cameraOptions, callback) { var _this = this; this.getCamera(cameraOptions); this.camera.requestCameraAccess(function (error, camera) { if (error) { // Neither camera or microphone device is allowed/able to capture media console.error(error); if (callback) { callback(error); } _this.camera.ee.emitEvent('access-denied-by-publisher'); } else { _this.camera.setVideoElement(_this.cameraReady(camera, parentId)); if (callback) { callback(undefined); } } }); return this.camera; }; OpenViduInternal.prototype.initPublisherScreen = function (parentId, callback) { var _this = this; if (!this.camera) { this.camera = new Stream_1.Stream(this, true, this.session, 'screen-options'); } this.camera.addOnceEventListener('can-request-screen', function () { _this.camera.requestCameraAccess(function (error, camera) { if (error) { _this.camera.ee.emitEvent('access-denied-by-publisher'); var errorName = OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED; var errorMessage = 'You must allow access to one window of your desktop'; var e = new OpenViduError_1.OpenViduError(errorName, errorMessage); console.error(e); if (callback) { callback(e); } } else { _this.camera.setVideoElement(_this.cameraReady(camera, parentId)); if (_this.camera.getSendAudio()) { // If the user wants to send audio with the screen capturing navigator.mediaDevices.getUserMedia({ audio: true, video: false }) .then(function (userStream) { _this.camera.getMediaStream().addTrack(userStream.getAudioTracks()[0]); _this.camera.isScreenRequestedReady = true; _this.camera.ee.emitEvent('screen-ready'); if (callback) { callback(undefined); } })["catch"](function (error) { _this.camera.ee.emitEvent('access-denied-by-publisher'); console.error("Error accessing the microphone", error); if (callback) { var errorName = OpenViduError_1.OpenViduErrorName.MICROPHONE_ACCESS_DENIED; var errorMessage = error.toString(); callback(new OpenViduError_1.OpenViduError(errorName, errorMessage)); } }); } else { _this.camera.isScreenRequestedReady = true; _this.camera.ee.emitEvent('screen-ready'); if (callback) { callback(undefined); } } } }); }); return this.camera; }; OpenViduInternal.prototype.cameraReady = function (camera, parentId) { this.camera = camera; var videoElement = this.camera.playOnlyVideo(parentId, null); this.camera.emitStreamReadyEvent(); return videoElement; }; OpenViduInternal.prototype.getLocalStream = function () { return this.camera; }; OpenViduInternal.prototype.getRemoteStreams = function () { return this.remoteStreams; }; /* NEW METHODS */ OpenViduInternal.prototype.getWsUri = function () { return this.wsUri; }; OpenViduInternal.prototype.setWsUri = function (wsUri) { this.wsUri = wsUri; }; OpenViduInternal.prototype.getSecret = function () { return this.secret; }; OpenViduInternal.prototype.setSecret = function (secret) { this.secret = secret; }; OpenViduInternal.prototype.getOpenViduServerURL = function () { return 'https://' + this.wsUri.split("wss://")[1].split("/room")[0]; }; OpenViduInternal.prototype.getRoom = function () { return this.session; }; OpenViduInternal.prototype.connect = function (callback) { this.callback = callback; this.initJsonRpcClient(this.wsUri); }; OpenViduInternal.prototype.initJsonRpcClient = function (wsUri) { var config = { heartbeat: 3000, sendCloseMessage: false, ws: { uri: wsUri, useSockJS: false, onconnected: this.connectCallback.bind(this), ondisconnect: this.disconnectCallback.bind(this), onreconnecting: this.reconnectingCallback.bind(this), onreconnected: this.reconnectedCallback.bind(this) }, rpc: { requestTimeout: 15000, //notifications participantJoined: this.onParticipantJoined.bind(this), participantPublished: this.onParticipantPublished.bind(this), participantUnpublished: this.onParticipantUnpublished.bind(this), participantLeft: this.onParticipantLeft.bind(this), participantEvicted: this.onParticipantEvicted.bind(this), sendMessage: this.onNewMessage.bind(this), iceCandidate: this.iceCandidateEvent.bind(this), mediaError: this.onMediaError.bind(this) } }; this.jsonRpcClient = new RpcBuilder.clients.JsonRpcClient(config); }; OpenViduInternal.prototype.connectCallback = function (error) { if (error) { this.callback(error); } else { this.callback(null); } }; OpenViduInternal.prototype.isRoomAvailable = function () { if (this.session !== undefined && this.session instanceof SessionInternal_1.SessionInternal) { return true; } else { console.warn('Room instance not found'); return false; } }; OpenViduInternal.prototype.disconnectCallback = function () { console.warn('Websocket connection lost'); if (this.isRoomAvailable()) { this.session.onLostConnection(); } else { alert('Connection error. Please reload page.'); } }; OpenViduInternal.prototype.reconnectingCallback = function () { console.warn('Websocket connection lost (reconnecting)'); if (this.isRoomAvailable()) { this.session.onLostConnection(); } else { alert('Connection error. Please reload page.'); } }; OpenViduInternal.prototype.reconnectedCallback = function () { console.warn('Websocket reconnected'); }; OpenViduInternal.prototype.onParticipantJoined = function (params) { if (this.isRoomAvailable()) { this.session.onParticipantJoined(params); } }; OpenViduInternal.prototype.onParticipantPublished = function (params) { if (this.isRoomAvailable()) { this.session.onParticipantPublished(params); } }; OpenViduInternal.prototype.onParticipantUnpublished = function (params) { if (this.isRoomAvailable()) { this.session.onParticipantUnpublished(params); } }; OpenViduInternal.prototype.onParticipantLeft = function (params) { if (this.isRoomAvailable()) { this.session.onParticipantLeft(params); } }; OpenViduInternal.prototype.onParticipantEvicted = function (params) { if (this.isRoomAvailable()) { this.session.onParticipantEvicted(params); } }; OpenViduInternal.prototype.onNewMessage = function (params) { if (this.isRoomAvailable()) { this.session.onNewMessage(params); } }; OpenViduInternal.prototype.iceCandidateEvent = function (params) { if (this.isRoomAvailable()) { this.session.recvIceCandidate(params); } }; OpenViduInternal.prototype.onRoomClosed = function (params) { if (this.isRoomAvailable()) { this.session.onRoomClosed(params); } }; OpenViduInternal.prototype.onMediaError = function (params) { if (this.isRoomAvailable()) { this.session.onMediaError(params); } }; OpenViduInternal.prototype.setRpcParams = function (params) { this.rpcParams = params; }; OpenViduInternal.prototype.sendRequest = function (method, params, callback) { if (params && params instanceof Function) { callback = params; params = undefined; } params = params || {}; if (this.rpcParams && this.rpcParams !== null && this.rpcParams !== undefined) { for (var index in this.rpcParams) { if (this.rpcParams.hasOwnProperty(index)) { params[index] = this.rpcParams[index]; console.debug('RPC param added to request {' + index + ': ' + this.rpcParams[index] + '}'); } } } console.debug('Sending request: {method:"' + method + '", params: ' + JSON.stringify(params) + '}'); this.jsonRpcClient.send(method, params, callback); }; OpenViduInternal.prototype.close = function (forced) { if (this.isRoomAvailable()) { this.session.leave(forced, this.jsonRpcClient); } }; ; OpenViduInternal.prototype.disconnectParticipant = function (stream) { if (this.isRoomAvailable()) { this.session.disconnect(stream); } }; OpenViduInternal.prototype.getCamera = function (options) { if (this.camera) { return this.camera; } options = options || { sendAudio: true, sendVideo: true, activeAudio: true, activeVideo: true, data: true, mediaConstraints: { audio: true, video: { width: { ideal: 1280 } } } }; options.connection = this.session.getLocalParticipant(); this.camera = new Stream_1.Stream(this, true, this.session, options); return this.camera; }; ; //CHAT OpenViduInternal.prototype.sendMessage = function (message) { this.sendRequest('sendMessage', { message: message }, function (error, response) { if (error) { console.error(error); } }); }; ; OpenViduInternal.prototype.toggleLocalVideoTrack = function (activate) { this.getCamera().getWebRtcPeer().videoEnabled = activate; }; OpenViduInternal.prototype.toggleLocalAudioTrack = function (activate) { this.getCamera().getWebRtcPeer().audioEnabled = activate; }; OpenViduInternal.prototype.publishLocalVideoAudio = function () { this.toggleLocalVideoTrack(true); this.toggleLocalAudioTrack(true); }; OpenViduInternal.prototype.unpublishLocalVideoAudio = function () { this.toggleLocalVideoTrack(false); this.toggleLocalAudioTrack(false); }; OpenViduInternal.prototype.generateMediaConstraints = function (cameraOptions) { var mediaConstraints = { audio: cameraOptions.audio, video: {} }; if (!cameraOptions.video) { mediaConstraints.video = false; } else { var w = void 0, h = void 0; switch (cameraOptions.quality) { case 'LOW': w = 320; h = 240; break; case 'MEDIUM': w = 640; h = 480; break; case 'HIGH': w = 1280; h = 720; break; default: w = 640; h = 480; } mediaConstraints.video['width'] = { exact: w }; mediaConstraints.video['height'] = { exact: h }; //mediaConstraints.video['frameRate'] = { ideal: Number((document.getElementById('frameRate')).value) }; } return mediaConstraints; }; return OpenViduInternal; }()); exports.OpenViduInternal = OpenViduInternal; //# sourceMappingURL=OpenViduInternal.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenViduInternal/SessionInternal.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var Connection_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/Connection.js"); var EventEmitter = __webpack_require__("../../../../wolfy87-eventemitter/EventEmitter.js"); var SECRET_PARAM = '?secret='; var SessionInternal = /** @class */ (function () { function SessionInternal(openVidu, sessionId) { this.openVidu = openVidu; this.ee = new EventEmitter(); this.streams = {}; this.participants = {}; this.publishersSpeaking = []; this.connected = false; this.sessionId = this.getUrlWithoutSecret(sessionId); this.localParticipant = new Connection_1.Connection(this.openVidu, true, this); if (!this.openVidu.getWsUri()) { this.processOpenViduUrl(sessionId); } } SessionInternal.prototype.processOpenViduUrl = function (url) { this.openVidu.setSecret(this.getSecretFromUrl(url)); this.openVidu.setWsUri(this.getFinalUrl(url)); }; SessionInternal.prototype.getSecretFromUrl = function (url) { var secret = ''; if (url.indexOf(SECRET_PARAM) !== -1) { secret = url.substring(url.lastIndexOf(SECRET_PARAM) + SECRET_PARAM.length, url.length); } return secret; }; SessionInternal.prototype.getUrlWithoutSecret = function (url) { if (!url) { console.error('sessionId is not defined'); } if (url.indexOf(SECRET_PARAM) !== -1) { url = url.substring(0, url.lastIndexOf(SECRET_PARAM)); } return url; }; SessionInternal.prototype.getFinalUrl = function (url) { url = this.getUrlWithoutSecret(url).substring(0, url.lastIndexOf('/')) + '/room'; if (url.indexOf(".ngrok.io") !== -1) { // OpenVidu server URL referes to a ngrok IP: secure wss protocol and delete port of URL url = url.replace("ws://", "wss://"); var regex = /\.ngrok\.io:\d+/; url = url.replace(regex, ".ngrok.io"); } else if ((url.indexOf("localhost") !== -1) || (url.indexOf("127.0.0.1") != -1)) { // OpenVidu server URL referes to localhost IP } return url; }; /* NEW METHODS */ SessionInternal.prototype.connect = function (token, callback) { var _this = this; this.openVidu.connect(function (error) { if (error) { callback('ERROR CONNECTING TO OPENVIDU'); } else { if (!token) { token = _this.randomToken(); } var joinParams = { token: token, session: _this.sessionId, metadata: _this.options.metadata, secret: _this.openVidu.getSecret(), dataChannels: false }; if (_this.localParticipant) { if (Object.keys(_this.localParticipant.getStreams()).some(function (streamId) { return _this.streams[streamId].isDataChannelEnabled(); })) { joinParams.dataChannels = true; } } _this.openVidu.sendRequest('joinRoom', joinParams, function (error, response) { if (error) { callback(error); } else { _this.connected = true; var exParticipants = response.value; // IMPORTANT: Update connectionId with value send by server _this.localParticipant.connectionId = response.id; _this.participants[response.id] = _this.localParticipant; var roomEvent = { participants: new Array(), streams: new Array() }; var length_1 = exParticipants.length; for (var i = 0; i < length_1; i++) { var connection = new Connection_1.Connection(_this.openVidu, false, _this, exParticipants[i]); connection.creationTime = new Date().getTime(); _this.participants[connection.connectionId] = connection; roomEvent.participants.push(connection); var streams = connection.getStreams(); for (var key in streams) { roomEvent.streams.push(streams[key]); if (_this.subscribeToStreams) { streams[key].subscribe(); } } } // Update local Connection object properties with values returned by server _this.localParticipant.data = response.metadata; _this.localParticipant.creationTime = new Date().getTime(); // Updates the value of property 'connection' in Session object _this.ee.emitEvent('update-connection-object', [{ connection: _this.localParticipant }]); // Own connection created event _this.ee.emitEvent('connectionCreated', [{ connection: _this.localParticipant }]); // One connection created event for each existing connection in the session for (var _i = 0, _a = roomEvent.participants; _i < _a.length; _i++) { var part = _a[_i]; _this.ee.emitEvent('connectionCreated', [{ connection: part }]); } //if (this.subscribeToStreams) { for (var _b = 0, _c = roomEvent.streams; _b < _c.length; _b++) { var stream = _c[_b]; _this.ee.emitEvent('streamCreated', [{ stream: stream }]); // Adding the remote stream to the OpenVidu object _this.openVidu.getRemoteStreams().push(stream); } callback(undefined); } }); } }); }; /* NEW METHODS */ SessionInternal.prototype.configure = function (options) { this.options = options; this.id = options.sessionId; this.subscribeToStreams = options.subscribeToStreams == null ? true : options.subscribeToStreams; this.updateSpeakerInterval = options.updateSpeakerInterval || 1500; this.thresholdSpeaker = options.thresholdSpeaker || -50; this.activateUpdateMainSpeaker(); }; SessionInternal.prototype.getId = function () { return this.id; }; SessionInternal.prototype.getSessionId = function () { return this.sessionId; }; SessionInternal.prototype.activateUpdateMainSpeaker = function () { /*setInterval(() => { if (this.publishersSpeaking.length > 0) { this.ee.emitEvent('publisherStartSpeaking', [{ participantId: this.publishersSpeaking[this.publishersSpeaking.length - 1] }]); } }, this.updateSpeakerInterval);*/ }; SessionInternal.prototype.getLocalParticipant = function () { return this.localParticipant; }; SessionInternal.prototype.addEventListener = function (eventName, listener) { this.ee.on(eventName, listener); }; SessionInternal.prototype.addOnceEventListener = function (eventName, listener) { this.ee.once(eventName, listener); }; SessionInternal.prototype.removeListener = function (eventName, listener) { this.ee.off(eventName, listener); }; SessionInternal.prototype.removeEvent = function (eventName) { this.ee.removeEvent(eventName); }; SessionInternal.prototype.emitEvent = function (eventName, eventsArray) { this.ee.emitEvent(eventName, eventsArray); }; SessionInternal.prototype.subscribe = function (stream) { stream.subscribe(); }; SessionInternal.prototype.unsubscribe = function (stream) { console.info("Unsubscribing from " + stream.connection.connectionId); this.openVidu.sendRequest('unsubscribeFromVideo', { sender: stream.connection.connectionId }, function (error, response) { if (error) { console.error("Error unsubscribing from Subscriber", error); } else { console.info("Unsubscribed correctly from " + stream.connection.connectionId); } stream.dispose(); }); }; SessionInternal.prototype.onParticipantPublished = function (options) { // Get the existing Connection created on 'onParticipantJoined' for // existing participants or create a new one for new participants var connection = this.participants[options.id]; if (connection) { // Update existing Connection options.metadata = connection.data; connection.options = options; connection.initStreams(options); } else { // Create new Connection connection = new Connection_1.Connection(this.openVidu, false, this, options); } var pid = connection.connectionId; if (!(pid in this.participants)) { console.debug("Remote Connection not found in connections list by its id [" + pid + "]"); } else { console.debug("Remote Connection found in connections list by its id [" + pid + "]"); } this.participants[pid] = connection; this.ee.emitEvent('participant-published', [{ connection: connection }]); var streams = connection.getStreams(); for (var key in streams) { var stream = streams[key]; if (this.subscribeToStreams) { stream.subscribe(); } this.ee.emitEvent('streamCreated', [{ stream: stream }]); // Adding the remote stream to the OpenVidu object this.openVidu.getRemoteStreams().push(stream); } }; SessionInternal.prototype.onParticipantUnpublished = function (msg) { var _this = this; var connection = this.participants[msg.name]; if (connection !== undefined) { var streams = connection.getStreams(); for (var key in streams) { this.ee.emitEvent('streamDestroyed', [{ stream: streams[key], preventDefault: function () { _this.ee.removeEvent('stream-destroyed-default'); } }]); this.ee.emitEvent('stream-destroyed-default', [{ stream: streams[key] }]); // Deleting the removed stream from the OpenVidu object var index = this.openVidu.getRemoteStreams().indexOf(streams[key]); var stream = this.openVidu.getRemoteStreams()[index]; stream.dispose(); this.openVidu.getRemoteStreams().splice(index, 1); delete this.streams[stream.streamId]; } } else { console.warn("Participant " + msg.name + " unknown. Participants: " + JSON.stringify(this.participants)); } }; SessionInternal.prototype.onParticipantJoined = function (msg) { var connection = new Connection_1.Connection(this.openVidu, false, this, msg); connection.creationTime = new Date().getTime(); var pid = connection.connectionId; if (!(pid in this.participants)) { this.participants[pid] = connection; } else { //use existing so that we don't lose streams info console.warn("Connection already exists in connections list with " + "the same connectionId, old:", this.participants[pid], ", joined now:", connection); connection = this.participants[pid]; } this.ee.emitEvent('participant-joined', [{ connection: connection }]); this.ee.emitEvent('connectionCreated', [{ connection: connection }]); }; SessionInternal.prototype.onParticipantLeft = function (msg) { var _this = this; var connection = this.participants[msg.name]; if (connection !== undefined) { delete this.participants[msg.name]; this.ee.emitEvent('participant-left', [{ connection: connection }]); var streams = connection.getStreams(); for (var key in streams) { this.ee.emitEvent('streamDestroyed', [{ stream: streams[key], preventDefault: function () { _this.ee.removeEvent('stream-destroyed-default'); } }]); this.ee.emitEvent('stream-destroyed-default', [{ stream: streams[key] }]); // Deleting the removed stream from the OpenVidu object var index = this.openVidu.getRemoteStreams().indexOf(streams[key]); this.openVidu.getRemoteStreams().splice(index, 1); } connection.dispose(); this.ee.emitEvent('connectionDestroyed', [{ connection: connection }]); } else { console.warn("Participant " + msg.name + " unknown. Participants: " + JSON.stringify(this.participants)); } }; ; SessionInternal.prototype.onParticipantEvicted = function (msg) { this.ee.emitEvent('participant-evicted', [{ localParticipant: this.localParticipant }]); }; ; SessionInternal.prototype.onNewMessage = function (msg) { console.info("New signal: " + JSON.stringify(msg)); this.ee.emitEvent('signal', [{ data: msg.data, from: this.participants[msg.from], type: msg.type }]); this.ee.emitEvent('signal:' + msg.type, [{ data: msg.data, from: this.participants[msg.from], type: msg.type }]); }; SessionInternal.prototype.recvIceCandidate = function (msg) { var candidate = { candidate: msg.candidate, sdpMid: msg.sdpMid, sdpMLineIndex: msg.sdpMLineIndex }; var connection = this.participants[msg.endpointName]; if (!connection) { console.error("Participant not found for endpoint " + msg.endpointName + ". Ice candidate will be ignored.", candidate); return; } var streams = connection.getStreams(); var _loop_1 = function (key) { var stream = streams[key]; stream.getWebRtcPeer().addIceCandidate(candidate, function (error) { if (error) { console.error("Error adding candidate for " + key + " stream of endpoint " + msg.endpointName + ": " + error); } }); }; for (var key in streams) { _loop_1(key); } }; SessionInternal.prototype.onRoomClosed = function (msg) { console.info("Room closed: " + JSON.stringify(msg)); var room = msg.room; if (room !== undefined) { this.ee.emitEvent('room-closed', [{ room: room }]); } else { console.warn("Room undefined in on room closed", msg); } }; SessionInternal.prototype.onLostConnection = function () { if (!this.connected) { console.warn('Not connected to room: if you are not debugging, this is probably a certificate error'); if (window.confirm('If you are not debugging, this is probably a certificate error at \"' + this.openVidu.getOpenViduServerURL() + '\"\n\nClick OK to navigate and accept it')) { location.assign(this.openVidu.getOpenViduServerURL() + '/accept-certificate'); } ; return; } console.warn('Lost connection in Session ' + this.id); var room = this.id; if (room !== undefined) { this.ee.emitEvent('lost-connection', [{ room: room }]); } else { console.warn('Room undefined when lost connection'); } }; SessionInternal.prototype.onMediaError = function (params) { console.error("Media error: " + JSON.stringify(params)); var error = params.error; if (error) { this.ee.emitEvent('error-media', [{ error: error }]); } else { console.warn("Received undefined media error. Params:", params); } }; /* * forced means the user was evicted, no need to send the 'leaveRoom' request */ SessionInternal.prototype.leave = function (forced, jsonRpcClient) { forced = !!forced; console.info("Leaving Session (forced=" + forced + ")"); if (this.connected && !forced) { this.openVidu.sendRequest('leaveRoom', function (error, response) { if (error) { console.error(error); } jsonRpcClient.close(); }); } else { jsonRpcClient.close(); } this.connected = false; if (this.participants) { for (var pid in this.participants) { this.participants[pid].dispose(); delete this.participants[pid]; } } }; SessionInternal.prototype.disconnect = function (stream) { var connection = stream.getParticipant(); if (!connection) { console.error("Stream to disconnect has no participant", stream); return; } delete this.participants[connection.connectionId]; connection.dispose(); if (connection === this.localParticipant) { console.info("Unpublishing my media (I'm " + connection.connectionId + ")"); delete this.localParticipant; this.openVidu.sendRequest('unpublishVideo', function (error, response) { if (error) { console.error(error); } else { console.info("Media unpublished correctly"); } }); } else { this.unsubscribe(stream); } }; SessionInternal.prototype.unpublish = function (publisher) { var _this = this; var stream = publisher.stream; if (!stream.connection) { console.error("The associated Connection object of this Publisher is null", stream); return; } else if (stream.connection !== this.localParticipant) { console.error("The associated Connection object of this Publisher is not your local Connection." + "Only moderators can force unpublish on remote Streams via 'forceUnpublish' method", stream); return; } else { stream.dispose(); console.info("Unpublishing local media (" + stream.connection.connectionId + ")"); this.openVidu.sendRequest('unpublishVideo', function (error, response) { if (error) { console.error(error); } else { console.info("Media unpublished correctly"); } }); stream.isReadyToPublish = false; stream.isScreenRequestedReady = false; publisher.ee.emitEvent('streamDestroyed', [{ stream: publisher.stream, preventDefault: function () { _this.ee.removeEvent('stream-destroyed-default'); } }]); publisher.ee.emitEvent('stream-destroyed-default', [{ stream: publisher.stream }]); } }; SessionInternal.prototype.getStreams = function () { return this.streams; }; SessionInternal.prototype.addParticipantSpeaking = function (participantId) { this.publishersSpeaking.push(participantId); this.ee.emitEvent('publisherStartSpeaking', [{ participantId: participantId }]); }; SessionInternal.prototype.removeParticipantSpeaking = function (participantId) { var pos = -1; for (var i = 0; i < this.publishersSpeaking.length; i++) { if (this.publishersSpeaking[i] == participantId) { pos = i; break; } } if (pos != -1) { this.publishersSpeaking.splice(pos, 1); this.ee.emitEvent('publisherStopSpeaking', [{ participantId: participantId }]); } }; SessionInternal.prototype.stringClientMetadata = function (metadata) { if (!(typeof metadata === 'string')) { return JSON.stringify(metadata); } else { return metadata; } }; SessionInternal.prototype.randomToken = function () { return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2); }; return SessionInternal; }()); exports.SessionInternal = SessionInternal; //# sourceMappingURL=SessionInternal.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/OpenViduInternal/Stream.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var OpenViduError_1 = __webpack_require__("../../../../openvidu-browser/lib/OpenViduInternal/OpenViduError.js"); var EventEmitter = __webpack_require__("../../../../wolfy87-eventemitter/EventEmitter.js"); var kurentoUtils = __webpack_require__("../../../../openvidu-browser/lib/KurentoUtils/kurento-utils-js/index.js"); var adapter = __webpack_require__("../../../../webrtc-adapter/src/js/adapter_core.js"); if (window) { window["adapter"] = adapter; } function jq(id) { return id.replace(/(@|:|\.|\[|\]|,)/g, "\\$1"); } function show(id) { document.getElementById(jq(id)).style.display = 'block'; } function hide(id) { document.getElementById(jq(id)).style.display = 'none'; } var Stream = /** @class */ (function () { function Stream(openVidu, local, room, options) { var _this = this; this.openVidu = openVidu; this.local = local; this.room = room; this.ee = new EventEmitter(); this.showMyRemote = false; this.localMirrored = false; this.chanId = 0; this.dataChannelOpened = false; this.activeAudio = true; this.activeVideo = true; this.isReadyToPublish = false; this.isPublisherPublished = false; this.isVideoELementCreated = false; this.accessIsAllowed = false; this.accessIsDenied = false; this.isScreenRequestedReady = false; this.isScreenRequested = false; if (options !== 'screen-options') { this.configureOptions(options); } else { this.isScreenRequested = true; this.connection = this.room.getLocalParticipant(); } this.addEventListener('mediastream-updated', function () { if (_this.video) _this.video.srcObject = _this.mediaStream; console.debug("Video srcObject [" + _this.mediaStream + "] added to stream [" + _this.streamId + "]"); }); } Stream.prototype.emitStreamReadyEvent = function () { this.ee.emitEvent('stream-ready'); }; Stream.prototype.removeVideo = function (parentElement) { if (this.video) { if (typeof parentElement === "string") { document.getElementById(parentElement).removeChild(this.video); } else if (parentElement instanceof Element) { parentElement.removeChild(this.video); } else if (!parentElement) { if (document.getElementById(this.parentId)) { document.getElementById(this.parentId).removeChild(this.video); } } delete this.video; } }; Stream.prototype.getVideoElement = function () { return this.video; }; Stream.prototype.setVideoElement = function (video) { this.video = video; }; Stream.prototype.getParentId = function () { return this.parentId; }; Stream.prototype.getRecvVideo = function () { return this.recvVideo; }; Stream.prototype.getRecvAudio = function () { return this.recvAudio; }; Stream.prototype.getSendVideo = function () { return this.sendVideo; }; Stream.prototype.getSendAudio = function () { return this.sendAudio; }; Stream.prototype.subscribeToMyRemote = function () { this.showMyRemote = true; }; Stream.prototype.displayMyRemote = function () { return this.showMyRemote; }; Stream.prototype.mirrorLocalStream = function (wr) { this.showMyRemote = true; this.localMirrored = true; if (wr) { this.mediaStream = wr; this.ee.emitEvent('mediastream-updated'); } }; Stream.prototype.isLocalMirrored = function () { return this.localMirrored; }; Stream.prototype.getChannelName = function () { return this.streamId + '_' + this.chanId++; }; Stream.prototype.isDataChannelEnabled = function () { return this.dataChannel; }; Stream.prototype.isDataChannelOpened = function () { return this.dataChannelOpened; }; Stream.prototype.onDataChannelOpen = function (event) { console.debug('Data channel is opened'); this.dataChannelOpened = true; }; Stream.prototype.onDataChannelClosed = function (event) { console.debug('Data channel is closed'); this.dataChannelOpened = false; }; Stream.prototype.sendData = function (data) { if (this.wp === undefined) { throw new Error('WebRTC peer has not been created yet'); } if (!this.dataChannelOpened) { throw new Error('Data channel is not opened'); } console.info("Sending through data channel: " + data); this.wp.send(data); }; Stream.prototype.getMediaStream = function () { return this.mediaStream; }; Stream.prototype.getWebRtcPeer = function () { return this.wp; }; Stream.prototype.addEventListener = function (eventName, listener) { this.ee.addListener(eventName, listener); }; Stream.prototype.addOnceEventListener = function (eventName, listener) { this.ee.addOnceListener(eventName, listener); }; Stream.prototype.removeListener = function (eventName) { this.ee.removeAllListeners(eventName); }; Stream.prototype.showSpinner = function (spinnerParentId) { var progress = document.createElement('div'); progress.id = 'progress-' + this.streamId; progress.style.background = "center transparent url('img/spinner.gif') no-repeat"; var spinnerParent = document.getElementById(spinnerParentId); if (spinnerParent) { spinnerParent.appendChild(progress); } }; Stream.prototype.hideSpinner = function (spinnerId) { spinnerId = (spinnerId === undefined) ? this.streamId : spinnerId; hide('progress-' + spinnerId); }; Stream.prototype.playOnlyVideo = function (parentElement, thumbnailId) { var _this = this; this.video = document.createElement('video'); this.video.id = (this.local ? 'local-' : 'remote-') + 'video-' + this.streamId; this.video.autoplay = true; this.video.controls = false; this.ee.emitEvent('mediastream-updated'); if (this.local && !this.displayMyRemote()) { this.video.muted = true; this.video.oncanplay = function () { console.info("Local 'Stream' with id [" + _this.streamId + "] video is now playing"); _this.ee.emitEvent('video-is-playing', [{ element: _this.video }]); }; } else { this.video.title = this.streamId; } if (typeof parentElement === "string") { this.parentId = parentElement; var parentElementDom = document.getElementById(parentElement); if (parentElementDom) { this.video = parentElementDom.appendChild(this.video); this.ee.emitEvent('video-element-created-by-stream', [{ element: this.video }]); this.isVideoELementCreated = true; } } else { this.parentId = parentElement.id; this.video = parentElement.appendChild(this.video); } this.isReadyToPublish = true; return this.video; }; Stream.prototype.playThumbnail = function (thumbnailId) { var container = document.createElement('div'); container.className = "participant"; container.id = this.streamId; var thumbnail = document.getElementById(thumbnailId); if (thumbnail) { thumbnail.appendChild(container); } var name = document.createElement('div'); container.appendChild(name); var userName = this.streamId.replace('_webcam', ''); if (userName.length >= 16) { userName = userName.substring(0, 16) + "..."; } name.appendChild(document.createTextNode(userName)); name.id = "name-" + this.streamId; name.className = "name"; name.title = this.streamId; this.showSpinner(thumbnailId); return this.playOnlyVideo(container, thumbnailId); }; Stream.prototype.getParticipant = function () { return this.connection; }; Stream.prototype.getRTCPeerConnection = function () { return this.getWebRtcPeer().peerConnection; }; Stream.prototype.requestCameraAccess = function (callback) { var _this = this; this.connection.addStream(this); var constraints = this.mediaConstraints; /*let constraints2 = { audio: true, video: { width: { ideal: 1280 }, frameRate: { ideal: 15 } } };*/ this.userMediaHasVideo(function (hasVideo) { if (!hasVideo) { if (_this.sendVideo) { callback(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.NO_VIDEO_DEVICE, 'You have requested camera access but there is no video input device available. Trying to connect with an audio input device only'), _this); } if (!_this.sendAudio) { callback(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.NO_INPUT_DEVICE, 'You must init Publisher object with audio or video streams enabled'), undefined); } else { constraints.video = false; _this.sendVideo = false; _this.requestCameraAccesAux(constraints, callback); } } else { _this.requestCameraAccesAux(constraints, callback); } }); }; Stream.prototype.requestCameraAccesAux = function (constraints, callback) { var _this = this; navigator.mediaDevices.getUserMedia(constraints) .then(function (userStream) { _this.cameraAccessSuccess(userStream, callback); })["catch"](function (error) { _this.accessIsDenied = true; _this.accessIsAllowed = false; var errorName; var errorMessage = error.toString(); ; if (!_this.isScreenRequested) { errorName = _this.sendVideo ? OpenViduError_1.OpenViduErrorName.CAMERA_ACCESS_DENIED : OpenViduError_1.OpenViduErrorName.MICROPHONE_ACCESS_DENIED; } else { errorName = OpenViduError_1.OpenViduErrorName.SCREEN_CAPTURE_DENIED; // This code is only reachable for Firefox } callback(new OpenViduError_1.OpenViduError(errorName, errorMessage), undefined); }); }; Stream.prototype.cameraAccessSuccess = function (userStream, callback) { this.accessIsAllowed = true; this.accessIsDenied = false; this.ee.emitEvent('access-allowed-by-publisher'); if (userStream.getAudioTracks()[0] != null) { userStream.getAudioTracks()[0].enabled = this.activeAudio; } if (userStream.getVideoTracks()[0] != null) { userStream.getVideoTracks()[0].enabled = this.activeVideo; } this.mediaStream = userStream; this.ee.emitEvent('mediastream-updated'); callback(undefined, this); }; Stream.prototype.userMediaHasVideo = function (callback) { // If the user is going to publish its screen there's a video source if (this.isScreenRequested) { callback(true); return; } else { // List all input devices and serach for a video kind navigator.mediaDevices.enumerateDevices().then(function (mediaDevices) { var videoInput = mediaDevices.filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })[0]; callback(videoInput != null); }); } }; Stream.prototype.publishVideoCallback = function (error, sdpOfferParam, wp) { var _this = this; if (error) { return console.error("(publish) SDP offer error: " + JSON.stringify(error)); } console.debug("Sending SDP offer to publish as " + this.streamId, sdpOfferParam); this.openVidu.sendRequest("publishVideo", { sdpOffer: sdpOfferParam, doLoopback: this.displayMyRemote() || false, audioActive: this.sendAudio, videoActive: this.sendVideo, typeOfVideo: ((this.sendVideo) ? ((this.isScreenRequested) ? 'SCREEN' : 'CAMERA') : '') }, function (error, response) { if (error) { console.error("Error on publishVideo: " + JSON.stringify(error)); } else { _this.processSdpAnswer(response.sdpAnswer); console.info("'Publisher' succesfully published to session"); } }); }; Stream.prototype.startVideoCallback = function (error, sdpOfferParam, wp) { var _this = this; if (error) { return console.error("(subscribe) SDP offer error: " + JSON.stringify(error)); } console.debug("Sending SDP offer to subscribe to " + this.streamId, sdpOfferParam); this.openVidu.sendRequest("receiveVideoFrom", { sender: this.streamId, sdpOffer: sdpOfferParam }, function (error, response) { if (error) { console.error("Error on recvVideoFrom: " + JSON.stringify(error)); } else { _this.processSdpAnswer(response.sdpAnswer); } }); }; Stream.prototype.initWebRtcPeer = function (sdpOfferCallback) { var _this = this; if (this.local) { var userMediaConstraints = { audio: this.sendAudio, video: this.sendVideo }; var options = { videoStream: this.mediaStream, mediaConstraints: userMediaConstraints, onicecandidate: this.connection.sendIceCandidate.bind(this.connection) }; if (this.dataChannel) { options.dataChannelConfig = { id: this.getChannelName(), onopen: this.onDataChannelOpen, onclose: this.onDataChannelClosed }; options.dataChannels = true; } if (this.displayMyRemote()) { this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function (error) { if (error) { return console.error(error); } _this.wp.generateOffer(sdpOfferCallback.bind(_this)); }); } else { this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options, function (error) { if (error) { return console.error(error); } _this.wp.generateOffer(sdpOfferCallback.bind(_this)); }); } this.isPublisherPublished = true; this.ee.emitEvent('stream-created-by-publisher'); } else { var offerConstraints = { audio: this.recvAudio, video: this.recvVideo }; console.debug("'Session.subscribe(Stream)' called. Constraints of generate SDP offer", offerConstraints); var options = { onicecandidate: this.connection.sendIceCandidate.bind(this.connection), mediaConstraints: offerConstraints }; this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(options, function (error) { if (error) { return console.error(error); } _this.wp.generateOffer(sdpOfferCallback.bind(_this)); }); } console.debug("Waiting for SDP offer to be generated (" + (this.local ? "local" : "remote") + " 'Stream': " + this.streamId + ")"); }; Stream.prototype.publish = function () { var _this = this; // FIXME: Throw error when stream is not local if (this.isReadyToPublish) { this.initWebRtcPeer(this.publishVideoCallback); } else { this.ee.once('stream-ready', function (streamEvent) { _this.publish(); }); } // FIXME: Now we have coupled connecting to a room and adding a // stream to this room. But in the new API, there are two steps. // This is the second step. For now, it do nothing. }; Stream.prototype.subscribe = function () { // FIXME: In the current implementation all participants are subscribed // automatically to all other participants. We use this method only to // negotiate SDP this.initWebRtcPeer(this.startVideoCallback); }; Stream.prototype.processSdpAnswer = function (sdpAnswer) { var _this = this; var answer = new RTCSessionDescription({ type: 'answer', sdp: sdpAnswer }); console.debug(this.streamId + ": set peer connection with recvd SDP answer", sdpAnswer); var participantId = this.streamId; var pc = this.wp.peerConnection; pc.setRemoteDescription(answer, function () { // Avoids to subscribe to your own stream remotely // except when showMyRemote is true if (!_this.local || _this.displayMyRemote()) { _this.mediaStream = pc.getRemoteStreams()[0]; console.debug("Peer remote stream", _this.mediaStream); if (_this.mediaStream != undefined) { _this.ee.emitEvent('mediastream-updated'); if (_this.mediaStream.getAudioTracks()[0] != null) { _this.speechEvent = kurentoUtils.WebRtcPeer.hark(_this.mediaStream, { threshold: _this.room.thresholdSpeaker }); _this.speechEvent.on('speaking', function () { //this.room.addParticipantSpeaking(participantId); _this.room.emitEvent('publisherStartSpeaking', [{ connection: _this.connection, streamId: _this.streamId }]); }); _this.speechEvent.on('stopped_speaking', function () { //this.room.removeParticipantSpeaking(participantId); _this.room.emitEvent('publisherStopSpeaking', [{ connection: _this.connection, streamId: _this.streamId }]); }); } } // let thumbnailId = this.video.thumb; _this.video.oncanplay = function () { if (_this.local && _this.displayMyRemote()) { console.info("Your own remote 'Stream' with id [" + _this.streamId + "] video is now playing"); _this.ee.emitEvent('remote-video-is-playing', [{ element: _this.video }]); } else if (!_this.local && !_this.displayMyRemote()) { console.info("Remote 'Stream' with id [" + _this.streamId + "] video is now playing"); _this.ee.emitEvent('video-is-playing', [{ element: _this.video }]); } //show(thumbnailId); //this.hideSpinner(this.streamId); }; _this.room.emitEvent('stream-subscribed', [{ stream: _this }]); } }, function (error) { console.error(_this.streamId + ": Error setting SDP to the peer connection: " + JSON.stringify(error)); }); }; Stream.prototype.unpublish = function () { if (this.wp) { this.wp.dispose(); } else { if (this.mediaStream) { this.mediaStream.getAudioTracks().forEach(function (track) { track.stop && track.stop(); }); this.mediaStream.getVideoTracks().forEach(function (track) { track.stop && track.stop(); }); } } if (this.speechEvent) { this.speechEvent.stop(); } console.info(this.streamId + ": Stream '" + this.streamId + "' unpublished"); }; Stream.prototype.dispose = function () { function disposeElement(element) { if (element && element.parentNode) { element.parentNode.removeChild(element); } } disposeElement("progress-" + this.streamId); if (this.wp) { this.wp.dispose(); } else { if (this.mediaStream) { this.mediaStream.getAudioTracks().forEach(function (track) { track.stop && track.stop(); }); this.mediaStream.getVideoTracks().forEach(function (track) { track.stop && track.stop(); }); } } if (this.speechEvent) { this.speechEvent.stop(); } console.info((this.local ? "Local " : "Remote ") + "'Stream' with id [" + this.streamId + "]' has been succesfully disposed"); }; Stream.prototype.configureOptions = function (options) { this.connection = options.connection; this.recvVideo = options.recvVideo || false; this.recvAudio = options.recvAudio || false; this.sendVideo = options.sendVideo; this.sendAudio = options.sendAudio; this.activeAudio = options.activeAudio; this.activeVideo = options.activeVideo; this.dataChannel = options.data || false; this.mediaConstraints = options.mediaConstraints; this.hasAudio = ((this.recvAudio || this.sendAudio) != undefined) ? (this.recvAudio || this.sendAudio) : false; this.hasVideo = ((this.recvVideo || this.sendVideo) != undefined) ? (this.recvVideo || this.sendVideo) : false; this.typeOfVideo = options.typeOfVideo; if (options.id) { this.streamId = options.id; } else { this.streamId = this.sendVideo ? "WEBCAM" : "MICRO"; } }; Stream.prototype.configureScreenOptions = function (options) { if (options.id) { this.streamId = options.id; } else { this.streamId = "SCREEN"; } this.recvVideo = options.recvVideo || false; this.recvAudio = options.recvAudio || false; this.sendVideo = options.sendVideo; this.sendAudio = options.sendAudio; this.activeAudio = options.activeAudio; this.activeVideo = options.activeVideo; this.dataChannel = options.data || false; this.mediaConstraints = options.mediaConstraints; this.ee.emitEvent('can-request-screen'); }; return Stream; }()); exports.Stream = Stream; //# sourceMappingURL=Stream.js.map /***/ }), /***/ "../../../../openvidu-browser/lib/ScreenSharing/Screen-Capturing-Auto.js": /***/ (function(module, exports) { // Last time updated at Feb 16, 2017, 08:32:23 // Latest file can be found here: https://cdn.webrtc-experiment.com/getScreenId.js // Muaz Khan - www.MuazKhan.com // MIT License - www.WebRTC-Experiment.com/licence // Documentation - https://github.com/muaz-khan/getScreenId. // ______________ // getScreenId.js /* getScreenId(function (error, sourceId, screen_constraints) { // error == null || 'permission-denied' || 'not-installed' || 'installed-disabled' || 'not-chrome' // sourceId == null || 'string' || 'firefox' if(sourceId == 'firefox') { navigator.mozGetUserMedia(screen_constraints, onSuccess, onFailure); } else navigator.webkitGetUserMedia(screen_constraints, onSuccess, onFailure); }); */ window.getScreenId = function (callback) { // for Firefox: // sourceId == 'firefox' // screen_constraints = {...} if (!!navigator.mozGetUserMedia) { callback(null, 'firefox', { video: { mozMediaSource: 'window', mediaSource: 'window' } }); return; } window.addEventListener('message', onIFrameCallback); function onIFrameCallback(event) { if (!event.data) return; if (event.data.chromeMediaSourceId) { if (event.data.chromeMediaSourceId === 'PermissionDeniedError') { callback('permission-denied'); } else callback(null, event.data.chromeMediaSourceId, getScreenConstraints(null, event.data.chromeMediaSourceId)); } if (event.data.chromeExtensionStatus) { callback(event.data.chromeExtensionStatus, null, getScreenConstraints(event.data.chromeExtensionStatus)); } // this event listener is no more needed window.removeEventListener('message', onIFrameCallback); } setTimeout(postGetSourceIdMessage, 100); }; function getScreenConstraints(error, sourceId) { var screen_constraints = { audio: false, video: { mandatory: { chromeMediaSource: error ? 'screen' : 'desktop', maxWidth: window.screen.width > 1920 ? window.screen.width : 1920, maxHeight: window.screen.height > 1080 ? window.screen.height : 1080 }, optional: [] } }; if (sourceId) { screen_constraints.video.mandatory.chromeMediaSourceId = sourceId; } return screen_constraints; } function postGetSourceIdMessage() { if (!iframe) { loadIFrame(postGetSourceIdMessage); return; } if (!iframe.isLoaded) { setTimeout(postGetSourceIdMessage, 100); return; } iframe.contentWindow.postMessage({ captureSourceId: true }, '*'); } var iframe; // this function is used in RTCMultiConnection v3 window.getScreenConstraints = function (callback) { loadIFrame(function () { getScreenId(function (error, sourceId, screen_constraints) { callback(error, screen_constraints.video); }); }); }; function loadIFrame(loadCallback) { if (iframe) { loadCallback(); return; } iframe = document.createElement('iframe'); iframe.onload = function () { iframe.isLoaded = true; loadCallback(); }; iframe.src = 'https://www.webrtc-experiment.com/getSourceId/'; // https://wwww.yourdomain.com/getScreenId.html iframe.style.display = 'none'; (document.body || document.documentElement).appendChild(iframe); } window.getChromeExtensionStatus = function (callback) { // for Firefox: if (!!navigator.mozGetUserMedia) { callback('installed-enabled'); return; } window.addEventListener('message', onIFrameCallback); function onIFrameCallback(event) { if (!event.data) return; if (event.data.chromeExtensionStatus) { callback(event.data.chromeExtensionStatus); } // this event listener is no more needed window.removeEventListener('message', onIFrameCallback); } setTimeout(postGetChromeExtensionStatusMessage, 100); }; function postGetChromeExtensionStatusMessage() { if (!iframe) { loadIFrame(postGetChromeExtensionStatusMessage); return; } if (!iframe.isLoaded) { setTimeout(postGetChromeExtensionStatusMessage, 100); return; } iframe.contentWindow.postMessage({ getChromeExtensionStatus: true }, '*'); } exports.getScreenId = getScreenId; exports.getChromeExtensionStatus = getChromeExtensionStatus; //# sourceMappingURL=Screen-Capturing-Auto.js.map /***/ }), /***/ "../../../../rtcpeerconnection-shim/rtcpeerconnection.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var SDPUtils = __webpack_require__("../../../../sdp/sdp.js"); function writeMediaSection(transceiver, caps, type, stream, dtlsRole) { var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps); // Map ICE parameters (ufrag, pwd) to SDP. sdp += SDPUtils.writeIceParameters( transceiver.iceGatherer.getLocalParameters()); // Map DTLS parameters to SDP. sdp += SDPUtils.writeDtlsParameters( transceiver.dtlsTransport.getLocalParameters(), type === 'offer' ? 'actpass' : dtlsRole || 'active'); sdp += 'a=mid:' + transceiver.mid + '\r\n'; if (transceiver.rtpSender && transceiver.rtpReceiver) { sdp += 'a=sendrecv\r\n'; } else if (transceiver.rtpSender) { sdp += 'a=sendonly\r\n'; } else if (transceiver.rtpReceiver) { sdp += 'a=recvonly\r\n'; } else { sdp += 'a=inactive\r\n'; } if (transceiver.rtpSender) { // spec. var msid = 'msid:' + (stream ? stream.id : '-') + ' ' + transceiver.rtpSender.track.id + '\r\n'; sdp += 'a=' + msid; // for Chrome. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' ' + msid; if (transceiver.sendEncodingParameters[0].rtx) { sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' ' + msid; sdp += 'a=ssrc-group:FID ' + transceiver.sendEncodingParameters[0].ssrc + ' ' + transceiver.sendEncodingParameters[0].rtx.ssrc + '\r\n'; } } // FIXME: this should be written by writeRtpDescription. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' cname:' + SDPUtils.localCName + '\r\n'; if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) { sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' cname:' + SDPUtils.localCName + '\r\n'; } return sdp; } // Edge does not like // 1) stun: filtered after 14393 unless ?transport=udp is present // 2) turn: that does not have all of turn:host:port?transport=udp // 3) turn: with ipv6 addresses // 4) turn: occurring muliple times function filterIceServers(iceServers, edgeVersion) { var hasTurn = false; iceServers = JSON.parse(JSON.stringify(iceServers)); return iceServers.filter(function(server) { if (server && (server.urls || server.url)) { var urls = server.urls || server.url; if (server.url && !server.urls) { console.warn('RTCIceServer.url is deprecated! Use urls instead.'); } var isString = typeof urls === 'string'; if (isString) { urls = [urls]; } urls = urls.filter(function(url) { var validTurn = url.indexOf('turn:') === 0 && url.indexOf('transport=udp') !== -1 && url.indexOf('turn:[') === -1 && !hasTurn; if (validTurn) { hasTurn = true; return true; } return url.indexOf('stun:') === 0 && edgeVersion >= 14393 && url.indexOf('?transport=udp') === -1; }); delete server.url; server.urls = isString ? urls[0] : urls; return !!urls.length; } }); } // Determines the intersection of local and remote capabilities. function getCommonCapabilities(localCapabilities, remoteCapabilities) { var commonCapabilities = { codecs: [], headerExtensions: [], fecMechanisms: [] }; var findCodecByPayloadType = function(pt, codecs) { pt = parseInt(pt, 10); for (var i = 0; i < codecs.length; i++) { if (codecs[i].payloadType === pt || codecs[i].preferredPayloadType === pt) { return codecs[i]; } } }; var rtxCapabilityMatches = function(lRtx, rRtx, lCodecs, rCodecs) { var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs); var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs); return lCodec && rCodec && lCodec.name.toLowerCase() === rCodec.name.toLowerCase(); }; localCapabilities.codecs.forEach(function(lCodec) { for (var i = 0; i < remoteCapabilities.codecs.length; i++) { var rCodec = remoteCapabilities.codecs[i]; if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() && lCodec.clockRate === rCodec.clockRate) { if (lCodec.name.toLowerCase() === 'rtx' && lCodec.parameters && rCodec.parameters.apt) { // for RTX we need to find the local rtx that has a apt // which points to the same local codec as the remote one. if (!rtxCapabilityMatches(lCodec, rCodec, localCapabilities.codecs, remoteCapabilities.codecs)) { continue; } } rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy // number of channels is the highest common number of channels rCodec.numChannels = Math.min(lCodec.numChannels, rCodec.numChannels); // push rCodec so we reply with offerer payload type commonCapabilities.codecs.push(rCodec); // determine common feedback mechanisms rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function(fb) { for (var j = 0; j < lCodec.rtcpFeedback.length; j++) { if (lCodec.rtcpFeedback[j].type === fb.type && lCodec.rtcpFeedback[j].parameter === fb.parameter) { return true; } } return false; }); // FIXME: also need to determine .parameters // see https://github.com/openpeer/ortc/issues/569 break; } } }); localCapabilities.headerExtensions.forEach(function(lHeaderExtension) { for (var i = 0; i < remoteCapabilities.headerExtensions.length; i++) { var rHeaderExtension = remoteCapabilities.headerExtensions[i]; if (lHeaderExtension.uri === rHeaderExtension.uri) { commonCapabilities.headerExtensions.push(rHeaderExtension); break; } } }); // FIXME: fecMechanisms return commonCapabilities; } // is action=setLocalDescription with type allowed in signalingState function isActionAllowedInSignalingState(action, type, signalingState) { return { offer: { setLocalDescription: ['stable', 'have-local-offer'], setRemoteDescription: ['stable', 'have-remote-offer'] }, answer: { setLocalDescription: ['have-remote-offer', 'have-local-pranswer'], setRemoteDescription: ['have-local-offer', 'have-remote-pranswer'] } }[type][action].indexOf(signalingState) !== -1; } function maybeAddCandidate(iceTransport, candidate) { // Edge's internal representation adds some fields therefore // not all fieldѕ are taken into account. var alreadyAdded = iceTransport.getRemoteCandidates() .find(function(remoteCandidate) { return candidate.foundation === remoteCandidate.foundation && candidate.ip === remoteCandidate.ip && candidate.port === remoteCandidate.port && candidate.priority === remoteCandidate.priority && candidate.protocol === remoteCandidate.protocol && candidate.type === remoteCandidate.type; }); if (!alreadyAdded) { iceTransport.addRemoteCandidate(candidate); } return !alreadyAdded; } function makeError(name, description) { var e = new Error(description); e.name = name; return e; } module.exports = function(window, edgeVersion) { // https://w3c.github.io/mediacapture-main/#mediastream // Helper function to add the track to the stream and // dispatch the event ourselves. function addTrackToStreamAndFireEvent(track, stream) { stream.addTrack(track); stream.dispatchEvent(new window.MediaStreamTrackEvent('addtrack', {track: track})); } function removeTrackFromStreamAndFireEvent(track, stream) { stream.removeTrack(track); stream.dispatchEvent(new window.MediaStreamTrackEvent('removetrack', {track: track})); } function fireAddTrack(pc, track, receiver, streams) { var trackEvent = new Event('track'); trackEvent.track = track; trackEvent.receiver = receiver; trackEvent.transceiver = {receiver: receiver}; trackEvent.streams = streams; window.setTimeout(function() { pc._dispatchEvent('track', trackEvent); }); } var RTCPeerConnection = function(config) { var pc = this; var _eventTarget = document.createDocumentFragment(); ['addEventListener', 'removeEventListener', 'dispatchEvent'] .forEach(function(method) { pc[method] = _eventTarget[method].bind(_eventTarget); }); this.canTrickleIceCandidates = null; this.needNegotiation = false; this.localStreams = []; this.remoteStreams = []; this.localDescription = null; this.remoteDescription = null; this.signalingState = 'stable'; this.iceConnectionState = 'new'; this.iceGatheringState = 'new'; config = JSON.parse(JSON.stringify(config || {})); this.usingBundle = config.bundlePolicy === 'max-bundle'; if (config.rtcpMuxPolicy === 'negotiate') { throw(makeError('NotSupportedError', 'rtcpMuxPolicy \'negotiate\' is not supported')); } else if (!config.rtcpMuxPolicy) { config.rtcpMuxPolicy = 'require'; } switch (config.iceTransportPolicy) { case 'all': case 'relay': break; default: config.iceTransportPolicy = 'all'; break; } switch (config.bundlePolicy) { case 'balanced': case 'max-compat': case 'max-bundle': break; default: config.bundlePolicy = 'balanced'; break; } config.iceServers = filterIceServers(config.iceServers || [], edgeVersion); this._iceGatherers = []; if (config.iceCandidatePoolSize) { for (var i = config.iceCandidatePoolSize; i > 0; i--) { this._iceGatherers.push(new window.RTCIceGatherer({ iceServers: config.iceServers, gatherPolicy: config.iceTransportPolicy })); } } else { config.iceCandidatePoolSize = 0; } this._config = config; // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ... // everything that is needed to describe a SDP m-line. this.transceivers = []; this._sdpSessionId = SDPUtils.generateSessionId(); this._sdpSessionVersion = 0; this._dtlsRole = undefined; // role for a=setup to use in answers. this._isClosed = false; }; // set up event handlers on prototype RTCPeerConnection.prototype.onicecandidate = null; RTCPeerConnection.prototype.onaddstream = null; RTCPeerConnection.prototype.ontrack = null; RTCPeerConnection.prototype.onremovestream = null; RTCPeerConnection.prototype.onsignalingstatechange = null; RTCPeerConnection.prototype.oniceconnectionstatechange = null; RTCPeerConnection.prototype.onicegatheringstatechange = null; RTCPeerConnection.prototype.onnegotiationneeded = null; RTCPeerConnection.prototype.ondatachannel = null; RTCPeerConnection.prototype._dispatchEvent = function(name, event) { if (this._isClosed) { return; } this.dispatchEvent(event); if (typeof this['on' + name] === 'function') { this['on' + name](event); } }; RTCPeerConnection.prototype._emitGatheringStateChange = function() { var event = new Event('icegatheringstatechange'); this._dispatchEvent('icegatheringstatechange', event); }; RTCPeerConnection.prototype.getConfiguration = function() { return this._config; }; RTCPeerConnection.prototype.getLocalStreams = function() { return this.localStreams; }; RTCPeerConnection.prototype.getRemoteStreams = function() { return this.remoteStreams; }; // internal helper to create a transceiver object. // (whih is not yet the same as the WebRTC 1.0 transceiver) RTCPeerConnection.prototype._createTransceiver = function(kind) { var hasBundleTransport = this.transceivers.length > 0; var transceiver = { track: null, iceGatherer: null, iceTransport: null, dtlsTransport: null, localCapabilities: null, remoteCapabilities: null, rtpSender: null, rtpReceiver: null, kind: kind, mid: null, sendEncodingParameters: null, recvEncodingParameters: null, stream: null, associatedRemoteMediaStreams: [], wantReceive: true }; if (this.usingBundle && hasBundleTransport) { transceiver.iceTransport = this.transceivers[0].iceTransport; transceiver.dtlsTransport = this.transceivers[0].dtlsTransport; } else { var transports = this._createIceAndDtlsTransports(); transceiver.iceTransport = transports.iceTransport; transceiver.dtlsTransport = transports.dtlsTransport; } this.transceivers.push(transceiver); return transceiver; }; RTCPeerConnection.prototype.addTrack = function(track, stream) { if (this._isClosed) { throw makeError('InvalidStateError', 'Attempted to call addTrack on a closed peerconnection.'); } var alreadyExists = this.transceivers.find(function(s) { return s.track === track; }); if (alreadyExists) { throw makeError('InvalidAccessError', 'Track already exists.'); } var transceiver; for (var i = 0; i < this.transceivers.length; i++) { if (!this.transceivers[i].track && this.transceivers[i].kind === track.kind) { transceiver = this.transceivers[i]; } } if (!transceiver) { transceiver = this._createTransceiver(track.kind); } this._maybeFireNegotiationNeeded(); if (this.localStreams.indexOf(stream) === -1) { this.localStreams.push(stream); } transceiver.track = track; transceiver.stream = stream; transceiver.rtpSender = new window.RTCRtpSender(track, transceiver.dtlsTransport); return transceiver.rtpSender; }; RTCPeerConnection.prototype.addStream = function(stream) { var pc = this; if (edgeVersion >= 15025) { stream.getTracks().forEach(function(track) { pc.addTrack(track, stream); }); } else { // Clone is necessary for local demos mostly, attaching directly // to two different senders does not work (build 10547). // Fixed in 15025 (or earlier) var clonedStream = stream.clone(); stream.getTracks().forEach(function(track, idx) { var clonedTrack = clonedStream.getTracks()[idx]; track.addEventListener('enabled', function(event) { clonedTrack.enabled = event.enabled; }); }); clonedStream.getTracks().forEach(function(track) { pc.addTrack(track, clonedStream); }); } }; RTCPeerConnection.prototype.removeTrack = function(sender) { if (this._isClosed) { throw makeError('InvalidStateError', 'Attempted to call removeTrack on a closed peerconnection.'); } if (!(sender instanceof window.RTCRtpSender)) { throw new TypeError('Argument 1 of RTCPeerConnection.removeTrack ' + 'does not implement interface RTCRtpSender.'); } var transceiver = this.transceivers.find(function(t) { return t.rtpSender === sender; }); if (!transceiver) { throw makeError('InvalidAccessError', 'Sender was not created by this connection.'); } var stream = transceiver.stream; transceiver.rtpSender.stop(); transceiver.rtpSender = null; transceiver.track = null; transceiver.stream = null; // remove the stream from the set of local streams var localStreams = this.transceivers.map(function(t) { return t.stream; }); if (localStreams.indexOf(stream) === -1 && this.localStreams.indexOf(stream) > -1) { this.localStreams.splice(this.localStreams.indexOf(stream), 1); } this._maybeFireNegotiationNeeded(); }; RTCPeerConnection.prototype.removeStream = function(stream) { var pc = this; stream.getTracks().forEach(function(track) { var sender = pc.getSenders().find(function(s) { return s.track === track; }); if (sender) { pc.removeTrack(sender); } }); }; RTCPeerConnection.prototype.getSenders = function() { return this.transceivers.filter(function(transceiver) { return !!transceiver.rtpSender; }) .map(function(transceiver) { return transceiver.rtpSender; }); }; RTCPeerConnection.prototype.getReceivers = function() { return this.transceivers.filter(function(transceiver) { return !!transceiver.rtpReceiver; }) .map(function(transceiver) { return transceiver.rtpReceiver; }); }; RTCPeerConnection.prototype._createIceGatherer = function(sdpMLineIndex, usingBundle) { var pc = this; if (usingBundle && sdpMLineIndex > 0) { return this.transceivers[0].iceGatherer; } else if (this._iceGatherers.length) { return this._iceGatherers.shift(); } var iceGatherer = new window.RTCIceGatherer({ iceServers: this._config.iceServers, gatherPolicy: this._config.iceTransportPolicy }); Object.defineProperty(iceGatherer, 'state', {value: 'new', writable: true} ); this.transceivers[sdpMLineIndex].bufferedCandidateEvents = []; this.transceivers[sdpMLineIndex].bufferCandidates = function(event) { var end = !event.candidate || Object.keys(event.candidate).length === 0; // polyfill since RTCIceGatherer.state is not implemented in // Edge 10547 yet. iceGatherer.state = end ? 'completed' : 'gathering'; if (pc.transceivers[sdpMLineIndex].bufferedCandidateEvents !== null) { pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event); } }; iceGatherer.addEventListener('localcandidate', this.transceivers[sdpMLineIndex].bufferCandidates); return iceGatherer; }; // start gathering from an RTCIceGatherer. RTCPeerConnection.prototype._gather = function(mid, sdpMLineIndex) { var pc = this; var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer; if (iceGatherer.onlocalcandidate) { return; } var bufferedCandidateEvents = this.transceivers[sdpMLineIndex].bufferedCandidateEvents; this.transceivers[sdpMLineIndex].bufferedCandidateEvents = null; iceGatherer.removeEventListener('localcandidate', this.transceivers[sdpMLineIndex].bufferCandidates); iceGatherer.onlocalcandidate = function(evt) { if (pc.usingBundle && sdpMLineIndex > 0) { // if we know that we use bundle we can drop candidates with // ѕdpMLineIndex > 0. If we don't do this then our state gets // confused since we dispose the extra ice gatherer. return; } var event = new Event('icecandidate'); event.candidate = {sdpMid: mid, sdpMLineIndex: sdpMLineIndex}; var cand = evt.candidate; // Edge emits an empty object for RTCIceCandidateComplete‥ var end = !cand || Object.keys(cand).length === 0; if (end) { // polyfill since RTCIceGatherer.state is not implemented in // Edge 10547 yet. if (iceGatherer.state === 'new' || iceGatherer.state === 'gathering') { iceGatherer.state = 'completed'; } } else { if (iceGatherer.state === 'new') { iceGatherer.state = 'gathering'; } // RTCIceCandidate doesn't have a component, needs to be added cand.component = 1; var serializedCandidate = SDPUtils.writeCandidate(cand); event.candidate = Object.assign(event.candidate, SDPUtils.parseCandidate(serializedCandidate)); event.candidate.candidate = serializedCandidate; } // update local description. var sections = SDPUtils.splitSections(pc.localDescription.sdp); if (!end) { sections[event.candidate.sdpMLineIndex + 1] += 'a=' + event.candidate.candidate + '\r\n'; } else { sections[event.candidate.sdpMLineIndex + 1] += 'a=end-of-candidates\r\n'; } pc.localDescription.sdp = sections.join(''); var complete = pc.transceivers.every(function(transceiver) { return transceiver.iceGatherer && transceiver.iceGatherer.state === 'completed'; }); if (pc.iceGatheringState !== 'gathering') { pc.iceGatheringState = 'gathering'; pc._emitGatheringStateChange(); } // Emit candidate. Also emit null candidate when all gatherers are // complete. if (!end) { pc._dispatchEvent('icecandidate', event); } if (complete) { pc._dispatchEvent('icecandidate', new Event('icecandidate')); pc.iceGatheringState = 'complete'; pc._emitGatheringStateChange(); } }; // emit already gathered candidates. window.setTimeout(function() { bufferedCandidateEvents.forEach(function(e) { iceGatherer.onlocalcandidate(e); }); }, 0); }; // Create ICE transport and DTLS transport. RTCPeerConnection.prototype._createIceAndDtlsTransports = function() { var pc = this; var iceTransport = new window.RTCIceTransport(null); iceTransport.onicestatechange = function() { pc._updateConnectionState(); }; var dtlsTransport = new window.RTCDtlsTransport(iceTransport); dtlsTransport.ondtlsstatechange = function() { pc._updateConnectionState(); }; dtlsTransport.onerror = function() { // onerror does not set state to failed by itself. Object.defineProperty(dtlsTransport, 'state', {value: 'failed', writable: true}); pc._updateConnectionState(); }; return { iceTransport: iceTransport, dtlsTransport: dtlsTransport }; }; // Destroy ICE gatherer, ICE transport and DTLS transport. // Without triggering the callbacks. RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function( sdpMLineIndex) { var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer; if (iceGatherer) { delete iceGatherer.onlocalcandidate; delete this.transceivers[sdpMLineIndex].iceGatherer; } var iceTransport = this.transceivers[sdpMLineIndex].iceTransport; if (iceTransport) { delete iceTransport.onicestatechange; delete this.transceivers[sdpMLineIndex].iceTransport; } var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport; if (dtlsTransport) { delete dtlsTransport.ondtlsstatechange; delete dtlsTransport.onerror; delete this.transceivers[sdpMLineIndex].dtlsTransport; } }; // Start the RTP Sender and Receiver for a transceiver. RTCPeerConnection.prototype._transceive = function(transceiver, send, recv) { var params = getCommonCapabilities(transceiver.localCapabilities, transceiver.remoteCapabilities); if (send && transceiver.rtpSender) { params.encodings = transceiver.sendEncodingParameters; params.rtcp = { cname: SDPUtils.localCName, compound: transceiver.rtcpParameters.compound }; if (transceiver.recvEncodingParameters.length) { params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc; } transceiver.rtpSender.send(params); } if (recv && transceiver.rtpReceiver && params.codecs.length > 0) { // remove RTX field in Edge 14942 if (transceiver.kind === 'video' && transceiver.recvEncodingParameters && edgeVersion < 15019) { transceiver.recvEncodingParameters.forEach(function(p) { delete p.rtx; }); } if (transceiver.recvEncodingParameters.length) { params.encodings = transceiver.recvEncodingParameters; } params.rtcp = { compound: transceiver.rtcpParameters.compound }; if (transceiver.rtcpParameters.cname) { params.rtcp.cname = transceiver.rtcpParameters.cname; } if (transceiver.sendEncodingParameters.length) { params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc; } transceiver.rtpReceiver.receive(params); } }; RTCPeerConnection.prototype.setLocalDescription = function(description) { var pc = this; // Note: pranswer is not supported. if (['offer', 'answer'].indexOf(description.type) === -1) { return Promise.reject(makeError('TypeError', 'Unsupported type "' + description.type + '"')); } if (!isActionAllowedInSignalingState('setLocalDescription', description.type, pc.signalingState) || pc._isClosed) { return Promise.reject(makeError('InvalidStateError', 'Can not set local ' + description.type + ' in state ' + pc.signalingState)); } var sections; var sessionpart; if (description.type === 'offer') { // VERY limited support for SDP munging. Limited to: // * changing the order of codecs sections = SDPUtils.splitSections(description.sdp); sessionpart = sections.shift(); sections.forEach(function(mediaSection, sdpMLineIndex) { var caps = SDPUtils.parseRtpParameters(mediaSection); pc.transceivers[sdpMLineIndex].localCapabilities = caps; }); pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { pc._gather(transceiver.mid, sdpMLineIndex); }); } else if (description.type === 'answer') { sections = SDPUtils.splitSections(pc.remoteDescription.sdp); sessionpart = sections.shift(); var isIceLite = SDPUtils.matchPrefix(sessionpart, 'a=ice-lite').length > 0; sections.forEach(function(mediaSection, sdpMLineIndex) { var transceiver = pc.transceivers[sdpMLineIndex]; var iceGatherer = transceiver.iceGatherer; var iceTransport = transceiver.iceTransport; var dtlsTransport = transceiver.dtlsTransport; var localCapabilities = transceiver.localCapabilities; var remoteCapabilities = transceiver.remoteCapabilities; // treat bundle-only as not-rejected. var rejected = SDPUtils.isRejected(mediaSection) && SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0; if (!rejected && !transceiver.isDatachannel) { var remoteIceParameters = SDPUtils.getIceParameters( mediaSection, sessionpart); var remoteDtlsParameters = SDPUtils.getDtlsParameters( mediaSection, sessionpart); if (isIceLite) { remoteDtlsParameters.role = 'server'; } if (!pc.usingBundle || sdpMLineIndex === 0) { pc._gather(transceiver.mid, sdpMLineIndex); if (iceTransport.state === 'new') { iceTransport.start(iceGatherer, remoteIceParameters, isIceLite ? 'controlling' : 'controlled'); } if (dtlsTransport.state === 'new') { dtlsTransport.start(remoteDtlsParameters); } } // Calculate intersection of capabilities. var params = getCommonCapabilities(localCapabilities, remoteCapabilities); // Start the RTCRtpSender. The RTCRtpReceiver for this // transceiver has already been started in setRemoteDescription. pc._transceive(transceiver, params.codecs.length > 0, false); } }); } pc.localDescription = { type: description.type, sdp: description.sdp }; if (description.type === 'offer') { pc._updateSignalingState('have-local-offer'); } else { pc._updateSignalingState('stable'); } return Promise.resolve(); }; RTCPeerConnection.prototype.setRemoteDescription = function(description) { var pc = this; // Note: pranswer is not supported. if (['offer', 'answer'].indexOf(description.type) === -1) { return Promise.reject(makeError('TypeError', 'Unsupported type "' + description.type + '"')); } if (!isActionAllowedInSignalingState('setRemoteDescription', description.type, pc.signalingState) || pc._isClosed) { return Promise.reject(makeError('InvalidStateError', 'Can not set remote ' + description.type + ' in state ' + pc.signalingState)); } var streams = {}; pc.remoteStreams.forEach(function(stream) { streams[stream.id] = stream; }); var receiverList = []; var sections = SDPUtils.splitSections(description.sdp); var sessionpart = sections.shift(); var isIceLite = SDPUtils.matchPrefix(sessionpart, 'a=ice-lite').length > 0; var usingBundle = SDPUtils.matchPrefix(sessionpart, 'a=group:BUNDLE ').length > 0; pc.usingBundle = usingBundle; var iceOptions = SDPUtils.matchPrefix(sessionpart, 'a=ice-options:')[0]; if (iceOptions) { pc.canTrickleIceCandidates = iceOptions.substr(14).split(' ') .indexOf('trickle') >= 0; } else { pc.canTrickleIceCandidates = false; } sections.forEach(function(mediaSection, sdpMLineIndex) { var lines = SDPUtils.splitLines(mediaSection); var kind = SDPUtils.getKind(mediaSection); // treat bundle-only as not-rejected. var rejected = SDPUtils.isRejected(mediaSection) && SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0; var protocol = lines[0].substr(2).split(' ')[2]; var direction = SDPUtils.getDirection(mediaSection, sessionpart); var remoteMsid = SDPUtils.parseMsid(mediaSection); var mid = SDPUtils.getMid(mediaSection) || SDPUtils.generateIdentifier(); // Reject datachannels which are not implemented yet. if (kind === 'application' && protocol === 'DTLS/SCTP') { pc.transceivers[sdpMLineIndex] = { mid: mid, isDatachannel: true }; return; } var transceiver; var iceGatherer; var iceTransport; var dtlsTransport; var rtpReceiver; var sendEncodingParameters; var recvEncodingParameters; var localCapabilities; var track; // FIXME: ensure the mediaSection has rtcp-mux set. var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection); var remoteIceParameters; var remoteDtlsParameters; if (!rejected) { remoteIceParameters = SDPUtils.getIceParameters(mediaSection, sessionpart); remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection, sessionpart); remoteDtlsParameters.role = 'client'; } recvEncodingParameters = SDPUtils.parseRtpEncodingParameters(mediaSection); var rtcpParameters = SDPUtils.parseRtcpParameters(mediaSection); var isComplete = SDPUtils.matchPrefix(mediaSection, 'a=end-of-candidates', sessionpart).length > 0; var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:') .map(function(cand) { return SDPUtils.parseCandidate(cand); }) .filter(function(cand) { return cand.component === 1; }); // Check if we can use BUNDLE and dispose transports. if ((description.type === 'offer' || description.type === 'answer') && !rejected && usingBundle && sdpMLineIndex > 0 && pc.transceivers[sdpMLineIndex]) { pc._disposeIceAndDtlsTransports(sdpMLineIndex); pc.transceivers[sdpMLineIndex].iceGatherer = pc.transceivers[0].iceGatherer; pc.transceivers[sdpMLineIndex].iceTransport = pc.transceivers[0].iceTransport; pc.transceivers[sdpMLineIndex].dtlsTransport = pc.transceivers[0].dtlsTransport; if (pc.transceivers[sdpMLineIndex].rtpSender) { pc.transceivers[sdpMLineIndex].rtpSender.setTransport( pc.transceivers[0].dtlsTransport); } if (pc.transceivers[sdpMLineIndex].rtpReceiver) { pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport( pc.transceivers[0].dtlsTransport); } } if (description.type === 'offer' && !rejected) { transceiver = pc.transceivers[sdpMLineIndex] || pc._createTransceiver(kind); transceiver.mid = mid; if (!transceiver.iceGatherer) { transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, usingBundle); } if (cands.length && transceiver.iceTransport.state === 'new') { if (isComplete && (!usingBundle || sdpMLineIndex === 0)) { transceiver.iceTransport.setRemoteCandidates(cands); } else { cands.forEach(function(candidate) { maybeAddCandidate(transceiver.iceTransport, candidate); }); } } localCapabilities = window.RTCRtpReceiver.getCapabilities(kind); // filter RTX until additional stuff needed for RTX is implemented // in adapter.js if (edgeVersion < 15019) { localCapabilities.codecs = localCapabilities.codecs.filter( function(codec) { return codec.name !== 'rtx'; }); } sendEncodingParameters = transceiver.sendEncodingParameters || [{ ssrc: (2 * sdpMLineIndex + 2) * 1001 }]; // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams var isNewTrack = false; if (direction === 'sendrecv' || direction === 'sendonly') { isNewTrack = !transceiver.rtpReceiver; rtpReceiver = transceiver.rtpReceiver || new window.RTCRtpReceiver(transceiver.dtlsTransport, kind); if (isNewTrack) { var stream; track = rtpReceiver.track; // FIXME: does not work with Plan B. if (remoteMsid && remoteMsid.stream === '-') { // no-op. a stream id of '-' means: no associated stream. } else if (remoteMsid) { if (!streams[remoteMsid.stream]) { streams[remoteMsid.stream] = new window.MediaStream(); Object.defineProperty(streams[remoteMsid.stream], 'id', { get: function() { return remoteMsid.stream; } }); } Object.defineProperty(track, 'id', { get: function() { return remoteMsid.track; } }); stream = streams[remoteMsid.stream]; } else { if (!streams.default) { streams.default = new window.MediaStream(); } stream = streams.default; } if (stream) { addTrackToStreamAndFireEvent(track, stream); transceiver.associatedRemoteMediaStreams.push(stream); } receiverList.push([track, rtpReceiver, stream]); } } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track) { transceiver.associatedRemoteMediaStreams.forEach(function(s) { var nativeTrack = s.getTracks().find(function(t) { return t.id === transceiver.rtpReceiver.track.id; }); if (nativeTrack) { removeTrackFromStreamAndFireEvent(nativeTrack, s); } }); transceiver.associatedRemoteMediaStreams = []; } transceiver.localCapabilities = localCapabilities; transceiver.remoteCapabilities = remoteCapabilities; transceiver.rtpReceiver = rtpReceiver; transceiver.rtcpParameters = rtcpParameters; transceiver.sendEncodingParameters = sendEncodingParameters; transceiver.recvEncodingParameters = recvEncodingParameters; // Start the RTCRtpReceiver now. The RTPSender is started in // setLocalDescription. pc._transceive(pc.transceivers[sdpMLineIndex], false, isNewTrack); } else if (description.type === 'answer' && !rejected) { transceiver = pc.transceivers[sdpMLineIndex]; iceGatherer = transceiver.iceGatherer; iceTransport = transceiver.iceTransport; dtlsTransport = transceiver.dtlsTransport; rtpReceiver = transceiver.rtpReceiver; sendEncodingParameters = transceiver.sendEncodingParameters; localCapabilities = transceiver.localCapabilities; pc.transceivers[sdpMLineIndex].recvEncodingParameters = recvEncodingParameters; pc.transceivers[sdpMLineIndex].remoteCapabilities = remoteCapabilities; pc.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters; if (cands.length && iceTransport.state === 'new') { if ((isIceLite || isComplete) && (!usingBundle || sdpMLineIndex === 0)) { iceTransport.setRemoteCandidates(cands); } else { cands.forEach(function(candidate) { maybeAddCandidate(transceiver.iceTransport, candidate); }); } } if (!usingBundle || sdpMLineIndex === 0) { if (iceTransport.state === 'new') { iceTransport.start(iceGatherer, remoteIceParameters, 'controlling'); } if (dtlsTransport.state === 'new') { dtlsTransport.start(remoteDtlsParameters); } } pc._transceive(transceiver, direction === 'sendrecv' || direction === 'recvonly', direction === 'sendrecv' || direction === 'sendonly'); // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams if (rtpReceiver && (direction === 'sendrecv' || direction === 'sendonly')) { track = rtpReceiver.track; if (remoteMsid) { if (!streams[remoteMsid.stream]) { streams[remoteMsid.stream] = new window.MediaStream(); } addTrackToStreamAndFireEvent(track, streams[remoteMsid.stream]); receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]); } else { if (!streams.default) { streams.default = new window.MediaStream(); } addTrackToStreamAndFireEvent(track, streams.default); receiverList.push([track, rtpReceiver, streams.default]); } } else { // FIXME: actually the receiver should be created later. delete transceiver.rtpReceiver; } } }); if (pc._dtlsRole === undefined) { pc._dtlsRole = description.type === 'offer' ? 'active' : 'passive'; } pc.remoteDescription = { type: description.type, sdp: description.sdp }; if (description.type === 'offer') { pc._updateSignalingState('have-remote-offer'); } else { pc._updateSignalingState('stable'); } Object.keys(streams).forEach(function(sid) { var stream = streams[sid]; if (stream.getTracks().length) { if (pc.remoteStreams.indexOf(stream) === -1) { pc.remoteStreams.push(stream); var event = new Event('addstream'); event.stream = stream; window.setTimeout(function() { pc._dispatchEvent('addstream', event); }); } receiverList.forEach(function(item) { var track = item[0]; var receiver = item[1]; if (stream.id !== item[2].id) { return; } fireAddTrack(pc, track, receiver, [stream]); }); } }); receiverList.forEach(function(item) { if (item[2]) { return; } fireAddTrack(pc, item[0], item[1], []); }); // check whether addIceCandidate({}) was called within four seconds after // setRemoteDescription. window.setTimeout(function() { if (!(pc && pc.transceivers)) { return; } pc.transceivers.forEach(function(transceiver) { if (transceiver.iceTransport && transceiver.iceTransport.state === 'new' && transceiver.iceTransport.getRemoteCandidates().length > 0) { console.warn('Timeout for addRemoteCandidate. Consider sending ' + 'an end-of-candidates notification'); transceiver.iceTransport.addRemoteCandidate({}); } }); }, 4000); return Promise.resolve(); }; RTCPeerConnection.prototype.close = function() { this.transceivers.forEach(function(transceiver) { /* not yet if (transceiver.iceGatherer) { transceiver.iceGatherer.close(); } */ if (transceiver.iceTransport) { transceiver.iceTransport.stop(); } if (transceiver.dtlsTransport) { transceiver.dtlsTransport.stop(); } if (transceiver.rtpSender) { transceiver.rtpSender.stop(); } if (transceiver.rtpReceiver) { transceiver.rtpReceiver.stop(); } }); // FIXME: clean up tracks, local streams, remote streams, etc this._isClosed = true; this._updateSignalingState('closed'); }; // Update the signaling state. RTCPeerConnection.prototype._updateSignalingState = function(newState) { this.signalingState = newState; var event = new Event('signalingstatechange'); this._dispatchEvent('signalingstatechange', event); }; // Determine whether to fire the negotiationneeded event. RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function() { var pc = this; if (this.signalingState !== 'stable' || this.needNegotiation === true) { return; } this.needNegotiation = true; window.setTimeout(function() { if (pc.needNegotiation) { pc.needNegotiation = false; var event = new Event('negotiationneeded'); pc._dispatchEvent('negotiationneeded', event); } }, 0); }; // Update the connection state. RTCPeerConnection.prototype._updateConnectionState = function() { var newState; var states = { 'new': 0, closed: 0, connecting: 0, checking: 0, connected: 0, completed: 0, disconnected: 0, failed: 0 }; this.transceivers.forEach(function(transceiver) { states[transceiver.iceTransport.state]++; states[transceiver.dtlsTransport.state]++; }); // ICETransport.completed and connected are the same for this purpose. states.connected += states.completed; newState = 'new'; if (states.failed > 0) { newState = 'failed'; } else if (states.connecting > 0 || states.checking > 0) { newState = 'connecting'; } else if (states.disconnected > 0) { newState = 'disconnected'; } else if (states.new > 0) { newState = 'new'; } else if (states.connected > 0 || states.completed > 0) { newState = 'connected'; } if (newState !== this.iceConnectionState) { this.iceConnectionState = newState; var event = new Event('iceconnectionstatechange'); this._dispatchEvent('iceconnectionstatechange', event); } }; RTCPeerConnection.prototype.createOffer = function() { var pc = this; if (pc._isClosed) { return Promise.reject(makeError('InvalidStateError', 'Can not call createOffer after close')); } var numAudioTracks = pc.transceivers.filter(function(t) { return t.kind === 'audio'; }).length; var numVideoTracks = pc.transceivers.filter(function(t) { return t.kind === 'video'; }).length; // Determine number of audio and video tracks we need to send/recv. var offerOptions = arguments[0]; if (offerOptions) { // Reject Chrome legacy constraints. if (offerOptions.mandatory || offerOptions.optional) { throw new TypeError( 'Legacy mandatory/optional constraints not supported.'); } if (offerOptions.offerToReceiveAudio !== undefined) { if (offerOptions.offerToReceiveAudio === true) { numAudioTracks = 1; } else if (offerOptions.offerToReceiveAudio === false) { numAudioTracks = 0; } else { numAudioTracks = offerOptions.offerToReceiveAudio; } } if (offerOptions.offerToReceiveVideo !== undefined) { if (offerOptions.offerToReceiveVideo === true) { numVideoTracks = 1; } else if (offerOptions.offerToReceiveVideo === false) { numVideoTracks = 0; } else { numVideoTracks = offerOptions.offerToReceiveVideo; } } } pc.transceivers.forEach(function(transceiver) { if (transceiver.kind === 'audio') { numAudioTracks--; if (numAudioTracks < 0) { transceiver.wantReceive = false; } } else if (transceiver.kind === 'video') { numVideoTracks--; if (numVideoTracks < 0) { transceiver.wantReceive = false; } } }); // Create M-lines for recvonly streams. while (numAudioTracks > 0 || numVideoTracks > 0) { if (numAudioTracks > 0) { pc._createTransceiver('audio'); numAudioTracks--; } if (numVideoTracks > 0) { pc._createTransceiver('video'); numVideoTracks--; } } var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId, pc._sdpSessionVersion++); pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { // For each track, create an ice gatherer, ice transport, // dtls transport, potentially rtpsender and rtpreceiver. var track = transceiver.track; var kind = transceiver.kind; var mid = transceiver.mid || SDPUtils.generateIdentifier(); transceiver.mid = mid; if (!transceiver.iceGatherer) { transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, pc.usingBundle); } var localCapabilities = window.RTCRtpSender.getCapabilities(kind); // filter RTX until additional stuff needed for RTX is implemented // in adapter.js if (edgeVersion < 15019) { localCapabilities.codecs = localCapabilities.codecs.filter( function(codec) { return codec.name !== 'rtx'; }); } localCapabilities.codecs.forEach(function(codec) { // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552 // by adding level-asymmetry-allowed=1 if (codec.name === 'H264' && codec.parameters['level-asymmetry-allowed'] === undefined) { codec.parameters['level-asymmetry-allowed'] = '1'; } }); // generate an ssrc now, to be used later in rtpSender.send var sendEncodingParameters = transceiver.sendEncodingParameters || [{ ssrc: (2 * sdpMLineIndex + 1) * 1001 }]; if (track) { // add RTX if (edgeVersion >= 15019 && kind === 'video' && !sendEncodingParameters[0].rtx) { sendEncodingParameters[0].rtx = { ssrc: sendEncodingParameters[0].ssrc + 1 }; } } if (transceiver.wantReceive) { transceiver.rtpReceiver = new window.RTCRtpReceiver( transceiver.dtlsTransport, kind); } transceiver.localCapabilities = localCapabilities; transceiver.sendEncodingParameters = sendEncodingParameters; }); // always offer BUNDLE and dispose on return if not supported. if (pc._config.bundlePolicy !== 'max-compat') { sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function(t) { return t.mid; }).join(' ') + '\r\n'; } sdp += 'a=ice-options:trickle\r\n'; pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { sdp += writeMediaSection(transceiver, transceiver.localCapabilities, 'offer', transceiver.stream, pc._dtlsRole); sdp += 'a=rtcp-rsize\r\n'; if (transceiver.iceGatherer && pc.iceGatheringState !== 'new' && (sdpMLineIndex === 0 || !pc.usingBundle)) { transceiver.iceGatherer.getLocalCandidates().forEach(function(cand) { cand.component = 1; sdp += 'a=' + SDPUtils.writeCandidate(cand) + '\r\n'; }); if (transceiver.iceGatherer.state === 'completed') { sdp += 'a=end-of-candidates\r\n'; } } }); var desc = new window.RTCSessionDescription({ type: 'offer', sdp: sdp }); return Promise.resolve(desc); }; RTCPeerConnection.prototype.createAnswer = function() { var pc = this; if (pc._isClosed) { return Promise.reject(makeError('InvalidStateError', 'Can not call createAnswer after close')); } var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId, pc._sdpSessionVersion++); if (pc.usingBundle) { sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function(t) { return t.mid; }).join(' ') + '\r\n'; } var mediaSectionsInOffer = SDPUtils.splitSections( pc.remoteDescription.sdp).length - 1; pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { if (sdpMLineIndex + 1 > mediaSectionsInOffer) { return; } if (transceiver.isDatachannel) { sdp += 'm=application 0 DTLS/SCTP 5000\r\n' + 'c=IN IP4 0.0.0.0\r\n' + 'a=mid:' + transceiver.mid + '\r\n'; return; } // FIXME: look at direction. if (transceiver.stream) { var localTrack; if (transceiver.kind === 'audio') { localTrack = transceiver.stream.getAudioTracks()[0]; } else if (transceiver.kind === 'video') { localTrack = transceiver.stream.getVideoTracks()[0]; } if (localTrack) { // add RTX if (edgeVersion >= 15019 && transceiver.kind === 'video' && !transceiver.sendEncodingParameters[0].rtx) { transceiver.sendEncodingParameters[0].rtx = { ssrc: transceiver.sendEncodingParameters[0].ssrc + 1 }; } } } // Calculate intersection of capabilities. var commonCapabilities = getCommonCapabilities( transceiver.localCapabilities, transceiver.remoteCapabilities); var hasRtx = commonCapabilities.codecs.filter(function(c) { return c.name.toLowerCase() === 'rtx'; }).length; if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) { delete transceiver.sendEncodingParameters[0].rtx; } sdp += writeMediaSection(transceiver, commonCapabilities, 'answer', transceiver.stream, pc._dtlsRole); if (transceiver.rtcpParameters && transceiver.rtcpParameters.reducedSize) { sdp += 'a=rtcp-rsize\r\n'; } }); var desc = new window.RTCSessionDescription({ type: 'answer', sdp: sdp }); return Promise.resolve(desc); }; RTCPeerConnection.prototype.addIceCandidate = function(candidate) { var pc = this; var sections; if (candidate && !(candidate.sdpMLineIndex !== undefined || candidate.sdpMid)) { return Promise.reject(new TypeError('sdpMLineIndex or sdpMid required')); } // TODO: needs to go into ops queue. return new Promise(function(resolve, reject) { if (!pc.remoteDescription) { return reject(makeError('InvalidStateError', 'Can not add ICE candidate without a remote description')); } else if (!candidate || candidate.candidate === '') { for (var j = 0; j < pc.transceivers.length; j++) { if (pc.transceivers[j].isDatachannel) { continue; } pc.transceivers[j].iceTransport.addRemoteCandidate({}); sections = SDPUtils.splitSections(pc.remoteDescription.sdp); sections[j + 1] += 'a=end-of-candidates\r\n'; pc.remoteDescription.sdp = sections.join(''); if (pc.usingBundle) { break; } } } else { var sdpMLineIndex = candidate.sdpMLineIndex; if (candidate.sdpMid) { for (var i = 0; i < pc.transceivers.length; i++) { if (pc.transceivers[i].mid === candidate.sdpMid) { sdpMLineIndex = i; break; } } } var transceiver = pc.transceivers[sdpMLineIndex]; if (transceiver) { if (transceiver.isDatachannel) { return resolve(); } var cand = Object.keys(candidate.candidate).length > 0 ? SDPUtils.parseCandidate(candidate.candidate) : {}; // Ignore Chrome's invalid candidates since Edge does not like them. if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) { return resolve(); } // Ignore RTCP candidates, we assume RTCP-MUX. if (cand.component && cand.component !== 1) { return resolve(); } // when using bundle, avoid adding candidates to the wrong // ice transport. And avoid adding candidates added in the SDP. if (sdpMLineIndex === 0 || (sdpMLineIndex > 0 && transceiver.iceTransport !== pc.transceivers[0].iceTransport)) { if (!maybeAddCandidate(transceiver.iceTransport, cand)) { return reject(makeError('OperationError', 'Can not add ICE candidate')); } } // update the remoteDescription. var candidateString = candidate.candidate.trim(); if (candidateString.indexOf('a=') === 0) { candidateString = candidateString.substr(2); } sections = SDPUtils.splitSections(pc.remoteDescription.sdp); sections[sdpMLineIndex + 1] += 'a=' + (cand.type ? candidateString : 'end-of-candidates') + '\r\n'; pc.remoteDescription.sdp = sections.join(''); } else { return reject(makeError('OperationError', 'Can not add ICE candidate')); } } resolve(); }); }; RTCPeerConnection.prototype.getStats = function() { var promises = []; this.transceivers.forEach(function(transceiver) { ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport', 'dtlsTransport'].forEach(function(method) { if (transceiver[method]) { promises.push(transceiver[method].getStats()); } }); }); var fixStatsType = function(stat) { return { inboundrtp: 'inbound-rtp', outboundrtp: 'outbound-rtp', candidatepair: 'candidate-pair', localcandidate: 'local-candidate', remotecandidate: 'remote-candidate' }[stat.type] || stat.type; }; return new Promise(function(resolve) { // shim getStats with maplike support var results = new Map(); Promise.all(promises).then(function(res) { res.forEach(function(result) { Object.keys(result).forEach(function(id) { result[id].type = fixStatsType(result[id]); results.set(id, result[id]); }); }); resolve(results); }); }); }; // legacy callback shims. Should be moved to adapter.js some days. var methods = ['createOffer', 'createAnswer']; methods.forEach(function(method) { var nativeMethod = RTCPeerConnection.prototype[method]; RTCPeerConnection.prototype[method] = function() { var args = arguments; if (typeof args[0] === 'function' || typeof args[1] === 'function') { // legacy return nativeMethod.apply(this, [arguments[2]]) .then(function(description) { if (typeof args[0] === 'function') { args[0].apply(null, [description]); } }, function(error) { if (typeof args[1] === 'function') { args[1].apply(null, [error]); } }); } return nativeMethod.apply(this, arguments); }; }); methods = ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']; methods.forEach(function(method) { var nativeMethod = RTCPeerConnection.prototype[method]; RTCPeerConnection.prototype[method] = function() { var args = arguments; if (typeof args[1] === 'function' || typeof args[2] === 'function') { // legacy return nativeMethod.apply(this, arguments) .then(function() { if (typeof args[1] === 'function') { args[1].apply(null); } }, function(error) { if (typeof args[2] === 'function') { args[2].apply(null, [error]); } }); } return nativeMethod.apply(this, arguments); }; }); // getStats is special. It doesn't have a spec legacy method yet we support // getStats(something, cb) without error callbacks. ['getStats'].forEach(function(method) { var nativeMethod = RTCPeerConnection.prototype[method]; RTCPeerConnection.prototype[method] = function() { var args = arguments; if (typeof args[1] === 'function') { return nativeMethod.apply(this, arguments) .then(function() { if (typeof args[1] === 'function') { args[1].apply(null); } }); } return nativeMethod.apply(this, arguments); }; }); return RTCPeerConnection; }; /***/ }), /***/ "../../../../rxjs/_esm5/AsyncSubject.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AsyncSubject; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /** PURE_IMPORTS_START ._Subject,._Subscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * @class AsyncSubject */ var AsyncSubject = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */].EMPTY; } else if (this.hasCompleted && this.hasNext) { subscriber.next(this.value); subscriber.complete(); return __WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */])); //# sourceMappingURL=AsyncSubject.js.map /***/ }), /***/ "../../../../rxjs/_esm5/BehaviorSubject.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BehaviorSubject; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_ObjectUnsubscribedError__ = __webpack_require__("../../../../rxjs/_esm5/util/ObjectUnsubscribedError.js"); /** PURE_IMPORTS_START ._Subject,._util_ObjectUnsubscribedError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * @class BehaviorSubject */ var BehaviorSubject = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_1__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); } else { return this._value; } }; BehaviorSubject.prototype.next = function (value) { _super.prototype.next.call(this, this._value = value); }; return BehaviorSubject; }(__WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */])); //# sourceMappingURL=BehaviorSubject.js.map /***/ }), /***/ "../../../../rxjs/_esm5/InnerSubscriber.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InnerSubscriber; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START ._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var InnerSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=InnerSubscriber.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Notification.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Notification; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /** PURE_IMPORTS_START ._Observable PURE_IMPORTS_END */ /** * Represents a push-based event or value that an {@link Observable} can emit. * This class is particularly useful for operators that manage notifications, * like {@link materialize}, {@link dematerialize}, {@link observeOn}, and * others. Besides wrapping the actual delivered value, it also annotates it * with metadata of, for instance, what type of push message it is (`next`, * `error`, or `complete`). * * @see {@link materialize} * @see {@link dematerialize} * @see {@link observeOn} * * @class Notification */ var Notification = /*@__PURE__*/ (/*@__PURE__*/ function () { function Notification(kind, value, error) { this.kind = kind; this.value = value; this.error = error; this.hasValue = kind === 'N'; } /** * Delivers to the given `observer` the value wrapped by this Notification. * @param {Observer} observer * @return */ 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(); } }; /** * Given some {@link Observer} callbacks, deliver the value represented by the * current Notification to the correctly corresponding callback. * @param {function(value: T): void} next An Observer `next` callback. * @param {function(err: any): void} [error] An Observer `error` callback. * @param {function(): void} [complete] An Observer `complete` callback. * @return {any} */ 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(); } }; /** * Takes an Observer or its individual callback functions, and calls `observe` * or `do` methods accordingly. * @param {Observer|function(value: T): void} nextOrObserver An Observer or * the `next` callback. * @param {function(err: any): void} [error] An Observer `error` callback. * @param {function(): void} [complete] An Observer `complete` callback. * @return {any} */ Notification.prototype.accept = function (nextOrObserver, error, complete) { if (nextOrObserver && typeof nextOrObserver.next === 'function') { return this.observe(nextOrObserver); } else { return this.do(nextOrObserver, error, complete); } }; /** * Returns a simple Observable that just delivers the notification represented * by this Notification instance. * @return {any} */ Notification.prototype.toObservable = function () { var kind = this.kind; switch (kind) { case 'N': return __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */].of(this.value); case 'E': return __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */].throw(this.error); case 'C': return __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */].empty(); } throw new Error('unexpected notification kind value'); }; /** * A shortcut to create a Notification instance of the type `next` from a * given value. * @param {T} value The `next` value. * @return {Notification} The "next" Notification representing the * argument. */ Notification.createNext = function (value) { if (typeof value !== 'undefined') { return new Notification('N', value); } return Notification.undefinedValueNotification; }; /** * A shortcut to create a Notification instance of the type `error` from a * given error. * @param {any} [err] The `error` error. * @return {Notification} The "error" Notification representing the * argument. */ Notification.createError = function (err) { return new Notification('E', undefined, err); }; /** * A shortcut to create a Notification instance of the type `complete`. * @return {Notification} The valueless "complete" Notification. */ Notification.createComplete = function () { return Notification.completeNotification; }; Notification.completeNotification = new Notification('C'); Notification.undefinedValueNotification = new Notification('N', undefined); return Notification; }()); //# sourceMappingURL=Notification.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Observable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/util/toSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__symbol_observable__ = __webpack_require__("../../../../rxjs/_esm5/symbol/observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__("../../../../rxjs/_esm5/util/pipe.js"); /** PURE_IMPORTS_START ._util_root,._util_toSubscriber,._symbol_observable,._util_pipe PURE_IMPORTS_END */ /** * A representation of any set of values over any amount of time. This is the most basic building block * of RxJS. * * @class Observable */ var Observable = /*@__PURE__*/ (/*@__PURE__*/ function () { /** * @constructor * @param {Function} subscribe the function that is called when the Observable is * initially subscribed to. This function is given a Subscriber, to which new values * can be `next`ed, or an `error` method can be called to raise an error, or * `complete` can be called to notify of a successful completion. */ function Observable(subscribe) { this._isScalar = false; if (subscribe) { this._subscribe = subscribe; } } /** * Creates a new Observable, with this Observable as the source, and the passed * operator defined as the new observable's operator. * @method lift * @param {Operator} operator the operator defining the operation to take on the observable * @return {Observable} a new observable with the Operator applied */ Observable.prototype.lift = function (operator) { var observable = new Observable(); observable.source = this; observable.operator = operator; return observable; }; /** * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit. * * Use it when you have all these Observables, but still nothing is happening. * * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It * might be for example a function that you passed to a {@link create} static factory, but most of the time it is * a library implementation, which defines what and when will be emitted by an Observable. This means that calling * `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often * thought. * * Apart from starting the execution of an Observable, this method allows you to listen for values * that an Observable emits, as well as for when it completes or errors. You can achieve this in two * following ways. * * The first way is creating an object that implements {@link Observer} interface. It should have methods * defined by that interface, but note that it should be just a regular JavaScript object, which you can create * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also * that your object does not have to implement all methods. If you find yourself creating a method that doesn't * do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will * be left uncaught. * * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods. * This means you can provide three functions as arguments to `subscribe`, where first function is equivalent * of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer, * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`, * since `subscribe` recognizes these functions by where they were placed in function call. When it comes * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown. * * Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object. * This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable. * * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously. * It is an Observable itself that decides when these functions will be called. For example {@link of} * by default emits all its values synchronously. Always check documentation for how given Observable * will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}. * * @example Subscribe with an Observer * const sumObserver = { * sum: 0, * next(value) { * console.log('Adding: ' + value); * this.sum = this.sum + value; * }, * error() { // We actually could just remove this method, * }, // since we do not really care about errors right now. * complete() { * console.log('Sum equals: ' + this.sum); * } * }; * * Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes. * .subscribe(sumObserver); * * // Logs: * // "Adding: 1" * // "Adding: 2" * // "Adding: 3" * // "Sum equals: 6" * * * @example Subscribe with functions * let sum = 0; * * Rx.Observable.of(1, 2, 3) * .subscribe( * function(value) { * console.log('Adding: ' + value); * sum = sum + value; * }, * undefined, * function() { * console.log('Sum equals: ' + sum); * } * ); * * // Logs: * // "Adding: 1" * // "Adding: 2" * // "Adding: 3" * // "Sum equals: 6" * * * @example Cancel a subscription * const subscription = Rx.Observable.interval(1000).subscribe( * num => console.log(num), * undefined, * () => console.log('completed!') // Will not be called, even * ); // when cancelling subscription * * * setTimeout(() => { * subscription.unsubscribe(); * console.log('unsubscribed!'); * }, 2500); * * // Logs: * // 0 after 1s * // 1 after 2s * // "unsubscribed!" after 2.5s * * * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called, * or the first of three possible handlers, which is the handler for each value emitted from the subscribed * Observable. * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided, * the error will be thrown as unhandled. * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion. * @return {ISubscription} a subscription reference to the registered handlers * @method subscribe */ Observable.prototype.subscribe = function (observerOrNext, error, complete) { var operator = this.operator; var sink = Object(__WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__["a" /* toSubscriber */])(observerOrNext, error, complete); if (operator) { operator.call(sink, this.source); } else { sink.add(this.source ? this._subscribe(sink) : this._trySubscribe(sink)); } 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) { sink.syncErrorThrown = true; sink.syncErrorValue = err; sink.error(err); } }; /** * @method forEach * @param {Function} next a handler for each value emitted by the observable * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise * @return {Promise} a promise that either resolves on observable completion or * rejects with the handled error */ Observable.prototype.forEach = function (next, PromiseCtor) { var _this = this; if (!PromiseCtor) { if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise) { PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise; } else if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise) { PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise; } } if (!PromiseCtor) { throw new Error('no Promise impl found'); } return new PromiseCtor(function (resolve, reject) { // Must be declared in a separate statement to avoid a RefernceError when // accessing subscription below in the closure due to Temporal Dead Zone. var subscription; subscription = _this.subscribe(function (value) { if (subscription) { // if there is a subscription, then we can surmise // the next handling is asynchronous. Any errors thrown // need to be rejected explicitly and unsubscribe must be // called manually try { next(value); } catch (err) { reject(err); subscription.unsubscribe(); } } else { // if there is NO subscription, then we're getting a nexted // value synchronously during subscription. We can just call it. // If it errors, Observable's `subscribe` will ensure the // unsubscription logic is called, then synchronously rethrow the error. // After that, Promise will trap the error and send it // down the rejection path. next(value); } }, reject, resolve); }); }; Observable.prototype._subscribe = function (subscriber) { return this.source.subscribe(subscriber); }; /** * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable * @method Symbol.observable * @return {Observable} this instance of the observable */ Observable.prototype[__WEBPACK_IMPORTED_MODULE_2__symbol_observable__["a" /* observable */]] = function () { return this; }; /* tslint:enable:max-line-length */ /** * Used to stitch together functional operators into a chain. * @method pipe * @return {Observable} the Observable result of all of the operators having * been called in the order they were passed in. * * @example * * import { map, filter, scan } from 'rxjs/operators'; * * Rx.Observable.interval(1000) * .pipe( * filter(x => x % 2 === 0), * map(x => x + x), * scan((acc, x) => acc + x) * ) * .subscribe(x => console.log(x)) */ 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 Object(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["b" /* pipeFromArray */])(operations)(this); }; /* tslint:enable:max-line-length */ Observable.prototype.toPromise = function (PromiseCtor) { var _this = this; if (!PromiseCtor) { if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise) { PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise; } else if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise) { PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise; } } if (!PromiseCtor) { throw new Error('no Promise impl found'); } return new PromiseCtor(function (resolve, reject) { var value; _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); }); }; // HACK: Since TypeScript inherits static properties too, we have to // fight against TypeScript here so Subject can have a different static create signature /** * Creates a new cold Observable by calling the Observable constructor * @static true * @owner Observable * @method create * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor * @return {Observable} a new cold observable */ Observable.create = function (subscribe) { return new Observable(subscribe); }; return Observable; }()); //# sourceMappingURL=Observable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Observer.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return empty; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var empty = { closed: true, next: function (value) { }, error: function (err) { throw err; }, complete: function () { } }; //# sourceMappingURL=Observer.js.map /***/ }), /***/ "../../../../rxjs/_esm5/OuterSubscriber.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OuterSubscriber; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START ._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var OuterSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=OuterSubscriber.js.map /***/ }), /***/ "../../../../rxjs/_esm5/ReplaySubject.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ReplaySubject; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_queue__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/queue.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_observeOn__ = __webpack_require__("../../../../rxjs/_esm5/operators/observeOn.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__ = __webpack_require__("../../../../rxjs/_esm5/util/ObjectUnsubscribedError.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__ = __webpack_require__("../../../../rxjs/_esm5/SubjectSubscription.js"); /** PURE_IMPORTS_START ._Subject,._scheduler_queue,._Subscription,._operators_observeOn,._util_ObjectUnsubscribedError,._SubjectSubscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * @class ReplaySubject */ var ReplaySubject = /*@__PURE__*/ (/*@__PURE__*/ 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._bufferSize = bufferSize < 1 ? 1 : bufferSize; _this._windowTime = windowTime < 1 ? 1 : windowTime; return _this; } ReplaySubject.prototype.next = function (value) { var now = this._getNow(); this._events.push(new ReplayEvent(now, value)); this._trimBufferThenGetEvents(); _super.prototype.next.call(this, value); }; ReplaySubject.prototype._subscribe = function (subscriber) { var _events = this._trimBufferThenGetEvents(); var scheduler = this.scheduler; var subscription; if (this.closed) { throw new __WEBPACK_IMPORTED_MODULE_4__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); } else if (this.hasError) { subscription = __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY; } else if (this.isStopped) { subscription = __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY; } else { this.observers.push(subscriber); subscription = new __WEBPACK_IMPORTED_MODULE_5__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber); } if (scheduler) { subscriber.add(subscriber = new __WEBPACK_IMPORTED_MODULE_3__operators_observeOn__["a" /* ObserveOnSubscriber */](subscriber, scheduler)); } var len = _events.length; 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 || __WEBPACK_IMPORTED_MODULE_1__scheduler_queue__["a" /* 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; // Trim events that fall out of the time window. // Start at the front of the list. Break early once // we encounter an event that falls within the window. 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; }(__WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */])); var ReplayEvent = /*@__PURE__*/ (/*@__PURE__*/ function () { function ReplayEvent(time, value) { this.time = time; this.value = value; } return ReplayEvent; }()); //# sourceMappingURL=ReplaySubject.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Scheduler.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Scheduler; }); /** * An execution context and a data structure to order tasks and schedule their * execution. Provides a notion of (potentially virtual) time, through the * `now()` getter method. * * Each unit of work in a Scheduler is called an {@link Action}. * * ```ts * class Scheduler { * now(): number; * schedule(work, delay?, state?): Subscription; * } * ``` * * @class Scheduler */ var Scheduler = /*@__PURE__*/ (/*@__PURE__*/ function () { function Scheduler(SchedulerAction, now) { if (now === void 0) { now = Scheduler.now; } this.SchedulerAction = SchedulerAction; this.now = now; } /** * Schedules a function, `work`, for execution. May happen at some point in * the future, according to the `delay` parameter, if specified. May be passed * some context object, `state`, which will be passed to the `work` function. * * The given arguments will be processed an stored as an Action object in a * queue of actions. * * @param {function(state: ?T): ?Subscription} work A function representing a * task, or some unit of work to be executed by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler itself. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @return {Subscription} A subscription in order to be able to unsubscribe * the scheduled work. */ Scheduler.prototype.schedule = function (work, delay, state) { if (delay === void 0) { delay = 0; } return new this.SchedulerAction(this, work).schedule(state, delay); }; Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; return Scheduler; }()); //# sourceMappingURL=Scheduler.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Subject.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SubjectSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subject; }); /* unused harmony export AnonymousSubject */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__ = __webpack_require__("../../../../rxjs/_esm5/util/ObjectUnsubscribedError.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SubjectSubscription__ = __webpack_require__("../../../../rxjs/_esm5/SubjectSubscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_rxSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/symbol/rxSubscriber.js"); /** PURE_IMPORTS_START ._Observable,._Subscriber,._Subscription,._util_ObjectUnsubscribedError,._SubjectSubscription,._symbol_rxSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * @class SubjectSubscriber */ var SubjectSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(SubjectSubscriber, _super); function SubjectSubscriber(destination) { var _this = _super.call(this, destination) || this; _this.destination = destination; return _this; } return SubjectSubscriber; }(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* Subscriber */])); /** * @class Subject */ var Subject = /*@__PURE__*/ (/*@__PURE__*/ 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[__WEBPACK_IMPORTED_MODULE_5__symbol_rxSubscriber__["a" /* 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 __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* 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 __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* 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 __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* 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 __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); } else { return _super.prototype._trySubscribe.call(this, subscriber); } }; Subject.prototype._subscribe = function (subscriber) { if (this.closed) { throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */](); } else if (this.hasError) { subscriber.error(this.thrownError); return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY; } else if (this.isStopped) { subscriber.complete(); return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY; } else { this.observers.push(subscriber); return new __WEBPACK_IMPORTED_MODULE_4__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber); } }; Subject.prototype.asObservable = function () { var observable = new __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */](); observable.source = this; return observable; }; Subject.create = function (destination, source) { return new AnonymousSubject(destination, source); }; return Subject; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); /** * @class AnonymousSubject */ var AnonymousSubject = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY; } }; return AnonymousSubject; }(Subject)); //# sourceMappingURL=Subject.js.map /***/ }), /***/ "../../../../rxjs/_esm5/SubjectSubscription.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SubjectSubscription; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /** PURE_IMPORTS_START ._Subscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SubjectSubscription = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscription__["a" /* Subscription */])); //# sourceMappingURL=SubjectSubscription.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Subscriber.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscriber; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isFunction__ = __webpack_require__("../../../../rxjs/_esm5/util/isFunction.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__("../../../../rxjs/_esm5/Observer.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__symbol_rxSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/symbol/rxSubscriber.js"); /** PURE_IMPORTS_START ._util_isFunction,._Subscription,._Observer,._symbol_rxSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Implements the {@link Observer} interface and extends the * {@link Subscription} class. While the {@link Observer} is the public API for * consuming the values of an {@link Observable}, all Observers get converted to * a Subscriber, in order to provide Subscription-like capabilities such as * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for * implementing operators, but it is rarely used as a public API. * * @class Subscriber */ var Subscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(Subscriber, _super); /** * @param {Observer|function(value: T): void} [destinationOrNext] A partially * defined Observer or a `next` callback function. * @param {function(e: ?any): void} [error] The `error` callback of an * Observer. * @param {function(): void} [complete] The `complete` callback of an * Observer. */ 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 = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]; break; case 1: if (!destinationOrNext) { _this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]; break; } if (typeof destinationOrNext === 'object') { if (destinationOrNext instanceof Subscriber) { _this.destination = destinationOrNext; _this.destination.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[__WEBPACK_IMPORTED_MODULE_3__symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { return this; }; /** * A static factory for a Subscriber, given a (potentially partial) definition * of an Observer. * @param {function(x: ?T): void} [next] The `next` callback of an Observer. * @param {function(e: ?any): void} [error] The `error` callback of an * Observer. * @param {function(): void} [complete] The `complete` callback of an * Observer. * @return {Subscriber} A Subscriber wrapping the (partially defined) * Observer represented by the given arguments. */ Subscriber.create = function (next, error, complete) { var subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; }; /** * The {@link Observer} callback to receive notifications of type `next` from * the Observable, with a value. The Observable may call this method 0 or more * times. * @param {T} [value] The `next` value. * @return {void} */ Subscriber.prototype.next = function (value) { if (!this.isStopped) { this._next(value); } }; /** * The {@link Observer} callback to receive notifications of type `error` from * the Observable, with an attached {@link Error}. Notifies the Observer that * the Observable has experienced an error condition. * @param {any} [err] The `error` exception. * @return {void} */ Subscriber.prototype.error = function (err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } }; /** * The {@link Observer} callback to receive a valueless notification of type * `complete` from the Observable. Notifies the Observer that the Observable * has finished sending push-based notifications. * @return {void} */ 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 _a = this, _parent = _a._parent, _parents = _a._parents; this._parent = null; this._parents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parent = _parent; this._parents = _parents; return this; }; return Subscriber; }(__WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SafeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 (Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* isFunction */])(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]) { context = Object.create(observerOrNext); if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* 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 (!_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; if (this._error) { if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); throw err; } else { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; 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 (!_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(); throw err; } }; SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { try { fn.call(this._context, value); } catch (err) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } return false; }; SafeSubscriber.prototype._unsubscribe = function () { var _parentSubscriber = this._parentSubscriber; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); }; return SafeSubscriber; }(Subscriber)); //# sourceMappingURL=Subscriber.js.map /***/ }), /***/ "../../../../rxjs/_esm5/Subscription.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__("../../../../rxjs/_esm5/util/isObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__("../../../../rxjs/_esm5/util/isFunction.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__("../../../../rxjs/_esm5/util/UnsubscriptionError.js"); /** PURE_IMPORTS_START ._util_isArray,._util_isObject,._util_isFunction,._util_tryCatch,._util_errorObject,._util_UnsubscriptionError PURE_IMPORTS_END */ /** * Represents a disposable resource, such as the execution of an Observable. A * Subscription has one important method, `unsubscribe`, that takes no argument * and just disposes the resource held by the subscription. * * Additionally, subscriptions may be grouped together through the `add()` * method, which will attach a child Subscription to the current Subscription. * When a Subscription is unsubscribed, all its children (and its grandchildren) * will be unsubscribed as well. * * @class Subscription */ var Subscription = /*@__PURE__*/ (/*@__PURE__*/ function () { /** * @param {function(): void} [unsubscribe] A function describing how to * perform the disposal of resources when the `unsubscribe` method is called. */ function Subscription(unsubscribe) { /** * A flag to indicate whether this Subscription has already been unsubscribed. * @type {boolean} */ this.closed = false; this._parent = null; this._parents = null; this._subscriptions = null; if (unsubscribe) { this._unsubscribe = unsubscribe; } } /** * Disposes the resources held by the subscription. May, for instance, cancel * an ongoing Observable execution or cancel any other type of work that * started when the Subscription was created. * @return {void} */ Subscription.prototype.unsubscribe = function () { var hasErrors = false; var errors; if (this.closed) { return; } var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; this.closed = true; this._parent = null; this._parents = null; // null out _subscriptions first so any child subscriptions that attempt // to remove themselves from this subscription will noop this._subscriptions = null; var index = -1; var len = _parents ? _parents.length : 0; // if this._parent is null, then so is this._parents, and we // don't have to remove ourselves from any parent subscriptions. while (_parent) { _parent.remove(this); // if this._parents is null or index >= len, // then _parent is set to null, and the loop exits _parent = ++index < len && _parents[index] || null; } if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(_unsubscribe)) { var trial = Object(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(_unsubscribe).call(this); if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) { hasErrors = true; errors = errors || (__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */] ? flattenUnsubscriptionErrors(__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e.errors) : [__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e]); } } if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(_subscriptions)) { index = -1; len = _subscriptions.length; while (++index < len) { var sub = _subscriptions[index]; if (Object(__WEBPACK_IMPORTED_MODULE_1__util_isObject__["a" /* isObject */])(sub)) { var trial = Object(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(sub.unsubscribe).call(sub); if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) { hasErrors = true; errors = errors || []; var err = __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e; if (err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) { errors = errors.concat(flattenUnsubscriptionErrors(err.errors)); } else { errors.push(err); } } } } } if (hasErrors) { throw new __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */](errors); } }; /** * Adds a tear down to be called during the unsubscribe() of this * Subscription. * * If the tear down being added is a subscription that is already * unsubscribed, is the same reference `add` is being called on, or is * `Subscription.EMPTY`, it will not be added. * * If this subscription is already in an `closed` state, the passed * tear down logic will be executed immediately. * * @param {TeardownLogic} teardown The additional logic to execute on * teardown. * @return {Subscription} Returns the Subscription used or created to be * added to the inner subscriptions list. This Subscription can be used with * `remove()` to remove the passed teardown logic from the inner subscriptions * list. */ Subscription.prototype.add = function (teardown) { if (!teardown || (teardown === Subscription.EMPTY)) { return Subscription.EMPTY; } if (teardown === this) { return this; } var subscription = teardown; switch (typeof teardown) { case 'function': subscription = new Subscription(teardown); case 'object': if (subscription.closed || typeof subscription.unsubscribe !== 'function') { return subscription; } else if (this.closed) { subscription.unsubscribe(); return subscription; } else if (typeof subscription._addParent !== 'function' /* quack quack */) { var tmp = subscription; subscription = new Subscription(); subscription._subscriptions = [tmp]; } break; default: throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); } var subscriptions = this._subscriptions || (this._subscriptions = []); subscriptions.push(subscription); subscription._addParent(this); return subscription; }; /** * Removes a Subscription from the internal list of subscriptions that will * unsubscribe during the unsubscribe process of this Subscription. * @param {Subscription} subscription The subscription to remove. * @return {void} */ Subscription.prototype.remove = function (subscription) { var subscriptions = this._subscriptions; if (subscriptions) { var subscriptionIndex = subscriptions.indexOf(subscription); if (subscriptionIndex !== -1) { subscriptions.splice(subscriptionIndex, 1); } } }; Subscription.prototype._addParent = function (parent) { var _a = this, _parent = _a._parent, _parents = _a._parents; if (!_parent || _parent === parent) { // If we don't have a parent, or the new parent is the same as the // current parent, then set this._parent to the new parent. this._parent = parent; } else if (!_parents) { // If there's already one parent, but not multiple, allocate an Array to // store the rest of the parent Subscriptions. this._parents = [parent]; } else if (_parents.indexOf(parent) === -1) { // Only add the new parent to the _parents list if it's not already there. _parents.push(parent); } }; Subscription.EMPTY = (function (empty) { empty.closed = true; return empty; }(new Subscription())); return Subscription; }()); function flattenUnsubscriptionErrors(errors) { return errors.reduce(function (errs, err) { return errs.concat((err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) ? err.errors : err); }, []); } //# sourceMappingURL=Subscription.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/ArrayLikeObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayLikeObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ScalarObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /** PURE_IMPORTS_START .._Observable,._ScalarObservable,._EmptyObservable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ArrayLikeObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ArrayLikeObservable, _super); function ArrayLikeObservable(arrayLike, scheduler) { var _this = _super.call(this) || this; _this.arrayLike = arrayLike; _this.scheduler = scheduler; if (!scheduler && arrayLike.length === 1) { _this._isScalar = true; _this.value = arrayLike[0]; } return _this; } ArrayLikeObservable.create = function (arrayLike, scheduler) { var length = arrayLike.length; if (length === 0) { return new __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__["a" /* EmptyObservable */](); } else if (length === 1) { return new __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__["a" /* ScalarObservable */](arrayLike[0], scheduler); } else { return new ArrayLikeObservable(arrayLike, scheduler); } }; ArrayLikeObservable.dispatch = function (state) { var arrayLike = state.arrayLike, index = state.index, length = state.length, subscriber = state.subscriber; if (subscriber.closed) { return; } if (index >= length) { subscriber.complete(); return; } subscriber.next(arrayLike[index]); state.index = index + 1; this.schedule(state); }; ArrayLikeObservable.prototype._subscribe = function (subscriber) { var index = 0; var _a = this, arrayLike = _a.arrayLike, scheduler = _a.scheduler; var length = arrayLike.length; if (scheduler) { return scheduler.schedule(ArrayLikeObservable.dispatch, 0, { arrayLike: arrayLike, index: index, length: length, subscriber: subscriber }); } else { for (var i = 0; i < length && !subscriber.closed; i++) { subscriber.next(arrayLike[i]); } subscriber.complete(); } }; return ArrayLikeObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); //# sourceMappingURL=ArrayLikeObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/ArrayObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ScalarObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /** PURE_IMPORTS_START .._Observable,._ScalarObservable,._EmptyObservable,.._util_isScheduler PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ArrayObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ArrayObservable, _super); function ArrayObservable(array, scheduler) { var _this = _super.call(this) || this; _this.array = array; _this.scheduler = scheduler; if (!scheduler && array.length === 1) { _this._isScalar = true; _this.value = array[0]; } return _this; } ArrayObservable.create = function (array, scheduler) { return new ArrayObservable(array, scheduler); }; /** * Creates an Observable that emits some values you specify as arguments, * immediately one after the other, and then emits a complete notification. * * Emits the arguments you provide, then completes. * * * * * This static operator is useful for creating a simple Observable that only * emits the arguments given, and the complete notification thereafter. It can * be used for composing with other Observables, such as with {@link concat}. * By default, it uses a `null` IScheduler, which means the `next` * notifications are sent synchronously, although with a different IScheduler * it is possible to determine when those notifications will be delivered. * * @example Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second. * var numbers = Rx.Observable.of(10, 20, 30); * var letters = Rx.Observable.of('a', 'b', 'c'); * var interval = Rx.Observable.interval(1000); * var result = numbers.concat(letters).concat(interval); * result.subscribe(x => console.log(x)); * * @see {@link create} * @see {@link empty} * @see {@link never} * @see {@link throw} * * @param {...T} values Arguments that represent `next` values to be emitted. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling * the emissions of the `next` notifications. * @return {Observable} An Observable that emits each given input value. * @static true * @name of * @owner Observable */ ArrayObservable.of = function () { var array = []; for (var _i = 0; _i < arguments.length; _i++) { array[_i] = arguments[_i]; } var scheduler = array[array.length - 1]; if (Object(__WEBPACK_IMPORTED_MODULE_3__util_isScheduler__["a" /* isScheduler */])(scheduler)) { array.pop(); } else { scheduler = null; } var len = array.length; if (len > 1) { return new ArrayObservable(array, scheduler); } else if (len === 1) { return new __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__["a" /* ScalarObservable */](array[0], scheduler); } else { return new __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__["a" /* EmptyObservable */](scheduler); } }; ArrayObservable.dispatch = function (state) { var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber; if (index >= count) { subscriber.complete(); return; } subscriber.next(array[index]); if (subscriber.closed) { return; } state.index = index + 1; this.schedule(state); }; ArrayObservable.prototype._subscribe = function (subscriber) { var index = 0; var array = this.array; var count = array.length; var scheduler = this.scheduler; if (scheduler) { return scheduler.schedule(ArrayObservable.dispatch, 0, { array: array, index: index, count: count, subscriber: subscriber }); } else { for (var i = 0; i < count && !subscriber.closed; i++) { subscriber.next(array[i]); } subscriber.complete(); } }; return ArrayObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); //# sourceMappingURL=ArrayObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/ConnectableObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export ConnectableObservable */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return connectableObservableDescriptor; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__operators_refCount__ = __webpack_require__("../../../../rxjs/_esm5/operators/refCount.js"); /** PURE_IMPORTS_START .._Subject,.._Observable,.._Subscriber,.._Subscription,.._operators_refCount PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * @class ConnectableObservable */ var ConnectableObservable = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */](); connection.add(this.source .subscribe(new ConnectableSubscriber(this.getSubject(), this))); if (connection.closed) { this._connection = null; connection = __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY; } else { this._connection = connection; } } return connection; }; ConnectableObservable.prototype.refCount = function () { return Object(__WEBPACK_IMPORTED_MODULE_4__operators_refCount__["a" /* refCount */])()(this); }; return ConnectableObservable; }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); var connectableProto = ConnectableObservable.prototype; var connectableObservableDescriptor = { 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 = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subject__["b" /* SubjectSubscriber */])); var RefCountOperator = /*@__PURE__*/ (/*@__PURE__*/ 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 = /*@__PURE__*/ (/*@__PURE__*/ 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; } /// // Compare the local RefCountSubscriber's connection Subscription to the // connection Subscription on the shared ConnectableObservable. In cases // where the ConnectableObservable source synchronously emits values, and // the RefCountSubscriber's downstream Observers synchronously unsubscribe, // execution continues to here before the RefCountOperator has a chance to // supply the RefCountSubscriber with the shared connection Subscription. // For example: // ``` // Observable.range(0, 10) // .publish() // .refCount() // .take(5) // .subscribe(); // ``` // In order to account for this case, RefCountSubscriber should only dispose // the ConnectableObservable's shared connection Subscription if the // connection Subscription exists, *and* either: // a. RefCountSubscriber doesn't have a reference to the shared connection // Subscription yet, or, // b. RefCountSubscriber's connection Subscription reference is identical // to the shared connection Subscription /// var connection = this.connection; var sharedConnection = connectable._connection; this.connection = null; if (sharedConnection && (!connection || sharedConnection === connection)) { sharedConnection.unsubscribe(); } }; return RefCountSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=ConnectableObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/DeferObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DeferObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /** PURE_IMPORTS_START .._Observable,.._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var DeferObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(DeferObservable, _super); function DeferObservable(observableFactory) { var _this = _super.call(this) || this; _this.observableFactory = observableFactory; return _this; } /** * Creates an Observable that, on subscribe, calls an Observable factory to * make an Observable for each new Observer. * * Creates the Observable lazily, that is, only when it * is subscribed. * * * * * `defer` allows you to create the Observable only when the Observer * subscribes, and create a fresh Observable for each Observer. It waits until * an Observer subscribes to it, and then it generates an Observable, * typically with an Observable factory function. It does this afresh for each * subscriber, so although each subscriber may think it is subscribing to the * same Observable, in fact each subscriber gets its own individual * Observable. * * @example Subscribe to either an Observable of clicks or an Observable of interval, at random * var clicksOrInterval = Rx.Observable.defer(function () { * if (Math.random() > 0.5) { * return Rx.Observable.fromEvent(document, 'click'); * } else { * return Rx.Observable.interval(1000); * } * }); * clicksOrInterval.subscribe(x => console.log(x)); * * // Results in the following behavior: * // If the result of Math.random() is greater than 0.5 it will listen * // for clicks anywhere on the "document"; when document is clicked it * // will log a MouseEvent object to the console. If the result is less * // than 0.5 it will emit ascending numbers, one every second(1000ms). * * @see {@link create} * * @param {function(): SubscribableOrPromise} observableFactory The Observable * factory function to invoke for each Observer that subscribes to the output * Observable. May also return a Promise, which will be converted on the fly * to an Observable. * @return {Observable} An Observable whose Observers' subscriptions trigger * an invocation of the given Observable factory function. * @static true * @name defer * @owner Observable */ DeferObservable.create = function (observableFactory) { return new DeferObservable(observableFactory); }; DeferObservable.prototype._subscribe = function (subscriber) { return new DeferSubscriber(subscriber, this.observableFactory); }; return DeferObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); var DeferSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(DeferSubscriber, _super); function DeferSubscriber(destination, factory) { var _this = _super.call(this, destination) || this; _this.factory = factory; _this.tryDefer(); return _this; } DeferSubscriber.prototype.tryDefer = function () { try { this._callFactory(); } catch (err) { this._error(err); } }; DeferSubscriber.prototype._callFactory = function () { var result = this.factory(); if (result) { this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, result)); } }; return DeferSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=DeferObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/EmptyObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EmptyObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var EmptyObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(EmptyObservable, _super); function EmptyObservable(scheduler) { var _this = _super.call(this) || this; _this.scheduler = scheduler; return _this; } /** * Creates an Observable that emits no items to the Observer and immediately * emits a complete notification. * * Just emits 'complete', and nothing else. * * * * * This static operator is useful for creating a simple Observable that only * emits the complete notification. It can be used for composing with other * Observables, such as in a {@link mergeMap}. * * @example Emit the number 7, then complete. * var result = Rx.Observable.empty().startWith(7); * result.subscribe(x => console.log(x)); * * @example Map and flatten only odd numbers to the sequence 'a', 'b', 'c' * var interval = Rx.Observable.interval(1000); * var result = interval.mergeMap(x => * x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty() * ); * result.subscribe(x => console.log(x)); * * // Results in the following to the console: * // x is equal to the count on the interval eg(0,1,2,3,...) * // x will occur every 1000ms * // if x % 2 is equal to 1 print abc * // if x % 2 is not equal to 1 nothing will be output * * @see {@link create} * @see {@link never} * @see {@link of} * @see {@link throw} * * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling * the emission of the complete notification. * @return {Observable} An "empty" Observable: emits only the complete * notification. * @static true * @name empty * @owner Observable */ EmptyObservable.create = function (scheduler) { return new EmptyObservable(scheduler); }; EmptyObservable.dispatch = function (arg) { var subscriber = arg.subscriber; subscriber.complete(); }; EmptyObservable.prototype._subscribe = function (subscriber) { var scheduler = this.scheduler; if (scheduler) { return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber }); } else { subscriber.complete(); } }; return EmptyObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); //# sourceMappingURL=EmptyObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/ErrorObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ErrorObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ErrorObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ErrorObservable, _super); function ErrorObservable(error, scheduler) { var _this = _super.call(this) || this; _this.error = error; _this.scheduler = scheduler; return _this; } /** * Creates an Observable that emits no items to the Observer and immediately * emits an error notification. * * Just emits 'error', and nothing else. * * * * * This static operator is useful for creating a simple Observable that only * emits the error notification. It can be used for composing with other * Observables, such as in a {@link mergeMap}. * * @example Emit the number 7, then emit an error. * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); * result.subscribe(x => console.log(x), e => console.error(e)); * * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 * var interval = Rx.Observable.interval(1000); * var result = interval.mergeMap(x => * x === 13 ? * Rx.Observable.throw('Thirteens are bad') : * Rx.Observable.of('a', 'b', 'c') * ); * result.subscribe(x => console.log(x), e => console.error(e)); * * @see {@link create} * @see {@link empty} * @see {@link never} * @see {@link of} * * @param {any} error The particular Error to pass to the error notification. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling * the emission of the error notification. * @return {Observable} An error Observable: emits only the error notification * using the given error argument. * @static true * @name throw * @owner Observable */ ErrorObservable.create = function (error, scheduler) { return new ErrorObservable(error, scheduler); }; ErrorObservable.dispatch = function (arg) { var error = arg.error, subscriber = arg.subscriber; subscriber.error(error); }; ErrorObservable.prototype._subscribe = function (subscriber) { var error = this.error; var scheduler = this.scheduler; subscriber.syncErrorThrowable = true; if (scheduler) { return scheduler.schedule(ErrorObservable.dispatch, 0, { error: error, subscriber: subscriber }); } else { subscriber.error(error); } }; return ErrorObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); //# sourceMappingURL=ErrorObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/ForkJoinObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ForkJoinObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /** PURE_IMPORTS_START .._Observable,._EmptyObservable,.._util_isArray,.._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ForkJoinObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ForkJoinObservable, _super); function ForkJoinObservable(sources, resultSelector) { var _this = _super.call(this) || this; _this.sources = sources; _this.resultSelector = resultSelector; return _this; } /* tslint:enable:max-line-length */ /** * Joins last values emitted by passed Observables. * * Wait for Observables to complete and then combine last values they emitted. * * * * `forkJoin` is an operator that takes any number of Observables which can be passed either as an array * or directly as arguments. If no input Observables are provided, resulting stream will complete * immediately. * * `forkJoin` will wait for all passed Observables to complete and then it will emit an array with last * values from corresponding Observables. So if you pass `n` Observables to the operator, resulting * array will have `n` values, where first value is the last thing emitted by the first Observable, * second value is the last thing emitted by the second Observable and so on. That means `forkJoin` will * not emit more than once and it will complete after that. If you need to emit combined values not only * at the end of lifecycle of passed Observables, but also throughout it, try out {@link combineLatest} * or {@link zip} instead. * * In order for resulting array to have the same length as the number of input Observables, whenever any of * that Observables completes without emitting any value, `forkJoin` will complete at that moment as well * and it will not emit anything either, even if it already has some last values from other Observables. * Conversely, if there is an Observable that never completes, `forkJoin` will never complete as well, * unless at any point some other Observable completes without emitting value, which brings us back to * the previous case. Overall, in order for `forkJoin` to emit a value, all Observables passed as arguments * have to emit something at least once and complete. * * If any input Observable errors at some point, `forkJoin` will error as well and all other Observables * will be immediately unsubscribed. * * Optionally `forkJoin` accepts project function, that will be called with values which normally * would land in emitted array. Whatever is returned by project function, will appear in output * Observable instead. This means that default project can be thought of as a function that takes * all its arguments and puts them into an array. Note that project function will be called only * when output Observable is supposed to emit a result. * * @example Use forkJoin with operator emitting immediately * const observable = Rx.Observable.forkJoin( * Rx.Observable.of(1, 2, 3, 4), * Rx.Observable.of(5, 6, 7, 8) * ); * observable.subscribe( * value => console.log(value), * err => {}, * () => console.log('This is how it ends!') * ); * * // Logs: * // [4, 8] * // "This is how it ends!" * * * @example Use forkJoin with operator emitting after some time * const observable = Rx.Observable.forkJoin( * Rx.Observable.interval(1000).take(3), // emit 0, 1, 2 every second and complete * Rx.Observable.interval(500).take(4) // emit 0, 1, 2, 3 every half a second and complete * ); * observable.subscribe( * value => console.log(value), * err => {}, * () => console.log('This is how it ends!') * ); * * // Logs: * // [2, 3] after 3 seconds * // "This is how it ends!" immediately after * * * @example Use forkJoin with project function * const observable = Rx.Observable.forkJoin( * Rx.Observable.interval(1000).take(3), // emit 0, 1, 2 every second and complete * Rx.Observable.interval(500).take(4), // emit 0, 1, 2, 3 every half a second and complete * (n, m) => n + m * ); * observable.subscribe( * value => console.log(value), * err => {}, * () => console.log('This is how it ends!') * ); * * // Logs: * // 5 after 3 seconds * // "This is how it ends!" immediately after * * @see {@link combineLatest} * @see {@link zip} * * @param {...SubscribableOrPromise} sources Any number of Observables provided either as an array or as an arguments * passed directly to the operator. * @param {function} [project] Function that takes values emitted by input Observables and returns value * that will appear in resulting Observable instead of default array. * @return {Observable} Observable emitting either an array of last values emitted by passed Observables * or value from project function. * @static true * @name forkJoin * @owner Observable */ ForkJoinObservable.create = function () { var sources = []; for (var _i = 0; _i < arguments.length; _i++) { sources[_i] = arguments[_i]; } if (sources === null || arguments.length === 0) { return new __WEBPACK_IMPORTED_MODULE_1__EmptyObservable__["a" /* EmptyObservable */](); } var resultSelector = null; if (typeof sources[sources.length - 1] === 'function') { resultSelector = sources.pop(); } // if the first and only other argument besides the resultSelector is an array // assume it's been called with `forkJoin([obs1, obs2, obs3], resultSelector)` if (sources.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_2__util_isArray__["a" /* isArray */])(sources[0])) { sources = sources[0]; } if (sources.length === 0) { return new __WEBPACK_IMPORTED_MODULE_1__EmptyObservable__["a" /* EmptyObservable */](); } return new ForkJoinObservable(sources, resultSelector); }; ForkJoinObservable.prototype._subscribe = function (subscriber) { return new ForkJoinSubscriber(subscriber, this.sources, this.resultSelector); }; return ForkJoinObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ForkJoinSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ForkJoinSubscriber, _super); function ForkJoinSubscriber(destination, sources, resultSelector) { var _this = _super.call(this, destination) || this; _this.sources = sources; _this.resultSelector = resultSelector; _this.completed = 0; _this.haveValues = 0; var len = sources.length; _this.total = len; _this.values = new Array(len); for (var i = 0; i < len; i++) { var source = sources[i]; var innerSubscription = Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* subscribeToResult */])(_this, source, null, i); if (innerSubscription) { innerSubscription.outerIndex = i; _this.add(innerSubscription); } } return _this; } ForkJoinSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.values[outerIndex] = innerValue; if (!innerSub._hasValue) { innerSub._hasValue = true; this.haveValues++; } }; ForkJoinSubscriber.prototype.notifyComplete = function (innerSub) { var destination = this.destination; var _a = this, haveValues = _a.haveValues, resultSelector = _a.resultSelector, values = _a.values; var len = values.length; if (!innerSub._hasValue) { destination.complete(); return; } this.completed++; if (this.completed !== len) { return; } if (haveValues === len) { var value = resultSelector ? resultSelector.apply(this, values) : values; destination.next(value); } destination.complete(); }; return ForkJoinSubscriber; }(__WEBPACK_IMPORTED_MODULE_4__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=ForkJoinObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/FromEventObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FromEventObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__("../../../../rxjs/_esm5/util/isFunction.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /** PURE_IMPORTS_START .._Observable,.._util_tryCatch,.._util_isFunction,.._util_errorObject,.._Subscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var toString = Object.prototype.toString; 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 isNodeList(sourceObj) { return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; } function isHTMLCollection(sourceObj) { return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; } function isEventTarget(sourceObj) { return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; } /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var FromEventObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(FromEventObservable, _super); function FromEventObservable(sourceObj, eventName, selector, options) { var _this = _super.call(this) || this; _this.sourceObj = sourceObj; _this.eventName = eventName; _this.selector = selector; _this.options = options; return _this; } /* tslint:enable:max-line-length */ /** * Creates an Observable that emits events of a specific type coming from the * given event target. * * Creates an Observable from DOM events, or Node.js * EventEmitter events or others. * * * * `fromEvent` accepts as a first argument event target, which is an object with methods * for registering event handler functions. As a second argument it takes string that indicates * type of event we want to listen for. `fromEvent` supports selected types of event targets, * which are described in detail below. If your event target does not match any of the ones listed, * you should use {@link fromEventPattern}, which can be used on arbitrary APIs. * When it comes to APIs supported by `fromEvent`, their methods for adding and removing event * handler functions have different names, but they all accept a string describing event type * and function itself, which will be called whenever said event happens. * * Every time resulting Observable is subscribed, event handler function will be registered * to event target on given event type. When that event fires, value * passed as a first argument to registered function will be emitted by output Observable. * When Observable is unsubscribed, function will be unregistered from event target. * * Note that if event target calls registered function with more than one argument, second * and following arguments will not appear in resulting stream. In order to get access to them, * you can pass to `fromEvent` optional project function, which will be called with all arguments * passed to event handler. Output Observable will then emit value returned by project function, * instead of the usual value. * * Remember that event targets listed below are checked via duck typing. It means that * no matter what kind of object you have and no matter what environment you work in, * you can safely use `fromEvent` on that object if it exposes described methods (provided * of course they behave as was described above). So for example if Node.js library exposes * event target which has the same method names as DOM EventTarget, `fromEvent` is still * a good choice. * * If the API you use is more callback then event handler oriented (subscribed * callback function fires only once and thus there is no need to manually * unregister it), you should use {@link bindCallback} or {@link bindNodeCallback} * instead. * * `fromEvent` supports following types of event targets: * * **DOM EventTarget** * * This is an object with `addEventListener` and `removeEventListener` methods. * * In the browser, `addEventListener` accepts - apart from event type string and event * handler function arguments - optional third parameter, which is either an object or boolean, * both used for additional configuration how and when passed function will be called. When * `fromEvent` is used with event target of that type, you can provide this values * as third parameter as well. * * **Node.js EventEmitter** * * An object with `addListener` and `removeListener` methods. * * **JQuery-style event target** * * An object with `on` and `off` methods * * **DOM NodeList** * * List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`. * * Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes * it contains and install event handler function in every of them. When returned Observable * is unsubscribed, function will be removed from all Nodes. * * **DOM HtmlCollection** * * Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is * installed and removed in each of elements. * * * @example Emits clicks happening on the DOM document * var clicks = Rx.Observable.fromEvent(document, 'click'); * clicks.subscribe(x => console.log(x)); * * // Results in: * // MouseEvent object logged to console every time a click * // occurs on the document. * * * @example Use addEventListener with capture option * var clicksInDocument = Rx.Observable.fromEvent(document, 'click', true); // note optional configuration parameter * // which will be passed to addEventListener * var clicksInDiv = Rx.Observable.fromEvent(someDivInDocument, 'click'); * * clicksInDocument.subscribe(() => console.log('document')); * clicksInDiv.subscribe(() => console.log('div')); * * // By default events bubble UP in DOM tree, so normally * // when we would click on div in document * // "div" would be logged first and then "document". * // Since we specified optional `capture` option, document * // will catch event when it goes DOWN DOM tree, so console * // will log "document" and then "div". * * @see {@link bindCallback} * @see {@link bindNodeCallback} * @see {@link fromEventPattern} * * @param {EventTargetLike} target The DOM EventTarget, Node.js * EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to. * @param {string} eventName The event name of interest, being emitted by the * `target`. * @param {EventListenerOptions} [options] Options to pass through to addEventListener * @param {SelectorMethodSignature} [selector] An optional function to * post-process results. It takes the arguments from the event handler and * should return a single value. * @return {Observable} * @static true * @name fromEvent * @owner Observable */ FromEventObservable.create = function (target, eventName, options, selector) { if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(options)) { selector = options; options = undefined; } return new FromEventObservable(target, eventName, selector, options); }; FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { var unsubscribe; if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { for (var i = 0, len = sourceObj.length; i < len; i++) { FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); } } else if (isEventTarget(sourceObj)) { var source_1 = sourceObj; sourceObj.addEventListener(eventName, handler, options); unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; } 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 { throw new TypeError('Invalid event target'); } subscriber.add(new __WEBPACK_IMPORTED_MODULE_4__Subscription__["a" /* Subscription */](unsubscribe)); }; FromEventObservable.prototype._subscribe = function (subscriber) { var sourceObj = this.sourceObj; var eventName = this.eventName; var options = this.options; var selector = this.selector; var handler = selector ? function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var result = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(selector).apply(void 0, args); if (result === __WEBPACK_IMPORTED_MODULE_3__util_errorObject__["a" /* errorObject */]) { subscriber.error(__WEBPACK_IMPORTED_MODULE_3__util_errorObject__["a" /* errorObject */].e); } else { subscriber.next(result); } } : function (e) { return subscriber.next(e); }; FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); }; return FromEventObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); //# sourceMappingURL=FromEventObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/FromEventPatternObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FromEventPatternObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isFunction__ = __webpack_require__("../../../../rxjs/_esm5/util/isFunction.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /** PURE_IMPORTS_START .._util_isFunction,.._Observable,.._Subscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var FromEventPatternObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(FromEventPatternObservable, _super); function FromEventPatternObservable(addHandler, removeHandler, selector) { var _this = _super.call(this) || this; _this.addHandler = addHandler; _this.removeHandler = removeHandler; _this.selector = selector; return _this; } /** * Creates an Observable from an API based on addHandler/removeHandler * functions. * * Converts any addHandler/removeHandler API to an * Observable. * * * * Creates an Observable by using the `addHandler` and `removeHandler` * functions to add and remove the handlers, with an optional selector * function to project the event arguments to a result. The `addHandler` is * called when the output Observable is subscribed, and `removeHandler` is * called when the Subscription is unsubscribed. * * @example Emits clicks happening on the DOM document * function addClickHandler(handler) { * document.addEventListener('click', handler); * } * * function removeClickHandler(handler) { * document.removeEventListener('click', handler); * } * * var clicks = Rx.Observable.fromEventPattern( * addClickHandler, * removeClickHandler * ); * clicks.subscribe(x => console.log(x)); * * @see {@link from} * @see {@link fromEvent} * * @param {function(handler: Function): any} addHandler A function that takes * a `handler` function as argument and attaches it somehow to the actual * source of events. * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that * takes a `handler` function as argument and removes it in case it was * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, * removeHandler function will forward it. * @param {function(...args: any): T} [selector] An optional function to * post-process results. It takes the arguments from the event handler and * should return a single value. * @return {Observable} * @static true * @name fromEventPattern * @owner Observable */ FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { return new FromEventPatternObservable(addHandler, removeHandler, selector); }; FromEventPatternObservable.prototype._subscribe = function (subscriber) { var _this = this; var removeHandler = this.removeHandler; var handler = !!this.selector ? function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } _this._callSelector(subscriber, args); } : function (e) { subscriber.next(e); }; var retValue = this._callAddHandler(handler, subscriber); if (!Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* isFunction */])(removeHandler)) { return; } subscriber.add(new __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */](function () { //TODO: determine whether or not to forward to error handler removeHandler(handler, retValue); })); }; FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { try { var result = this.selector.apply(this, args); subscriber.next(result); } catch (e) { subscriber.error(e); } }; FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { try { return this.addHandler(handler) || null; } catch (e) { errorSubscriber.error(e); } }; return FromEventPatternObservable; }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); //# sourceMappingURL=FromEventPatternObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/FromObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FromObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isArrayLike__ = __webpack_require__("../../../../rxjs/_esm5/util/isArrayLike.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isPromise__ = __webpack_require__("../../../../rxjs/_esm5/util/isPromise.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PromiseObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/PromiseObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__IteratorObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/IteratorObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ArrayLikeObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayLikeObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__symbol_iterator__ = __webpack_require__("../../../../rxjs/_esm5/symbol/iterator.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__operators_observeOn__ = __webpack_require__("../../../../rxjs/_esm5/operators/observeOn.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__symbol_observable__ = __webpack_require__("../../../../rxjs/_esm5/symbol/observable.js"); /** PURE_IMPORTS_START .._util_isArray,.._util_isArrayLike,.._util_isPromise,._PromiseObservable,._IteratorObservable,._ArrayObservable,._ArrayLikeObservable,.._symbol_iterator,.._Observable,.._operators_observeOn,.._symbol_observable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var FromObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(FromObservable, _super); function FromObservable(ish, scheduler) { var _this = _super.call(this, null) || this; _this.ish = ish; _this.scheduler = scheduler; return _this; } /** * Creates an Observable from an Array, an array-like object, a Promise, an * iterable object, or an Observable-like object. * * Converts almost anything to an Observable. * * * * Convert various other objects and data types into Observables. `from` * converts a Promise or an array-like or an * [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable) * object into an Observable that emits the items in that promise or array or * iterable. A String, in this context, is treated as an array of characters. * Observable-like objects (contains a function named with the ES2015 Symbol * for Observable) can also be converted through this operator. * * @example Converts an array to an Observable * var array = [10, 20, 30]; * var result = Rx.Observable.from(array); * result.subscribe(x => console.log(x)); * * // Results in the following: * // 10 20 30 * * @example Convert an infinite iterable (from a generator) to an Observable * function* generateDoubles(seed) { * var i = seed; * while (true) { * yield i; * i = 2 * i; // double it * } * } * * var iterator = generateDoubles(3); * var result = Rx.Observable.from(iterator).take(10); * result.subscribe(x => console.log(x)); * * // Results in the following: * // 3 6 12 24 48 96 192 384 768 1536 * * @see {@link create} * @see {@link fromEvent} * @see {@link fromEventPattern} * @see {@link fromPromise} * * @param {ObservableInput} ish A subscribable object, a Promise, an * Observable-like, an Array, an iterable or an array-like object to be * converted. * @param {Scheduler} [scheduler] The scheduler on which to schedule the * emissions of values. * @return {Observable} The Observable whose values are originally from the * input object that was converted. * @static true * @name from * @owner Observable */ FromObservable.create = function (ish, scheduler) { if (ish != null) { if (typeof ish[__WEBPACK_IMPORTED_MODULE_10__symbol_observable__["a" /* observable */]] === 'function') { if (ish instanceof __WEBPACK_IMPORTED_MODULE_8__Observable__["a" /* Observable */] && !scheduler) { return ish; } return new FromObservable(ish, scheduler); } else if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(ish)) { return new __WEBPACK_IMPORTED_MODULE_5__ArrayObservable__["a" /* ArrayObservable */](ish, scheduler); } else if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isPromise__["a" /* isPromise */])(ish)) { return new __WEBPACK_IMPORTED_MODULE_3__PromiseObservable__["a" /* PromiseObservable */](ish, scheduler); } else if (typeof ish[__WEBPACK_IMPORTED_MODULE_7__symbol_iterator__["a" /* iterator */]] === 'function' || typeof ish === 'string') { return new __WEBPACK_IMPORTED_MODULE_4__IteratorObservable__["a" /* IteratorObservable */](ish, scheduler); } else if (Object(__WEBPACK_IMPORTED_MODULE_1__util_isArrayLike__["a" /* isArrayLike */])(ish)) { return new __WEBPACK_IMPORTED_MODULE_6__ArrayLikeObservable__["a" /* ArrayLikeObservable */](ish, scheduler); } } throw new TypeError((ish !== null && typeof ish || ish) + ' is not observable'); }; FromObservable.prototype._subscribe = function (subscriber) { var ish = this.ish; var scheduler = this.scheduler; if (scheduler == null) { return ish[__WEBPACK_IMPORTED_MODULE_10__symbol_observable__["a" /* observable */]]().subscribe(subscriber); } else { return ish[__WEBPACK_IMPORTED_MODULE_10__symbol_observable__["a" /* observable */]]().subscribe(new __WEBPACK_IMPORTED_MODULE_9__operators_observeOn__["a" /* ObserveOnSubscriber */](subscriber, scheduler, 0)); } }; return FromObservable; }(__WEBPACK_IMPORTED_MODULE_8__Observable__["a" /* Observable */])); //# sourceMappingURL=FromObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/IteratorObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IteratorObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__symbol_iterator__ = __webpack_require__("../../../../rxjs/_esm5/symbol/iterator.js"); /** PURE_IMPORTS_START .._util_root,.._Observable,.._symbol_iterator PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var IteratorObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(IteratorObservable, _super); function IteratorObservable(iterator, scheduler) { var _this = _super.call(this) || this; _this.scheduler = scheduler; if (iterator == null) { throw new Error('iterator cannot be null.'); } _this.iterator = getIterator(iterator); return _this; } IteratorObservable.create = function (iterator, scheduler) { return new IteratorObservable(iterator, scheduler); }; IteratorObservable.dispatch = function (state) { var index = state.index, hasError = state.hasError, iterator = state.iterator, subscriber = state.subscriber; if (hasError) { subscriber.error(state.error); return; } var result = iterator.next(); if (result.done) { subscriber.complete(); return; } subscriber.next(result.value); state.index = index + 1; if (subscriber.closed) { if (typeof iterator.return === 'function') { iterator.return(); } return; } this.schedule(state); }; IteratorObservable.prototype._subscribe = function (subscriber) { var index = 0; var _a = this, iterator = _a.iterator, scheduler = _a.scheduler; if (scheduler) { return scheduler.schedule(IteratorObservable.dispatch, 0, { index: index, iterator: iterator, subscriber: subscriber }); } else { do { var result = iterator.next(); if (result.done) { subscriber.complete(); break; } else { subscriber.next(result.value); } if (subscriber.closed) { if (typeof iterator.return === 'function') { iterator.return(); } break; } } while (true); } }; return IteratorObservable; }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); var StringIterator = /*@__PURE__*/ (/*@__PURE__*/ function () { function StringIterator(str, idx, len) { if (idx === void 0) { idx = 0; } if (len === void 0) { len = str.length; } this.str = str; this.idx = idx; this.len = len; } StringIterator.prototype[__WEBPACK_IMPORTED_MODULE_2__symbol_iterator__["a" /* iterator */]] = function () { return (this); }; StringIterator.prototype.next = function () { return this.idx < this.len ? { done: false, value: this.str.charAt(this.idx++) } : { done: true, value: undefined }; }; return StringIterator; }()); var ArrayIterator = /*@__PURE__*/ (/*@__PURE__*/ function () { function ArrayIterator(arr, idx, len) { if (idx === void 0) { idx = 0; } if (len === void 0) { len = toLength(arr); } this.arr = arr; this.idx = idx; this.len = len; } ArrayIterator.prototype[__WEBPACK_IMPORTED_MODULE_2__symbol_iterator__["a" /* iterator */]] = function () { return this; }; ArrayIterator.prototype.next = function () { return this.idx < this.len ? { done: false, value: this.arr[this.idx++] } : { done: true, value: undefined }; }; return ArrayIterator; }()); function getIterator(obj) { var i = obj[__WEBPACK_IMPORTED_MODULE_2__symbol_iterator__["a" /* iterator */]]; if (!i && typeof obj === 'string') { return new StringIterator(obj); } if (!i && obj.length !== undefined) { return new ArrayIterator(obj); } if (!i) { throw new TypeError('object is not iterable'); } return obj[__WEBPACK_IMPORTED_MODULE_2__symbol_iterator__["a" /* iterator */]](); } var maxSafeInteger = /*@__PURE__*/ Math.pow(2, 53) - 1; function toLength(o) { var len = +o.length; if (isNaN(len)) { return 0; } if (len === 0 || !numberIsFinite(len)) { return len; } len = sign(len) * Math.floor(Math.abs(len)); if (len <= 0) { return 0; } if (len > maxSafeInteger) { return maxSafeInteger; } return len; } function numberIsFinite(value) { return typeof value === 'number' && __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].isFinite(value); } function sign(value) { var valueAsNumber = +value; if (valueAsNumber === 0) { return valueAsNumber; } if (isNaN(valueAsNumber)) { return valueAsNumber; } return valueAsNumber < 0 ? -1 : 1; } //# sourceMappingURL=IteratorObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/PromiseObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PromiseObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /** PURE_IMPORTS_START .._util_root,.._Observable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var PromiseObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(PromiseObservable, _super); function PromiseObservable(promise, scheduler) { var _this = _super.call(this) || this; _this.promise = promise; _this.scheduler = scheduler; return _this; } /** * Converts a Promise to an Observable. * * Returns an Observable that just emits the Promise's * resolved value, then completes. * * Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an * Observable. If the Promise resolves with a value, the output Observable * emits that resolved value as a `next`, and then completes. If the Promise * is rejected, then the output Observable emits the corresponding Error. * * @example Convert the Promise returned by Fetch to an Observable * var result = Rx.Observable.fromPromise(fetch('http://myserver.com/')); * result.subscribe(x => console.log(x), e => console.error(e)); * * @see {@link bindCallback} * @see {@link from} * * @param {PromiseLike} promise The promise to be converted. * @param {Scheduler} [scheduler] An optional IScheduler to use for scheduling * the delivery of the resolved value (or the rejection). * @return {Observable} An Observable which wraps the Promise. * @static true * @name fromPromise * @owner Observable */ PromiseObservable.create = function (promise, scheduler) { return new PromiseObservable(promise, scheduler); }; PromiseObservable.prototype._subscribe = function (subscriber) { var _this = this; var promise = this.promise; var scheduler = this.scheduler; if (scheduler == null) { if (this._isScalar) { if (!subscriber.closed) { subscriber.next(this.value); subscriber.complete(); } } else { promise.then(function (value) { _this.value = value; _this._isScalar = true; if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } }, function (err) { if (!subscriber.closed) { subscriber.error(err); } }) .then(null, function (err) { // escape the promise trap, throw unhandled errors __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].setTimeout(function () { throw err; }); }); } } else { if (this._isScalar) { if (!subscriber.closed) { return scheduler.schedule(dispatchNext, 0, { value: this.value, subscriber: subscriber }); } } else { promise.then(function (value) { _this.value = value; _this._isScalar = true; if (!subscriber.closed) { subscriber.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber })); } }, function (err) { if (!subscriber.closed) { subscriber.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber })); } }) .then(null, function (err) { // escape the promise trap, throw unhandled errors __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].setTimeout(function () { throw err; }); }); } } }; return PromiseObservable; }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); function dispatchNext(arg) { var value = arg.value, subscriber = arg.subscriber; if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } } function dispatchError(arg) { var err = arg.err, subscriber = arg.subscriber; if (!subscriber.closed) { subscriber.error(err); } } //# sourceMappingURL=PromiseObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/ScalarObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScalarObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ScalarObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ScalarObservable, _super); function ScalarObservable(value, scheduler) { var _this = _super.call(this) || this; _this.value = value; _this.scheduler = scheduler; _this._isScalar = true; if (scheduler) { _this._isScalar = false; } return _this; } ScalarObservable.create = function (value, scheduler) { return new ScalarObservable(value, scheduler); }; ScalarObservable.dispatch = function (state) { var done = state.done, value = state.value, subscriber = state.subscriber; if (done) { subscriber.complete(); return; } subscriber.next(value); if (subscriber.closed) { return; } state.done = true; this.schedule(state); }; ScalarObservable.prototype._subscribe = function (subscriber) { var value = this.value; var scheduler = this.scheduler; if (scheduler) { return scheduler.schedule(ScalarObservable.dispatch, 0, { done: false, value: value, subscriber: subscriber }); } else { subscriber.next(value); if (!subscriber.closed) { subscriber.complete(); } } }; return ScalarObservable; }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */])); //# sourceMappingURL=ScalarObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/TimerObservable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TimerObservable; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isNumeric__ = __webpack_require__("../../../../rxjs/_esm5/util/isNumeric.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_isDate__ = __webpack_require__("../../../../rxjs/_esm5/util/isDate.js"); /** PURE_IMPORTS_START .._util_isNumeric,.._Observable,.._scheduler_async,.._util_isScheduler,.._util_isDate PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var TimerObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TimerObservable, _super); function TimerObservable(dueTime, period, scheduler) { if (dueTime === void 0) { dueTime = 0; } var _this = _super.call(this) || this; _this.period = -1; _this.dueTime = 0; if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isNumeric__["a" /* isNumeric */])(period)) { _this.period = Number(period) < 1 && 1 || Number(period); } else if (Object(__WEBPACK_IMPORTED_MODULE_3__util_isScheduler__["a" /* isScheduler */])(period)) { scheduler = period; } if (!Object(__WEBPACK_IMPORTED_MODULE_3__util_isScheduler__["a" /* isScheduler */])(scheduler)) { scheduler = __WEBPACK_IMPORTED_MODULE_2__scheduler_async__["a" /* async */]; } _this.scheduler = scheduler; _this.dueTime = Object(__WEBPACK_IMPORTED_MODULE_4__util_isDate__["a" /* isDate */])(dueTime) ? (+dueTime - _this.scheduler.now()) : dueTime; return _this; } /** * Creates an Observable that starts emitting after an `initialDelay` and * emits ever increasing numbers after each `period` of time thereafter. * * Its like {@link interval}, but you can specify when * should the emissions start. * * * * `timer` returns an Observable that emits an infinite sequence of ascending * integers, with a constant interval of time, `period` of your choosing * between those emissions. The first emission happens after the specified * `initialDelay`. The initial delay may be a {@link Date}. By default, this * operator uses the `async` IScheduler to provide a notion of time, but you * may pass any IScheduler to it. If `period` is not specified, the output * Observable emits only one value, `0`. Otherwise, it emits an infinite * sequence. * * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds * var numbers = Rx.Observable.timer(3000, 1000); * numbers.subscribe(x => console.log(x)); * * @example Emits one number after five seconds * var numbers = Rx.Observable.timer(5000); * numbers.subscribe(x => console.log(x)); * * @see {@link interval} * @see {@link delay} * * @param {number|Date} initialDelay The initial delay time to wait before * emitting the first value of `0`. * @param {number} [period] The period of time between emissions of the * subsequent numbers. * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling * the emission of values, and providing a notion of "time". * @return {Observable} An Observable that emits a `0` after the * `initialDelay` and ever increasing numbers after each `period` of time * thereafter. * @static true * @name timer * @owner Observable */ TimerObservable.create = function (initialDelay, period, scheduler) { if (initialDelay === void 0) { initialDelay = 0; } return new TimerObservable(initialDelay, period, scheduler); }; TimerObservable.dispatch = function (state) { var index = state.index, period = state.period, subscriber = state.subscriber; var action = this; subscriber.next(index); if (subscriber.closed) { return; } else if (period === -1) { return subscriber.complete(); } state.index = index + 1; action.schedule(state, period); }; TimerObservable.prototype._subscribe = function (subscriber) { var index = 0; var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; return scheduler.schedule(TimerObservable.dispatch, dueTime, { index: index, period: period, subscriber: subscriber }); }; return TimerObservable; }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); //# sourceMappingURL=TimerObservable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/combineLatest.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = combineLatest; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_combineLatest__ = __webpack_require__("../../../../rxjs/_esm5/operators/combineLatest.js"); /** PURE_IMPORTS_START .._util_isScheduler,.._util_isArray,._ArrayObservable,.._operators_combineLatest PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Combines multiple Observables to create an Observable whose values are * calculated from the latest values of each of its input Observables. * * Whenever any input Observable emits a value, it * computes a formula using the latest values from all the inputs, then emits * the output of that formula. * * * * `combineLatest` combines the values from all the Observables passed as * arguments. This is done by subscribing to each Observable in order and, * whenever any Observable emits, collecting an array of the most recent * values from each Observable. So if you pass `n` Observables to operator, * returned Observable will always emit an array of `n` values, in order * corresponding to order of passed Observables (value from the first Observable * on the first place and so on). * * Static version of `combineLatest` accepts either an array of Observables * or each Observable can be put directly as an argument. Note that array of * Observables is good choice, if you don't know beforehand how many Observables * you will combine. Passing empty array will result in Observable that * completes immediately. * * To ensure output array has always the same length, `combineLatest` will * actually wait for all input Observables to emit at least once, * before it starts emitting results. This means if some Observable emits * values before other Observables started emitting, all that values but last * will be lost. On the other hand, is some Observable does not emit value but * completes, resulting Observable will complete at the same moment without * emitting anything, since it will be now impossible to include value from * completed Observable in resulting array. Also, if some input Observable does * not emit any value and never completes, `combineLatest` will also never emit * and never complete, since, again, it will wait for all streams to emit some * value. * * If at least one Observable was passed to `combineLatest` and all passed Observables * emitted something, resulting Observable will complete when all combined * streams complete. So even if some Observable completes, result of * `combineLatest` will still emit values when other Observables do. In case * of completed Observable, its value from now on will always be the last * emitted value. On the other hand, if any Observable errors, `combineLatest` * will error immediately as well, and all other Observables will be unsubscribed. * * `combineLatest` accepts as optional parameter `project` function, which takes * as arguments all values that would normally be emitted by resulting Observable. * `project` can return any kind of value, which will be then emitted by Observable * instead of default array. Note that `project` does not take as argument that array * of values, but values themselves. That means default `project` can be imagined * as function that takes all its arguments and puts them into an array. * * * @example Combine two timer Observables * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); * combinedTimers.subscribe(value => console.log(value)); * // Logs * // [0, 0] after 0.5s * // [1, 0] after 1s * // [1, 1] after 1.5s * // [2, 1] after 2s * * * @example Combine an array of Observables * const observables = [1, 5, 10].map( * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds * ); * const combined = Rx.Observable.combineLatest(observables); * combined.subscribe(value => console.log(value)); * // Logs * // [0, 0, 0] immediately * // [1, 0, 0] after 1s * // [1, 5, 0] after 5s * // [1, 5, 10] after 10s * * * @example Use project function to dynamically calculate the Body-Mass Index * var weight = Rx.Observable.of(70, 72, 76, 79, 75); * var height = Rx.Observable.of(1.76, 1.77, 1.78); * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); * bmi.subscribe(x => console.log('BMI is ' + x)); * * // With output to console: * // BMI is 24.212293388429753 * // BMI is 23.93948099205209 * // BMI is 23.671253629592222 * * * @see {@link combineAll} * @see {@link merge} * @see {@link withLatestFrom} * * @param {ObservableInput} observable1 An input Observable to combine with other Observables. * @param {ObservableInput} observable2 An input Observable to combine with other Observables. * More than one input Observables may be given as arguments * or an array of Observables may be given as the first argument. * @param {function} [project] An optional function to project the values from * the combined latest values into a new value on the output Observable. * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to * each input Observable. * @return {Observable} An Observable of projected values from the most recent * values from each input Observable, or an array of the most recent values from * each input Observable. * @static true * @name combineLatest * @owner Observable */ function combineLatest() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } var project = null; var scheduler = null; if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isScheduler__["a" /* isScheduler */])(observables[observables.length - 1])) { scheduler = observables.pop(); } if (typeof observables[observables.length - 1] === 'function') { project = observables.pop(); } // if the first and only other argument besides the resultSelector is an array // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` if (observables.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_1__util_isArray__["a" /* isArray */])(observables[0])) { observables = observables[0]; } return new __WEBPACK_IMPORTED_MODULE_2__ArrayObservable__["a" /* ArrayObservable */](observables, scheduler).lift(new __WEBPACK_IMPORTED_MODULE_3__operators_combineLatest__["a" /* CombineLatestOperator */](project)); } //# sourceMappingURL=combineLatest.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/concat.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = concat; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__of__ = __webpack_require__("../../../../rxjs/_esm5/observable/of.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__from__ = __webpack_require__("../../../../rxjs/_esm5/observable/from.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_concatAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatAll.js"); /** PURE_IMPORTS_START .._util_isScheduler,._of,._from,.._operators_concatAll PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Creates an output Observable which sequentially emits all values from given * Observable and then moves on to the next. * * Concatenates multiple Observables together by * sequentially emitting their values, one Observable after the other. * * * * `concat` joins multiple Observables together, by subscribing to them one at a time and * merging their results into the output Observable. You can pass either an array of * Observables, or put them directly as arguments. Passing an empty array will result * in Observable that completes immediately. * * `concat` will subscribe to first input Observable and emit all its values, without * changing or affecting them in any way. When that Observable completes, it will * subscribe to then next Observable passed and, again, emit its values. This will be * repeated, until the operator runs out of Observables. When last input Observable completes, * `concat` will complete as well. At any given moment only one Observable passed to operator * emits values. If you would like to emit values from passed Observables concurrently, check out * {@link merge} instead, especially with optional `concurrent` parameter. As a matter of fact, * `concat` is an equivalent of `merge` operator with `concurrent` parameter set to `1`. * * Note that if some input Observable never completes, `concat` will also never complete * and Observables following the one that did not complete will never be subscribed. On the other * hand, if some Observable simply completes immediately after it is subscribed, it will be * invisible for `concat`, which will just move on to the next Observable. * * If any Observable in chain errors, instead of passing control to the next Observable, * `concat` will error immediately as well. Observables that would be subscribed after * the one that emitted error, never will. * * If you pass to `concat` the same Observable many times, its stream of values * will be "replayed" on every subscription, which means you can repeat given Observable * as many times as you like. If passing the same Observable to `concat` 1000 times becomes tedious, * you can always use {@link repeat}. * * @example Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10 * var timer = Rx.Observable.interval(1000).take(4); * var sequence = Rx.Observable.range(1, 10); * var result = Rx.Observable.concat(timer, sequence); * result.subscribe(x => console.log(x)); * * // results in: * // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10 * * * @example Concatenate an array of 3 Observables * var timer1 = Rx.Observable.interval(1000).take(10); * var timer2 = Rx.Observable.interval(2000).take(6); * var timer3 = Rx.Observable.interval(500).take(10); * var result = Rx.Observable.concat([timer1, timer2, timer3]); // note that array is passed * result.subscribe(x => console.log(x)); * * // results in the following: * // (Prints to console sequentially) * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9 * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5 * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9 * * * @example Concatenate the same Observable to repeat it * const timer = Rx.Observable.interval(1000).take(2); * * Rx.Observable.concat(timer, timer) // concating the same Observable! * .subscribe( * value => console.log(value), * err => {}, * () => console.log('...and it is done!') * ); * * // Logs: * // 0 after 1s * // 1 after 2s * // 0 after 3s * // 1 after 4s * // "...and it is done!" also after 4s * * @see {@link concatAll} * @see {@link concatMap} * @see {@link concatMapTo} * * @param {ObservableInput} input1 An input Observable to concatenate with others. * @param {ObservableInput} input2 An input Observable to concatenate with others. * More than one input Observables may be given as argument. * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each * Observable subscription on. * @return {Observable} All values of each passed Observable merged into a * single Observable, in order, in serial fashion. * @static true * @name concat * @owner Observable */ function concat() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } if (observables.length === 1 || (observables.length === 2 && Object(__WEBPACK_IMPORTED_MODULE_0__util_isScheduler__["a" /* isScheduler */])(observables[1]))) { return Object(__WEBPACK_IMPORTED_MODULE_2__from__["a" /* from */])(observables[0]); } return Object(__WEBPACK_IMPORTED_MODULE_3__operators_concatAll__["a" /* concatAll */])()(__WEBPACK_IMPORTED_MODULE_1__of__["a" /* of */].apply(void 0, observables)); } //# sourceMappingURL=concat.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/defer.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return defer; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__DeferObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/DeferObservable.js"); /** PURE_IMPORTS_START ._DeferObservable PURE_IMPORTS_END */ var defer = __WEBPACK_IMPORTED_MODULE_0__DeferObservable__["a" /* DeferObservable */].create; //# sourceMappingURL=defer.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/empty.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return empty; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /** PURE_IMPORTS_START ._EmptyObservable PURE_IMPORTS_END */ var empty = __WEBPACK_IMPORTED_MODULE_0__EmptyObservable__["a" /* EmptyObservable */].create; //# sourceMappingURL=empty.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/forkJoin.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return forkJoin; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ForkJoinObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ForkJoinObservable.js"); /** PURE_IMPORTS_START ._ForkJoinObservable PURE_IMPORTS_END */ var forkJoin = __WEBPACK_IMPORTED_MODULE_0__ForkJoinObservable__["a" /* ForkJoinObservable */].create; //# sourceMappingURL=forkJoin.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/from.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return from; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__FromObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/FromObservable.js"); /** PURE_IMPORTS_START ._FromObservable PURE_IMPORTS_END */ var from = __WEBPACK_IMPORTED_MODULE_0__FromObservable__["a" /* FromObservable */].create; //# sourceMappingURL=from.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/fromEvent.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fromEvent; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__FromEventObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/FromEventObservable.js"); /** PURE_IMPORTS_START ._FromEventObservable PURE_IMPORTS_END */ var fromEvent = __WEBPACK_IMPORTED_MODULE_0__FromEventObservable__["a" /* FromEventObservable */].create; //# sourceMappingURL=fromEvent.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/fromEventPattern.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fromEventPattern; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__FromEventPatternObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/FromEventPatternObservable.js"); /** PURE_IMPORTS_START ._FromEventPatternObservable PURE_IMPORTS_END */ var fromEventPattern = __WEBPACK_IMPORTED_MODULE_0__FromEventPatternObservable__["a" /* FromEventPatternObservable */].create; //# sourceMappingURL=fromEventPattern.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/fromPromise.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fromPromise; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__PromiseObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/PromiseObservable.js"); /** PURE_IMPORTS_START ._PromiseObservable PURE_IMPORTS_END */ var fromPromise = __WEBPACK_IMPORTED_MODULE_0__PromiseObservable__["a" /* PromiseObservable */].create; //# sourceMappingURL=fromPromise.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/merge.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = merge; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_mergeAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeAll.js"); /** PURE_IMPORTS_START .._Observable,._ArrayObservable,.._util_isScheduler,.._operators_mergeAll PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Creates an output Observable which concurrently emits all values from every * given input Observable. * * Flattens multiple Observables together by blending * their values into one Observable. * * * * `merge` subscribes to each given input Observable (as arguments), and simply * forwards (without doing any transformation) all the values from all the input * Observables to the output Observable. The output Observable only completes * once all input Observables have completed. Any error delivered by an input * Observable will be immediately emitted on the output Observable. * * @example Merge together two Observables: 1s interval and clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var timer = Rx.Observable.interval(1000); * var clicksOrTimer = Rx.Observable.merge(clicks, timer); * clicksOrTimer.subscribe(x => console.log(x)); * * // Results in the following: * // timer will emit ascending values, one every second(1000ms) to console * // clicks logs MouseEvents to console everytime the "document" is clicked * // Since the two streams are merged you see these happening * // as they occur. * * @example Merge together 3 Observables, but only 2 run concurrently * var timer1 = Rx.Observable.interval(1000).take(10); * var timer2 = Rx.Observable.interval(2000).take(6); * var timer3 = Rx.Observable.interval(500).take(10); * var concurrent = 2; // the argument * var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent); * merged.subscribe(x => console.log(x)); * * // Results in the following: * // - First timer1 and timer2 will run concurrently * // - timer1 will emit a value every 1000ms for 10 iterations * // - timer2 will emit a value every 2000ms for 6 iterations * // - after timer1 hits it's max iteration, timer2 will * // continue, and timer3 will start to run concurrently with timer2 * // - when timer2 hits it's max iteration it terminates, and * // timer3 will continue to emit a value every 500ms until it is complete * * @see {@link mergeAll} * @see {@link mergeMap} * @see {@link mergeMapTo} * @see {@link mergeScan} * * @param {...ObservableInput} observables Input Observables to merge together. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @param {Scheduler} [scheduler=null] The IScheduler to use for managing * concurrency of input Observables. * @return {Observable} an Observable that emits items that are the result of * every input Observable. * @static true * @name merge * @owner Observable */ 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 (Object(__WEBPACK_IMPORTED_MODULE_2__util_isScheduler__["a" /* 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 __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]) { return observables[0]; } return Object(__WEBPACK_IMPORTED_MODULE_3__operators_mergeAll__["a" /* mergeAll */])(concurrent)(new __WEBPACK_IMPORTED_MODULE_1__ArrayObservable__["a" /* ArrayObservable */](observables, scheduler)); } //# sourceMappingURL=merge.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/of.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return of; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /** PURE_IMPORTS_START ._ArrayObservable PURE_IMPORTS_END */ var of = __WEBPACK_IMPORTED_MODULE_0__ArrayObservable__["a" /* ArrayObservable */].of; //# sourceMappingURL=of.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/race.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = race; /* unused harmony export RaceOperator */ /* unused harmony export RaceSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__observable_ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._util_isArray,.._observable_ArrayObservable,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function race() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } // if the only argument is an array, it was most likely called with // `race([obs1, obs2, ...])` if (observables.length === 1) { if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(observables[0])) { observables = observables[0]; } else { return observables[0]; } } return new __WEBPACK_IMPORTED_MODULE_1__observable_ArrayObservable__["a" /* ArrayObservable */](observables).lift(new RaceOperator()); } var RaceOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function RaceOperator() { } RaceOperator.prototype.call = function (subscriber, source) { return source.subscribe(new RaceSubscriber(subscriber)); }; return RaceOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var RaceSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 = Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=race.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/throw.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _throw; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ErrorObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ErrorObservable.js"); /** PURE_IMPORTS_START ._ErrorObservable PURE_IMPORTS_END */ var _throw = __WEBPACK_IMPORTED_MODULE_0__ErrorObservable__["a" /* ErrorObservable */].create; //# sourceMappingURL=throw.js.map /***/ }), /***/ "../../../../rxjs/_esm5/observable/timer.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return timer; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__TimerObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/TimerObservable.js"); /** PURE_IMPORTS_START ._TimerObservable PURE_IMPORTS_END */ var timer = __WEBPACK_IMPORTED_MODULE_0__TimerObservable__["a" /* TimerObservable */].create; //# sourceMappingURL=timer.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/catch.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = _catch; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_catchError__ = __webpack_require__("../../../../rxjs/_esm5/operators/catchError.js"); /** PURE_IMPORTS_START .._operators_catchError PURE_IMPORTS_END */ /** * Catches errors on the observable to be handled by returning a new observable or throwing an error. * * * * @example Continues with a different Observable when there's an error * * Observable.of(1, 2, 3, 4, 5) * .map(n => { * if (n == 4) { * throw 'four!'; * } * return n; * }) * .catch(err => Observable.of('I', 'II', 'III', 'IV', 'V')) * .subscribe(x => console.log(x)); * // 1, 2, 3, I, II, III, IV, V * * @example Retries the caught source Observable again in case of error, similar to retry() operator * * Observable.of(1, 2, 3, 4, 5) * .map(n => { * if (n === 4) { * throw 'four!'; * } * return n; * }) * .catch((err, caught) => caught) * .take(30) * .subscribe(x => console.log(x)); * // 1, 2, 3, 1, 2, 3, ... * * @example Throws a new error when the source Observable throws an error * * Observable.of(1, 2, 3, 4, 5) * .map(n => { * if (n == 4) { * throw 'four!'; * } * return n; * }) * .catch(err => { * throw 'error in source. Details: ' + err; * }) * .subscribe( * x => console.log(x), * err => console.log(err) * ); * // 1, 2, 3, error in source. Details: four! * * @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which * is the source observable, in case you'd like to "retry" that observable by returning it again. Whatever observable * is returned by the `selector` will be used to continue the observable chain. * @return {Observable} An observable that originates from either the source or the observable returned by the * catch `selector` function. * @method catch * @name catch * @owner Observable */ function _catch(selector) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_catchError__["a" /* catchError */])(selector)(this); } //# sourceMappingURL=catch.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/concatAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = concatAll; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_concatAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatAll.js"); /** PURE_IMPORTS_START .._operators_concatAll PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Converts a higher-order Observable into a first-order Observable by * concatenating the inner Observables in order. * * Flattens an Observable-of-Observables by putting one * inner Observable after the other. * * * * Joins every Observable emitted by the source (a higher-order Observable), in * a serial fashion. It subscribes to each inner Observable only after the * previous inner Observable has completed, and merges all of their values into * the returned observable. * * __Warning:__ If the source Observable emits Observables quickly and * endlessly, and the inner Observables it emits generally complete slower than * the source emits, you can run into memory issues as the incoming Observables * collect in an unbounded buffer. * * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set * to `1`. * * @example For each click event, tick every second from 0 to 3, with no concurrency * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4)); * var firstOrder = higherOrder.concatAll(); * firstOrder.subscribe(x => console.log(x)); * * // Results in the following: * // (results are not concurrent) * // For every click on the "document" it will emit values 0 to 3 spaced * // on a 1000ms interval * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 * * @see {@link combineAll} * @see {@link concat} * @see {@link concatMap} * @see {@link concatMapTo} * @see {@link exhaust} * @see {@link mergeAll} * @see {@link switch} * @see {@link zipAll} * * @return {Observable} An Observable emitting values from all the inner * Observables concatenated. * @method concatAll * @owner Observable */ function concatAll() { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_concatAll__["a" /* concatAll */])()(this); } //# sourceMappingURL=concatAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/concatMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = concatMap; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_concatMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatMap.js"); /** PURE_IMPORTS_START .._operators_concatMap PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Projects each source value to an Observable which is merged in the output * Observable, in a serialized fashion waiting for each one to complete before * merging the next. * * Maps each value to an Observable, then flattens all of * these inner Observables using {@link concatAll}. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an (so-called "inner") Observable. Each new inner Observable is * concatenated with the previous inner Observable. * * __Warning:__ if source values arrive endlessly and faster than their * corresponding inner Observables can complete, it will result in memory issues * as inner Observables amass in an unbounded buffer waiting for their turn to * be subscribed to. * * Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set * to `1`. * * @example For each click event, tick every second from 0 to 3, with no concurrency * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4)); * result.subscribe(x => console.log(x)); * * // Results in the following: * // (results are not concurrent) * // For every click on the "document" it will emit values 0 to 3 spaced * // on a 1000ms interval * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 * * @see {@link concat} * @see {@link concatAll} * @see {@link concatMapTo} * @see {@link exhaustMap} * @see {@link mergeMap} * @see {@link switchMap} * * @param {function(value: T, ?index: number): ObservableInput} project A function * that, when applied to an item emitted by the source Observable, returns an * Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @return {Observable} An Observable that emits the result of applying the * projection function (and the optional `resultSelector`) to each item emitted * by the source Observable and taking values from each projected inner * Observable sequentially. * @method concatMap * @owner Observable */ function concatMap(project, resultSelector) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_concatMap__["a" /* concatMap */])(project, resultSelector)(this); } //# sourceMappingURL=concatMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/every.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = every; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_every__ = __webpack_require__("../../../../rxjs/_esm5/operators/every.js"); /** PURE_IMPORTS_START .._operators_every PURE_IMPORTS_END */ /** * Returns an Observable that emits whether or not every item of the source satisfies the condition specified. * * @example A simple example emitting true if all elements are less than 5, false otherwise * Observable.of(1, 2, 3, 4, 5, 6) * .every(x => x < 5) * .subscribe(x => console.log(x)); // -> false * * @param {function} predicate A function for determining if an item meets a specified condition. * @param {any} [thisArg] Optional object to use for `this` in the callback. * @return {Observable} An Observable of booleans that determines if all items of the source Observable meet the condition specified. * @method every * @owner Observable */ function every(predicate, thisArg) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_every__["a" /* every */])(predicate, thisArg)(this); } //# sourceMappingURL=every.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/filter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = filter; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_filter__ = __webpack_require__("../../../../rxjs/_esm5/operators/filter.js"); /** PURE_IMPORTS_START .._operators_filter PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Filter items emitted by the source Observable by only emitting those that * satisfy a specified predicate. * * Like * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), * it only emits a value from the source if it passes a criterion function. * * * * Similar to the well-known `Array.prototype.filter` method, this operator * takes values from the source Observable, passes them through a `predicate` * function and only emits those values that yielded `true`. * * @example Emit only click events whose target was a DIV element * var clicks = Rx.Observable.fromEvent(document, 'click'); * var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV'); * clicksOnDivs.subscribe(x => console.log(x)); * * @see {@link distinct} * @see {@link distinctUntilChanged} * @see {@link distinctUntilKeyChanged} * @see {@link ignoreElements} * @see {@link partition} * @see {@link skip} * * @param {function(value: T, index: number): boolean} predicate A function that * evaluates each value emitted by the source Observable. If it returns `true`, * the value is emitted, if `false` the value is not passed to the output * Observable. The `index` parameter is the number `i` for the i-th source * emission that has happened since the subscription, starting from the number * `0`. * @param {any} [thisArg] An optional argument to determine the value of `this` * in the `predicate` function. * @return {Observable} An Observable of values from the source that were * allowed by the `predicate` function. * @method filter * @owner Observable */ function filter(predicate, thisArg) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_filter__["a" /* filter */])(predicate, thisArg)(this); } //# sourceMappingURL=filter.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/first.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = first; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_first__ = __webpack_require__("../../../../rxjs/_esm5/operators/first.js"); /** PURE_IMPORTS_START .._operators_first PURE_IMPORTS_END */ /** * Emits only the first value (or the first value that meets some condition) * emitted by the source Observable. * * Emits only the first value. Or emits only the first * value that passes some test. * * * * If called with no arguments, `first` emits the first value of the source * Observable, then completes. If called with a `predicate` function, `first` * emits the first value of the source that matches the specified condition. It * may also take a `resultSelector` function to produce the output value from * the input value, and a `defaultValue` to emit in case the source completes * before it is able to emit a valid value. Throws an error if `defaultValue` * was not provided and a matching element is not found. * * @example Emit only the first click that happens on the DOM * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.first(); * result.subscribe(x => console.log(x)); * * @example Emits the first click that happens on a DIV * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.first(ev => ev.target.tagName === 'DIV'); * result.subscribe(x => console.log(x)); * * @see {@link filter} * @see {@link find} * @see {@link take} * * @throws {EmptyError} Delivers an EmptyError to the Observer's `error` * callback if the Observable completes before any `next` notification was sent. * * @param {function(value: T, index: number, source: Observable): boolean} [predicate] * An optional function called with each item to test for condition matching. * @param {function(value: T, index: number): R} [resultSelector] A function to * produce the value on the output Observable based on the values * and the indices of the source Observable. The arguments passed to this * function are: * - `value`: the value that was emitted on the source. * - `index`: the "index" of the value from the source. * @param {R} [defaultValue] The default value emitted in case no valid value * was found on the source. * @return {Observable} An Observable of the first item that matches the * condition. * @method first * @owner Observable */ function first(predicate, resultSelector, defaultValue) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_first__["a" /* first */])(predicate, resultSelector, defaultValue)(this); } //# sourceMappingURL=first.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/last.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = last; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_last__ = __webpack_require__("../../../../rxjs/_esm5/operators/last.js"); /** PURE_IMPORTS_START .._operators_last PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Returns an Observable that emits only the last item emitted by the source Observable. * It optionally takes a predicate function as a parameter, in which case, rather than emitting * the last item from the source Observable, the resulting Observable will emit the last item * from the source Observable that satisfies the predicate. * * * * @throws {EmptyError} Delivers an EmptyError to the Observer's `error` * callback if the Observable completes before any `next` notification was sent. * @param {function} predicate - The condition any source emitted item has to satisfy. * @return {Observable} An Observable that emits only the last item satisfying the given condition * from the source, or an NoSuchElementException if no such items are emitted. * @throws - Throws if no items that match the predicate are emitted by the source Observable. * @method last * @owner Observable */ function last(predicate, resultSelector, defaultValue) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_last__["a" /* last */])(predicate, resultSelector, defaultValue)(this); } //# sourceMappingURL=last.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/map.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = map; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_map__ = __webpack_require__("../../../../rxjs/_esm5/operators/map.js"); /** PURE_IMPORTS_START .._operators_map PURE_IMPORTS_END */ /** * Applies a given `project` function to each value emitted by the source * Observable, and emits the resulting values as an Observable. * * Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), * it passes each source value through a transformation function to get * corresponding output values. * * * * Similar to the well known `Array.prototype.map` function, this operator * applies a projection to each value and emits that projection in the output * Observable. * * @example Map every click to the clientX position of that click * var clicks = Rx.Observable.fromEvent(document, 'click'); * var positions = clicks.map(ev => ev.clientX); * positions.subscribe(x => console.log(x)); * * @see {@link mapTo} * @see {@link pluck} * * @param {function(value: T, index: number): R} project The function to apply * to each `value` emitted by the source Observable. The `index` parameter is * the number `i` for the i-th emission that has happened since the * subscription, starting from the number `0`. * @param {any} [thisArg] An optional argument to define what `this` is in the * `project` function. * @return {Observable} An Observable that emits the values from the source * Observable transformed by the given `project` function. * @method map * @owner Observable */ function map(project, thisArg) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_map__["a" /* map */])(project, thisArg)(this); } //# sourceMappingURL=map.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/mergeAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = mergeAll; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_mergeAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeAll.js"); /** PURE_IMPORTS_START .._operators_mergeAll PURE_IMPORTS_END */ /** * Converts a higher-order Observable into a first-order Observable which * concurrently delivers all values that are emitted on the inner Observables. * * Flattens an Observable-of-Observables. * * * * `mergeAll` subscribes to an Observable that emits Observables, also known as * a higher-order Observable. Each time it observes one of these emitted inner * Observables, it subscribes to that and delivers all the values from the * inner Observable on the output Observable. The output Observable only * completes once all inner Observables have completed. Any error delivered by * a inner Observable will be immediately emitted on the output Observable. * * @example Spawn a new interval Observable for each click event, and blend their outputs as one Observable * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000)); * var firstOrder = higherOrder.mergeAll(); * firstOrder.subscribe(x => console.log(x)); * * @example Count from 0 to 9 every second for each click, but only allow 2 concurrent timers * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10)); * var firstOrder = higherOrder.mergeAll(2); * firstOrder.subscribe(x => console.log(x)); * * @see {@link combineAll} * @see {@link concatAll} * @see {@link exhaust} * @see {@link merge} * @see {@link mergeMap} * @see {@link mergeMapTo} * @see {@link mergeScan} * @see {@link switch} * @see {@link zipAll} * * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner * Observables being subscribed to concurrently. * @return {Observable} An Observable that emits values coming from all the * inner Observables emitted by the source Observable. * @method mergeAll * @owner Observable */ function mergeAll(concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } return Object(__WEBPACK_IMPORTED_MODULE_0__operators_mergeAll__["a" /* mergeAll */])(concurrent)(this); } //# sourceMappingURL=mergeAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/mergeMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = mergeMap; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_mergeMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeMap.js"); /** PURE_IMPORTS_START .._operators_mergeMap PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Projects each source value to an Observable which is merged in the output * Observable. * * Maps each value to an Observable, then flattens all of * these inner Observables using {@link mergeAll}. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an Observable, and then merging those resulting Observables and * emitting the results of this merger. * * @example Map and flatten each letter to an Observable ticking every 1 second * var letters = Rx.Observable.of('a', 'b', 'c'); * var result = letters.mergeMap(x => * Rx.Observable.interval(1000).map(i => x+i) * ); * result.subscribe(x => console.log(x)); * * // Results in the following: * // a0 * // b0 * // c0 * // a1 * // b1 * // c1 * // continues to list a,b,c with respective ascending integers * * @see {@link concatMap} * @see {@link exhaustMap} * @see {@link merge} * @see {@link mergeAll} * @see {@link mergeMapTo} * @see {@link mergeScan} * @see {@link switchMap} * * @param {function(value: T, ?index: number): ObservableInput} project A function * that, when applied to an item emitted by the source Observable, returns an * Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @return {Observable} An Observable that emits the result of applying the * projection function (and the optional `resultSelector`) to each item emitted * by the source Observable and merging the results of the Observables obtained * from this transformation. * @method mergeMap * @owner Observable */ function mergeMap(project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } return Object(__WEBPACK_IMPORTED_MODULE_0__operators_mergeMap__["a" /* mergeMap */])(project, resultSelector, concurrent)(this); } //# sourceMappingURL=mergeMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/reduce.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = reduce; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_reduce__ = __webpack_require__("../../../../rxjs/_esm5/operators/reduce.js"); /** PURE_IMPORTS_START .._operators_reduce PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Applies an accumulator function over the source Observable, and returns the * accumulated result when the source completes, given an optional seed value. * * Combines together all values emitted on the source, * using an accumulator function that knows how to join a new source value into * the accumulation from the past. * * * * Like * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce), * `reduce` applies an `accumulator` function against an accumulation and each * value of the source Observable (from the past) to reduce it to a single * value, emitted on the output Observable. Note that `reduce` will only emit * one value, only when the source Observable completes. It is equivalent to * applying operator {@link scan} followed by operator {@link last}. * * Returns an Observable that applies a specified `accumulator` function to each * item emitted by the source Observable. If a `seed` value is specified, then * that value will be used as the initial value for the accumulator. If no seed * value is specified, the first item of the source is used as the seed. * * @example Count the number of click events that happened in 5 seconds * var clicksInFiveSeconds = Rx.Observable.fromEvent(document, 'click') * .takeUntil(Rx.Observable.interval(5000)); * var ones = clicksInFiveSeconds.mapTo(1); * var seed = 0; * var count = ones.reduce((acc, one) => acc + one, seed); * count.subscribe(x => console.log(x)); * * @see {@link count} * @see {@link expand} * @see {@link mergeScan} * @see {@link scan} * * @param {function(acc: R, value: T, index: number): R} accumulator The accumulator function * called on each source value. * @param {R} [seed] The initial accumulation value. * @return {Observable} An Observable that emits a single value that is the * result of accumulating the values emitted by the source Observable. * @method reduce * @owner Observable */ function reduce(accumulator, seed) { // providing a seed of `undefined` *should* be valid and trigger // hasSeed! so don't use `seed !== undefined` checks! // For this reason, we have to check it here at the original call site // otherwise inside Operator/Subscriber we won't know if `undefined` // means they didn't provide anything or if they literally provided `undefined` if (arguments.length >= 2) { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_reduce__["a" /* reduce */])(accumulator, seed)(this); } return Object(__WEBPACK_IMPORTED_MODULE_0__operators_reduce__["a" /* reduce */])(accumulator)(this); } //# sourceMappingURL=reduce.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operator/share.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = share; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_share__ = __webpack_require__("../../../../rxjs/_esm5/operators/share.js"); /** PURE_IMPORTS_START .._operators_share PURE_IMPORTS_END */ /** * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`. * * This behaves similarly to .publish().refCount(), with a behavior difference when the source observable emits complete. * .publish().refCount() will not resubscribe to the original source, however .share() will resubscribe to the original source. * Observable.of("test").publish().refCount() will not re-emit "test" on new subscriptions, Observable.of("test").share() will * re-emit "test" to new subscriptions. * * * * @return {Observable} An Observable that upon connection causes the source Observable to emit items to its Observers. * @method share * @owner Observable */ function share() { return Object(__WEBPACK_IMPORTED_MODULE_0__operators_share__["a" /* share */])()(this); } ; //# sourceMappingURL=share.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_audit__ = __webpack_require__("../../../../rxjs/_esm5/operators/audit.js"); /* unused harmony reexport audit */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__operators_auditTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/auditTime.js"); /* unused harmony reexport auditTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__operators_buffer__ = __webpack_require__("../../../../rxjs/_esm5/operators/buffer.js"); /* unused harmony reexport buffer */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_bufferCount__ = __webpack_require__("../../../../rxjs/_esm5/operators/bufferCount.js"); /* unused harmony reexport bufferCount */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__operators_bufferTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/bufferTime.js"); /* unused harmony reexport bufferTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__operators_bufferToggle__ = __webpack_require__("../../../../rxjs/_esm5/operators/bufferToggle.js"); /* unused harmony reexport bufferToggle */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__operators_bufferWhen__ = __webpack_require__("../../../../rxjs/_esm5/operators/bufferWhen.js"); /* unused harmony reexport bufferWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__operators_catchError__ = __webpack_require__("../../../../rxjs/_esm5/operators/catchError.js"); /* unused harmony reexport catchError */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__operators_combineAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/combineAll.js"); /* unused harmony reexport combineAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__operators_combineLatest__ = __webpack_require__("../../../../rxjs/_esm5/operators/combineLatest.js"); /* unused harmony reexport combineLatest */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__operators_concat__ = __webpack_require__("../../../../rxjs/_esm5/operators/concat.js"); /* unused harmony reexport concat */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__operators_concatAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatAll.js"); /* unused harmony reexport concatAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__operators_concatMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatMap.js"); /* unused harmony reexport concatMap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__operators_concatMapTo__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatMapTo.js"); /* unused harmony reexport concatMapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__operators_count__ = __webpack_require__("../../../../rxjs/_esm5/operators/count.js"); /* unused harmony reexport count */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__operators_debounce__ = __webpack_require__("../../../../rxjs/_esm5/operators/debounce.js"); /* unused harmony reexport debounce */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__operators_debounceTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/debounceTime.js"); /* unused harmony reexport debounceTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__operators_defaultIfEmpty__ = __webpack_require__("../../../../rxjs/_esm5/operators/defaultIfEmpty.js"); /* unused harmony reexport defaultIfEmpty */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__operators_delay__ = __webpack_require__("../../../../rxjs/_esm5/operators/delay.js"); /* unused harmony reexport delay */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__operators_delayWhen__ = __webpack_require__("../../../../rxjs/_esm5/operators/delayWhen.js"); /* unused harmony reexport delayWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__operators_dematerialize__ = __webpack_require__("../../../../rxjs/_esm5/operators/dematerialize.js"); /* unused harmony reexport dematerialize */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__operators_distinct__ = __webpack_require__("../../../../rxjs/_esm5/operators/distinct.js"); /* unused harmony reexport distinct */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__operators_distinctUntilChanged__ = __webpack_require__("../../../../rxjs/_esm5/operators/distinctUntilChanged.js"); /* unused harmony reexport distinctUntilChanged */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__operators_distinctUntilKeyChanged__ = __webpack_require__("../../../../rxjs/_esm5/operators/distinctUntilKeyChanged.js"); /* unused harmony reexport distinctUntilKeyChanged */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__operators_elementAt__ = __webpack_require__("../../../../rxjs/_esm5/operators/elementAt.js"); /* unused harmony reexport elementAt */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__operators_every__ = __webpack_require__("../../../../rxjs/_esm5/operators/every.js"); /* unused harmony reexport every */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__operators_exhaust__ = __webpack_require__("../../../../rxjs/_esm5/operators/exhaust.js"); /* unused harmony reexport exhaust */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__operators_exhaustMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/exhaustMap.js"); /* unused harmony reexport exhaustMap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__operators_expand__ = __webpack_require__("../../../../rxjs/_esm5/operators/expand.js"); /* unused harmony reexport expand */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__operators_filter__ = __webpack_require__("../../../../rxjs/_esm5/operators/filter.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_29__operators_filter__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__operators_finalize__ = __webpack_require__("../../../../rxjs/_esm5/operators/finalize.js"); /* unused harmony reexport finalize */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__operators_find__ = __webpack_require__("../../../../rxjs/_esm5/operators/find.js"); /* unused harmony reexport find */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__operators_findIndex__ = __webpack_require__("../../../../rxjs/_esm5/operators/findIndex.js"); /* unused harmony reexport findIndex */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__operators_first__ = __webpack_require__("../../../../rxjs/_esm5/operators/first.js"); /* unused harmony reexport first */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__operators_groupBy__ = __webpack_require__("../../../../rxjs/_esm5/operators/groupBy.js"); /* unused harmony reexport groupBy */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__operators_ignoreElements__ = __webpack_require__("../../../../rxjs/_esm5/operators/ignoreElements.js"); /* unused harmony reexport ignoreElements */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__operators_isEmpty__ = __webpack_require__("../../../../rxjs/_esm5/operators/isEmpty.js"); /* unused harmony reexport isEmpty */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__operators_last__ = __webpack_require__("../../../../rxjs/_esm5/operators/last.js"); /* unused harmony reexport last */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__operators_map__ = __webpack_require__("../../../../rxjs/_esm5/operators/map.js"); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_38__operators_map__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__operators_mapTo__ = __webpack_require__("../../../../rxjs/_esm5/operators/mapTo.js"); /* unused harmony reexport mapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__operators_materialize__ = __webpack_require__("../../../../rxjs/_esm5/operators/materialize.js"); /* unused harmony reexport materialize */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__operators_max__ = __webpack_require__("../../../../rxjs/_esm5/operators/max.js"); /* unused harmony reexport max */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__operators_merge__ = __webpack_require__("../../../../rxjs/_esm5/operators/merge.js"); /* unused harmony reexport merge */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__operators_mergeAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeAll.js"); /* unused harmony reexport mergeAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__operators_mergeMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeMap.js"); /* unused harmony reexport mergeMap */ /* unused harmony reexport flatMap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__operators_mergeMapTo__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeMapTo.js"); /* unused harmony reexport mergeMapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__operators_mergeScan__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeScan.js"); /* unused harmony reexport mergeScan */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__operators_min__ = __webpack_require__("../../../../rxjs/_esm5/operators/min.js"); /* unused harmony reexport min */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__operators_multicast__ = __webpack_require__("../../../../rxjs/_esm5/operators/multicast.js"); /* unused harmony reexport multicast */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__operators_observeOn__ = __webpack_require__("../../../../rxjs/_esm5/operators/observeOn.js"); /* unused harmony reexport observeOn */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__operators_onErrorResumeNext__ = __webpack_require__("../../../../rxjs/_esm5/operators/onErrorResumeNext.js"); /* unused harmony reexport onErrorResumeNext */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__operators_pairwise__ = __webpack_require__("../../../../rxjs/_esm5/operators/pairwise.js"); /* unused harmony reexport pairwise */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__operators_partition__ = __webpack_require__("../../../../rxjs/_esm5/operators/partition.js"); /* unused harmony reexport partition */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__operators_pluck__ = __webpack_require__("../../../../rxjs/_esm5/operators/pluck.js"); /* unused harmony reexport pluck */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__operators_publish__ = __webpack_require__("../../../../rxjs/_esm5/operators/publish.js"); /* unused harmony reexport publish */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__operators_publishBehavior__ = __webpack_require__("../../../../rxjs/_esm5/operators/publishBehavior.js"); /* unused harmony reexport publishBehavior */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__operators_publishLast__ = __webpack_require__("../../../../rxjs/_esm5/operators/publishLast.js"); /* unused harmony reexport publishLast */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__operators_publishReplay__ = __webpack_require__("../../../../rxjs/_esm5/operators/publishReplay.js"); /* unused harmony reexport publishReplay */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__operators_race__ = __webpack_require__("../../../../rxjs/_esm5/operators/race.js"); /* unused harmony reexport race */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__operators_reduce__ = __webpack_require__("../../../../rxjs/_esm5/operators/reduce.js"); /* unused harmony reexport reduce */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__operators_repeat__ = __webpack_require__("../../../../rxjs/_esm5/operators/repeat.js"); /* unused harmony reexport repeat */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__operators_repeatWhen__ = __webpack_require__("../../../../rxjs/_esm5/operators/repeatWhen.js"); /* unused harmony reexport repeatWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__operators_retry__ = __webpack_require__("../../../../rxjs/_esm5/operators/retry.js"); /* unused harmony reexport retry */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__operators_retryWhen__ = __webpack_require__("../../../../rxjs/_esm5/operators/retryWhen.js"); /* unused harmony reexport retryWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__operators_refCount__ = __webpack_require__("../../../../rxjs/_esm5/operators/refCount.js"); /* unused harmony reexport refCount */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__operators_sample__ = __webpack_require__("../../../../rxjs/_esm5/operators/sample.js"); /* unused harmony reexport sample */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__operators_sampleTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/sampleTime.js"); /* unused harmony reexport sampleTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__operators_scan__ = __webpack_require__("../../../../rxjs/_esm5/operators/scan.js"); /* unused harmony reexport scan */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__operators_sequenceEqual__ = __webpack_require__("../../../../rxjs/_esm5/operators/sequenceEqual.js"); /* unused harmony reexport sequenceEqual */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__operators_share__ = __webpack_require__("../../../../rxjs/_esm5/operators/share.js"); /* unused harmony reexport share */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__operators_shareReplay__ = __webpack_require__("../../../../rxjs/_esm5/operators/shareReplay.js"); /* unused harmony reexport shareReplay */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__operators_single__ = __webpack_require__("../../../../rxjs/_esm5/operators/single.js"); /* unused harmony reexport single */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__operators_skip__ = __webpack_require__("../../../../rxjs/_esm5/operators/skip.js"); /* unused harmony reexport skip */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__operators_skipLast__ = __webpack_require__("../../../../rxjs/_esm5/operators/skipLast.js"); /* unused harmony reexport skipLast */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__operators_skipUntil__ = __webpack_require__("../../../../rxjs/_esm5/operators/skipUntil.js"); /* unused harmony reexport skipUntil */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__operators_skipWhile__ = __webpack_require__("../../../../rxjs/_esm5/operators/skipWhile.js"); /* unused harmony reexport skipWhile */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__operators_startWith__ = __webpack_require__("../../../../rxjs/_esm5/operators/startWith.js"); /* unused harmony reexport startWith */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__operators_switchAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/switchAll.js"); /* unused harmony reexport switchAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__operators_switchMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/switchMap.js"); /* unused harmony reexport switchMap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__operators_switchMapTo__ = __webpack_require__("../../../../rxjs/_esm5/operators/switchMapTo.js"); /* unused harmony reexport switchMapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__operators_take__ = __webpack_require__("../../../../rxjs/_esm5/operators/take.js"); /* unused harmony reexport take */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__operators_takeLast__ = __webpack_require__("../../../../rxjs/_esm5/operators/takeLast.js"); /* unused harmony reexport takeLast */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__operators_takeUntil__ = __webpack_require__("../../../../rxjs/_esm5/operators/takeUntil.js"); /* unused harmony reexport takeUntil */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__operators_takeWhile__ = __webpack_require__("../../../../rxjs/_esm5/operators/takeWhile.js"); /* unused harmony reexport takeWhile */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__operators_tap__ = __webpack_require__("../../../../rxjs/_esm5/operators/tap.js"); /* unused harmony reexport tap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__operators_throttle__ = __webpack_require__("../../../../rxjs/_esm5/operators/throttle.js"); /* unused harmony reexport throttle */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__operators_throttleTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/throttleTime.js"); /* unused harmony reexport throttleTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__operators_timeInterval__ = __webpack_require__("../../../../rxjs/_esm5/operators/timeInterval.js"); /* unused harmony reexport timeInterval */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__operators_timeout__ = __webpack_require__("../../../../rxjs/_esm5/operators/timeout.js"); /* unused harmony reexport timeout */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__operators_timeoutWith__ = __webpack_require__("../../../../rxjs/_esm5/operators/timeoutWith.js"); /* unused harmony reexport timeoutWith */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__operators_timestamp__ = __webpack_require__("../../../../rxjs/_esm5/operators/timestamp.js"); /* unused harmony reexport timestamp */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__operators_toArray__ = __webpack_require__("../../../../rxjs/_esm5/operators/toArray.js"); /* unused harmony reexport toArray */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__operators_window__ = __webpack_require__("../../../../rxjs/_esm5/operators/window.js"); /* unused harmony reexport window */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__operators_windowCount__ = __webpack_require__("../../../../rxjs/_esm5/operators/windowCount.js"); /* unused harmony reexport windowCount */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__operators_windowTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/windowTime.js"); /* unused harmony reexport windowTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__operators_windowToggle__ = __webpack_require__("../../../../rxjs/_esm5/operators/windowToggle.js"); /* unused harmony reexport windowToggle */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__operators_windowWhen__ = __webpack_require__("../../../../rxjs/_esm5/operators/windowWhen.js"); /* unused harmony reexport windowWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__operators_withLatestFrom__ = __webpack_require__("../../../../rxjs/_esm5/operators/withLatestFrom.js"); /* unused harmony reexport withLatestFrom */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__operators_zip__ = __webpack_require__("../../../../rxjs/_esm5/operators/zip.js"); /* unused harmony reexport zip */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__operators_zipAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/zipAll.js"); /* unused harmony reexport zipAll */ /** PURE_IMPORTS_START PURE_IMPORTS_END */ /** * TODO(https://github.com/ReactiveX/rxjs/issues/2900): Add back subscribeOn once it can be * treeshaken. Currently if this export is added back, it * forces apps to bring in asap scheduler along with * Immediate, root, and other supporting code. */ // export { subscribeOn } from './operators/subscribeOn'; //# sourceMappingURL=operators.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/audit.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = audit; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Ignores source values for a duration determined by another Observable, then * emits the most recent value from the source Observable, then repeats this * process. * * It's like {@link auditTime}, but the silencing * duration is determined by a second Observable. * * * * `audit` is similar to `throttle`, but emits the last value from the silenced * time window, instead of the first value. `audit` emits the most recent value * from the source Observable on the output Observable as soon as its internal * timer becomes disabled, and ignores source values while the timer is enabled. * Initially, the timer is disabled. As soon as the first source value arrives, * the timer is enabled by calling the `durationSelector` function with the * source value, which returns the "duration" Observable. When the duration * Observable emits a value or completes, the timer is disabled, then the most * recent source value is emitted on the output Observable, and this process * repeats for the next source value. * * @example Emit clicks at a rate of at most one click per second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.audit(ev => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link auditTime} * @see {@link debounce} * @see {@link delayWhen} * @see {@link sample} * @see {@link throttle} * * @param {function(value: T): SubscribableOrPromise} durationSelector A function * that receives a value from the source Observable, for computing the silencing * duration, returned as an Observable or a Promise. * @return {Observable} An Observable that performs rate-limiting of * emissions from the source Observable. * @method audit * @owner Observable */ function audit(durationSelector) { return function auditOperatorFunction(source) { return source.lift(new AuditOperator(durationSelector)); }; } var AuditOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function AuditOperator(durationSelector) { this.durationSelector = durationSelector; } AuditOperator.prototype.call = function (subscriber, source) { return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); }; return AuditOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var AuditSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 = Object(__WEBPACK_IMPORTED_MODULE_0__util_tryCatch__["a" /* tryCatch */])(this.durationSelector)(value); if (duration === __WEBPACK_IMPORTED_MODULE_1__util_errorObject__["a" /* errorObject */]) { this.destination.error(__WEBPACK_IMPORTED_MODULE_1__util_errorObject__["a" /* errorObject */].e); } else { var innerSubscription = Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* subscribeToResult */])(this, duration); if (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; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=audit.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/auditTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = auditTime; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__audit__ = __webpack_require__("../../../../rxjs/_esm5/operators/audit.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__observable_timer__ = __webpack_require__("../../../../rxjs/_esm5/observable/timer.js"); /** PURE_IMPORTS_START .._scheduler_async,._audit,.._observable_timer PURE_IMPORTS_END */ /** * Ignores source values for `duration` milliseconds, then emits the most recent * value from the source Observable, then repeats this process. * * When it sees a source values, it ignores that plus * the next ones for `duration` milliseconds, and then it emits the most recent * value from the source. * * * * `auditTime` is similar to `throttleTime`, but emits the last value from the * silenced time window, instead of the first value. `auditTime` emits the most * recent value from the source Observable on the output Observable as soon as * its internal timer becomes disabled, and ignores source values while the * timer is enabled. Initially, the timer is disabled. As soon as the first * source value arrives, the timer is enabled. After `duration` milliseconds (or * the time unit determined internally by the optional `scheduler`) has passed, * the timer is disabled, then the most recent source value is emitted on the * output Observable, and this process repeats for the next source value. * Optionally takes a {@link IScheduler} for managing timers. * * @example Emit clicks at a rate of at most one click per second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.auditTime(1000); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounceTime} * @see {@link delay} * @see {@link sampleTime} * @see {@link throttleTime} * * @param {number} duration Time to wait before emitting the most recent source * value, measured in milliseconds or the time unit determined internally * by the optional `scheduler`. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for * managing the timers that handle the rate-limiting behavior. * @return {Observable} An Observable that performs rate-limiting of * emissions from the source Observable. * @method auditTime * @owner Observable */ function auditTime(duration, scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_0__scheduler_async__["a" /* async */]; } return Object(__WEBPACK_IMPORTED_MODULE_1__audit__["a" /* audit */])(function () { return Object(__WEBPACK_IMPORTED_MODULE_2__observable_timer__["a" /* timer */])(duration, scheduler); }); } //# sourceMappingURL=auditTime.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/buffer.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export buffer */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Buffers the source Observable values until `closingNotifier` emits. * * Collects values from the past as an array, and emits * that array only when another Observable emits. * * * * Buffers the incoming Observable values until the given `closingNotifier` * Observable emits a value, at which point it emits the buffer on the output * Observable and starts a new buffer internally, awaiting the next time * `closingNotifier` emits. * * @example On every click, emit array of most recent interval events * var clicks = Rx.Observable.fromEvent(document, 'click'); * var interval = Rx.Observable.interval(1000); * var buffered = interval.buffer(clicks); * buffered.subscribe(x => console.log(x)); * * @see {@link bufferCount} * @see {@link bufferTime} * @see {@link bufferToggle} * @see {@link bufferWhen} * @see {@link window} * * @param {Observable} closingNotifier An Observable that signals the * buffer to be emitted on the output Observable. * @return {Observable} An Observable of buffers, which are arrays of * values. * @method buffer * @owner Observable */ function buffer(closingNotifier) { return function bufferOperatorFunction(source) { return source.lift(new BufferOperator(closingNotifier)); }; } var BufferOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function BufferOperator(closingNotifier) { this.closingNotifier = closingNotifier; } BufferOperator.prototype.call = function (subscriber, source) { return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); }; return BufferOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var BufferSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(BufferSubscriber, _super); function BufferSubscriber(destination, closingNotifier) { var _this = _super.call(this, destination) || this; _this.buffer = []; _this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=buffer.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/bufferCount.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export bufferCount */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Buffers the source Observable values until the size hits the maximum * `bufferSize` given. * * Collects values from the past as an array, and emits * that array only when its size reaches `bufferSize`. * * * * Buffers a number of values from the source Observable by `bufferSize` then * emits the buffer and clears it, and starts a new buffer each * `startBufferEvery` values. If `startBufferEvery` is not provided or is * `null`, then new buffers are started immediately at the start of the source * and when each buffer closes and is emitted. * * @example Emit the last two click events as an array * var clicks = Rx.Observable.fromEvent(document, 'click'); * var buffered = clicks.bufferCount(2); * buffered.subscribe(x => console.log(x)); * * @example On every click, emit the last two click events as an array * var clicks = Rx.Observable.fromEvent(document, 'click'); * var buffered = clicks.bufferCount(2, 1); * buffered.subscribe(x => console.log(x)); * * @see {@link buffer} * @see {@link bufferTime} * @see {@link bufferToggle} * @see {@link bufferWhen} * @see {@link pairwise} * @see {@link windowCount} * * @param {number} bufferSize The maximum size of the buffer emitted. * @param {number} [startBufferEvery] Interval at which to start a new buffer. * For example if `startBufferEvery` is `2`, then a new buffer will be started * on every other value from the source. A new buffer is started at the * beginning of the source by default. * @return {Observable} An Observable of arrays of buffered values. * @method bufferCount * @owner Observable */ function bufferCount(bufferSize, startBufferEvery) { if (startBufferEvery === void 0) { startBufferEvery = null; } return function bufferCountOperatorFunction(source) { return source.lift(new BufferCountOperator(bufferSize, startBufferEvery)); }; } var BufferCountOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var BufferCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var BufferSkipCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=bufferCount.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/bufferTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export bufferTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /** PURE_IMPORTS_START .._scheduler_async,.._Subscriber,.._util_isScheduler PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Buffers the source Observable values for a specific time period. * * Collects values from the past as an array, and emits * those arrays periodically in time. * * * * Buffers values from the source for a specific time duration `bufferTimeSpan`. * Unless the optional argument `bufferCreationInterval` is given, it emits and * resets the buffer every `bufferTimeSpan` milliseconds. If * `bufferCreationInterval` is given, this operator opens the buffer every * `bufferCreationInterval` milliseconds and closes (emits and resets) the * buffer every `bufferTimeSpan` milliseconds. When the optional argument * `maxBufferSize` is specified, the buffer will be closed either after * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. * * @example Every second, emit an array of the recent click events * var clicks = Rx.Observable.fromEvent(document, 'click'); * var buffered = clicks.bufferTime(1000); * buffered.subscribe(x => console.log(x)); * * @example Every 5 seconds, emit the click events from the next 2 seconds * var clicks = Rx.Observable.fromEvent(document, 'click'); * var buffered = clicks.bufferTime(2000, 5000); * buffered.subscribe(x => console.log(x)); * * @see {@link buffer} * @see {@link bufferCount} * @see {@link bufferToggle} * @see {@link bufferWhen} * @see {@link windowTime} * * @param {number} bufferTimeSpan The amount of time to fill each buffer array. * @param {number} [bufferCreationInterval] The interval at which to start new * buffers. * @param {number} [maxBufferSize] The maximum buffer size. * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the * intervals that determine buffer boundaries. * @return {Observable} An observable of arrays of buffered values. * @method bufferTime * @owner Observable */ function bufferTime(bufferTimeSpan) { var length = arguments.length; var scheduler = __WEBPACK_IMPORTED_MODULE_0__scheduler_async__["a" /* async */]; if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isScheduler__["a" /* 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)); }; } var BufferTimeOperator = /*@__PURE__*/ (/*@__PURE__*/ 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 = /*@__PURE__*/ (/*@__PURE__*/ function () { function Context() { this.buffer = []; } return Context; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var BufferTimeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* 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); } //# sourceMappingURL=bufferTime.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/bufferToggle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export bufferToggle */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /** PURE_IMPORTS_START .._Subscription,.._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Buffers the source Observable values starting from an emission from * `openings` and ending when the output of `closingSelector` emits. * * Collects values from the past as an array. Starts * collecting only when `opening` emits, and calls the `closingSelector` * function to get an Observable that tells when to close the buffer. * * * * Buffers values from the source by opening the buffer via signals from an * Observable provided to `openings`, and closing and sending the buffers when * a Subscribable or Promise returned by the `closingSelector` function emits. * * @example Every other second, emit the click events from the next 500ms * var clicks = Rx.Observable.fromEvent(document, 'click'); * var openings = Rx.Observable.interval(1000); * var buffered = clicks.bufferToggle(openings, i => * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() * ); * buffered.subscribe(x => console.log(x)); * * @see {@link buffer} * @see {@link bufferCount} * @see {@link bufferTime} * @see {@link bufferWhen} * @see {@link windowToggle} * * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new * buffers. * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes * the value emitted by the `openings` observable and returns a Subscribable or Promise, * which, when it emits, signals that the associated buffer should be emitted * and cleared. * @return {Observable} An observable of arrays of buffered values. * @method bufferToggle * @owner Observable */ function bufferToggle(openings, closingSelector) { return function bufferToggleOperatorFunction(source) { return source.lift(new BufferToggleOperator(openings, closingSelector)); }; } var BufferToggleOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var BufferToggleSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* 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 __WEBPACK_IMPORTED_MODULE_0__Subscription__["a" /* Subscription */](); var context = { buffer: buffer, subscription: subscription }; contexts.push(context); var innerSubscription = Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, closingNotifier, context); if (!innerSubscription || innerSubscription.closed) { this.closeBuffer(context); } else { innerSubscription.context = context; this.add(innerSubscription); subscription.add(innerSubscription); } }; return BufferToggleSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=bufferToggle.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/bufferWhen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export bufferWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subscription,.._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Buffers the source Observable values, using a factory function of closing * Observables to determine when to close, emit, and reset the buffer. * * Collects values from the past as an array. When it * starts collecting values, it calls a function that returns an Observable that * tells when to close the buffer and restart collecting. * * * * Opens a buffer immediately, then closes the buffer when the observable * returned by calling `closingSelector` function emits a value. When it closes * the buffer, it immediately opens a new buffer and repeats the process. * * @example Emit an array of the last clicks every [1-5] random seconds * var clicks = Rx.Observable.fromEvent(document, 'click'); * var buffered = clicks.bufferWhen(() => * Rx.Observable.interval(1000 + Math.random() * 4000) * ); * buffered.subscribe(x => console.log(x)); * * @see {@link buffer} * @see {@link bufferCount} * @see {@link bufferTime} * @see {@link bufferToggle} * @see {@link windowWhen} * * @param {function(): Observable} closingSelector A function that takes no * arguments and returns an Observable that signals buffer closure. * @return {Observable} An observable of arrays of buffered values. * @method bufferWhen * @owner Observable */ function bufferWhen(closingSelector) { return function (source) { return source.lift(new BufferWhenOperator(closingSelector)); }; } var BufferWhenOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function BufferWhenOperator(closingSelector) { this.closingSelector = closingSelector; } BufferWhenOperator.prototype.call = function (subscriber, source) { return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); }; return BufferWhenOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var BufferWhenSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(this.closingSelector)(); if (closingNotifier === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { this.error(__WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */].e); } else { closingSubscription = new __WEBPACK_IMPORTED_MODULE_0__Subscription__["a" /* Subscription */](); this.closingSubscription = closingSubscription; this.add(closingSubscription); this.subscribing = true; closingSubscription.add(Object(__WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__["a" /* subscribeToResult */])(this, closingNotifier)); this.subscribing = false; } }; return BufferWhenSubscriber; }(__WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=bufferWhen.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/catchError.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = catchError; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Catches errors on the observable to be handled by returning a new observable or throwing an error. * * * * @example Continues with a different Observable when there's an error * * Observable.of(1, 2, 3, 4, 5) * .map(n => { * if (n == 4) { * throw 'four!'; * } * return n; * }) * .catch(err => Observable.of('I', 'II', 'III', 'IV', 'V')) * .subscribe(x => console.log(x)); * // 1, 2, 3, I, II, III, IV, V * * @example Retries the caught source Observable again in case of error, similar to retry() operator * * Observable.of(1, 2, 3, 4, 5) * .map(n => { * if (n === 4) { * throw 'four!'; * } * return n; * }) * .catch((err, caught) => caught) * .take(30) * .subscribe(x => console.log(x)); * // 1, 2, 3, 1, 2, 3, ... * * @example Throws a new error when the source Observable throws an error * * Observable.of(1, 2, 3, 4, 5) * .map(n => { * if (n == 4) { * throw 'four!'; * } * return n; * }) * .catch(err => { * throw 'error in source. Details: ' + err; * }) * .subscribe( * x => console.log(x), * err => console.log(err) * ); * // 1, 2, 3, error in source. Details: four! * * @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which * is the source observable, in case you'd like to "retry" that observable by returning it again. Whatever observable * is returned by the `selector` will be used to continue the observable chain. * @return {Observable} An observable that originates from either the source or the observable returned by the * catch `selector` function. * @name catchError */ function catchError(selector) { return function catchErrorOperatorFunction(source) { var operator = new CatchOperator(selector); var caught = source.lift(operator); return (operator.caught = caught); }; } var CatchOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var CatchSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; } // NOTE: overriding `error` instead of `_error` because we don't want // to have this flag this subscriber as `isStopped`. We can mimic the // behavior of the RetrySubscriber (from the `retry` operator), where // we unsubscribe from our source chain, reset our Subscriber flags, // then subscribe to the selector result. 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(); this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, result)); } }; return CatchSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=catchError.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/combineAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export combineAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_combineLatest__ = __webpack_require__("../../../../rxjs/_esm5/operators/combineLatest.js"); /** PURE_IMPORTS_START .._operators_combineLatest PURE_IMPORTS_END */ function combineAll(project) { return function (source) { return source.lift(new __WEBPACK_IMPORTED_MODULE_0__operators_combineLatest__["a" /* CombineLatestOperator */](project)); }; } //# sourceMappingURL=combineAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/combineLatest.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = combineLatest; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CombineLatestOperator; }); /* unused harmony export CombineLatestSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._observable_ArrayObservable,.._util_isArray,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var none = {}; /* tslint:enable:max-line-length */ /** * Combines multiple Observables to create an Observable whose values are * calculated from the latest values of each of its input Observables. * * Whenever any input Observable emits a value, it * computes a formula using the latest values from all the inputs, then emits * the output of that formula. * * * * `combineLatest` combines the values from this Observable with values from * Observables passed as arguments. This is done by subscribing to each * Observable, in order, and collecting an array of each of the most recent * values any time any of the input Observables emits, then either taking that * array and passing it as arguments to an optional `project` function and * emitting the return value of that, or just emitting the array of recent * values directly if there is no `project` function. * * @example Dynamically calculate the Body-Mass Index from an Observable of weight and one for height * var weight = Rx.Observable.of(70, 72, 76, 79, 75); * var height = Rx.Observable.of(1.76, 1.77, 1.78); * var bmi = weight.combineLatest(height, (w, h) => w / (h * h)); * bmi.subscribe(x => console.log('BMI is ' + x)); * * // With output to console: * // BMI is 24.212293388429753 * // BMI is 23.93948099205209 * // BMI is 23.671253629592222 * * @see {@link combineAll} * @see {@link merge} * @see {@link withLatestFrom} * * @param {ObservableInput} other An input Observable to combine with the source * Observable. More than one input Observables may be given as argument. * @param {function} [project] An optional function to project the values from * the combined latest values into a new value on the output Observable. * @return {Observable} An Observable of projected values from the most recent * values from each input Observable, or an array of the most recent values from * each input Observable. * @method combineLatest * @owner Observable */ 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 the first and only other argument besides the resultSelector is an array // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` if (observables.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_1__util_isArray__["a" /* isArray */])(observables[0])) { observables = observables[0].slice(); } return function (source) { return source.lift.call(new __WEBPACK_IMPORTED_MODULE_0__observable_ArrayObservable__["a" /* ArrayObservable */]([source].concat(observables)), new CombineLatestOperator(project)); }; } var CombineLatestOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function CombineLatestOperator(project) { this.project = project; } CombineLatestOperator.prototype.call = function (subscriber, source) { return source.subscribe(new CombineLatestSubscriber(subscriber, this.project)); }; return CombineLatestOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var CombineLatestSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(CombineLatestSubscriber, _super); function CombineLatestSubscriber(destination, project) { var _this = _super.call(this, destination) || this; _this.project = project; _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(Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* 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.project) { this._tryProject(values); } else { this.destination.next(values.slice()); } } }; CombineLatestSubscriber.prototype._tryProject = function (values) { var result; try { result = this.project.apply(this, values); } catch (err) { this.destination.error(err); return; } this.destination.next(result); }; return CombineLatestSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=combineLatest.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/concat.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export concat */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_concat__ = __webpack_require__("../../../../rxjs/_esm5/observable/concat.js"); /* unused harmony reexport concatStatic */ /** PURE_IMPORTS_START .._observable_concat PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Creates an output Observable which sequentially emits all values from every * given input Observable after the current Observable. * * Concatenates multiple Observables together by * sequentially emitting their values, one Observable after the other. * * * * Joins this Observable with multiple other Observables by subscribing to them * one at a time, starting with the source, and merging their results into the * output Observable. Will wait for each Observable to complete before moving * on to the next. * * @example Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10 * var timer = Rx.Observable.interval(1000).take(4); * var sequence = Rx.Observable.range(1, 10); * var result = timer.concat(sequence); * result.subscribe(x => console.log(x)); * * // results in: * // 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10 * * @example Concatenate 3 Observables * var timer1 = Rx.Observable.interval(1000).take(10); * var timer2 = Rx.Observable.interval(2000).take(6); * var timer3 = Rx.Observable.interval(500).take(10); * var result = timer1.concat(timer2, timer3); * result.subscribe(x => console.log(x)); * * // results in the following: * // (Prints to console sequentially) * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9 * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5 * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9 * * @see {@link concatAll} * @see {@link concatMap} * @see {@link concatMapTo} * * @param {ObservableInput} other An input Observable to concatenate after the source * Observable. More than one input Observables may be given as argument. * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each * Observable subscription on. * @return {Observable} All values of each passed Observable merged into a * single Observable, in order, in serial fashion. * @method concat * @owner Observable */ function concat() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } return function (source) { return source.lift.call(__WEBPACK_IMPORTED_MODULE_0__observable_concat__["a" /* concat */].apply(void 0, [source].concat(observables))); }; } //# sourceMappingURL=concat.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/concatAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = concatAll; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mergeAll__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeAll.js"); /** PURE_IMPORTS_START ._mergeAll PURE_IMPORTS_END */ /** * Converts a higher-order Observable into a first-order Observable by * concatenating the inner Observables in order. * * Flattens an Observable-of-Observables by putting one * inner Observable after the other. * * * * Joins every Observable emitted by the source (a higher-order Observable), in * a serial fashion. It subscribes to each inner Observable only after the * previous inner Observable has completed, and merges all of their values into * the returned observable. * * __Warning:__ If the source Observable emits Observables quickly and * endlessly, and the inner Observables it emits generally complete slower than * the source emits, you can run into memory issues as the incoming Observables * collect in an unbounded buffer. * * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set * to `1`. * * @example For each click event, tick every second from 0 to 3, with no concurrency * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4)); * var firstOrder = higherOrder.concatAll(); * firstOrder.subscribe(x => console.log(x)); * * // Results in the following: * // (results are not concurrent) * // For every click on the "document" it will emit values 0 to 3 spaced * // on a 1000ms interval * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 * * @see {@link combineAll} * @see {@link concat} * @see {@link concatMap} * @see {@link concatMapTo} * @see {@link exhaust} * @see {@link mergeAll} * @see {@link switch} * @see {@link zipAll} * * @return {Observable} An Observable emitting values from all the inner * Observables concatenated. * @method concatAll * @owner Observable */ function concatAll() { return Object(__WEBPACK_IMPORTED_MODULE_0__mergeAll__["a" /* mergeAll */])(1); } //# sourceMappingURL=concatAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/concatMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = concatMap; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mergeMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeMap.js"); /** PURE_IMPORTS_START ._mergeMap PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Projects each source value to an Observable which is merged in the output * Observable, in a serialized fashion waiting for each one to complete before * merging the next. * * Maps each value to an Observable, then flattens all of * these inner Observables using {@link concatAll}. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an (so-called "inner") Observable. Each new inner Observable is * concatenated with the previous inner Observable. * * __Warning:__ if source values arrive endlessly and faster than their * corresponding inner Observables can complete, it will result in memory issues * as inner Observables amass in an unbounded buffer waiting for their turn to * be subscribed to. * * Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set * to `1`. * * @example For each click event, tick every second from 0 to 3, with no concurrency * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4)); * result.subscribe(x => console.log(x)); * * // Results in the following: * // (results are not concurrent) * // For every click on the "document" it will emit values 0 to 3 spaced * // on a 1000ms interval * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 * * @see {@link concat} * @see {@link concatAll} * @see {@link concatMapTo} * @see {@link exhaustMap} * @see {@link mergeMap} * @see {@link switchMap} * * @param {function(value: T, ?index: number): ObservableInput} project A function * that, when applied to an item emitted by the source Observable, returns an * Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @return {Observable} An Observable that emits the result of applying the * projection function (and the optional `resultSelector`) to each item emitted * by the source Observable and taking values from each projected inner * Observable sequentially. * @method concatMap * @owner Observable */ function concatMap(project, resultSelector) { return Object(__WEBPACK_IMPORTED_MODULE_0__mergeMap__["a" /* mergeMap */])(project, resultSelector, 1); } //# sourceMappingURL=concatMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/concatMapTo.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export concatMapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__concatMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/concatMap.js"); /** PURE_IMPORTS_START ._concatMap PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Projects each source value to the same Observable which is merged multiple * times in a serialized fashion on the output Observable. * * It's like {@link concatMap}, but maps each value * always to the same inner Observable. * * * * Maps each source value to the given Observable `innerObservable` regardless * of the source value, and then flattens those resulting Observables into one * single Observable, which is the output Observable. Each new `innerObservable` * instance emitted on the output Observable is concatenated with the previous * `innerObservable` instance. * * __Warning:__ if source values arrive endlessly and faster than their * corresponding inner Observables can complete, it will result in memory issues * as inner Observables amass in an unbounded buffer waiting for their turn to * be subscribed to. * * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter * set to `1`. * * @example For each click event, tick every second from 0 to 3, with no concurrency * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); * result.subscribe(x => console.log(x)); * * // Results in the following: * // (results are not concurrent) * // For every click on the "document" it will emit values 0 to 3 spaced * // on a 1000ms interval * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 * * @see {@link concat} * @see {@link concatAll} * @see {@link concatMap} * @see {@link mergeMapTo} * @see {@link switchMapTo} * * @param {ObservableInput} innerObservable An Observable to replace each value from * the source Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @return {Observable} An observable of values merged together by joining the * passed observable with itself, one after the other, for each value emitted * from the source. * @method concatMapTo * @owner Observable */ function concatMapTo(innerObservable, resultSelector) { return Object(__WEBPACK_IMPORTED_MODULE_0__concatMap__["a" /* concatMap */])(function () { return innerObservable; }, resultSelector); } //# sourceMappingURL=concatMapTo.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/count.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export count */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Counts the number of emissions on the source and emits that number when the * source completes. * * Tells how many values were emitted, when the source * completes. * * * * `count` transforms an Observable that emits values into an Observable that * emits a single value that represents the number of values emitted by the * source Observable. If the source Observable terminates with an error, `count` * will pass this error notification along without emitting a value first. If * the source Observable does not terminate at all, `count` will neither emit * a value nor terminate. This operator takes an optional `predicate` function * as argument, in which case the output emission will represent the number of * source values that matched `true` with the `predicate`. * * @example Counts how many seconds have passed before the first click happened * var seconds = Rx.Observable.interval(1000); * var clicks = Rx.Observable.fromEvent(document, 'click'); * var secondsBeforeClick = seconds.takeUntil(clicks); * var result = secondsBeforeClick.count(); * result.subscribe(x => console.log(x)); * * @example Counts how many odd numbers are there between 1 and 7 * var numbers = Rx.Observable.range(1, 7); * var result = numbers.count(i => i % 2 === 1); * result.subscribe(x => console.log(x)); * * // Results in: * // 4 * * @see {@link max} * @see {@link min} * @see {@link reduce} * * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A * boolean function to select what values are to be counted. It is provided with * arguments of: * - `value`: the value from the source Observable. * - `index`: the (zero-based) "index" of the value from the source Observable. * - `source`: the source Observable instance itself. * @return {Observable} An Observable of one number that represents the count as * described above. * @method count * @owner Observable */ function count(predicate) { return function (source) { return source.lift(new CountOperator(predicate, source)); }; } var CountOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var CountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=count.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/debounce.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export debounce */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits a value from the source Observable only after a particular time span * determined by another Observable has passed without another source emission. * * It's like {@link debounceTime}, but the time span of * emission silence is determined by a second Observable. * * * * `debounce` delays values emitted by the source Observable, but drops previous * pending delayed emissions if a new value arrives on the source Observable. * This operator keeps track of the most recent value from the source * Observable, and spawns a duration Observable by calling the * `durationSelector` function. The value is emitted only when the duration * Observable emits a value or completes, and if no other value was emitted on * the source Observable since the duration Observable was spawned. If a new * value appears before the duration Observable emits, the previous value will * be dropped and will not be emitted on the output Observable. * * Like {@link debounceTime}, this is a rate-limiting operator, and also a * delay-like operator since output emissions do not necessarily occur at the * same time as they did on the source Observable. * * @example Emit the most recent click after a burst of clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.debounce(() => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounceTime} * @see {@link delayWhen} * @see {@link throttle} * * @param {function(value: T): SubscribableOrPromise} durationSelector A function * that receives a value from the source Observable, for computing the timeout * duration for each source value, returned as an Observable or a Promise. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified duration Observable returned by * `durationSelector`, and may drop some values if they occur too frequently. * @method debounce * @owner Observable */ function debounce(durationSelector) { return function (source) { return source.lift(new DebounceOperator(durationSelector)); }; } var DebounceOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function DebounceOperator(durationSelector) { this.durationSelector = durationSelector; } DebounceOperator.prototype.call = function (subscriber, source) { return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); }; return DebounceOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DebounceSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 = Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, duration); if (!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; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=debounce.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/debounceTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = debounceTime; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /** PURE_IMPORTS_START .._Subscriber,.._scheduler_async PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits a value from the source Observable only after a particular time span * has passed without another source emission. * * It's like {@link delay}, but passes only the most * recent value from each burst of emissions. * * * * `debounceTime` delays values emitted by the source Observable, but drops * previous pending delayed emissions if a new value arrives on the source * Observable. This operator keeps track of the most recent value from the * source Observable, and emits that only when `dueTime` enough time has passed * without any other value appearing on the source Observable. If a new value * appears before `dueTime` silence occurs, the previous value will be dropped * and will not be emitted on the output Observable. * * This is a rate-limiting operator, because it is impossible for more than one * value to be emitted in any time window of duration `dueTime`, but it is also * a delay-like operator since output emissions do not occur at the same time as * they did on the source Observable. Optionally takes a {@link IScheduler} for * managing timers. * * @example Emit the most recent click after a burst of clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.debounceTime(1000); * result.subscribe(x => console.log(x)); * * @see {@link auditTime} * @see {@link debounce} * @see {@link delay} * @see {@link sampleTime} * @see {@link throttleTime} * * @param {number} dueTime The timeout duration in milliseconds (or the time * unit determined internally by the optional `scheduler`) for the window of * time required to wait for emission silence before emitting the most recent * source value. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for * managing the timers that handle the timeout for each value. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified `dueTime`, and may drop some values if they occur * too frequently. * @method debounceTime * @owner Observable */ function debounceTime(dueTime, scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_1__scheduler_async__["a" /* async */]; } return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); }; } var DebounceTimeOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DebounceTimeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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) { this.destination.next(this.lastValue); this.lastValue = null; this.hasValue = false; } }; DebounceTimeSubscriber.prototype.clearDebounce = function () { var debouncedSubscription = this.debouncedSubscription; if (debouncedSubscription !== null) { this.remove(debouncedSubscription); debouncedSubscription.unsubscribe(); this.debouncedSubscription = null; } }; return DebounceTimeSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); function dispatchNext(subscriber) { subscriber.debouncedNext(); } //# sourceMappingURL=debounceTime.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/defaultIfEmpty.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = defaultIfEmpty; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Emits a given value if the source Observable completes without emitting any * `next` value, otherwise mirrors the source Observable. * * If the source Observable turns out to be empty, then * this operator will emit a default value. * * * * `defaultIfEmpty` emits the values emitted by the source Observable or a * specified default value if the source Observable is empty (completes without * having emitted any `next` value). * * @example If no clicks happen in 5 seconds, then emit "no clicks" * var clicks = Rx.Observable.fromEvent(document, 'click'); * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); * result.subscribe(x => console.log(x)); * * @see {@link empty} * @see {@link last} * * @param {any} [defaultValue=null] The default value used if the source * Observable is empty. * @return {Observable} An Observable that emits either the specified * `defaultValue` if the source Observable emits no items, or the values emitted * by the source Observable. * @method defaultIfEmpty * @owner Observable */ function defaultIfEmpty(defaultValue) { if (defaultValue === void 0) { defaultValue = null; } return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); }; } var DefaultIfEmptyOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function DefaultIfEmptyOperator(defaultValue) { this.defaultValue = defaultValue; } DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); }; return DefaultIfEmptyOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DefaultIfEmptySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=defaultIfEmpty.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/delay.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = delay; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isDate__ = __webpack_require__("../../../../rxjs/_esm5/util/isDate.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Notification__ = __webpack_require__("../../../../rxjs/_esm5/Notification.js"); /** PURE_IMPORTS_START .._scheduler_async,.._util_isDate,.._Subscriber,.._Notification PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Delays the emission of items from the source Observable by a given timeout or * until a given Date. * * Time shifts each item by some specified amount of * milliseconds. * * * * If the delay argument is a Number, this operator time shifts the source * Observable by that amount of time expressed in milliseconds. The relative * time intervals between the values are preserved. * * If the delay argument is a Date, this operator time shifts the start of the * Observable execution until the given date occurs. * * @example Delay each click by one second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second * delayedClicks.subscribe(x => console.log(x)); * * @example Delay all clicks until a future date happens * var clicks = Rx.Observable.fromEvent(document, 'click'); * var date = new Date('March 15, 2050 12:00:00'); // in the future * var delayedClicks = clicks.delay(date); // click emitted only after that date * delayedClicks.subscribe(x => console.log(x)); * * @see {@link debounceTime} * @see {@link delayWhen} * * @param {number|Date} delay The delay duration in milliseconds (a `number`) or * a `Date` until which the emission of the source items is delayed. * @param {Scheduler} [scheduler=async] The IScheduler to use for * managing the timers that handle the time-shift for each item. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified timeout or Date. * @method delay * @owner Observable */ function delay(delay, scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_0__scheduler_async__["a" /* async */]; } var absoluteDelay = Object(__WEBPACK_IMPORTED_MODULE_1__util_isDate__["a" /* isDate */])(delay); var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); return function (source) { return source.lift(new DelayOperator(delayFor, scheduler)); }; } var DelayOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DelaySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 { source.active = false; } }; DelaySubscriber.prototype._schedule = function (scheduler) { this.active = true; this.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(__WEBPACK_IMPORTED_MODULE_3__Notification__["a" /* Notification */].createNext(value)); }; DelaySubscriber.prototype._error = function (err) { this.errored = true; this.queue = []; this.destination.error(err); }; DelaySubscriber.prototype._complete = function () { this.scheduleNotification(__WEBPACK_IMPORTED_MODULE_3__Notification__["a" /* Notification */].createComplete()); }; return DelaySubscriber; }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); var DelayMessage = /*@__PURE__*/ (/*@__PURE__*/ function () { function DelayMessage(time, notification) { this.time = time; this.notification = notification; } return DelayMessage; }()); //# sourceMappingURL=delay.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/delayWhen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export delayWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subscriber,.._Observable,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Delays the emission of items from the source Observable by a given time span * determined by the emissions of another Observable. * * It's like {@link delay}, but the time span of the * delay duration is determined by a second Observable. * * * * `delayWhen` time shifts each emitted value from the source Observable by a * time span determined by another Observable. When the source emits a value, * the `delayDurationSelector` function is called with the source value as * argument, and should return an Observable, called the "duration" Observable. * The source value is emitted on the output Observable only when the duration * Observable emits a value or completes. * * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which * is an Observable. When `subscriptionDelay` emits its first value or * completes, the source Observable is subscribed to and starts behaving like * described in the previous paragraph. If `subscriptionDelay` is not provided, * `delayWhen` will subscribe to the source Observable as soon as the output * Observable is subscribed. * * @example Delay each click by a random amount of time, between 0 and 5 seconds * var clicks = Rx.Observable.fromEvent(document, 'click'); * var delayedClicks = clicks.delayWhen(event => * Rx.Observable.interval(Math.random() * 5000) * ); * delayedClicks.subscribe(x => console.log(x)); * * @see {@link debounce} * @see {@link delay} * * @param {function(value: T): Observable} delayDurationSelector A function that * returns an Observable for each value emitted by the source Observable, which * is then used to delay the emission of that item on the output Observable * until the Observable returned from this function emits a value. * @param {Observable} subscriptionDelay An Observable that triggers the * subscription to the source Observable once it emits any value. * @return {Observable} An Observable that delays the emissions of the source * Observable by an amount of time specified by the Observable returned by * `delayDurationSelector`. * @method delayWhen * @owner Observable */ 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)); }; } var DelayWhenOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function DelayWhenOperator(delayDurationSelector) { this.delayDurationSelector = delayDurationSelector; } DelayWhenOperator.prototype.call = function (subscriber, source) { return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); }; return DelayWhenOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DelayWhenSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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.values = []; 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) { try { var delayNotifier = this.delayDurationSelector(value); if (delayNotifier) { this.tryDelay(delayNotifier, value); } } catch (err) { this.destination.error(err); } }; DelayWhenSubscriber.prototype._complete = function () { this.completed = true; this.tryComplete(); }; DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { subscription.unsubscribe(); var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); var value = null; if (subscriptionIdx !== -1) { value = this.values[subscriptionIdx]; this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); this.values.splice(subscriptionIdx, 1); } return value; }; DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { var notifierSubscription = Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* subscribeToResult */])(this, delayNotifier, value); if (notifierSubscription && !notifierSubscription.closed) { this.add(notifierSubscription); this.delayNotifierSubscriptions.push(notifierSubscription); } this.values.push(value); }; DelayWhenSubscriber.prototype.tryComplete = function () { if (this.completed && this.delayNotifierSubscriptions.length === 0) { this.destination.complete(); } }; return DelayWhenSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SubscriptionDelayObservable = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SubscriptionDelaySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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.subscribeToSource(); }; SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { if (!this.sourceSubscribed) { this.sourceSubscribed = true; this.unsubscribe(); this.source.subscribe(this.parent); } }; return SubscriptionDelaySubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=delayWhen.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/dematerialize.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export dematerialize */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Converts an Observable of {@link Notification} objects into the emissions * that they represent. * * Unwraps {@link Notification} objects as actual `next`, * `error` and `complete` emissions. The opposite of {@link materialize}. * * * * `dematerialize` is assumed to operate an Observable that only emits * {@link Notification} objects as `next` emissions, and does not emit any * `error`. Such Observable is the output of a `materialize` operation. Those * notifications are then unwrapped using the metadata they contain, and emitted * as `next`, `error`, and `complete` on the output Observable. * * Use this operator in conjunction with {@link materialize}. * * @example Convert an Observable of Notifications to an actual Observable * var notifA = new Rx.Notification('N', 'A'); * var notifB = new Rx.Notification('N', 'B'); * var notifE = new Rx.Notification('E', void 0, * new TypeError('x.toUpperCase is not a function') * ); * var materialized = Rx.Observable.of(notifA, notifB, notifE); * var upperCase = materialized.dematerialize(); * upperCase.subscribe(x => console.log(x), e => console.error(e)); * * // Results in: * // A * // B * // TypeError: x.toUpperCase is not a function * * @see {@link Notification} * @see {@link materialize} * * @return {Observable} An Observable that emits items and notifications * embedded in Notification objects emitted by the source Observable. * @method dematerialize * @owner Observable */ function dematerialize() { return function dematerializeOperatorFunction(source) { return source.lift(new DeMaterializeOperator()); }; } var DeMaterializeOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function DeMaterializeOperator() { } DeMaterializeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new DeMaterializeSubscriber(subscriber)); }; return DeMaterializeOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DeMaterializeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=dematerialize.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/distinct.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export distinct */ /* unused harmony export DistinctSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_Set__ = __webpack_require__("../../../../rxjs/_esm5/util/Set.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult,.._util_Set PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. * * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the * source observable directly with an equality check against previous values. * * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. * * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so * that the internal `Set` can be "flushed", basically clearing it of values. * * @example A simple example with numbers * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) * .distinct() * .subscribe(x => console.log(x)); // 1, 2, 3, 4 * * @example An example using a keySelector function * interface Person { * age: number, * name: string * } * * Observable.of( * { age: 4, name: 'Foo'}, * { age: 7, name: 'Bar'}, * { age: 5, name: 'Foo'}) * .distinct((p: Person) => p.name) * .subscribe(x => console.log(x)); * * // displays: * // { age: 4, name: 'Foo' } * // { age: 7, name: 'Bar' } * * @see {@link distinctUntilChanged} * @see {@link distinctUntilKeyChanged} * * @param {function} [keySelector] Optional function to select which value you want to check as distinct. * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. * @return {Observable} An Observable that emits items from the source Observable with distinct values. * @method distinct * @owner Observable */ function distinct(keySelector, flushes) { return function (source) { return source.lift(new DistinctOperator(keySelector, flushes)); }; } var DistinctOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DistinctSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(DistinctSubscriber, _super); function DistinctSubscriber(destination, keySelector, flushes) { var _this = _super.call(this, destination) || this; _this.keySelector = keySelector; _this.values = new __WEBPACK_IMPORTED_MODULE_2__util_Set__["a" /* Set */](); if (flushes) { _this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=distinct.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/distinctUntilChanged.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = distinctUntilChanged; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_tryCatch,.._util_errorObject PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item. * * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. * * If a comparator function is not provided, an equality check is used by default. * * @example A simple example with numbers * Observable.of(1, 1, 2, 2, 2, 1, 1, 2, 3, 3, 4) * .distinctUntilChanged() * .subscribe(x => console.log(x)); // 1, 2, 1, 2, 3, 4 * * @example An example using a compare function * interface Person { * age: number, * name: string * } * * Observable.of( * { age: 4, name: 'Foo'}, * { age: 7, name: 'Bar'}, * { age: 5, name: 'Foo'}) * { age: 6, name: 'Foo'}) * .distinctUntilChanged((p: Person, q: Person) => p.name === q.name) * .subscribe(x => console.log(x)); * * // displays: * // { age: 4, name: 'Foo' } * // { age: 7, name: 'Bar' } * // { age: 5, name: 'Foo' } * * @see {@link distinct} * @see {@link distinctUntilKeyChanged} * * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. * @return {Observable} An Observable that emits items from the source Observable with distinct values. * @method distinctUntilChanged * @owner Observable */ function distinctUntilChanged(compare, keySelector) { return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); }; } var DistinctUntilChangedOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DistinctUntilChangedSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 keySelector = this.keySelector; var key = value; if (keySelector) { key = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(this.keySelector)(value); if (key === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { return this.destination.error(__WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */].e); } } var result = false; if (this.hasKey) { result = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(this.compare)(this.key, key); if (result === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { return this.destination.error(__WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */].e); } } else { this.hasKey = true; } if (Boolean(result) === false) { this.key = key; this.destination.next(value); } }; return DistinctUntilChangedSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=distinctUntilChanged.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/distinctUntilKeyChanged.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export distinctUntilKeyChanged */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__distinctUntilChanged__ = __webpack_require__("../../../../rxjs/_esm5/operators/distinctUntilChanged.js"); /** PURE_IMPORTS_START ._distinctUntilChanged PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, * using a property accessed by using the key provided to check if the two items are distinct. * * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. * * If a comparator function is not provided, an equality check is used by default. * * @example An example comparing the name of persons * * interface Person { * age: number, * name: string * } * * Observable.of( * { age: 4, name: 'Foo'}, * { age: 7, name: 'Bar'}, * { age: 5, name: 'Foo'}, * { age: 6, name: 'Foo'}) * .distinctUntilKeyChanged('name') * .subscribe(x => console.log(x)); * * // displays: * // { age: 4, name: 'Foo' } * // { age: 7, name: 'Bar' } * // { age: 5, name: 'Foo' } * * @example An example comparing the first letters of the name * * interface Person { * age: number, * name: string * } * * Observable.of( * { age: 4, name: 'Foo1'}, * { age: 7, name: 'Bar'}, * { age: 5, name: 'Foo2'}, * { age: 6, name: 'Foo3'}) * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) * .subscribe(x => console.log(x)); * * // displays: * // { age: 4, name: 'Foo1' } * // { age: 7, name: 'Bar' } * // { age: 5, name: 'Foo2' } * * @see {@link distinct} * @see {@link distinctUntilChanged} * * @param {string} key String key for object property lookup on each item. * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. * @method distinctUntilKeyChanged * @owner Observable */ function distinctUntilKeyChanged(key, compare) { return Object(__WEBPACK_IMPORTED_MODULE_0__distinctUntilChanged__["a" /* distinctUntilChanged */])(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; }); } //# sourceMappingURL=distinctUntilKeyChanged.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/elementAt.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export elementAt */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__ = __webpack_require__("../../../../rxjs/_esm5/util/ArgumentOutOfRangeError.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_ArgumentOutOfRangeError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits the single value at the specified `index` in a sequence of emissions * from the source Observable. * * Emits only the i-th value, then completes. * * * * `elementAt` returns an Observable that emits the item at the specified * `index` in the source Observable, or a default value if that `index` is out * of range and the `default` argument is provided. If the `default` argument is * not given and the `index` is out of range, the output Observable will emit an * `ArgumentOutOfRangeError` error. * * @example Emit only the third click event * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.elementAt(2); * result.subscribe(x => console.log(x)); * * // Results in: * // click 1 = nothing * // click 2 = nothing * // click 3 = MouseEvent object logged to console * * @see {@link first} * @see {@link last} * @see {@link skip} * @see {@link single} * @see {@link take} * * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the * Observable has completed before emitting the i-th `next` notification. * * @param {number} index Is the number `i` for the i-th source emission that has * happened since the subscription, starting from the number `0`. * @param {T} [defaultValue] The default value returned for missing indices. * @return {Observable} An Observable that emits a single item, if it is found. * Otherwise, will emit the default value if given. If not, then emits an error. * @method elementAt * @owner Observable */ function elementAt(index, defaultValue) { return function (source) { return source.lift(new ElementAtOperator(index, defaultValue)); }; } var ElementAtOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function ElementAtOperator(index, defaultValue) { this.index = index; this.defaultValue = defaultValue; if (index < 0) { throw new __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__["a" /* ArgumentOutOfRangeError */]; } } ElementAtOperator.prototype.call = function (subscriber, source) { return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); }; return ElementAtOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ElementAtSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ElementAtSubscriber, _super); function ElementAtSubscriber(destination, index, defaultValue) { var _this = _super.call(this, destination) || this; _this.index = index; _this.defaultValue = defaultValue; return _this; } ElementAtSubscriber.prototype._next = function (x) { if (this.index-- === 0) { this.destination.next(x); this.destination.complete(); } }; ElementAtSubscriber.prototype._complete = function () { var destination = this.destination; if (this.index >= 0) { if (typeof this.defaultValue !== 'undefined') { destination.next(this.defaultValue); } else { destination.error(new __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__["a" /* ArgumentOutOfRangeError */]); } } destination.complete(); }; return ElementAtSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=elementAt.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/every.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = every; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that emits whether or not every item of the source satisfies the condition specified. * * @example A simple example emitting true if all elements are less than 5, false otherwise * Observable.of(1, 2, 3, 4, 5, 6) * .every(x => x < 5) * .subscribe(x => console.log(x)); // -> false * * @param {function} predicate A function for determining if an item meets a specified condition. * @param {any} [thisArg] Optional object to use for `this` in the callback. * @return {Observable} An Observable of booleans that determines if all items of the source Observable meet the condition specified. * @method every * @owner Observable */ function every(predicate, thisArg) { return function (source) { return source.lift(new EveryOperator(predicate, thisArg, source)); }; } var EveryOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var EverySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=every.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/exhaust.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export exhaust */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Converts a higher-order Observable into a first-order Observable by dropping * inner Observables while the previous inner Observable has not yet completed. * * Flattens an Observable-of-Observables by dropping the * next inner Observables while the current inner is still executing. * * * * `exhaust` subscribes to an Observable that emits Observables, also known as a * higher-order Observable. Each time it observes one of these emitted inner * Observables, the output Observable begins emitting the items emitted by that * inner Observable. So far, it behaves like {@link mergeAll}. However, * `exhaust` ignores every new inner Observable if the previous Observable has * not yet completed. Once that one completes, it will accept and flatten the * next inner Observable and repeat this process. * * @example Run a finite timer for each click, only if there is no currently active timer * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); * var result = higherOrder.exhaust(); * result.subscribe(x => console.log(x)); * * @see {@link combineAll} * @see {@link concatAll} * @see {@link switch} * @see {@link mergeAll} * @see {@link exhaustMap} * @see {@link zipAll} * * @return {Observable} An Observable that takes a source of Observables and propagates the first observable * exclusively until it completes before subscribing to the next. * @method exhaust * @owner Observable */ function exhaust() { return function (source) { return source.lift(new SwitchFirstOperator()); }; } var SwitchFirstOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SwitchFirstOperator() { } SwitchFirstOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SwitchFirstSubscriber(subscriber)); }; return SwitchFirstOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SwitchFirstSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=exhaust.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/exhaustMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export exhaustMap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Projects each source value to an Observable which is merged in the output * Observable only if the previous projected Observable has completed. * * Maps each value to an Observable, then flattens all of * these inner Observables using {@link exhaust}. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an (so-called "inner") Observable. When it projects a source value to * an Observable, the output Observable begins emitting the items emitted by * that projected Observable. However, `exhaustMap` ignores every new projected * Observable if the previous projected Observable has not yet completed. Once * that one completes, it will accept and flatten the next projected Observable * and repeat this process. * * @example Run a finite timer for each click, only if there is no currently active timer * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); * result.subscribe(x => console.log(x)); * * @see {@link concatMap} * @see {@link exhaust} * @see {@link mergeMap} * @see {@link switchMap} * * @param {function(value: T, ?index: number): ObservableInput} project A function * that, when applied to an item emitted by the source Observable, returns an * Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @return {Observable} An Observable containing projected Observables * of each item of the source, ignoring projected Observables that start before * their preceding Observable has completed. * @method exhaustMap * @owner Observable */ function exhaustMap(project, resultSelector) { return function (source) { return source.lift(new SwitchFirstMapOperator(project, resultSelector)); }; } var SwitchFirstMapOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SwitchFirstMapOperator(project, resultSelector) { this.project = project; this.resultSelector = resultSelector; } SwitchFirstMapOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); }; return SwitchFirstMapOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SwitchFirstMapSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(SwitchFirstMapSubscriber, _super); function SwitchFirstMapSubscriber(destination, project, resultSelector) { var _this = _super.call(this, destination) || this; _this.project = project; _this.resultSelector = resultSelector; _this.hasSubscription = false; _this.hasCompleted = false; _this.index = 0; return _this; } SwitchFirstMapSubscriber.prototype._next = function (value) { if (!this.hasSubscription) { this.tryNext(value); } }; SwitchFirstMapSubscriber.prototype.tryNext = function (value) { var index = this.index++; var destination = this.destination; try { var result = this.project(value, index); this.hasSubscription = true; this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, result, value, index)); } catch (err) { destination.error(err); } }; SwitchFirstMapSubscriber.prototype._complete = function () { this.hasCompleted = true; if (!this.hasSubscription) { this.destination.complete(); } }; SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; if (resultSelector) { this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); } else { destination.next(innerValue); } }; SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; try { var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); destination.next(result); } catch (err) { destination.error(err); } }; SwitchFirstMapSubscriber.prototype.notifyError = function (err) { this.destination.error(err); }; SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { this.remove(innerSub); this.hasSubscription = false; if (this.hasCompleted) { this.destination.complete(); } }; return SwitchFirstMapSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=exhaustMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/expand.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export expand */ /* unused harmony export ExpandOperator */ /* unused harmony export ExpandSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Recursively projects each source value to an Observable which is merged in * the output Observable. * * It's similar to {@link mergeMap}, but applies the * projection function to every source value as well as every output value. * It's recursive. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an Observable, and then merging those resulting Observables and * emitting the results of this merger. *Expand* will re-emit on the output * Observable every source value. Then, each output value is given to the * `project` function which returns an inner Observable to be merged on the * output Observable. Those output values resulting from the projection are also * given to the `project` function to produce new output values. This is how * *expand* behaves recursively. * * @example Start emitting the powers of two on every click, at most 10 of them * var clicks = Rx.Observable.fromEvent(document, 'click'); * var powersOfTwo = clicks * .mapTo(1) * .expand(x => Rx.Observable.of(2 * x).delay(1000)) * .take(10); * powersOfTwo.subscribe(x => console.log(x)); * * @see {@link mergeMap} * @see {@link mergeScan} * * @param {function(value: T, index: number) => Observable} project A function * that, when applied to an item emitted by the source or the output Observable, * returns an Observable. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to * each projected inner Observable. * @return {Observable} An Observable that emits the source values and also * result of applying the projection function to each value emitted on the * output Observable and and merging the results of the Observables obtained * from this transformation. * @method expand * @owner Observable */ 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)); }; } var ExpandOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ExpandSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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); var result = Object(__WEBPACK_IMPORTED_MODULE_0__util_tryCatch__["a" /* tryCatch */])(this.project)(value, index); if (result === __WEBPACK_IMPORTED_MODULE_1__util_errorObject__["a" /* errorObject */]) { destination.error(__WEBPACK_IMPORTED_MODULE_1__util_errorObject__["a" /* errorObject */].e); } else if (!this.scheduler) { this.subscribeToProjection(result, value, index); } else { var state = { subscriber: this, result: result, value: value, index: index }; this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); } } else { this.buffer.push(value); } }; ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { this.active++; this.add(Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* subscribeToResult */])(this, result, value, index)); }; ExpandSubscriber.prototype._complete = function () { this.hasCompleted = true; if (this.hasCompleted && this.active === 0) { this.destination.complete(); } }; ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this._next(innerValue); }; ExpandSubscriber.prototype.notifyComplete = function (innerSub) { var buffer = this.buffer; this.remove(innerSub); this.active--; if (buffer && buffer.length > 0) { this._next(buffer.shift()); } if (this.hasCompleted && this.active === 0) { this.destination.complete(); } }; return ExpandSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=expand.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/filter.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = filter; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Filter items emitted by the source Observable by only emitting those that * satisfy a specified predicate. * * Like * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), * it only emits a value from the source if it passes a criterion function. * * * * Similar to the well-known `Array.prototype.filter` method, this operator * takes values from the source Observable, passes them through a `predicate` * function and only emits those values that yielded `true`. * * @example Emit only click events whose target was a DIV element * var clicks = Rx.Observable.fromEvent(document, 'click'); * var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV'); * clicksOnDivs.subscribe(x => console.log(x)); * * @see {@link distinct} * @see {@link distinctUntilChanged} * @see {@link distinctUntilKeyChanged} * @see {@link ignoreElements} * @see {@link partition} * @see {@link skip} * * @param {function(value: T, index: number): boolean} predicate A function that * evaluates each value emitted by the source Observable. If it returns `true`, * the value is emitted, if `false` the value is not passed to the output * Observable. The `index` parameter is the number `i` for the i-th source * emission that has happened since the subscription, starting from the number * `0`. * @param {any} [thisArg] An optional argument to determine the value of `this` * in the `predicate` function. * @return {Observable} An Observable of values from the source that were * allowed by the `predicate` function. * @method filter * @owner Observable */ function filter(predicate, thisArg) { return function filterOperatorFunction(source) { return source.lift(new FilterOperator(predicate, thisArg)); }; } var FilterOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var FilterSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; } // the try catch block below is left specifically for // optimization and perf reasons. a tryCatcher is not necessary here. 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=filter.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/finalize.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = finalize; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /** PURE_IMPORTS_START .._Subscriber,.._Subscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that mirrors the source Observable, but will call a specified function when * the source terminates on complete or error. * @param {function} callback Function to be called when source terminates. * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. * @method finally * @owner Observable */ function finalize(callback) { return function (source) { return source.lift(new FinallyOperator(callback)); }; } var FinallyOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function FinallyOperator(callback) { this.callback = callback; } FinallyOperator.prototype.call = function (subscriber, source) { return source.subscribe(new FinallySubscriber(subscriber, this.callback)); }; return FinallyOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var FinallySubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(FinallySubscriber, _super); function FinallySubscriber(destination, callback) { var _this = _super.call(this, destination) || this; _this.add(new __WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */](callback)); return _this; } return FinallySubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=finalize.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/find.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export find */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FindValueOperator; }); /* unused harmony export FindValueSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits only the first value emitted by the source Observable that meets some * condition. * * Finds the first value that passes some test and emits * that. * * * * `find` searches for the first item in the source Observable that matches the * specified condition embodied by the `predicate`, and returns the first * occurrence in the source. Unlike {@link first}, the `predicate` is required * in `find`, and does not emit an error if a valid value is not found. * * @example Find and emit the first click that happens on a DIV element * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.find(ev => ev.target.tagName === 'DIV'); * result.subscribe(x => console.log(x)); * * @see {@link filter} * @see {@link first} * @see {@link findIndex} * @see {@link take} * * @param {function(value: T, index: number, source: Observable): boolean} predicate * A function called with each item to test for condition matching. * @param {any} [thisArg] An optional argument to determine the value of `this` * in the `predicate` function. * @return {Observable} An Observable of the first item that matches the * condition. * @method find * @owner Observable */ 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)); }; } var FindValueOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var FindValueSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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(); }; 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=find.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/findIndex.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export findIndex */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_find__ = __webpack_require__("../../../../rxjs/_esm5/operators/find.js"); /** PURE_IMPORTS_START .._operators_find PURE_IMPORTS_END */ /** * Emits only the index of the first value emitted by the source Observable that * meets some condition. * * It's like {@link find}, but emits the index of the * found value, not the value itself. * * * * `findIndex` searches for the first item in the source Observable that matches * the specified condition embodied by the `predicate`, and returns the * (zero-based) index of the first occurrence in the source. Unlike * {@link first}, the `predicate` is required in `findIndex`, and does not emit * an error if a valid value is not found. * * @example Emit the index of first click that happens on a DIV element * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); * result.subscribe(x => console.log(x)); * * @see {@link filter} * @see {@link find} * @see {@link first} * @see {@link take} * * @param {function(value: T, index: number, source: Observable): boolean} predicate * A function called with each item to test for condition matching. * @param {any} [thisArg] An optional argument to determine the value of `this` * in the `predicate` function. * @return {Observable} An Observable of the index of the first item that * matches the condition. * @method find * @owner Observable */ function findIndex(predicate, thisArg) { return function (source) { return source.lift(new __WEBPACK_IMPORTED_MODULE_0__operators_find__["a" /* FindValueOperator */](predicate, source, true, thisArg)); }; } //# sourceMappingURL=findIndex.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/first.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = first; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_EmptyError__ = __webpack_require__("../../../../rxjs/_esm5/util/EmptyError.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_EmptyError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits only the first value (or the first value that meets some condition) * emitted by the source Observable. * * Emits only the first value. Or emits only the first * value that passes some test. * * * * If called with no arguments, `first` emits the first value of the source * Observable, then completes. If called with a `predicate` function, `first` * emits the first value of the source that matches the specified condition. It * may also take a `resultSelector` function to produce the output value from * the input value, and a `defaultValue` to emit in case the source completes * before it is able to emit a valid value. Throws an error if `defaultValue` * was not provided and a matching element is not found. * * @example Emit only the first click that happens on the DOM * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.first(); * result.subscribe(x => console.log(x)); * * @example Emits the first click that happens on a DIV * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.first(ev => ev.target.tagName === 'DIV'); * result.subscribe(x => console.log(x)); * * @see {@link filter} * @see {@link find} * @see {@link take} * * @throws {EmptyError} Delivers an EmptyError to the Observer's `error` * callback if the Observable completes before any `next` notification was sent. * * @param {function(value: T, index: number, source: Observable): boolean} [predicate] * An optional function called with each item to test for condition matching. * @param {function(value: T, index: number): R} [resultSelector] A function to * produce the value on the output Observable based on the values * and the indices of the source Observable. The arguments passed to this * function are: * - `value`: the value that was emitted on the source. * - `index`: the "index" of the value from the source. * @param {R} [defaultValue] The default value emitted in case no valid value * was found on the source. * @return {Observable} An Observable of the first item that matches the * condition. * @method first * @owner Observable */ function first(predicate, resultSelector, defaultValue) { return function (source) { return source.lift(new FirstOperator(predicate, resultSelector, defaultValue, source)); }; } var FirstOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function FirstOperator(predicate, resultSelector, defaultValue, source) { this.predicate = predicate; this.resultSelector = resultSelector; this.defaultValue = defaultValue; this.source = source; } FirstOperator.prototype.call = function (observer, source) { return source.subscribe(new FirstSubscriber(observer, this.predicate, this.resultSelector, this.defaultValue, this.source)); }; return FirstOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var FirstSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(FirstSubscriber, _super); function FirstSubscriber(destination, predicate, resultSelector, defaultValue, source) { var _this = _super.call(this, destination) || this; _this.predicate = predicate; _this.resultSelector = resultSelector; _this.defaultValue = defaultValue; _this.source = source; _this.index = 0; _this.hasCompleted = false; _this._emitted = false; return _this; } FirstSubscriber.prototype._next = function (value) { var index = this.index++; if (this.predicate) { this._tryPredicate(value, index); } else { this._emit(value, index); } }; FirstSubscriber.prototype._tryPredicate = function (value, index) { var result; try { result = this.predicate(value, index, this.source); } catch (err) { this.destination.error(err); return; } if (result) { this._emit(value, index); } }; FirstSubscriber.prototype._emit = function (value, index) { if (this.resultSelector) { this._tryResultSelector(value, index); return; } this._emitFinal(value); }; FirstSubscriber.prototype._tryResultSelector = function (value, index) { var result; try { result = this.resultSelector(value, index); } catch (err) { this.destination.error(err); return; } this._emitFinal(result); }; FirstSubscriber.prototype._emitFinal = function (value) { var destination = this.destination; if (!this._emitted) { this._emitted = true; destination.next(value); destination.complete(); this.hasCompleted = true; } }; FirstSubscriber.prototype._complete = function () { var destination = this.destination; if (!this.hasCompleted && typeof this.defaultValue !== 'undefined') { destination.next(this.defaultValue); destination.complete(); } else if (!this.hasCompleted) { destination.error(new __WEBPACK_IMPORTED_MODULE_1__util_EmptyError__["a" /* EmptyError */]); } }; return FirstSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=first.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/groupBy.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export groupBy */ /* unused harmony export GroupedObservable */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_Map__ = __webpack_require__("../../../../rxjs/_esm5/util/Map.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_FastMap__ = __webpack_require__("../../../../rxjs/_esm5/util/FastMap.js"); /** PURE_IMPORTS_START .._Subscriber,.._Subscription,.._Observable,.._Subject,.._util_Map,.._util_FastMap PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Groups the items emitted by an Observable according to a specified criterion, * and emits these grouped items as `GroupedObservables`, one * {@link GroupedObservable} per group. * * * * @example Group objects by id and return as array * Observable.of({id: 1, name: 'aze1'}, * {id: 2, name: 'sf2'}, * {id: 2, name: 'dg2'}, * {id: 1, name: 'erg1'}, * {id: 1, name: 'df1'}, * {id: 2, name: 'sfqfb2'}, * {id: 3, name: 'qfs3'}, * {id: 2, name: 'qsgqsfg2'} * ) * .groupBy(p => p.id) * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) * .subscribe(p => console.log(p)); * * // displays: * // [ { id: 1, name: 'aze1' }, * // { id: 1, name: 'erg1' }, * // { id: 1, name: 'df1' } ] * // * // [ { id: 2, name: 'sf2' }, * // { id: 2, name: 'dg2' }, * // { id: 2, name: 'sfqfb2' }, * // { id: 2, name: 'qsgqsfg2' } ] * // * // [ { id: 3, name: 'qfs3' } ] * * @example Pivot data on the id field * Observable.of({id: 1, name: 'aze1'}, * {id: 2, name: 'sf2'}, * {id: 2, name: 'dg2'}, * {id: 1, name: 'erg1'}, * {id: 1, name: 'df1'}, * {id: 2, name: 'sfqfb2'}, * {id: 3, name: 'qfs1'}, * {id: 2, name: 'qsgqsfg2'} * ) * .groupBy(p => p.id, p => p.name) * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) * .subscribe(p => console.log(p)); * * // displays: * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } * // { id: 3, values: [ 'qfs1' ] } * * @param {function(value: T): K} keySelector A function that extracts the key * for each item. * @param {function(value: T): R} [elementSelector] A function that extracts the * return element for each item. * @param {function(grouped: GroupedObservable): Observable} [durationSelector] * A function that returns an Observable to determine how long each group should * exist. * @return {Observable>} An Observable that emits * GroupedObservables, each of which corresponds to a unique key value and each * of which emits those items from the source Observable that share that key * value. * @method groupBy * @owner Observable */ function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { return function (source) { return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); }; } var GroupByOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var GroupBySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 = typeof key === 'string' ? new __WEBPACK_IMPORTED_MODULE_5__util_FastMap__["a" /* FastMap */]() : new __WEBPACK_IMPORTED_MODULE_4__util_Map__["a" /* 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 __WEBPACK_IMPORTED_MODULE_3__Subject__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var GroupDurationSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); /** * An Observable representing values belonging to the same group represented by * a common key. The values emitted by a GroupedObservable come from the source * Observable. The common key is available as the field `key` on a * GroupedObservable instance. * * @class GroupedObservable */ var GroupedObservable = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* 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; }(__WEBPACK_IMPORTED_MODULE_2__Observable__["a" /* Observable */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var InnerRefCountSubscription = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */])); //# sourceMappingURL=groupBy.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/ignoreElements.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export ignoreElements */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_noop__ = __webpack_require__("../../../../rxjs/_esm5/util/noop.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_noop PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Ignores all items emitted by the source Observable and only passes calls of `complete` or `error`. * * * * @return {Observable} An empty Observable that only calls `complete` * or `error`, based on which one is called by the source Observable. * @method ignoreElements * @owner Observable */ function ignoreElements() { return function ignoreElementsOperatorFunction(source) { return source.lift(new IgnoreElementsOperator()); }; } var IgnoreElementsOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function IgnoreElementsOperator() { } IgnoreElementsOperator.prototype.call = function (subscriber, source) { return source.subscribe(new IgnoreElementsSubscriber(subscriber)); }; return IgnoreElementsOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var IgnoreElementsSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(IgnoreElementsSubscriber, _super); function IgnoreElementsSubscriber() { return _super !== null && _super.apply(this, arguments) || this; } IgnoreElementsSubscriber.prototype._next = function (unused) { Object(__WEBPACK_IMPORTED_MODULE_1__util_noop__["a" /* noop */])(); }; return IgnoreElementsSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=ignoreElements.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/isEmpty.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export isEmpty */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function isEmpty() { return function (source) { return source.lift(new IsEmptyOperator()); }; } var IsEmptyOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function IsEmptyOperator() { } IsEmptyOperator.prototype.call = function (observer, source) { return source.subscribe(new IsEmptySubscriber(observer)); }; return IsEmptyOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var IsEmptySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=isEmpty.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/last.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = last; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_EmptyError__ = __webpack_require__("../../../../rxjs/_esm5/util/EmptyError.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_EmptyError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Returns an Observable that emits only the last item emitted by the source Observable. * It optionally takes a predicate function as a parameter, in which case, rather than emitting * the last item from the source Observable, the resulting Observable will emit the last item * from the source Observable that satisfies the predicate. * * * * @throws {EmptyError} Delivers an EmptyError to the Observer's `error` * callback if the Observable completes before any `next` notification was sent. * @param {function} predicate - The condition any source emitted item has to satisfy. * @return {Observable} An Observable that emits only the last item satisfying the given condition * from the source, or an NoSuchElementException if no such items are emitted. * @throws - Throws if no items that match the predicate are emitted by the source Observable. * @method last * @owner Observable */ function last(predicate, resultSelector, defaultValue) { return function (source) { return source.lift(new LastOperator(predicate, resultSelector, defaultValue, source)); }; } var LastOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function LastOperator(predicate, resultSelector, defaultValue, source) { this.predicate = predicate; this.resultSelector = resultSelector; this.defaultValue = defaultValue; this.source = source; } LastOperator.prototype.call = function (observer, source) { return source.subscribe(new LastSubscriber(observer, this.predicate, this.resultSelector, this.defaultValue, this.source)); }; return LastOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var LastSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(LastSubscriber, _super); function LastSubscriber(destination, predicate, resultSelector, defaultValue, source) { var _this = _super.call(this, destination) || this; _this.predicate = predicate; _this.resultSelector = resultSelector; _this.defaultValue = defaultValue; _this.source = source; _this.hasValue = false; _this.index = 0; if (typeof defaultValue !== 'undefined') { _this.lastValue = defaultValue; _this.hasValue = true; } return _this; } LastSubscriber.prototype._next = function (value) { var index = this.index++; if (this.predicate) { this._tryPredicate(value, index); } else { if (this.resultSelector) { this._tryResultSelector(value, index); return; } this.lastValue = value; this.hasValue = true; } }; LastSubscriber.prototype._tryPredicate = function (value, index) { var result; try { result = this.predicate(value, index, this.source); } catch (err) { this.destination.error(err); return; } if (result) { if (this.resultSelector) { this._tryResultSelector(value, index); return; } this.lastValue = value; this.hasValue = true; } }; LastSubscriber.prototype._tryResultSelector = function (value, index) { var result; try { result = this.resultSelector(value, index); } catch (err) { this.destination.error(err); return; } this.lastValue = result; this.hasValue = true; }; LastSubscriber.prototype._complete = function () { var destination = this.destination; if (this.hasValue) { destination.next(this.lastValue); destination.complete(); } else { destination.error(new __WEBPACK_IMPORTED_MODULE_1__util_EmptyError__["a" /* EmptyError */]); } }; return LastSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=last.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/map.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = map; /* unused harmony export MapOperator */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Applies a given `project` function to each value emitted by the source * Observable, and emits the resulting values as an Observable. * * Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), * it passes each source value through a transformation function to get * corresponding output values. * * * * Similar to the well known `Array.prototype.map` function, this operator * applies a projection to each value and emits that projection in the output * Observable. * * @example Map every click to the clientX position of that click * var clicks = Rx.Observable.fromEvent(document, 'click'); * var positions = clicks.map(ev => ev.clientX); * positions.subscribe(x => console.log(x)); * * @see {@link mapTo} * @see {@link pluck} * * @param {function(value: T, index: number): R} project The function to apply * to each `value` emitted by the source Observable. The `index` parameter is * the number `i` for the i-th emission that has happened since the * subscription, starting from the number `0`. * @param {any} [thisArg] An optional argument to define what `this` is in the * `project` function. * @return {Observable} An Observable that emits the values from the source * Observable transformed by the given `project` function. * @method map * @owner Observable */ 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)); }; } var MapOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MapSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; } // NOTE: This looks unoptimized, but it's actually purposefully NOT // using try/catch optimizations. 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=map.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/mapTo.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export mapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits the given constant value on the output Observable every time the source * Observable emits a value. * * Like {@link map}, but it maps every source value to * the same output value every time. * * * * Takes a constant `value` as argument, and emits that whenever the source * Observable emits a value. In other words, ignores the actual source value, * and simply uses the emission moment to know when to emit the given `value`. * * @example Map every click to the string 'Hi' * var clicks = Rx.Observable.fromEvent(document, 'click'); * var greetings = clicks.mapTo('Hi'); * greetings.subscribe(x => console.log(x)); * * @see {@link map} * * @param {any} value The value to map each source value to. * @return {Observable} An Observable that emits the given `value` every time * the source Observable emits something. * @method mapTo * @owner Observable */ function mapTo(value) { return function (source) { return source.lift(new MapToOperator(value)); }; } var MapToOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function MapToOperator(value) { this.value = value; } MapToOperator.prototype.call = function (subscriber, source) { return source.subscribe(new MapToSubscriber(subscriber, this.value)); }; return MapToOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MapToSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=mapTo.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/materialize.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export materialize */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Notification__ = __webpack_require__("../../../../rxjs/_esm5/Notification.js"); /** PURE_IMPORTS_START .._Subscriber,.._Notification PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Represents all of the notifications from the source Observable as `next` * emissions marked with their original types within {@link Notification} * objects. * * Wraps `next`, `error` and `complete` emissions in * {@link Notification} objects, emitted as `next` on the output Observable. * * * * * `materialize` returns an Observable that emits a `next` notification for each * `next`, `error`, or `complete` emission of the source Observable. When the * source Observable emits `complete`, the output Observable will emit `next` as * a Notification of type "complete", and then it will emit `complete` as well. * When the source Observable emits `error`, the output will emit `next` as a * Notification of type "error", and then `complete`. * * This operator is useful for producing metadata of the source Observable, to * be consumed as `next` emissions. Use it in conjunction with * {@link dematerialize}. * * @example Convert a faulty Observable to an Observable of Notifications * var letters = Rx.Observable.of('a', 'b', 13, 'd'); * var upperCase = letters.map(x => x.toUpperCase()); * var materialized = upperCase.materialize(); * materialized.subscribe(x => console.log(x)); * * // Results in the following: * // - Notification {kind: "N", value: "A", error: undefined, hasValue: true} * // - Notification {kind: "N", value: "B", error: undefined, hasValue: true} * // - Notification {kind: "E", value: undefined, error: TypeError: * // x.toUpperCase is not a function at MapSubscriber.letters.map.x * // [as project] (http://1…, hasValue: false} * * @see {@link Notification} * @see {@link dematerialize} * * @return {Observable>} An Observable that emits * {@link Notification} objects that wrap the original emissions from the source * Observable with metadata. * @method materialize * @owner Observable */ function materialize() { return function materializeOperatorFunction(source) { return source.lift(new MaterializeOperator()); }; } var MaterializeOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function MaterializeOperator() { } MaterializeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new MaterializeSubscriber(subscriber)); }; return MaterializeOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MaterializeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(MaterializeSubscriber, _super); function MaterializeSubscriber(destination) { return _super.call(this, destination) || this; } MaterializeSubscriber.prototype._next = function (value) { this.destination.next(__WEBPACK_IMPORTED_MODULE_1__Notification__["a" /* Notification */].createNext(value)); }; MaterializeSubscriber.prototype._error = function (err) { var destination = this.destination; destination.next(__WEBPACK_IMPORTED_MODULE_1__Notification__["a" /* Notification */].createError(err)); destination.complete(); }; MaterializeSubscriber.prototype._complete = function () { var destination = this.destination; destination.next(__WEBPACK_IMPORTED_MODULE_1__Notification__["a" /* Notification */].createComplete()); destination.complete(); }; return MaterializeSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=materialize.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/max.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export max */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__reduce__ = __webpack_require__("../../../../rxjs/_esm5/operators/reduce.js"); /** PURE_IMPORTS_START ._reduce PURE_IMPORTS_END */ /** * The Max operator operates on an Observable that emits numbers (or items that can be compared with a provided function), * and when source Observable completes it emits a single item: the item with the largest value. * * * * @example Get the maximal value of a series of numbers * Rx.Observable.of(5, 4, 7, 2, 8) * .max() * .subscribe(x => console.log(x)); // -> 8 * * @example Use a comparer function to get the maximal item * interface Person { * age: number, * name: string * } * Observable.of({age: 7, name: 'Foo'}, * {age: 5, name: 'Bar'}, * {age: 9, name: 'Beer'}) * .max((a: Person, b: Person) => a.age < b.age ? -1 : 1) * .subscribe((x: Person) => console.log(x.name)); // -> 'Beer' * } * * @see {@link min} * * @param {Function} [comparer] - Optional comparer function that it will use instead of its default to compare the * value of two items. * @return {Observable} An Observable that emits item with the largest value. * @method max * @owner Observable */ 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 Object(__WEBPACK_IMPORTED_MODULE_0__reduce__["a" /* reduce */])(max); } //# sourceMappingURL=max.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/merge.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export merge */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_merge__ = __webpack_require__("../../../../rxjs/_esm5/observable/merge.js"); /* unused harmony reexport mergeStatic */ /** PURE_IMPORTS_START .._observable_merge PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Creates an output Observable which concurrently emits all values from every * given input Observable. * * Flattens multiple Observables together by blending * their values into one Observable. * * * * `merge` subscribes to each given input Observable (either the source or an * Observable given as argument), and simply forwards (without doing any * transformation) all the values from all the input Observables to the output * Observable. The output Observable only completes once all input Observables * have completed. Any error delivered by an input Observable will be immediately * emitted on the output Observable. * * @example Merge together two Observables: 1s interval and clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var timer = Rx.Observable.interval(1000); * var clicksOrTimer = clicks.merge(timer); * clicksOrTimer.subscribe(x => console.log(x)); * * @example Merge together 3 Observables, but only 2 run concurrently * var timer1 = Rx.Observable.interval(1000).take(10); * var timer2 = Rx.Observable.interval(2000).take(6); * var timer3 = Rx.Observable.interval(500).take(10); * var concurrent = 2; // the argument * var merged = timer1.merge(timer2, timer3, concurrent); * merged.subscribe(x => console.log(x)); * * @see {@link mergeAll} * @see {@link mergeMap} * @see {@link mergeMapTo} * @see {@link mergeScan} * * @param {ObservableInput} other An input Observable to merge with the source * Observable. More than one input Observables may be given as argument. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @param {Scheduler} [scheduler=null] The IScheduler to use for managing * concurrency of input Observables. * @return {Observable} An Observable that emits items that are the result of * every input Observable. * @method merge * @owner Observable */ function merge() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } return function (source) { return source.lift.call(__WEBPACK_IMPORTED_MODULE_0__observable_merge__["a" /* merge */].apply(void 0, [source].concat(observables))); }; } //# sourceMappingURL=merge.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/mergeAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = mergeAll; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mergeMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/mergeMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_identity__ = __webpack_require__("../../../../rxjs/_esm5/util/identity.js"); /** PURE_IMPORTS_START ._mergeMap,.._util_identity PURE_IMPORTS_END */ /** * Converts a higher-order Observable into a first-order Observable which * concurrently delivers all values that are emitted on the inner Observables. * * Flattens an Observable-of-Observables. * * * * `mergeAll` subscribes to an Observable that emits Observables, also known as * a higher-order Observable. Each time it observes one of these emitted inner * Observables, it subscribes to that and delivers all the values from the * inner Observable on the output Observable. The output Observable only * completes once all inner Observables have completed. Any error delivered by * a inner Observable will be immediately emitted on the output Observable. * * @example Spawn a new interval Observable for each click event, and blend their outputs as one Observable * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000)); * var firstOrder = higherOrder.mergeAll(); * firstOrder.subscribe(x => console.log(x)); * * @example Count from 0 to 9 every second for each click, but only allow 2 concurrent timers * var clicks = Rx.Observable.fromEvent(document, 'click'); * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10)); * var firstOrder = higherOrder.mergeAll(2); * firstOrder.subscribe(x => console.log(x)); * * @see {@link combineAll} * @see {@link concatAll} * @see {@link exhaust} * @see {@link merge} * @see {@link mergeMap} * @see {@link mergeMapTo} * @see {@link mergeScan} * @see {@link switch} * @see {@link zipAll} * * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner * Observables being subscribed to concurrently. * @return {Observable} An Observable that emits values coming from all the * inner Observables emitted by the source Observable. * @method mergeAll * @owner Observable */ function mergeAll(concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } return Object(__WEBPACK_IMPORTED_MODULE_0__mergeMap__["a" /* mergeMap */])(__WEBPACK_IMPORTED_MODULE_1__util_identity__["a" /* identity */], null, concurrent); } //# sourceMappingURL=mergeAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/mergeMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = mergeMap; /* unused harmony export MergeMapOperator */ /* unused harmony export MergeMapSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /** PURE_IMPORTS_START .._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Projects each source value to an Observable which is merged in the output * Observable. * * Maps each value to an Observable, then flattens all of * these inner Observables using {@link mergeAll}. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an Observable, and then merging those resulting Observables and * emitting the results of this merger. * * @example Map and flatten each letter to an Observable ticking every 1 second * var letters = Rx.Observable.of('a', 'b', 'c'); * var result = letters.mergeMap(x => * Rx.Observable.interval(1000).map(i => x+i) * ); * result.subscribe(x => console.log(x)); * * // Results in the following: * // a0 * // b0 * // c0 * // a1 * // b1 * // c1 * // continues to list a,b,c with respective ascending integers * * @see {@link concatMap} * @see {@link exhaustMap} * @see {@link merge} * @see {@link mergeAll} * @see {@link mergeMapTo} * @see {@link mergeScan} * @see {@link switchMap} * * @param {function(value: T, ?index: number): ObservableInput} project A function * that, when applied to an item emitted by the source Observable, returns an * Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @return {Observable} An Observable that emits the result of applying the * projection function (and the optional `resultSelector`) to each item emitted * by the source Observable and merging the results of the Observables obtained * from this transformation. * @method mergeMap * @owner Observable */ function mergeMap(project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } return function mergeMapOperatorFunction(source) { if (typeof resultSelector === 'number') { concurrent = resultSelector; resultSelector = null; } return source.lift(new MergeMapOperator(project, resultSelector, concurrent)); }; } var MergeMapOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function MergeMapOperator(project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } this.project = project; this.resultSelector = resultSelector; this.concurrent = concurrent; } MergeMapOperator.prototype.call = function (observer, source) { return source.subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent)); }; return MergeMapOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MergeMapSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(MergeMapSubscriber, _super); function MergeMapSubscriber(destination, project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } var _this = _super.call(this, destination) || this; _this.project = project; _this.resultSelector = resultSelector; _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) { this.add(Object(__WEBPACK_IMPORTED_MODULE_0__util_subscribeToResult__["a" /* subscribeToResult */])(this, ish, value, index)); }; MergeMapSubscriber.prototype._complete = function () { this.hasCompleted = true; if (this.active === 0 && this.buffer.length === 0) { this.destination.complete(); } }; MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { if (this.resultSelector) { this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex); } else { this.destination.next(innerValue); } }; MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) { var result; try { result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex); } catch (err) { this.destination.error(err); return; } this.destination.next(result); }; 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; }(__WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=mergeMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/mergeMapTo.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export mergeMapTo */ /* unused harmony export MergeMapToOperator */ /* unused harmony export MergeMapToSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Projects each source value to the same Observable which is merged multiple * times in the output Observable. * * It's like {@link mergeMap}, but maps each value always * to the same inner Observable. * * * * Maps each source value to the given Observable `innerObservable` regardless * of the source value, and then merges those resulting Observables into one * single Observable, which is the output Observable. * * @example For each click event, start an interval Observable ticking every 1 second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.mergeMapTo(Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link concatMapTo} * @see {@link merge} * @see {@link mergeAll} * @see {@link mergeMap} * @see {@link mergeScan} * @see {@link switchMapTo} * * @param {ObservableInput} innerObservable An Observable to replace each value from * the source Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input * Observables being subscribed to concurrently. * @return {Observable} An Observable that emits items from the given * `innerObservable` (and optionally transformed through `resultSelector`) every * time a value is emitted on the source Observable. * @method mergeMapTo * @owner Observable */ function mergeMapTo(innerObservable, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } if (typeof resultSelector === 'number') { concurrent = resultSelector; resultSelector = null; } return function (source) { return source.lift(new MergeMapToOperator(innerObservable, resultSelector, concurrent)); }; } // TODO: Figure out correct signature here: an Operator, R> // needs to implement call(observer: Subscriber): Subscriber> var MergeMapToOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function MergeMapToOperator(ish, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } this.ish = ish; this.resultSelector = resultSelector; this.concurrent = concurrent; } MergeMapToOperator.prototype.call = function (observer, source) { return source.subscribe(new MergeMapToSubscriber(observer, this.ish, this.resultSelector, this.concurrent)); }; return MergeMapToOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MergeMapToSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(MergeMapToSubscriber, _super); function MergeMapToSubscriber(destination, ish, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } var _this = _super.call(this, destination) || this; _this.ish = ish; _this.resultSelector = resultSelector; _this.concurrent = concurrent; _this.hasCompleted = false; _this.buffer = []; _this.active = 0; _this.index = 0; return _this; } MergeMapToSubscriber.prototype._next = function (value) { if (this.active < this.concurrent) { var resultSelector = this.resultSelector; var index = this.index++; var ish = this.ish; var destination = this.destination; this.active++; this._innerSub(ish, destination, resultSelector, value, index); } else { this.buffer.push(value); } }; MergeMapToSubscriber.prototype._innerSub = function (ish, destination, resultSelector, value, index) { this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, ish, value, index)); }; MergeMapToSubscriber.prototype._complete = function () { this.hasCompleted = true; if (this.active === 0 && this.buffer.length === 0) { this.destination.complete(); } }; MergeMapToSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; if (resultSelector) { this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); } else { destination.next(innerValue); } }; MergeMapToSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; var result; try { result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); } catch (err) { destination.error(err); return; } destination.next(result); }; MergeMapToSubscriber.prototype.notifyError = function (err) { this.destination.error(err); }; MergeMapToSubscriber.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 MergeMapToSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=mergeMapTo.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/mergeScan.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export mergeScan */ /* unused harmony export MergeScanOperator */ /* unused harmony export MergeScanSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /** PURE_IMPORTS_START .._util_tryCatch,.._util_errorObject,.._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Applies an accumulator function over the source Observable where the * accumulator function itself returns an Observable, then each intermediate * Observable returned is merged into the output Observable. * * It's like {@link scan}, but the Observables returned * by the accumulator are merged into the outer Observable. * * @example Count the number of click events * const click$ = Rx.Observable.fromEvent(document, 'click'); * const one$ = click$.mapTo(1); * const seed = 0; * const count$ = one$.mergeScan((acc, one) => Rx.Observable.of(acc + one), seed); * count$.subscribe(x => console.log(x)); * * // Results: * 1 * 2 * 3 * 4 * // ...and so on for each click * * @param {function(acc: R, value: T): Observable} accumulator * The accumulator function called on each source value. * @param seed The initial accumulation value. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of * input Observables being subscribed to concurrently. * @return {Observable} An observable of the accumulated values. * @method mergeScan * @owner Observable */ function mergeScan(accumulator, seed, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } return function (source) { return source.lift(new MergeScanOperator(accumulator, seed, concurrent)); }; } var MergeScanOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MergeScanSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 ish = Object(__WEBPACK_IMPORTED_MODULE_0__util_tryCatch__["a" /* tryCatch */])(this.accumulator)(this.acc, value); var destination = this.destination; if (ish === __WEBPACK_IMPORTED_MODULE_1__util_errorObject__["a" /* errorObject */]) { destination.error(__WEBPACK_IMPORTED_MODULE_1__util_errorObject__["a" /* errorObject */].e); } else { this.active++; this._innerSub(ish, value, index); } } else { this.buffer.push(value); } }; MergeScanSubscriber.prototype._innerSub = function (ish, value, index) { this.add(Object(__WEBPACK_IMPORTED_MODULE_2__util_subscribeToResult__["a" /* subscribeToResult */])(this, ish, value, index)); }; 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(); } }; 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; this.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; }(__WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=mergeScan.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/min.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export min */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__reduce__ = __webpack_require__("../../../../rxjs/_esm5/operators/reduce.js"); /** PURE_IMPORTS_START ._reduce PURE_IMPORTS_END */ /** * The Min operator operates on an Observable that emits numbers (or items that can be compared with a provided function), * and when source Observable completes it emits a single item: the item with the smallest value. * * * * @example Get the minimal value of a series of numbers * Rx.Observable.of(5, 4, 7, 2, 8) * .min() * .subscribe(x => console.log(x)); // -> 2 * * @example Use a comparer function to get the minimal item * interface Person { * age: number, * name: string * } * Observable.of({age: 7, name: 'Foo'}, * {age: 5, name: 'Bar'}, * {age: 9, name: 'Beer'}) * .min( (a: Person, b: Person) => a.age < b.age ? -1 : 1) * .subscribe((x: Person) => console.log(x.name)); // -> 'Bar' * } * * @see {@link max} * * @param {Function} [comparer] - Optional comparer function that it will use instead of its default to compare the * value of two items. * @return {Observable} An Observable that emits item with the smallest value. * @method min * @owner Observable */ 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 Object(__WEBPACK_IMPORTED_MODULE_0__reduce__["a" /* reduce */])(min); } //# sourceMappingURL=min.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/multicast.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = multicast; /* unused harmony export MulticastOperator */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_ConnectableObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ConnectableObservable.js"); /** PURE_IMPORTS_START .._observable_ConnectableObservable PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Returns an Observable that emits the results of invoking a specified selector on items * emitted by a ConnectableObservable that shares a single subscription to the underlying stream. * * * * @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through * which the source sequence's elements will be multicast to the selector function * or Subject to push source elements into. * @param {Function} [selector] - Optional selector function that can use the multicasted source stream * as many times as needed, without causing multiple subscriptions to the source stream. * Subscribers to the given source will receive all notifications of the source from the * time of the subscription forward. * @return {Observable} An Observable that emits the results of invoking the selector * on the items emitted by a `ConnectableObservable` that shares a single subscription to * the underlying stream. * @method multicast * @owner Observable */ 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, __WEBPACK_IMPORTED_MODULE_0__observable_ConnectableObservable__["a" /* connectableObservableDescriptor */]); connectable.source = source; connectable.subjectFactory = subjectFactory; return connectable; }; } var MulticastOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); //# sourceMappingURL=multicast.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/observeOn.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export observeOn */ /* unused harmony export ObserveOnOperator */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ObserveOnSubscriber; }); /* unused harmony export ObserveOnMessage */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Notification__ = __webpack_require__("../../../../rxjs/_esm5/Notification.js"); /** PURE_IMPORTS_START .._Subscriber,.._Notification PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * * Re-emits all notifications from source Observable with specified scheduler. * * Ensure a specific scheduler is used, from outside of an Observable. * * `observeOn` is an operator that accepts a scheduler as a first parameter, which will be used to reschedule * notifications emitted by the source Observable. It might be useful, if you do not have control over * internal scheduler of a given Observable, but want to control when its values are emitted nevertheless. * * Returned Observable emits the same notifications (nexted values, complete and error events) as the source Observable, * but rescheduled with provided scheduler. Note that this doesn't mean that source Observables internal * scheduler will be replaced in any way. Original scheduler still will be used, but when the source Observable emits * notification, it will be immediately scheduled again - this time with scheduler passed to `observeOn`. * An anti-pattern would be calling `observeOn` on Observable that emits lots of values synchronously, to split * that emissions into asynchronous chunks. For this to happen, scheduler would have to be passed into the source * Observable directly (usually into the operator that creates it). `observeOn` simply delays notifications a * little bit more, to ensure that they are emitted at expected moments. * * As a matter of fact, `observeOn` accepts second parameter, which specifies in milliseconds with what delay notifications * will be emitted. The main difference between {@link delay} operator and `observeOn` is that `observeOn` * will delay all notifications - including error notifications - while `delay` will pass through error * from source Observable immediately when it is emitted. In general it is highly recommended to use `delay` operator * for any kind of delaying of values in the stream, while using `observeOn` to specify which scheduler should be used * for notification emissions in general. * * @example Ensure values in subscribe are called just before browser repaint. * const intervals = Rx.Observable.interval(10); // Intervals are scheduled * // with async scheduler by default... * * intervals * .observeOn(Rx.Scheduler.animationFrame) // ...but we will observe on animationFrame * .subscribe(val => { // scheduler to ensure smooth animation. * someDiv.style.height = val + 'px'; * }); * * @see {@link delay} * * @param {IScheduler} scheduler Scheduler that will be used to reschedule notifications from source Observable. * @param {number} [delay] Number of milliseconds that states with what delay every notification should be rescheduled. * @return {Observable} Observable that emits the same notifications as the source Observable, * but with provided scheduler. * * @method observeOn * @owner Observable */ function observeOn(scheduler, delay) { if (delay === void 0) { delay = 0; } return function observeOnOperatorFunction(source) { return source.lift(new ObserveOnOperator(scheduler, delay)); }; } var ObserveOnOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ObserveOnSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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) { this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination))); }; ObserveOnSubscriber.prototype._next = function (value) { this.scheduleMessage(__WEBPACK_IMPORTED_MODULE_1__Notification__["a" /* Notification */].createNext(value)); }; ObserveOnSubscriber.prototype._error = function (err) { this.scheduleMessage(__WEBPACK_IMPORTED_MODULE_1__Notification__["a" /* Notification */].createError(err)); }; ObserveOnSubscriber.prototype._complete = function () { this.scheduleMessage(__WEBPACK_IMPORTED_MODULE_1__Notification__["a" /* Notification */].createComplete()); }; return ObserveOnSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); var ObserveOnMessage = /*@__PURE__*/ (/*@__PURE__*/ function () { function ObserveOnMessage(notification, destination) { this.notification = notification; this.destination = destination; } return ObserveOnMessage; }()); //# sourceMappingURL=observeOn.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/onErrorResumeNext.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export onErrorResumeNext */ /* unused harmony export onErrorResumeNextStatic */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_FromObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/FromObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._observable_FromObservable,.._util_isArray,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * When any of the provided Observable emits an complete or error notification, it immediately subscribes to the next one * that was passed. * * Execute series of Observables no matter what, even if it means swallowing errors. * * * * `onErrorResumeNext` is an operator that accepts a series of Observables, provided either directly as * arguments or as an array. If no single Observable is provided, returned Observable will simply behave the same * as the source. * * `onErrorResumeNext` returns an Observable that starts by subscribing and re-emitting values from the source Observable. * When its stream of values ends - no matter if Observable completed or emitted an error - `onErrorResumeNext` * will subscribe to the first Observable that was passed as an argument to the method. It will start re-emitting * its values as well and - again - when that stream ends, `onErrorResumeNext` will proceed to subscribing yet another * Observable in provided series, no matter if previous Observable completed or ended with an error. This will * be happening until there is no more Observables left in the series, at which point returned Observable will * complete - even if the last subscribed stream ended with an error. * * `onErrorResumeNext` can be therefore thought of as version of {@link concat} operator, which is more permissive * when it comes to the errors emitted by its input Observables. While `concat` subscribes to the next Observable * in series only if previous one successfully completed, `onErrorResumeNext` subscribes even if it ended with * an error. * * Note that you do not get any access to errors emitted by the Observables. In particular do not * expect these errors to appear in error callback passed to {@link subscribe}. If you want to take * specific actions based on what error was emitted by an Observable, you should try out {@link catch} instead. * * * @example Subscribe to the next Observable after map fails * Rx.Observable.of(1, 2, 3, 0) * .map(x => { * if (x === 0) { throw Error(); } return 10 / x; * }) * .onErrorResumeNext(Rx.Observable.of(1, 2, 3)) * .subscribe( * val => console.log(val), * err => console.log(err), // Will never be called. * () => console.log('that\'s it!') * ); * * // Logs: * // 10 * // 5 * // 3.3333333333333335 * // 1 * // 2 * // 3 * // "that's it!" * * @see {@link concat} * @see {@link catch} * * @param {...ObservableInput} observables Observables passed either directly or as an array. * @return {Observable} An Observable that emits values from source Observable, but - if it errors - subscribes * to the next passed Observable and so on, until it completes or runs out of Observables. * @method onErrorResumeNext * @owner Observable */ function onErrorResumeNext() { var nextSources = []; for (var _i = 0; _i < arguments.length; _i++) { nextSources[_i] = arguments[_i]; } if (nextSources.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_1__util_isArray__["a" /* isArray */])(nextSources[0])) { nextSources = nextSources[0]; } return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); }; } /* tslint:enable:max-line-length */ function onErrorResumeNextStatic() { var nextSources = []; for (var _i = 0; _i < arguments.length; _i++) { nextSources[_i] = arguments[_i]; } var source = null; if (nextSources.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_1__util_isArray__["a" /* isArray */])(nextSources[0])) { nextSources = nextSources[0]; } source = nextSources.shift(); return new __WEBPACK_IMPORTED_MODULE_0__observable_FromObservable__["a" /* FromObservable */](source, null).lift(new OnErrorResumeNextOperator(nextSources)); } var OnErrorResumeNextOperator = /*@__PURE__*/ (/*@__PURE__*/ 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 = /*@__PURE__*/ (/*@__PURE__*/ 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(); }; OnErrorResumeNextSubscriber.prototype._complete = function () { this.subscribeToNextSource(); }; OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () { var next = this.nextSources.shift(); if (next) { this.add(Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* subscribeToResult */])(this, next)); } else { this.destination.complete(); } }; return OnErrorResumeNextSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=onErrorResumeNext.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/pairwise.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export pairwise */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Groups pairs of consecutive emissions together and emits them as an array of * two values. * * Puts the current value and previous value together as * an array, and emits that. * * * * The Nth emission from the source Observable will cause the output Observable * to emit an array [(N-1)th, Nth] of the previous and the current value, as a * pair. For this reason, `pairwise` emits on the second and subsequent * emissions from the source Observable, but not on the first emission, because * there is no previous value in that case. * * @example On every click (starting from the second), emit the relative distance to the previous click * var clicks = Rx.Observable.fromEvent(document, 'click'); * var pairs = clicks.pairwise(); * var distance = pairs.map(pair => { * var x0 = pair[0].clientX; * var y0 = pair[0].clientY; * var x1 = pair[1].clientX; * var y1 = pair[1].clientY; * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2)); * }); * distance.subscribe(x => console.log(x)); * * @see {@link buffer} * @see {@link bufferCount} * * @return {Observable>} An Observable of pairs (as arrays) of * consecutive values from the source Observable. * @method pairwise * @owner Observable */ function pairwise() { return function (source) { return source.lift(new PairwiseOperator()); }; } var PairwiseOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function PairwiseOperator() { } PairwiseOperator.prototype.call = function (subscriber, source) { return source.subscribe(new PairwiseSubscriber(subscriber)); }; return PairwiseOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var PairwiseSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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) { if (this.hasPrev) { this.destination.next([this.prev, value]); } else { this.hasPrev = true; } this.prev = value; }; return PairwiseSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=pairwise.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/partition.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export partition */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_not__ = __webpack_require__("../../../../rxjs/_esm5/util/not.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__filter__ = __webpack_require__("../../../../rxjs/_esm5/operators/filter.js"); /** PURE_IMPORTS_START .._util_not,._filter PURE_IMPORTS_END */ /** * Splits the source Observable into two, one with values that satisfy a * predicate, and another with values that don't satisfy the predicate. * * It's like {@link filter}, but returns two Observables: * one like the output of {@link filter}, and the other with values that did not * pass the condition. * * * * `partition` outputs an array with two Observables that partition the values * from the source Observable through the given `predicate` function. The first * Observable in that array emits source values for which the predicate argument * returns true. The second Observable emits source values for which the * predicate returns false. The first behaves like {@link filter} and the second * behaves like {@link filter} with the predicate negated. * * @example Partition click events into those on DIV elements and those elsewhere * var clicks = Rx.Observable.fromEvent(document, 'click'); * var parts = clicks.partition(ev => ev.target.tagName === 'DIV'); * var clicksOnDivs = parts[0]; * var clicksElsewhere = parts[1]; * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x)); * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x)); * * @see {@link filter} * * @param {function(value: T, index: number): boolean} predicate A function that * evaluates each value emitted by the source Observable. If it returns `true`, * the value is emitted on the first Observable in the returned array, if * `false` the value is emitted on the second Observable in the array. The * `index` parameter is the number `i` for the i-th source emission that has * happened since the subscription, starting from the number `0`. * @param {any} [thisArg] An optional argument to determine the value of `this` * in the `predicate` function. * @return {[Observable, Observable]} An array with two Observables: one * with values that passed the predicate, and another with values that did not * pass the predicate. * @method partition * @owner Observable */ function partition(predicate, thisArg) { return function (source) { return [ Object(__WEBPACK_IMPORTED_MODULE_1__filter__["a" /* filter */])(predicate, thisArg)(source), Object(__WEBPACK_IMPORTED_MODULE_1__filter__["a" /* filter */])(Object(__WEBPACK_IMPORTED_MODULE_0__util_not__["a" /* not */])(predicate, thisArg))(source) ]; }; } //# sourceMappingURL=partition.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/pluck.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export pluck */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map__ = __webpack_require__("../../../../rxjs/_esm5/operators/map.js"); /** PURE_IMPORTS_START ._map PURE_IMPORTS_END */ /** * Maps each source value (an object) to its specified nested property. * * Like {@link map}, but meant only for picking one of * the nested properties of every emitted object. * * * * Given a list of strings describing a path to an object property, retrieves * the value of a specified nested property from all values in the source * Observable. If a property can't be resolved, it will return `undefined` for * that value. * * @example Map every click to the tagName of the clicked target element * var clicks = Rx.Observable.fromEvent(document, 'click'); * var tagNames = clicks.pluck('target', 'tagName'); * tagNames.subscribe(x => console.log(x)); * * @see {@link map} * * @param {...string} properties The nested properties to pluck from each source * value (an object). * @return {Observable} A new Observable of property values from the source values. * @method pluck * @owner Observable */ 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 Object(__WEBPACK_IMPORTED_MODULE_0__map__["a" /* map */])(plucker(properties, length))(source); }; } 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; } //# sourceMappingURL=pluck.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/publish.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export publish */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__multicast__ = __webpack_require__("../../../../rxjs/_esm5/operators/multicast.js"); /** PURE_IMPORTS_START .._Subject,._multicast PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Returns a ConnectableObservable, which is a variety of Observable that waits until its connect method is called * before it begins emitting items to those Observers that have subscribed to it. * * * * @param {Function} [selector] - Optional selector function which can use the multicasted source sequence as many times * as needed, without causing multiple subscriptions to the source sequence. * Subscribers to the given source will receive all notifications of the source from the time of the subscription on. * @return A ConnectableObservable that upon connection causes the source Observable to emit items to its Observers. * @method publish * @owner Observable */ function publish(selector) { return selector ? Object(__WEBPACK_IMPORTED_MODULE_1__multicast__["a" /* multicast */])(function () { return new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); }, selector) : Object(__WEBPACK_IMPORTED_MODULE_1__multicast__["a" /* multicast */])(new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */]()); } //# sourceMappingURL=publish.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/publishBehavior.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export publishBehavior */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BehaviorSubject__ = __webpack_require__("../../../../rxjs/_esm5/BehaviorSubject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__multicast__ = __webpack_require__("../../../../rxjs/_esm5/operators/multicast.js"); /** PURE_IMPORTS_START .._BehaviorSubject,._multicast PURE_IMPORTS_END */ /** * @param value * @return {ConnectableObservable} * @method publishBehavior * @owner Observable */ function publishBehavior(value) { return function (source) { return Object(__WEBPACK_IMPORTED_MODULE_1__multicast__["a" /* multicast */])(new __WEBPACK_IMPORTED_MODULE_0__BehaviorSubject__["a" /* BehaviorSubject */](value))(source); }; } //# sourceMappingURL=publishBehavior.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/publishLast.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export publishLast */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__AsyncSubject__ = __webpack_require__("../../../../rxjs/_esm5/AsyncSubject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__multicast__ = __webpack_require__("../../../../rxjs/_esm5/operators/multicast.js"); /** PURE_IMPORTS_START .._AsyncSubject,._multicast PURE_IMPORTS_END */ function publishLast() { return function (source) { return Object(__WEBPACK_IMPORTED_MODULE_1__multicast__["a" /* multicast */])(new __WEBPACK_IMPORTED_MODULE_0__AsyncSubject__["a" /* AsyncSubject */]())(source); }; } //# sourceMappingURL=publishLast.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/publishReplay.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export publishReplay */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ReplaySubject__ = __webpack_require__("../../../../rxjs/_esm5/ReplaySubject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__multicast__ = __webpack_require__("../../../../rxjs/_esm5/operators/multicast.js"); /** PURE_IMPORTS_START .._ReplaySubject,._multicast PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) { if (selectorOrScheduler && typeof selectorOrScheduler !== 'function') { scheduler = selectorOrScheduler; } var selector = typeof selectorOrScheduler === 'function' ? selectorOrScheduler : undefined; var subject = new __WEBPACK_IMPORTED_MODULE_0__ReplaySubject__["a" /* ReplaySubject */](bufferSize, windowTime, scheduler); return function (source) { return Object(__WEBPACK_IMPORTED_MODULE_1__multicast__["a" /* multicast */])(function () { return subject; }, selector)(source); }; } //# sourceMappingURL=publishReplay.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/race.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export race */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__observable_race__ = __webpack_require__("../../../../rxjs/_esm5/observable/race.js"); /** PURE_IMPORTS_START .._util_isArray,.._observable_race PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Returns an Observable that mirrors the first source Observable to emit an item * from the combination of this Observable and supplied Observables. * @param {...Observables} ...observables Sources used to race for which Observable emits first. * @return {Observable} An Observable that mirrors the output of the first Observable to emit an item. * @method race * @owner Observable */ function race() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } return function raceOperatorFunction(source) { // if the only argument is an array, it was most likely called with // `pair([obs1, obs2, ...])` if (observables.length === 1 && Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(observables[0])) { observables = observables[0]; } return source.lift.call(__WEBPACK_IMPORTED_MODULE_1__observable_race__["a" /* race */].apply(void 0, [source].concat(observables))); }; } //# sourceMappingURL=race.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/reduce.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = reduce; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scan__ = __webpack_require__("../../../../rxjs/_esm5/operators/scan.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__takeLast__ = __webpack_require__("../../../../rxjs/_esm5/operators/takeLast.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__defaultIfEmpty__ = __webpack_require__("../../../../rxjs/_esm5/operators/defaultIfEmpty.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__("../../../../rxjs/_esm5/util/pipe.js"); /** PURE_IMPORTS_START ._scan,._takeLast,._defaultIfEmpty,.._util_pipe PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Applies an accumulator function over the source Observable, and returns the * accumulated result when the source completes, given an optional seed value. * * Combines together all values emitted on the source, * using an accumulator function that knows how to join a new source value into * the accumulation from the past. * * * * Like * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce), * `reduce` applies an `accumulator` function against an accumulation and each * value of the source Observable (from the past) to reduce it to a single * value, emitted on the output Observable. Note that `reduce` will only emit * one value, only when the source Observable completes. It is equivalent to * applying operator {@link scan} followed by operator {@link last}. * * Returns an Observable that applies a specified `accumulator` function to each * item emitted by the source Observable. If a `seed` value is specified, then * that value will be used as the initial value for the accumulator. If no seed * value is specified, the first item of the source is used as the seed. * * @example Count the number of click events that happened in 5 seconds * var clicksInFiveSeconds = Rx.Observable.fromEvent(document, 'click') * .takeUntil(Rx.Observable.interval(5000)); * var ones = clicksInFiveSeconds.mapTo(1); * var seed = 0; * var count = ones.reduce((acc, one) => acc + one, seed); * count.subscribe(x => console.log(x)); * * @see {@link count} * @see {@link expand} * @see {@link mergeScan} * @see {@link scan} * * @param {function(acc: R, value: T, index: number): R} accumulator The accumulator function * called on each source value. * @param {R} [seed] The initial accumulation value. * @return {Observable} An Observable that emits a single value that is the * result of accumulating the values emitted by the source Observable. * @method reduce * @owner Observable */ function reduce(accumulator, seed) { // providing a seed of `undefined` *should* be valid and trigger // hasSeed! so don't use `seed !== undefined` checks! // For this reason, we have to check it here at the original call site // otherwise inside Operator/Subscriber we won't know if `undefined` // means they didn't provide anything or if they literally provided `undefined` if (arguments.length >= 2) { return function reduceOperatorFunctionWithSeed(source) { return Object(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["a" /* pipe */])(Object(__WEBPACK_IMPORTED_MODULE_0__scan__["a" /* scan */])(accumulator, seed), Object(__WEBPACK_IMPORTED_MODULE_1__takeLast__["a" /* takeLast */])(1), Object(__WEBPACK_IMPORTED_MODULE_2__defaultIfEmpty__["a" /* defaultIfEmpty */])(seed))(source); }; } return function reduceOperatorFunction(source) { return Object(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["a" /* pipe */])(Object(__WEBPACK_IMPORTED_MODULE_0__scan__["a" /* scan */])(function (acc, value, index) { return accumulator(acc, value, index + 1); }), Object(__WEBPACK_IMPORTED_MODULE_1__takeLast__["a" /* takeLast */])(1))(source); }; } //# sourceMappingURL=reduce.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/refCount.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = refCount; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function refCount() { return function refCountOperatorFunction(source) { return source.lift(new RefCountOperator(source)); }; } var RefCountOperator = /*@__PURE__*/ (/*@__PURE__*/ 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 = /*@__PURE__*/ (/*@__PURE__*/ 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; } /// // Compare the local RefCountSubscriber's connection Subscription to the // connection Subscription on the shared ConnectableObservable. In cases // where the ConnectableObservable source synchronously emits values, and // the RefCountSubscriber's downstream Observers synchronously unsubscribe, // execution continues to here before the RefCountOperator has a chance to // supply the RefCountSubscriber with the shared connection Subscription. // For example: // ``` // Observable.range(0, 10) // .publish() // .refCount() // .take(5) // .subscribe(); // ``` // In order to account for this case, RefCountSubscriber should only dispose // the ConnectableObservable's shared connection Subscription if the // connection Subscription exists, *and* either: // a. RefCountSubscriber doesn't have a reference to the shared connection // Subscription yet, or, // b. RefCountSubscriber's connection Subscription reference is identical // to the shared connection Subscription /// var connection = this.connection; var sharedConnection = connectable._connection; this.connection = null; if (sharedConnection && (!connection || sharedConnection === connection)) { sharedConnection.unsubscribe(); } }; return RefCountSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=refCount.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/repeat.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export repeat */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__observable_EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /** PURE_IMPORTS_START .._Subscriber,.._observable_EmptyObservable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that repeats the stream of items emitted by the source Observable at most count times. * * * * @param {number} [count] The number of times the source Observable items are repeated, a count of 0 will yield * an empty Observable. * @return {Observable} An Observable that repeats the stream of items emitted by the source Observable at most * count times. * @method repeat * @owner Observable */ function repeat(count) { if (count === void 0) { count = -1; } return function (source) { if (count === 0) { return new __WEBPACK_IMPORTED_MODULE_1__observable_EmptyObservable__["a" /* EmptyObservable */](); } else if (count < 0) { return source.lift(new RepeatOperator(-1, source)); } else { return source.lift(new RepeatOperator(count - 1, source)); } }; } var RepeatOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var RepeatSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=repeat.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/repeatWhen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export repeatWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subject,.._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that mirrors the source Observable with the exception of a `complete`. If the source * Observable calls `complete`, this method will emit to the Observable returned from `notifier`. If that Observable * calls `complete` or `error`, then this method will call `complete` or `error` on the child subscription. Otherwise * this method will resubscribe to the source Observable. * * * * @param {function(notifications: Observable): Observable} notifier - Receives an Observable of notifications with * which a user can `complete` or `error`, aborting the repetition. * @return {Observable} The source Observable modified with repeat logic. * @method repeatWhen * @owner Observable */ function repeatWhen(notifier) { return function (source) { return source.lift(new RepeatWhenOperator(notifier)); }; } var RepeatWhenOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function RepeatWhenOperator(notifier) { this.notifier = notifier; } RepeatWhenOperator.prototype.call = function (subscriber, source) { return source.subscribe(new RepeatWhenSubscriber(subscriber, this.notifier, source)); }; return RepeatWhenOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var RepeatWhenSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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(); } else if (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 _a = this, notifications = _a.notifications, retries = _a.retries, retriesSubscription = _a.retriesSubscription; this.notifications = null; this.retries = null; this.retriesSubscription = null; _super.prototype._unsubscribeAndRecycle.call(this); this.notifications = notifications; this.retries = retries; this.retriesSubscription = retriesSubscription; return this; }; RepeatWhenSubscriber.prototype.subscribeToRetries = function () { this.notifications = new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); var retries = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(this.notifier)(this.notifications); if (retries === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { return _super.prototype.complete.call(this); } this.retries = retries; this.retriesSubscription = Object(__WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__["a" /* subscribeToResult */])(this, retries); }; return RepeatWhenSubscriber; }(__WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=repeatWhen.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/retry.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export retry */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable * calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given * as a number parameter) rather than propagating the `error` call. * * * * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications * would be: [1, 2, 1, 2, 3, 4, 5, `complete`]. * @param {number} count - Number of retry attempts before failing. * @return {Observable} The source Observable modified with the retry logic. * @method retry * @owner Observable */ function retry(count) { if (count === void 0) { count = -1; } return function (source) { return source.lift(new RetryOperator(count, source)); }; } var RetryOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var RetrySubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=retry.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/retryWhen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export retryWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subject,.._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable * calls `error`, this method will emit the Throwable that caused the error to the Observable returned from `notifier`. * If that Observable calls `complete` or `error` then this method will call `complete` or `error` on the child * subscription. Otherwise this method will resubscribe to the source Observable. * * * * @param {function(errors: Observable): Observable} notifier - Receives an Observable of notifications with which a * user can `complete` or `error`, aborting the retry. * @return {Observable} The source Observable modified with retry logic. * @method retryWhen * @owner Observable */ function retryWhen(notifier) { return function (source) { return source.lift(new RetryWhenOperator(notifier, source)); }; } var RetryWhenOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var RetryWhenSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); retries = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(this.notifier)(errors); if (retries === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { return _super.prototype.error.call(this, __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */].e); } retriesSubscription = Object(__WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__["a" /* 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 _a = this, errors = _a.errors, retries = _a.retries, retriesSubscription = _a.retriesSubscription; this.errors = null; this.retries = null; this.retriesSubscription = null; this._unsubscribeAndRecycle(); this.errors = errors; this.retries = retries; this.retriesSubscription = retriesSubscription; this.source.subscribe(this); }; return RetryWhenSubscriber; }(__WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=retryWhen.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/sample.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export sample */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits the most recently emitted value from the source Observable whenever * another Observable, the `notifier`, emits. * * It's like {@link sampleTime}, but samples whenever * the `notifier` Observable emits something. * * * * Whenever the `notifier` Observable emits a value or completes, `sample` * looks at the source Observable and emits whichever value it has most recently * emitted since the previous sampling, unless the source has not emitted * anything since the previous sampling. The `notifier` is subscribed to as soon * as the output Observable is subscribed. * * @example On every click, sample the most recent "seconds" timer * var seconds = Rx.Observable.interval(1000); * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = seconds.sample(clicks); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounce} * @see {@link sampleTime} * @see {@link throttle} * * @param {Observable} notifier The Observable to use for sampling the * source Observable. * @return {Observable} An Observable that emits the results of sampling the * values emitted by the source Observable whenever the notifier Observable * emits value or completes. * @method sample * @owner Observable */ function sample(notifier) { return function (source) { return source.lift(new SampleOperator(notifier)); }; } var SampleOperator = /*@__PURE__*/ (/*@__PURE__*/ 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(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(sampleSubscriber, this.notifier)); return subscription; }; return SampleOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SampleSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=sample.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/sampleTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export sampleTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /** PURE_IMPORTS_START .._Subscriber,.._scheduler_async PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits the most recently emitted value from the source Observable within * periodic time intervals. * * Samples the source Observable at periodic time * intervals, emitting what it samples. * * * * `sampleTime` periodically looks at the source Observable and emits whichever * value it has most recently emitted since the previous sampling, unless the * source has not emitted anything since the previous sampling. The sampling * happens periodically in time every `period` milliseconds (or the time unit * defined by the optional `scheduler` argument). The sampling starts as soon as * the output Observable is subscribed. * * @example Every second, emit the most recent click at most once * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.sampleTime(1000); * result.subscribe(x => console.log(x)); * * @see {@link auditTime} * @see {@link debounceTime} * @see {@link delay} * @see {@link sample} * @see {@link throttleTime} * * @param {number} period The sampling period expressed in milliseconds or the * time unit determined internally by the optional `scheduler`. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for * managing the timers that handle the sampling. * @return {Observable} An Observable that emits the results of sampling the * values emitted by the source Observable at the specified time interval. * @method sampleTime * @owner Observable */ function sampleTime(period, scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_1__scheduler_async__["a" /* async */]; } return function (source) { return source.lift(new SampleTimeOperator(period, scheduler)); }; } var SampleTimeOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SampleTimeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); function dispatchNotification(state) { var subscriber = state.subscriber, period = state.period; subscriber.notifyNext(); this.schedule(state, period); } //# sourceMappingURL=sampleTime.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/scan.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = scan; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Applies an accumulator function over the source Observable, and returns each * intermediate result, with an optional seed value. * * It's like {@link reduce}, but emits the current * accumulation whenever the source emits a value. * * * * Combines together all values emitted on the source, using an accumulator * function that knows how to join a new source value into the accumulation from * the past. Is similar to {@link reduce}, but emits the intermediate * accumulations. * * Returns an Observable that applies a specified `accumulator` function to each * item emitted by the source Observable. If a `seed` value is specified, then * that value will be used as the initial value for the accumulator. If no seed * value is specified, the first item of the source is used as the seed. * * @example Count the number of click events * var clicks = Rx.Observable.fromEvent(document, 'click'); * var ones = clicks.mapTo(1); * var seed = 0; * var count = ones.scan((acc, one) => acc + one, seed); * count.subscribe(x => console.log(x)); * * @see {@link expand} * @see {@link mergeScan} * @see {@link reduce} * * @param {function(acc: R, value: T, index: number): R} accumulator * The accumulator function called on each source value. * @param {T|R} [seed] The initial accumulation value. * @return {Observable} An observable of the accumulated values. * @method scan * @owner Observable */ function scan(accumulator, seed) { var hasSeed = false; // providing a seed of `undefined` *should* be valid and trigger // hasSeed! so don't use `seed !== undefined` checks! // For this reason, we have to check it here at the original call site // otherwise inside Operator/Subscriber we won't know if `undefined` // means they didn't provide anything or if they literally provided `undefined` if (arguments.length >= 2) { hasSeed = true; } return function scanOperatorFunction(source) { return source.lift(new ScanOperator(accumulator, seed, hasSeed)); }; } var ScanOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ScanSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=scan.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/sequenceEqual.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export sequenceEqual */ /* unused harmony export SequenceEqualOperator */ /* unused harmony export SequenceEqualSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_tryCatch,.._util_errorObject PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Compares all values of two observables in sequence using an optional comparor function * and returns an observable of a single boolean value representing whether or not the two sequences * are equal. * * Checks to see of all values emitted by both observables are equal, in order. * * * * `sequenceEqual` subscribes to two observables and buffers incoming values from each observable. Whenever either * observable emits a value, the value is buffered and the buffers are shifted and compared from the bottom * up; If any value pair doesn't match, the returned observable will emit `false` and complete. If one of the * observables completes, the operator will wait for the other observable to complete; If the other * observable emits before completing, the returned observable will emit `false` and complete. If one observable never * completes or emits after the other complets, the returned observable will never complete. * * @example figure out if the Konami code matches * var code = Rx.Observable.from([ * "ArrowUp", * "ArrowUp", * "ArrowDown", * "ArrowDown", * "ArrowLeft", * "ArrowRight", * "ArrowLeft", * "ArrowRight", * "KeyB", * "KeyA", * "Enter" // no start key, clearly. * ]); * * var keys = Rx.Observable.fromEvent(document, 'keyup') * .map(e => e.code); * var matches = keys.bufferCount(11, 1) * .mergeMap( * last11 => * Rx.Observable.from(last11) * .sequenceEqual(code) * ); * matches.subscribe(matched => console.log('Successful cheat at Contra? ', matched)); * * @see {@link combineLatest} * @see {@link zip} * @see {@link withLatestFrom} * * @param {Observable} compareTo The observable sequence to compare the source sequence to. * @param {function} [comparor] An optional function to compare each value pair * @return {Observable} An Observable of a single boolean value representing whether or not * the values emitted by both observables were equal in sequence. * @method sequenceEqual * @owner Observable */ function sequenceEqual(compareTo, comparor) { return function (source) { return source.lift(new SequenceEqualOperator(compareTo, comparor)); }; } var SequenceEqualOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SequenceEqualOperator(compareTo, comparor) { this.compareTo = compareTo; this.comparor = comparor; } SequenceEqualOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SequenceEqualSubscriber(subscriber, this.compareTo, this.comparor)); }; return SequenceEqualOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SequenceEqualSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(SequenceEqualSubscriber, _super); function SequenceEqualSubscriber(destination, compareTo, comparor) { var _this = _super.call(this, destination) || this; _this.compareTo = compareTo; _this.comparor = comparor; _this._a = []; _this._b = []; _this._oneComplete = false; _this.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; } }; SequenceEqualSubscriber.prototype.checkValues = function () { var _c = this, _a = _c._a, _b = _c._b, comparor = _c.comparor; while (_a.length > 0 && _b.length > 0) { var a = _a.shift(); var b = _b.shift(); var areEqual = false; if (comparor) { areEqual = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(comparor)(a, b); if (areEqual === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { this.destination.error(__WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */].e); } } else { areEqual = a === b; } 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(); } }; return SequenceEqualSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); var SequenceEqualCompareToSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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); }; SequenceEqualCompareToSubscriber.prototype._complete = function () { this.parent._complete(); }; return SequenceEqualCompareToSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=sequenceEqual.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/share.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = share; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__multicast__ = __webpack_require__("../../../../rxjs/_esm5/operators/multicast.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__refCount__ = __webpack_require__("../../../../rxjs/_esm5/operators/refCount.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /** PURE_IMPORTS_START ._multicast,._refCount,.._Subject PURE_IMPORTS_END */ function shareSubjectFactory() { return new __WEBPACK_IMPORTED_MODULE_2__Subject__["a" /* Subject */](); } /** * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`. * This is an alias for .multicast(() => new Subject()).refCount(). * * * * @return {Observable} An Observable that upon connection causes the source Observable to emit items to its Observers. * @method share * @owner Observable */ function share() { return function (source) { return Object(__WEBPACK_IMPORTED_MODULE_1__refCount__["a" /* refCount */])()(Object(__WEBPACK_IMPORTED_MODULE_0__multicast__["a" /* multicast */])(shareSubjectFactory)(source)); }; } ; //# sourceMappingURL=share.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/shareReplay.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export shareReplay */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ReplaySubject__ = __webpack_require__("../../../../rxjs/_esm5/ReplaySubject.js"); /** PURE_IMPORTS_START .._ReplaySubject PURE_IMPORTS_END */ /** * @method shareReplay * @owner Observable */ function shareReplay(bufferSize, windowTime, scheduler) { return function (source) { return source.lift(shareReplayOperator(bufferSize, windowTime, scheduler)); }; } function shareReplayOperator(bufferSize, windowTime, 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 __WEBPACK_IMPORTED_MODULE_0__ReplaySubject__["a" /* 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; subject.complete(); }, }); } var innerSub = subject.subscribe(this); return function () { refCount--; innerSub.unsubscribe(); if (subscription && refCount === 0 && isComplete) { subscription.unsubscribe(); } }; }; } ; //# sourceMappingURL=shareReplay.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/single.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export single */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_EmptyError__ = __webpack_require__("../../../../rxjs/_esm5/util/EmptyError.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_EmptyError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that emits the single item emitted by the source Observable that matches a specified * predicate, if that Observable emits one such item. If the source Observable emits more than one such item or no * such items, notify of an IllegalArgumentException or NoSuchElementException respectively. * * * * @throws {EmptyError} Delivers an EmptyError to the Observer's `error` * callback if the Observable completes before any `next` notification was sent. * @param {Function} predicate - A predicate function to evaluate items emitted by the source Observable. * @return {Observable} An Observable that emits the single item emitted by the source Observable that matches * the predicate. . * @method single * @owner Observable */ function single(predicate) { return function (source) { return source.lift(new SingleOperator(predicate, source)); }; } var SingleOperator = /*@__PURE__*/ (/*@__PURE__*/ 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SingleSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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 __WEBPACK_IMPORTED_MODULE_1__util_EmptyError__["a" /* EmptyError */]); } }; return SingleSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=single.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/skip.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export skip */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that skips the first `count` items emitted by the source Observable. * * * * @param {Number} count - The number of times, items emitted by source Observable should be skipped. * @return {Observable} An Observable that skips values emitted by the source Observable. * * @method skip * @owner Observable */ function skip(count) { return function (source) { return source.lift(new SkipOperator(count)); }; } var SkipOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SkipOperator(total) { this.total = total; } SkipOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SkipSubscriber(subscriber, this.total)); }; return SkipOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SkipSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=skip.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/skipLast.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export skipLast */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__ = __webpack_require__("../../../../rxjs/_esm5/util/ArgumentOutOfRangeError.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_ArgumentOutOfRangeError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Skip the last `count` values emitted by the source Observable. * * * * `skipLast` returns an Observable that accumulates a queue with a length * enough to store the first `count` values. As more values are received, * values are taken from the front of the queue and produced on the result * sequence. This causes values to be delayed. * * @example Skip the last 2 values of an Observable with many values * var many = Rx.Observable.range(1, 5); * var skipLastTwo = many.skipLast(2); * skipLastTwo.subscribe(x => console.log(x)); * * // Results in: * // 1 2 3 * * @see {@link skip} * @see {@link skipUntil} * @see {@link skipWhile} * @see {@link take} * * @throws {ArgumentOutOfRangeError} When using `skipLast(i)`, it throws * ArgumentOutOrRangeError if `i < 0`. * * @param {number} count Number of elements to skip from the end of the source Observable. * @returns {Observable} An Observable that skips the last count values * emitted by the source Observable. * @method skipLast * @owner Observable */ function skipLast(count) { return function (source) { return source.lift(new SkipLastOperator(count)); }; } var SkipLastOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SkipLastOperator(_skipCount) { this._skipCount = _skipCount; if (this._skipCount < 0) { throw new __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__["a" /* ArgumentOutOfRangeError */]; } } SkipLastOperator.prototype.call = function (subscriber, source) { if (this._skipCount === 0) { // If we don't want to skip any values then just subscribe // to Subscriber without any further logic. return source.subscribe(new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](subscriber)); } else { return source.subscribe(new SkipLastSubscriber(subscriber, this._skipCount)); } }; return SkipLastOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SkipLastSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=skipLast.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/skipUntil.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export skipUntil */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item. * * * * @param {Observable} notifier - The second Observable that has to emit an item before the source Observable's elements begin to * be mirrored by the resulting Observable. * @return {Observable} An Observable that skips items from the source Observable until the second Observable emits * an item, then emits the remaining items. * @method skipUntil * @owner Observable */ function skipUntil(notifier) { return function (source) { return source.lift(new SkipUntilOperator(notifier)); }; } var SkipUntilOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SkipUntilOperator(notifier) { this.notifier = notifier; } SkipUntilOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SkipUntilSubscriber(subscriber, this.notifier)); }; return SkipUntilOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SkipUntilSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(SkipUntilSubscriber, _super); function SkipUntilSubscriber(destination, notifier) { var _this = _super.call(this, destination) || this; _this.hasValue = false; _this.isInnerStopped = false; _this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(_this, notifier)); return _this; } SkipUntilSubscriber.prototype._next = function (value) { if (this.hasValue) { _super.prototype._next.call(this, value); } }; SkipUntilSubscriber.prototype._complete = function () { if (this.isInnerStopped) { _super.prototype._complete.call(this); } else { this.unsubscribe(); } }; SkipUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.hasValue = true; }; SkipUntilSubscriber.prototype.notifyComplete = function () { this.isInnerStopped = true; if (this.isStopped) { _super.prototype._complete.call(this); } }; return SkipUntilSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=skipUntil.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/skipWhile.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export skipWhile */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds * true, but emits all further source items as soon as the condition becomes false. * * * * @param {Function} predicate - A function to test each item emitted from the source Observable. * @return {Observable} An Observable that begins emitting items emitted by the source Observable when the * specified predicate becomes false. * @method skipWhile * @owner Observable */ function skipWhile(predicate) { return function (source) { return source.lift(new SkipWhileOperator(predicate)); }; } var SkipWhileOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SkipWhileOperator(predicate) { this.predicate = predicate; } SkipWhileOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate)); }; return SkipWhileOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SkipWhileSubscriber = /*@__PURE__*/ (/*@__PURE__*/ 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; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=skipWhile.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/startWith.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = startWith; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__observable_ScalarObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ScalarObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__observable_EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__observable_concat__ = __webpack_require__("../../../../rxjs/_esm5/observable/concat.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /** PURE_IMPORTS_START .._observable_ArrayObservable,.._observable_ScalarObservable,.._observable_EmptyObservable,.._observable_concat,.._util_isScheduler PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ /** * Returns an Observable that emits the items you specify as arguments before it begins to emit * items emitted by the source Observable. * * * * @param {...T} values - Items you want the modified Observable to emit first. * @param {Scheduler} [scheduler] - A {@link IScheduler} to use for scheduling * the emissions of the `next` notifications. * @return {Observable} An Observable that emits the items in the specified Iterable and then emits the items * emitted by the source Observable. * @method startWith * @owner Observable */ function startWith() { var array = []; for (var _i = 0; _i < arguments.length; _i++) { array[_i] = arguments[_i]; } return function (source) { var scheduler = array[array.length - 1]; if (Object(__WEBPACK_IMPORTED_MODULE_4__util_isScheduler__["a" /* isScheduler */])(scheduler)) { array.pop(); } else { scheduler = null; } var len = array.length; if (len === 1) { return Object(__WEBPACK_IMPORTED_MODULE_3__observable_concat__["a" /* concat */])(new __WEBPACK_IMPORTED_MODULE_1__observable_ScalarObservable__["a" /* ScalarObservable */](array[0], scheduler), source); } else if (len > 1) { return Object(__WEBPACK_IMPORTED_MODULE_3__observable_concat__["a" /* concat */])(new __WEBPACK_IMPORTED_MODULE_0__observable_ArrayObservable__["a" /* ArrayObservable */](array, scheduler), source); } else { return Object(__WEBPACK_IMPORTED_MODULE_3__observable_concat__["a" /* concat */])(new __WEBPACK_IMPORTED_MODULE_2__observable_EmptyObservable__["a" /* EmptyObservable */](scheduler), source); } }; } //# sourceMappingURL=startWith.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/switchAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export switchAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__switchMap__ = __webpack_require__("../../../../rxjs/_esm5/operators/switchMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_identity__ = __webpack_require__("../../../../rxjs/_esm5/util/identity.js"); /** PURE_IMPORTS_START ._switchMap,.._util_identity PURE_IMPORTS_END */ function switchAll() { return Object(__WEBPACK_IMPORTED_MODULE_0__switchMap__["a" /* switchMap */])(__WEBPACK_IMPORTED_MODULE_1__util_identity__["a" /* identity */]); } //# sourceMappingURL=switchAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/switchMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = switchMap; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Projects each source value to an Observable which is merged in the output * Observable, emitting values only from the most recently projected Observable. * * Maps each value to an Observable, then flattens all of * these inner Observables using {@link switch}. * * * * Returns an Observable that emits items based on applying a function that you * supply to each item emitted by the source Observable, where that function * returns an (so-called "inner") Observable. Each time it observes one of these * inner Observables, the output Observable begins emitting the items emitted by * that inner Observable. When a new inner Observable is emitted, `switchMap` * stops emitting items from the earlier-emitted inner Observable and begins * emitting items from the new one. It continues to behave like this for * subsequent inner Observables. * * @example Rerun an interval Observable on every click event * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.switchMap((ev) => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link concatMap} * @see {@link exhaustMap} * @see {@link mergeMap} * @see {@link switch} * @see {@link switchMapTo} * * @param {function(value: T, ?index: number): ObservableInput} project A function * that, when applied to an item emitted by the source Observable, returns an * Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @return {Observable} An Observable that emits the result of applying the * projection function (and the optional `resultSelector`) to each item emitted * by the source Observable and taking only the values from the most recently * projected inner Observable. * @method switchMap * @owner Observable */ function switchMap(project, resultSelector) { return function switchMapOperatorFunction(source) { return source.lift(new SwitchMapOperator(project, resultSelector)); }; } var SwitchMapOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SwitchMapOperator(project, resultSelector) { this.project = project; this.resultSelector = resultSelector; } SwitchMapOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SwitchMapSubscriber(subscriber, this.project, this.resultSelector)); }; return SwitchMapOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SwitchMapSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(SwitchMapSubscriber, _super); function SwitchMapSubscriber(destination, project, resultSelector) { var _this = _super.call(this, destination) || this; _this.project = project; _this.resultSelector = resultSelector; _this.index = 0; return _this; } SwitchMapSubscriber.prototype._next = function (value) { var result; var index = this.index++; try { result = this.project(value, index); } catch (error) { this.destination.error(error); return; } this._innerSub(result, value, index); }; SwitchMapSubscriber.prototype._innerSub = function (result, value, index) { var innerSubscription = this.innerSubscription; if (innerSubscription) { innerSubscription.unsubscribe(); } this.add(this.innerSubscription = Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, result, value, index)); }; SwitchMapSubscriber.prototype._complete = function () { var innerSubscription = this.innerSubscription; if (!innerSubscription || innerSubscription.closed) { _super.prototype._complete.call(this); } }; SwitchMapSubscriber.prototype._unsubscribe = function () { this.innerSubscription = null; }; SwitchMapSubscriber.prototype.notifyComplete = function (innerSub) { this.remove(innerSub); this.innerSubscription = null; if (this.isStopped) { _super.prototype._complete.call(this); } }; SwitchMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { if (this.resultSelector) { this._tryNotifyNext(outerValue, innerValue, outerIndex, innerIndex); } else { this.destination.next(innerValue); } }; SwitchMapSubscriber.prototype._tryNotifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { var result; try { result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex); } catch (err) { this.destination.error(err); return; } this.destination.next(result); }; return SwitchMapSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=switchMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/switchMapTo.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export switchMapTo */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Projects each source value to the same Observable which is flattened multiple * times with {@link switch} in the output Observable. * * It's like {@link switchMap}, but maps each value * always to the same inner Observable. * * * * Maps each source value to the given Observable `innerObservable` regardless * of the source value, and then flattens those resulting Observables into one * single Observable, which is the output Observable. The output Observables * emits values only from the most recently emitted instance of * `innerObservable`. * * @example Rerun an interval Observable on every click event * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.switchMapTo(Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link concatMapTo} * @see {@link switch} * @see {@link switchMap} * @see {@link mergeMapTo} * * @param {ObservableInput} innerObservable An Observable to replace each value from * the source Observable. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] * A function to produce the value on the output Observable based on the values * and the indices of the source (outer) emission and the inner Observable * emission. The arguments passed to this function are: * - `outerValue`: the value that came from the source * - `innerValue`: the value that came from the projected Observable * - `outerIndex`: the "index" of the value that came from the source * - `innerIndex`: the "index" of the value from the projected Observable * @return {Observable} An Observable that emits items from the given * `innerObservable` (and optionally transformed through `resultSelector`) every * time a value is emitted on the source Observable, and taking only the values * from the most recently projected inner Observable. * @method switchMapTo * @owner Observable */ function switchMapTo(innerObservable, resultSelector) { return function (source) { return source.lift(new SwitchMapToOperator(innerObservable, resultSelector)); }; } var SwitchMapToOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function SwitchMapToOperator(observable, resultSelector) { this.observable = observable; this.resultSelector = resultSelector; } SwitchMapToOperator.prototype.call = function (subscriber, source) { return source.subscribe(new SwitchMapToSubscriber(subscriber, this.observable, this.resultSelector)); }; return SwitchMapToOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SwitchMapToSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(SwitchMapToSubscriber, _super); function SwitchMapToSubscriber(destination, inner, resultSelector) { var _this = _super.call(this, destination) || this; _this.inner = inner; _this.resultSelector = resultSelector; _this.index = 0; return _this; } SwitchMapToSubscriber.prototype._next = function (value) { var innerSubscription = this.innerSubscription; if (innerSubscription) { innerSubscription.unsubscribe(); } this.add(this.innerSubscription = Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, this.inner, value, this.index++)); }; SwitchMapToSubscriber.prototype._complete = function () { var innerSubscription = this.innerSubscription; if (!innerSubscription || innerSubscription.closed) { _super.prototype._complete.call(this); } }; SwitchMapToSubscriber.prototype._unsubscribe = function () { this.innerSubscription = null; }; SwitchMapToSubscriber.prototype.notifyComplete = function (innerSub) { this.remove(innerSub); this.innerSubscription = null; if (this.isStopped) { _super.prototype._complete.call(this); } }; SwitchMapToSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; if (resultSelector) { this.tryResultSelector(outerValue, innerValue, outerIndex, innerIndex); } else { destination.next(innerValue); } }; SwitchMapToSubscriber.prototype.tryResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) { var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; var result; try { result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); } catch (err) { destination.error(err); return; } destination.next(result); }; return SwitchMapToSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=switchMapTo.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/take.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = take; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__ = __webpack_require__("../../../../rxjs/_esm5/util/ArgumentOutOfRangeError.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__observable_EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_ArgumentOutOfRangeError,.._observable_EmptyObservable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits only the first `count` values emitted by the source Observable. * * Takes the first `count` values from the source, then * completes. * * * * `take` returns an Observable that emits only the first `count` values emitted * by the source Observable. If the source emits fewer than `count` values then * all of its values are emitted. After that, it completes, regardless if the * source completes. * * @example Take the first 5 seconds of an infinite 1-second interval Observable * var interval = Rx.Observable.interval(1000); * var five = interval.take(5); * five.subscribe(x => console.log(x)); * * @see {@link takeLast} * @see {@link takeUntil} * @see {@link takeWhile} * @see {@link skip} * * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`. * * @param {number} count The maximum number of `next` values to emit. * @return {Observable} An Observable that emits only the first `count` * values emitted by the source Observable, or all of the values from the source * if the source emits fewer than `count` values. * @method take * @owner Observable */ function take(count) { return function (source) { if (count === 0) { return new __WEBPACK_IMPORTED_MODULE_2__observable_EmptyObservable__["a" /* EmptyObservable */](); } else { return source.lift(new TakeOperator(count)); } }; } var TakeOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TakeOperator(total) { this.total = total; if (this.total < 0) { throw new __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__["a" /* ArgumentOutOfRangeError */]; } } TakeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new TakeSubscriber(subscriber, this.total)); }; return TakeOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TakeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TakeSubscriber, _super); function TakeSubscriber(destination, total) { var _this = _super.call(this, destination) || this; _this.total = total; _this.count = 0; return _this; } TakeSubscriber.prototype._next = function (value) { var total = this.total; var count = ++this.count; if (count <= total) { this.destination.next(value); if (count === total) { this.destination.complete(); this.unsubscribe(); } } }; return TakeSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=take.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/takeLast.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = takeLast; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__ = __webpack_require__("../../../../rxjs/_esm5/util/ArgumentOutOfRangeError.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__observable_EmptyObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/EmptyObservable.js"); /** PURE_IMPORTS_START .._Subscriber,.._util_ArgumentOutOfRangeError,.._observable_EmptyObservable PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits only the last `count` values emitted by the source Observable. * * Remembers the latest `count` values, then emits those * only when the source completes. * * * * `takeLast` returns an Observable that emits at most the last `count` values * emitted by the source Observable. If the source emits fewer than `count` * values then all of its values are emitted. This operator must wait until the * `complete` notification emission from the source in order to emit the `next` * values on the output Observable, because otherwise it is impossible to know * whether or not more values will be emitted on the source. For this reason, * all values are emitted synchronously, followed by the complete notification. * * @example Take the last 3 values of an Observable with many values * var many = Rx.Observable.range(1, 100); * var lastThree = many.takeLast(3); * lastThree.subscribe(x => console.log(x)); * * @see {@link take} * @see {@link takeUntil} * @see {@link takeWhile} * @see {@link skip} * * @throws {ArgumentOutOfRangeError} When using `takeLast(i)`, it delivers an * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`. * * @param {number} count The maximum number of values to emit from the end of * the sequence of values emitted by the source Observable. * @return {Observable} An Observable that emits at most the last count * values emitted by the source Observable. * @method takeLast * @owner Observable */ function takeLast(count) { return function takeLastOperatorFunction(source) { if (count === 0) { return new __WEBPACK_IMPORTED_MODULE_2__observable_EmptyObservable__["a" /* EmptyObservable */](); } else { return source.lift(new TakeLastOperator(count)); } }; } var TakeLastOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TakeLastOperator(total) { this.total = total; if (this.total < 0) { throw new __WEBPACK_IMPORTED_MODULE_1__util_ArgumentOutOfRangeError__["a" /* ArgumentOutOfRangeError */]; } } TakeLastOperator.prototype.call = function (subscriber, source) { return source.subscribe(new TakeLastSubscriber(subscriber, this.total)); }; return TakeLastOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TakeLastSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TakeLastSubscriber, _super); function TakeLastSubscriber(destination, total) { var _this = _super.call(this, destination) || this; _this.total = total; _this.ring = new Array(); _this.count = 0; return _this; } TakeLastSubscriber.prototype._next = function (value) { var ring = this.ring; var total = this.total; var count = this.count++; if (ring.length < total) { ring.push(value); } else { var index = count % total; ring[index] = value; } }; TakeLastSubscriber.prototype._complete = function () { var destination = this.destination; var count = this.count; if (count > 0) { var total = this.count >= this.total ? this.total : this.count; var ring = this.ring; for (var i = 0; i < total; i++) { var idx = (count++) % total; destination.next(ring[idx]); } } destination.complete(); }; return TakeLastSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=takeLast.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/takeUntil.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = takeUntil; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits the values emitted by the source Observable until a `notifier` * Observable emits a value. * * Lets values pass until a second Observable, * `notifier`, emits something. Then, it completes. * * * * `takeUntil` subscribes and begins mirroring the source Observable. It also * monitors a second Observable, `notifier` that you provide. If the `notifier` * emits a value or a complete notification, the output Observable stops * mirroring the source Observable and completes. * * @example Tick every second until the first click happens * var interval = Rx.Observable.interval(1000); * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = interval.takeUntil(clicks); * result.subscribe(x => console.log(x)); * * @see {@link take} * @see {@link takeLast} * @see {@link takeWhile} * @see {@link skip} * * @param {Observable} notifier The Observable whose first emitted value will * cause the output Observable of `takeUntil` to stop emitting values from the * source Observable. * @return {Observable} An Observable that emits the values from the source * Observable until such time as `notifier` emits its first value. * @method takeUntil * @owner Observable */ function takeUntil(notifier) { return function (source) { return source.lift(new TakeUntilOperator(notifier)); }; } var TakeUntilOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TakeUntilOperator(notifier) { this.notifier = notifier; } TakeUntilOperator.prototype.call = function (subscriber, source) { return source.subscribe(new TakeUntilSubscriber(subscriber, this.notifier)); }; return TakeUntilOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TakeUntilSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TakeUntilSubscriber, _super); function TakeUntilSubscriber(destination, notifier) { var _this = _super.call(this, destination) || this; _this.notifier = notifier; _this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(_this, notifier)); return _this; } TakeUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.complete(); }; TakeUntilSubscriber.prototype.notifyComplete = function () { // noop }; return TakeUntilSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=takeUntil.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/takeWhile.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export takeWhile */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits values emitted by the source Observable so long as each value satisfies * the given `predicate`, and then completes as soon as this `predicate` is not * satisfied. * * Takes values from the source only while they pass the * condition given. When the first value does not satisfy, it completes. * * * * `takeWhile` subscribes and begins mirroring the source Observable. Each value * emitted on the source is given to the `predicate` function which returns a * boolean, representing a condition to be satisfied by the source values. The * output Observable emits the source values until such time as the `predicate` * returns false, at which point `takeWhile` stops mirroring the source * Observable and completes the output Observable. * * @example Emit click events only while the clientX property is greater than 200 * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.takeWhile(ev => ev.clientX > 200); * result.subscribe(x => console.log(x)); * * @see {@link take} * @see {@link takeLast} * @see {@link takeUntil} * @see {@link skip} * * @param {function(value: T, index: number): boolean} predicate A function that * evaluates a value emitted by the source Observable and returns a boolean. * Also takes the (zero-based) index as the second argument. * @return {Observable} An Observable that emits the values from the source * Observable so long as each value satisfies the condition defined by the * `predicate`, then completes. * @method takeWhile * @owner Observable */ function takeWhile(predicate) { return function (source) { return source.lift(new TakeWhileOperator(predicate)); }; } var TakeWhileOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TakeWhileOperator(predicate) { this.predicate = predicate; } TakeWhileOperator.prototype.call = function (subscriber, source) { return source.subscribe(new TakeWhileSubscriber(subscriber, this.predicate)); }; return TakeWhileOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TakeWhileSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TakeWhileSubscriber, _super); function TakeWhileSubscriber(destination, predicate) { var _this = _super.call(this, destination) || this; _this.predicate = predicate; _this.index = 0; return _this; } TakeWhileSubscriber.prototype._next = function (value) { var destination = this.destination; var result; try { result = this.predicate(value, this.index++); } catch (err) { destination.error(err); return; } this.nextOrComplete(value, result); }; TakeWhileSubscriber.prototype.nextOrComplete = function (value, predicateResult) { var destination = this.destination; if (Boolean(predicateResult)) { destination.next(value); } else { destination.complete(); } }; return TakeWhileSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=takeWhile.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/tap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = tap; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Perform a side effect for every emission on the source Observable, but return * an Observable that is identical to the source. * * Intercepts each emission on the source and runs a * function, but returns an output which is identical to the source as long as errors don't occur. * * * * Returns a mirrored Observable of the source Observable, but modified so that * the provided Observer is called to perform a side effect for every value, * error, and completion emitted by the source. Any errors that are thrown in * the aforementioned Observer or handlers are safely sent down the error path * of the output Observable. * * This operator is useful for debugging your Observables for the correct values * or performing other side effects. * * Note: this is different to a `subscribe` on the Observable. If the Observable * returned by `do` is not subscribed, the side effects specified by the * Observer will never happen. `do` therefore simply spies on existing * execution, it does not trigger an execution to happen like `subscribe` does. * * @example Map every click to the clientX position of that click, while also logging the click event * var clicks = Rx.Observable.fromEvent(document, 'click'); * var positions = clicks * .do(ev => console.log(ev)) * .map(ev => ev.clientX); * positions.subscribe(x => console.log(x)); * * @see {@link map} * @see {@link subscribe} * * @param {Observer|function} [nextOrObserver] A normal Observer object or a * callback for `next`. * @param {function} [error] Callback for errors in the source. * @param {function} [complete] Callback for the completion of the source. * @return {Observable} An Observable identical to the source, but runs the * specified Observer or callback(s) for each item. * @name tap */ function tap(nextOrObserver, error, complete) { return function tapOperatorFunction(source) { return source.lift(new DoOperator(nextOrObserver, error, complete)); }; } var DoOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function DoOperator(nextOrObserver, error, complete) { this.nextOrObserver = nextOrObserver; this.error = error; this.complete = complete; } DoOperator.prototype.call = function (subscriber, source) { return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); }; return DoOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DoSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(DoSubscriber, _super); function DoSubscriber(destination, nextOrObserver, error, complete) { var _this = _super.call(this, destination) || this; var safeSubscriber = new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](nextOrObserver, error, complete); safeSubscriber.syncErrorThrowable = true; _this.add(safeSubscriber); _this.safeSubscriber = safeSubscriber; return _this; } DoSubscriber.prototype._next = function (value) { var safeSubscriber = this.safeSubscriber; safeSubscriber.next(value); if (safeSubscriber.syncErrorThrown) { this.destination.error(safeSubscriber.syncErrorValue); } else { this.destination.next(value); } }; DoSubscriber.prototype._error = function (err) { var safeSubscriber = this.safeSubscriber; safeSubscriber.error(err); if (safeSubscriber.syncErrorThrown) { this.destination.error(safeSubscriber.syncErrorValue); } else { this.destination.error(err); } }; DoSubscriber.prototype._complete = function () { var safeSubscriber = this.safeSubscriber; safeSubscriber.complete(); if (safeSubscriber.syncErrorThrown) { this.destination.error(safeSubscriber.syncErrorValue); } else { this.destination.complete(); } }; return DoSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=tap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/throttle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return defaultThrottleConfig; }); /* unused harmony export throttle */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var defaultThrottleConfig = { leading: true, trailing: false }; /** * Emits a value from the source Observable, then ignores subsequent source * values for a duration determined by another Observable, then repeats this * process. * * It's like {@link throttleTime}, but the silencing * duration is determined by a second Observable. * * * * `throttle` emits the source Observable values on the output Observable * when its internal timer is disabled, and ignores source values when the timer * is enabled. Initially, the timer is disabled. As soon as the first source * value arrives, it is forwarded to the output Observable, and then the timer * is enabled by calling the `durationSelector` function with the source value, * which returns the "duration" Observable. When the duration Observable emits a * value or completes, the timer is disabled, and this process repeats for the * next source value. * * @example Emit clicks at a rate of at most one click per second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.throttle(ev => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounce} * @see {@link delayWhen} * @see {@link sample} * @see {@link throttleTime} * * @param {function(value: T): SubscribableOrPromise} durationSelector A function * that receives a value from the source Observable, for computing the silencing * duration for each source value, returned as an Observable or a Promise. * @param {Object} config a configuration object to define `leading` and `trailing` behavior. Defaults * to `{ leading: true, trailing: false }`. * @return {Observable} An Observable that performs the throttle operation to * limit the rate of emissions from the source. * @method throttle * @owner Observable */ function throttle(durationSelector, config) { if (config === void 0) { config = defaultThrottleConfig; } return function (source) { return source.lift(new ThrottleOperator(durationSelector, config.leading, config.trailing)); }; } var ThrottleOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function ThrottleOperator(durationSelector, leading, trailing) { this.durationSelector = durationSelector; this.leading = leading; this.trailing = trailing; } ThrottleOperator.prototype.call = function (subscriber, source) { return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing)); }; return ThrottleOperator; }()); /** * We need this JSDoc comment for affecting ESDoc * @ignore * @extends {Ignored} */ var ThrottleSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ThrottleSubscriber, _super); function ThrottleSubscriber(destination, durationSelector, _leading, _trailing) { var _this = _super.call(this, destination) || this; _this.destination = destination; _this.durationSelector = durationSelector; _this._leading = _leading; _this._trailing = _trailing; _this._hasTrailingValue = false; return _this; } ThrottleSubscriber.prototype._next = function (value) { if (this.throttled) { if (this._trailing) { this._hasTrailingValue = true; this._trailingValue = value; } } else { var duration = this.tryDurationSelector(value); if (duration) { this.add(this.throttled = Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(this, duration)); } if (this._leading) { this.destination.next(value); if (this._trailing) { this._hasTrailingValue = true; this._trailingValue = value; } } } }; ThrottleSubscriber.prototype.tryDurationSelector = function (value) { try { return this.durationSelector(value); } catch (err) { this.destination.error(err); return null; } }; ThrottleSubscriber.prototype._unsubscribe = function () { var _a = this, throttled = _a.throttled, _trailingValue = _a._trailingValue, _hasTrailingValue = _a._hasTrailingValue, _trailing = _a._trailing; this._trailingValue = null; this._hasTrailingValue = false; if (throttled) { this.remove(throttled); this.throttled = null; throttled.unsubscribe(); } }; ThrottleSubscriber.prototype._sendTrailing = function () { var _a = this, destination = _a.destination, throttled = _a.throttled, _trailing = _a._trailing, _trailingValue = _a._trailingValue, _hasTrailingValue = _a._hasTrailingValue; if (throttled && _trailing && _hasTrailingValue) { destination.next(_trailingValue); this._trailingValue = null; this._hasTrailingValue = false; } }; ThrottleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this._sendTrailing(); this._unsubscribe(); }; ThrottleSubscriber.prototype.notifyComplete = function () { this._sendTrailing(); this._unsubscribe(); }; return ThrottleSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=throttle.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/throttleTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export throttleTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__throttle__ = __webpack_require__("../../../../rxjs/_esm5/operators/throttle.js"); /** PURE_IMPORTS_START .._Subscriber,.._scheduler_async,._throttle PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Emits a value from the source Observable, then ignores subsequent source * values for `duration` milliseconds, then repeats this process. * * Lets a value pass, then ignores source values for the * next `duration` milliseconds. * * * * `throttleTime` emits the source Observable values on the output Observable * when its internal timer is disabled, and ignores source values when the timer * is enabled. Initially, the timer is disabled. As soon as the first source * value arrives, it is forwarded to the output Observable, and then the timer * is enabled. After `duration` milliseconds (or the time unit determined * internally by the optional `scheduler`) has passed, the timer is disabled, * and this process repeats for the next source value. Optionally takes a * {@link IScheduler} for managing timers. * * @example Emit clicks at a rate of at most one click per second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.throttleTime(1000); * result.subscribe(x => console.log(x)); * * @see {@link auditTime} * @see {@link debounceTime} * @see {@link delay} * @see {@link sampleTime} * @see {@link throttle} * * @param {number} duration Time to wait before emitting another value after * emitting the last value, measured in milliseconds or the time unit determined * internally by the optional `scheduler`. * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for * managing the timers that handle the throttling. * @return {Observable} An Observable that performs the throttle operation to * limit the rate of emissions from the source. * @method throttleTime * @owner Observable */ function throttleTime(duration, scheduler, config) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_1__scheduler_async__["a" /* async */]; } if (config === void 0) { config = __WEBPACK_IMPORTED_MODULE_2__throttle__["a" /* defaultThrottleConfig */]; } return function (source) { return source.lift(new ThrottleTimeOperator(duration, scheduler, config.leading, config.trailing)); }; } var ThrottleTimeOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function ThrottleTimeOperator(duration, scheduler, leading, trailing) { this.duration = duration; this.scheduler = scheduler; this.leading = leading; this.trailing = trailing; } ThrottleTimeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new ThrottleTimeSubscriber(subscriber, this.duration, this.scheduler, this.leading, this.trailing)); }; return ThrottleTimeOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ThrottleTimeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ThrottleTimeSubscriber, _super); function ThrottleTimeSubscriber(destination, duration, scheduler, leading, trailing) { var _this = _super.call(this, destination) || this; _this.duration = duration; _this.scheduler = scheduler; _this.leading = leading; _this.trailing = trailing; _this._hasTrailingValue = false; _this._trailingValue = null; return _this; } ThrottleTimeSubscriber.prototype._next = function (value) { if (this.throttled) { if (this.trailing) { this._trailingValue = value; this._hasTrailingValue = true; } } else { this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, { subscriber: this })); if (this.leading) { this.destination.next(value); } } }; ThrottleTimeSubscriber.prototype.clearThrottle = function () { var throttled = this.throttled; if (throttled) { if (this.trailing && this._hasTrailingValue) { this.destination.next(this._trailingValue); this._trailingValue = null; this._hasTrailingValue = false; } throttled.unsubscribe(); this.remove(throttled); this.throttled = null; } }; return ThrottleTimeSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); function dispatchNext(arg) { var subscriber = arg.subscriber; subscriber.clearThrottle(); } //# sourceMappingURL=throttleTime.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/timeInterval.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export timeInterval */ /* unused harmony export TimeInterval */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /** PURE_IMPORTS_START .._Subscriber,.._scheduler_async PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function timeInterval(scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_1__scheduler_async__["a" /* async */]; } return function (source) { return source.lift(new TimeIntervalOperator(scheduler)); }; } var TimeInterval = /*@__PURE__*/ (/*@__PURE__*/ function () { function TimeInterval(value, interval) { this.value = value; this.interval = interval; } return TimeInterval; }()); ; var TimeIntervalOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TimeIntervalOperator(scheduler) { this.scheduler = scheduler; } TimeIntervalOperator.prototype.call = function (observer, source) { return source.subscribe(new TimeIntervalSubscriber(observer, this.scheduler)); }; return TimeIntervalOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TimeIntervalSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TimeIntervalSubscriber, _super); function TimeIntervalSubscriber(destination, scheduler) { var _this = _super.call(this, destination) || this; _this.scheduler = scheduler; _this.lastTime = 0; _this.lastTime = scheduler.now(); return _this; } TimeIntervalSubscriber.prototype._next = function (value) { var now = this.scheduler.now(); var span = now - this.lastTime; this.lastTime = now; this.destination.next(new TimeInterval(value, span)); }; return TimeIntervalSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=timeInterval.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/timeout.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export timeout */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isDate__ = __webpack_require__("../../../../rxjs/_esm5/util/isDate.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_TimeoutError__ = __webpack_require__("../../../../rxjs/_esm5/util/TimeoutError.js"); /** PURE_IMPORTS_START .._scheduler_async,.._util_isDate,.._Subscriber,.._util_TimeoutError PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * * Errors if Observable does not emit a value in given time span. * * Timeouts on Observable that doesn't emit values fast enough. * * * * `timeout` operator accepts as an argument either a number or a Date. * * If number was provided, it returns an Observable that behaves like a source * Observable, unless there is a period of time where there is no value emitted. * So if you provide `100` as argument and first value comes after 50ms from * the moment of subscription, this value will be simply re-emitted by the resulting * Observable. If however after that 100ms passes without a second value being emitted, * stream will end with an error and source Observable will be unsubscribed. * These checks are performed throughout whole lifecycle of Observable - from the moment * it was subscribed to, until it completes or errors itself. Thus every value must be * emitted within specified period since previous value. * * If provided argument was Date, returned Observable behaves differently. It throws * if Observable did not complete before provided Date. This means that periods between * emission of particular values do not matter in this case. If Observable did not complete * before provided Date, source Observable will be unsubscribed. Other than that, resulting * stream behaves just as source Observable. * * `timeout` accepts also a Scheduler as a second parameter. It is used to schedule moment (or moments) * when returned Observable will check if source stream emitted value or completed. * * @example Check if ticks are emitted within certain timespan * const seconds = Rx.Observable.interval(1000); * * seconds.timeout(1100) // Let's use bigger timespan to be safe, * // since `interval` might fire a bit later then scheduled. * .subscribe( * value => console.log(value), // Will emit numbers just as regular `interval` would. * err => console.log(err) // Will never be called. * ); * * seconds.timeout(900).subscribe( * value => console.log(value), // Will never be called. * err => console.log(err) // Will emit error before even first value is emitted, * // since it did not arrive within 900ms period. * ); * * @example Use Date to check if Observable completed * const seconds = Rx.Observable.interval(1000); * * seconds.timeout(new Date("December 17, 2020 03:24:00")) * .subscribe( * value => console.log(value), // Will emit values as regular `interval` would * // until December 17, 2020 at 03:24:00. * err => console.log(err) // On December 17, 2020 at 03:24:00 it will emit an error, * // since Observable did not complete by then. * ); * * @see {@link timeoutWith} * * @param {number|Date} due Number specifying period within which Observable must emit values * or Date specifying before when Observable should complete * @param {Scheduler} [scheduler] Scheduler controlling when timeout checks occur. * @return {Observable} Observable that mirrors behaviour of source, unless timeout checks fail. * @method timeout * @owner Observable */ function timeout(due, scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_0__scheduler_async__["a" /* async */]; } var absoluteTimeout = Object(__WEBPACK_IMPORTED_MODULE_1__util_isDate__["a" /* isDate */])(due); var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due); return function (source) { return source.lift(new TimeoutOperator(waitFor, absoluteTimeout, scheduler, new __WEBPACK_IMPORTED_MODULE_3__util_TimeoutError__["a" /* TimeoutError */]())); }; } var TimeoutOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TimeoutOperator(waitFor, absoluteTimeout, scheduler, errorInstance) { this.waitFor = waitFor; this.absoluteTimeout = absoluteTimeout; this.scheduler = scheduler; this.errorInstance = errorInstance; } TimeoutOperator.prototype.call = function (subscriber, source) { return source.subscribe(new TimeoutSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.scheduler, this.errorInstance)); }; return TimeoutOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TimeoutSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TimeoutSubscriber, _super); function TimeoutSubscriber(destination, absoluteTimeout, waitFor, scheduler, errorInstance) { var _this = _super.call(this, destination) || this; _this.absoluteTimeout = absoluteTimeout; _this.waitFor = waitFor; _this.scheduler = scheduler; _this.errorInstance = errorInstance; _this.action = null; _this.scheduleTimeout(); return _this; } TimeoutSubscriber.dispatchTimeout = function (subscriber) { subscriber.error(subscriber.errorInstance); }; TimeoutSubscriber.prototype.scheduleTimeout = function () { var action = this.action; if (action) { // Recycle the action if we've already scheduled one. All the production // Scheduler Actions mutate their state/delay time and return themeselves. // VirtualActions are immutable, so they create and return a clone. In this // case, we need to set the action reference to the most recent VirtualAction, // to ensure that's the one we clone from next time. this.action = action.schedule(this, this.waitFor); } else { this.add(this.action = this.scheduler.schedule(TimeoutSubscriber.dispatchTimeout, this.waitFor, this)); } }; TimeoutSubscriber.prototype._next = function (value) { if (!this.absoluteTimeout) { this.scheduleTimeout(); } _super.prototype._next.call(this, value); }; TimeoutSubscriber.prototype._unsubscribe = function () { this.action = null; this.scheduler = null; this.errorInstance = null; }; return TimeoutSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=timeout.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/timeoutWith.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export timeoutWith */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isDate__ = __webpack_require__("../../../../rxjs/_esm5/util/isDate.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._scheduler_async,.._util_isDate,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * * Errors if Observable does not emit a value in given time span, in case of which * subscribes to the second Observable. * * It's a version of `timeout` operator that let's you specify fallback Observable. * * * * `timeoutWith` is a variation of `timeout` operator. It behaves exactly the same, * still accepting as a first argument either a number or a Date, which control - respectively - * when values of source Observable should be emitted or when it should complete. * * The only difference is that it accepts a second, required parameter. This parameter * should be an Observable which will be subscribed when source Observable fails any timeout check. * So whenever regular `timeout` would emit an error, `timeoutWith` will instead start re-emitting * values from second Observable. Note that this fallback Observable is not checked for timeouts * itself, so it can emit values and complete at arbitrary points in time. From the moment of a second * subscription, Observable returned from `timeoutWith` simply mirrors fallback stream. When that * stream completes, it completes as well. * * Scheduler, which in case of `timeout` is provided as as second argument, can be still provided * here - as a third, optional parameter. It still is used to schedule timeout checks and - * as a consequence - when second Observable will be subscribed, since subscription happens * immediately after failing check. * * @example Add fallback observable * const seconds = Rx.Observable.interval(1000); * const minutes = Rx.Observable.interval(60 * 1000); * * seconds.timeoutWith(900, minutes) * .subscribe( * value => console.log(value), // After 900ms, will start emitting `minutes`, * // since first value of `seconds` will not arrive fast enough. * err => console.log(err) // Would be called after 900ms in case of `timeout`, * // but here will never be called. * ); * * @param {number|Date} due Number specifying period within which Observable must emit values * or Date specifying before when Observable should complete * @param {Observable} withObservable Observable which will be subscribed if source fails timeout check. * @param {Scheduler} [scheduler] Scheduler controlling when timeout checks occur. * @return {Observable} Observable that mirrors behaviour of source or, when timeout check fails, of an Observable * passed as a second parameter. * @method timeoutWith * @owner Observable */ function timeoutWith(due, withObservable, scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_0__scheduler_async__["a" /* async */]; } return function (source) { var absoluteTimeout = Object(__WEBPACK_IMPORTED_MODULE_1__util_isDate__["a" /* isDate */])(due); var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due); return source.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler)); }; } var TimeoutWithOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler) { this.waitFor = waitFor; this.absoluteTimeout = absoluteTimeout; this.withObservable = withObservable; this.scheduler = scheduler; } TimeoutWithOperator.prototype.call = function (subscriber, source) { return source.subscribe(new TimeoutWithSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.withObservable, this.scheduler)); }; return TimeoutWithOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TimeoutWithSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TimeoutWithSubscriber, _super); function TimeoutWithSubscriber(destination, absoluteTimeout, waitFor, withObservable, scheduler) { var _this = _super.call(this, destination) || this; _this.absoluteTimeout = absoluteTimeout; _this.waitFor = waitFor; _this.withObservable = withObservable; _this.scheduler = scheduler; _this.action = null; _this.scheduleTimeout(); return _this; } TimeoutWithSubscriber.dispatchTimeout = function (subscriber) { var withObservable = subscriber.withObservable; subscriber._unsubscribeAndRecycle(); subscriber.add(Object(__WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__["a" /* subscribeToResult */])(subscriber, withObservable)); }; TimeoutWithSubscriber.prototype.scheduleTimeout = function () { var action = this.action; if (action) { // Recycle the action if we've already scheduled one. All the production // Scheduler Actions mutate their state/delay time and return themeselves. // VirtualActions are immutable, so they create and return a clone. In this // case, we need to set the action reference to the most recent VirtualAction, // to ensure that's the one we clone from next time. this.action = action.schedule(this, this.waitFor); } else { this.add(this.action = this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout, this.waitFor, this)); } }; TimeoutWithSubscriber.prototype._next = function (value) { if (!this.absoluteTimeout) { this.scheduleTimeout(); } _super.prototype._next.call(this, value); }; TimeoutWithSubscriber.prototype._unsubscribe = function () { this.action = null; this.scheduler = null; this.withObservable = null; }; return TimeoutWithSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=timeoutWith.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/timestamp.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export timestamp */ /* unused harmony export Timestamp */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__map__ = __webpack_require__("../../../../rxjs/_esm5/operators/map.js"); /** PURE_IMPORTS_START .._scheduler_async,._map PURE_IMPORTS_END */ /** * @param scheduler * @return {Observable>|WebSocketSubject|Observable} * @method timestamp * @owner Observable */ function timestamp(scheduler) { if (scheduler === void 0) { scheduler = __WEBPACK_IMPORTED_MODULE_0__scheduler_async__["a" /* async */]; } return Object(__WEBPACK_IMPORTED_MODULE_1__map__["a" /* map */])(function (value) { return new Timestamp(value, scheduler.now()); }); // return (source: Observable) => source.lift(new TimestampOperator(scheduler)); } var Timestamp = /*@__PURE__*/ (/*@__PURE__*/ function () { function Timestamp(value, timestamp) { this.value = value; this.timestamp = timestamp; } return Timestamp; }()); ; //# sourceMappingURL=timestamp.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/toArray.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export toArray */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__reduce__ = __webpack_require__("../../../../rxjs/_esm5/operators/reduce.js"); /** PURE_IMPORTS_START ._reduce PURE_IMPORTS_END */ function toArrayReducer(arr, item, index) { arr.push(item); return arr; } function toArray() { return Object(__WEBPACK_IMPORTED_MODULE_0__reduce__["a" /* reduce */])(toArrayReducer, []); } //# sourceMappingURL=toArray.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/window.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export window */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Branch out the source Observable values as a nested Observable whenever * `windowBoundaries` emits. * * It's like {@link buffer}, but emits a nested Observable * instead of an array. * * * * Returns an Observable that emits windows of items it collects from the source * Observable. The output Observable emits connected, non-overlapping * windows. It emits the current window and opens a new one whenever the * Observable `windowBoundaries` emits an item. Because each window is an * Observable, the output is a higher-order Observable. * * @example In every window of 1 second each, emit at most 2 click events * var clicks = Rx.Observable.fromEvent(document, 'click'); * var interval = Rx.Observable.interval(1000); * var result = clicks.window(interval) * .map(win => win.take(2)) // each window has at most 2 emissions * .mergeAll(); // flatten the Observable-of-Observables * result.subscribe(x => console.log(x)); * * @see {@link windowCount} * @see {@link windowTime} * @see {@link windowToggle} * @see {@link windowWhen} * @see {@link buffer} * * @param {Observable} windowBoundaries An Observable that completes the * previous window and starts a new window. * @return {Observable>} An Observable of windows, which are * Observables emitting values of the source Observable. * @method window * @owner Observable */ function window(windowBoundaries) { return function windowOperatorFunction(source) { return source.lift(new WindowOperator(windowBoundaries)); }; } var WindowOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function WindowOperator(windowBoundaries) { this.windowBoundaries = windowBoundaries; } WindowOperator.prototype.call = function (subscriber, source) { var windowSubscriber = new WindowSubscriber(subscriber); var sourceSubscription = source.subscribe(windowSubscriber); if (!sourceSubscription.closed) { windowSubscriber.add(Object(__WEBPACK_IMPORTED_MODULE_2__util_subscribeToResult__["a" /* subscribeToResult */])(windowSubscriber, this.windowBoundaries)); } return sourceSubscription; }; return WindowOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var WindowSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(WindowSubscriber, _super); function WindowSubscriber(destination) { var _this = _super.call(this, destination) || this; _this.window = new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); destination.next(_this.window); return _this; } WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.openWindow(); }; WindowSubscriber.prototype.notifyError = function (error, innerSub) { this._error(error); }; WindowSubscriber.prototype.notifyComplete = function (innerSub) { this._complete(); }; WindowSubscriber.prototype._next = function (value) { this.window.next(value); }; WindowSubscriber.prototype._error = function (err) { this.window.error(err); this.destination.error(err); }; WindowSubscriber.prototype._complete = function () { this.window.complete(); this.destination.complete(); }; WindowSubscriber.prototype._unsubscribe = function () { this.window = null; }; WindowSubscriber.prototype.openWindow = function () { var prevWindow = this.window; if (prevWindow) { prevWindow.complete(); } var destination = this.destination; var newWindow = this.window = new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); destination.next(newWindow); }; return WindowSubscriber; }(__WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=window.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/windowCount.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export windowCount */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /** PURE_IMPORTS_START .._Subscriber,.._Subject PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Branch out the source Observable values as a nested Observable with each * nested Observable emitting at most `windowSize` values. * * It's like {@link bufferCount}, but emits a nested * Observable instead of an array. * * * * Returns an Observable that emits windows of items it collects from the source * Observable. The output Observable emits windows every `startWindowEvery` * items, each containing no more than `windowSize` items. When the source * Observable completes or encounters an error, the output Observable emits * the current window and propagates the notification from the source * Observable. If `startWindowEvery` is not provided, then new windows are * started immediately at the start of the source and when each window completes * with size `windowSize`. * * @example Ignore every 3rd click event, starting from the first one * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.windowCount(3) * .map(win => win.skip(1)) // skip first of every 3 clicks * .mergeAll(); // flatten the Observable-of-Observables * result.subscribe(x => console.log(x)); * * @example Ignore every 3rd click event, starting from the third one * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.windowCount(2, 3) * .mergeAll(); // flatten the Observable-of-Observables * result.subscribe(x => console.log(x)); * * @see {@link window} * @see {@link windowTime} * @see {@link windowToggle} * @see {@link windowWhen} * @see {@link bufferCount} * * @param {number} windowSize The maximum number of values emitted by each * window. * @param {number} [startWindowEvery] Interval at which to start a new window. * For example if `startWindowEvery` is `2`, then a new window will be started * on every other value from the source. A new window is started at the * beginning of the source by default. * @return {Observable>} An Observable of windows, which in turn * are Observable of values. * @method windowCount * @owner Observable */ function windowCount(windowSize, startWindowEvery) { if (startWindowEvery === void 0) { startWindowEvery = 0; } return function windowCountOperatorFunction(source) { return source.lift(new WindowCountOperator(windowSize, startWindowEvery)); }; } var WindowCountOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function WindowCountOperator(windowSize, startWindowEvery) { this.windowSize = windowSize; this.startWindowEvery = startWindowEvery; } WindowCountOperator.prototype.call = function (subscriber, source) { return source.subscribe(new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery)); }; return WindowCountOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var WindowCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(WindowCountSubscriber, _super); function WindowCountSubscriber(destination, windowSize, startWindowEvery) { var _this = _super.call(this, destination) || this; _this.destination = destination; _this.windowSize = windowSize; _this.startWindowEvery = startWindowEvery; _this.windows = [new __WEBPACK_IMPORTED_MODULE_1__Subject__["a" /* Subject */]()]; _this.count = 0; destination.next(_this.windows[0]); return _this; } WindowCountSubscriber.prototype._next = function (value) { var startWindowEvery = (this.startWindowEvery > 0) ? this.startWindowEvery : this.windowSize; var destination = this.destination; var windowSize = this.windowSize; var windows = this.windows; var len = windows.length; for (var i = 0; i < len && !this.closed; i++) { windows[i].next(value); } var c = this.count - windowSize + 1; if (c >= 0 && c % startWindowEvery === 0 && !this.closed) { windows.shift().complete(); } if (++this.count % startWindowEvery === 0 && !this.closed) { var window_1 = new __WEBPACK_IMPORTED_MODULE_1__Subject__["a" /* Subject */](); windows.push(window_1); destination.next(window_1); } }; WindowCountSubscriber.prototype._error = function (err) { var windows = this.windows; if (windows) { while (windows.length > 0 && !this.closed) { windows.shift().error(err); } } this.destination.error(err); }; WindowCountSubscriber.prototype._complete = function () { var windows = this.windows; if (windows) { while (windows.length > 0 && !this.closed) { windows.shift().complete(); } } this.destination.complete(); }; WindowCountSubscriber.prototype._unsubscribe = function () { this.count = 0; this.windows = null; }; return WindowCountSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */])); //# sourceMappingURL=windowCount.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/windowTime.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export windowTime */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_async__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/async.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isNumeric__ = __webpack_require__("../../../../rxjs/_esm5/util/isNumeric.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_isScheduler__ = __webpack_require__("../../../../rxjs/_esm5/util/isScheduler.js"); /** PURE_IMPORTS_START .._Subject,.._scheduler_async,.._Subscriber,.._util_isNumeric,.._util_isScheduler PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); function windowTime(windowTimeSpan) { var scheduler = __WEBPACK_IMPORTED_MODULE_1__scheduler_async__["a" /* async */]; var windowCreationInterval = null; var maxWindowSize = Number.POSITIVE_INFINITY; if (Object(__WEBPACK_IMPORTED_MODULE_4__util_isScheduler__["a" /* isScheduler */])(arguments[3])) { scheduler = arguments[3]; } if (Object(__WEBPACK_IMPORTED_MODULE_4__util_isScheduler__["a" /* isScheduler */])(arguments[2])) { scheduler = arguments[2]; } else if (Object(__WEBPACK_IMPORTED_MODULE_3__util_isNumeric__["a" /* isNumeric */])(arguments[2])) { maxWindowSize = arguments[2]; } if (Object(__WEBPACK_IMPORTED_MODULE_4__util_isScheduler__["a" /* isScheduler */])(arguments[1])) { scheduler = arguments[1]; } else if (Object(__WEBPACK_IMPORTED_MODULE_3__util_isNumeric__["a" /* isNumeric */])(arguments[1])) { windowCreationInterval = arguments[1]; } return function windowTimeOperatorFunction(source) { return source.lift(new WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler)); }; } var WindowTimeOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) { this.windowTimeSpan = windowTimeSpan; this.windowCreationInterval = windowCreationInterval; this.maxWindowSize = maxWindowSize; this.scheduler = scheduler; } WindowTimeOperator.prototype.call = function (subscriber, source) { return source.subscribe(new WindowTimeSubscriber(subscriber, this.windowTimeSpan, this.windowCreationInterval, this.maxWindowSize, this.scheduler)); }; return WindowTimeOperator; }()); var CountedSubject = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(CountedSubject, _super); function CountedSubject() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._numberOfNextedValues = 0; return _this; } CountedSubject.prototype.next = function (value) { this._numberOfNextedValues++; _super.prototype.next.call(this, value); }; Object.defineProperty(CountedSubject.prototype, "numberOfNextedValues", { get: function () { return this._numberOfNextedValues; }, enumerable: true, configurable: true }); return CountedSubject; }(__WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */])); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var WindowTimeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(WindowTimeSubscriber, _super); function WindowTimeSubscriber(destination, windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) { var _this = _super.call(this, destination) || this; _this.destination = destination; _this.windowTimeSpan = windowTimeSpan; _this.windowCreationInterval = windowCreationInterval; _this.maxWindowSize = maxWindowSize; _this.scheduler = scheduler; _this.windows = []; var window = _this.openWindow(); if (windowCreationInterval !== null && windowCreationInterval >= 0) { var closeState = { subscriber: _this, window: window, context: null }; var creationState = { windowTimeSpan: windowTimeSpan, windowCreationInterval: windowCreationInterval, subscriber: _this, scheduler: scheduler }; _this.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState)); _this.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState)); } else { var timeSpanOnlyState = { subscriber: _this, window: window, windowTimeSpan: windowTimeSpan }; _this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState)); } return _this; } WindowTimeSubscriber.prototype._next = function (value) { var windows = this.windows; var len = windows.length; for (var i = 0; i < len; i++) { var window_1 = windows[i]; if (!window_1.closed) { window_1.next(value); if (window_1.numberOfNextedValues >= this.maxWindowSize) { this.closeWindow(window_1); } } } }; WindowTimeSubscriber.prototype._error = function (err) { var windows = this.windows; while (windows.length > 0) { windows.shift().error(err); } this.destination.error(err); }; WindowTimeSubscriber.prototype._complete = function () { var windows = this.windows; while (windows.length > 0) { var window_2 = windows.shift(); if (!window_2.closed) { window_2.complete(); } } this.destination.complete(); }; WindowTimeSubscriber.prototype.openWindow = function () { var window = new CountedSubject(); this.windows.push(window); var destination = this.destination; destination.next(window); return window; }; WindowTimeSubscriber.prototype.closeWindow = function (window) { window.complete(); var windows = this.windows; windows.splice(windows.indexOf(window), 1); }; return WindowTimeSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); function dispatchWindowTimeSpanOnly(state) { var subscriber = state.subscriber, windowTimeSpan = state.windowTimeSpan, window = state.window; if (window) { subscriber.closeWindow(window); } state.window = subscriber.openWindow(); this.schedule(state, windowTimeSpan); } function dispatchWindowCreation(state) { var windowTimeSpan = state.windowTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler, windowCreationInterval = state.windowCreationInterval; var window = subscriber.openWindow(); var action = this; var context = { action: action, subscription: null }; var timeSpanState = { subscriber: subscriber, window: window, context: context }; context.subscription = scheduler.schedule(dispatchWindowClose, windowTimeSpan, timeSpanState); action.add(context.subscription); action.schedule(state, windowCreationInterval); } function dispatchWindowClose(state) { var subscriber = state.subscriber, window = state.window, context = state.context; if (context && context.action && context.subscription) { context.action.remove(context.subscription); } subscriber.closeWindow(window); } //# sourceMappingURL=windowTime.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/windowToggle.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export windowToggle */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subject,.._Subscription,.._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Branch out the source Observable values as a nested Observable starting from * an emission from `openings` and ending when the output of `closingSelector` * emits. * * It's like {@link bufferToggle}, but emits a nested * Observable instead of an array. * * * * Returns an Observable that emits windows of items it collects from the source * Observable. The output Observable emits windows that contain those items * emitted by the source Observable between the time when the `openings` * Observable emits an item and when the Observable returned by * `closingSelector` emits an item. * * @example Every other second, emit the click events from the next 500ms * var clicks = Rx.Observable.fromEvent(document, 'click'); * var openings = Rx.Observable.interval(1000); * var result = clicks.windowToggle(openings, i => * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() * ).mergeAll(); * result.subscribe(x => console.log(x)); * * @see {@link window} * @see {@link windowCount} * @see {@link windowTime} * @see {@link windowWhen} * @see {@link bufferToggle} * * @param {Observable} openings An observable of notifications to start new * windows. * @param {function(value: O): Observable} closingSelector A function that takes * the value emitted by the `openings` observable and returns an Observable, * which, when it emits (either `next` or `complete`), signals that the * associated window should complete. * @return {Observable>} An observable of windows, which in turn * are Observables. * @method windowToggle * @owner Observable */ function windowToggle(openings, closingSelector) { return function (source) { return source.lift(new WindowToggleOperator(openings, closingSelector)); }; } var WindowToggleOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function WindowToggleOperator(openings, closingSelector) { this.openings = openings; this.closingSelector = closingSelector; } WindowToggleOperator.prototype.call = function (subscriber, source) { return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector)); }; return WindowToggleOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var WindowToggleSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(WindowToggleSubscriber, _super); function WindowToggleSubscriber(destination, openings, closingSelector) { var _this = _super.call(this, destination) || this; _this.openings = openings; _this.closingSelector = closingSelector; _this.contexts = []; _this.add(_this.openSubscription = Object(__WEBPACK_IMPORTED_MODULE_5__util_subscribeToResult__["a" /* subscribeToResult */])(_this, openings, openings)); return _this; } WindowToggleSubscriber.prototype._next = function (value) { var contexts = this.contexts; if (contexts) { var len = contexts.length; for (var i = 0; i < len; i++) { contexts[i].window.next(value); } } }; WindowToggleSubscriber.prototype._error = function (err) { var contexts = this.contexts; this.contexts = null; if (contexts) { var len = contexts.length; var index = -1; while (++index < len) { var context_1 = contexts[index]; context_1.window.error(err); context_1.subscription.unsubscribe(); } } _super.prototype._error.call(this, err); }; WindowToggleSubscriber.prototype._complete = function () { var contexts = this.contexts; this.contexts = null; if (contexts) { var len = contexts.length; var index = -1; while (++index < len) { var context_2 = contexts[index]; context_2.window.complete(); context_2.subscription.unsubscribe(); } } _super.prototype._complete.call(this); }; WindowToggleSubscriber.prototype._unsubscribe = function () { var contexts = this.contexts; this.contexts = null; if (contexts) { var len = contexts.length; var index = -1; while (++index < len) { var context_3 = contexts[index]; context_3.window.unsubscribe(); context_3.subscription.unsubscribe(); } } }; WindowToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { if (outerValue === this.openings) { var closingSelector = this.closingSelector; var closingNotifier = Object(__WEBPACK_IMPORTED_MODULE_2__util_tryCatch__["a" /* tryCatch */])(closingSelector)(innerValue); if (closingNotifier === __WEBPACK_IMPORTED_MODULE_3__util_errorObject__["a" /* errorObject */]) { return this.error(__WEBPACK_IMPORTED_MODULE_3__util_errorObject__["a" /* errorObject */].e); } else { var window_1 = new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); var subscription = new __WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */](); var context_4 = { window: window_1, subscription: subscription }; this.contexts.push(context_4); var innerSubscription = Object(__WEBPACK_IMPORTED_MODULE_5__util_subscribeToResult__["a" /* subscribeToResult */])(this, closingNotifier, context_4); if (innerSubscription.closed) { this.closeWindow(this.contexts.length - 1); } else { innerSubscription.context = context_4; subscription.add(innerSubscription); } this.destination.next(window_1); } } else { this.closeWindow(this.contexts.indexOf(outerValue)); } }; WindowToggleSubscriber.prototype.notifyError = function (err) { this.error(err); }; WindowToggleSubscriber.prototype.notifyComplete = function (inner) { if (inner !== this.openSubscription) { this.closeWindow(this.contexts.indexOf(inner.context)); } }; WindowToggleSubscriber.prototype.closeWindow = function (index) { if (index === -1) { return; } var contexts = this.contexts; var context = contexts[index]; var window = context.window, subscription = context.subscription; contexts.splice(index, 1); window.complete(); subscription.unsubscribe(); }; return WindowToggleSubscriber; }(__WEBPACK_IMPORTED_MODULE_4__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=windowToggle.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/windowWhen.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export windowWhen */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__("../../../../rxjs/_esm5/util/tryCatch.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._Subject,.._util_tryCatch,.._util_errorObject,.._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * Branch out the source Observable values as a nested Observable using a * factory function of closing Observables to determine when to start a new * window. * * It's like {@link bufferWhen}, but emits a nested * Observable instead of an array. * * * * Returns an Observable that emits windows of items it collects from the source * Observable. The output Observable emits connected, non-overlapping windows. * It emits the current window and opens a new one whenever the Observable * produced by the specified `closingSelector` function emits an item. The first * window is opened immediately when subscribing to the output Observable. * * @example Emit only the first two clicks events in every window of [1-5] random seconds * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks * .windowWhen(() => Rx.Observable.interval(1000 + Math.random() * 4000)) * .map(win => win.take(2)) // each window has at most 2 emissions * .mergeAll(); // flatten the Observable-of-Observables * result.subscribe(x => console.log(x)); * * @see {@link window} * @see {@link windowCount} * @see {@link windowTime} * @see {@link windowToggle} * @see {@link bufferWhen} * * @param {function(): Observable} closingSelector A function that takes no * arguments and returns an Observable that signals (on either `next` or * `complete`) when to close the previous window and start a new one. * @return {Observable>} An observable of windows, which in turn * are Observables. * @method windowWhen * @owner Observable */ function windowWhen(closingSelector) { return function windowWhenOperatorFunction(source) { return source.lift(new WindowOperator(closingSelector)); }; } var WindowOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function WindowOperator(closingSelector) { this.closingSelector = closingSelector; } WindowOperator.prototype.call = function (subscriber, source) { return source.subscribe(new WindowSubscriber(subscriber, this.closingSelector)); }; return WindowOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var WindowSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(WindowSubscriber, _super); function WindowSubscriber(destination, closingSelector) { var _this = _super.call(this, destination) || this; _this.destination = destination; _this.closingSelector = closingSelector; _this.openWindow(); return _this; } WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.openWindow(innerSub); }; WindowSubscriber.prototype.notifyError = function (error, innerSub) { this._error(error); }; WindowSubscriber.prototype.notifyComplete = function (innerSub) { this.openWindow(innerSub); }; WindowSubscriber.prototype._next = function (value) { this.window.next(value); }; WindowSubscriber.prototype._error = function (err) { this.window.error(err); this.destination.error(err); this.unsubscribeClosingNotification(); }; WindowSubscriber.prototype._complete = function () { this.window.complete(); this.destination.complete(); this.unsubscribeClosingNotification(); }; WindowSubscriber.prototype.unsubscribeClosingNotification = function () { if (this.closingNotification) { this.closingNotification.unsubscribe(); } }; WindowSubscriber.prototype.openWindow = function (innerSub) { if (innerSub === void 0) { innerSub = null; } if (innerSub) { this.remove(innerSub); innerSub.unsubscribe(); } var prevWindow = this.window; if (prevWindow) { prevWindow.complete(); } var window = this.window = new __WEBPACK_IMPORTED_MODULE_0__Subject__["a" /* Subject */](); this.destination.next(window); var closingNotifier = Object(__WEBPACK_IMPORTED_MODULE_1__util_tryCatch__["a" /* tryCatch */])(this.closingSelector)(); if (closingNotifier === __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */]) { var err = __WEBPACK_IMPORTED_MODULE_2__util_errorObject__["a" /* errorObject */].e; this.destination.error(err); this.window.error(err); } else { this.add(this.closingNotification = Object(__WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__["a" /* subscribeToResult */])(this, closingNotifier)); } }; return WindowSubscriber; }(__WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=windowWhen.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/withLatestFrom.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export withLatestFrom */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * Combines the source Observable with other Observables to create an Observable * whose values are calculated from the latest values of each, only when the * source emits. * * Whenever the source Observable emits a value, it * computes a formula using that value plus the latest values from other input * Observables, then emits the output of that formula. * * * * `withLatestFrom` combines each value from the source Observable (the * instance) with the latest values from the other input Observables only when * the source emits a value, optionally using a `project` function to determine * the value to be emitted on the output Observable. All input Observables must * emit at least one value before the output Observable will emit a value. * * @example On every click event, emit an array with the latest timer event plus the click event * var clicks = Rx.Observable.fromEvent(document, 'click'); * var timer = Rx.Observable.interval(1000); * var result = clicks.withLatestFrom(timer); * result.subscribe(x => console.log(x)); * * @see {@link combineLatest} * * @param {ObservableInput} other An input Observable to combine with the source * Observable. More than one input Observables may be given as argument. * @param {Function} [project] Projection function for combining values * together. Receives all values in order of the Observables passed, where the * first parameter is a value from the source Observable. (e.g. * `a.withLatestFrom(b, c, (a1, b1, c1) => a1 + b1 + c1)`). If this is not * passed, arrays will be emitted on the output Observable. * @return {Observable} An Observable of projected values from the most recent * values from each input Observable, or an array of the most recent values from * each input Observable. * @method withLatestFrom * @owner Observable */ function withLatestFrom() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return function (source) { var project; if (typeof args[args.length - 1] === 'function') { project = args.pop(); } var observables = args; return source.lift(new WithLatestFromOperator(observables, project)); }; } var WithLatestFromOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function WithLatestFromOperator(observables, project) { this.observables = observables; this.project = project; } WithLatestFromOperator.prototype.call = function (subscriber, source) { return source.subscribe(new WithLatestFromSubscriber(subscriber, this.observables, this.project)); }; return WithLatestFromOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var WithLatestFromSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(WithLatestFromSubscriber, _super); function WithLatestFromSubscriber(destination, observables, project) { var _this = _super.call(this, destination) || this; _this.observables = observables; _this.project = project; _this.toRespond = []; var len = observables.length; _this.values = new Array(len); for (var i = 0; i < len; i++) { _this.toRespond.push(i); } for (var i = 0; i < len; i++) { var observable = observables[i]; _this.add(Object(__WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__["a" /* subscribeToResult */])(_this, observable, observable, i)); } return _this; } WithLatestFromSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.values[outerIndex] = innerValue; var toRespond = this.toRespond; if (toRespond.length > 0) { var found = toRespond.indexOf(outerIndex); if (found !== -1) { toRespond.splice(found, 1); } } }; WithLatestFromSubscriber.prototype.notifyComplete = function () { // noop }; WithLatestFromSubscriber.prototype._next = function (value) { if (this.toRespond.length === 0) { var args = [value].concat(this.values); if (this.project) { this._tryProject(args); } else { this.destination.next(args); } } }; WithLatestFromSubscriber.prototype._tryProject = function (args) { var result; try { result = this.project.apply(this, args); } catch (err) { this.destination.error(err); return; } this.destination.next(result); }; return WithLatestFromSubscriber; }(__WEBPACK_IMPORTED_MODULE_0__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=withLatestFrom.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/zip.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export zip */ /* unused harmony export zipStatic */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ZipOperator; }); /* unused harmony export ZipSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_ArrayObservable__ = __webpack_require__("../../../../rxjs/_esm5/observable/ArrayObservable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/OuterSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__("../../../../rxjs/_esm5/util/subscribeToResult.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_iterator__ = __webpack_require__("../../../../rxjs/_esm5/symbol/iterator.js"); /** PURE_IMPORTS_START .._observable_ArrayObservable,.._util_isArray,.._Subscriber,.._OuterSubscriber,.._util_subscribeToResult,.._symbol_iterator PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* tslint:enable:max-line-length */ /** * @param observables * @return {Observable} * @method zip * @owner Observable */ function zip() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } return function zipOperatorFunction(source) { return source.lift.call(zipStatic.apply(void 0, [source].concat(observables))); }; } /* tslint:enable:max-line-length */ /** * Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each * of its input Observables. * * If the latest parameter is a function, this function is used to compute the created value from the input values. * Otherwise, an array of the input values is returned. * * @example Combine age and name from different sources * * let age$ = Observable.of(27, 25, 29); * let name$ = Observable.of('Foo', 'Bar', 'Beer'); * let isDev$ = Observable.of(true, true, false); * * Observable * .zip(age$, * name$, * isDev$, * (age: number, name: string, isDev: boolean) => ({ age, name, isDev })) * .subscribe(x => console.log(x)); * * // outputs * // { age: 27, name: 'Foo', isDev: true } * // { age: 25, name: 'Bar', isDev: true } * // { age: 29, name: 'Beer', isDev: false } * * @param observables * @return {Observable} * @static true * @name zip * @owner Observable */ function zipStatic() { var observables = []; for (var _i = 0; _i < arguments.length; _i++) { observables[_i] = arguments[_i]; } var project = observables[observables.length - 1]; if (typeof project === 'function') { observables.pop(); } return new __WEBPACK_IMPORTED_MODULE_0__observable_ArrayObservable__["a" /* ArrayObservable */](observables).lift(new ZipOperator(project)); } var ZipOperator = /*@__PURE__*/ (/*@__PURE__*/ function () { function ZipOperator(project) { this.project = project; } ZipOperator.prototype.call = function (subscriber, source) { return source.subscribe(new ZipSubscriber(subscriber, this.project)); }; return ZipOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ZipSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ZipSubscriber, _super); function ZipSubscriber(destination, project, values) { if (values === void 0) { values = Object.create(null); } var _this = _super.call(this, destination) || this; _this.iterators = []; _this.active = 0; _this.project = (typeof project === 'function') ? project : null; _this.values = values; return _this; } ZipSubscriber.prototype._next = function (value) { var iterators = this.iterators; if (Object(__WEBPACK_IMPORTED_MODULE_1__util_isArray__["a" /* isArray */])(value)) { iterators.push(new StaticArrayIterator(value)); } else if (typeof value[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]] === 'function') { iterators.push(new StaticIterator(value[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]]())); } else { iterators.push(new ZipBufferIterator(this.destination, this, value)); } }; ZipSubscriber.prototype._complete = function () { var iterators = this.iterators; var len = iterators.length; if (len === 0) { this.destination.complete(); return; } this.active = len; for (var i = 0; i < len; i++) { var iterator = iterators[i]; if (iterator.stillUnsubscribed) { this.add(iterator.subscribe(iterator, i)); } else { this.active--; // not an observable } } }; 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; // abort if not all of them have values 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(); // check to see if it's completed now that you've gotten // the next value. if (iterator.hasCompleted()) { shouldComplete = true; } if (result.done) { destination.complete(); return; } args.push(result.value); } if (this.project) { this._tryProject(args); } else { destination.next(args); } if (shouldComplete) { destination.complete(); } }; ZipSubscriber.prototype._tryProject = function (args) { var result; try { result = this.project.apply(this, args); } catch (err) { this.destination.error(err); return; } this.destination.next(result); }; return ZipSubscriber; }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */])); var StaticIterator = /*@__PURE__*/ (/*@__PURE__*/ 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 = /*@__PURE__*/ (/*@__PURE__*/ function () { function StaticArrayIterator(array) { this.array = array; this.index = 0; this.length = 0; this.length = array.length; } StaticArrayIterator.prototype[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* 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; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ZipBufferIterator = /*@__PURE__*/ (/*@__PURE__*/ 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[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]] = function () { return this; }; // NOTE: there is actually a name collision here with Subscriber.next and Iterator.next // this is legit because `next()` will never be called by a subscription in this case. 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 Object(__WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__["a" /* subscribeToResult */])(this, this.observable, this, index); }; return ZipBufferIterator; }(__WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__["a" /* OuterSubscriber */])); //# sourceMappingURL=zip.js.map /***/ }), /***/ "../../../../rxjs/_esm5/operators/zipAll.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export zipAll */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__zip__ = __webpack_require__("../../../../rxjs/_esm5/operators/zip.js"); /** PURE_IMPORTS_START ._zip PURE_IMPORTS_END */ function zipAll(project) { return function (source) { return source.lift(new __WEBPACK_IMPORTED_MODULE_0__zip__["a" /* ZipOperator */](project)); }; } //# sourceMappingURL=zipAll.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/Action.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Action; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /** PURE_IMPORTS_START .._Subscription PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * A unit of work to be executed in a {@link Scheduler}. An action is typically * created from within a Scheduler and an RxJS user does not need to concern * themselves about creating and manipulating an Action. * * ```ts * class Action extends Subscription { * new (scheduler: Scheduler, work: (state?: T) => void); * schedule(state?: T, delay: number = 0): Subscription; * } * ``` * * @class Action */ var Action = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(Action, _super); function Action(scheduler, work) { return _super.call(this) || this; } /** * Schedules this action on its parent Scheduler for execution. May be passed * some context object, `state`. May happen at some point in the future, * according to the `delay` parameter, if specified. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler. * @return {void} */ Action.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } return this; }; return Action; }(__WEBPACK_IMPORTED_MODULE_0__Subscription__["a" /* Subscription */])); //# sourceMappingURL=Action.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/AsyncAction.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AsyncAction; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Action__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/Action.js"); /** PURE_IMPORTS_START .._util_root,._Action PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var AsyncAction = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(AsyncAction, _super); function AsyncAction(scheduler, work) { var _this = _super.call(this, scheduler, work) || this; _this.scheduler = scheduler; _this.work = work; _this.pending = false; return _this; } AsyncAction.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } if (this.closed) { return this; } // Always replace the current state with the new state. this.state = state; var id = this.id; var scheduler = this.scheduler; // // Important implementation note: // // Actions only execute once by default, unless rescheduled from within the // scheduled callback. This allows us to implement single and repeat // actions via the same code path, without adding API surface area, as well // as mimic traditional recursion but across asynchronous boundaries. // // However, JS runtimes and timers distinguish between intervals achieved by // serial `setTimeout` calls vs. a single `setInterval` call. An interval of // serial `setTimeout` calls can be individually delayed, which delays // scheduling the next `setTimeout`, and so on. `setInterval` attempts to // guarantee the interval callback will be invoked more precisely to the // interval period, regardless of load. // // Therefore, we use `setInterval` to schedule single and repeat actions. // If the action reschedules itself with the same delay, the interval is not // canceled. If the action doesn't reschedule, or reschedules with a // different delay, the interval will be canceled after scheduled callback // execution. // if (id != null) { this.id = this.recycleAsyncId(scheduler, id, delay); } // Set the pending flag indicating that this action has been scheduled, or // has recursively rescheduled itself. this.pending = true; this.delay = delay; // If this action has already an async Id, don't request a new one. this.id = this.id || this.requestAsyncId(scheduler, this.id, delay); return this; }; AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) { if (delay === void 0) { delay = 0; } return __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].setInterval(scheduler.flush.bind(scheduler, this), delay); }; AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) { if (delay === void 0) { delay = 0; } // If this action is rescheduled with the same delay time, don't clear the interval id. if (delay !== null && this.delay === delay && this.pending === false) { return id; } // Otherwise, if the action's delay time is different from the current delay, // or the action has been rescheduled before it's executed, clear the interval id return __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].clearInterval(id) && undefined || undefined; }; /** * Immediately executes this action and the `work` it contains. * @return {any} */ AsyncAction.prototype.execute = function (state, delay) { if (this.closed) { return new Error('executing a cancelled action'); } this.pending = false; var error = this._execute(state, delay); if (error) { return error; } else if (this.pending === false && this.id != null) { // Dequeue if the action didn't reschedule itself. Don't call // unsubscribe(), because the action could reschedule later. // For example: // ``` // scheduler.schedule(function doWork(counter) { // /* ... I'm a busy worker bee ... */ // var originalAction = this; // /* wait 100ms before rescheduling the action */ // setTimeout(function () { // originalAction.schedule(counter + 1); // }, 100); // }, 1000); // ``` this.id = this.recycleAsyncId(this.scheduler, this.id, null); } }; AsyncAction.prototype._execute = function (state, delay) { var errored = false; var errorValue = undefined; try { this.work(state); } catch (e) { errored = true; errorValue = !!e && e || new Error(e); } if (errored) { this.unsubscribe(); return errorValue; } }; AsyncAction.prototype._unsubscribe = function () { var id = this.id; var scheduler = this.scheduler; var actions = scheduler.actions; var index = actions.indexOf(this); this.work = null; this.state = null; this.pending = false; this.scheduler = null; if (index !== -1) { actions.splice(index, 1); } if (id != null) { this.id = this.recycleAsyncId(scheduler, id, null); } this.delay = null; }; return AsyncAction; }(__WEBPACK_IMPORTED_MODULE_1__Action__["a" /* Action */])); //# sourceMappingURL=AsyncAction.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/AsyncScheduler.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AsyncScheduler; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Scheduler__ = __webpack_require__("../../../../rxjs/_esm5/Scheduler.js"); /** PURE_IMPORTS_START .._Scheduler PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var AsyncScheduler = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(AsyncScheduler, _super); function AsyncScheduler() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.actions = []; /** * A flag to indicate whether the Scheduler is currently executing a batch of * queued actions. * @type {boolean} */ _this.active = false; /** * An internal ID used to track the latest asynchronous task such as those * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and * others. * @type {any} */ _this.scheduled = undefined; return _this; } AsyncScheduler.prototype.flush = function (action) { var actions = this.actions; if (this.active) { actions.push(action); return; } var error; this.active = true; do { if (error = action.execute(action.state, action.delay)) { break; } } while (action = actions.shift()); // exhaust the scheduler queue this.active = false; if (error) { while (action = actions.shift()) { action.unsubscribe(); } throw error; } }; return AsyncScheduler; }(__WEBPACK_IMPORTED_MODULE_0__Scheduler__["a" /* Scheduler */])); //# sourceMappingURL=AsyncScheduler.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/QueueAction.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return QueueAction; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__AsyncAction__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/AsyncAction.js"); /** PURE_IMPORTS_START ._AsyncAction PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var QueueAction = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(QueueAction, _super); function QueueAction(scheduler, work) { var _this = _super.call(this, scheduler, work) || this; _this.scheduler = scheduler; _this.work = work; return _this; } QueueAction.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } if (delay > 0) { return _super.prototype.schedule.call(this, state, delay); } this.delay = delay; this.state = state; this.scheduler.flush(this); return this; }; QueueAction.prototype.execute = function (state, delay) { return (delay > 0 || this.closed) ? _super.prototype.execute.call(this, state, delay) : this._execute(state, delay); }; QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) { if (delay === void 0) { delay = 0; } // If delay exists and is greater than 0, or if the delay is null (the // action wasn't rescheduled) but was originally scheduled as an async // action, then recycle as an async action. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) { return _super.prototype.requestAsyncId.call(this, scheduler, id, delay); } // Otherwise flush the scheduler starting with this action. return scheduler.flush(this); }; return QueueAction; }(__WEBPACK_IMPORTED_MODULE_0__AsyncAction__["a" /* AsyncAction */])); //# sourceMappingURL=QueueAction.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/QueueScheduler.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return QueueScheduler; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__AsyncScheduler__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/AsyncScheduler.js"); /** PURE_IMPORTS_START ._AsyncScheduler PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var QueueScheduler = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(QueueScheduler, _super); function QueueScheduler() { return _super !== null && _super.apply(this, arguments) || this; } return QueueScheduler; }(__WEBPACK_IMPORTED_MODULE_0__AsyncScheduler__["a" /* AsyncScheduler */])); //# sourceMappingURL=QueueScheduler.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/async.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return async; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__AsyncAction__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/AsyncAction.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__AsyncScheduler__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/AsyncScheduler.js"); /** PURE_IMPORTS_START ._AsyncAction,._AsyncScheduler PURE_IMPORTS_END */ /** * * Async Scheduler * * Schedule task as if you used setTimeout(task, duration) * * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating * in intervals. * * If you just want to "defer" task, that is to perform it right after currently * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`), * better choice will be the {@link asap} scheduler. * * @example Use async scheduler to delay task * const task = () => console.log('it works!'); * * Rx.Scheduler.async.schedule(task, 2000); * * // After 2 seconds logs: * // "it works!" * * * @example Use async scheduler to repeat task in intervals * function task(state) { * console.log(state); * this.schedule(state + 1, 1000); // `this` references currently executing Action, * // which we reschedule with new state and delay * } * * Rx.Scheduler.async.schedule(task, 3000, 0); * * // Logs: * // 0 after 3s * // 1 after 4s * // 2 after 5s * // 3 after 6s * * @static true * @name async * @owner Scheduler */ var async = /*@__PURE__*/ new __WEBPACK_IMPORTED_MODULE_1__AsyncScheduler__["a" /* AsyncScheduler */](__WEBPACK_IMPORTED_MODULE_0__AsyncAction__["a" /* AsyncAction */]); //# sourceMappingURL=async.js.map /***/ }), /***/ "../../../../rxjs/_esm5/scheduler/queue.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return queue; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__QueueAction__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/QueueAction.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__QueueScheduler__ = __webpack_require__("../../../../rxjs/_esm5/scheduler/QueueScheduler.js"); /** PURE_IMPORTS_START ._QueueAction,._QueueScheduler PURE_IMPORTS_END */ /** * * Queue Scheduler * * Put every next task on a queue, instead of executing it immediately * * `queue` scheduler, when used with delay, behaves the same as {@link async} scheduler. * * When used without delay, it schedules given task synchronously - executes it right when * it is scheduled. However when called recursively, that is when inside the scheduled task, * another task is scheduled with queue scheduler, instead of executing immediately as well, * that task will be put on a queue and wait for current one to finish. * * This means that when you execute task with `queue` scheduler, you are sure it will end * before any other task scheduled with that scheduler will start. * * @examples Schedule recursively first, then do something * * Rx.Scheduler.queue.schedule(() => { * Rx.Scheduler.queue.schedule(() => console.log('second')); // will not happen now, but will be put on a queue * * console.log('first'); * }); * * // Logs: * // "first" * // "second" * * * @example Reschedule itself recursively * * Rx.Scheduler.queue.schedule(function(state) { * if (state !== 0) { * console.log('before', state); * this.schedule(state - 1); // `this` references currently executing Action, * // which we reschedule with new state * console.log('after', state); * } * }, 0, 3); * * // In scheduler that runs recursively, you would expect: * // "before", 3 * // "before", 2 * // "before", 1 * // "after", 1 * // "after", 2 * // "after", 3 * * // But with queue it logs: * // "before", 3 * // "after", 3 * // "before", 2 * // "after", 2 * // "before", 1 * // "after", 1 * * * @static true * @name queue * @owner Scheduler */ var queue = /*@__PURE__*/ new __WEBPACK_IMPORTED_MODULE_1__QueueScheduler__["a" /* QueueScheduler */](__WEBPACK_IMPORTED_MODULE_0__QueueAction__["a" /* QueueAction */]); //# sourceMappingURL=queue.js.map /***/ }), /***/ "../../../../rxjs/_esm5/symbol/iterator.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export symbolIteratorPonyfill */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return iterator; }); /* unused harmony export $$iterator */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */ function symbolIteratorPonyfill(root) { var Symbol = root.Symbol; if (typeof Symbol === 'function') { if (!Symbol.iterator) { Symbol.iterator = Symbol('iterator polyfill'); } return Symbol.iterator; } else { // [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC) var Set_1 = root.Set; if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') { return '@@iterator'; } var Map_1 = root.Map; // required for compatability with es6-shim if (Map_1) { var keys = Object.getOwnPropertyNames(Map_1.prototype); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; // according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal. if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) { return key; } } } return '@@iterator'; } } var iterator = /*@__PURE__*/ symbolIteratorPonyfill(__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */]); /** * @deprecated use iterator instead */ var $$iterator = iterator; //# sourceMappingURL=iterator.js.map /***/ }), /***/ "../../../../rxjs/_esm5/symbol/observable.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export getSymbolObservable */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return observable; }); /* unused harmony export $$observable */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */ function getSymbolObservable(context) { var $$observable; var Symbol = context.Symbol; if (typeof Symbol === 'function') { if (Symbol.observable) { $$observable = Symbol.observable; } else { $$observable = Symbol('observable'); Symbol.observable = $$observable; } } else { $$observable = '@@observable'; } return $$observable; } var observable = /*@__PURE__*/ getSymbolObservable(__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */]); /** * @deprecated use observable instead */ var $$observable = observable; //# sourceMappingURL=observable.js.map /***/ }), /***/ "../../../../rxjs/_esm5/symbol/rxSubscriber.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return rxSubscriber; }); /* unused harmony export $$rxSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */ var Symbol = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Symbol; var rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? /*@__PURE__*/ Symbol.for('rxSubscriber') : '@@rxSubscriber'; /** * @deprecated use rxSubscriber instead */ var $$rxSubscriber = rxSubscriber; //# sourceMappingURL=rxSubscriber.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/ArgumentOutOfRangeError.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArgumentOutOfRangeError; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * An error thrown when an element was queried at a certain index of an * Observable, but no such index or position exists in that sequence. * * @see {@link elementAt} * @see {@link take} * @see {@link takeLast} * * @class ArgumentOutOfRangeError */ var ArgumentOutOfRangeError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ArgumentOutOfRangeError, _super); function ArgumentOutOfRangeError() { var _this = this; var err = _this = _super.call(this, 'argument out of range') || this; _this.name = err.name = 'ArgumentOutOfRangeError'; _this.stack = err.stack; _this.message = err.message; return _this; } return ArgumentOutOfRangeError; }(Error)); //# sourceMappingURL=ArgumentOutOfRangeError.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/EmptyError.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EmptyError; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * An error thrown when an Observable or a sequence was queried but has no * elements. * * @see {@link first} * @see {@link last} * @see {@link single} * * @class EmptyError */ var EmptyError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(EmptyError, _super); function EmptyError() { var _this = this; var err = _this = _super.call(this, 'no elements in sequence') || this; _this.name = err.name = 'EmptyError'; _this.stack = err.stack; _this.message = err.message; return _this; } return EmptyError; }(Error)); //# sourceMappingURL=EmptyError.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/FastMap.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FastMap; }); var FastMap = /*@__PURE__*/ (/*@__PURE__*/ function () { function FastMap() { this.values = {}; } FastMap.prototype.delete = function (key) { this.values[key] = null; return true; }; FastMap.prototype.set = function (key, value) { this.values[key] = value; return this; }; FastMap.prototype.get = function (key) { return this.values[key]; }; FastMap.prototype.forEach = function (cb, thisArg) { var values = this.values; for (var key in values) { if (values.hasOwnProperty(key) && values[key] !== null) { cb.call(thisArg, values[key], key); } } }; FastMap.prototype.clear = function () { this.values = {}; }; return FastMap; }()); //# sourceMappingURL=FastMap.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/Map.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Map; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__MapPolyfill__ = __webpack_require__("../../../../rxjs/_esm5/util/MapPolyfill.js"); /** PURE_IMPORTS_START ._root,._MapPolyfill PURE_IMPORTS_END */ var Map = __WEBPACK_IMPORTED_MODULE_0__root__["a" /* root */].Map || /*@__PURE__*/ (function () { return __WEBPACK_IMPORTED_MODULE_1__MapPolyfill__["a" /* MapPolyfill */]; })(); //# sourceMappingURL=Map.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/MapPolyfill.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MapPolyfill; }); var MapPolyfill = /*@__PURE__*/ (/*@__PURE__*/ function () { function MapPolyfill() { this.size = 0; this._values = []; this._keys = []; } MapPolyfill.prototype.get = function (key) { var i = this._keys.indexOf(key); return i === -1 ? undefined : this._values[i]; }; MapPolyfill.prototype.set = function (key, value) { var i = this._keys.indexOf(key); if (i === -1) { this._keys.push(key); this._values.push(value); this.size++; } else { this._values[i] = value; } return this; }; MapPolyfill.prototype.delete = function (key) { var i = this._keys.indexOf(key); if (i === -1) { return false; } this._values.splice(i, 1); this._keys.splice(i, 1); this.size--; return true; }; MapPolyfill.prototype.clear = function () { this._keys.length = 0; this._values.length = 0; this.size = 0; }; MapPolyfill.prototype.forEach = function (cb, thisArg) { for (var i = 0; i < this.size; i++) { cb.call(thisArg, this._values[i], this._keys[i]); } }; return MapPolyfill; }()); //# sourceMappingURL=MapPolyfill.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/ObjectUnsubscribedError.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ObjectUnsubscribedError; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * An error thrown when an action is invalid because the object has been * unsubscribed. * * @see {@link Subject} * @see {@link BehaviorSubject} * * @class ObjectUnsubscribedError */ var ObjectUnsubscribedError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(ObjectUnsubscribedError, _super); function ObjectUnsubscribedError() { var _this = this; var err = _this = _super.call(this, 'object unsubscribed') || this; _this.name = err.name = 'ObjectUnsubscribedError'; _this.stack = err.stack; _this.message = err.message; return _this; } return ObjectUnsubscribedError; }(Error)); //# sourceMappingURL=ObjectUnsubscribedError.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/Set.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export minimalSetImpl */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Set; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /** PURE_IMPORTS_START ._root PURE_IMPORTS_END */ function minimalSetImpl() { // THIS IS NOT a full impl of Set, this is just the minimum // bits of functionality we need for this library. return /** @class */ (function () { function MinimalSet() { this._values = []; } MinimalSet.prototype.add = function (value) { if (!this.has(value)) { this._values.push(value); } }; MinimalSet.prototype.has = function (value) { return this._values.indexOf(value) !== -1; }; Object.defineProperty(MinimalSet.prototype, "size", { get: function () { return this._values.length; }, enumerable: true, configurable: true }); MinimalSet.prototype.clear = function () { this._values.length = 0; }; return MinimalSet; }()); } var Set = __WEBPACK_IMPORTED_MODULE_0__root__["a" /* root */].Set || /*@__PURE__*/ minimalSetImpl(); //# sourceMappingURL=Set.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/TimeoutError.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TimeoutError; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * An error thrown when duetime elapses. * * @see {@link timeout} * * @class TimeoutError */ var TimeoutError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(TimeoutError, _super); function TimeoutError() { var _this = this; var err = _this = _super.call(this, 'Timeout has occurred') || this; _this.name = err.name = 'TimeoutError'; _this.stack = err.stack; _this.message = err.message; return _this; } return TimeoutError; }(Error)); //# sourceMappingURL=TimeoutError.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/UnsubscriptionError.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnsubscriptionError; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var __extends = (this && this.__extends) || /*@__PURE__*/ (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * An error thrown when one or more errors have occurred during the * `unsubscribe` of a {@link Subscription}. */ var UnsubscriptionError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) { __extends(UnsubscriptionError, _super); function UnsubscriptionError(errors) { var _this = _super.call(this) || this; _this.errors = errors; var err = Error.call(_this, errors ? errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : ''); _this.name = err.name = 'UnsubscriptionError'; _this.stack = err.stack; _this.message = err.message; return _this; } return UnsubscriptionError; }(Error)); //# sourceMappingURL=UnsubscriptionError.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/errorObject.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return errorObject; }); // typeof any so that it we don't have to cast when comparing a result to the error object /** PURE_IMPORTS_START PURE_IMPORTS_END */ var errorObject = { e: {} }; //# sourceMappingURL=errorObject.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/identity.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = identity; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function identity(x) { return x; } //# sourceMappingURL=identity.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isArray.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isArray; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); //# sourceMappingURL=isArray.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isArrayLike.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isArrayLike; }); /** PURE_IMPORTS_START PURE_IMPORTS_END */ var isArrayLike = (function (x) { return x && typeof x.length === 'number'; }); //# sourceMappingURL=isArrayLike.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isDate.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isDate; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isDate(value) { return value instanceof Date && !isNaN(+value); } //# sourceMappingURL=isDate.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isFunction.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isFunction; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isFunction(x) { return typeof x === 'function'; } //# sourceMappingURL=isFunction.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isNumeric.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isNumeric; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("../../../../rxjs/_esm5/util/isArray.js"); /** PURE_IMPORTS_START .._util_isArray PURE_IMPORTS_END */ function isNumeric(val) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) return !Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(val) && (val - parseFloat(val) + 1) >= 0; } ; //# sourceMappingURL=isNumeric.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isObject.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isObject; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isObject(x) { return x != null && typeof x === 'object'; } //# sourceMappingURL=isObject.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isPromise.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isPromise; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isPromise(value) { return value && typeof value.subscribe !== 'function' && typeof value.then === 'function'; } //# sourceMappingURL=isPromise.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/isScheduler.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = isScheduler; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function isScheduler(value) { return value && typeof value.schedule === 'function'; } //# sourceMappingURL=isScheduler.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/noop.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = noop; /* tslint:disable:no-empty */ /** PURE_IMPORTS_START PURE_IMPORTS_END */ function noop() { } //# sourceMappingURL=noop.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/not.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = not; /** PURE_IMPORTS_START PURE_IMPORTS_END */ function not(pred, thisArg) { function notPred() { return !(notPred.pred.apply(notPred.thisArg, arguments)); } notPred.pred = pred; notPred.thisArg = thisArg; return notPred; } //# sourceMappingURL=not.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/pipe.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = pipe; /* harmony export (immutable) */ __webpack_exports__["b"] = pipeFromArray; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop__ = __webpack_require__("../../../../rxjs/_esm5/util/noop.js"); /** PURE_IMPORTS_START ._noop PURE_IMPORTS_END */ /* tslint:enable:max-line-length */ function pipe() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i] = arguments[_i]; } return pipeFromArray(fns); } /* @internal */ function pipeFromArray(fns) { if (!fns) { return __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* noop */]; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function (prev, fn) { return fn(prev); }, input); }; } //# sourceMappingURL=pipe.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/root.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _root; }); // CommonJS / Node have global context exposed as "global" variable. // We don't want to include the whole node.d.ts this this compilation unit so we'll just fake // the global "global" var for now. /** PURE_IMPORTS_START PURE_IMPORTS_END */ var __window = typeof window !== 'undefined' && window; var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self; var __global = typeof global !== 'undefined' && global; var _root = __window || __global || __self; // Workaround Closure Compiler restriction: The body of a goog.module cannot use throw. // This is needed when used with angular/tsickle which inserts a goog.module statement. // Wrap in IIFE /*@__PURE__*/ (function () { if (!_root) { throw new Error('RxJS could not find any global context (window, self, global)'); } })(); //# sourceMappingURL=root.js.map /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("../../../../webpack/buildin/global.js"))) /***/ }), /***/ "../../../../rxjs/_esm5/util/subscribeToResult.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = subscribeToResult; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__root__ = __webpack_require__("../../../../rxjs/_esm5/util/root.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike__ = __webpack_require__("../../../../rxjs/_esm5/util/isArrayLike.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isPromise__ = __webpack_require__("../../../../rxjs/_esm5/util/isPromise.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isObject__ = __webpack_require__("../../../../rxjs/_esm5/util/isObject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Observable__ = __webpack_require__("../../../../rxjs/_esm5/Observable.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_iterator__ = __webpack_require__("../../../../rxjs/_esm5/symbol/iterator.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/InnerSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__symbol_observable__ = __webpack_require__("../../../../rxjs/_esm5/symbol/observable.js"); /** PURE_IMPORTS_START ._root,._isArrayLike,._isPromise,._isObject,.._Observable,.._symbol_iterator,.._InnerSubscriber,.._symbol_observable PURE_IMPORTS_END */ function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) { var destination = new __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex); if (destination.closed) { return null; } if (result instanceof __WEBPACK_IMPORTED_MODULE_4__Observable__["a" /* Observable */]) { if (result._isScalar) { destination.next(result.value); destination.complete(); return null; } else { destination.syncErrorThrowable = true; return result.subscribe(destination); } } else if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike__["a" /* isArrayLike */])(result)) { for (var i = 0, len = result.length; i < len && !destination.closed; i++) { destination.next(result[i]); } if (!destination.closed) { destination.complete(); } } else if (Object(__WEBPACK_IMPORTED_MODULE_2__isPromise__["a" /* isPromise */])(result)) { result.then(function (value) { if (!destination.closed) { destination.next(value); destination.complete(); } }, function (err) { return destination.error(err); }) .then(null, function (err) { // Escaping the Promise trap: globally throw unhandled errors __WEBPACK_IMPORTED_MODULE_0__root__["a" /* root */].setTimeout(function () { throw err; }); }); return destination; } else if (result && typeof result[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]] === 'function') { var iterator = result[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]](); do { var item = iterator.next(); if (item.done) { destination.complete(); break; } destination.next(item.value); if (destination.closed) { break; } } while (true); } else if (result && typeof result[__WEBPACK_IMPORTED_MODULE_7__symbol_observable__["a" /* observable */]] === 'function') { var obs = result[__WEBPACK_IMPORTED_MODULE_7__symbol_observable__["a" /* observable */]](); if (typeof obs.subscribe !== 'function') { destination.error(new TypeError('Provided object does not correctly implement Symbol.observable')); } else { return obs.subscribe(new __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex)); } } else { var value = Object(__WEBPACK_IMPORTED_MODULE_3__isObject__["a" /* isObject */])(result) ? 'an invalid object' : "'" + result + "'"; var msg = "You provided " + value + " where a stream was expected." + ' You can provide an Observable, Promise, Array, or Iterable.'; destination.error(new TypeError(msg)); } return null; } //# sourceMappingURL=subscribeToResult.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/toSubscriber.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = toSubscriber; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("../../../../rxjs/_esm5/Subscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__ = __webpack_require__("../../../../rxjs/_esm5/symbol/rxSubscriber.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__("../../../../rxjs/_esm5/Observer.js"); /** PURE_IMPORTS_START .._Subscriber,.._symbol_rxSubscriber,.._Observer PURE_IMPORTS_END */ function toSubscriber(nextOrObserver, error, complete) { if (nextOrObserver) { if (nextOrObserver instanceof __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]) { return nextOrObserver; } if (nextOrObserver[__WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__["a" /* rxSubscriber */]]) { return nextOrObserver[__WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__["a" /* rxSubscriber */]](); } } if (!nextOrObserver && !error && !complete) { return new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](__WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]); } return new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](nextOrObserver, error, complete); } //# sourceMappingURL=toSubscriber.js.map /***/ }), /***/ "../../../../rxjs/_esm5/util/tryCatch.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = tryCatch; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__errorObject__ = __webpack_require__("../../../../rxjs/_esm5/util/errorObject.js"); /** PURE_IMPORTS_START ._errorObject PURE_IMPORTS_END */ var tryCatchTarget; function tryCatcher() { try { return tryCatchTarget.apply(this, arguments); } catch (e) { __WEBPACK_IMPORTED_MODULE_0__errorObject__["a" /* errorObject */].e = e; return __WEBPACK_IMPORTED_MODULE_0__errorObject__["a" /* errorObject */]; } } function tryCatch(fn) { tryCatchTarget = fn; return tryCatcher; } ; //# sourceMappingURL=tryCatch.js.map /***/ }), /***/ "../../../../sdp-transform/lib/grammar.js": /***/ (function(module, exports) { var grammar = module.exports = { v: [{ name: 'version', reg: /^(\d*)$/ }], o: [{ //o=- 20518 0 IN IP4 203.0.113.1 // NB: sessionId will be a String in most cases because it is huge name: 'origin', reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/, names: ['username', 'sessionId', 'sessionVersion', 'netType', 'ipVer', 'address'], format: "%s %s %d %s IP%d %s" }], // default parsing of these only (though some of these feel outdated) s: [{ name: 'name' }], i: [{ name: 'description' }], u: [{ name: 'uri' }], e: [{ name: 'email' }], p: [{ name: 'phone' }], z: [{ name: 'timezones' }], // TODO: this one can actually be parsed properly.. r: [{ name: 'repeats' }], // TODO: this one can also be parsed properly //k: [{}], // outdated thing ignored t: [{ //t=0 0 name: 'timing', reg: /^(\d*) (\d*)/, names: ['start', 'stop'], format: "%d %d" }], c: [{ //c=IN IP4 10.47.197.26 name: 'connection', reg: /^IN IP(\d) (\S*)/, names: ['version', 'ip'], format: "IN IP%d %s" }], b: [{ //b=AS:4000 push: 'bandwidth', reg: /^(TIAS|AS|CT|RR|RS):(\d*)/, names: ['type', 'limit'], format: "%s:%s" }], m: [{ //m=video 51744 RTP/AVP 126 97 98 34 31 // NB: special - pushes to session // TODO: rtp/fmtp should be filtered by the payloads found here? reg: /^(\w*) (\d*) ([\w\/]*)(?: (.*))?/, names: ['type', 'port', 'protocol', 'payloads'], format: "%s %d %s %s" }], a: [ { //a=rtpmap:110 opus/48000/2 push: 'rtp', reg: /^rtpmap:(\d*) ([\w\-]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/, names: ['payload', 'codec', 'rate', 'encoding'], format: function (o) { return (o.encoding) ? "rtpmap:%d %s/%s/%s": o.rate ? "rtpmap:%d %s/%s": "rtpmap:%d %s"; } }, { //a=fmtp:108 profile-level-id=24;object=23;bitrate=64000 //a=fmtp:111 minptime=10; useinbandfec=1 push: 'fmtp', reg: /^fmtp:(\d*) ([\S| ]*)/, names: ['payload', 'config'], format: "fmtp:%d %s" }, { //a=control:streamid=0 name: 'control', reg: /^control:(.*)/, format: "control:%s" }, { //a=rtcp:65179 IN IP4 193.84.77.194 name: 'rtcp', reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/, names: ['port', 'netType', 'ipVer', 'address'], format: function (o) { return (o.address != null) ? "rtcp:%d %s IP%d %s": "rtcp:%d"; } }, { //a=rtcp-fb:98 trr-int 100 push: 'rtcpFbTrrInt', reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/, names: ['payload', 'value'], format: "rtcp-fb:%d trr-int %d" }, { //a=rtcp-fb:98 nack rpsi push: 'rtcpFb', reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/, names: ['payload', 'type', 'subtype'], format: function (o) { return (o.subtype != null) ? "rtcp-fb:%s %s %s": "rtcp-fb:%s %s"; } }, { //a=extmap:2 urn:ietf:params:rtp-hdrext:toffset //a=extmap:1/recvonly URI-gps-string push: 'ext', reg: /^extmap:([\w_\/]*) (\S*)(?: (\S*))?/, names: ['value', 'uri', 'config'], // value may include "/direction" suffix format: function (o) { return (o.config != null) ? "extmap:%s %s %s": "extmap:%s %s"; } }, { //a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32 push: 'crypto', reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/, names: ['id', 'suite', 'config', 'sessionConfig'], format: function (o) { return (o.sessionConfig != null) ? "crypto:%d %s %s %s": "crypto:%d %s %s"; } }, { //a=setup:actpass name: 'setup', reg: /^setup:(\w*)/, format: "setup:%s" }, { //a=mid:1 name: 'mid', reg: /^mid:([^\s]*)/, format: "mid:%s" }, { //a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a name: 'msid', reg: /^msid:(.*)/, format: "msid:%s" }, { //a=ptime:20 name: 'ptime', reg: /^ptime:(\d*)/, format: "ptime:%d" }, { //a=maxptime:60 name: 'maxptime', reg: /^maxptime:(\d*)/, format: "maxptime:%d" }, { //a=sendrecv name: 'direction', reg: /^(sendrecv|recvonly|sendonly|inactive)/ }, { //a=ice-lite name: 'icelite', reg: /^(ice-lite)/ }, { //a=ice-ufrag:F7gI name: 'iceUfrag', reg: /^ice-ufrag:(\S*)/, format: "ice-ufrag:%s" }, { //a=ice-pwd:x9cml/YzichV2+XlhiMu8g name: 'icePwd', reg: /^ice-pwd:(\S*)/, format: "ice-pwd:%s" }, { //a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33 name: 'fingerprint', reg: /^fingerprint:(\S*) (\S*)/, names: ['type', 'hash'], format: "fingerprint:%s %s" }, { //a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host //a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0 //a=candidate:3289912957 2 udp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 generation 0 //a=candidate:229815620 1 tcp 1518280447 192.168.150.19 60017 typ host tcptype active generation 0 //a=candidate:3289912957 2 tcp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 tcptype passive generation 0 push:'candidates', reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?/, names: ['foundation', 'component', 'transport', 'priority', 'ip', 'port', 'type', 'raddr', 'rport', 'tcptype', 'generation'], format: function (o) { var str = "candidate:%s %d %s %d %s %d typ %s"; str += (o.raddr != null) ? " raddr %s rport %d" : "%v%v"; // NB: candidate has three optional chunks, so %void middles one if it's missing str += (o.tcptype != null) ? " tcptype %s" : "%v"; if (o.generation != null) { str += " generation %d"; } return str; } }, { //a=end-of-candidates (keep after the candidates line for readability) name: 'endOfCandidates', reg: /^(end-of-candidates)/ }, { //a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ... name: 'remoteCandidates', reg: /^remote-candidates:(.*)/, format: "remote-candidates:%s" }, { //a=ice-options:google-ice name: 'iceOptions', reg: /^ice-options:(\S*)/, format: "ice-options:%s" }, { //a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1 push: "ssrcs", reg: /^ssrc:(\d*) ([\w_]*):(.*)/, names: ['id', 'attribute', 'value'], format: "ssrc:%d %s:%s" }, { //a=ssrc-group:FEC 1 2 push: "ssrcGroups", reg: /^ssrc-group:(\w*) (.*)/, names: ['semantics', 'ssrcs'], format: "ssrc-group:%s %s" }, { //a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV name: "msidSemantic", reg: /^msid-semantic:\s?(\w*) (\S*)/, names: ['semantic', 'token'], format: "msid-semantic: %s %s" // space after ":" is not accidental }, { //a=group:BUNDLE audio video push: 'groups', reg: /^group:(\w*) (.*)/, names: ['type', 'mids'], format: "group:%s %s" }, { //a=rtcp-mux name: 'rtcpMux', reg: /^(rtcp-mux)/ }, { //a=rtcp-rsize name: 'rtcpRsize', reg: /^(rtcp-rsize)/ }, { // any a= that we don't understand is kepts verbatim on media.invalid push: 'invalid', names: ["value"] } ] }; // set sensible defaults to avoid polluting the grammar with boring details Object.keys(grammar).forEach(function (key) { var objs = grammar[key]; objs.forEach(function (obj) { if (!obj.reg) { obj.reg = /(.*)/; } if (!obj.format) { obj.format = "%s"; } }); }); /***/ }), /***/ "../../../../sdp-transform/lib/index.js": /***/ (function(module, exports, __webpack_require__) { var parser = __webpack_require__("../../../../sdp-transform/lib/parser.js"); var writer = __webpack_require__("../../../../sdp-transform/lib/writer.js"); exports.write = writer; exports.parse = parser.parse; exports.parseFmtpConfig = parser.parseFmtpConfig; exports.parsePayloads = parser.parsePayloads; exports.parseRemoteCandidates = parser.parseRemoteCandidates; /***/ }), /***/ "../../../../sdp-transform/lib/parser.js": /***/ (function(module, exports, __webpack_require__) { var toIntIfInt = function (v) { return String(Number(v)) === v ? Number(v) : v; }; var attachProperties = function (match, location, names, rawName) { if (rawName && !names) { location[rawName] = toIntIfInt(match[1]); } else { for (var i = 0; i < names.length; i += 1) { if (match[i+1] != null) { location[names[i]] = toIntIfInt(match[i+1]); } } } }; var parseReg = function (obj, location, content) { var needsBlank = obj.name && obj.names; if (obj.push && !location[obj.push]) { location[obj.push] = []; } else if (needsBlank && !location[obj.name]) { location[obj.name] = {}; } var keyLocation = obj.push ? {} : // blank object that will be pushed needsBlank ? location[obj.name] : location; // otherwise, named location or root attachProperties(content.match(obj.reg), keyLocation, obj.names, obj.name); if (obj.push) { location[obj.push].push(keyLocation); } }; var grammar = __webpack_require__("../../../../sdp-transform/lib/grammar.js"); var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/); exports.parse = function (sdp) { var session = {} , media = [] , location = session; // points at where properties go under (one of the above) // parse lines we understand sdp.split(/(\r\n|\r|\n)/).filter(validLine).forEach(function (l) { var type = l[0]; var content = l.slice(2); if (type === 'm') { media.push({rtp: [], fmtp: []}); location = media[media.length-1]; // point at latest media line } for (var j = 0; j < (grammar[type] || []).length; j += 1) { var obj = grammar[type][j]; if (obj.reg.test(content)) { return parseReg(obj, location, content); } } }); session.media = media; // link it up return session; }; var fmtpReducer = function (acc, expr) { var s = expr.split('='); if (s.length === 2) { acc[s[0]] = toIntIfInt(s[1]); } return acc; }; exports.parseFmtpConfig = function (str) { return str.split(/\;\s?/).reduce(fmtpReducer, {}); }; exports.parsePayloads = function (str) { return str.split(' ').map(Number); }; exports.parseRemoteCandidates = function (str) { var candidates = []; var parts = str.split(' ').map(toIntIfInt); for (var i = 0; i < parts.length; i += 3) { candidates.push({ component: parts[i], ip: parts[i + 1], port: parts[i + 2] }); } return candidates; }; /***/ }), /***/ "../../../../sdp-transform/lib/writer.js": /***/ (function(module, exports, __webpack_require__) { var grammar = __webpack_require__("../../../../sdp-transform/lib/grammar.js"); // customized util.format - discards excess arguments and can void middle ones var formatRegExp = /%[sdv%]/g; var format = function (formatStr) { var i = 1; var args = arguments; var len = args.length; return formatStr.replace(formatRegExp, function (x) { if (i >= len) { return x; // missing argument } var arg = args[i]; i += 1; switch (x) { case '%%': return '%'; case '%s': return String(arg); case '%d': return Number(arg); case '%v': return ''; } }); // NB: we discard excess arguments - they are typically undefined from makeLine }; var makeLine = function (type, obj, location) { var str = obj.format instanceof Function ? (obj.format(obj.push ? location : location[obj.name])) : obj.format; var args = [type + '=' + str]; if (obj.names) { for (var i = 0; i < obj.names.length; i += 1) { var n = obj.names[i]; if (obj.name) { args.push(location[obj.name][n]); } else { // for mLine and push attributes args.push(location[obj.names[i]]); } } } else { args.push(location[obj.name]); } return format.apply(null, args); }; // RFC specified order // TODO: extend this with all the rest var defaultOuterOrder = [ 'v', 'o', 's', 'i', 'u', 'e', 'p', 'c', 'b', 't', 'r', 'z', 'a' ]; var defaultInnerOrder = ['i', 'c', 'b', 'a']; module.exports = function (session, opts) { opts = opts || {}; // ensure certain properties exist if (session.version == null) { session.version = 0; // "v=0" must be there (only defined version atm) } if (session.name == null) { session.name = " "; // "s= " must be there if no meaningful name set } session.media.forEach(function (mLine) { if (mLine.payloads == null) { mLine.payloads = ""; } }); var outerOrder = opts.outerOrder || defaultOuterOrder; var innerOrder = opts.innerOrder || defaultInnerOrder; var sdp = []; // loop through outerOrder for matching properties on session outerOrder.forEach(function (type) { grammar[type].forEach(function (obj) { if (obj.name in session && session[obj.name] != null) { sdp.push(makeLine(type, obj, session)); } else if (obj.push in session && session[obj.push] != null) { session[obj.push].forEach(function (el) { sdp.push(makeLine(type, obj, el)); }); } }); }); // then for each media line, follow the innerOrder session.media.forEach(function (mLine) { sdp.push(makeLine('m', grammar.m[0], mLine)); innerOrder.forEach(function (type) { grammar[type].forEach(function (obj) { if (obj.name in mLine && mLine[obj.name] != null) { sdp.push(makeLine(type, obj, mLine)); } else if (obj.push in mLine && mLine[obj.push] != null) { mLine[obj.push].forEach(function (el) { sdp.push(makeLine(type, obj, el)); }); } }); }); }); return sdp.join('\r\n') + '\r\n'; }; /***/ }), /***/ "../../../../sdp-translator/lib/array-equals.js": /***/ (function(module, exports) { /* Copyright @ 2015 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ module.exports = function arrayEquals(array) { // if the other array is a falsy value, return if (!array) return false; // compare lengths - can save a lot of time if (this.length != array.length) return false; for (var i = 0, l = this.length; i < l; i++) { // Check if we have nested arrays if (this[i] instanceof Array && array[i] instanceof Array) { // recurse into the nested arrays if (!arrayEquals.apply(this[i], [array[i]])) return false; } else if (this[i] != array[i]) { // Warning - two different object instances will never be equal: // {x:20} != {x:20} return false; } } return true; }; /***/ }), /***/ "../../../../sdp-translator/lib/index.js": /***/ (function(module, exports, __webpack_require__) { /* Copyright @ 2015 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ exports.Interop = __webpack_require__("../../../../sdp-translator/lib/interop.js"); /***/ }), /***/ "../../../../sdp-translator/lib/interop.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* Copyright @ 2015 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* global RTCSessionDescription */ /* global RTCIceCandidate */ /* jshint -W097 */ var transform = __webpack_require__("../../../../sdp-translator/lib/transform.js"); var arrayEquals = __webpack_require__("../../../../sdp-translator/lib/array-equals.js"); function Interop() { /** * This map holds the most recent Unified Plan offer/answer SDP that was * converted to Plan B, with the SDP type ('offer' or 'answer') as keys and * the SDP string as values. * * @type {{}} */ this.cache = { mlB2UMap : {}, mlU2BMap : {} }; } module.exports = Interop; /** * Changes the candidate args to match with the related Unified Plan */ Interop.prototype.candidateToUnifiedPlan = function(candidate) { var cand = new RTCIceCandidate(candidate); cand.sdpMLineIndex = this.cache.mlB2UMap[cand.sdpMLineIndex]; /* TODO: change sdpMid to (audio|video)-SSRC */ return cand; }; /** * Changes the candidate args to match with the related Plan B */ Interop.prototype.candidateToPlanB = function(candidate) { var cand = new RTCIceCandidate(candidate); if (cand.sdpMid.indexOf('audio') === 0) { cand.sdpMid = 'audio'; } else if (cand.sdpMid.indexOf('video') === 0) { cand.sdpMid = 'video'; } else { throw new Error('candidate with ' + cand.sdpMid + ' not allowed'); } cand.sdpMLineIndex = this.cache.mlU2BMap[cand.sdpMLineIndex]; return cand; }; /** * Returns the index of the first m-line with the given media type and with a * direction which allows sending, in the last Unified Plan description with * type "answer" converted to Plan B. Returns {null} if there is no saved * answer, or if none of its m-lines with the given type allow sending. * @param type the media type ("audio" or "video"). * @returns {*} */ Interop.prototype.getFirstSendingIndexFromAnswer = function(type) { if (!this.cache.answer) { return null; } var session = transform.parse(this.cache.answer); if (session && session.media && Array.isArray(session.media)){ for (var i = 0; i < session.media.length; i++) { if (session.media[i].type == type && (!session.media[i].direction /* default to sendrecv */ || session.media[i].direction === 'sendrecv' || session.media[i].direction === 'sendonly')){ return i; } } } return null; }; /** * This method transforms a Unified Plan SDP to an equivalent Plan B SDP. A * PeerConnection wrapper transforms the SDP to Plan B before passing it to the * application. * * @param desc * @returns {*} */ Interop.prototype.toPlanB = function(desc) { var self = this; //#region Preliminary input validation. if (typeof desc !== 'object' || desc === null || typeof desc.sdp !== 'string') { console.warn('An empty description was passed as an argument.'); return desc; } // Objectify the SDP for easier manipulation. var session = transform.parse(desc.sdp); // If the SDP contains no media, there's nothing to transform. if (typeof session.media === 'undefined' || !Array.isArray(session.media) || session.media.length === 0) { console.warn('The description has no media.'); return desc; } // Try some heuristics to "make sure" this is a Unified Plan SDP. Plan B // SDP has a video, an audio and a data "channel" at most. if (session.media.length <= 3 && session.media.every(function(m) { return ['video', 'audio', 'data'].indexOf(m.mid) !== -1; })) { console.warn('This description does not look like Unified Plan.'); return desc; } //#endregion // HACK https://bugzilla.mozilla.org/show_bug.cgi?id=1113443 var sdp = desc.sdp; var rewrite = false; for (var i = 0; i < session.media.length; i++) { var uLine = session.media[i]; uLine.rtp.forEach(function(rtp) { if (rtp.codec === 'NULL') { rewrite = true; var offer = transform.parse(self.cache.offer); rtp.codec = offer.media[i].rtp[0].codec; } }); } if (rewrite) { sdp = transform.write(session); } // Unified Plan SDP is our "precious". Cache it for later use in the Plan B // -> Unified Plan transformation. this.cache[desc.type] = sdp; //#region Convert from Unified Plan to Plan B. // We rebuild the session.media array. var media = session.media; session.media = []; // Associative array that maps channel types to channel objects for fast // access to channel objects by their type, e.g. type2bl['audio']->channel // obj. var type2bl = {}; // Used to build the group:BUNDLE value after the channels construction // loop. var types = []; media.forEach(function(uLine) { // rtcp-mux is required in the Plan B SDP. if ((typeof uLine.rtcpMux !== 'string' || uLine.rtcpMux !== 'rtcp-mux') && uLine.direction !== 'inactive') { throw new Error('Cannot convert to Plan B because m-lines ' + 'without the rtcp-mux attribute were found.'); } // If we don't have a channel for this uLine.type OR the selected is // inactive, then select this uLine as the channel basis. if (typeof type2bl[uLine.type] === 'undefined' || type2bl[uLine.type].direction === 'inactive') { type2bl[uLine.type] = uLine; } if (uLine.protocol != type2bl[uLine.type].protocol) { throw new Error('Cannot convert to Plan B because m-lines ' + 'have different protocols and this library does not have ' + 'support for that'); } if (uLine.payloads != type2bl[uLine.type].payloads) { throw new Error('Cannot convert to Plan B because m-lines ' + 'have different payloads and this library does not have ' + 'support for that'); } }); // Implode the Unified Plan m-lines/tracks into Plan B channels. media.forEach(function(uLine) { if (uLine.type === 'application') { session.media.push(uLine); types.push(uLine.mid); return; } // Add sources to the channel and handle a=msid. if (typeof uLine.sources === 'object') { Object.keys(uLine.sources).forEach(function(ssrc) { if (typeof type2bl[uLine.type].sources !== 'object') type2bl[uLine.type].sources = {}; // Assign the sources to the channel. type2bl[uLine.type].sources[ssrc] = uLine.sources[ssrc]; if (typeof uLine.msid !== 'undefined') { // In Plan B the msid is an SSRC attribute. Also, we don't // care about the obsolete label and mslabel attributes. // // Note that it is not guaranteed that the uLine will // have an msid. recvonly channels in particular don't have // one. type2bl[uLine.type].sources[ssrc].msid = uLine.msid; } // NOTE ssrcs in ssrc groups will share msids, as // draft-uberti-rtcweb-plan-00 mandates. }); } // Add ssrc groups to the channel. if (typeof uLine.ssrcGroups !== 'undefined' && Array.isArray(uLine.ssrcGroups)) { // Create the ssrcGroups array, if it's not defined. if (typeof type2bl[uLine.type].ssrcGroups === 'undefined' || !Array.isArray(type2bl[uLine.type].ssrcGroups)) { type2bl[uLine.type].ssrcGroups = []; } type2bl[uLine.type].ssrcGroups = type2bl[uLine.type].ssrcGroups.concat( uLine.ssrcGroups); } if (type2bl[uLine.type] === uLine) { // Plan B mids are in ['audio', 'video', 'data'] uLine.mid = uLine.type; // Plan B doesn't support/need the bundle-only attribute. delete uLine.bundleOnly; // In Plan B the msid is an SSRC attribute. delete uLine.msid; if (uLine.type == media[0].type) { types.unshift(uLine.type); // Add the channel to the new media array. session.media.unshift(uLine); } else { types.push(uLine.type); // Add the channel to the new media array. session.media.push(uLine); } } }); if (typeof session.groups !== 'undefined') { // We regenerate the BUNDLE group with the new mids. session.groups.some(function(group) { if (group.type === 'BUNDLE') { group.mids = types.join(' '); return true; } }); } // msid semantic session.msidSemantic = { semantic: 'WMS', token: '*' }; var resStr = transform.write(session); return new RTCSessionDescription({ type: desc.type, sdp: resStr }); //#endregion }; /* follow rules defined in RFC4145 */ function addSetupAttr(uLine) { if (typeof uLine.setup === 'undefined') { return; } if (uLine.setup === "active") { uLine.setup = "passive"; } else if (uLine.setup === "passive") { uLine.setup = "active"; } } /** * This method transforms a Plan B SDP to an equivalent Unified Plan SDP. A * PeerConnection wrapper transforms the SDP to Unified Plan before passing it * to FF. * * @param desc * @returns {*} */ Interop.prototype.toUnifiedPlan = function(desc) { var self = this; //#region Preliminary input validation. if (typeof desc !== 'object' || desc === null || typeof desc.sdp !== 'string') { console.warn('An empty description was passed as an argument.'); return desc; } var session = transform.parse(desc.sdp); // If the SDP contains no media, there's nothing to transform. if (typeof session.media === 'undefined' || !Array.isArray(session.media) || session.media.length === 0) { console.warn('The description has no media.'); return desc; } // Try some heuristics to "make sure" this is a Plan B SDP. Plan B SDP has // a video, an audio and a data "channel" at most. if (session.media.length > 3 || !session.media.every(function(m) { return ['video', 'audio', 'data'].indexOf(m.mid) !== -1; })) { console.warn('This description does not look like Plan B.'); return desc; } // Make sure this Plan B SDP can be converted to a Unified Plan SDP. var mids = []; session.media.forEach(function(m) { mids.push(m.mid); }); var hasBundle = false; if (typeof session.groups !== 'undefined' && Array.isArray(session.groups)) { hasBundle = session.groups.every(function(g) { return g.type !== 'BUNDLE' || arrayEquals.apply(g.mids.sort(), [mids.sort()]); }); } if (!hasBundle) { var mustBeBundle = false; session.media.forEach(function(m) { if (m.direction !== 'inactive') { mustBeBundle = true; } }); if (mustBeBundle) { throw new Error("Cannot convert to Unified Plan because m-lines that" + " are not bundled were found."); } } //#endregion //#region Convert from Plan B to Unified Plan. // Unfortunately, a Plan B offer/answer doesn't have enough information to // rebuild an equivalent Unified Plan offer/answer. // // For example, if this is a local answer (in Unified Plan style) that we // convert to Plan B prior to handing it over to the application (the // PeerConnection wrapper called us, for instance, after a successful // createAnswer), we want to remember the m-line at which we've seen the // (local) SSRC. That's because when the application wants to do call the // SLD method, forcing us to do the inverse transformation (from Plan B to // Unified Plan), we need to know to which m-line to assign the (local) // SSRC. We also need to know all the other m-lines that the original // answer had and include them in the transformed answer as well. // // Another example is if this is a remote offer that we convert to Plan B // prior to giving it to the application, we want to remember the mid at // which we've seen the (remote) SSRC. // // In the iteration that follows, we use the cached Unified Plan (if it // exists) to assign mids to ssrcs. var type; if (desc.type === 'answer') { type = 'offer'; } else if (desc.type === 'offer') { type = 'answer'; } else { throw new Error("Type '" + desc.type + "' not supported."); } var cached; if (typeof this.cache[type] !== 'undefined') { cached = transform.parse(this.cache[type]); } var recvonlySsrcs = { audio: {}, video: {} }; // A helper map that sends mids to m-line objects. We use it later to // rebuild the Unified Plan style session.media array. var mid2ul = {}; var bIdx = 0; var uIdx = 0; var sources2ul = {}; var candidates; var iceUfrag; var icePwd; var fingerprint; var payloads = {}; var rtcpFb = {}; var rtp = {}; session.media.forEach(function(bLine) { if ((typeof bLine.rtcpMux !== 'string' || bLine.rtcpMux !== 'rtcp-mux') && bLine.direction !== 'inactive') { throw new Error("Cannot convert to Unified Plan because m-lines " + "without the rtcp-mux attribute were found."); } if (bLine.type === 'application') { mid2ul[bLine.mid] = bLine; return; } // With rtcp-mux and bundle all the channels should have the same ICE // stuff. var sources = bLine.sources; var ssrcGroups = bLine.ssrcGroups; var port = bLine.port; /* Chrome adds different candidates even using bundle, so we concat the candidates list */ if (typeof bLine.candidates != 'undefined') { if (typeof candidates != 'undefined') { candidates = candidates.concat(bLine.candidates); } else { candidates = bLine.candidates; } } if ((typeof iceUfrag != 'undefined') && (typeof bLine.iceUfrag != 'undefined') && (iceUfrag != bLine.iceUfrag)) { throw new Error("Only BUNDLE supported, iceUfrag must be the same for all m-lines.\n" + "\tLast iceUfrag: " + iceUfrag + "\n" + "\tNew iceUfrag: " + bLine.iceUfrag ); } if (typeof bLine.iceUfrag != 'undefined') { iceUfrag = bLine.iceUfrag; } if ((typeof icePwd != 'undefined') && (typeof bLine.icePwd != 'undefined') && (icePwd != bLine.icePwd)) { throw new Error("Only BUNDLE supported, icePwd must be the same for all m-lines.\n" + "\tLast icePwd: " + icePwd + "\n" + "\tNew icePwd: " + bLine.icePwd ); } if (typeof bLine.icePwd != 'undefined') { icePwd = bLine.icePwd; } if ((typeof fingerprint != 'undefined') && (typeof bLine.fingerprint != 'undefined') && (fingerprint.type != bLine.fingerprint.type || fingerprint.hash != bLine.fingerprint.hash)) { throw new Error("Only BUNDLE supported, fingerprint must be the same for all m-lines.\n" + "\tLast fingerprint: " + JSON.stringify(fingerprint) + "\n" + "\tNew fingerprint: " + JSON.stringify(bLine.fingerprint) ); } if (typeof bLine.fingerprint != 'undefined') { fingerprint = bLine.fingerprint; } payloads[bLine.type] = bLine.payloads; rtcpFb[bLine.type] = bLine.rtcpFb; rtp[bLine.type] = bLine.rtp; // inverted ssrc group map var ssrc2group = {}; if (typeof ssrcGroups !== 'undefined' && Array.isArray(ssrcGroups)) { ssrcGroups.forEach(function (ssrcGroup) { // XXX This might brake if an SSRC is in more than one group // for some reason. if (typeof ssrcGroup.ssrcs !== 'undefined' && Array.isArray(ssrcGroup.ssrcs)) { ssrcGroup.ssrcs.forEach(function (ssrc) { if (typeof ssrc2group[ssrc] === 'undefined') { ssrc2group[ssrc] = []; } ssrc2group[ssrc].push(ssrcGroup); }); } }); } // ssrc to m-line index. var ssrc2ml = {}; if (typeof sources === 'object') { // We'll use the "bLine" object as a prototype for each new "mLine" // that we create, but first we need to clean it up a bit. delete bLine.sources; delete bLine.ssrcGroups; delete bLine.candidates; delete bLine.iceUfrag; delete bLine.icePwd; delete bLine.fingerprint; delete bLine.port; delete bLine.mid; // Explode the Plan B channel sources with one m-line per source. Object.keys(sources).forEach(function(ssrc) { // The (unified) m-line for this SSRC. We either create it from // scratch or, if it's a grouped SSRC, we re-use a related // mline. In other words, if the source is grouped with another // source, put the two together in the same m-line. var uLine; // We assume here that we are the answerer in the O/A, so any // offers which we translate come from the remote side, while // answers are local. So the check below is to make that we // handle receive-only SSRCs in a special way only if they come // from the remote side. if (desc.type==='offer') { // We want to detect SSRCs which are used by a remote peer // in an m-line with direction=recvonly (i.e. they are // being used for RTCP only). // This information would have gotten lost if the remote // peer used Unified Plan and their local description was // translated to Plan B. So we use the lack of an MSID // attribute to deduce a "receive only" SSRC. if (!sources[ssrc].msid) { recvonlySsrcs[bLine.type][ssrc] = sources[ssrc]; // Receive-only SSRCs must not create new m-lines. We // will assign them to an existing m-line later. return; } } if (typeof ssrc2group[ssrc] !== 'undefined' && Array.isArray(ssrc2group[ssrc])) { ssrc2group[ssrc].some(function (ssrcGroup) { // ssrcGroup.ssrcs *is* an Array, no need to check // again here. return ssrcGroup.ssrcs.some(function (related) { if (typeof ssrc2ml[related] === 'object') { uLine = ssrc2ml[related]; return true; } }); }); } if (typeof uLine === 'object') { // the m-line already exists. Just add the source. uLine.sources[ssrc] = sources[ssrc]; delete sources[ssrc].msid; } else { // Use the "bLine" as a prototype for the "uLine". uLine = Object.create(bLine); ssrc2ml[ssrc] = uLine; if (typeof sources[ssrc].msid !== 'undefined') { // Assign the msid of the source to the m-line. Note // that it is not guaranteed that the source will have // msid. In particular "recvonly" sources don't have an // msid. Note that "recvonly" is a term only defined // for m-lines. uLine.msid = sources[ssrc].msid; delete sources[ssrc].msid; } // We assign one SSRC per media line. uLine.sources = {}; uLine.sources[ssrc] = sources[ssrc]; uLine.ssrcGroups = ssrc2group[ssrc]; // Use the cached Unified Plan SDP (if it exists) to assign // SSRCs to mids. if (typeof cached !== 'undefined' && typeof cached.media !== 'undefined' && Array.isArray(cached.media)) { cached.media.forEach(function (m) { if (typeof m.sources === 'object') { Object.keys(m.sources).forEach(function (s) { if (s === ssrc) { uLine.mid = m.mid; } }); } }); } if (typeof uLine.mid === 'undefined') { // If this is an SSRC that we see for the first time // assign it a new mid. This is typically the case when // this method is called to transform a remote // description for the first time or when there is a // new SSRC in the remote description because a new // peer has joined the conference. Local SSRCs should // have already been added to the map in the toPlanB // method. // // Because FF generates answers in Unified Plan style, // we MUST already have a cached answer with all the // local SSRCs mapped to some m-line/mid. uLine.mid = [bLine.type, '-', ssrc].join(''); } // Include the candidates in the 1st media line. uLine.candidates = candidates; uLine.iceUfrag = iceUfrag; uLine.icePwd = icePwd; uLine.fingerprint = fingerprint; uLine.port = port; mid2ul[uLine.mid] = uLine; sources2ul[uIdx] = uLine.sources; self.cache.mlU2BMap[uIdx] = bIdx; if (typeof self.cache.mlB2UMap[bIdx] === 'undefined') { self.cache.mlB2UMap[bIdx] = uIdx; } uIdx++; } }); } else { var uLine = bLine; uLine.candidates = candidates; uLine.iceUfrag = iceUfrag; uLine.icePwd = icePwd; uLine.fingerprint = fingerprint; uLine.port = port; mid2ul[uLine.mid] = uLine; self.cache.mlU2BMap[uIdx] = bIdx; if (typeof self.cache.mlB2UMap[bIdx] === 'undefined') { self.cache.mlB2UMap[bIdx] = uIdx; } } bIdx++; }); // Rebuild the media array in the right order and add the missing mLines // (missing from the Plan B SDP). session.media = []; mids = []; // reuse if (desc.type === 'answer') { // The media lines in the answer must match the media lines in the // offer. The order is important too. Here we assume that Firefox is // the answerer, so we merely have to use the reconstructed (unified) // answer to update the cached (unified) answer accordingly. // // In the general case, one would have to use the cached (unified) // offer to find the m-lines that are missing from the reconstructed // answer, potentially grabbing them from the cached (unified) answer. // One has to be careful with this approach because inactive m-lines do // not always have an mid, making it tricky (impossible?) to find where // exactly and which m-lines are missing from the reconstructed answer. for (var i = 0; i < cached.media.length; i++) { var uLine = cached.media[i]; delete uLine.msid; delete uLine.sources; delete uLine.ssrcGroups; if (typeof sources2ul[i] === 'undefined') { if (!uLine.direction || uLine.direction === 'sendrecv') uLine.direction = 'recvonly'; else if (uLine.direction === 'sendonly') uLine.direction = 'inactive'; } else { if (!uLine.direction || uLine.direction === 'sendrecv') uLine.direction = 'sendrecv'; else if (uLine.direction === 'recvonly') uLine.direction = 'sendonly'; } uLine.sources = sources2ul[i]; uLine.candidates = candidates; uLine.iceUfrag = iceUfrag; uLine.icePwd = icePwd; uLine.fingerprint = fingerprint; uLine.rtp = rtp[uLine.type]; uLine.payloads = payloads[uLine.type]; uLine.rtcpFb = rtcpFb[uLine.type]; session.media.push(uLine); if (typeof uLine.mid === 'string') { // inactive lines don't/may not have an mid. mids.push(uLine.mid); } } } else { // SDP offer/answer (and the JSEP spec) forbids removing an m-section // under any circumstances. If we are no longer interested in sending a // track, we just remove the msid and ssrc attributes and set it to // either a=recvonly (as the reofferer, we must use recvonly if the // other side was previously sending on the m-section, but we can also // leave the possibility open if it wasn't previously in use), or // a=inactive. if (typeof cached !== 'undefined' && typeof cached.media !== 'undefined' && Array.isArray(cached.media)) { cached.media.forEach(function(uLine) { mids.push(uLine.mid); if (typeof mid2ul[uLine.mid] !== 'undefined') { session.media.push(mid2ul[uLine.mid]); } else { delete uLine.msid; delete uLine.sources; delete uLine.ssrcGroups; if (!uLine.direction || uLine.direction === 'sendrecv') { uLine.direction = 'sendonly'; } if (!uLine.direction || uLine.direction === 'recvonly') { uLine.direction = 'inactive'; } addSetupAttr (uLine); session.media.push(uLine); } }); } // Add all the remaining (new) m-lines of the transformed SDP. Object.keys(mid2ul).forEach(function(mid) { if (mids.indexOf(mid) === -1) { mids.push(mid); if (mid2ul[mid].direction === 'recvonly') { // This is a remote recvonly channel. Add its SSRC to the // appropriate sendrecv or sendonly channel. // TODO(gp) what if we don't have sendrecv/sendonly // channel? var done = false; session.media.some(function (uLine) { if ((uLine.direction === 'sendrecv' || uLine.direction === 'sendonly') && uLine.type === mid2ul[mid].type) { // mid2ul[mid] shouldn't have any ssrc-groups Object.keys(mid2ul[mid].sources).forEach( function (ssrc) { uLine.sources[ssrc] = mid2ul[mid].sources[ssrc]; }); done = true; return true; } }); if (!done) { session.media.push(mid2ul[mid]); } } else { session.media.push(mid2ul[mid]); } } }); } // After we have constructed the Plan Unified m-lines we can figure out // where (in which m-line) to place the 'recvonly SSRCs'. // Note: we assume here that we are the answerer in the O/A, so any offers // which we translate come from the remote side, while answers are local // (and so our last local description is cached as an 'answer'). ["audio", "video"].forEach(function (type) { if (!session || !session.media || !Array.isArray(session.media)) return; var idx = null; if (Object.keys(recvonlySsrcs[type]).length > 0) { idx = self.getFirstSendingIndexFromAnswer(type); if (idx === null){ // If this is the first offer we receive, we don't have a // cached answer. Assume that we will be sending media using // the first m-line for each media type. for (var i = 0; i < session.media.length; i++) { if (session.media[i].type === type) { idx = i; break; } } } } if (idx && session.media.length > idx) { var mLine = session.media[idx]; Object.keys(recvonlySsrcs[type]).forEach(function(ssrc) { if (mLine.sources && mLine.sources[ssrc]) { console.warn("Replacing an existing SSRC."); } if (!mLine.sources) { mLine.sources = {}; } mLine.sources[ssrc] = recvonlySsrcs[type][ssrc]; }); } }); if (typeof session.groups !== 'undefined') { // We regenerate the BUNDLE group (since we regenerated the mids) session.groups.some(function(group) { if (group.type === 'BUNDLE') { group.mids = mids.join(' '); return true; } }); } // msid semantic session.msidSemantic = { semantic: 'WMS', token: '*' }; var resStr = transform.write(session); // Cache the transformed SDP (Unified Plan) for later re-use in this // function. this.cache[desc.type] = resStr; return new RTCSessionDescription({ type: desc.type, sdp: resStr }); //#endregion }; /***/ }), /***/ "../../../../sdp-translator/lib/transform.js": /***/ (function(module, exports, __webpack_require__) { /* Copyright @ 2015 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var transform = __webpack_require__("../../../../sdp-transform/lib/index.js"); exports.write = function(session, opts) { if (typeof session !== 'undefined' && typeof session.media !== 'undefined' && Array.isArray(session.media)) { session.media.forEach(function (mLine) { // expand sources to ssrcs if (typeof mLine.sources !== 'undefined' && Object.keys(mLine.sources).length !== 0) { mLine.ssrcs = []; Object.keys(mLine.sources).forEach(function (ssrc) { var source = mLine.sources[ssrc]; Object.keys(source).forEach(function (attribute) { mLine.ssrcs.push({ id: ssrc, attribute: attribute, value: source[attribute] }); }); }); delete mLine.sources; } // join ssrcs in ssrc groups if (typeof mLine.ssrcGroups !== 'undefined' && Array.isArray(mLine.ssrcGroups)) { mLine.ssrcGroups.forEach(function (ssrcGroup) { if (typeof ssrcGroup.ssrcs !== 'undefined' && Array.isArray(ssrcGroup.ssrcs)) { ssrcGroup.ssrcs = ssrcGroup.ssrcs.join(' '); } }); } }); } // join group mids if (typeof session !== 'undefined' && typeof session.groups !== 'undefined' && Array.isArray(session.groups)) { session.groups.forEach(function (g) { if (typeof g.mids !== 'undefined' && Array.isArray(g.mids)) { g.mids = g.mids.join(' '); } }); } return transform.write(session, opts); }; exports.parse = function(sdp) { var session = transform.parse(sdp); if (typeof session !== 'undefined' && typeof session.media !== 'undefined' && Array.isArray(session.media)) { session.media.forEach(function (mLine) { // group sources attributes by ssrc if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) { mLine.sources = {}; mLine.ssrcs.forEach(function (ssrc) { if (!mLine.sources[ssrc.id]) mLine.sources[ssrc.id] = {}; mLine.sources[ssrc.id][ssrc.attribute] = ssrc.value; }); delete mLine.ssrcs; } // split ssrcs in ssrc groups if (typeof mLine.ssrcGroups !== 'undefined' && Array.isArray(mLine.ssrcGroups)) { mLine.ssrcGroups.forEach(function (ssrcGroup) { if (typeof ssrcGroup.ssrcs === 'string') { ssrcGroup.ssrcs = ssrcGroup.ssrcs.split(' '); } }); } }); } // split group mids if (typeof session !== 'undefined' && typeof session.groups !== 'undefined' && Array.isArray(session.groups)) { session.groups.forEach(function (g) { if (typeof g.mids === 'string') { g.mids = g.mids.split(' '); } }); } return session; }; /***/ }), /***/ "../../../../sdp/sdp.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-env node */ // SDP helpers. var SDPUtils = {}; // Generate an alphanumeric identifier for cname or mids. // TODO: use UUIDs instead? https://gist.github.com/jed/982883 SDPUtils.generateIdentifier = function() { return Math.random().toString(36).substr(2, 10); }; // The RTCP CNAME used by all peerconnections from the same JS. SDPUtils.localCName = SDPUtils.generateIdentifier(); // Splits SDP into lines, dealing with both CRLF and LF. SDPUtils.splitLines = function(blob) { return blob.trim().split('\n').map(function(line) { return line.trim(); }); }; // Splits SDP into sessionpart and mediasections. Ensures CRLF. SDPUtils.splitSections = function(blob) { var parts = blob.split('\nm='); return parts.map(function(part, index) { return (index > 0 ? 'm=' + part : part).trim() + '\r\n'; }); }; // Returns lines that start with a certain prefix. SDPUtils.matchPrefix = function(blob, prefix) { return SDPUtils.splitLines(blob).filter(function(line) { return line.indexOf(prefix) === 0; }); }; // Parses an ICE candidate line. Sample input: // candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8 // rport 55996" SDPUtils.parseCandidate = function(line) { var parts; // Parse both variants. if (line.indexOf('a=candidate:') === 0) { parts = line.substring(12).split(' '); } else { parts = line.substring(10).split(' '); } var candidate = { foundation: parts[0], component: parseInt(parts[1], 10), protocol: parts[2].toLowerCase(), priority: parseInt(parts[3], 10), ip: parts[4], port: parseInt(parts[5], 10), // skip parts[6] == 'typ' type: parts[7] }; for (var i = 8; i < parts.length; i += 2) { switch (parts[i]) { case 'raddr': candidate.relatedAddress = parts[i + 1]; break; case 'rport': candidate.relatedPort = parseInt(parts[i + 1], 10); break; case 'tcptype': candidate.tcpType = parts[i + 1]; break; case 'ufrag': candidate.ufrag = parts[i + 1]; // for backward compability. candidate.usernameFragment = parts[i + 1]; break; default: // extension handling, in particular ufrag candidate[parts[i]] = parts[i + 1]; break; } } return candidate; }; // Translates a candidate object into SDP candidate attribute. SDPUtils.writeCandidate = function(candidate) { var sdp = []; sdp.push(candidate.foundation); sdp.push(candidate.component); sdp.push(candidate.protocol.toUpperCase()); sdp.push(candidate.priority); sdp.push(candidate.ip); sdp.push(candidate.port); var type = candidate.type; sdp.push('typ'); sdp.push(type); if (type !== 'host' && candidate.relatedAddress && candidate.relatedPort) { sdp.push('raddr'); sdp.push(candidate.relatedAddress); // was: relAddr sdp.push('rport'); sdp.push(candidate.relatedPort); // was: relPort } if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') { sdp.push('tcptype'); sdp.push(candidate.tcpType); } if (candidate.ufrag) { sdp.push('ufrag'); sdp.push(candidate.ufrag); } return 'candidate:' + sdp.join(' '); }; // Parses an ice-options line, returns an array of option tags. // a=ice-options:foo bar SDPUtils.parseIceOptions = function(line) { return line.substr(14).split(' '); } // Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input: // a=rtpmap:111 opus/48000/2 SDPUtils.parseRtpMap = function(line) { var parts = line.substr(9).split(' '); var parsed = { payloadType: parseInt(parts.shift(), 10) // was: id }; parts = parts[0].split('/'); parsed.name = parts[0]; parsed.clockRate = parseInt(parts[1], 10); // was: clockrate // was: channels parsed.numChannels = parts.length === 3 ? parseInt(parts[2], 10) : 1; return parsed; }; // Generate an a=rtpmap line from RTCRtpCodecCapability or // RTCRtpCodecParameters. SDPUtils.writeRtpMap = function(codec) { var pt = codec.payloadType; if (codec.preferredPayloadType !== undefined) { pt = codec.preferredPayloadType; } return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate + (codec.numChannels !== 1 ? '/' + codec.numChannels : '') + '\r\n'; }; // Parses an a=extmap line (headerextension from RFC 5285). Sample input: // a=extmap:2 urn:ietf:params:rtp-hdrext:toffset // a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset SDPUtils.parseExtmap = function(line) { var parts = line.substr(9).split(' '); return { id: parseInt(parts[0], 10), direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv', uri: parts[1] }; }; // Generates a=extmap line from RTCRtpHeaderExtensionParameters or // RTCRtpHeaderExtension. SDPUtils.writeExtmap = function(headerExtension) { return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) + (headerExtension.direction && headerExtension.direction !== 'sendrecv' ? '/' + headerExtension.direction : '') + ' ' + headerExtension.uri + '\r\n'; }; // Parses an ftmp line, returns dictionary. Sample input: // a=fmtp:96 vbr=on;cng=on // Also deals with vbr=on; cng=on SDPUtils.parseFmtp = function(line) { var parsed = {}; var kv; var parts = line.substr(line.indexOf(' ') + 1).split(';'); for (var j = 0; j < parts.length; j++) { kv = parts[j].trim().split('='); parsed[kv[0].trim()] = kv[1]; } return parsed; }; // Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters. SDPUtils.writeFmtp = function(codec) { var line = ''; var pt = codec.payloadType; if (codec.preferredPayloadType !== undefined) { pt = codec.preferredPayloadType; } if (codec.parameters && Object.keys(codec.parameters).length) { var params = []; Object.keys(codec.parameters).forEach(function(param) { params.push(param + '=' + codec.parameters[param]); }); line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\r\n'; } return line; }; // Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input: // a=rtcp-fb:98 nack rpsi SDPUtils.parseRtcpFb = function(line) { var parts = line.substr(line.indexOf(' ') + 1).split(' '); return { type: parts.shift(), parameter: parts.join(' ') }; }; // Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters. SDPUtils.writeRtcpFb = function(codec) { var lines = ''; var pt = codec.payloadType; if (codec.preferredPayloadType !== undefined) { pt = codec.preferredPayloadType; } if (codec.rtcpFeedback && codec.rtcpFeedback.length) { // FIXME: special handling for trr-int? codec.rtcpFeedback.forEach(function(fb) { lines += 'a=rtcp-fb:' + pt + ' ' + fb.type + (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') + '\r\n'; }); } return lines; }; // Parses an RFC 5576 ssrc media attribute. Sample input: // a=ssrc:3735928559 cname:something SDPUtils.parseSsrcMedia = function(line) { var sp = line.indexOf(' '); var parts = { ssrc: parseInt(line.substr(7, sp - 7), 10) }; var colon = line.indexOf(':', sp); if (colon > -1) { parts.attribute = line.substr(sp + 1, colon - sp - 1); parts.value = line.substr(colon + 1); } else { parts.attribute = line.substr(sp + 1); } return parts; }; // Extracts the MID (RFC 5888) from a media section. // returns the MID or undefined if no mid line was found. SDPUtils.getMid = function(mediaSection) { var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0]; if (mid) { return mid.substr(6); } } SDPUtils.parseFingerprint = function(line) { var parts = line.substr(14).split(' '); return { algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge. value: parts[1] }; }; // Extracts DTLS parameters from SDP media section or sessionpart. // FIXME: for consistency with other functions this should only // get the fingerprint line as input. See also getIceParameters. SDPUtils.getDtlsParameters = function(mediaSection, sessionpart) { var lines = SDPUtils.matchPrefix(mediaSection + sessionpart, 'a=fingerprint:'); // Note: a=setup line is ignored since we use the 'auto' role. // Note2: 'algorithm' is not case sensitive except in Edge. return { role: 'auto', fingerprints: lines.map(SDPUtils.parseFingerprint) }; }; // Serializes DTLS parameters to SDP. SDPUtils.writeDtlsParameters = function(params, setupType) { var sdp = 'a=setup:' + setupType + '\r\n'; params.fingerprints.forEach(function(fp) { sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\r\n'; }); return sdp; }; // Parses ICE information from SDP media section or sessionpart. // FIXME: for consistency with other functions this should only // get the ice-ufrag and ice-pwd lines as input. SDPUtils.getIceParameters = function(mediaSection, sessionpart) { var lines = SDPUtils.splitLines(mediaSection); // Search in session part, too. lines = lines.concat(SDPUtils.splitLines(sessionpart)); var iceParameters = { usernameFragment: lines.filter(function(line) { return line.indexOf('a=ice-ufrag:') === 0; })[0].substr(12), password: lines.filter(function(line) { return line.indexOf('a=ice-pwd:') === 0; })[0].substr(10) }; return iceParameters; }; // Serializes ICE parameters to SDP. SDPUtils.writeIceParameters = function(params) { return 'a=ice-ufrag:' + params.usernameFragment + '\r\n' + 'a=ice-pwd:' + params.password + '\r\n'; }; // Parses the SDP media section and returns RTCRtpParameters. SDPUtils.parseRtpParameters = function(mediaSection) { var description = { codecs: [], headerExtensions: [], fecMechanisms: [], rtcp: [] }; var lines = SDPUtils.splitLines(mediaSection); var mline = lines[0].split(' '); for (var i = 3; i < mline.length; i++) { // find all codecs from mline[3..] var pt = mline[i]; var rtpmapline = SDPUtils.matchPrefix( mediaSection, 'a=rtpmap:' + pt + ' ')[0]; if (rtpmapline) { var codec = SDPUtils.parseRtpMap(rtpmapline); var fmtps = SDPUtils.matchPrefix( mediaSection, 'a=fmtp:' + pt + ' '); // Only the first a=fmtp: is considered. codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {}; codec.rtcpFeedback = SDPUtils.matchPrefix( mediaSection, 'a=rtcp-fb:' + pt + ' ') .map(SDPUtils.parseRtcpFb); description.codecs.push(codec); // parse FEC mechanisms from rtpmap lines. switch (codec.name.toUpperCase()) { case 'RED': case 'ULPFEC': description.fecMechanisms.push(codec.name.toUpperCase()); break; default: // only RED and ULPFEC are recognized as FEC mechanisms. break; } } } SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function(line) { description.headerExtensions.push(SDPUtils.parseExtmap(line)); }); // FIXME: parse rtcp. return description; }; // Generates parts of the SDP media section describing the capabilities / // parameters. SDPUtils.writeRtpDescription = function(kind, caps) { var sdp = ''; // Build the mline. sdp += 'm=' + kind + ' '; sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs. sdp += ' UDP/TLS/RTP/SAVPF '; sdp += caps.codecs.map(function(codec) { if (codec.preferredPayloadType !== undefined) { return codec.preferredPayloadType; } return codec.payloadType; }).join(' ') + '\r\n'; sdp += 'c=IN IP4 0.0.0.0\r\n'; sdp += 'a=rtcp:9 IN IP4 0.0.0.0\r\n'; // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb. caps.codecs.forEach(function(codec) { sdp += SDPUtils.writeRtpMap(codec); sdp += SDPUtils.writeFmtp(codec); sdp += SDPUtils.writeRtcpFb(codec); }); var maxptime = 0; caps.codecs.forEach(function(codec) { if (codec.maxptime > maxptime) { maxptime = codec.maxptime; } }); if (maxptime > 0) { sdp += 'a=maxptime:' + maxptime + '\r\n'; } sdp += 'a=rtcp-mux\r\n'; caps.headerExtensions.forEach(function(extension) { sdp += SDPUtils.writeExtmap(extension); }); // FIXME: write fecMechanisms. return sdp; }; // Parses the SDP media section and returns an array of // RTCRtpEncodingParameters. SDPUtils.parseRtpEncodingParameters = function(mediaSection) { var encodingParameters = []; var description = SDPUtils.parseRtpParameters(mediaSection); var hasRed = description.fecMechanisms.indexOf('RED') !== -1; var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1; // filter a=ssrc:... cname:, ignore PlanB-msid var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') .map(function(line) { return SDPUtils.parseSsrcMedia(line); }) .filter(function(parts) { return parts.attribute === 'cname'; }); var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc; var secondarySsrc; var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID') .map(function(line) { var parts = line.split(' '); parts.shift(); return parts.map(function(part) { return parseInt(part, 10); }); }); if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) { secondarySsrc = flows[0][1]; } description.codecs.forEach(function(codec) { if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) { var encParam = { ssrc: primarySsrc, codecPayloadType: parseInt(codec.parameters.apt, 10), rtx: { ssrc: secondarySsrc } }; encodingParameters.push(encParam); if (hasRed) { encParam = JSON.parse(JSON.stringify(encParam)); encParam.fec = { ssrc: secondarySsrc, mechanism: hasUlpfec ? 'red+ulpfec' : 'red' }; encodingParameters.push(encParam); } } }); if (encodingParameters.length === 0 && primarySsrc) { encodingParameters.push({ ssrc: primarySsrc }); } // we support both b=AS and b=TIAS but interpret AS as TIAS. var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b='); if (bandwidth.length) { if (bandwidth[0].indexOf('b=TIAS:') === 0) { bandwidth = parseInt(bandwidth[0].substr(7), 10); } else if (bandwidth[0].indexOf('b=AS:') === 0) { // use formula from JSEP to convert b=AS to TIAS value. bandwidth = parseInt(bandwidth[0].substr(5), 10) * 1000 * 0.95 - (50 * 40 * 8); } else { bandwidth = undefined; } encodingParameters.forEach(function(params) { params.maxBitrate = bandwidth; }); } return encodingParameters; }; // parses http://draft.ortc.org/#rtcrtcpparameters* SDPUtils.parseRtcpParameters = function(mediaSection) { var rtcpParameters = {}; var cname; // Gets the first SSRC. Note that with RTX there might be multiple // SSRCs. var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') .map(function(line) { return SDPUtils.parseSsrcMedia(line); }) .filter(function(obj) { return obj.attribute === 'cname'; })[0]; if (remoteSsrc) { rtcpParameters.cname = remoteSsrc.value; rtcpParameters.ssrc = remoteSsrc.ssrc; } // Edge uses the compound attribute instead of reducedSize // compound is !reducedSize var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize'); rtcpParameters.reducedSize = rsize.length > 0; rtcpParameters.compound = rsize.length === 0; // parses the rtcp-mux attrіbute. // Note that Edge does not support unmuxed RTCP. var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux'); rtcpParameters.mux = mux.length > 0; return rtcpParameters; }; // parses either a=msid: or a=ssrc:... msid lines and returns // the id of the MediaStream and MediaStreamTrack. SDPUtils.parseMsid = function(mediaSection) { var parts; var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:'); if (spec.length === 1) { parts = spec[0].substr(7).split(' '); return {stream: parts[0], track: parts[1]}; } var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') .map(function(line) { return SDPUtils.parseSsrcMedia(line); }) .filter(function(parts) { return parts.attribute === 'msid'; }); if (planB.length > 0) { parts = planB[0].value.split(' '); return {stream: parts[0], track: parts[1]}; } }; // Generate a session ID for SDP. // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1 // recommends using a cryptographically random +ve 64-bit value // but right now this should be acceptable and within the right range SDPUtils.generateSessionId = function() { return Math.random().toString().substr(2, 21); }; // Write boilder plate for start of SDP // sessId argument is optional - if not supplied it will // be generated randomly // sessVersion is optional and defaults to 2 SDPUtils.writeSessionBoilerplate = function(sessId, sessVer) { var sessionId; var version = sessVer !== undefined ? sessVer : 2; if (sessId) { sessionId = sessId; } else { sessionId = SDPUtils.generateSessionId(); } // FIXME: sess-id should be an NTP timestamp. return 'v=0\r\n' + 'o=thisisadapterortc ' + sessionId + ' ' + version + ' IN IP4 127.0.0.1\r\n' + 's=-\r\n' + 't=0 0\r\n'; }; SDPUtils.writeMediaSection = function(transceiver, caps, type, stream) { var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps); // Map ICE parameters (ufrag, pwd) to SDP. sdp += SDPUtils.writeIceParameters( transceiver.iceGatherer.getLocalParameters()); // Map DTLS parameters to SDP. sdp += SDPUtils.writeDtlsParameters( transceiver.dtlsTransport.getLocalParameters(), type === 'offer' ? 'actpass' : 'active'); sdp += 'a=mid:' + transceiver.mid + '\r\n'; if (transceiver.direction) { sdp += 'a=' + transceiver.direction + '\r\n'; } else if (transceiver.rtpSender && transceiver.rtpReceiver) { sdp += 'a=sendrecv\r\n'; } else if (transceiver.rtpSender) { sdp += 'a=sendonly\r\n'; } else if (transceiver.rtpReceiver) { sdp += 'a=recvonly\r\n'; } else { sdp += 'a=inactive\r\n'; } if (transceiver.rtpSender) { // spec. var msid = 'msid:' + stream.id + ' ' + transceiver.rtpSender.track.id + '\r\n'; sdp += 'a=' + msid; // for Chrome. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' ' + msid; if (transceiver.sendEncodingParameters[0].rtx) { sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' ' + msid; sdp += 'a=ssrc-group:FID ' + transceiver.sendEncodingParameters[0].ssrc + ' ' + transceiver.sendEncodingParameters[0].rtx.ssrc + '\r\n'; } } // FIXME: this should be written by writeRtpDescription. sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + ' cname:' + SDPUtils.localCName + '\r\n'; if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) { sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + ' cname:' + SDPUtils.localCName + '\r\n'; } return sdp; }; // Gets the direction from the mediaSection or the sessionpart. SDPUtils.getDirection = function(mediaSection, sessionpart) { // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv. var lines = SDPUtils.splitLines(mediaSection); for (var i = 0; i < lines.length; i++) { switch (lines[i]) { case 'a=sendrecv': case 'a=sendonly': case 'a=recvonly': case 'a=inactive': return lines[i].substr(2); default: // FIXME: What should happen here? } } if (sessionpart) { return SDPUtils.getDirection(sessionpart); } return 'sendrecv'; }; SDPUtils.getKind = function(mediaSection) { var lines = SDPUtils.splitLines(mediaSection); var mline = lines[0].split(' '); return mline[0].substr(2); }; SDPUtils.isRejected = function(mediaSection) { return mediaSection.split(' ', 2)[1] === '0'; }; SDPUtils.parseMLine = function(mediaSection) { var lines = SDPUtils.splitLines(mediaSection); var mline = lines[0].split(' '); return { kind: mline[0].substr(2), port: parseInt(mline[1], 10), protocol: mline[2], fmt: mline.slice(3).join(' ') }; }; // Expose public methods. if (true) { module.exports = SDPUtils; } /***/ }), /***/ "../../../../tslib/tslib.es6.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = __extends; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __assign; }); /* unused harmony export __rest */ /* unused harmony export __decorate */ /* unused harmony export __param */ /* unused harmony export __metadata */ /* unused harmony export __awaiter */ /* unused harmony export __generator */ /* unused harmony export __exportStar */ /* unused harmony export __values */ /* unused harmony export __read */ /* unused harmony export __spread */ /* unused harmony export __await */ /* unused harmony export __asyncGenerator */ /* unused harmony export __asyncDelegator */ /* unused harmony export __asyncValues */ /* unused harmony export __makeTemplateObject */ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var 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]; }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [0, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __exportStar(m, exports) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator]; return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; /***/ }), /***/ "../../../../ua-parser-js/src/ua-parser.js": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/** * UAParser.js v0.7.17 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman * Dual licensed under GPLv2 & MIT */ (function (window, undefined) { 'use strict'; ////////////// // Constants ///////////// var LIBVERSION = '0.7.17', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', UNDEF_TYPE = 'undefined', OBJ_TYPE = 'object', STR_TYPE = 'string', MAJOR = 'major', // deprecated MODEL = 'model', NAME = 'name', TYPE = 'type', VENDOR = 'vendor', VERSION = 'version', ARCHITECTURE= 'architecture', CONSOLE = 'console', MOBILE = 'mobile', TABLET = 'tablet', SMARTTV = 'smarttv', WEARABLE = 'wearable', EMBEDDED = 'embedded'; /////////// // Helper ////////// var util = { extend : function (regexes, extensions) { var margedRegexes = {}; for (var i in regexes) { if (extensions[i] && extensions[i].length % 2 === 0) { margedRegexes[i] = extensions[i].concat(regexes[i]); } else { margedRegexes[i] = regexes[i]; } } return margedRegexes; }, has : function (str1, str2) { if (typeof str1 === "string") { return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1; } else { return false; } }, lowerize : function (str) { return str.toLowerCase(); }, major : function (version) { return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g,'').split(".")[0] : undefined; }, trim : function (str) { return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } }; /////////////// // Map helper ////////////// var mapper = { rgx : function (ua, arrays) { //var result = {}, var i = 0, j, k, p, q, matches, match;//, args = arguments; /*// construct object barebones for (p = 0; p < args[1].length; p++) { q = args[1][p]; result[typeof q === OBJ_TYPE ? q[0] : q] = undefined; }*/ // loop through all regexes maps while (i < arrays.length && !matches) { var regex = arrays[i], // even sequence (0,2,4,..) props = arrays[i + 1]; // odd sequence (1,3,5,..) j = k = 0; // try matching uastring with regexes while (j < regex.length && !matches) { matches = regex[j++].exec(ua); if (!!matches) { for (p = 0; p < props.length; p++) { match = matches[++k]; q = props[p]; // check if given property is actually array if (typeof q === OBJ_TYPE && q.length > 0) { if (q.length == 2) { if (typeof q[1] == FUNC_TYPE) { // assign modified match this[q[0]] = q[1].call(this, match); } else { // assign given value, ignore regex match this[q[0]] = q[1]; } } else if (q.length == 3) { // check whether function or regex if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) { // call function (usually string mapper) this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined; } else { // sanitize match using given regex this[q[0]] = match ? match.replace(q[1], q[2]) : undefined; } } else if (q.length == 4) { this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined; } } else { this[q] = match ? match : undefined; } } } } i += 2; } // console.log(this); //return this; }, str : function (str, map) { for (var i in map) { // check if array if (typeof map[i] === OBJ_TYPE && map[i].length > 0) { for (var j = 0; j < map[i].length; j++) { if (util.has(map[i][j], str)) { return (i === UNKNOWN) ? undefined : i; } } } else if (util.has(map[i], str)) { return (i === UNKNOWN) ? undefined : i; } } return str; } }; /////////////// // String map ////////////// var maps = { browser : { oldsafari : { version : { '1.0' : '/8', '1.2' : '/1', '1.3' : '/3', '2.0' : '/412', '2.0.2' : '/416', '2.0.3' : '/417', '2.0.4' : '/419', '?' : '/' } } }, device : { amazon : { model : { 'Fire Phone' : ['SD', 'KF'] } }, sprint : { model : { 'Evo Shift 4G' : '7373KT' }, vendor : { 'HTC' : 'APA', 'Sprint' : 'Sprint' } } }, os : { windows : { version : { 'ME' : '4.90', 'NT 3.11' : 'NT3.51', 'NT 4.0' : 'NT4.0', '2000' : 'NT 5.0', 'XP' : ['NT 5.1', 'NT 5.2'], 'Vista' : 'NT 6.0', '7' : 'NT 6.1', '8' : 'NT 6.2', '8.1' : 'NT 6.3', '10' : ['NT 6.4', 'NT 10.0'], 'RT' : 'ARM' } } } }; ////////////// // Regex map ///////////// var regexes = { browser : [[ // Presto based /(opera\smini)\/([\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet /(opera).+version\/([\w\.]+)/i, // Opera > 9.80 /(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80 ], [NAME, VERSION], [ /(opios)[\/\s]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [[NAME, 'Opera Mini'], VERSION], [ /\s(opr)\/([\w\.]+)/i // Opera Webkit ], [[NAME, 'Opera'], VERSION], [ // Mixed /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser/Baidu /(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer // Webkit/KHTML based /(rekonq)\/([\w\.]+)*/i, // Rekonq /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser ], [NAME, VERSION], [ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ /(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [NAME, VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex ], [[NAME, 'Yandex'], VERSION], [ /(puffin)\/([\w\.]+)/i // Puffin ], [[NAME, 'Puffin'], VERSION], [ /((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i // UCBrowser ], [[NAME, 'UCBrowser'], VERSION], [ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ /(QQ)\/([\d\.]+)/i // QQ, aka ShouQ ], [NAME, VERSION], [ /m?(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser ], [NAME, VERSION], [ /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android ], [VERSION, [NAME, 'Facebook']], [ /headlesschrome(?:\/([\w\.]+)|\s)/i // Chrome Headless ], [VERSION, [NAME, 'Chrome Headless']], [ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [ /((?:oculus|samsung)browser)\/([\w\.]+)/i ], [[NAME, /(.+(?:g|us))(.+)/, '$1 $2'], VERSION], [ // Oculus / Samsung Browser /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ /(dolfin)\/([\w\.]+)/i // Dolphin ], [[NAME, 'Dolphin'], VERSION], [ /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION], [ /(coast)\/([\w\.]+)/i // Opera Coast ], [[NAME, 'Opera Coast'], VERSION], [ /fxios\/([\w\.-]+)/i // Firefox for iOS ], [VERSION, [NAME, 'Firefox']], [ /version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari ], [VERSION, [NAME, 'Mobile Safari']], [ /version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile ], [VERSION, NAME], [ /webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Google Search Appliance on iOS ], [[NAME, 'GSA'], VERSION], [ /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [ /(konqueror)\/([\w\.]+)/i, // Konqueror /(webkit|khtml)\/([\w\.]+)/i ], [NAME, VERSION], [ // Gecko based /(navigator|netscape)\/([\w\.-]+)/i // Netscape ], [[NAME, 'Netscape'], VERSION], [ /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla // Other /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir /(links)\s\(([\w\.]+)/i, // Links /(gobrowser)\/?([\w\.]+)*/i, // GoBrowser /(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser /(mosaic)[\/\s]([\w\.]+)/i // Mosaic ], [NAME, VERSION] /* ///////////////////// // Media players BEGIN //////////////////////// , [ /(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia /(coremedia) v((\d+)[\w\._]+)/i ], [NAME, VERSION], [ /(aqualung|lyssna|bsplayer)\/((\d+)?[\w\.-]+)/i // Aqualung/Lyssna/BSPlayer ], [NAME, VERSION], [ /(ares|ossproxy)\s((\d+)[\w\.-]+)/i // Ares/OSSProxy ], [NAME, VERSION], [ /(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/((\d+)[\w\.-]+)/i, // Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC // NSPlayer/PSP-InternetRadioPlayer/Videos /(clementine|music player daemon)\s((\d+)[\w\.-]+)/i, // Clementine/MPD /(lg player|nexplayer)\s((\d+)[\d\.]+)/i, /player\/(nexplayer|lg player)\s((\d+)[\w\.-]+)/i // NexPlayer/LG Player ], [NAME, VERSION], [ /(nexplayer)\s((\d+)[\w\.-]+)/i // Nexplayer ], [NAME, VERSION], [ /(flrp)\/((\d+)[\w\.-]+)/i // Flip Player ], [[NAME, 'Flip Player'], VERSION], [ /(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i // FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit ], [NAME], [ /(gstreamer) souphttpsrc (?:\([^\)]+\)){0,1} libsoup\/((\d+)[\w\.-]+)/i // Gstreamer ], [NAME, VERSION], [ /(htc streaming player)\s[\w_]+\s\/\s((\d+)[\d\.]+)/i, // HTC Streaming Player /(java|python-urllib|python-requests|wget|libcurl)\/((\d+)[\w\.-_]+)/i, // Java/urllib/requests/wget/cURL /(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG) ], [NAME, VERSION], [ /(htc_one_s)\/((\d+)[\d\.]+)/i // HTC One S ], [[NAME, /_/g, ' '], VERSION], [ /(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i // MPlayer SVN ], [NAME, VERSION], [ /(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i // MPlayer ], [NAME, VERSION], [ /(mplayer)/i, // MPlayer (no other info) /(yourmuze)/i, // YourMuze /(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime ], [NAME], [ /(nero (?:home|scout))\/((\d+)[\w\.-]+)/i // Nero Home/Nero Scout ], [NAME, VERSION], [ /(nokia\d+)\/((\d+)[\w\.-]+)/i // Nokia ], [NAME, VERSION], [ /\s(songbird)\/((\d+)[\w\.-]+)/i // Songbird/Philips-Songbird ], [NAME, VERSION], [ /(winamp)3 version ((\d+)[\w\.-]+)/i, // Winamp /(winamp)\s((\d+)[\w\.-]+)/i, /(winamp)mpeg\/((\d+)[\w\.-]+)/i ], [NAME, VERSION], [ /(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info) // inlight radio ], [NAME], [ /(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/((\d+)[\w\.-]+)/i // QuickTime/RealMedia/RadioApp/RadioClientApplication/ // SoundTap/Totem/Stagefright/Streamium ], [NAME, VERSION], [ /(smp)((\d+)[\d\.]+)/i // SMP ], [NAME, VERSION], [ /(vlc) media player - version ((\d+)[\w\.]+)/i, // VLC Videolan /(vlc)\/((\d+)[\w\.-]+)/i, /(xbmc|gvfs|xine|xmms|irapp)\/((\d+)[\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp /(foobar2000)\/((\d+)[\d\.]+)/i, // Foobar2000 /(itunes)\/((\d+)[\d\.]+)/i // iTunes ], [NAME, VERSION], [ /(wmplayer)\/((\d+)[\w\.-]+)/i, // Windows Media Player /(windows-media-player)\/((\d+)[\w\.-]+)/i ], [[NAME, /-/g, ' '], VERSION], [ /windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i // Windows Media Server ], [VERSION, [NAME, 'Windows']], [ /(com\.riseupradioalarm)\/((\d+)[\d\.]*)/i // RiseUP Radio Alarm ], [NAME, VERSION], [ /(rad.io)\s((\d+)[\d\.]+)/i, // Rad.io /(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i ], [[NAME, 'rad.io'], VERSION] ////////////////////// // Media players END ////////////////////*/ ], cpu : [[ /(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64 ], [[ARCHITECTURE, 'amd64']], [ /(ia32(?=;))/i // IA32 (quicktime) ], [[ARCHITECTURE, util.lowerize]], [ /((?:i[346]|x)86)[;\)]/i // IA32 ], [[ARCHITECTURE, 'ia32']], [ // PocketPC mistakenly identified as PowerPC /windows\s(ce|mobile);\sppc;/i ], [[ARCHITECTURE, 'arm']], [ /((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC ], [[ARCHITECTURE, /ower/, '', util.lowerize]], [ /(sun4\w)[;\)]/i // SPARC ], [[ARCHITECTURE, 'sparc']], [ /((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC ], [[ARCHITECTURE, util.lowerize]] ], device : [[ /\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook ], [MODEL, VENDOR, [TYPE, TABLET]], [ /applecoremedia\/[\w\.]+ \((ipad)/ // iPad ], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [ /(apple\s{0,1}tv)/i // Apple TV ], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [ /(archos)\s(gamepad2?)/i, // Archos /(hp).+(touchpad)/i, // HP TouchPad /(hp).+(tablet)/i, // HP Tablet /(kindle)\/([\w\.]+)/i, // Kindle /\s(nook)[\w\s]+build\/(\w+)/i, // Nook /(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak ], [VENDOR, MODEL, [TYPE, TABLET]], [ /(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i // Kindle Fire HD ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ /(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i // Fire Phone ], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [ /\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone ], [MODEL, VENDOR, [TYPE, MOBILE]], [ /\((ip[honed|\s\w*]+);/i // iPod/iPhone ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ /(blackberry)[\s-]?(\w+)/i, // BlackBerry /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron /(hp)\s([\w\s]+\w)/i, // HP iPAQ /(asus)-?(\w+)/i // Asus ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /\(bb10;\s(\w+)/i // BlackBerry 10 ], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [ // Asus Tablets /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i ], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony /(sony)?(?:sgp.+)\sbuild\//i ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [ /android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i ], [MODEL, [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /\s(ouya)\s/i, // Ouya /(nintendo)\s([wids3u]+)/i // Nintendo ], [VENDOR, MODEL, [TYPE, CONSOLE]], [ /android.+;\s(shield)\sbuild/i // Nvidia ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [ /(playstation\s[34portablevi]+)/i // Playstation ], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [ /(sprint\s(\w+))/i // Sprint Phones ], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [ /(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i // Lenovo tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC /(zte)-(\w+)*/i, // ZTE /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, /(nexus\s6p)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /[\s\(;](xbox(?:\sone)?)[\s\);]/i // Microsoft Xbox ], [MODEL, [VENDOR, 'Microsoft'], [TYPE, CONSOLE]], [ /(kin\.[onetw]{3})/i // Microsoft Kin ], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [ // Motorola /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w+)*/i, /(XT\d{3,4}) build\//i, /(nexus\s6)/i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [ /android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [ /hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices ], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [ /hbbtv.+maple;(\d+)/i ], [[MODEL, /^/, 'SmartTV'], [VENDOR, 'Samsung'], [TYPE, SMARTTV]], [ /\(dtv[\);].+(aquos)/i // Sharp ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung /smart-tv.+(samsung)/i ], [VENDOR, [TYPE, SMARTTV], MODEL], [ /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ /sie-(\w+)*/i // Siemens ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [ /(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia /(nokia)[\s_-]?([\w-]+)*/i ], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [ /android\s3\.[\s\w;-]{10}(a\d{3})/i // Acer ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [ /android.+([vl]k\-?\d{3})\s+build/i // LG Tablet ], [MODEL, [VENDOR, 'LG'], [TYPE, TABLET]], [ /android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ /(lg) netcast\.tv/i // LG SmartTV ], [VENDOR, MODEL, [TYPE, SMARTTV]], [ /(nexus\s[45])/i, // LG /lg[e;\s\/-]+(\w+)*/i, /android.+lg(\-?[\d\w]+)\s+build/i ], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [ /android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [ /linux;.+((jolla));/i // Jolla ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /((pebble))app\/[\d\.]+\s/i // Pebble ], [VENDOR, MODEL, [TYPE, WEARABLE]], [ /android.+;\s(oppo)\s?([\w\s]+)\sbuild/i // OPPO ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /crkey/i // Google Chromecast ], [[MODEL, 'Chromecast'], [VENDOR, 'Google']], [ /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ /android.+;\s(pixel c)\s/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ /android.+;\s(pixel xl|pixel)\s/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ /android.+(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Mi /android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+)?)\s+build/i // Redmi Phones ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ /android.+(mi[\s\-_]*(?:pad)?(?:[\s_]*[\w\s]+)?)\s+build/i // Mi Pad tablets ],[[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, TABLET]], [ /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ /android.+a000(1)\s+build/i // OnePlus ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Venue[\d\s]*)\s+build/i // Dell Venue Tablets ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [ /android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i // Barnes & Noble Tablet ], [[VENDOR, 'Barnes & Noble'], MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i // Barnes & Noble Tablet ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [ /android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i // ZTE K Series Tablet ], [[VENDOR, 'ZTE'], MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(gen\d{3})\s+build.*49h/i // Swiss GEN Mobile ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [ /android.+[;\/]\s*(zur\d{3})\s+build/i // Swiss ZUR Tablet ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [ /android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i // Zeki Tablets ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [ /(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i, /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i // Dragon Touch Tablet ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(NS-?.+)\s+build/i // Insignia Tablets ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [ /android.+[;\/]\s*((NX|Next)-?.+)\s+build/i // NextBook Tablets ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones /android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i // LvTel Phones ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i // Le Pan Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i // Trinity Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ /android.+(KS(.+))\s+build/i // Amazon Kindle Tablets ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ /android.+(Gigaset)[\s\-]+(Q.+)\s+build/i // Gigaset Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ /(android.+)[;\/].+build/i // Generic Android Device ], [MODEL, [VENDOR, 'Generic']] /*////////////////////////// // TODO: move to string map //////////////////////////// /(C6603)/i // Sony Xperia Z C6603 ], [[MODEL, 'Xperia Z C6603'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /(C6903)/i // Sony Xperia Z 1 ], [[MODEL, 'Xperia Z 1'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /(SM-G900[F|H])/i // Samsung Galaxy S5 ], [[MODEL, 'Galaxy S5'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-G7102)/i // Samsung Galaxy Grand 2 ], [[MODEL, 'Galaxy Grand 2'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-G530H)/i // Samsung Galaxy Grand Prime ], [[MODEL, 'Galaxy Grand Prime'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-G313HZ)/i // Samsung Galaxy V ], [[MODEL, 'Galaxy V'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-T805)/i // Samsung Galaxy Tab S 10.5 ], [[MODEL, 'Galaxy Tab S 10.5'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ /(SM-G800F)/i // Samsung Galaxy S5 Mini ], [[MODEL, 'Galaxy S5 Mini'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-T311)/i // Samsung Galaxy Tab 3 8.0 ], [[MODEL, 'Galaxy Tab 3 8.0'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ /(T3C)/i // Advan Vandroid T3C ], [MODEL, [VENDOR, 'Advan'], [TYPE, TABLET]], [ /(ADVAN T1J\+)/i // Advan Vandroid T1J+ ], [[MODEL, 'Vandroid T1J+'], [VENDOR, 'Advan'], [TYPE, TABLET]], [ /(ADVAN S4A)/i // Advan Vandroid S4A ], [[MODEL, 'Vandroid S4A'], [VENDOR, 'Advan'], [TYPE, MOBILE]], [ /(V972M)/i // ZTE V972M ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [ /(i-mobile)\s(IQ\s[\d\.]+)/i // i-mobile IQ ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /(IQ6.3)/i // i-mobile IQ IQ 6.3 ], [[MODEL, 'IQ 6.3'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [ /(i-mobile)\s(i-style\s[\d\.]+)/i // i-mobile i-STYLE ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /(i-STYLE2.1)/i // i-mobile i-STYLE 2.1 ], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [ /(mobiistar touch LAI 512)/i // mobiistar touch LAI 512 ], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [ ///////////// // END TODO ///////////*/ ], engine : [[ /windows.+\sedge\/([\w\.]+)/i // EdgeHTML ], [VERSION, [NAME, 'EdgeHTML']], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab ], [NAME, VERSION], [ /rv\:([\w\.]+).*(gecko)/i // Gecko ], [VERSION, NAME] ], os : [[ // Windows based /microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes) ], [NAME, VERSION], [ /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i, // Windows Phone /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [ /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i ], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [ // Mobile/Embedded OS /\((bb)(10);/i // BlackBerry 10 ], [[NAME, 'BlackBerry'], VERSION], [ /(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry /(tizen)[\/\s]([\w\.]+)/i, // Tizen /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i, // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki /linux;.+(sailfish);/i // Sailfish OS ], [NAME, VERSION], [ /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian ], [[NAME, 'Symbian'], VERSION], [ /\((series40);/i // Series 40 ], [NAME], [ /mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS ], [[NAME, 'Firefox OS'], VERSION], [ // Console /(nintendo|playstation)\s([wids34portablevu]+)/i, // Nintendo/Playstation // GNU/Linux based /(mint)[\/\s\(]?(\w+)*/i, // Mint /(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i, // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux /(gnu)\s?([\w\.]+)*/i // GNU ], [NAME, VERSION], [ /(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS ], [[NAME, 'Chromium OS'], VERSION],[ // Solaris /(sunos)\s?([\w\.]+\d)*/i // Solaris ], [[NAME, 'Solaris'], VERSION], [ // BSD based /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ /(haiku)\s(\w+)/i // Haiku ], [NAME, VERSION],[ /cfnetwork\/.+darwin/i, /ip[honead]+(?:.*os\s([\w]+)\slike\smac|;\sopera)/i // iOS ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(macintosh|mac(?=_powerpc)\s)/i // Mac OS ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ // Other /((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS /(unix)\s?([\w\.]+)*/i // UNIX ], [NAME, VERSION] ] }; ///////////////// // Constructor //////////////// /* var Browser = function (name, version) { this[NAME] = name; this[VERSION] = version; }; var CPU = function (arch) { this[ARCHITECTURE] = arch; }; var Device = function (vendor, model, type) { this[VENDOR] = vendor; this[MODEL] = model; this[TYPE] = type; }; var Engine = Browser; var OS = Browser; */ var UAParser = function (uastring, extensions) { if (typeof uastring === 'object') { extensions = uastring; uastring = undefined; } if (!(this instanceof UAParser)) { return new UAParser(uastring, extensions).getResult(); } var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); var rgxmap = extensions ? util.extend(regexes, extensions) : regexes; //var browser = new Browser(); //var cpu = new CPU(); //var device = new Device(); //var engine = new Engine(); //var os = new OS(); this.getBrowser = function () { var browser = { name: undefined, version: undefined }; mapper.rgx.call(browser, ua, rgxmap.browser); browser.major = util.major(browser.version); // deprecated return browser; }; this.getCPU = function () { var cpu = { architecture: undefined }; mapper.rgx.call(cpu, ua, rgxmap.cpu); return cpu; }; this.getDevice = function () { var device = { vendor: undefined, model: undefined, type: undefined }; mapper.rgx.call(device, ua, rgxmap.device); return device; }; this.getEngine = function () { var engine = { name: undefined, version: undefined }; mapper.rgx.call(engine, ua, rgxmap.engine); return engine; }; this.getOS = function () { var os = { name: undefined, version: undefined }; mapper.rgx.call(os, ua, rgxmap.os); return os; }; this.getResult = function () { return { ua : this.getUA(), browser : this.getBrowser(), engine : this.getEngine(), os : this.getOS(), device : this.getDevice(), cpu : this.getCPU() }; }; this.getUA = function () { return ua; }; this.setUA = function (uastring) { ua = uastring; //browser = new Browser(); //cpu = new CPU(); //device = new Device(); //engine = new Engine(); //os = new OS(); return this; }; return this; }; UAParser.VERSION = LIBVERSION; UAParser.BROWSER = { NAME : NAME, MAJOR : MAJOR, // deprecated VERSION : VERSION }; UAParser.CPU = { ARCHITECTURE : ARCHITECTURE }; UAParser.DEVICE = { MODEL : MODEL, VENDOR : VENDOR, TYPE : TYPE, CONSOLE : CONSOLE, MOBILE : MOBILE, SMARTTV : SMARTTV, TABLET : TABLET, WEARABLE: WEARABLE, EMBEDDED: EMBEDDED }; UAParser.ENGINE = { NAME : NAME, VERSION : VERSION }; UAParser.OS = { NAME : NAME, VERSION : VERSION }; //UAParser.Utils = util; /////////// // Export ////////// // check js environment if (typeof(exports) !== UNDEF_TYPE) { // nodejs env if (typeof module !== UNDEF_TYPE && module.exports) { exports = module.exports = UAParser; } // TODO: test!!!!!!!! /* if (require && require.main === module && process) { // cli var jsonize = function (arr) { var res = []; for (var i in arr) { res.push(new UAParser(arr[i]).getResult()); } process.stdout.write(JSON.stringify(res, null, 2) + '\n'); }; if (process.stdin.isTTY) { // via args jsonize(process.argv.slice(2)); } else { // via pipe var str = ''; process.stdin.on('readable', function() { var read = process.stdin.read(); if (read !== null) { str += read; } }); process.stdin.on('end', function () { jsonize(str.replace(/\n$/, '').split('\n')); }); } } */ exports.UAParser = UAParser; } else { // requirejs env (optional) if ("function" === FUNC_TYPE && __webpack_require__("../../../../webpack/buildin/amd-options.js")) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return UAParser; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (window) { // browser env window.UAParser = UAParser; } } // jQuery/Zepto specific (optional) // Note: // In AMD env the global scope should be kept clean, but jQuery is an exception. // jQuery always exports to global scope, unless jQuery.noConflict(true) is used, // and we should catch that. var $ = window && (window.jQuery || window.Zepto); if (typeof $ !== UNDEF_TYPE) { var parser = new UAParser(); $.ua = parser.getResult(); $.ua.get = function () { return parser.getUA(); }; $.ua.set = function (uastring) { parser.setUA(uastring); var result = parser.getResult(); for (var prop in result) { $.ua[prop] = result[prop]; } }; } })(typeof window === 'object' ? window : this); /***/ }), /***/ "../../../../uuid/index.js": /***/ (function(module, exports, __webpack_require__) { var v1 = __webpack_require__("../../../../uuid/v1.js"); var v4 = __webpack_require__("../../../../uuid/v4.js"); var uuid = v4; uuid.v1 = v1; uuid.v4 = v4; module.exports = uuid; /***/ }), /***/ "../../../../uuid/lib/bytesToUuid.js": /***/ (function(module, exports) { /** * Convert array of 16 byte values to UUID string format of the form: * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX */ var byteToHex = []; for (var i = 0; i < 256; ++i) { byteToHex[i] = (i + 0x100).toString(16).substr(1); } function bytesToUuid(buf, offset) { var i = offset || 0; var bth = byteToHex; return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; } module.exports = bytesToUuid; /***/ }), /***/ "../../../../uuid/lib/rng-browser.js": /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {// Unique ID creation requires a high quality random # generator. In the // browser this is a little complicated due to unknown quality of Math.random() // and inconsistent support for the `crypto` API. We do the best we can via // feature-detection var rng; var crypto = global.crypto || global.msCrypto; // for IE 11 if (crypto && crypto.getRandomValues) { // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef rng = function whatwgRNG() { crypto.getRandomValues(rnds8); return rnds8; }; } if (!rng) { // Math.random()-based (RNG) // // If all else fails, use Math.random(). It's fast, but is of unspecified // quality. var rnds = new Array(16); rng = function() { for (var i = 0, r; i < 16; i++) { if ((i & 0x03) === 0) r = Math.random() * 0x100000000; rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; } return rnds; }; } module.exports = rng; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../../../../webpack/buildin/global.js"))) /***/ }), /***/ "../../../../uuid/v1.js": /***/ (function(module, exports, __webpack_require__) { var rng = __webpack_require__("../../../../uuid/lib/rng-browser.js"); var bytesToUuid = __webpack_require__("../../../../uuid/lib/bytesToUuid.js"); // **`v1()` - Generate time-based UUID** // // Inspired by https://github.com/LiosK/UUID.js // and http://docs.python.org/library/uuid.html // random #'s we need to init node and clockseq var _seedBytes = rng(); // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) var _nodeId = [ _seedBytes[0] | 0x01, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] ]; // Per 4.2.2, randomize (14 bit) clockseq var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; // Previous uuid creation time var _lastMSecs = 0, _lastNSecs = 0; // See https://github.com/broofa/node-uuid for API details function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; options = options || {}; var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // UUID timestamps are 100 nano-second units since the Gregorian epoch, // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock // cycle to simulate higher resolution clock var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; // Per 4.2.1.2, Bump clockseq on clock regression if (dt < 0 && options.clockseq === undefined) { clockseq = clockseq + 1 & 0x3fff; } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new // time interval if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { nsecs = 0; } // Per 4.2.1.2 Throw error if too many uuids are requested if (nsecs >= 10000) { throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); } _lastMSecs = msecs; _lastNSecs = nsecs; _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch msecs += 12219292800000; // `time_low` var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; b[i++] = tl >>> 24 & 0xff; b[i++] = tl >>> 16 & 0xff; b[i++] = tl >>> 8 & 0xff; b[i++] = tl & 0xff; // `time_mid` var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; b[i++] = tmh >>> 8 & 0xff; b[i++] = tmh & 0xff; // `time_high_and_version` b[i++] = tmh >>> 24 & 0xf | 0x10; // include version b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` b[i++] = clockseq & 0xff; // `node` var node = options.node || _nodeId; for (var n = 0; n < 6; ++n) { b[i + n] = node[n]; } return buf ? buf : bytesToUuid(b); } module.exports = v1; /***/ }), /***/ "../../../../uuid/v4.js": /***/ (function(module, exports, __webpack_require__) { var rng = __webpack_require__("../../../../uuid/lib/rng-browser.js"); var bytesToUuid = __webpack_require__("../../../../uuid/lib/bytesToUuid.js"); function v4(options, buf, offset) { var i = buf && offset || 0; if (typeof(options) == 'string') { buf = options == 'binary' ? new Array(16) : null; options = null; } options = options || {}; var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` rnds[6] = (rnds[6] & 0x0f) | 0x40; rnds[8] = (rnds[8] & 0x3f) | 0x80; // Copy bytes to buffer, if provided if (buf) { for (var ii = 0; ii < 16; ++ii) { buf[i + ii] = rnds[ii]; } } return buf || bytesToUuid(rnds); } module.exports = v4; /***/ }), /***/ "../../../../webpack/buildin/amd-options.js": /***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */ module.exports = __webpack_amd_options__; /* WEBPACK VAR INJECTION */}.call(exports, {})) /***/ }), /***/ "../../../../webpack/buildin/global.js": /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /***/ "../../../../webpack/buildin/module.js": /***/ (function(module, exports) { module.exports = function(module) { if(!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if(!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/adapter_core.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var adapterFactory = __webpack_require__("../../../../webrtc-adapter/src/js/adapter_factory.js"); module.exports = adapterFactory({window: global.window}); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("../../../../webpack/buildin/global.js"))) /***/ }), /***/ "../../../../webrtc-adapter/src/js/adapter_factory.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); // Shimming starts here. module.exports = function(dependencies, opts) { var window = dependencies && dependencies.window; var options = { shimChrome: true, shimFirefox: true, shimEdge: true, shimSafari: true, }; for (var key in opts) { if (hasOwnProperty.call(opts, key)) { options[key] = opts[key]; } } // Utils. var logging = utils.log; var browserDetails = utils.detectBrowser(window); // Export to the adapter global object visible in the browser. var adapter = { browserDetails: browserDetails, extractVersion: utils.extractVersion, disableLog: utils.disableLog, disableWarnings: utils.disableWarnings }; // Uncomment the line below if you want logging to occur, including logging // for the switch statement below. Can also be turned on in the browser via // adapter.disableLog(false), but then logging from the switch statement below // will not appear. // require('./utils').disableLog(false); // Browser shims. var chromeShim = __webpack_require__("../../../../webrtc-adapter/src/js/chrome/chrome_shim.js") || null; var edgeShim = __webpack_require__("../../../../webrtc-adapter/src/js/edge/edge_shim.js") || null; var firefoxShim = __webpack_require__("../../../../webrtc-adapter/src/js/firefox/firefox_shim.js") || null; var safariShim = __webpack_require__("../../../../webrtc-adapter/src/js/safari/safari_shim.js") || null; var commonShim = __webpack_require__("../../../../webrtc-adapter/src/js/common_shim.js") || null; // Shim browser if found. switch (browserDetails.browser) { case 'chrome': if (!chromeShim || !chromeShim.shimPeerConnection || !options.shimChrome) { logging('Chrome shim is not included in this adapter release.'); return adapter; } logging('adapter.js shimming chrome.'); // Export to the adapter global object visible in the browser. adapter.browserShim = chromeShim; commonShim.shimCreateObjectURL(window); chromeShim.shimGetUserMedia(window); chromeShim.shimMediaStream(window); chromeShim.shimSourceObject(window); chromeShim.shimPeerConnection(window); chromeShim.shimOnTrack(window); chromeShim.shimAddTrackRemoveTrack(window); chromeShim.shimGetSendersWithDtmf(window); commonShim.shimRTCIceCandidate(window); break; case 'firefox': if (!firefoxShim || !firefoxShim.shimPeerConnection || !options.shimFirefox) { logging('Firefox shim is not included in this adapter release.'); return adapter; } logging('adapter.js shimming firefox.'); // Export to the adapter global object visible in the browser. adapter.browserShim = firefoxShim; commonShim.shimCreateObjectURL(window); firefoxShim.shimGetUserMedia(window); firefoxShim.shimSourceObject(window); firefoxShim.shimPeerConnection(window); firefoxShim.shimOnTrack(window); firefoxShim.shimRemoveStream(window); commonShim.shimRTCIceCandidate(window); break; case 'edge': if (!edgeShim || !edgeShim.shimPeerConnection || !options.shimEdge) { logging('MS edge shim is not included in this adapter release.'); return adapter; } logging('adapter.js shimming edge.'); // Export to the adapter global object visible in the browser. adapter.browserShim = edgeShim; commonShim.shimCreateObjectURL(window); edgeShim.shimGetUserMedia(window); edgeShim.shimPeerConnection(window); edgeShim.shimReplaceTrack(window); // the edge shim implements the full RTCIceCandidate object. break; case 'safari': if (!safariShim || !options.shimSafari) { logging('Safari shim is not included in this adapter release.'); return adapter; } logging('adapter.js shimming safari.'); // Export to the adapter global object visible in the browser. adapter.browserShim = safariShim; commonShim.shimCreateObjectURL(window); safariShim.shimRTCIceServerUrls(window); safariShim.shimCallbacksAPI(window); safariShim.shimLocalStreamsAPI(window); safariShim.shimRemoteStreamsAPI(window); safariShim.shimTrackEventTransceiver(window); safariShim.shimGetUserMedia(window); safariShim.shimCreateOfferLegacy(window); commonShim.shimRTCIceCandidate(window); break; default: logging('Unsupported browser!'); break; } return adapter; }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/chrome/chrome_shim.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); var logging = utils.log; module.exports = { shimGetUserMedia: __webpack_require__("../../../../webrtc-adapter/src/js/chrome/getusermedia.js"), shimMediaStream: function(window) { window.MediaStream = window.MediaStream || window.webkitMediaStream; }, shimOnTrack: function(window) { if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in window.RTCPeerConnection.prototype)) { Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', { get: function() { return this._ontrack; }, set: function(f) { if (this._ontrack) { this.removeEventListener('track', this._ontrack); } this.addEventListener('track', this._ontrack = f); } }); var origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription; window.RTCPeerConnection.prototype.setRemoteDescription = function() { var pc = this; if (!pc._ontrackpoly) { pc._ontrackpoly = function(e) { // onaddstream does not fire when a track is added to an existing // stream. But stream.onaddtrack is implemented so we use that. e.stream.addEventListener('addtrack', function(te) { var receiver; if (window.RTCPeerConnection.prototype.getReceivers) { receiver = pc.getReceivers().find(function(r) { return r.track && r.track.id === te.track.id; }); } else { receiver = {track: te.track}; } var event = new Event('track'); event.track = te.track; event.receiver = receiver; event.transceiver = {receiver: receiver}; event.streams = [e.stream]; pc.dispatchEvent(event); }); e.stream.getTracks().forEach(function(track) { var receiver; if (window.RTCPeerConnection.prototype.getReceivers) { receiver = pc.getReceivers().find(function(r) { return r.track && r.track.id === track.id; }); } else { receiver = {track: track}; } var event = new Event('track'); event.track = track; event.receiver = receiver; event.transceiver = {receiver: receiver}; event.streams = [e.stream]; pc.dispatchEvent(event); }); }; pc.addEventListener('addstream', pc._ontrackpoly); } return origSetRemoteDescription.apply(pc, arguments); }; } }, shimGetSendersWithDtmf: function(window) { // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack. if (typeof window === 'object' && window.RTCPeerConnection && !('getSenders' in window.RTCPeerConnection.prototype) && 'createDTMFSender' in window.RTCPeerConnection.prototype) { var shimSenderWithDtmf = function(pc, track) { return { track: track, get dtmf() { if (this._dtmf === undefined) { if (track.kind === 'audio') { this._dtmf = pc.createDTMFSender(track); } else { this._dtmf = null; } } return this._dtmf; }, _pc: pc }; }; // augment addTrack when getSenders is not available. if (!window.RTCPeerConnection.prototype.getSenders) { window.RTCPeerConnection.prototype.getSenders = function() { this._senders = this._senders || []; return this._senders.slice(); // return a copy of the internal state. }; var origAddTrack = window.RTCPeerConnection.prototype.addTrack; window.RTCPeerConnection.prototype.addTrack = function(track, stream) { var pc = this; var sender = origAddTrack.apply(pc, arguments); if (!sender) { sender = shimSenderWithDtmf(pc, track); pc._senders.push(sender); } return sender; }; var origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack; window.RTCPeerConnection.prototype.removeTrack = function(sender) { var pc = this; origRemoveTrack.apply(pc, arguments); var idx = pc._senders.indexOf(sender); if (idx !== -1) { pc._senders.splice(idx, 1); } }; } var origAddStream = window.RTCPeerConnection.prototype.addStream; window.RTCPeerConnection.prototype.addStream = function(stream) { var pc = this; pc._senders = pc._senders || []; origAddStream.apply(pc, [stream]); stream.getTracks().forEach(function(track) { pc._senders.push(shimSenderWithDtmf(pc, track)); }); }; var origRemoveStream = window.RTCPeerConnection.prototype.removeStream; window.RTCPeerConnection.prototype.removeStream = function(stream) { var pc = this; pc._senders = pc._senders || []; origRemoveStream.apply(pc, [stream]); stream.getTracks().forEach(function(track) { var sender = pc._senders.find(function(s) { return s.track === track; }); if (sender) { pc._senders.splice(pc._senders.indexOf(sender), 1); // remove sender } }); }; } else if (typeof window === 'object' && window.RTCPeerConnection && 'getSenders' in window.RTCPeerConnection.prototype && 'createDTMFSender' in window.RTCPeerConnection.prototype && window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) { var origGetSenders = window.RTCPeerConnection.prototype.getSenders; window.RTCPeerConnection.prototype.getSenders = function() { var pc = this; var senders = origGetSenders.apply(pc, []); senders.forEach(function(sender) { sender._pc = pc; }); return senders; }; Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', { get: function() { if (this._dtmf === undefined) { if (this.track.kind === 'audio') { this._dtmf = this._pc.createDTMFSender(this.track); } else { this._dtmf = null; } } return this._dtmf; } }); } }, shimSourceObject: function(window) { var URL = window && window.URL; if (typeof window === 'object') { if (window.HTMLMediaElement && !('srcObject' in window.HTMLMediaElement.prototype)) { // Shim the srcObject property, once, when HTMLMediaElement is found. Object.defineProperty(window.HTMLMediaElement.prototype, 'srcObject', { get: function() { return this._srcObject; }, set: function(stream) { var self = this; // Use _srcObject as a private property for this shim this._srcObject = stream; if (this.src) { URL.revokeObjectURL(this.src); } if (!stream) { this.src = ''; return undefined; } this.src = URL.createObjectURL(stream); // We need to recreate the blob url when a track is added or // removed. Doing it manually since we want to avoid a recursion. stream.addEventListener('addtrack', function() { if (self.src) { URL.revokeObjectURL(self.src); } self.src = URL.createObjectURL(stream); }); stream.addEventListener('removetrack', function() { if (self.src) { URL.revokeObjectURL(self.src); } self.src = URL.createObjectURL(stream); }); } }); } } }, shimAddTrackRemoveTrackWithNative: function(window) { // shim addTrack/removeTrack with native variants in order to make // the interactions with legacy getLocalStreams behave as in other browsers. // Keeps a mapping stream.id => [stream, rtpsenders...] window.RTCPeerConnection.prototype.getLocalStreams = function() { var pc = this; this._shimmedLocalStreams = this._shimmedLocalStreams || {}; return Object.keys(this._shimmedLocalStreams).map(function(streamId) { return pc._shimmedLocalStreams[streamId][0]; }); }; var origAddTrack = window.RTCPeerConnection.prototype.addTrack; window.RTCPeerConnection.prototype.addTrack = function(track, stream) { if (!stream) { return origAddTrack.apply(this, arguments); } this._shimmedLocalStreams = this._shimmedLocalStreams || {}; var sender = origAddTrack.apply(this, arguments); if (!this._shimmedLocalStreams[stream.id]) { this._shimmedLocalStreams[stream.id] = [stream, sender]; } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) { this._shimmedLocalStreams[stream.id].push(sender); } return sender; }; var origAddStream = window.RTCPeerConnection.prototype.addStream; window.RTCPeerConnection.prototype.addStream = function(stream) { var pc = this; this._shimmedLocalStreams = this._shimmedLocalStreams || {}; stream.getTracks().forEach(function(track) { var alreadyExists = pc.getSenders().find(function(s) { return s.track === track; }); if (alreadyExists) { throw new DOMException('Track already exists.', 'InvalidAccessError'); } }); var existingSenders = pc.getSenders(); origAddStream.apply(this, arguments); var newSenders = pc.getSenders().filter(function(newSender) { return existingSenders.indexOf(newSender) === -1; }); this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders); }; var origRemoveStream = window.RTCPeerConnection.prototype.removeStream; window.RTCPeerConnection.prototype.removeStream = function(stream) { this._shimmedLocalStreams = this._shimmedLocalStreams || {}; delete this._shimmedLocalStreams[stream.id]; return origRemoveStream.apply(this, arguments); }; var origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack; window.RTCPeerConnection.prototype.removeTrack = function(sender) { var pc = this; this._shimmedLocalStreams = this._shimmedLocalStreams || {}; if (sender) { Object.keys(this._shimmedLocalStreams).forEach(function(streamId) { var idx = pc._shimmedLocalStreams[streamId].indexOf(sender); if (idx !== -1) { pc._shimmedLocalStreams[streamId].splice(idx, 1); } if (pc._shimmedLocalStreams[streamId].length === 1) { delete pc._shimmedLocalStreams[streamId]; } }); } return origRemoveTrack.apply(this, arguments); }; }, shimAddTrackRemoveTrack: function(window) { var browserDetails = utils.detectBrowser(window); // shim addTrack and removeTrack. if (window.RTCPeerConnection.prototype.addTrack && browserDetails.version >= 65) { return this.shimAddTrackRemoveTrackWithNative(window); } // also shim pc.getLocalStreams when addTrack is shimmed // to return the original streams. var origGetLocalStreams = window.RTCPeerConnection.prototype .getLocalStreams; window.RTCPeerConnection.prototype.getLocalStreams = function() { var pc = this; var nativeStreams = origGetLocalStreams.apply(this); pc._reverseStreams = pc._reverseStreams || {}; return nativeStreams.map(function(stream) { return pc._reverseStreams[stream.id]; }); }; var origAddStream = window.RTCPeerConnection.prototype.addStream; window.RTCPeerConnection.prototype.addStream = function(stream) { var pc = this; pc._streams = pc._streams || {}; pc._reverseStreams = pc._reverseStreams || {}; stream.getTracks().forEach(function(track) { var alreadyExists = pc.getSenders().find(function(s) { return s.track === track; }); if (alreadyExists) { throw new DOMException('Track already exists.', 'InvalidAccessError'); } }); // Add identity mapping for consistency with addTrack. // Unless this is being used with a stream from addTrack. if (!pc._reverseStreams[stream.id]) { var newStream = new window.MediaStream(stream.getTracks()); pc._streams[stream.id] = newStream; pc._reverseStreams[newStream.id] = stream; stream = newStream; } origAddStream.apply(pc, [stream]); }; var origRemoveStream = window.RTCPeerConnection.prototype.removeStream; window.RTCPeerConnection.prototype.removeStream = function(stream) { var pc = this; pc._streams = pc._streams || {}; pc._reverseStreams = pc._reverseStreams || {}; origRemoveStream.apply(pc, [(pc._streams[stream.id] || stream)]); delete pc._reverseStreams[(pc._streams[stream.id] ? pc._streams[stream.id].id : stream.id)]; delete pc._streams[stream.id]; }; window.RTCPeerConnection.prototype.addTrack = function(track, stream) { var pc = this; if (pc.signalingState === 'closed') { throw new DOMException( 'The RTCPeerConnection\'s signalingState is \'closed\'.', 'InvalidStateError'); } var streams = [].slice.call(arguments, 1); if (streams.length !== 1 || !streams[0].getTracks().find(function(t) { return t === track; })) { // this is not fully correct but all we can manage without // [[associated MediaStreams]] internal slot. throw new DOMException( 'The adapter.js addTrack polyfill only supports a single ' + ' stream which is associated with the specified track.', 'NotSupportedError'); } var alreadyExists = pc.getSenders().find(function(s) { return s.track === track; }); if (alreadyExists) { throw new DOMException('Track already exists.', 'InvalidAccessError'); } pc._streams = pc._streams || {}; pc._reverseStreams = pc._reverseStreams || {}; var oldStream = pc._streams[stream.id]; if (oldStream) { // this is using odd Chrome behaviour, use with caution: // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815 // Note: we rely on the high-level addTrack/dtmf shim to // create the sender with a dtmf sender. oldStream.addTrack(track); // Trigger ONN async. Promise.resolve().then(function() { pc.dispatchEvent(new Event('negotiationneeded')); }); } else { var newStream = new window.MediaStream([track]); pc._streams[stream.id] = newStream; pc._reverseStreams[newStream.id] = stream; pc.addStream(newStream); } return pc.getSenders().find(function(s) { return s.track === track; }); }; // replace the internal stream id with the external one and // vice versa. function replaceInternalStreamId(pc, description) { var sdp = description.sdp; Object.keys(pc._reverseStreams || []).forEach(function(internalId) { var externalStream = pc._reverseStreams[internalId]; var internalStream = pc._streams[externalStream.id]; sdp = sdp.replace(new RegExp(internalStream.id, 'g'), externalStream.id); }); return new RTCSessionDescription({ type: description.type, sdp: sdp }); } function replaceExternalStreamId(pc, description) { var sdp = description.sdp; Object.keys(pc._reverseStreams || []).forEach(function(internalId) { var externalStream = pc._reverseStreams[internalId]; var internalStream = pc._streams[externalStream.id]; sdp = sdp.replace(new RegExp(externalStream.id, 'g'), internalStream.id); }); return new RTCSessionDescription({ type: description.type, sdp: sdp }); } ['createOffer', 'createAnswer'].forEach(function(method) { var nativeMethod = window.RTCPeerConnection.prototype[method]; window.RTCPeerConnection.prototype[method] = function() { var pc = this; var args = arguments; var isLegacyCall = arguments.length && typeof arguments[0] === 'function'; if (isLegacyCall) { return nativeMethod.apply(pc, [ function(description) { var desc = replaceInternalStreamId(pc, description); args[0].apply(null, [desc]); }, function(err) { if (args[1]) { args[1].apply(null, err); } }, arguments[2] ]); } return nativeMethod.apply(pc, arguments) .then(function(description) { return replaceInternalStreamId(pc, description); }); }; }); var origSetLocalDescription = window.RTCPeerConnection.prototype.setLocalDescription; window.RTCPeerConnection.prototype.setLocalDescription = function() { var pc = this; if (!arguments.length || !arguments[0].type) { return origSetLocalDescription.apply(pc, arguments); } arguments[0] = replaceExternalStreamId(pc, arguments[0]); return origSetLocalDescription.apply(pc, arguments); }; // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier var origLocalDescription = Object.getOwnPropertyDescriptor( window.RTCPeerConnection.prototype, 'localDescription'); Object.defineProperty(window.RTCPeerConnection.prototype, 'localDescription', { get: function() { var pc = this; var description = origLocalDescription.get.apply(this); if (description.type === '') { return description; } return replaceInternalStreamId(pc, description); } }); window.RTCPeerConnection.prototype.removeTrack = function(sender) { var pc = this; if (pc.signalingState === 'closed') { throw new DOMException( 'The RTCPeerConnection\'s signalingState is \'closed\'.', 'InvalidStateError'); } // We can not yet check for sender instanceof RTCRtpSender // since we shim RTPSender. So we check if sender._pc is set. if (!sender._pc) { throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' + 'does not implement interface RTCRtpSender.', 'TypeError'); } var isLocal = sender._pc === pc; if (!isLocal) { throw new DOMException('Sender was not created by this connection.', 'InvalidAccessError'); } // Search for the native stream the senders track belongs to. pc._streams = pc._streams || {}; var stream; Object.keys(pc._streams).forEach(function(streamid) { var hasTrack = pc._streams[streamid].getTracks().find(function(track) { return sender.track === track; }); if (hasTrack) { stream = pc._streams[streamid]; } }); if (stream) { if (stream.getTracks().length === 1) { // if this is the last track of the stream, remove the stream. This // takes care of any shimmed _senders. pc.removeStream(pc._reverseStreams[stream.id]); } else { // relying on the same odd chrome behaviour as above. stream.removeTrack(sender.track); } pc.dispatchEvent(new Event('negotiationneeded')); } }; }, shimPeerConnection: function(window) { var browserDetails = utils.detectBrowser(window); // The RTCPeerConnection object. if (!window.RTCPeerConnection) { window.RTCPeerConnection = function(pcConfig, pcConstraints) { // Translate iceTransportPolicy to iceTransports, // see https://code.google.com/p/webrtc/issues/detail?id=4869 // this was fixed in M56 along with unprefixing RTCPeerConnection. logging('PeerConnection'); if (pcConfig && pcConfig.iceTransportPolicy) { pcConfig.iceTransports = pcConfig.iceTransportPolicy; } return new window.webkitRTCPeerConnection(pcConfig, pcConstraints); }; window.RTCPeerConnection.prototype = window.webkitRTCPeerConnection.prototype; // wrap static methods. Currently just generateCertificate. if (window.webkitRTCPeerConnection.generateCertificate) { Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', { get: function() { return window.webkitRTCPeerConnection.generateCertificate; } }); } } else { // migrate from non-spec RTCIceServer.url to RTCIceServer.urls var OrigPeerConnection = window.RTCPeerConnection; window.RTCPeerConnection = function(pcConfig, pcConstraints) { if (pcConfig && pcConfig.iceServers) { var newIceServers = []; for (var i = 0; i < pcConfig.iceServers.length; i++) { var server = pcConfig.iceServers[i]; if (!server.hasOwnProperty('urls') && server.hasOwnProperty('url')) { utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls'); server = JSON.parse(JSON.stringify(server)); server.urls = server.url; newIceServers.push(server); } else { newIceServers.push(pcConfig.iceServers[i]); } } pcConfig.iceServers = newIceServers; } return new OrigPeerConnection(pcConfig, pcConstraints); }; window.RTCPeerConnection.prototype = OrigPeerConnection.prototype; // wrap static methods. Currently just generateCertificate. Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', { get: function() { return OrigPeerConnection.generateCertificate; } }); } var origGetStats = window.RTCPeerConnection.prototype.getStats; window.RTCPeerConnection.prototype.getStats = function(selector, successCallback, errorCallback) { var pc = this; var args = arguments; // If selector is a function then we are in the old style stats so just // pass back the original getStats format to avoid breaking old users. if (arguments.length > 0 && typeof selector === 'function') { return origGetStats.apply(this, arguments); } // When spec-style getStats is supported, return those when called with // either no arguments or the selector argument is null. if (origGetStats.length === 0 && (arguments.length === 0 || typeof arguments[0] !== 'function')) { return origGetStats.apply(this, []); } var fixChromeStats_ = function(response) { var standardReport = {}; var reports = response.result(); reports.forEach(function(report) { var standardStats = { id: report.id, timestamp: report.timestamp, type: { localcandidate: 'local-candidate', remotecandidate: 'remote-candidate' }[report.type] || report.type }; report.names().forEach(function(name) { standardStats[name] = report.stat(name); }); standardReport[standardStats.id] = standardStats; }); return standardReport; }; // shim getStats with maplike support var makeMapStats = function(stats) { return new Map(Object.keys(stats).map(function(key) { return [key, stats[key]]; })); }; if (arguments.length >= 2) { var successCallbackWrapper_ = function(response) { args[1](makeMapStats(fixChromeStats_(response))); }; return origGetStats.apply(this, [successCallbackWrapper_, arguments[0]]); } // promise-support return new Promise(function(resolve, reject) { origGetStats.apply(pc, [ function(response) { resolve(makeMapStats(fixChromeStats_(response))); }, reject]); }).then(successCallback, errorCallback); }; // add promise support -- natively available in Chrome 51 if (browserDetails.version < 51) { ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] .forEach(function(method) { var nativeMethod = window.RTCPeerConnection.prototype[method]; window.RTCPeerConnection.prototype[method] = function() { var args = arguments; var pc = this; var promise = new Promise(function(resolve, reject) { nativeMethod.apply(pc, [args[0], resolve, reject]); }); if (args.length < 2) { return promise; } return promise.then(function() { args[1].apply(null, []); }, function(err) { if (args.length >= 3) { args[2].apply(null, [err]); } }); }; }); } // promise support for createOffer and createAnswer. Available (without // bugs) since M52: crbug/619289 if (browserDetails.version < 52) { ['createOffer', 'createAnswer'].forEach(function(method) { var nativeMethod = window.RTCPeerConnection.prototype[method]; window.RTCPeerConnection.prototype[method] = function() { var pc = this; if (arguments.length < 1 || (arguments.length === 1 && typeof arguments[0] === 'object')) { var opts = arguments.length === 1 ? arguments[0] : undefined; return new Promise(function(resolve, reject) { nativeMethod.apply(pc, [resolve, reject, opts]); }); } return nativeMethod.apply(this, arguments); }; }); } // shim implicit creation of RTCSessionDescription/RTCIceCandidate ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] .forEach(function(method) { var nativeMethod = window.RTCPeerConnection.prototype[method]; window.RTCPeerConnection.prototype[method] = function() { arguments[0] = new ((method === 'addIceCandidate') ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]); return nativeMethod.apply(this, arguments); }; }); // support for addIceCandidate(null or undefined) var nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate; window.RTCPeerConnection.prototype.addIceCandidate = function() { if (!arguments[0]) { if (arguments[1]) { arguments[1].apply(null); } return Promise.resolve(); } return nativeAddIceCandidate.apply(this, arguments); }; } }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/chrome/getusermedia.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); var logging = utils.log; // Expose public methods. module.exports = function(window) { var browserDetails = utils.detectBrowser(window); var navigator = window && window.navigator; var constraintsToChrome_ = function(c) { if (typeof c !== 'object' || c.mandatory || c.optional) { return c; } var cc = {}; Object.keys(c).forEach(function(key) { if (key === 'require' || key === 'advanced' || key === 'mediaSource') { return; } var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]}; if (r.exact !== undefined && typeof r.exact === 'number') { r.min = r.max = r.exact; } var oldname_ = function(prefix, name) { if (prefix) { return prefix + name.charAt(0).toUpperCase() + name.slice(1); } return (name === 'deviceId') ? 'sourceId' : name; }; if (r.ideal !== undefined) { cc.optional = cc.optional || []; var oc = {}; if (typeof r.ideal === 'number') { oc[oldname_('min', key)] = r.ideal; cc.optional.push(oc); oc = {}; oc[oldname_('max', key)] = r.ideal; cc.optional.push(oc); } else { oc[oldname_('', key)] = r.ideal; cc.optional.push(oc); } } if (r.exact !== undefined && typeof r.exact !== 'number') { cc.mandatory = cc.mandatory || {}; cc.mandatory[oldname_('', key)] = r.exact; } else { ['min', 'max'].forEach(function(mix) { if (r[mix] !== undefined) { cc.mandatory = cc.mandatory || {}; cc.mandatory[oldname_(mix, key)] = r[mix]; } }); } }); if (c.advanced) { cc.optional = (cc.optional || []).concat(c.advanced); } return cc; }; var shimConstraints_ = function(constraints, func) { if (browserDetails.version >= 61) { return func(constraints); } constraints = JSON.parse(JSON.stringify(constraints)); if (constraints && typeof constraints.audio === 'object') { var remap = function(obj, a, b) { if (a in obj && !(b in obj)) { obj[b] = obj[a]; delete obj[a]; } }; constraints = JSON.parse(JSON.stringify(constraints)); remap(constraints.audio, 'autoGainControl', 'googAutoGainControl'); remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression'); constraints.audio = constraintsToChrome_(constraints.audio); } if (constraints && typeof constraints.video === 'object') { // Shim facingMode for mobile & surface pro. var face = constraints.video.facingMode; face = face && ((typeof face === 'object') ? face : {ideal: face}); var getSupportedFacingModeLies = browserDetails.version < 66; if ((face && (face.exact === 'user' || face.exact === 'environment' || face.ideal === 'user' || face.ideal === 'environment')) && !(navigator.mediaDevices.getSupportedConstraints && navigator.mediaDevices.getSupportedConstraints().facingMode && !getSupportedFacingModeLies)) { delete constraints.video.facingMode; var matches; if (face.exact === 'environment' || face.ideal === 'environment') { matches = ['back', 'rear']; } else if (face.exact === 'user' || face.ideal === 'user') { matches = ['front']; } if (matches) { // Look for matches in label, or use last cam for back (typical). return navigator.mediaDevices.enumerateDevices() .then(function(devices) { devices = devices.filter(function(d) { return d.kind === 'videoinput'; }); var dev = devices.find(function(d) { return matches.some(function(match) { return d.label.toLowerCase().indexOf(match) !== -1; }); }); if (!dev && devices.length && matches.indexOf('back') !== -1) { dev = devices[devices.length - 1]; // more likely the back cam } if (dev) { constraints.video.deviceId = face.exact ? {exact: dev.deviceId} : {ideal: dev.deviceId}; } constraints.video = constraintsToChrome_(constraints.video); logging('chrome: ' + JSON.stringify(constraints)); return func(constraints); }); } } constraints.video = constraintsToChrome_(constraints.video); } logging('chrome: ' + JSON.stringify(constraints)); return func(constraints); }; var shimError_ = function(e) { return { name: { PermissionDeniedError: 'NotAllowedError', InvalidStateError: 'NotReadableError', DevicesNotFoundError: 'NotFoundError', ConstraintNotSatisfiedError: 'OverconstrainedError', TrackStartError: 'NotReadableError', MediaDeviceFailedDueToShutdown: 'NotReadableError', MediaDeviceKillSwitchOn: 'NotReadableError' }[e.name] || e.name, message: e.message, constraint: e.constraintName, toString: function() { return this.name + (this.message && ': ') + this.message; } }; }; var getUserMedia_ = function(constraints, onSuccess, onError) { shimConstraints_(constraints, function(c) { navigator.webkitGetUserMedia(c, onSuccess, function(e) { if (onError) { onError(shimError_(e)); } }); }); }; navigator.getUserMedia = getUserMedia_; // Returns the result of getUserMedia as a Promise. var getUserMediaPromise_ = function(constraints) { return new Promise(function(resolve, reject) { navigator.getUserMedia(constraints, resolve, reject); }); }; if (!navigator.mediaDevices) { navigator.mediaDevices = { getUserMedia: getUserMediaPromise_, enumerateDevices: function() { return new Promise(function(resolve) { var kinds = {audio: 'audioinput', video: 'videoinput'}; return window.MediaStreamTrack.getSources(function(devices) { resolve(devices.map(function(device) { return {label: device.label, kind: kinds[device.kind], deviceId: device.id, groupId: ''}; })); }); }); }, getSupportedConstraints: function() { return { deviceId: true, echoCancellation: true, facingMode: true, frameRate: true, height: true, width: true }; } }; } // A shim for getUserMedia method on the mediaDevices object. // TODO(KaptenJansson) remove once implemented in Chrome stable. if (!navigator.mediaDevices.getUserMedia) { navigator.mediaDevices.getUserMedia = function(constraints) { return getUserMediaPromise_(constraints); }; } else { // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia // function which returns a Promise, it does not accept spec-style // constraints. var origGetUserMedia = navigator.mediaDevices.getUserMedia. bind(navigator.mediaDevices); navigator.mediaDevices.getUserMedia = function(cs) { return shimConstraints_(cs, function(c) { return origGetUserMedia(c).then(function(stream) { if (c.audio && !stream.getAudioTracks().length || c.video && !stream.getVideoTracks().length) { stream.getTracks().forEach(function(track) { track.stop(); }); throw new DOMException('', 'NotFoundError'); } return stream; }, function(e) { return Promise.reject(shimError_(e)); }); }); }; } // Dummy devicechange event methods. // TODO(KaptenJansson) remove once implemented in Chrome stable. if (typeof navigator.mediaDevices.addEventListener === 'undefined') { navigator.mediaDevices.addEventListener = function() { logging('Dummy mediaDevices.addEventListener called.'); }; } if (typeof navigator.mediaDevices.removeEventListener === 'undefined') { navigator.mediaDevices.removeEventListener = function() { logging('Dummy mediaDevices.removeEventListener called.'); }; } }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/common_shim.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var SDPUtils = __webpack_require__("../../../../sdp/sdp.js"); var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); // Wraps the peerconnection event eventNameToWrap in a function // which returns the modified event object. function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) { if (!window.RTCPeerConnection) { return; } var proto = window.RTCPeerConnection.prototype; var nativeAddEventListener = proto.addEventListener; proto.addEventListener = function(nativeEventName, cb) { if (nativeEventName !== eventNameToWrap) { return nativeAddEventListener.apply(this, arguments); } var wrappedCallback = function(e) { cb(wrapper(e)); }; this._eventMap = this._eventMap || {}; this._eventMap[cb] = wrappedCallback; return nativeAddEventListener.apply(this, [nativeEventName, wrappedCallback]); }; var nativeRemoveEventListener = proto.removeEventListener; proto.removeEventListener = function(nativeEventName, cb) { if (nativeEventName !== eventNameToWrap || !this._eventMap || !this._eventMap[cb]) { return nativeRemoveEventListener.apply(this, arguments); } var unwrappedCb = this._eventMap[cb]; delete this._eventMap[cb]; return nativeRemoveEventListener.apply(this, [nativeEventName, unwrappedCb]); }; Object.defineProperty(proto, 'on' + eventNameToWrap, { get: function() { return this['_on' + eventNameToWrap]; }, set: function(cb) { if (this['_on' + eventNameToWrap]) { this.removeEventListener(eventNameToWrap, this['_on' + eventNameToWrap]); delete this['_on' + eventNameToWrap]; } if (cb) { this.addEventListener(eventNameToWrap, this['_on' + eventNameToWrap] = cb); } } }); } module.exports = { shimRTCIceCandidate: function(window) { // foundation is arbitrarily chosen as an indicator for full support for // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface if (window.RTCIceCandidate && 'foundation' in window.RTCIceCandidate.prototype) { return; } var NativeRTCIceCandidate = window.RTCIceCandidate; window.RTCIceCandidate = function(args) { // Remove the a= which shouldn't be part of the candidate string. if (typeof args === 'object' && args.candidate && args.candidate.indexOf('a=') === 0) { args = JSON.parse(JSON.stringify(args)); args.candidate = args.candidate.substr(2); } // Augment the native candidate with the parsed fields. var nativeCandidate = new NativeRTCIceCandidate(args); var parsedCandidate = SDPUtils.parseCandidate(args.candidate); var augmentedCandidate = Object.assign(nativeCandidate, parsedCandidate); // Add a serializer that does not serialize the extra attributes. augmentedCandidate.toJSON = function() { return { candidate: augmentedCandidate.candidate, sdpMid: augmentedCandidate.sdpMid, sdpMLineIndex: augmentedCandidate.sdpMLineIndex, usernameFragment: augmentedCandidate.usernameFragment, }; }; return augmentedCandidate; }; // Hook up the augmented candidate in onicecandidate and // addEventListener('icecandidate', ...) wrapPeerConnectionEvent(window, 'icecandidate', function(e) { if (e.candidate) { Object.defineProperty(e, 'candidate', { value: new window.RTCIceCandidate(e.candidate), writable: 'false' }); } return e; }); }, // shimCreateObjectURL must be called before shimSourceObject to avoid loop. shimCreateObjectURL: function(window) { var URL = window && window.URL; if (!(typeof window === 'object' && window.HTMLMediaElement && 'srcObject' in window.HTMLMediaElement.prototype && URL.createObjectURL && URL.revokeObjectURL)) { // Only shim CreateObjectURL using srcObject if srcObject exists. return undefined; } var nativeCreateObjectURL = URL.createObjectURL.bind(URL); var nativeRevokeObjectURL = URL.revokeObjectURL.bind(URL); var streams = new Map(), newId = 0; URL.createObjectURL = function(stream) { if ('getTracks' in stream) { var url = 'polyblob:' + (++newId); streams.set(url, stream); utils.deprecated('URL.createObjectURL(stream)', 'elem.srcObject = stream'); return url; } return nativeCreateObjectURL(stream); }; URL.revokeObjectURL = function(url) { nativeRevokeObjectURL(url); streams.delete(url); }; var dsc = Object.getOwnPropertyDescriptor(window.HTMLMediaElement.prototype, 'src'); Object.defineProperty(window.HTMLMediaElement.prototype, 'src', { get: function() { return dsc.get.apply(this); }, set: function(url) { this.srcObject = streams.get(url) || null; return dsc.set.apply(this, [url]); } }); var nativeSetAttribute = window.HTMLMediaElement.prototype.setAttribute; window.HTMLMediaElement.prototype.setAttribute = function() { if (arguments.length === 2 && ('' + arguments[0]).toLowerCase() === 'src') { this.srcObject = streams.get(arguments[1]) || null; } return nativeSetAttribute.apply(this, arguments); }; } }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/edge/edge_shim.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); var shimRTCPeerConnection = __webpack_require__("../../../../rtcpeerconnection-shim/rtcpeerconnection.js"); module.exports = { shimGetUserMedia: __webpack_require__("../../../../webrtc-adapter/src/js/edge/getusermedia.js"), shimPeerConnection: function(window) { var browserDetails = utils.detectBrowser(window); if (window.RTCIceGatherer) { // ORTC defines an RTCIceCandidate object but no constructor. // Not implemented in Edge. if (!window.RTCIceCandidate) { window.RTCIceCandidate = function(args) { return args; }; } // ORTC does not have a session description object but // other browsers (i.e. Chrome) that will support both PC and ORTC // in the future might have this defined already. if (!window.RTCSessionDescription) { window.RTCSessionDescription = function(args) { return args; }; } // this adds an additional event listener to MediaStrackTrack that signals // when a tracks enabled property was changed. Workaround for a bug in // addStream, see below. No longer required in 15025+ if (browserDetails.version < 15025) { var origMSTEnabled = Object.getOwnPropertyDescriptor( window.MediaStreamTrack.prototype, 'enabled'); Object.defineProperty(window.MediaStreamTrack.prototype, 'enabled', { set: function(value) { origMSTEnabled.set.call(this, value); var ev = new Event('enabled'); ev.enabled = value; this.dispatchEvent(ev); } }); } } // ORTC defines the DTMF sender a bit different. // https://github.com/w3c/ortc/issues/714 if (window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) { Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', { get: function() { if (this._dtmf === undefined) { if (this.track.kind === 'audio') { this._dtmf = new window.RTCDtmfSender(this); } else if (this.track.kind === 'video') { this._dtmf = null; } } return this._dtmf; } }); } window.RTCPeerConnection = shimRTCPeerConnection(window, browserDetails.version); }, shimReplaceTrack: function(window) { // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614 if (window.RTCRtpSender && !('replaceTrack' in window.RTCRtpSender.prototype)) { window.RTCRtpSender.prototype.replaceTrack = window.RTCRtpSender.prototype.setTrack; } } }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/edge/getusermedia.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ // Expose public methods. module.exports = function(window) { var navigator = window && window.navigator; var shimError_ = function(e) { return { name: {PermissionDeniedError: 'NotAllowedError'}[e.name] || e.name, message: e.message, constraint: e.constraint, toString: function() { return this.name; } }; }; // getUserMedia error shim. var origGetUserMedia = navigator.mediaDevices.getUserMedia. bind(navigator.mediaDevices); navigator.mediaDevices.getUserMedia = function(c) { return origGetUserMedia(c).catch(function(e) { return Promise.reject(shimError_(e)); }); }; }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/firefox/firefox_shim.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); module.exports = { shimGetUserMedia: __webpack_require__("../../../../webrtc-adapter/src/js/firefox/getusermedia.js"), shimOnTrack: function(window) { if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in window.RTCPeerConnection.prototype)) { Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', { get: function() { return this._ontrack; }, set: function(f) { if (this._ontrack) { this.removeEventListener('track', this._ontrack); this.removeEventListener('addstream', this._ontrackpoly); } this.addEventListener('track', this._ontrack = f); this.addEventListener('addstream', this._ontrackpoly = function(e) { e.stream.getTracks().forEach(function(track) { var event = new Event('track'); event.track = track; event.receiver = {track: track}; event.transceiver = {receiver: event.receiver}; event.streams = [e.stream]; this.dispatchEvent(event); }.bind(this)); }.bind(this)); } }); } if (typeof window === 'object' && window.RTCTrackEvent && ('receiver' in window.RTCTrackEvent.prototype) && !('transceiver' in window.RTCTrackEvent.prototype)) { Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', { get: function() { return {receiver: this.receiver}; } }); } }, shimSourceObject: function(window) { // Firefox has supported mozSrcObject since FF22, unprefixed in 42. if (typeof window === 'object') { if (window.HTMLMediaElement && !('srcObject' in window.HTMLMediaElement.prototype)) { // Shim the srcObject property, once, when HTMLMediaElement is found. Object.defineProperty(window.HTMLMediaElement.prototype, 'srcObject', { get: function() { return this.mozSrcObject; }, set: function(stream) { this.mozSrcObject = stream; } }); } } }, shimPeerConnection: function(window) { var browserDetails = utils.detectBrowser(window); if (typeof window !== 'object' || !(window.RTCPeerConnection || window.mozRTCPeerConnection)) { return; // probably media.peerconnection.enabled=false in about:config } // The RTCPeerConnection object. if (!window.RTCPeerConnection) { window.RTCPeerConnection = function(pcConfig, pcConstraints) { if (browserDetails.version < 38) { // .urls is not supported in FF < 38. // create RTCIceServers with a single url. if (pcConfig && pcConfig.iceServers) { var newIceServers = []; for (var i = 0; i < pcConfig.iceServers.length; i++) { var server = pcConfig.iceServers[i]; if (server.hasOwnProperty('urls')) { for (var j = 0; j < server.urls.length; j++) { var newServer = { url: server.urls[j] }; if (server.urls[j].indexOf('turn') === 0) { newServer.username = server.username; newServer.credential = server.credential; } newIceServers.push(newServer); } } else { newIceServers.push(pcConfig.iceServers[i]); } } pcConfig.iceServers = newIceServers; } } return new window.mozRTCPeerConnection(pcConfig, pcConstraints); }; window.RTCPeerConnection.prototype = window.mozRTCPeerConnection.prototype; // wrap static methods. Currently just generateCertificate. if (window.mozRTCPeerConnection.generateCertificate) { Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', { get: function() { return window.mozRTCPeerConnection.generateCertificate; } }); } window.RTCSessionDescription = window.mozRTCSessionDescription; window.RTCIceCandidate = window.mozRTCIceCandidate; } // shim away need for obsolete RTCIceCandidate/RTCSessionDescription. ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] .forEach(function(method) { var nativeMethod = window.RTCPeerConnection.prototype[method]; window.RTCPeerConnection.prototype[method] = function() { arguments[0] = new ((method === 'addIceCandidate') ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]); return nativeMethod.apply(this, arguments); }; }); // support for addIceCandidate(null or undefined) var nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate; window.RTCPeerConnection.prototype.addIceCandidate = function() { if (!arguments[0]) { if (arguments[1]) { arguments[1].apply(null); } return Promise.resolve(); } return nativeAddIceCandidate.apply(this, arguments); }; // shim getStats with maplike support var makeMapStats = function(stats) { var map = new Map(); Object.keys(stats).forEach(function(key) { map.set(key, stats[key]); map[key] = stats[key]; }); return map; }; var modernStatsTypes = { inboundrtp: 'inbound-rtp', outboundrtp: 'outbound-rtp', candidatepair: 'candidate-pair', localcandidate: 'local-candidate', remotecandidate: 'remote-candidate' }; var nativeGetStats = window.RTCPeerConnection.prototype.getStats; window.RTCPeerConnection.prototype.getStats = function( selector, onSucc, onErr ) { return nativeGetStats.apply(this, [selector || null]) .then(function(stats) { if (browserDetails.version < 48) { stats = makeMapStats(stats); } if (browserDetails.version < 53 && !onSucc) { // Shim only promise getStats with spec-hyphens in type names // Leave callback version alone; misc old uses of forEach before Map try { stats.forEach(function(stat) { stat.type = modernStatsTypes[stat.type] || stat.type; }); } catch (e) { if (e.name !== 'TypeError') { throw e; } // Avoid TypeError: "type" is read-only, in old versions. 34-43ish stats.forEach(function(stat, i) { stats.set(i, Object.assign({}, stat, { type: modernStatsTypes[stat.type] || stat.type })); }); } } return stats; }) .then(onSucc, onErr); }; }, shimRemoveStream: function(window) { if (!window.RTCPeerConnection || 'removeStream' in window.RTCPeerConnection.prototype) { return; } window.RTCPeerConnection.prototype.removeStream = function(stream) { var pc = this; utils.deprecated('removeStream', 'removeTrack'); this.getSenders().forEach(function(sender) { if (sender.track && stream.getTracks().indexOf(sender.track) !== -1) { pc.removeTrack(sender); } }); }; } }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/firefox/getusermedia.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); var logging = utils.log; // Expose public methods. module.exports = function(window) { var browserDetails = utils.detectBrowser(window); var navigator = window && window.navigator; var MediaStreamTrack = window && window.MediaStreamTrack; var shimError_ = function(e) { return { name: { InternalError: 'NotReadableError', NotSupportedError: 'TypeError', PermissionDeniedError: 'NotAllowedError', SecurityError: 'NotAllowedError' }[e.name] || e.name, message: { 'The operation is insecure.': 'The request is not allowed by the ' + 'user agent or the platform in the current context.' }[e.message] || e.message, constraint: e.constraint, toString: function() { return this.name + (this.message && ': ') + this.message; } }; }; // getUserMedia constraints shim. var getUserMedia_ = function(constraints, onSuccess, onError) { var constraintsToFF37_ = function(c) { if (typeof c !== 'object' || c.require) { return c; } var require = []; Object.keys(c).forEach(function(key) { if (key === 'require' || key === 'advanced' || key === 'mediaSource') { return; } var r = c[key] = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]}; if (r.min !== undefined || r.max !== undefined || r.exact !== undefined) { require.push(key); } if (r.exact !== undefined) { if (typeof r.exact === 'number') { r. min = r.max = r.exact; } else { c[key] = r.exact; } delete r.exact; } if (r.ideal !== undefined) { c.advanced = c.advanced || []; var oc = {}; if (typeof r.ideal === 'number') { oc[key] = {min: r.ideal, max: r.ideal}; } else { oc[key] = r.ideal; } c.advanced.push(oc); delete r.ideal; if (!Object.keys(r).length) { delete c[key]; } } }); if (require.length) { c.require = require; } return c; }; constraints = JSON.parse(JSON.stringify(constraints)); if (browserDetails.version < 38) { logging('spec: ' + JSON.stringify(constraints)); if (constraints.audio) { constraints.audio = constraintsToFF37_(constraints.audio); } if (constraints.video) { constraints.video = constraintsToFF37_(constraints.video); } logging('ff37: ' + JSON.stringify(constraints)); } return navigator.mozGetUserMedia(constraints, onSuccess, function(e) { onError(shimError_(e)); }); }; // Returns the result of getUserMedia as a Promise. var getUserMediaPromise_ = function(constraints) { return new Promise(function(resolve, reject) { getUserMedia_(constraints, resolve, reject); }); }; // Shim for mediaDevices on older versions. if (!navigator.mediaDevices) { navigator.mediaDevices = {getUserMedia: getUserMediaPromise_, addEventListener: function() { }, removeEventListener: function() { } }; } navigator.mediaDevices.enumerateDevices = navigator.mediaDevices.enumerateDevices || function() { return new Promise(function(resolve) { var infos = [ {kind: 'audioinput', deviceId: 'default', label: '', groupId: ''}, {kind: 'videoinput', deviceId: 'default', label: '', groupId: ''} ]; resolve(infos); }); }; if (browserDetails.version < 41) { // Work around http://bugzil.la/1169665 var orgEnumerateDevices = navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices); navigator.mediaDevices.enumerateDevices = function() { return orgEnumerateDevices().then(undefined, function(e) { if (e.name === 'NotFoundError') { return []; } throw e; }); }; } if (browserDetails.version < 49) { var origGetUserMedia = navigator.mediaDevices.getUserMedia. bind(navigator.mediaDevices); navigator.mediaDevices.getUserMedia = function(c) { return origGetUserMedia(c).then(function(stream) { // Work around https://bugzil.la/802326 if (c.audio && !stream.getAudioTracks().length || c.video && !stream.getVideoTracks().length) { stream.getTracks().forEach(function(track) { track.stop(); }); throw new DOMException('The object can not be found here.', 'NotFoundError'); } return stream; }, function(e) { return Promise.reject(shimError_(e)); }); }; } if (!(browserDetails.version > 55 && 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) { var remap = function(obj, a, b) { if (a in obj && !(b in obj)) { obj[b] = obj[a]; delete obj[a]; } }; var nativeGetUserMedia = navigator.mediaDevices.getUserMedia. bind(navigator.mediaDevices); navigator.mediaDevices.getUserMedia = function(c) { if (typeof c === 'object' && typeof c.audio === 'object') { c = JSON.parse(JSON.stringify(c)); remap(c.audio, 'autoGainControl', 'mozAutoGainControl'); remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression'); } return nativeGetUserMedia(c); }; if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) { var nativeGetSettings = MediaStreamTrack.prototype.getSettings; MediaStreamTrack.prototype.getSettings = function() { var obj = nativeGetSettings.apply(this, arguments); remap(obj, 'mozAutoGainControl', 'autoGainControl'); remap(obj, 'mozNoiseSuppression', 'noiseSuppression'); return obj; }; } if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) { var nativeApplyConstraints = MediaStreamTrack.prototype.applyConstraints; MediaStreamTrack.prototype.applyConstraints = function(c) { if (this.kind === 'audio' && typeof c === 'object') { c = JSON.parse(JSON.stringify(c)); remap(c, 'autoGainControl', 'mozAutoGainControl'); remap(c, 'noiseSuppression', 'mozNoiseSuppression'); } return nativeApplyConstraints.apply(this, [c]); }; } } navigator.getUserMedia = function(constraints, onSuccess, onError) { if (browserDetails.version < 44) { return getUserMedia_(constraints, onSuccess, onError); } // Replace Firefox 44+'s deprecation warning with unprefixed version. utils.deprecated('navigator.getUserMedia', 'navigator.mediaDevices.getUserMedia'); navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError); }; }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/safari/safari_shim.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ var utils = __webpack_require__("../../../../webrtc-adapter/src/js/utils.js"); module.exports = { shimLocalStreamsAPI: function(window) { if (typeof window !== 'object' || !window.RTCPeerConnection) { return; } if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) { window.RTCPeerConnection.prototype.getLocalStreams = function() { if (!this._localStreams) { this._localStreams = []; } return this._localStreams; }; } if (!('getStreamById' in window.RTCPeerConnection.prototype)) { window.RTCPeerConnection.prototype.getStreamById = function(id) { var result = null; if (this._localStreams) { this._localStreams.forEach(function(stream) { if (stream.id === id) { result = stream; } }); } if (this._remoteStreams) { this._remoteStreams.forEach(function(stream) { if (stream.id === id) { result = stream; } }); } return result; }; } if (!('addStream' in window.RTCPeerConnection.prototype)) { var _addTrack = window.RTCPeerConnection.prototype.addTrack; window.RTCPeerConnection.prototype.addStream = function(stream) { if (!this._localStreams) { this._localStreams = []; } if (this._localStreams.indexOf(stream) === -1) { this._localStreams.push(stream); } var pc = this; stream.getTracks().forEach(function(track) { _addTrack.call(pc, track, stream); }); }; window.RTCPeerConnection.prototype.addTrack = function(track, stream) { if (stream) { if (!this._localStreams) { this._localStreams = [stream]; } else if (this._localStreams.indexOf(stream) === -1) { this._localStreams.push(stream); } } return _addTrack.call(this, track, stream); }; } if (!('removeStream' in window.RTCPeerConnection.prototype)) { window.RTCPeerConnection.prototype.removeStream = function(stream) { if (!this._localStreams) { this._localStreams = []; } var index = this._localStreams.indexOf(stream); if (index === -1) { return; } this._localStreams.splice(index, 1); var pc = this; var tracks = stream.getTracks(); this.getSenders().forEach(function(sender) { if (tracks.indexOf(sender.track) !== -1) { pc.removeTrack(sender); } }); }; } }, shimRemoteStreamsAPI: function(window) { if (typeof window !== 'object' || !window.RTCPeerConnection) { return; } if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) { window.RTCPeerConnection.prototype.getRemoteStreams = function() { return this._remoteStreams ? this._remoteStreams : []; }; } if (!('onaddstream' in window.RTCPeerConnection.prototype)) { Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', { get: function() { return this._onaddstream; }, set: function(f) { if (this._onaddstream) { this.removeEventListener('addstream', this._onaddstream); this.removeEventListener('track', this._onaddstreampoly); } this.addEventListener('addstream', this._onaddstream = f); this.addEventListener('track', this._onaddstreampoly = function(e) { var stream = e.streams[0]; if (!this._remoteStreams) { this._remoteStreams = []; } if (this._remoteStreams.indexOf(stream) >= 0) { return; } this._remoteStreams.push(stream); var event = new Event('addstream'); event.stream = e.streams[0]; this.dispatchEvent(event); }.bind(this)); } }); } }, shimCallbacksAPI: function(window) { if (typeof window !== 'object' || !window.RTCPeerConnection) { return; } var prototype = window.RTCPeerConnection.prototype; var createOffer = prototype.createOffer; var createAnswer = prototype.createAnswer; var setLocalDescription = prototype.setLocalDescription; var setRemoteDescription = prototype.setRemoteDescription; var addIceCandidate = prototype.addIceCandidate; prototype.createOffer = function(successCallback, failureCallback) { var options = (arguments.length >= 2) ? arguments[2] : arguments[0]; var promise = createOffer.apply(this, [options]); if (!failureCallback) { return promise; } promise.then(successCallback, failureCallback); return Promise.resolve(); }; prototype.createAnswer = function(successCallback, failureCallback) { var options = (arguments.length >= 2) ? arguments[2] : arguments[0]; var promise = createAnswer.apply(this, [options]); if (!failureCallback) { return promise; } promise.then(successCallback, failureCallback); return Promise.resolve(); }; var withCallback = function(description, successCallback, failureCallback) { var promise = setLocalDescription.apply(this, [description]); if (!failureCallback) { return promise; } promise.then(successCallback, failureCallback); return Promise.resolve(); }; prototype.setLocalDescription = withCallback; withCallback = function(description, successCallback, failureCallback) { var promise = setRemoteDescription.apply(this, [description]); if (!failureCallback) { return promise; } promise.then(successCallback, failureCallback); return Promise.resolve(); }; prototype.setRemoteDescription = withCallback; withCallback = function(candidate, successCallback, failureCallback) { var promise = addIceCandidate.apply(this, [candidate]); if (!failureCallback) { return promise; } promise.then(successCallback, failureCallback); return Promise.resolve(); }; prototype.addIceCandidate = withCallback; }, shimGetUserMedia: function(window) { var navigator = window && window.navigator; if (!navigator.getUserMedia) { if (navigator.webkitGetUserMedia) { navigator.getUserMedia = navigator.webkitGetUserMedia.bind(navigator); } else if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { navigator.getUserMedia = function(constraints, cb, errcb) { navigator.mediaDevices.getUserMedia(constraints) .then(cb, errcb); }.bind(navigator); } } }, shimRTCIceServerUrls: function(window) { // migrate from non-spec RTCIceServer.url to RTCIceServer.urls var OrigPeerConnection = window.RTCPeerConnection; window.RTCPeerConnection = function(pcConfig, pcConstraints) { if (pcConfig && pcConfig.iceServers) { var newIceServers = []; for (var i = 0; i < pcConfig.iceServers.length; i++) { var server = pcConfig.iceServers[i]; if (!server.hasOwnProperty('urls') && server.hasOwnProperty('url')) { utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls'); server = JSON.parse(JSON.stringify(server)); server.urls = server.url; delete server.url; newIceServers.push(server); } else { newIceServers.push(pcConfig.iceServers[i]); } } pcConfig.iceServers = newIceServers; } return new OrigPeerConnection(pcConfig, pcConstraints); }; window.RTCPeerConnection.prototype = OrigPeerConnection.prototype; // wrap static methods. Currently just generateCertificate. if ('generateCertificate' in window.RTCPeerConnection) { Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', { get: function() { return OrigPeerConnection.generateCertificate; } }); } }, shimTrackEventTransceiver: function(window) { // Add event.transceiver member over deprecated event.receiver if (typeof window === 'object' && window.RTCPeerConnection && ('receiver' in window.RTCTrackEvent.prototype) && // can't check 'transceiver' in window.RTCTrackEvent.prototype, as it is // defined for some reason even when window.RTCTransceiver is not. !window.RTCTransceiver) { Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', { get: function() { return {receiver: this.receiver}; } }); } }, shimCreateOfferLegacy: function(window) { var origCreateOffer = window.RTCPeerConnection.prototype.createOffer; window.RTCPeerConnection.prototype.createOffer = function(offerOptions) { var pc = this; if (offerOptions) { var audioTransceiver = pc.getTransceivers().find(function(transceiver) { return transceiver.sender.track && transceiver.sender.track.kind === 'audio'; }); if (offerOptions.offerToReceiveAudio === false && audioTransceiver) { if (audioTransceiver.direction === 'sendrecv') { audioTransceiver.setDirection('sendonly'); } else if (audioTransceiver.direction === 'recvonly') { audioTransceiver.setDirection('inactive'); } } else if (offerOptions.offerToReceiveAudio === true && !audioTransceiver) { pc.addTransceiver('audio'); } var videoTransceiver = pc.getTransceivers().find(function(transceiver) { return transceiver.sender.track && transceiver.sender.track.kind === 'video'; }); if (offerOptions.offerToReceiveVideo === false && videoTransceiver) { if (videoTransceiver.direction === 'sendrecv') { videoTransceiver.setDirection('sendonly'); } else if (videoTransceiver.direction === 'recvonly') { videoTransceiver.setDirection('inactive'); } } else if (offerOptions.offerToReceiveVideo === true && !videoTransceiver) { pc.addTransceiver('video'); } } return origCreateOffer.apply(pc, arguments); }; } }; /***/ }), /***/ "../../../../webrtc-adapter/src/js/utils.js": /***/ (function(module, exports, __webpack_require__) { "use strict"; /* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. */ /* eslint-env node */ var logDisabled_ = true; var deprecationWarnings_ = true; /** * Extract browser version out of the provided user agent string. * * @param {!string} uastring userAgent string. * @param {!string} expr Regular expression used as match criteria. * @param {!number} pos position in the version string to be returned. * @return {!number} browser version. */ function extractVersion(uastring, expr, pos) { var match = uastring.match(expr); return match && match.length >= pos && parseInt(match[pos], 10); } // Utility methods. module.exports = { extractVersion: extractVersion, disableLog: function(bool) { if (typeof bool !== 'boolean') { return new Error('Argument type: ' + typeof bool + '. Please use a boolean.'); } logDisabled_ = bool; return (bool) ? 'adapter.js logging disabled' : 'adapter.js logging enabled'; }, /** * Disable or enable deprecation warnings * @param {!boolean} bool set to true to disable warnings. */ disableWarnings: function(bool) { if (typeof bool !== 'boolean') { return new Error('Argument type: ' + typeof bool + '. Please use a boolean.'); } deprecationWarnings_ = !bool; return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled'); }, log: function() { if (typeof window === 'object') { if (logDisabled_) { return; } if (typeof console !== 'undefined' && typeof console.log === 'function') { console.log.apply(console, arguments); } } }, /** * Shows a deprecation warning suggesting the modern and spec-compatible API. */ deprecated: function(oldMethod, newMethod) { if (!deprecationWarnings_) { return; } console.warn(oldMethod + ' is deprecated, please use ' + newMethod + ' instead.'); }, /** * Browser detector. * * @return {object} result containing browser and version * properties. */ detectBrowser: function(window) { var navigator = window && window.navigator; // Returned result object. var result = {}; result.browser = null; result.version = null; // Fail early if it's not a browser if (typeof window === 'undefined' || !window.navigator) { result.browser = 'Not a browser.'; return result; } // Firefox. if (navigator.mozGetUserMedia) { result.browser = 'firefox'; result.version = extractVersion(navigator.userAgent, /Firefox\/(\d+)\./, 1); } else if (navigator.webkitGetUserMedia) { // Chrome, Chromium, Webview, Opera, all use the chrome shim for now if (window.webkitRTCPeerConnection) { result.browser = 'chrome'; result.version = extractVersion(navigator.userAgent, /Chrom(e|ium)\/(\d+)\./, 2); } else { // Safari (in an unpublished version) or unknown webkit-based. if (navigator.userAgent.match(/Version\/(\d+).(\d+)/)) { result.browser = 'safari'; result.version = extractVersion(navigator.userAgent, /AppleWebKit\/(\d+)\./, 1); } else { // unknown webkit-based browser. result.browser = 'Unsupported webkit-based browser ' + 'with GUM support but no WebRTC support.'; return result; } } } else if (navigator.mediaDevices && navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) { // Edge. result.browser = 'edge'; result.version = extractVersion(navigator.userAgent, /Edge\/(\d+).(\d+)$/, 2); } else if (navigator.mediaDevices && navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari, with webkitGetUserMedia removed. result.browser = 'safari'; result.version = extractVersion(navigator.userAgent, /AppleWebKit\/(\d+)\./, 1); } else { // Default fallthrough: not supported. result.browser = 'Not a supported browser.'; return result; } return result; } }; /***/ }), /***/ "../../../../wildemitter/wildemitter.js": /***/ (function(module, exports) { /* WildEmitter.js is a slim little event emitter by @henrikjoreteg largely based on @visionmedia's Emitter from UI Kit. Why? I wanted it standalone. I also wanted support for wildcard emitters like this: emitter.on('*', function (eventName, other, event, payloads) { }); emitter.on('somenamespace*', function (eventName, payloads) { }); Please note that callbacks triggered by wildcard registered events also get the event name as the first argument. */ module.exports = WildEmitter; function WildEmitter() { } WildEmitter.mixin = function (constructor) { var prototype = constructor.prototype || constructor; prototype.isWildEmitter= true; // Listen on the given `event` with `fn`. Store a group name if present. prototype.on = function (event, groupName, fn) { this.callbacks = this.callbacks || {}; var hasGroup = (arguments.length === 3), group = hasGroup ? arguments[1] : undefined, func = hasGroup ? arguments[2] : arguments[1]; func._groupName = group; (this.callbacks[event] = this.callbacks[event] || []).push(func); return this; }; // Adds an `event` listener that will be invoked a single // time then automatically removed. prototype.once = function (event, groupName, fn) { var self = this, hasGroup = (arguments.length === 3), group = hasGroup ? arguments[1] : undefined, func = hasGroup ? arguments[2] : arguments[1]; function on() { self.off(event, on); func.apply(this, arguments); } this.on(event, group, on); return this; }; // Unbinds an entire group prototype.releaseGroup = function (groupName) { this.callbacks = this.callbacks || {}; var item, i, len, handlers; for (item in this.callbacks) { handlers = this.callbacks[item]; for (i = 0, len = handlers.length; i < len; i++) { if (handlers[i]._groupName === groupName) { //console.log('removing'); // remove it and shorten the array we're looping through handlers.splice(i, 1); i--; len--; } } } return this; }; // Remove the given callback for `event` or all // registered callbacks. prototype.off = function (event, fn) { this.callbacks = this.callbacks || {}; var callbacks = this.callbacks[event], i; if (!callbacks) return this; // remove all handlers if (arguments.length === 1) { delete this.callbacks[event]; return this; } // remove specific handler i = callbacks.indexOf(fn); callbacks.splice(i, 1); if (callbacks.length === 0) { delete this.callbacks[event]; } return this; }; /// Emit `event` with the given args. // also calls any `*` handlers prototype.emit = function (event) { this.callbacks = this.callbacks || {}; var args = [].slice.call(arguments, 1), callbacks = this.callbacks[event], specialCallbacks = this.getWildcardCallbacks(event), i, len, item, listeners; if (callbacks) { listeners = callbacks.slice(); for (i = 0, len = listeners.length; i < len; ++i) { if (!listeners[i]) { break; } listeners[i].apply(this, args); } } if (specialCallbacks) { len = specialCallbacks.length; listeners = specialCallbacks.slice(); for (i = 0, len = listeners.length; i < len; ++i) { if (!listeners[i]) { break; } listeners[i].apply(this, [event].concat(args)); } } return this; }; // Helper for for finding special wildcard event handlers that match the event prototype.getWildcardCallbacks = function (eventName) { this.callbacks = this.callbacks || {}; var item, split, result = []; for (item in this.callbacks) { split = item.split('*'); if (item === '*' || (split.length === 2 && eventName.slice(0, split[0].length) === split[0])) { result = result.concat(this.callbacks[item]); } } return result; }; }; WildEmitter.mixin(WildEmitter); /***/ }), /***/ "../../../../wolfy87-eventemitter/EventEmitter.js": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! * EventEmitter v5.2.4 - git.io/ee * Unlicense - http://unlicense.org/ * Oliver Caldwell - http://oli.me.uk/ * @preserve */ ;(function (exports) { 'use strict'; /** * Class for managing events. * Can be extended to provide event functionality in other classes. * * @class EventEmitter Manages event registering and emitting. */ function EventEmitter() {} // Shortcuts to improve speed and size var proto = EventEmitter.prototype; var originalGlobalValue = exports.EventEmitter; /** * Finds the index of the listener for the event in its storage array. * * @param {Function[]} listeners Array of listeners to search through. * @param {Function} listener Method to look for. * @return {Number} Index of the specified listener, -1 if not found * @api private */ function indexOfListener(listeners, listener) { var i = listeners.length; while (i--) { if (listeners[i].listener === listener) { return i; } } return -1; } /** * Alias a method while keeping the context correct, to allow for overwriting of target method. * * @param {String} name The name of the target method. * @return {Function} The aliased method * @api private */ function alias(name) { return function aliasClosure() { return this[name].apply(this, arguments); }; } /** * Returns the listener array for the specified event. * Will initialise the event object and listener arrays if required. * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. * Each property in the object response is an array of listener functions. * * @param {String|RegExp} evt Name of the event to return the listeners from. * @return {Function[]|Object} All listener functions for the event. */ proto.getListeners = function getListeners(evt) { var events = this._getEvents(); var response; var key; // Return a concatenated array of all matching events if // the selector is a regular expression. if (evt instanceof RegExp) { response = {}; for (key in events) { if (events.hasOwnProperty(key) && evt.test(key)) { response[key] = events[key]; } } } else { response = events[evt] || (events[evt] = []); } return response; }; /** * Takes a list of listener objects and flattens it into a list of listener functions. * * @param {Object[]} listeners Raw listener objects. * @return {Function[]} Just the listener functions. */ proto.flattenListeners = function flattenListeners(listeners) { var flatListeners = []; var i; for (i = 0; i < listeners.length; i += 1) { flatListeners.push(listeners[i].listener); } return flatListeners; }; /** * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. * * @param {String|RegExp} evt Name of the event to return the listeners from. * @return {Object} All listener functions for an event in an object. */ proto.getListenersAsObject = function getListenersAsObject(evt) { var listeners = this.getListeners(evt); var response; if (listeners instanceof Array) { response = {}; response[evt] = listeners; } return response || listeners; }; function isValidListener (listener) { if (typeof listener === 'function' || listener instanceof RegExp) { return true } else if (listener && typeof listener === 'object') { return isValidListener(listener.listener) } else { return false } } /** * Adds a listener function to the specified event. * The listener will not be added if it is a duplicate. * If the listener returns true then it will be removed after it is called. * If you pass a regular expression as the event name then the listener will be added to all events that match it. * * @param {String|RegExp} evt Name of the event to attach the listener to. * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. * @return {Object} Current instance of EventEmitter for chaining. */ proto.addListener = function addListener(evt, listener) { if (!isValidListener(listener)) { throw new TypeError('listener must be a function'); } var listeners = this.getListenersAsObject(evt); var listenerIsWrapped = typeof listener === 'object'; var key; for (key in listeners) { if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { listeners[key].push(listenerIsWrapped ? listener : { listener: listener, once: false }); } } return this; }; /** * Alias of addListener */ proto.on = alias('addListener'); /** * Semi-alias of addListener. It will add a listener that will be * automatically removed after its first execution. * * @param {String|RegExp} evt Name of the event to attach the listener to. * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. * @return {Object} Current instance of EventEmitter for chaining. */ proto.addOnceListener = function addOnceListener(evt, listener) { return this.addListener(evt, { listener: listener, once: true }); }; /** * Alias of addOnceListener. */ proto.once = alias('addOnceListener'); /** * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. * You need to tell it what event names should be matched by a regex. * * @param {String} evt Name of the event to create. * @return {Object} Current instance of EventEmitter for chaining. */ proto.defineEvent = function defineEvent(evt) { this.getListeners(evt); return this; }; /** * Uses defineEvent to define multiple events. * * @param {String[]} evts An array of event names to define. * @return {Object} Current instance of EventEmitter for chaining. */ proto.defineEvents = function defineEvents(evts) { for (var i = 0; i < evts.length; i += 1) { this.defineEvent(evts[i]); } return this; }; /** * Removes a listener function from the specified event. * When passed a regular expression as the event name, it will remove the listener from all events that match it. * * @param {String|RegExp} evt Name of the event to remove the listener from. * @param {Function} listener Method to remove from the event. * @return {Object} Current instance of EventEmitter for chaining. */ proto.removeListener = function removeListener(evt, listener) { var listeners = this.getListenersAsObject(evt); var index; var key; for (key in listeners) { if (listeners.hasOwnProperty(key)) { index = indexOfListener(listeners[key], listener); if (index !== -1) { listeners[key].splice(index, 1); } } } return this; }; /** * Alias of removeListener */ proto.off = alias('removeListener'); /** * Adds listeners in bulk using the manipulateListeners method. * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. * You can also pass it a regular expression to add the array of listeners to all events that match it. * Yeah, this function does quite a bit. That's probably a bad thing. * * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. * @param {Function[]} [listeners] An optional array of listener functions to add. * @return {Object} Current instance of EventEmitter for chaining. */ proto.addListeners = function addListeners(evt, listeners) { // Pass through to manipulateListeners return this.manipulateListeners(false, evt, listeners); }; /** * Removes listeners in bulk using the manipulateListeners method. * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. * You can also pass it an event name and an array of listeners to be removed. * You can also pass it a regular expression to remove the listeners from all events that match it. * * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. * @param {Function[]} [listeners] An optional array of listener functions to remove. * @return {Object} Current instance of EventEmitter for chaining. */ proto.removeListeners = function removeListeners(evt, listeners) { // Pass through to manipulateListeners return this.manipulateListeners(true, evt, listeners); }; /** * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. * The first argument will determine if the listeners are removed (true) or added (false). * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. * You can also pass it an event name and an array of listeners to be added/removed. * You can also pass it a regular expression to manipulate the listeners of all events that match it. * * @param {Boolean} remove True if you want to remove listeners, false if you want to add. * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. * @param {Function[]} [listeners] An optional array of listener functions to add/remove. * @return {Object} Current instance of EventEmitter for chaining. */ proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { var i; var value; var single = remove ? this.removeListener : this.addListener; var multiple = remove ? this.removeListeners : this.addListeners; // If evt is an object then pass each of its properties to this method if (typeof evt === 'object' && !(evt instanceof RegExp)) { for (i in evt) { if (evt.hasOwnProperty(i) && (value = evt[i])) { // Pass the single listener straight through to the singular method if (typeof value === 'function') { single.call(this, i, value); } else { // Otherwise pass back to the multiple function multiple.call(this, i, value); } } } } else { // So evt must be a string // And listeners must be an array of listeners // Loop over it and pass each one to the multiple method i = listeners.length; while (i--) { single.call(this, evt, listeners[i]); } } return this; }; /** * Removes all listeners from a specified event. * If you do not specify an event then all listeners will be removed. * That means every event will be emptied. * You can also pass a regex to remove all events that match it. * * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. * @return {Object} Current instance of EventEmitter for chaining. */ proto.removeEvent = function removeEvent(evt) { var type = typeof evt; var events = this._getEvents(); var key; // Remove different things depending on the state of evt if (type === 'string') { // Remove all listeners for the specified event delete events[evt]; } else if (evt instanceof RegExp) { // Remove all events matching the regex. for (key in events) { if (events.hasOwnProperty(key) && evt.test(key)) { delete events[key]; } } } else { // Remove all listeners in all events delete this._events; } return this; }; /** * Alias of removeEvent. * * Added to mirror the node API. */ proto.removeAllListeners = alias('removeEvent'); /** * Emits an event of your choice. * When emitted, every listener attached to that event will be executed. * If you pass the optional argument array then those arguments will be passed to every listener upon execution. * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. * So they will not arrive within the array on the other side, they will be separate. * You can also pass a regular expression to emit to all events that match it. * * @param {String|RegExp} evt Name of the event to emit and execute listeners for. * @param {Array} [args] Optional array of arguments to be passed to each listener. * @return {Object} Current instance of EventEmitter for chaining. */ proto.emitEvent = function emitEvent(evt, args) { var listenersMap = this.getListenersAsObject(evt); var listeners; var listener; var i; var key; var response; for (key in listenersMap) { if (listenersMap.hasOwnProperty(key)) { listeners = listenersMap[key].slice(0); for (i = 0; i < listeners.length; i++) { // If the listener returns true then it shall be removed from the event // The function is executed either with a basic call or an apply if there is an args array listener = listeners[i]; if (listener.once === true) { this.removeListener(evt, listener.listener); } response = listener.listener.apply(this, args || []); if (response === this._getOnceReturnValue()) { this.removeListener(evt, listener.listener); } } } } return this; }; /** * Alias of emitEvent */ proto.trigger = alias('emitEvent'); /** * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. * * @param {String|RegExp} evt Name of the event to emit and execute listeners for. * @param {...*} Optional additional arguments to be passed to each listener. * @return {Object} Current instance of EventEmitter for chaining. */ proto.emit = function emit(evt) { var args = Array.prototype.slice.call(arguments, 1); return this.emitEvent(evt, args); }; /** * Sets the current value to check against when executing listeners. If a * listeners return value matches the one set here then it will be removed * after execution. This value defaults to true. * * @param {*} value The new value to check for when executing listeners. * @return {Object} Current instance of EventEmitter for chaining. */ proto.setOnceReturnValue = function setOnceReturnValue(value) { this._onceReturnValue = value; return this; }; /** * Fetches the current value to check against when executing listeners. If * the listeners return value matches this one then it should be removed * automatically. It will return true by default. * * @return {*|Boolean} The current value to check for or the default, true. * @api private */ proto._getOnceReturnValue = function _getOnceReturnValue() { if (this.hasOwnProperty('_onceReturnValue')) { return this._onceReturnValue; } else { return true; } }; /** * Fetches the events object and creates one if required. * * @return {Object} The events storage object. * @api private */ proto._getEvents = function _getEvents() { return this._events || (this._events = {}); }; /** * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. * * @return {Function} Non conflicting EventEmitter class. */ EventEmitter.noConflict = function noConflict() { exports.EventEmitter = originalGlobalValue; return EventEmitter; }; // Expose the class either via AMD, CommonJS or the global object if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return EventEmitter; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof module === 'object' && module.exports){ module.exports = EventEmitter; } else { exports.EventEmitter = EventEmitter; } }(this || {})); /***/ }), /***/ "../../../animations/esm5/animations.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AnimationBuilder; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AnimationFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AUTO_STYLE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return animate; }); /* unused harmony export animateChild */ /* unused harmony export animation */ /* unused harmony export group */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return keyframes; }); /* unused harmony export query */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return sequence; }); /* unused harmony export stagger */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return state; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return style; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return transition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return trigger; }); /* unused harmony export useAnimation */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NoopAnimationPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return AnimationGroupPlayer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return ɵPRE_STYLE; }); /** * @license Angular v5.0.5 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * AnimationBuilder is an injectable service that is available when the {\@link * BrowserAnimationsModule BrowserAnimationsModule} or {\@link NoopAnimationsModule * NoopAnimationsModule} modules are used within an application. * * The purpose if this service is to produce an animation sequence programmatically within an * angular component or directive. * * Programmatic animations are first built and then a player is created when the build animation is * attached to an element. * * ```ts * // remember to include the BrowserAnimationsModule module for this to work... * import {AnimationBuilder} from '\@angular/animations'; * * class MyCmp { * constructor(private _builder: AnimationBuilder) {} * * makeAnimation(element: any) { * // first build the animation * const myAnimation = this._builder.build([ * style({ width: 0 }), * animate(1000, style({ width: '100px' })) * ]); * * // then create a player from it * const player = myAnimation.create(element); * * player.play(); * } * } * ``` * * When an animation is built an instance of {\@link AnimationFactory AnimationFactory} will be * returned. Using that an {\@link AnimationPlayer AnimationPlayer} can be created which can then be * used to start the animation. * * \@experimental Animation support is experimental. * @abstract */ var AnimationBuilder = (function () { function AnimationBuilder() { } return AnimationBuilder; }()); /** * An instance of `AnimationFactory` is returned from {\@link AnimationBuilder#build * AnimationBuilder.build}. * * \@experimental Animation support is experimental. * @abstract */ var AnimationFactory = (function () { function AnimationFactory() { } return AnimationFactory; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license * @record */ /** * \@experimental Animation support is experimental. */ var AUTO_STYLE = '*'; /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link trigger trigger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link state state animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link transition transition animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link keyframes keyframes animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link style style animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animate animate animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animateChild animateChild animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link useAnimation useAnimation animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link sequence sequence animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link group group animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link stagger stagger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * `trigger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the * {\@link Component#animations component animations metadata page} to gain a better * understanding of how animations in Angular are used. * * `trigger` Creates an animation trigger which will a list of {\@link state state} and * {\@link transition transition} entries that will be evaluated when the expression * bound to the trigger changes. * * Triggers are registered within the component annotation data under the * {\@link Component#animations animations section}. An animation trigger can be placed on an element * within a template by referencing the name of the trigger followed by the expression value that * the * trigger is bound to (in the form of `[\@triggerName]="expression"`. * * Animation trigger bindings strigify values and then match the previous and current values against * any linked transitions. If a boolean value is provided into the trigger binding then it will both * be represented as `1` or `true` and `0` or `false` for a true and false boolean values * respectively. * * ### Usage * * `trigger` will create an animation trigger reference based on the provided `name` value. The * provided `animation` value is expected to be an array consisting of {\@link state state} and * {\@link transition transition} declarations. * * ```typescript * \@Component({ * selector: 'my-component', * templateUrl: 'my-component-tpl.html', * animations: [ * trigger("myAnimationTrigger", [ * state(...), * state(...), * transition(...), * transition(...) * ]) * ] * }) * class MyComponent { * myStatusExp = "something"; * } * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * *
...
* ``` * * ## Disable Animations * A special animation control binding called `\@.disabled` can be placed on an element which will * then disable animations for any inner animation triggers situated within the element as well as * any animations on the element itself. * * When true, the `\@.disabled` binding will prevent all animations from rendering. The example * below shows how to use this feature: * * ```ts * \@Component({ * selector: 'my-component', * template: ` *
*
*
* `, * animations: [ * trigger("childAnimation", [ * // ... * ]) * ] * }) * class MyComponent { * isDisabled = true; * exp = '...'; * } * ``` * * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening * (when true). * * Note that `\@.disbled` will only disable all animations (this means any animations running on * the same element will also be disabled). * * ### Disabling Animations Application-wide * When an area of the template is set to have animations disabled, **all** inner components will * also have their animations disabled as well. This means that all animations for an angular * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular * component. * * ```ts * import {Component, HostBinding} from '\@angular/core'; * * \@Component({ * selector: 'app-component', * templateUrl: 'app.component.html', * }) * class AppComponent { * \@HostBinding('\@.disabled') * public animationsDisabled = true; * } * ``` * * ### What about animations that us `query()` and `animateChild()`? * Despite inner animations being disabled, a parent animation can {\@link query query} for inner * elements located in disabled areas of the template and still animate them as it sees fit. This is * also the case for when a sub animation is queried by a parent and then later animated using {\@link * animateChild animateChild}. * * \@experimental Animation support is experimental. * @param {?} name * @param {?} definitions * @return {?} */ function trigger(name, definitions) { return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} }; } /** * `animate` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `animate` specifies an animation step that will apply the provided `styles` data for a given * amount of time based on the provided `timing` expression value. Calls to `animate` are expected * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link * transition transition}. * * ### Usage * * The `animate` function accepts two input parameters: `timing` and `styles`: * * - `timing` is a string based value that can be a combination of a duration with optional delay * and easing values. The format for the expression breaks down to `duration delay easing` * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the * `duration` value in millisecond form. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link * keyframes keyframes}. If left empty then the styles from the destination state will be collected * and used (this is useful when describing an animation step that will complete an animation by * {\@link transition#the-final-animate-call animating to the final state}). * * ```typescript * // various functions for specifying timing data * animate(500, style(...)) * animate("1s", style(...)) * animate("100ms 0.5s", style(...)) * animate("5s ease", style(...)) * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...)) * * // either style() of keyframes() can be used * animate(500, style({ background: "red" })) * animate(500, keyframes([ * style({ background: "blue" })), * style({ background: "red" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} timings * @param {?=} styles * @return {?} */ function animate(timings, styles) { if (styles === void 0) { styles = null; } return { type: 4 /* Animate */, styles: styles, timings: timings }; } /** * `group` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are * useful when a series of styles must be animated/closed off at different starting/ending times. * * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition * transition} and it will only continue to the next instruction once all of the inner animation * steps have completed. * * ### Usage * * The `steps` data that is passed into the `group` animation function can either consist of {\@link * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()` * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link * animate#usage animate() with a delay value} to offset styles to be applied at a later time). * * ```typescript * group([ * animate("1s", { background: "black" })) * animate("2s", { color: "white" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function group(steps, options) { if (options === void 0) { options = null; } return { type: 3 /* Group */, steps: steps, options: options }; } /** * `sequence` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by * default when an array is passed as animation data into {\@link transition transition}.) * * The `sequence` function can either be used within a {\@link group group} or a {\@link transition * transition} and it will only continue to the next instruction once each of the inner animation * steps have completed. * * To perform animation styling in parallel with other animation steps then have a look at the * {\@link group group} animation function. * * ### Usage * * The `steps` data that is passed into the `sequence` animation function can either consist of * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the * provided styling data immediately while a call to `animate()` will apply its styling data over a * given time depending on its timing data. * * ```typescript * sequence([ * style({ opacity: 0 })), * animate("1s", { opacity: 1 })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function sequence(steps, options) { if (options === void 0) { options = null; } return { type: 2 /* Sequence */, steps: steps, options: options }; } /** * `style` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `style` declares a key/value object containing CSS properties/styles that can then be used for * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data * for both {\@link animate animate} and {\@link keyframes keyframes}. * * ### Usage * * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs * to be defined. * * ```typescript * // string values are used for css properties * style({ background: "red", color: "blue" }) * * // numerical (pixel) values are also supported * style({ width: 100, height: 0 }) * ``` * * #### Auto-styles (using `*`) * * When an asterix (`*`) character is used as a value then it will be detected from the element * being animated and applied as animation data when the animation starts. * * This feature proves useful for a state depending on layout and/or environment factors; in such * cases the styles are calculated just before the animation starts. * * ```typescript * // the steps below will animate from 0 to the * // actual height of the element * style({ height: 0 }), * animate("1s", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} tokens * @return {?} */ function style(tokens) { return { type: 6 /* Style */, styles: tokens, offset: null }; } /** * `state` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `state` declares an animation state within the given trigger. When a state is active within a * component then its associated styles will persist on the element that the trigger is attached to * (even when the animation ends). * * To animate between states, have a look at the animation {\@link transition transition} DSL * function. To register states to an animation trigger please have a look at the {\@link trigger * trigger} function. * * #### The `void` state * * The `void` state value is a reserved word that angular uses to determine when the element is not * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the * associated element is void). * * #### The `*` (default) state * * The `*` state (when styled) is a fallback state that will be used if the state that is being * animated is not declared within the trigger. * * ### Usage * * `state` will declare an animation state with its associated styles * within the given trigger. * * - `stateNameExpr` can be one or more state names separated by commas. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once * the state has been reached. * * ```typescript * // "void" is a reserved name for a state and is used to represent * // the state in which an element is detached from from the application. * state("void", style({ height: 0 })) * * // user-defined states * state("closed", style({ height: 0 })) * state("open, visible", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} name * @param {?} styles * @param {?=} options * @return {?} */ function state(name, styles, options) { return { type: 0 /* State */, name: name, styles: styles, options: options }; } /** * `keyframes` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized * by an `offset` value. * * ### Usage * * The `keyframes` animation function is designed to be used alongside the {\@link animate animate} * animation function. Instead of applying animations from where they are currently to their * destination, keyframes can describe how each style entry is applied and at what point within the * animation arc (much like CSS Keyframe Animations do). * * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what * percentage of the animate time the styles will be applied. * * ```typescript * // the provided offset values describe when each backgroundColor value is applied. * animate("5s", keyframes([ * style({ backgroundColor: "red", offset: 0 }), * style({ backgroundColor: "blue", offset: 0.2 }), * style({ backgroundColor: "orange", offset: 0.3 }), * style({ backgroundColor: "black", offset: 1 }) * ])) * ``` * * Alternatively, if there are no `offset` values used within the style entries then the offsets * will be calculated automatically. * * ```typescript * animate("5s", keyframes([ * style({ backgroundColor: "red" }) // offset = 0 * style({ backgroundColor: "blue" }) // offset = 0.33 * style({ backgroundColor: "orange" }) // offset = 0.66 * style({ backgroundColor: "black" }) // offset = 1 * ])) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function keyframes(steps) { return { type: 5 /* Keyframes */, steps: steps }; } /** * `transition` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting * and/or ending state). * * A function can also be provided as the `stateChangeExpr` argument for a transition and this * function will be executed each time a state change occurs. If the value returned within the * function is true then the associated animation will be run. * * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition * to animate to a state value and persist its styles then one or more {\@link state animation * states} is expected to be defined. * * ### Usage * * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on * what the previous state is and what the current state has become. In other words, if a transition * is defined that matches the old/current state criteria then the associated animation will be * triggered. * * ```typescript * // all transition/state changes are defined within an animation trigger * trigger("myAnimationTrigger", [ * // if a state is defined then its styles will be persisted when the * // animation has fully completed itself * state("on", style({ background: "green" })), * state("off", style({ background: "grey" })), * * // a transition animation that will be kicked off when the state value * // bound to "myAnimationTrigger" changes from "on" to "off" * transition("on => off", animate(500)), * * // it is also possible to do run the same animation for both directions * transition("on <=> off", animate(500)), * * // or to define multiple states pairs separated by commas * transition("on => off, off => void", animate(500)), * * // this is a catch-all state change for when an element is inserted into * // the page and the destination state is unknown * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]), * * // this will capture a state change between any states * transition("* => *", animate("1s 0s")), * * // you can also go full out and include a function * transition((fromState, toState) => { * // when `true` then it will allow the animation below to be invoked * return fromState == "off" && toState == "on"; * }, animate("1s 0s")) * ]) * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * *
...
* ``` * * #### The final `animate` call * * If the final step within the transition steps is a call to `animate()` that **only** uses a * timing value with **no style data** then it will be automatically used as the final animation arc * for the element to animate itself to the final state. This involves an automatic mix of * adding/removing CSS styles so that the element will be in the exact state it should be for the * applied state to be presented correctly. * * ``` * // start off by hiding the element, but make sure that it animates properly to whatever state * // is currently active for "myAnimationTrigger" * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * * ### Using :enter and :leave * * Given that enter (insertion) and leave (removal) animations are so common, the `transition` * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `* * => void` state changes. * * ``` * transition(":enter", [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * transition(":leave", [ * animate(500, style({ opacity: 0 })) * ]) * ``` * * ### Boolean values * if a trigger binding value is a boolean value then it can be matched using a transition * expression that compares `true` and `false` or `1` and `0`. * * ``` * // in the template *
...
* * // in the component metadata * trigger('openClose', [ * state('true', style({ height: '*' })), * state('false', style({ height: '0px' })), * transition('false <=> true', animate(500)) * ]) * ``` * * ### Using :increment and :decrement * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases * can be used to kick off a transition when a numeric value has increased or decreased in value. * * ``` * import {group, animate, query, transition, style, trigger} from '\@angular/animations'; * import {Component} from '\@angular/core'; * * \@Component({ * selector: 'banner-carousel-component', * styles: [` * .banner-container { * position:relative; * height:500px; * overflow:hidden; * } * .banner-container > .banner { * position:absolute; * left:0; * top:0; * font-size:200px; * line-height:500px; * font-weight:bold; * text-align:center; * width:100%; * } * `], * template: ` * * *
* * ` * animations: [ * trigger('bannerAnimation', [ * transition(":increment", group([ * query(':enter', [ * style({ left: '100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '-100%' })) * ]) * ])), * transition(":decrement", group([ * query(':enter', [ * style({ left: '-100%' }), * animate('0.5s ease-out', style('*')) * ]), * query(':leave', [ * animate('0.5s ease-out', style({ left: '100%' })) * ]) * ])), * ]) * ] * }) * class BannerCarouselComponent { * allBanners: string[] = ['1', '2', '3', '4']; * selectedIndex: number = 0; * * get banners() { * return [this.allBanners[this.selectedIndex]]; * } * * previous() { * this.selectedIndex = Math.max(this.selectedIndex - 1, 0); * } * * next() { * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1); * } * } * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} stateChangeExpr * @param {?} steps * @param {?=} options * @return {?} */ function transition(stateChangeExpr, steps, options) { if (options === void 0) { options = null; } return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options }; } /** * `animation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later * invoked in another animation or sequence. Reusable animations are designed to make use of * animation parameters and the produced animation can be used via the `useAnimation` method. * * ``` * var fadeAnimation = animation([ * style({ opacity: '{{ start }}' }), * animate('{{ time }}', * style({ opacity: '{{ end }}'})) * ], { params: { time: '1000ms', start: 0, end: 1 }}); * ``` * * If parameters are attached to an animation then they act as **default parameter values**. When an * animation is invoked via `useAnimation` then parameter values are allowed to be passed in * directly. If any of the passed in parameter values are missing then the default values will be * used. * * ``` * useAnimation(fadeAnimation, { * params: { * time: '2s', * start: 1, * end: 0 * } * }) * ``` * * If one or more parameter values are missing before animated then an error will be thrown. * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function animation(steps, options) { if (options === void 0) { options = null; } return { type: 8 /* Reference */, animation: steps, options: options }; } /** * `animateChild` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It works by allowing a queried element to execute its own * animation within the animation sequence. * * Each time an animation is triggered in angular, the parent animation * will always get priority and any child animations will be blocked. In order * for a child animation to run, the parent animation must query each of the elements * containing child animations and then allow the animations to run using `animateChild`. * * The example HTML code below shows both parent and child elements that have animation * triggers that will execute at the same time. * * ```html * * *
* *
*
Hello
*
* one *
*
* two *
*
* three *
*
* ``` * * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate * because it has priority. However, using `query` and `animateChild` each of the inner animations * can also fire: * * ```ts * // parent-child.component.ts * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations'; * \@Component({ * selector: 'parent-child-component', * animations: [ * trigger('parentAnimation', [ * transition('false => true', [ * query('header', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * query('\@childAnimation', [ * animateChild() * ]) * ]) * ]), * trigger('childAnimation', [ * transition('false => true', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]) * ]) * ] * }) * class ParentChildCmp { * exp: boolean = false; * } * ``` * * In the animation code above, when the `parentAnimation` transition kicks off it first queries to * find the header element and fades it in. It then finds each of the sub elements that contain the * `\@childAnimation` trigger and then allows for their animations to fire. * * This example can be further extended by using stagger: * * ```ts * query('\@childAnimation', stagger(100, [ * animateChild() * ])) * ``` * * Now each of the sub animations start off with respect to the `100ms` staggering step. * * ## The first frame of child animations * When sub animations are executed using `animateChild` the animation engine will always apply the * first frame of every sub animation immediately at the start of the animation sequence. This way * the parent animation does not need to set any initial styling data on the sub elements before the * sub animations kick off. * * In the example above the first frame of the `childAnimation`'s `false => true` transition * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation` * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called * with `animateChild` will it then animate to its destination of `opacity: 1`. * * Note that this feature designed to be used alongside {\@link query query()} and it will only work * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes * and transitions are not handled by this API). * * \@experimental Animation support is experimental. * @param {?=} options * @return {?} */ function animateChild(options) { if (options === void 0) { options = null; } return { type: 9 /* AnimateChild */, options: options }; } /** * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is used to kick off a reusable animation that is created using {\@link * animation animation()}. * * \@experimental Animation support is experimental. * @param {?} animation * @param {?=} options * @return {?} */ function useAnimation(animation, options) { if (options === void 0) { options = null; } return { type: 10 /* AnimateRef */, animation: animation, options: options }; } /** * `query` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * query() is used to find one or more inner elements within the current element that is * being animated within the sequence. The provided animation steps are applied * to the queried element (by default, an array is provided, then this will be * treated as an animation sequence). * * ### Usage * * query() is designed to collect mutiple elements and works internally by using * `element.querySelectorAll`. An additional options object can be provided which * can be used to limit the total amount of items to be collected. * * ```js * query('div', [ * animate(...), * animate(...) * ], { limit: 1 }) * ``` * * query(), by default, will throw an error when zero items are found. If a query * has the `optional` flag set to true then this error will be ignored. * * ```js * query('.some-element-that-may-not-be-there', [ * animate(...), * animate(...) * ], { optional: true }) * ``` * * ### Special Selector Values * * The selector value within a query can collect elements that contain angular-specific * characteristics * using special pseudo-selectors tokens. * * These include: * * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")` * - Querying all currently animating elements using `query(":animating")` * - Querying elements that contain an animation trigger using `query("\@triggerName")` * - Querying all elements that contain an animation triggers using `query("\@*")` * - Including the current element into the animation sequence using `query(":self")` * * * Each of these pseudo-selector tokens can be merged together into a combined query selector * string: * * ``` * query(':self, .record:enter, .record:leave, \@subTrigger', [...]) * ``` * * ### Demo * * ``` * \@Component({ * selector: 'inner', * template: ` *
*

Title

*
* Blah blah blah *
*
* `, * animations: [ * trigger('queryAnimation', [ * transition('* => goAnimate', [ * // hide the inner elements * query('h1', style({ opacity: 0 })), * query('.content', style({ opacity: 0 })), * * // animate the inner elements in, one by one * query('h1', animate(1000, style({ opacity: 1 })), * query('.content', animate(1000, style({ opacity: 1 })), * ]) * ]) * ] * }) * class Cmp { * exp = ''; * * goAnimate() { * this.exp = 'goAnimate'; * } * } * ``` * * \@experimental Animation support is experimental. * @param {?} selector * @param {?} animation * @param {?=} options * @return {?} */ function query(selector, animation, options) { if (options === void 0) { options = null; } return { type: 11 /* Query */, selector: selector, animation: animation, options: options }; } /** * `stagger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is designed to be used inside of an animation {\@link query query()} * and works by issuing a timing gap between after each queried item is animated. * * ### Usage * * In the example below there is a container element that wraps a list of items stamped out * by an ngFor. The container element contains an animation trigger that will later be set * to query for each of the inner items. * * ```html * * *
*
*
* {{ item }} *
*
* ``` * * The component code for this looks as such: * * ```ts * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations'; * \@Component({ * templateUrl: 'list.component.html', * animations: [ * trigger('listAnimation', [ * //... * ]) * ] * }) * class ListComponent { * items = []; * * showItems() { * this.items = [0,1,2,3,4]; * } * * hideItems() { * this.items = []; * } * * toggle() { * this.items.length ? this.hideItems() : this.showItems(); * } * } * ``` * * And now for the animation trigger code: * * ```ts * trigger('listAnimation', [ * transition('* => *', [ // each time the binding value changes * query(':leave', [ * stagger(100, [ * animate('0.5s', style({ opacity: 0 })) * ]) * ]), * query(':enter', [ * style({ opacity: 0 }), * stagger(100, [ * animate('0.5s', style({ opacity: 1 })) * ]) * ]) * ]) * ]) * ``` * * Now each time the items are added/removed then either the opacity * fade-in animation will run or each removed item will be faded out. * When either of these animations occur then a stagger effect will be * applied after each item's animation is started. * * \@experimental Animation support is experimental. * @param {?} timings * @param {?} animation * @return {?} */ function stagger(timings, animation) { return { type: 12 /* Stagger */, timings: timings, animation: animation }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license * @param {?} cb * @return {?} */ function scheduleMicroTask(cb) { Promise.resolve(null).then(cb); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * AnimationPlayer controls an animation sequence that was produced from a programmatic animation. * (see {\@link AnimationBuilder AnimationBuilder} for more information on how to create programmatic * animations.) * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. */ var NoopAnimationPlayer = (function () { function NoopAnimationPlayer() { this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._started = false; this._destroyed = false; this._finished = false; this.parentPlayer = null; this.totalTime = 0; } /** * @return {?} */ NoopAnimationPlayer.prototype._onFinish = /** * @return {?} */ function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; /** * @param {?} fn * @return {?} */ NoopAnimationPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { this._onStartFns.push(fn); }; /** * @param {?} fn * @return {?} */ NoopAnimationPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ NoopAnimationPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ NoopAnimationPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this._started; }; /** * @return {?} */ NoopAnimationPlayer.prototype.init = /** * @return {?} */ function () { }; /** * @return {?} */ NoopAnimationPlayer.prototype.play = /** * @return {?} */ function () { if (!this.hasStarted()) { this.triggerMicrotask(); this._onStart(); } this._started = true; }; /* @internal */ /** * @return {?} */ NoopAnimationPlayer.prototype.triggerMicrotask = /** * @return {?} */ function () { var _this = this; scheduleMicroTask(function () { return _this._onFinish(); }); }; /** * @return {?} */ NoopAnimationPlayer.prototype._onStart = /** * @return {?} */ function () { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; }; /** * @return {?} */ NoopAnimationPlayer.prototype.pause = /** * @return {?} */ function () { }; /** * @return {?} */ NoopAnimationPlayer.prototype.restart = /** * @return {?} */ function () { }; /** * @return {?} */ NoopAnimationPlayer.prototype.finish = /** * @return {?} */ function () { this._onFinish(); }; /** * @return {?} */ NoopAnimationPlayer.prototype.destroy = /** * @return {?} */ function () { if (!this._destroyed) { this._destroyed = true; if (!this.hasStarted()) { this._onStart(); } this.finish(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; /** * @return {?} */ NoopAnimationPlayer.prototype.reset = /** * @return {?} */ function () { }; /** * @param {?} p * @return {?} */ NoopAnimationPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { }; /** * @return {?} */ NoopAnimationPlayer.prototype.getPosition = /** * @return {?} */ function () { return 0; }; /* @internal */ /** * @param {?} phaseName * @return {?} */ NoopAnimationPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return NoopAnimationPlayer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var AnimationGroupPlayer = (function () { function AnimationGroupPlayer(_players) { var _this = this; this._onDoneFns = []; this._onStartFns = []; this._finished = false; this._started = false; this._destroyed = false; this._onDestroyFns = []; this.parentPlayer = null; this.totalTime = 0; this.players = _players; var /** @type {?} */ doneCount = 0; var /** @type {?} */ destroyCount = 0; var /** @type {?} */ startCount = 0; var /** @type {?} */ total = this.players.length; if (total == 0) { scheduleMicroTask(function () { return _this._onFinish(); }); } else { this.players.forEach(function (player) { player.parentPlayer = _this; player.onDone(function () { if (++doneCount >= total) { _this._onFinish(); } }); player.onDestroy(function () { if (++destroyCount >= total) { _this._onDestroy(); } }); player.onStart(function () { if (++startCount >= total) { _this._onStart(); } }); }); } this.totalTime = this.players.reduce(function (time, player) { return Math.max(time, player.totalTime); }, 0); } /** * @return {?} */ AnimationGroupPlayer.prototype._onFinish = /** * @return {?} */ function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; /** * @return {?} */ AnimationGroupPlayer.prototype.init = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.init(); }); }; /** * @param {?} fn * @return {?} */ AnimationGroupPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { this._onStartFns.push(fn); }; /** * @return {?} */ AnimationGroupPlayer.prototype._onStart = /** * @return {?} */ function () { if (!this.hasStarted()) { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; this._started = true; } }; /** * @param {?} fn * @return {?} */ AnimationGroupPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ AnimationGroupPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ AnimationGroupPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this._started; }; /** * @return {?} */ AnimationGroupPlayer.prototype.play = /** * @return {?} */ function () { if (!this.parentPlayer) { this.init(); } this._onStart(); this.players.forEach(function (player) { return player.play(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.pause = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.pause(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.restart = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.restart(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.finish = /** * @return {?} */ function () { this._onFinish(); this.players.forEach(function (player) { return player.finish(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.destroy = /** * @return {?} */ function () { this._onDestroy(); }; /** * @return {?} */ AnimationGroupPlayer.prototype._onDestroy = /** * @return {?} */ function () { if (!this._destroyed) { this._destroyed = true; this._onFinish(); this.players.forEach(function (player) { return player.destroy(); }); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; /** * @return {?} */ AnimationGroupPlayer.prototype.reset = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.reset(); }); this._destroyed = false; this._finished = false; this._started = false; }; /** * @param {?} p * @return {?} */ AnimationGroupPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { var /** @type {?} */ timeAtPosition = p * this.totalTime; this.players.forEach(function (player) { var /** @type {?} */ position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1; player.setPosition(position); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.getPosition = /** * @return {?} */ function () { var /** @type {?} */ min = 0; this.players.forEach(function (player) { var /** @type {?} */ p = player.getPosition(); min = Math.min(p, min); }); return min; }; /** * @return {?} */ AnimationGroupPlayer.prototype.beforeDestroy = /** * @return {?} */ function () { this.players.forEach(function (player) { if (player.beforeDestroy) { player.beforeDestroy(); } }); }; /* @internal */ /** * @param {?} phaseName * @return {?} */ AnimationGroupPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return AnimationGroupPlayer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ɵPRE_STYLE = '!'; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all animation APIs of the animation package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=animations.js.map /***/ }), /***/ "../../../animations/esm5/browser.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AnimationDriver; }); /* unused harmony export ɵAnimation */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AnimationStyleNormalizer; }); /* unused harmony export ɵNoopAnimationStyleNormalizer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return WebAnimationsStyleNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NoopAnimationDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AnimationEngine; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return WebAnimationsDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return supportsWebAnimations; }); /* unused harmony export ɵWebAnimationsPlayer */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_animations__ = __webpack_require__("../../../animations/esm5/animations.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__("../../../../tslib/tslib.es6.js"); /** * @license Angular v5.0.5 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} players * @return {?} */ function optimizeGroupPlayer(players) { switch (players.length) { case 0: return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["d" /* NoopAnimationPlayer */](); case 1: return players[0]; default: return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["l" /* ɵAnimationGroupPlayer */](players); } } /** * @param {?} driver * @param {?} normalizer * @param {?} element * @param {?} keyframes * @param {?=} preStyles * @param {?=} postStyles * @return {?} */ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) { if (preStyles === void 0) { preStyles = {}; } if (postStyles === void 0) { postStyles = {}; } var /** @type {?} */ errors = []; var /** @type {?} */ normalizedKeyframes = []; var /** @type {?} */ previousOffset = -1; var /** @type {?} */ previousKeyframe = null; keyframes.forEach(function (kf) { var /** @type {?} */ offset = /** @type {?} */ (kf['offset']); var /** @type {?} */ isSameOffset = offset == previousOffset; var /** @type {?} */ normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; Object.keys(kf).forEach(function (prop) { var /** @type {?} */ normalizedProp = prop; var /** @type {?} */ normalizedValue = kf[prop]; if (prop !== 'offset') { normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); switch (normalizedValue) { case __WEBPACK_IMPORTED_MODULE_0__angular_animations__["m" /* ɵPRE_STYLE */]: normalizedValue = preStyles[prop]; break; case __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]: normalizedValue = postStyles[prop]; break; default: normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); break; } } normalizedKeyframe[normalizedProp] = normalizedValue; }); if (!isSameOffset) { normalizedKeyframes.push(normalizedKeyframe); } previousKeyframe = normalizedKeyframe; previousOffset = offset; }); if (errors.length) { var /** @type {?} */ LINE_START = '\n - '; throw new Error("Unable to animate due to the following errors:" + LINE_START + errors.join(LINE_START)); } return normalizedKeyframes; } /** * @param {?} player * @param {?} eventName * @param {?} event * @param {?} callback * @return {?} */ function listenOnPlayer(player, eventName, event, callback) { switch (eventName) { case 'start': player.onStart(function () { return callback(event && copyAnimationEvent(event, 'start', player.totalTime)); }); break; case 'done': player.onDone(function () { return callback(event && copyAnimationEvent(event, 'done', player.totalTime)); }); break; case 'destroy': player.onDestroy(function () { return callback(event && copyAnimationEvent(event, 'destroy', player.totalTime)); }); break; } } /** * @param {?} e * @param {?=} phaseName * @param {?=} totalTime * @return {?} */ function copyAnimationEvent(e, phaseName, totalTime) { var /** @type {?} */ event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime); var /** @type {?} */ data = (/** @type {?} */ (e))['_data']; if (data != null) { (/** @type {?} */ (event))['_data'] = data; } return event; } /** * @param {?} element * @param {?} triggerName * @param {?} fromState * @param {?} toState * @param {?=} phaseName * @param {?=} totalTime * @return {?} */ function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime) { if (phaseName === void 0) { phaseName = ''; } if (totalTime === void 0) { totalTime = 0; } return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime }; } /** * @param {?} map * @param {?} key * @param {?} defaultValue * @return {?} */ function getOrSetAsInMap(map, key, defaultValue) { var /** @type {?} */ value; if (map instanceof Map) { value = map.get(key); if (!value) { map.set(key, value = defaultValue); } } else { value = map[key]; if (!value) { value = map[key] = defaultValue; } } return value; } /** * @param {?} command * @return {?} */ function parseTimelineCommand(command) { var /** @type {?} */ separatorPos = command.indexOf(':'); var /** @type {?} */ id = command.substring(1, separatorPos); var /** @type {?} */ action = command.substr(separatorPos + 1); return [id, action]; } var _contains = function (elm1, elm2) { return false; }; var _matches = function (element, selector) { return false; }; var _query = function (element, selector, multi) { return []; }; if (typeof Element != 'undefined') { // this is well supported in all browsers _contains = function (elm1, elm2) { return /** @type {?} */ (elm1.contains(elm2)); }; if (Element.prototype.matches) { _matches = function (element, selector) { return element.matches(selector); }; } else { var /** @type {?} */ proto = /** @type {?} */ (Element.prototype); var /** @type {?} */ fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; if (fn_1) { _matches = function (element, selector) { return fn_1.apply(element, [selector]); }; } } _query = function (element, selector, multi) { var /** @type {?} */ results = []; if (multi) { results.push.apply(results, element.querySelectorAll(selector)); } else { var /** @type {?} */ elm = element.querySelector(selector); if (elm) { results.push(elm); } } return results; }; } var _CACHED_BODY = null; /** * @param {?} prop * @return {?} */ function validateStyleProperty(prop) { if (!_CACHED_BODY) { _CACHED_BODY = getBodyNode() || {}; } return /** @type {?} */ ((_CACHED_BODY)).style ? prop in /** @type {?} */ ((_CACHED_BODY)).style : true; } /** * @return {?} */ function getBodyNode() { if (typeof document != 'undefined') { return document.body; } return null; } var matchesElement = _matches; var containsElement = _contains; var invokeQuery = _query; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental */ var NoopAnimationDriver = (function () { function NoopAnimationDriver() { } /** * @param {?} prop * @return {?} */ NoopAnimationDriver.prototype.validateStyleProperty = /** * @param {?} prop * @return {?} */ function (prop) { return validateStyleProperty(prop); }; /** * @param {?} element * @param {?} selector * @return {?} */ NoopAnimationDriver.prototype.matchesElement = /** * @param {?} element * @param {?} selector * @return {?} */ function (element, selector) { return matchesElement(element, selector); }; /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ NoopAnimationDriver.prototype.containsElement = /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ function (elm1, elm2) { return containsElement(elm1, elm2); }; /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ NoopAnimationDriver.prototype.query = /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ function (element, selector, multi) { return invokeQuery(element, selector, multi); }; /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ NoopAnimationDriver.prototype.computeStyle = /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ function (element, prop, defaultValue) { return defaultValue || ''; }; /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ NoopAnimationDriver.prototype.animate = /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ function (element, keyframes, duration, delay, easing, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["d" /* NoopAnimationPlayer */](); }; return NoopAnimationDriver; }()); /** * \@experimental * @abstract */ var AnimationDriver = (function () { function AnimationDriver() { } AnimationDriver.NOOP = new NoopAnimationDriver(); return AnimationDriver; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ONE_SECOND = 1000; var SUBSTITUTION_EXPR_START = '{{'; var SUBSTITUTION_EXPR_END = '}}'; var ENTER_CLASSNAME = 'ng-enter'; var LEAVE_CLASSNAME = 'ng-leave'; var NG_TRIGGER_CLASSNAME = 'ng-trigger'; var NG_TRIGGER_SELECTOR = '.ng-trigger'; var NG_ANIMATING_CLASSNAME = 'ng-animating'; var NG_ANIMATING_SELECTOR = '.ng-animating'; /** * @param {?} value * @return {?} */ function resolveTimingValue(value) { if (typeof value == 'number') return value; var /** @type {?} */ matches = (/** @type {?} */ (value)).match(/^(-?[\.\d]+)(m?s)/); if (!matches || matches.length < 2) return 0; return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); } /** * @param {?} value * @param {?} unit * @return {?} */ function _convertTimeValueToMS(value, unit) { switch (unit) { case 's': return value * ONE_SECOND; default: // ms or something else return value; } } /** * @param {?} timings * @param {?} errors * @param {?=} allowNegativeValues * @return {?} */ function resolveTiming(timings, errors, allowNegativeValues) { return timings.hasOwnProperty('duration') ? /** @type {?} */ (timings) : parseTimeExpression(/** @type {?} */ (timings), errors, allowNegativeValues); } /** * @param {?} exp * @param {?} errors * @param {?=} allowNegativeValues * @return {?} */ function parseTimeExpression(exp, errors, allowNegativeValues) { var /** @type {?} */ regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; var /** @type {?} */ duration; var /** @type {?} */ delay = 0; var /** @type {?} */ easing = ''; if (typeof exp === 'string') { var /** @type {?} */ matches = exp.match(regex); if (matches === null) { errors.push("The provided timing value \"" + exp + "\" is invalid."); return { duration: 0, delay: 0, easing: '' }; } duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); var /** @type {?} */ delayMatch = matches[3]; if (delayMatch != null) { delay = _convertTimeValueToMS(Math.floor(parseFloat(delayMatch)), matches[4]); } var /** @type {?} */ easingVal = matches[5]; if (easingVal) { easing = easingVal; } } else { duration = /** @type {?} */ (exp); } if (!allowNegativeValues) { var /** @type {?} */ containsErrors = false; var /** @type {?} */ startIndex = errors.length; if (duration < 0) { errors.push("Duration values below 0 are not allowed for this animation step."); containsErrors = true; } if (delay < 0) { errors.push("Delay values below 0 are not allowed for this animation step."); containsErrors = true; } if (containsErrors) { errors.splice(startIndex, 0, "The provided timing value \"" + exp + "\" is invalid."); } } return { duration: duration, delay: delay, easing: easing }; } /** * @param {?} obj * @param {?=} destination * @return {?} */ function copyObj(obj, destination) { if (destination === void 0) { destination = {}; } Object.keys(obj).forEach(function (prop) { destination[prop] = obj[prop]; }); return destination; } /** * @param {?} styles * @return {?} */ function normalizeStyles(styles) { var /** @type {?} */ normalizedStyles = {}; if (Array.isArray(styles)) { styles.forEach(function (data) { return copyStyles(data, false, normalizedStyles); }); } else { copyStyles(styles, false, normalizedStyles); } return normalizedStyles; } /** * @param {?} styles * @param {?} readPrototype * @param {?=} destination * @return {?} */ function copyStyles(styles, readPrototype, destination) { if (destination === void 0) { destination = {}; } if (readPrototype) { // we make use of a for-in loop so that the // prototypically inherited properties are // revealed from the backFill map for (var /** @type {?} */ prop in styles) { destination[prop] = styles[prop]; } } else { copyObj(styles, destination); } return destination; } /** * @param {?} element * @param {?} styles * @return {?} */ function setStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(function (prop) { var /** @type {?} */ camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = styles[prop]; }); } } /** * @param {?} element * @param {?} styles * @return {?} */ function eraseStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(function (prop) { var /** @type {?} */ camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = ''; }); } } /** * @param {?} steps * @return {?} */ function normalizeAnimationEntry(steps) { if (Array.isArray(steps)) { if (steps.length == 1) return steps[0]; return Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["g" /* sequence */])(steps); } return /** @type {?} */ (steps); } /** * @param {?} value * @param {?} options * @param {?} errors * @return {?} */ function validateStyleParams(value, options, errors) { var /** @type {?} */ params = options.params || {}; var /** @type {?} */ matches = extractStyleParams(value); if (matches.length) { matches.forEach(function (varName) { if (!params.hasOwnProperty(varName)) { errors.push("Unable to resolve the local animation param " + varName + " in the given list of values"); } }); } } var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g'); /** * @param {?} value * @return {?} */ function extractStyleParams(value) { var /** @type {?} */ params = []; if (typeof value === 'string') { var /** @type {?} */ val = value.toString(); var /** @type {?} */ match = void 0; while (match = PARAM_REGEX.exec(val)) { params.push(/** @type {?} */ (match[1])); } PARAM_REGEX.lastIndex = 0; } return params; } /** * @param {?} value * @param {?} params * @param {?} errors * @return {?} */ function interpolateParams(value, params, errors) { var /** @type {?} */ original = value.toString(); var /** @type {?} */ str = original.replace(PARAM_REGEX, function (_, varName) { var /** @type {?} */ localVal = params[varName]; // this means that the value was never overidden by the data passed in by the user if (!params.hasOwnProperty(varName)) { errors.push("Please provide a value for the animation param " + varName); localVal = ''; } return localVal.toString(); }); // we do this to assert that numeric values stay as they are return str == original ? value : str; } /** * @param {?} iterator * @return {?} */ function iteratorToArray(iterator) { var /** @type {?} */ arr = []; var /** @type {?} */ item = iterator.next(); while (!item.done) { arr.push(item.value); item = iterator.next(); } return arr; } /** * @param {?} source * @param {?} destination * @return {?} */ var DASH_CASE_REGEXP = /-+([a-z0-9])/g; /** * @param {?} input * @return {?} */ function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, function () { var m = []; for (var _i = 0; _i < arguments.length; _i++) { m[_i] = arguments[_i]; } return m[1].toUpperCase(); }); } /** * @param {?} duration * @param {?} delay * @return {?} */ function allowPreviousPlayerStylesMerge(duration, delay) { return duration === 0 || delay === 0; } /** * @param {?} visitor * @param {?} node * @param {?} context * @return {?} */ function visitDslNode(visitor, node, context) { switch (node.type) { case 7 /* Trigger */: return visitor.visitTrigger(node, context); case 0 /* State */: return visitor.visitState(node, context); case 1 /* Transition */: return visitor.visitTransition(node, context); case 2 /* Sequence */: return visitor.visitSequence(node, context); case 3 /* Group */: return visitor.visitGroup(node, context); case 4 /* Animate */: return visitor.visitAnimate(node, context); case 5 /* Keyframes */: return visitor.visitKeyframes(node, context); case 6 /* Style */: return visitor.visitStyle(node, context); case 8 /* Reference */: return visitor.visitReference(node, context); case 9 /* AnimateChild */: return visitor.visitAnimateChild(node, context); case 10 /* AnimateRef */: return visitor.visitAnimateRef(node, context); case 11 /* Query */: return visitor.visitQuery(node, context); case 12 /* Stagger */: return visitor.visitStagger(node, context); default: throw new Error("Unable to resolve animation metadata node #" + node.type); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ANY_STATE = '*'; /** * @param {?} transitionValue * @param {?} errors * @return {?} */ function parseTransitionExpr(transitionValue, errors) { var /** @type {?} */ expressions = []; if (typeof transitionValue == 'string') { (/** @type {?} */ (transitionValue)) .split(/\s*,\s*/) .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); } else { expressions.push(/** @type {?} */ (transitionValue)); } return expressions; } /** * @param {?} eventStr * @param {?} expressions * @param {?} errors * @return {?} */ function parseInnerTransitionStr(eventStr, expressions, errors) { if (eventStr[0] == ':') { var /** @type {?} */ result = parseAnimationAlias(eventStr, errors); if (typeof result == 'function') { expressions.push(result); return; } eventStr = /** @type {?} */ (result); } var /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/); if (match == null || match.length < 4) { errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); return expressions; } var /** @type {?} */ fromState = match[1]; var /** @type {?} */ separator = match[2]; var /** @type {?} */ toState = match[3]; expressions.push(makeLambdaFromStates(fromState, toState)); var /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; if (separator[0] == '<' && !isFullAnyStateExpr) { expressions.push(makeLambdaFromStates(toState, fromState)); } } /** * @param {?} alias * @param {?} errors * @return {?} */ function parseAnimationAlias(alias, errors) { switch (alias) { case ':enter': return 'void => *'; case ':leave': return '* => void'; case ':increment': return function (fromState, toState) { return parseFloat(toState) > parseFloat(fromState); }; case ':decrement': return function (fromState, toState) { return parseFloat(toState) < parseFloat(fromState); }; default: errors.push("The transition alias value \"" + alias + "\" is not supported"); return '* => *'; } } var TRUE_BOOLEAN_VALUES = new Set(); TRUE_BOOLEAN_VALUES.add('true'); TRUE_BOOLEAN_VALUES.add('1'); var FALSE_BOOLEAN_VALUES = new Set(); FALSE_BOOLEAN_VALUES.add('false'); FALSE_BOOLEAN_VALUES.add('0'); /** * @param {?} lhs * @param {?} rhs * @return {?} */ function makeLambdaFromStates(lhs, rhs) { var /** @type {?} */ LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); var /** @type {?} */ RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); return function (fromState, toState) { var /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState; var /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState; if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); } if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); } return lhsMatch && rhsMatch; }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var SELF_TOKEN = ':self'; var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); /** * @param {?} driver * @param {?} metadata * @param {?} errors * @return {?} */ function buildAnimationAst(driver, metadata, errors) { return new AnimationAstBuilderVisitor(driver).build(metadata, errors); } var ROOT_SELECTOR = ''; var AnimationAstBuilderVisitor = (function () { function AnimationAstBuilderVisitor(_driver) { this._driver = _driver; } /** * @param {?} metadata * @param {?} errors * @return {?} */ AnimationAstBuilderVisitor.prototype.build = /** * @param {?} metadata * @param {?} errors * @return {?} */ function (metadata, errors) { var /** @type {?} */ context = new AnimationAstBuilderContext(errors); this._resetContextStyleTimingState(context); return /** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context)); }; /** * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = /** * @param {?} context * @return {?} */ function (context) { context.currentQuerySelector = ROOT_SELECTOR; context.collectedStyles = {}; context.collectedStyles[ROOT_SELECTOR] = {}; context.currentTime = 0; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitTrigger = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; var /** @type {?} */ queryCount = context.queryCount = 0; var /** @type {?} */ depCount = context.depCount = 0; var /** @type {?} */ states = []; var /** @type {?} */ transitions = []; if (metadata.name.charAt(0) == '@') { context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))'); } metadata.definitions.forEach(function (def) { _this._resetContextStyleTimingState(context); if (def.type == 0 /* State */) { var /** @type {?} */ stateDef_1 = /** @type {?} */ (def); var /** @type {?} */ name_1 = stateDef_1.name; name_1.split(/\s*,\s*/).forEach(function (n) { stateDef_1.name = n; states.push(_this.visitState(stateDef_1, context)); }); stateDef_1.name = name_1; } else if (def.type == 1 /* Transition */) { var /** @type {?} */ transition = _this.visitTransition(/** @type {?} */ (def), context); queryCount += transition.queryCount; depCount += transition.depCount; transitions.push(transition); } else { context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); } }); return { type: 7 /* Trigger */, name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount, options: null }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitState = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ styleAst = this.visitStyle(metadata.styles, context); var /** @type {?} */ astParams = (metadata.options && metadata.options.params) || null; if (styleAst.containsDynamicStyles) { var /** @type {?} */ missingSubs_1 = new Set(); var /** @type {?} */ params_1 = astParams || {}; styleAst.styles.forEach(function (value) { if (isObject(value)) { var /** @type {?} */ stylesObj_1 = /** @type {?} */ (value); Object.keys(stylesObj_1).forEach(function (prop) { extractStyleParams(stylesObj_1[prop]).forEach(function (sub) { if (!params_1.hasOwnProperty(sub)) { missingSubs_1.add(sub); } }); }); } }); if (missingSubs_1.size) { var /** @type {?} */ missingSubsArr = iteratorToArray(missingSubs_1.values()); context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', ')); } } return { type: 0 /* State */, name: metadata.name, style: styleAst, options: astParams ? { params: astParams } : null }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitTransition = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { context.queryCount = 0; context.depCount = 0; var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); var /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors); return { type: 1 /* Transition */, matchers: matchers, animation: animation, queryCount: context.queryCount, depCount: context.depCount, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitSequence = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; return { type: 2 /* Sequence */, steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }), options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitGroup = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; var /** @type {?} */ currentTime = context.currentTime; var /** @type {?} */ furthestTime = 0; var /** @type {?} */ steps = metadata.steps.map(function (step) { context.currentTime = currentTime; var /** @type {?} */ innerAst = visitDslNode(_this, step, context); furthestTime = Math.max(furthestTime, context.currentTime); return innerAst; }); context.currentTime = furthestTime; return { type: 3 /* Group */, steps: steps, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitAnimate = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors); context.currentAnimateTimings = timingAst; var /** @type {?} */ styleAst; var /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["i" /* style */])({}); if (styleMetadata.type == 5 /* Keyframes */) { styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context); } else { var /** @type {?} */ styleMetadata_1 = /** @type {?} */ (metadata.styles); var /** @type {?} */ isEmpty = false; if (!styleMetadata_1) { isEmpty = true; var /** @type {?} */ newStyleData = {}; if (timingAst.easing) { newStyleData['easing'] = timingAst.easing; } styleMetadata_1 = Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["i" /* style */])(newStyleData); } context.currentTime += timingAst.duration + timingAst.delay; var /** @type {?} */ _styleAst = this.visitStyle(styleMetadata_1, context); _styleAst.isEmptyStep = isEmpty; styleAst = _styleAst; } context.currentAnimateTimings = null; return { type: 4 /* Animate */, timings: timingAst, style: styleAst, options: null }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitStyle = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ ast = this._makeStyleAst(metadata, context); this._validateStyleAst(ast, context); return ast; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype._makeStyleAst = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ styles = []; if (Array.isArray(metadata.styles)) { (/** @type {?} */ (metadata.styles)).forEach(function (styleTuple) { if (typeof styleTuple == 'string') { if (styleTuple == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]) { styles.push(/** @type {?} */ (styleTuple)); } else { context.errors.push("The provided style string value " + styleTuple + " is not allowed."); } } else { styles.push(/** @type {?} */ (styleTuple)); } }); } else { styles.push(metadata.styles); } var /** @type {?} */ containsDynamicStyles = false; var /** @type {?} */ collectedEasing = null; styles.forEach(function (styleData) { if (isObject(styleData)) { var /** @type {?} */ styleMap = /** @type {?} */ (styleData); var /** @type {?} */ easing = styleMap['easing']; if (easing) { collectedEasing = /** @type {?} */ (easing); delete styleMap['easing']; } if (!containsDynamicStyles) { for (var /** @type {?} */ prop in styleMap) { var /** @type {?} */ value = styleMap[prop]; if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { containsDynamicStyles = true; break; } } } } }); return { type: 6 /* Style */, styles: styles, easing: collectedEasing, offset: metadata.offset, containsDynamicStyles: containsDynamicStyles, options: null }; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype._validateStyleAst = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; var /** @type {?} */ timings = context.currentAnimateTimings; var /** @type {?} */ endTime = context.currentTime; var /** @type {?} */ startTime = context.currentTime; if (timings && startTime > 0) { startTime -= timings.duration + timings.delay; } ast.styles.forEach(function (tuple) { if (typeof tuple == 'string') return; Object.keys(tuple).forEach(function (prop) { if (!_this._driver.validateStyleProperty(prop)) { context.errors.push("The provided animation property \"" + prop + "\" is not a supported CSS property for animations"); return; } var /** @type {?} */ collectedStyles = context.collectedStyles[/** @type {?} */ ((context.currentQuerySelector))]; var /** @type {?} */ collectedEntry = collectedStyles[prop]; var /** @type {?} */ updateCollectedStyle = true; if (collectedEntry) { if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) { context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\""); updateCollectedStyle = false; } // we always choose the smaller start time value since we // want to have a record of the entire animation window where // the style property is being animated in between startTime = collectedEntry.startTime; } if (updateCollectedStyle) { collectedStyles[prop] = { startTime: startTime, endTime: endTime }; } if (context.options) { validateStyleParams(tuple[prop], context.options, context.errors); } }); }); }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitKeyframes = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; var /** @type {?} */ ast = { type: 5 /* Keyframes */, styles: [], options: null }; if (!context.currentAnimateTimings) { context.errors.push("keyframes() must be placed inside of a call to animate()"); return ast; } var /** @type {?} */ MAX_KEYFRAME_OFFSET = 1; var /** @type {?} */ totalKeyframesWithOffsets = 0; var /** @type {?} */ offsets = []; var /** @type {?} */ offsetsOutOfOrder = false; var /** @type {?} */ keyframesOutOfRange = false; var /** @type {?} */ previousOffset = 0; var /** @type {?} */ keyframes = metadata.steps.map(function (styles) { var /** @type {?} */ style$$1 = _this._makeStyleAst(styles, context); var /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); var /** @type {?} */ offset = 0; if (offsetVal != null) { totalKeyframesWithOffsets++; offset = style$$1.offset = offsetVal; } keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; previousOffset = offset; offsets.push(offset); return style$$1; }); if (keyframesOutOfRange) { context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); } if (offsetsOutOfOrder) { context.errors.push("Please ensure that all keyframe offsets are in order"); } var /** @type {?} */ length = metadata.steps.length; var /** @type {?} */ generatedOffset = 0; if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); } else if (totalKeyframesWithOffsets == 0) { generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); } var /** @type {?} */ limit = length - 1; var /** @type {?} */ currentTime = context.currentTime; var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); var /** @type {?} */ animateDuration = currentAnimateTimings.duration; keyframes.forEach(function (kf, i) { var /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; var /** @type {?} */ durationUpToThisFrame = offset * animateDuration; context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; currentAnimateTimings.duration = durationUpToThisFrame; _this._validateStyleAst(kf, context); kf.offset = offset; ast.styles.push(kf); }); return ast; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitReference = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { return { type: 8 /* Reference */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitAnimateChild = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { context.depCount++; return { type: 9 /* AnimateChild */, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitAnimateRef = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { return { type: 10 /* AnimateRef */, animation: this.visitReference(metadata.animation, context), options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitQuery = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ parentSelector = /** @type {?} */ ((context.currentQuerySelector)); var /** @type {?} */ options = /** @type {?} */ ((metadata.options || {})); context.queryCount++; context.currentQuery = metadata; var _a = normalizeSelector(metadata.selector), selector = _a[0], includeSelf = _a[1]; context.currentQuerySelector = parentSelector.length ? (parentSelector + ' ' + selector) : selector; getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); context.currentQuery = null; context.currentQuerySelector = parentSelector; return { type: 11 /* Query */, selector: selector, limit: options.limit || 0, optional: !!options.optional, includeSelf: includeSelf, animation: animation, originalSelector: metadata.selector, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitStagger = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { if (!context.currentQuery) { context.errors.push("stagger() can only be used inside of query()"); } var /** @type {?} */ timings = metadata.timings === 'full' ? { duration: 0, delay: 0, easing: 'full' } : resolveTiming(metadata.timings, context.errors, true); return { type: 12 /* Stagger */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings, options: null }; }; return AnimationAstBuilderVisitor; }()); /** * @param {?} selector * @return {?} */ function normalizeSelector(selector) { var /** @type {?} */ hasAmpersand = selector.split(/\s*,\s*/).find(function (token) { return token == SELF_TOKEN; }) ? true : false; if (hasAmpersand) { selector = selector.replace(SELF_TOKEN_REGEX, ''); } // the :enter and :leave selectors are filled in at runtime during timeline building selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR) .replace(/@\w+/g, function (match) { return NG_TRIGGER_SELECTOR + '-' + match.substr(1); }) .replace(/:animating/g, NG_ANIMATING_SELECTOR); return [selector, hasAmpersand]; } /** * @param {?} obj * @return {?} */ function normalizeParams(obj) { return obj ? copyObj(obj) : null; } var AnimationAstBuilderContext = (function () { function AnimationAstBuilderContext(errors) { this.errors = errors; this.queryCount = 0; this.depCount = 0; this.currentTransition = null; this.currentQuery = null; this.currentQuerySelector = null; this.currentAnimateTimings = null; this.currentTime = 0; this.collectedStyles = {}; this.options = null; } return AnimationAstBuilderContext; }()); /** * @param {?} styles * @return {?} */ function consumeOffset(styles) { if (typeof styles == 'string') return null; var /** @type {?} */ offset = null; if (Array.isArray(styles)) { styles.forEach(function (styleTuple) { if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { var /** @type {?} */ obj = /** @type {?} */ (styleTuple); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } }); } else if (isObject(styles) && styles.hasOwnProperty('offset')) { var /** @type {?} */ obj = /** @type {?} */ (styles); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } return offset; } /** * @param {?} value * @return {?} */ function isObject(value) { return !Array.isArray(value) && typeof value == 'object'; } /** * @param {?} value * @param {?} errors * @return {?} */ function constructTimingAst(value, errors) { var /** @type {?} */ timings = null; if (value.hasOwnProperty('duration')) { timings = /** @type {?} */ (value); } else if (typeof value == 'number') { var /** @type {?} */ duration = resolveTiming(/** @type {?} */ (value), errors).duration; return makeTimingAst(/** @type {?} */ (duration), 0, ''); } var /** @type {?} */ strValue = /** @type {?} */ (value); var /** @type {?} */ isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; }); if (isDynamic) { var /** @type {?} */ ast = /** @type {?} */ (makeTimingAst(0, 0, '')); ast.dynamic = true; ast.strValue = strValue; return /** @type {?} */ (ast); } timings = timings || resolveTiming(strValue, errors); return makeTimingAst(timings.duration, timings.delay, timings.easing); } /** * @param {?} options * @return {?} */ function normalizeAnimationOptions(options) { if (options) { options = copyObj(options); if (options['params']) { options['params'] = /** @type {?} */ ((normalizeParams(options['params']))); } } else { options = {}; } return options; } /** * @param {?} duration * @param {?} delay * @param {?} easing * @return {?} */ function makeTimingAst(duration, delay, easing) { return { duration: duration, delay: delay, easing: easing }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @param {?} element * @param {?} keyframes * @param {?} preStyleProps * @param {?} postStyleProps * @param {?} duration * @param {?} delay * @param {?=} easing * @param {?=} subTimeline * @return {?} */ function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing, subTimeline) { if (easing === void 0) { easing = null; } if (subTimeline === void 0) { subTimeline = false; } return { type: 1 /* TimelineAnimation */, element: element, keyframes: keyframes, preStyleProps: preStyleProps, postStyleProps: postStyleProps, duration: duration, delay: delay, totalTime: duration + delay, easing: easing, subTimeline: subTimeline }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var ElementInstructionMap = (function () { function ElementInstructionMap() { this._map = new Map(); } /** * @param {?} element * @return {?} */ ElementInstructionMap.prototype.consume = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ instructions = this._map.get(element); if (instructions) { this._map.delete(element); } else { instructions = []; } return instructions; }; /** * @param {?} element * @param {?} instructions * @return {?} */ ElementInstructionMap.prototype.append = /** * @param {?} element * @param {?} instructions * @return {?} */ function (element, instructions) { var /** @type {?} */ existingInstructions = this._map.get(element); if (!existingInstructions) { this._map.set(element, existingInstructions = []); } existingInstructions.push.apply(existingInstructions, instructions); }; /** * @param {?} element * @return {?} */ ElementInstructionMap.prototype.has = /** * @param {?} element * @return {?} */ function (element) { return this._map.has(element); }; /** * @return {?} */ ElementInstructionMap.prototype.clear = /** * @return {?} */ function () { this._map.clear(); }; return ElementInstructionMap; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ONE_FRAME_IN_MILLISECONDS = 1; var ENTER_TOKEN = ':enter'; var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); var LEAVE_TOKEN = ':leave'; var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?=} startingStyles * @param {?=} finalStyles * @param {?=} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { if (startingStyles === void 0) { startingStyles = {}; } if (finalStyles === void 0) { finalStyles = {}; } if (errors === void 0) { errors = []; } return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors); } var AnimationTimelineBuilderVisitor = (function () { function AnimationTimelineBuilderVisitor() { } /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?} startingStyles * @param {?} finalStyles * @param {?} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ AnimationTimelineBuilderVisitor.prototype.buildKeyframes = /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?} startingStyles * @param {?} finalStyles * @param {?} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ function (driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { if (errors === void 0) { errors = []; } subInstructions = subInstructions || new ElementInstructionMap(); var /** @type {?} */ context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []); context.options = options; context.currentTimeline.setStyles([startingStyles], null, context.errors, options); visitDslNode(this, ast, context); // this checks to see if an actual animation happened var /** @type {?} */ timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); }); if (timelines.length && Object.keys(finalStyles).length) { var /** @type {?} */ tl = timelines[timelines.length - 1]; if (!tl.allowOnlyTimelineStyles()) { tl.setStyles([finalStyles], null, context.errors, options); } } return timelines.length ? timelines.map(function (timeline) { return timeline.buildKeyframes(); }) : [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)]; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitTrigger = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { // these values are not visited in this AST }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitState = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { // these values are not visited in this AST }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitTransition = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { // these values are not visited in this AST }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ elementInstructions = context.subInstructions.consume(context.element); if (elementInstructions) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ endTime = this._visitSubInstructions(elementInstructions, innerContext, /** @type {?} */ (innerContext.options)); if (startTime != endTime) { // we do this on the upper context because we created a sub context for // the sub child animations context.transformIntoNewTimeline(endTime); } } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); innerContext.transformIntoNewTimeline(); this.visitReference(ast.animation, innerContext); context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); context.previousNode = ast; }; /** * @param {?} instructions * @param {?} context * @param {?} options * @return {?} */ AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = /** * @param {?} instructions * @param {?} context * @param {?} options * @return {?} */ function (instructions, context, options) { var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ furthestTime = startTime; // this is a special-case for when a user wants to skip a sub // animation from being fired entirely. var /** @type {?} */ duration = options.duration != null ? resolveTimingValue(options.duration) : null; var /** @type {?} */ delay = options.delay != null ? resolveTimingValue(options.delay) : null; if (duration !== 0) { instructions.forEach(function (instruction) { var /** @type {?} */ instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); }); } return furthestTime; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitReference = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { context.updateOptions(ast.options, true); visitDslNode(this, ast.animation, context); context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitSequence = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; var /** @type {?} */ subContextCount = context.subContextCount; var /** @type {?} */ ctx = context; var /** @type {?} */ options = ast.options; if (options && (options.params || options.delay)) { ctx = context.createSubContext(options); ctx.transformIntoNewTimeline(); if (options.delay != null) { if (ctx.previousNode.type == 6 /* Style */) { ctx.currentTimeline.snapshotCurrentStyles(); ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } var /** @type {?} */ delay = resolveTimingValue(options.delay); ctx.delayNextStep(delay); } } if (ast.steps.length) { ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); }); // this is here just incase the inner steps only contain or end with a style() call ctx.currentTimeline.applyStylesToKeyframe(); // this means that some animation function within the sequence // ended up creating a sub timeline (which means the current // timeline cannot overlap with the contents of the sequence) if (ctx.subContextCount > subContextCount) { ctx.transformIntoNewTimeline(); } } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitGroup = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; var /** @type {?} */ innerTimelines = []; var /** @type {?} */ furthestTime = context.currentTimeline.currentTime; var /** @type {?} */ delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; ast.steps.forEach(function (s) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); if (delay) { innerContext.delayNextStep(delay); } visitDslNode(_this, s, innerContext); furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); innerTimelines.push(innerContext.currentTimeline); }); // this operation is run after the AST loop because otherwise // if the parent timeline's collected styles were updated then // it would pass in invalid data into the new-to-be forked items innerTimelines.forEach(function (timeline) { return context.currentTimeline.mergeTimelineCollectedStyles(timeline); }); context.transformIntoNewTimeline(furthestTime); context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype._visitTiming = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { if ((/** @type {?} */ (ast)).dynamic) { var /** @type {?} */ strValue = (/** @type {?} */ (ast)).strValue; var /** @type {?} */ timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; return resolveTiming(timingValue, context.errors); } else { return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; } }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitAnimate = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); var /** @type {?} */ timeline = context.currentTimeline; if (timings.delay) { context.incrementTime(timings.delay); timeline.snapshotCurrentStyles(); } var /** @type {?} */ style$$1 = ast.style; if (style$$1.type == 5 /* Keyframes */) { this.visitKeyframes(style$$1, context); } else { context.incrementTime(timings.duration); this.visitStyle(/** @type {?} */ (style$$1), context); timeline.applyStylesToKeyframe(); } context.currentAnimateTimings = null; context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitStyle = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ timeline = context.currentTimeline; var /** @type {?} */ timings = /** @type {?} */ ((context.currentAnimateTimings)); // this is a special case for when a style() call // directly follows an animate() call (but not inside of an animate() call) if (!timings && timeline.getCurrentStyleProperties().length) { timeline.forwardFrame(); } var /** @type {?} */ easing = (timings && timings.easing) || ast.easing; if (ast.isEmptyStep) { timeline.applyEmptyStep(easing); } else { timeline.setStyles(ast.styles, easing, context.errors, context.options); } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitKeyframes = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); var /** @type {?} */ startTime = (/** @type {?} */ ((context.currentTimeline))).duration; var /** @type {?} */ duration = currentAnimateTimings.duration; var /** @type {?} */ innerContext = context.createSubContext(); var /** @type {?} */ innerTimeline = innerContext.currentTimeline; innerTimeline.easing = currentAnimateTimings.easing; ast.styles.forEach(function (step) { var /** @type {?} */ offset = step.offset || 0; innerTimeline.forwardTime(offset * duration); innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); innerTimeline.applyStylesToKeyframe(); }); // this will ensure that the parent timeline gets all the styles from // the child even if the new timeline below is not used context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); // we do this because the window between this timeline and the sub timeline // should ensure that the styles within are exactly the same as they were before context.transformIntoNewTimeline(startTime + duration); context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitQuery = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; // in the event that the first step before this is a style step we need // to ensure the styles are applied before the children are animated var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ options = /** @type {?} */ ((ast.options || {})); var /** @type {?} */ delay = options.delay ? resolveTimingValue(options.delay) : 0; if (delay && (context.previousNode.type === 6 /* Style */ || (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { context.currentTimeline.snapshotCurrentStyles(); context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } var /** @type {?} */ furthestTime = startTime; var /** @type {?} */ elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); context.currentQueryTotal = elms.length; var /** @type {?} */ sameElementTimeline = null; elms.forEach(function (element, i) { context.currentQueryIndex = i; var /** @type {?} */ innerContext = context.createSubContext(ast.options, element); if (delay) { innerContext.delayNextStep(delay); } if (element === context.element) { sameElementTimeline = innerContext.currentTimeline; } visitDslNode(_this, ast.animation, innerContext); // this is here just incase the inner steps only contain or end // with a style() call (which is here to signal that this is a preparatory // call to style an element before it is animated again) innerContext.currentTimeline.applyStylesToKeyframe(); var /** @type {?} */ endTime = innerContext.currentTimeline.currentTime; furthestTime = Math.max(furthestTime, endTime); }); context.currentQueryIndex = 0; context.currentQueryTotal = 0; context.transformIntoNewTimeline(furthestTime); if (sameElementTimeline) { context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); context.currentTimeline.snapshotCurrentStyles(); } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitStagger = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ parentContext = /** @type {?} */ ((context.parentContext)); var /** @type {?} */ tl = context.currentTimeline; var /** @type {?} */ timings = ast.timings; var /** @type {?} */ duration = Math.abs(timings.duration); var /** @type {?} */ maxTime = duration * (context.currentQueryTotal - 1); var /** @type {?} */ delay = duration * context.currentQueryIndex; var /** @type {?} */ staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing; switch (staggerTransformer) { case 'reverse': delay = maxTime - delay; break; case 'full': delay = parentContext.currentStaggerTime; break; } var /** @type {?} */ timeline = context.currentTimeline; if (delay) { timeline.delayNextStep(delay); } var /** @type {?} */ startingTime = timeline.currentTime; visitDslNode(this, ast.animation, context); context.previousNode = ast; // time = duration + delay // the reason why this computation is so complex is because // the inner timeline may either have a delay value or a stretched // keyframe depending on if a subtimeline is not used or is used. parentContext.currentStaggerTime = (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime); }; return AnimationTimelineBuilderVisitor; }()); var DEFAULT_NOOP_PREVIOUS_NODE = /** @type {?} */ ({}); var AnimationTimelineContext = (function () { function AnimationTimelineContext(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) { this._driver = _driver; this.element = element; this.subInstructions = subInstructions; this._enterClassName = _enterClassName; this._leaveClassName = _leaveClassName; this.errors = errors; this.timelines = timelines; this.parentContext = null; this.currentAnimateTimings = null; this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.subContextCount = 0; this.options = {}; this.currentQueryIndex = 0; this.currentQueryTotal = 0; this.currentStaggerTime = 0; this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0); timelines.push(this.currentTimeline); } Object.defineProperty(AnimationTimelineContext.prototype, "params", { get: /** * @return {?} */ function () { return this.options.params; }, enumerable: true, configurable: true }); /** * @param {?} options * @param {?=} skipIfExists * @return {?} */ AnimationTimelineContext.prototype.updateOptions = /** * @param {?} options * @param {?=} skipIfExists * @return {?} */ function (options, skipIfExists) { var _this = this; if (!options) return; var /** @type {?} */ newOptions = /** @type {?} */ (options); var /** @type {?} */ optionsToUpdate = this.options; // NOTE: this will get patched up when other animation methods support duration overrides if (newOptions.duration != null) { (/** @type {?} */ (optionsToUpdate)).duration = resolveTimingValue(newOptions.duration); } if (newOptions.delay != null) { optionsToUpdate.delay = resolveTimingValue(newOptions.delay); } var /** @type {?} */ newParams = newOptions.params; if (newParams) { var /** @type {?} */ paramsToUpdate_1 = /** @type {?} */ ((optionsToUpdate.params)); if (!paramsToUpdate_1) { paramsToUpdate_1 = this.options.params = {}; } Object.keys(newParams).forEach(function (name) { if (!skipIfExists || !paramsToUpdate_1.hasOwnProperty(name)) { paramsToUpdate_1[name] = interpolateParams(newParams[name], paramsToUpdate_1, _this.errors); } }); } }; /** * @return {?} */ AnimationTimelineContext.prototype._copyOptions = /** * @return {?} */ function () { var /** @type {?} */ options = {}; if (this.options) { var /** @type {?} */ oldParams_1 = this.options.params; if (oldParams_1) { var /** @type {?} */ params_1 = options['params'] = {}; Object.keys(oldParams_1).forEach(function (name) { params_1[name] = oldParams_1[name]; }); } } return options; }; /** * @param {?=} options * @param {?=} element * @param {?=} newTime * @return {?} */ AnimationTimelineContext.prototype.createSubContext = /** * @param {?=} options * @param {?=} element * @param {?=} newTime * @return {?} */ function (options, element, newTime) { if (options === void 0) { options = null; } var /** @type {?} */ target = element || this.element; var /** @type {?} */ context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); context.previousNode = this.previousNode; context.currentAnimateTimings = this.currentAnimateTimings; context.options = this._copyOptions(); context.updateOptions(options); context.currentQueryIndex = this.currentQueryIndex; context.currentQueryTotal = this.currentQueryTotal; context.parentContext = this; this.subContextCount++; return context; }; /** * @param {?=} newTime * @return {?} */ AnimationTimelineContext.prototype.transformIntoNewTimeline = /** * @param {?=} newTime * @return {?} */ function (newTime) { this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.currentTimeline = this.currentTimeline.fork(this.element, newTime); this.timelines.push(this.currentTimeline); return this.currentTimeline; }; /** * @param {?} instruction * @param {?} duration * @param {?} delay * @return {?} */ AnimationTimelineContext.prototype.appendInstructionToTimeline = /** * @param {?} instruction * @param {?} duration * @param {?} delay * @return {?} */ function (instruction, duration, delay) { var /** @type {?} */ updatedTimings = { duration: duration != null ? duration : instruction.duration, delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, easing: '' }; var /** @type {?} */ builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); this.timelines.push(builder); return updatedTimings; }; /** * @param {?} time * @return {?} */ AnimationTimelineContext.prototype.incrementTime = /** * @param {?} time * @return {?} */ function (time) { this.currentTimeline.forwardTime(this.currentTimeline.duration + time); }; /** * @param {?} delay * @return {?} */ AnimationTimelineContext.prototype.delayNextStep = /** * @param {?} delay * @return {?} */ function (delay) { // negative delays are not yet supported if (delay > 0) { this.currentTimeline.delayNextStep(delay); } }; /** * @param {?} selector * @param {?} originalSelector * @param {?} limit * @param {?} includeSelf * @param {?} optional * @param {?} errors * @return {?} */ AnimationTimelineContext.prototype.invokeQuery = /** * @param {?} selector * @param {?} originalSelector * @param {?} limit * @param {?} includeSelf * @param {?} optional * @param {?} errors * @return {?} */ function (selector, originalSelector, limit, includeSelf, optional, errors) { var /** @type {?} */ results = []; if (includeSelf) { results.push(this.element); } if (selector.length > 0) { // if :self is only used then the selector is empty selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName); selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName); var /** @type {?} */ multi = limit != 1; var /** @type {?} */ elements = this._driver.query(this.element, selector, multi); if (limit !== 0) { elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : elements.slice(0, limit); } results.push.apply(results, elements); } if (!optional && results.length == 0) { errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)"); } return results; }; return AnimationTimelineContext; }()); var TimelineBuilder = (function () { function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) { this._driver = _driver; this.element = element; this.startTime = startTime; this._elementTimelineStylesLookup = _elementTimelineStylesLookup; this.duration = 0; this._previousKeyframe = {}; this._currentKeyframe = {}; this._keyframes = new Map(); this._styleSummary = {}; this._pendingStyles = {}; this._backFill = {}; this._currentEmptyStepKeyframe = null; if (!this._elementTimelineStylesLookup) { this._elementTimelineStylesLookup = new Map(); } this._localTimelineStyles = Object.create(this._backFill, {}); this._globalTimelineStyles = /** @type {?} */ ((this._elementTimelineStylesLookup.get(element))); if (!this._globalTimelineStyles) { this._globalTimelineStyles = this._localTimelineStyles; this._elementTimelineStylesLookup.set(element, this._localTimelineStyles); } this._loadKeyframe(); } /** * @return {?} */ TimelineBuilder.prototype.containsAnimation = /** * @return {?} */ function () { switch (this._keyframes.size) { case 0: return false; case 1: return this.getCurrentStyleProperties().length > 0; default: return true; } }; /** * @return {?} */ TimelineBuilder.prototype.getCurrentStyleProperties = /** * @return {?} */ function () { return Object.keys(this._currentKeyframe); }; Object.defineProperty(TimelineBuilder.prototype, "currentTime", { get: /** * @return {?} */ function () { return this.startTime + this.duration; }, enumerable: true, configurable: true }); /** * @param {?} delay * @return {?} */ TimelineBuilder.prototype.delayNextStep = /** * @param {?} delay * @return {?} */ function (delay) { // in the event that a style() step is placed right before a stagger() // and that style() step is the very first style() value in the animation // then we need to make a copy of the keyframe [0, copy, 1] so that the delay // properly applies the style() values to work with the stagger... var /** @type {?} */ hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length; if (this.duration || hasPreStyleStep) { this.forwardTime(this.currentTime + delay); if (hasPreStyleStep) { this.snapshotCurrentStyles(); } } else { this.startTime += delay; } }; /** * @param {?} element * @param {?=} currentTime * @return {?} */ TimelineBuilder.prototype.fork = /** * @param {?} element * @param {?=} currentTime * @return {?} */ function (element, currentTime) { this.applyStylesToKeyframe(); return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); }; /** * @return {?} */ TimelineBuilder.prototype._loadKeyframe = /** * @return {?} */ function () { if (this._currentKeyframe) { this._previousKeyframe = this._currentKeyframe; } this._currentKeyframe = /** @type {?} */ ((this._keyframes.get(this.duration))); if (!this._currentKeyframe) { this._currentKeyframe = Object.create(this._backFill, {}); this._keyframes.set(this.duration, this._currentKeyframe); } }; /** * @return {?} */ TimelineBuilder.prototype.forwardFrame = /** * @return {?} */ function () { this.duration += ONE_FRAME_IN_MILLISECONDS; this._loadKeyframe(); }; /** * @param {?} time * @return {?} */ TimelineBuilder.prototype.forwardTime = /** * @param {?} time * @return {?} */ function (time) { this.applyStylesToKeyframe(); this.duration = time; this._loadKeyframe(); }; /** * @param {?} prop * @param {?} value * @return {?} */ TimelineBuilder.prototype._updateStyle = /** * @param {?} prop * @param {?} value * @return {?} */ function (prop, value) { this._localTimelineStyles[prop] = value; this._globalTimelineStyles[prop] = value; this._styleSummary[prop] = { time: this.currentTime, value: value }; }; /** * @return {?} */ TimelineBuilder.prototype.allowOnlyTimelineStyles = /** * @return {?} */ function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; /** * @param {?} easing * @return {?} */ TimelineBuilder.prototype.applyEmptyStep = /** * @param {?} easing * @return {?} */ function (easing) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; } // special case for animate(duration): // all missing styles are filled with a `*` value then // if any destination styles are filled in later on the same // keyframe then they will override the overridden styles // We use `_globalTimelineStyles` here because there may be // styles in previous keyframes that are not present in this timeline Object.keys(this._globalTimelineStyles).forEach(function (prop) { _this._backFill[prop] = _this._globalTimelineStyles[prop] || __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]; _this._currentKeyframe[prop] = __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]; }); this._currentEmptyStepKeyframe = this._currentKeyframe; }; /** * @param {?} input * @param {?} easing * @param {?} errors * @param {?=} options * @return {?} */ TimelineBuilder.prototype.setStyles = /** * @param {?} input * @param {?} easing * @param {?} errors * @param {?=} options * @return {?} */ function (input, easing, errors, options) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; } var /** @type {?} */ params = (options && options.params) || {}; var /** @type {?} */ styles = flattenStyles(input, this._globalTimelineStyles); Object.keys(styles).forEach(function (prop) { var /** @type {?} */ val = interpolateParams(styles[prop], params, errors); _this._pendingStyles[prop] = val; if (!_this._localTimelineStyles.hasOwnProperty(prop)) { _this._backFill[prop] = _this._globalTimelineStyles.hasOwnProperty(prop) ? _this._globalTimelineStyles[prop] : __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]; } _this._updateStyle(prop, val); }); }; /** * @return {?} */ TimelineBuilder.prototype.applyStylesToKeyframe = /** * @return {?} */ function () { var _this = this; var /** @type {?} */ styles = this._pendingStyles; var /** @type {?} */ props = Object.keys(styles); if (props.length == 0) return; this._pendingStyles = {}; props.forEach(function (prop) { var /** @type {?} */ val = styles[prop]; _this._currentKeyframe[prop] = val; }); Object.keys(this._localTimelineStyles).forEach(function (prop) { if (!_this._currentKeyframe.hasOwnProperty(prop)) { _this._currentKeyframe[prop] = _this._localTimelineStyles[prop]; } }); }; /** * @return {?} */ TimelineBuilder.prototype.snapshotCurrentStyles = /** * @return {?} */ function () { var _this = this; Object.keys(this._localTimelineStyles).forEach(function (prop) { var /** @type {?} */ val = _this._localTimelineStyles[prop]; _this._pendingStyles[prop] = val; _this._updateStyle(prop, val); }); }; /** * @return {?} */ TimelineBuilder.prototype.getFinalKeyframe = /** * @return {?} */ function () { return this._keyframes.get(this.duration); }; Object.defineProperty(TimelineBuilder.prototype, "properties", { get: /** * @return {?} */ function () { var /** @type {?} */ properties = []; for (var /** @type {?} */ prop in this._currentKeyframe) { properties.push(prop); } return properties; }, enumerable: true, configurable: true }); /** * @param {?} timeline * @return {?} */ TimelineBuilder.prototype.mergeTimelineCollectedStyles = /** * @param {?} timeline * @return {?} */ function (timeline) { var _this = this; Object.keys(timeline._styleSummary).forEach(function (prop) { var /** @type {?} */ details0 = _this._styleSummary[prop]; var /** @type {?} */ details1 = timeline._styleSummary[prop]; if (!details0 || details1.time > details0.time) { _this._updateStyle(prop, details1.value); } }); }; /** * @return {?} */ TimelineBuilder.prototype.buildKeyframes = /** * @return {?} */ function () { var _this = this; this.applyStylesToKeyframe(); var /** @type {?} */ preStyleProps = new Set(); var /** @type {?} */ postStyleProps = new Set(); var /** @type {?} */ isEmpty = this._keyframes.size === 1 && this.duration === 0; var /** @type {?} */ finalKeyframes = []; this._keyframes.forEach(function (keyframe, time) { var /** @type {?} */ finalKeyframe = copyStyles(keyframe, true); Object.keys(finalKeyframe).forEach(function (prop) { var /** @type {?} */ value = finalKeyframe[prop]; if (value == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["m" /* ɵPRE_STYLE */]) { preStyleProps.add(prop); } else if (value == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]) { postStyleProps.add(prop); } }); if (!isEmpty) { finalKeyframe['offset'] = time / _this.duration; } finalKeyframes.push(finalKeyframe); }); var /** @type {?} */ preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : []; var /** @type {?} */ postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; // special case for a 0-second animation (which is designed just to place styles onscreen) if (isEmpty) { var /** @type {?} */ kf0 = finalKeyframes[0]; var /** @type {?} */ kf1 = copyObj(kf0); kf0['offset'] = 0; kf1['offset'] = 1; finalKeyframes = [kf0, kf1]; } return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false); }; return TimelineBuilder; }()); var SubTimelineBuilder = (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(SubTimelineBuilder, _super); function SubTimelineBuilder(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { if (_stretchStartingKeyframe === void 0) { _stretchStartingKeyframe = false; } var _this = _super.call(this, driver, element, timings.delay) || this; _this.element = element; _this.keyframes = keyframes; _this.preStyleProps = preStyleProps; _this.postStyleProps = postStyleProps; _this._stretchStartingKeyframe = _stretchStartingKeyframe; _this.timings = { duration: timings.duration, delay: timings.delay, easing: timings.easing }; return _this; } /** * @return {?} */ SubTimelineBuilder.prototype.containsAnimation = /** * @return {?} */ function () { return this.keyframes.length > 1; }; /** * @return {?} */ SubTimelineBuilder.prototype.buildKeyframes = /** * @return {?} */ function () { var /** @type {?} */ keyframes = this.keyframes; var _a = this.timings, delay = _a.delay, duration = _a.duration, easing = _a.easing; if (this._stretchStartingKeyframe && delay) { var /** @type {?} */ newKeyframes = []; var /** @type {?} */ totalTime = duration + delay; var /** @type {?} */ startingGap = delay / totalTime; // the original starting keyframe now starts once the delay is done var /** @type {?} */ newFirstKeyframe = copyStyles(keyframes[0], false); newFirstKeyframe['offset'] = 0; newKeyframes.push(newFirstKeyframe); var /** @type {?} */ oldFirstKeyframe = copyStyles(keyframes[0], false); oldFirstKeyframe['offset'] = roundOffset(startingGap); newKeyframes.push(oldFirstKeyframe); /* When the keyframe is stretched then it means that the delay before the animation starts is gone. Instead the first keyframe is placed at the start of the animation and it is then copied to where it starts when the original delay is over. This basically means nothing animates during that delay, but the styles are still renderered. For this to work the original offset values that exist in the original keyframes must be "warped" so that they can take the new keyframe + delay into account. delay=1000, duration=1000, keyframes = 0 .5 1 turns into delay=0, duration=2000, keyframes = 0 .33 .66 1 */ // offsets between 1 ... n -1 are all warped by the keyframe stretch var /** @type {?} */ limit = keyframes.length - 1; for (var /** @type {?} */ i = 1; i <= limit; i++) { var /** @type {?} */ kf = copyStyles(keyframes[i], false); var /** @type {?} */ oldOffset = /** @type {?} */ (kf['offset']); var /** @type {?} */ timeAtKeyframe = delay + oldOffset * duration; kf['offset'] = roundOffset(timeAtKeyframe / totalTime); newKeyframes.push(kf); } // the new starting keyframe should be added at the start duration = totalTime; delay = 0; easing = ''; keyframes = newKeyframes; } return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); }; return SubTimelineBuilder; }(TimelineBuilder)); /** * @param {?} offset * @param {?=} decimalPoints * @return {?} */ function roundOffset(offset, decimalPoints) { if (decimalPoints === void 0) { decimalPoints = 3; } var /** @type {?} */ mult = Math.pow(10, decimalPoints - 1); return Math.round(offset * mult) / mult; } /** * @param {?} input * @param {?} allStyles * @return {?} */ function flattenStyles(input, allStyles) { var /** @type {?} */ styles = {}; var /** @type {?} */ allProperties; input.forEach(function (token) { if (token === '*') { allProperties = allProperties || Object.keys(allStyles); allProperties.forEach(function (prop) { styles[prop] = __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]; }); } else { copyStyles(/** @type {?} */ (token), false, styles); } }); return styles; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var Animation = (function () { function Animation(_driver, input) { this._driver = _driver; var /** @type {?} */ errors = []; var /** @type {?} */ ast = buildAnimationAst(_driver, input, errors); if (errors.length) { var /** @type {?} */ errorMessage = "animation validation failed:\n" + errors.join("\n"); throw new Error(errorMessage); } this._animationAst = ast; } /** * @param {?} element * @param {?} startingStyles * @param {?} destinationStyles * @param {?} options * @param {?=} subInstructions * @return {?} */ Animation.prototype.buildTimelines = /** * @param {?} element * @param {?} startingStyles * @param {?} destinationStyles * @param {?} options * @param {?=} subInstructions * @return {?} */ function (element, startingStyles, destinationStyles, options, subInstructions) { var /** @type {?} */ start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : /** @type {?} */ (startingStyles); var /** @type {?} */ dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : /** @type {?} */ (destinationStyles); var /** @type {?} */ errors = []; subInstructions = subInstructions || new ElementInstructionMap(); var /** @type {?} */ result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors); if (errors.length) { var /** @type {?} */ errorMessage = "animation building failed:\n" + errors.join("\n"); throw new Error(errorMessage); } return result; }; return Animation; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental Animation support is experimental. * @abstract */ var AnimationStyleNormalizer = (function () { function AnimationStyleNormalizer() { } return AnimationStyleNormalizer; }()); /** * \@experimental Animation support is experimental. */ var NoopAnimationStyleNormalizer = (function () { function NoopAnimationStyleNormalizer() { } /** * @param {?} propertyName * @param {?} errors * @return {?} */ NoopAnimationStyleNormalizer.prototype.normalizePropertyName = /** * @param {?} propertyName * @param {?} errors * @return {?} */ function (propertyName, errors) { return propertyName; }; /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ function (userProvidedProperty, normalizedProperty, value, errors) { return /** @type {?} */ (value); }; return NoopAnimationStyleNormalizer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var WebAnimationsStyleNormalizer = (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(WebAnimationsStyleNormalizer, _super); function WebAnimationsStyleNormalizer() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} propertyName * @param {?} errors * @return {?} */ WebAnimationsStyleNormalizer.prototype.normalizePropertyName = /** * @param {?} propertyName * @param {?} errors * @return {?} */ function (propertyName, errors) { return dashCaseToCamelCase(propertyName); }; /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ function (userProvidedProperty, normalizedProperty, value, errors) { var /** @type {?} */ unit = ''; var /** @type {?} */ strVal = value.toString().trim(); if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { if (typeof value === 'number') { unit = 'px'; } else { var /** @type {?} */ valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { errors.push("Please provide a CSS unit value for " + userProvidedProperty + ":" + value); } } } return strVal + unit; }; return WebAnimationsStyleNormalizer; }(AnimationStyleNormalizer)); var DIMENSIONAL_PROP_MAP = makeBooleanMap('width,height,minWidth,minHeight,maxWidth,maxHeight,left,top,bottom,right,fontSize,outlineWidth,outlineOffset,paddingTop,paddingLeft,paddingBottom,paddingRight,marginTop,marginLeft,marginBottom,marginRight,borderRadius,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,textIndent,perspective' .split(',')); /** * @param {?} keys * @return {?} */ function makeBooleanMap(keys) { var /** @type {?} */ map = {}; keys.forEach(function (key) { return map[key] = true; }); return map; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @param {?} element * @param {?} triggerName * @param {?} fromState * @param {?} toState * @param {?} isRemovalTransition * @param {?} fromStyles * @param {?} toStyles * @param {?} timelines * @param {?} queriedElements * @param {?} preStyleProps * @param {?} postStyleProps * @param {?=} errors * @return {?} */ function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, errors) { return { type: 0 /* TransitionAnimation */, element: element, triggerName: triggerName, isRemovalTransition: isRemovalTransition, fromState: fromState, fromStyles: fromStyles, toState: toState, toStyles: toStyles, timelines: timelines, queriedElements: queriedElements, preStyleProps: preStyleProps, postStyleProps: postStyleProps, errors: errors }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var EMPTY_OBJECT = {}; var AnimationTransitionFactory = (function () { function AnimationTransitionFactory(_triggerName, ast, _stateStyles) { this._triggerName = _triggerName; this.ast = ast; this._stateStyles = _stateStyles; } /** * @param {?} currentState * @param {?} nextState * @return {?} */ AnimationTransitionFactory.prototype.match = /** * @param {?} currentState * @param {?} nextState * @return {?} */ function (currentState, nextState) { return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState); }; /** * @param {?} stateName * @param {?} params * @param {?} errors * @return {?} */ AnimationTransitionFactory.prototype.buildStyles = /** * @param {?} stateName * @param {?} params * @param {?} errors * @return {?} */ function (stateName, params, errors) { var /** @type {?} */ backupStateStyler = this._stateStyles['*']; var /** @type {?} */ stateStyler = this._stateStyles[stateName]; var /** @type {?} */ backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {}; return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles; }; /** * @param {?} driver * @param {?} element * @param {?} currentState * @param {?} nextState * @param {?} enterClassName * @param {?} leaveClassName * @param {?=} currentOptions * @param {?=} nextOptions * @param {?=} subInstructions * @return {?} */ AnimationTransitionFactory.prototype.build = /** * @param {?} driver * @param {?} element * @param {?} currentState * @param {?} nextState * @param {?} enterClassName * @param {?} leaveClassName * @param {?=} currentOptions * @param {?=} nextOptions * @param {?=} subInstructions * @return {?} */ function (driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions) { var /** @type {?} */ errors = []; var /** @type {?} */ transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; var /** @type {?} */ currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; var /** @type {?} */ currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); var /** @type {?} */ nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; var /** @type {?} */ nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); var /** @type {?} */ queriedElements = new Set(); var /** @type {?} */ preStyleMap = new Map(); var /** @type {?} */ postStyleMap = new Map(); var /** @type {?} */ isRemoval = nextState === 'void'; var /** @type {?} */ animationOptions = { params: Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, transitionAnimationParams, nextAnimationParams) }; var /** @type {?} */ timelines = buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); if (errors.length) { return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, errors); } timelines.forEach(function (tl) { var /** @type {?} */ elm = tl.element; var /** @type {?} */ preProps = getOrSetAsInMap(preStyleMap, elm, {}); tl.preStyleProps.forEach(function (prop) { return preProps[prop] = true; }); var /** @type {?} */ postProps = getOrSetAsInMap(postStyleMap, elm, {}); tl.postStyleProps.forEach(function (prop) { return postProps[prop] = true; }); if (elm !== element) { queriedElements.add(elm); } }); var /** @type {?} */ queriedElementsList = iteratorToArray(queriedElements.values()); return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap); }; return AnimationTransitionFactory; }()); /** * @param {?} matchFns * @param {?} currentState * @param {?} nextState * @return {?} */ function oneOrMoreTransitionsMatch(matchFns, currentState, nextState) { return matchFns.some(function (fn) { return fn(currentState, nextState); }); } var AnimationStateStyles = (function () { function AnimationStateStyles(styles, defaultParams) { this.styles = styles; this.defaultParams = defaultParams; } /** * @param {?} params * @param {?} errors * @return {?} */ AnimationStateStyles.prototype.buildStyles = /** * @param {?} params * @param {?} errors * @return {?} */ function (params, errors) { var /** @type {?} */ finalStyles = {}; var /** @type {?} */ combinedParams = copyObj(this.defaultParams); Object.keys(params).forEach(function (key) { var /** @type {?} */ value = params[key]; if (value != null) { combinedParams[key] = value; } }); this.styles.styles.forEach(function (value) { if (typeof value !== 'string') { var /** @type {?} */ styleObj_1 = /** @type {?} */ (value); Object.keys(styleObj_1).forEach(function (prop) { var /** @type {?} */ val = styleObj_1[prop]; if (val.length > 1) { val = interpolateParams(val, combinedParams, errors); } finalStyles[prop] = val; }); } }); return finalStyles; }; return AnimationStateStyles; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental Animation support is experimental. * @param {?} name * @param {?} ast * @return {?} */ function buildTrigger(name, ast) { return new AnimationTrigger(name, ast); } /** * \@experimental Animation support is experimental. */ var AnimationTrigger = (function () { function AnimationTrigger(name, ast) { var _this = this; this.name = name; this.ast = ast; this.transitionFactories = []; this.states = {}; ast.states.forEach(function (ast) { var /** @type {?} */ defaultParams = (ast.options && ast.options.params) || {}; _this.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams); }); balanceProperties(this.states, 'true', '1'); balanceProperties(this.states, 'false', '0'); ast.transitions.forEach(function (ast) { _this.transitionFactories.push(new AnimationTransitionFactory(name, ast, _this.states)); }); this.fallbackTransition = createFallbackTransition(name, this.states); } Object.defineProperty(AnimationTrigger.prototype, "containsQueries", { get: /** * @return {?} */ function () { return this.ast.queryCount > 0; }, enumerable: true, configurable: true }); /** * @param {?} currentState * @param {?} nextState * @return {?} */ AnimationTrigger.prototype.matchTransition = /** * @param {?} currentState * @param {?} nextState * @return {?} */ function (currentState, nextState) { var /** @type {?} */ entry = this.transitionFactories.find(function (f) { return f.match(currentState, nextState); }); return entry || null; }; /** * @param {?} currentState * @param {?} params * @param {?} errors * @return {?} */ AnimationTrigger.prototype.matchStyles = /** * @param {?} currentState * @param {?} params * @param {?} errors * @return {?} */ function (currentState, params, errors) { return this.fallbackTransition.buildStyles(currentState, params, errors); }; return AnimationTrigger; }()); /** * @param {?} triggerName * @param {?} states * @return {?} */ function createFallbackTransition(triggerName, states) { var /** @type {?} */ matchers = [function (fromState, toState) { return true; }]; var /** @type {?} */ animation = { type: 2 /* Sequence */, steps: [], options: null }; var /** @type {?} */ transition = { type: 1 /* Transition */, animation: animation, matchers: matchers, options: null, queryCount: 0, depCount: 0 }; return new AnimationTransitionFactory(triggerName, transition, states); } /** * @param {?} obj * @param {?} key1 * @param {?} key2 * @return {?} */ function balanceProperties(obj, key1, key2) { if (obj.hasOwnProperty(key1)) { if (!obj.hasOwnProperty(key2)) { obj[key2] = obj[key1]; } } else if (obj.hasOwnProperty(key2)) { obj[key1] = obj[key2]; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var EMPTY_INSTRUCTION_MAP = new ElementInstructionMap(); var TimelineAnimationEngine = (function () { function TimelineAnimationEngine(_driver, _normalizer) { this._driver = _driver; this._normalizer = _normalizer; this._animations = {}; this._playersById = {}; this.players = []; } /** * @param {?} id * @param {?} metadata * @return {?} */ TimelineAnimationEngine.prototype.register = /** * @param {?} id * @param {?} metadata * @return {?} */ function (id, metadata) { var /** @type {?} */ errors = []; var /** @type {?} */ ast = buildAnimationAst(this._driver, metadata, errors); if (errors.length) { throw new Error("Unable to build the animation due to the following errors: " + errors.join("\n")); } else { this._animations[id] = ast; } }; /** * @param {?} i * @param {?} preStyles * @param {?=} postStyles * @return {?} */ TimelineAnimationEngine.prototype._buildPlayer = /** * @param {?} i * @param {?} preStyles * @param {?=} postStyles * @return {?} */ function (i, preStyles, postStyles) { var /** @type {?} */ element = i.element; var /** @type {?} */ keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles); return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, []); }; /** * @param {?} id * @param {?} element * @param {?=} options * @return {?} */ TimelineAnimationEngine.prototype.create = /** * @param {?} id * @param {?} element * @param {?=} options * @return {?} */ function (id, element, options) { var _this = this; if (options === void 0) { options = {}; } var /** @type {?} */ errors = []; var /** @type {?} */ ast = this._animations[id]; var /** @type {?} */ instructions; var /** @type {?} */ autoStylesMap = new Map(); if (ast) { instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, {}, {}, options, EMPTY_INSTRUCTION_MAP, errors); instructions.forEach(function (inst) { var /** @type {?} */ styles = getOrSetAsInMap(autoStylesMap, inst.element, {}); inst.postStyleProps.forEach(function (prop) { return styles[prop] = null; }); }); } else { errors.push('The requested animation doesn\'t exist or has already been destroyed'); instructions = []; } if (errors.length) { throw new Error("Unable to create the animation due to the following errors: " + errors.join("\n")); } autoStylesMap.forEach(function (styles, element) { Object.keys(styles).forEach(function (prop) { styles[prop] = _this._driver.computeStyle(element, prop, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]); }); }); var /** @type {?} */ players = instructions.map(function (i) { var /** @type {?} */ styles = autoStylesMap.get(i.element); return _this._buildPlayer(i, {}, styles); }); var /** @type {?} */ player = optimizeGroupPlayer(players); this._playersById[id] = player; player.onDestroy(function () { return _this.destroy(id); }); this.players.push(player); return player; }; /** * @param {?} id * @return {?} */ TimelineAnimationEngine.prototype.destroy = /** * @param {?} id * @return {?} */ function (id) { var /** @type {?} */ player = this._getPlayer(id); player.destroy(); delete this._playersById[id]; var /** @type {?} */ index = this.players.indexOf(player); if (index >= 0) { this.players.splice(index, 1); } }; /** * @param {?} id * @return {?} */ TimelineAnimationEngine.prototype._getPlayer = /** * @param {?} id * @return {?} */ function (id) { var /** @type {?} */ player = this._playersById[id]; if (!player) { throw new Error("Unable to find the timeline player referenced by " + id); } return player; }; /** * @param {?} id * @param {?} element * @param {?} eventName * @param {?} callback * @return {?} */ TimelineAnimationEngine.prototype.listen = /** * @param {?} id * @param {?} element * @param {?} eventName * @param {?} callback * @return {?} */ function (id, element, eventName, callback) { // triggerName, fromState, toState are all ignored for timeline animations var /** @type {?} */ baseEvent = makeAnimationEvent(element, '', '', ''); listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); return function () { }; }; /** * @param {?} id * @param {?} element * @param {?} command * @param {?} args * @return {?} */ TimelineAnimationEngine.prototype.command = /** * @param {?} id * @param {?} element * @param {?} command * @param {?} args * @return {?} */ function (id, element, command, args) { if (command == 'register') { this.register(id, /** @type {?} */ (args[0])); return; } if (command == 'create') { var /** @type {?} */ options = /** @type {?} */ ((args[0] || {})); this.create(id, element, options); return; } var /** @type {?} */ player = this._getPlayer(id); switch (command) { case 'play': player.play(); break; case 'pause': player.pause(); break; case 'reset': player.reset(); break; case 'restart': player.restart(); break; case 'finish': player.finish(); break; case 'init': player.init(); break; case 'setPosition': player.setPosition(parseFloat(/** @type {?} */ (args[0]))); break; case 'destroy': this.destroy(id); break; } }; return TimelineAnimationEngine; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var QUEUED_CLASSNAME = 'ng-animate-queued'; var QUEUED_SELECTOR = '.ng-animate-queued'; var DISABLED_CLASSNAME = 'ng-animate-disabled'; var DISABLED_SELECTOR = '.ng-animate-disabled'; var STAR_CLASSNAME = 'ng-star-inserted'; var STAR_SELECTOR = '.ng-star-inserted'; var EMPTY_PLAYER_ARRAY = []; var NULL_REMOVAL_STATE = { namespaceId: '', setForRemoval: null, hasAnimation: false, removedBeforeQueried: false }; var NULL_REMOVED_QUERIED_STATE = { namespaceId: '', setForRemoval: null, hasAnimation: false, removedBeforeQueried: true }; /** * @record */ var REMOVAL_FLAG = '__ng_removed'; /** * @record */ var StateValue = (function () { function StateValue(input, namespaceId) { if (namespaceId === void 0) { namespaceId = ''; } this.namespaceId = namespaceId; var /** @type {?} */ isObj = input && input.hasOwnProperty('value'); var /** @type {?} */ value = isObj ? input['value'] : input; this.value = normalizeTriggerValue(value); if (isObj) { var /** @type {?} */ options = copyObj(/** @type {?} */ (input)); delete options['value']; this.options = /** @type {?} */ (options); } else { this.options = {}; } if (!this.options.params) { this.options.params = {}; } } Object.defineProperty(StateValue.prototype, "params", { get: /** * @return {?} */ function () { return /** @type {?} */ (this.options.params); }, enumerable: true, configurable: true }); /** * @param {?} options * @return {?} */ StateValue.prototype.absorbOptions = /** * @param {?} options * @return {?} */ function (options) { var /** @type {?} */ newParams = options.params; if (newParams) { var /** @type {?} */ oldParams_1 = /** @type {?} */ ((this.options.params)); Object.keys(newParams).forEach(function (prop) { if (oldParams_1[prop] == null) { oldParams_1[prop] = newParams[prop]; } }); } }; return StateValue; }()); var VOID_VALUE = 'void'; var DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE); var DELETED_STATE_VALUE = new StateValue('DELETED'); var AnimationTransitionNamespace = (function () { function AnimationTransitionNamespace(id, hostElement, _engine) { this.id = id; this.hostElement = hostElement; this._engine = _engine; this.players = []; this._triggers = {}; this._queue = []; this._elementListeners = new Map(); this._hostClassName = 'ng-tns-' + id; addClass(hostElement, this._hostClassName); } /** * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ AnimationTransitionNamespace.prototype.listen = /** * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ function (element, name, phase, callback) { var _this = this; if (!this._triggers.hasOwnProperty(name)) { throw new Error("Unable to listen on the animation trigger event \"" + phase + "\" because the animation trigger \"" + name + "\" doesn't exist!"); } if (phase == null || phase.length == 0) { throw new Error("Unable to listen on the animation trigger \"" + name + "\" because the provided event is undefined!"); } if (!isTriggerEventValid(phase)) { throw new Error("The provided animation trigger event \"" + phase + "\" for the animation trigger \"" + name + "\" is not supported!"); } var /** @type {?} */ listeners = getOrSetAsInMap(this._elementListeners, element, []); var /** @type {?} */ data = { name: name, phase: phase, callback: callback }; listeners.push(data); var /** @type {?} */ triggersWithStates = getOrSetAsInMap(this._engine.statesByElement, element, {}); if (!triggersWithStates.hasOwnProperty(name)) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + name); triggersWithStates[name] = DEFAULT_STATE_VALUE; } return function () { // the event listener is removed AFTER the flush has occurred such // that leave animations callbacks can fire (otherwise if the node // is removed in between then the listeners would be deregistered) // the event listener is removed AFTER the flush has occurred such // that leave animations callbacks can fire (otherwise if the node // is removed in between then the listeners would be deregistered) _this._engine.afterFlush(function () { var /** @type {?} */ index = listeners.indexOf(data); if (index >= 0) { listeners.splice(index, 1); } if (!_this._triggers[name]) { delete triggersWithStates[name]; } }); }; }; /** * @param {?} name * @param {?} ast * @return {?} */ AnimationTransitionNamespace.prototype.register = /** * @param {?} name * @param {?} ast * @return {?} */ function (name, ast) { if (this._triggers[name]) { // throw return false; } else { this._triggers[name] = ast; return true; } }; /** * @param {?} name * @return {?} */ AnimationTransitionNamespace.prototype._getTrigger = /** * @param {?} name * @return {?} */ function (name) { var /** @type {?} */ trigger = this._triggers[name]; if (!trigger) { throw new Error("The provided animation trigger \"" + name + "\" has not been registered!"); } return trigger; }; /** * @param {?} element * @param {?} triggerName * @param {?} value * @param {?=} defaultToFallback * @return {?} */ AnimationTransitionNamespace.prototype.trigger = /** * @param {?} element * @param {?} triggerName * @param {?} value * @param {?=} defaultToFallback * @return {?} */ function (element, triggerName, value, defaultToFallback) { var _this = this; if (defaultToFallback === void 0) { defaultToFallback = true; } var /** @type {?} */ trigger = this._getTrigger(triggerName); var /** @type {?} */ player = new TransitionAnimationPlayer(this.id, triggerName, element); var /** @type {?} */ triggersWithStates = this._engine.statesByElement.get(element); if (!triggersWithStates) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName); this._engine.statesByElement.set(element, triggersWithStates = {}); } var /** @type {?} */ fromState = triggersWithStates[triggerName]; var /** @type {?} */ toState = new StateValue(value, this.id); var /** @type {?} */ isObj = value && value.hasOwnProperty('value'); if (!isObj && fromState) { toState.absorbOptions(fromState.options); } triggersWithStates[triggerName] = toState; if (!fromState) { fromState = DEFAULT_STATE_VALUE; } else if (fromState === DELETED_STATE_VALUE) { return player; } var /** @type {?} */ isRemoval = toState.value === VOID_VALUE; // normally this isn't reached by here, however, if an object expression // is passed in then it may be a new object each time. Comparing the value // is important since that will stay the same despite there being a new object. // The removal arc here is special cased because the same element is triggered // twice in the event that it contains animations on the outer/inner portions // of the host container if (!isRemoval && fromState.value === toState.value) { // this means that despite the value not changing, some inner params // have changed which means that the animation final styles need to be applied if (!objEquals(fromState.params, toState.params)) { var /** @type {?} */ errors = []; var /** @type {?} */ fromStyles_1 = trigger.matchStyles(fromState.value, fromState.params, errors); var /** @type {?} */ toStyles_1 = trigger.matchStyles(toState.value, toState.params, errors); if (errors.length) { this._engine.reportError(errors); } else { this._engine.afterFlush(function () { eraseStyles(element, fromStyles_1); setStyles(element, toStyles_1); }); } } return; } var /** @type {?} */ playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []); playersOnElement.forEach(function (player) { // only remove the player if it is queued on the EXACT same trigger/namespace // we only also deal with queued players here because if the animation has // started then we want to keep the player alive until the flush happens // (which is where the previousPlayers are passed into the new palyer) if (player.namespaceId == _this.id && player.triggerName == triggerName && player.queued) { player.destroy(); } }); var /** @type {?} */ transition = trigger.matchTransition(fromState.value, toState.value); var /** @type {?} */ isFallbackTransition = false; if (!transition) { if (!defaultToFallback) return; transition = trigger.fallbackTransition; isFallbackTransition = true; } this._engine.totalQueuedPlayers++; this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: isFallbackTransition }); if (!isFallbackTransition) { addClass(element, QUEUED_CLASSNAME); player.onStart(function () { removeClass(element, QUEUED_CLASSNAME); }); } player.onDone(function () { var /** @type {?} */ index = _this.players.indexOf(player); if (index >= 0) { _this.players.splice(index, 1); } var /** @type {?} */ players = _this._engine.playersByElement.get(element); if (players) { var /** @type {?} */ index_1 = players.indexOf(player); if (index_1 >= 0) { players.splice(index_1, 1); } } }); this.players.push(player); playersOnElement.push(player); return player; }; /** * @param {?} name * @return {?} */ AnimationTransitionNamespace.prototype.deregister = /** * @param {?} name * @return {?} */ function (name) { var _this = this; delete this._triggers[name]; this._engine.statesByElement.forEach(function (stateMap, element) { delete stateMap[name]; }); this._elementListeners.forEach(function (listeners, element) { _this._elementListeners.set(element, listeners.filter(function (entry) { return entry.name != name; })); }); }; /** * @param {?} element * @return {?} */ AnimationTransitionNamespace.prototype.clearElementCache = /** * @param {?} element * @return {?} */ function (element) { this._engine.statesByElement.delete(element); this._elementListeners.delete(element); var /** @type {?} */ elementPlayers = this._engine.playersByElement.get(element); if (elementPlayers) { elementPlayers.forEach(function (player) { return player.destroy(); }); this._engine.playersByElement.delete(element); } }; /** * @param {?} rootElement * @param {?} context * @param {?=} animate * @return {?} */ AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = /** * @param {?} rootElement * @param {?} context * @param {?=} animate * @return {?} */ function (rootElement, context, animate) { var _this = this; if (animate === void 0) { animate = false; } // emulate a leave animation for all inner nodes within this node. // If there are no animations found for any of the nodes then clear the cache // for the element. this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(function (elm) { var /** @type {?} */ namespaces = _this._engine.fetchNamespacesByElement(elm); if (namespaces.size) { namespaces.forEach(function (ns) { ns.triggerLeaveAnimation(elm, context, false, true); }); } else { _this.clearElementCache(elm); } }); }; /** * @param {?} element * @param {?} context * @param {?=} destroyAfterComplete * @param {?=} defaultToFallback * @return {?} */ AnimationTransitionNamespace.prototype.triggerLeaveAnimation = /** * @param {?} element * @param {?} context * @param {?=} destroyAfterComplete * @param {?=} defaultToFallback * @return {?} */ function (element, context, destroyAfterComplete, defaultToFallback) { var _this = this; var /** @type {?} */ triggerStates = this._engine.statesByElement.get(element); if (triggerStates) { var /** @type {?} */ players_1 = []; Object.keys(triggerStates).forEach(function (triggerName) { // this check is here in the event that an element is removed // twice (both on the host level and the component level) if (_this._triggers[triggerName]) { var /** @type {?} */ player = _this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); if (player) { players_1.push(player); } } }); if (players_1.length) { this._engine.markElementAsRemoved(this.id, element, true, context); if (destroyAfterComplete) { optimizeGroupPlayer(players_1).onDone(function () { return _this._engine.processLeaveNode(element); }); } return true; } } return false; }; /** * @param {?} element * @return {?} */ AnimationTransitionNamespace.prototype.prepareLeaveAnimationListeners = /** * @param {?} element * @return {?} */ function (element) { var _this = this; var /** @type {?} */ listeners = this._elementListeners.get(element); if (listeners) { var /** @type {?} */ visitedTriggers_1 = new Set(); listeners.forEach(function (listener) { var /** @type {?} */ triggerName = listener.name; if (visitedTriggers_1.has(triggerName)) return; visitedTriggers_1.add(triggerName); var /** @type {?} */ trigger = _this._triggers[triggerName]; var /** @type {?} */ transition = trigger.fallbackTransition; var /** @type {?} */ elementStates = /** @type {?} */ ((_this._engine.statesByElement.get(element))); var /** @type {?} */ fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE; var /** @type {?} */ toState = new StateValue(VOID_VALUE); var /** @type {?} */ player = new TransitionAnimationPlayer(_this.id, triggerName, element); _this._engine.totalQueuedPlayers++; _this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: true }); }); } }; /** * @param {?} element * @param {?} context * @return {?} */ AnimationTransitionNamespace.prototype.removeNode = /** * @param {?} element * @param {?} context * @return {?} */ function (element, context) { var _this = this; var /** @type {?} */ engine = this._engine; if (element.childElementCount) { this._signalRemovalForInnerTriggers(element, context, true); } // this means that a * => VOID animation was detected and kicked off if (this.triggerLeaveAnimation(element, context, true)) return; // find the player that is animating and make sure that the // removal is delayed until that player has completed var /** @type {?} */ containsPotentialParentTransition = false; if (engine.totalAnimations) { var /** @type {?} */ currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; // when this `if statement` does not continue forward it means that // a previous animation query has selected the current element and // is animating it. In this situation want to continue fowards and // allow the element to be queued up for animation later. if (currentPlayers && currentPlayers.length) { containsPotentialParentTransition = true; } else { var /** @type {?} */ parent_1 = element; while (parent_1 = parent_1.parentNode) { var /** @type {?} */ triggers = engine.statesByElement.get(parent_1); if (triggers) { containsPotentialParentTransition = true; break; } } } } // at this stage we know that the element will either get removed // during flush or will be picked up by a parent query. Either way // we need to fire the listeners for this element when it DOES get // removed (once the query parent animation is done or after flush) this.prepareLeaveAnimationListeners(element); // whether or not a parent has an animation we need to delay the deferral of the leave // operation until we have more information (which we do after flush() has been called) if (containsPotentialParentTransition) { engine.markElementAsRemoved(this.id, element, false, context); } else { // we do this after the flush has occurred such // that the callbacks can be fired engine.afterFlush(function () { return _this.clearElementCache(element); }); engine.destroyInnerAnimations(element); engine._onRemovalComplete(element, context); } }; /** * @param {?} element * @param {?} parent * @return {?} */ AnimationTransitionNamespace.prototype.insertNode = /** * @param {?} element * @param {?} parent * @return {?} */ function (element, parent) { addClass(element, this._hostClassName); }; /** * @param {?} microtaskId * @return {?} */ AnimationTransitionNamespace.prototype.drainQueuedTransitions = /** * @param {?} microtaskId * @return {?} */ function (microtaskId) { var _this = this; var /** @type {?} */ instructions = []; this._queue.forEach(function (entry) { var /** @type {?} */ player = entry.player; if (player.destroyed) return; var /** @type {?} */ element = entry.element; var /** @type {?} */ listeners = _this._elementListeners.get(element); if (listeners) { listeners.forEach(function (listener) { if (listener.name == entry.triggerName) { var /** @type {?} */ baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value); (/** @type {?} */ (baseEvent))['_data'] = microtaskId; listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback); } }); } if (player.markedForDestroy) { _this._engine.afterFlush(function () { // now we can destroy the element properly since the event listeners have // been bound to the player player.destroy(); }); } else { instructions.push(entry); } }); this._queue = []; return instructions.sort(function (a, b) { // if depCount == 0 them move to front // otherwise if a contains b then move back var /** @type {?} */ d0 = a.transition.ast.depCount; var /** @type {?} */ d1 = b.transition.ast.depCount; if (d0 == 0 || d1 == 0) { return d0 - d1; } return _this._engine.driver.containsElement(a.element, b.element) ? 1 : -1; }); }; /** * @param {?} context * @return {?} */ AnimationTransitionNamespace.prototype.destroy = /** * @param {?} context * @return {?} */ function (context) { this.players.forEach(function (p) { return p.destroy(); }); this._signalRemovalForInnerTriggers(this.hostElement, context); }; /** * @param {?} element * @return {?} */ AnimationTransitionNamespace.prototype.elementContainsData = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ containsData = false; if (this._elementListeners.has(element)) containsData = true; containsData = (this._queue.find(function (entry) { return entry.element === element; }) ? true : false) || containsData; return containsData; }; return AnimationTransitionNamespace; }()); /** * @record */ var TransitionAnimationEngine = (function () { function TransitionAnimationEngine(driver, _normalizer) { this.driver = driver; this._normalizer = _normalizer; this.players = []; this.newHostElements = new Map(); this.playersByElement = new Map(); this.playersByQueriedElement = new Map(); this.statesByElement = new Map(); this.disabledNodes = new Set(); this.totalAnimations = 0; this.totalQueuedPlayers = 0; this._namespaceLookup = {}; this._namespaceList = []; this._flushFns = []; this._whenQuietFns = []; this.namespacesByHostElement = new Map(); this.collectedEnterElements = []; this.collectedLeaveElements = []; this.onRemovalComplete = function (element, context) { }; } /** @internal */ /** * \@internal * @param {?} element * @param {?} context * @return {?} */ TransitionAnimationEngine.prototype._onRemovalComplete = /** * \@internal * @param {?} element * @param {?} context * @return {?} */ function (element, context) { this.onRemovalComplete(element, context); }; Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", { get: /** * @return {?} */ function () { var /** @type {?} */ players = []; this._namespaceList.forEach(function (ns) { ns.players.forEach(function (player) { if (player.queued) { players.push(player); } }); }); return players; }, enumerable: true, configurable: true }); /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ TransitionAnimationEngine.prototype.createNamespace = /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ function (namespaceId, hostElement) { var /** @type {?} */ ns = new AnimationTransitionNamespace(namespaceId, hostElement, this); if (hostElement.parentNode) { this._balanceNamespaceList(ns, hostElement); } else { // defer this later until flush during when the host element has // been inserted so that we know exactly where to place it in // the namespace list this.newHostElements.set(hostElement, ns); // given that this host element is apart of the animation code, it // may or may not be inserted by a parent node that is an of an // animation renderer type. If this happens then we can still have // access to this item when we query for :enter nodes. If the parent // is a renderer then the set data-structure will normalize the entry this.collectEnterElement(hostElement); } return this._namespaceLookup[namespaceId] = ns; }; /** * @param {?} ns * @param {?} hostElement * @return {?} */ TransitionAnimationEngine.prototype._balanceNamespaceList = /** * @param {?} ns * @param {?} hostElement * @return {?} */ function (ns, hostElement) { var /** @type {?} */ limit = this._namespaceList.length - 1; if (limit >= 0) { var /** @type {?} */ found = false; for (var /** @type {?} */ i = limit; i >= 0; i--) { var /** @type {?} */ nextNamespace = this._namespaceList[i]; if (this.driver.containsElement(nextNamespace.hostElement, hostElement)) { this._namespaceList.splice(i + 1, 0, ns); found = true; break; } } if (!found) { this._namespaceList.splice(0, 0, ns); } } else { this._namespaceList.push(ns); } this.namespacesByHostElement.set(hostElement, ns); return ns; }; /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ TransitionAnimationEngine.prototype.register = /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ function (namespaceId, hostElement) { var /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (!ns) { ns = this.createNamespace(namespaceId, hostElement); } return ns; }; /** * @param {?} namespaceId * @param {?} name * @param {?} trigger * @return {?} */ TransitionAnimationEngine.prototype.registerTrigger = /** * @param {?} namespaceId * @param {?} name * @param {?} trigger * @return {?} */ function (namespaceId, name, trigger) { var /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (ns && ns.register(name, trigger)) { this.totalAnimations++; } }; /** * @param {?} namespaceId * @param {?} context * @return {?} */ TransitionAnimationEngine.prototype.destroy = /** * @param {?} namespaceId * @param {?} context * @return {?} */ function (namespaceId, context) { var _this = this; if (!namespaceId) return; var /** @type {?} */ ns = this._fetchNamespace(namespaceId); this.afterFlush(function () { _this.namespacesByHostElement.delete(ns.hostElement); delete _this._namespaceLookup[namespaceId]; var /** @type {?} */ index = _this._namespaceList.indexOf(ns); if (index >= 0) { _this._namespaceList.splice(index, 1); } }); this.afterFlushAnimationsDone(function () { return ns.destroy(context); }); }; /** * @param {?} id * @return {?} */ TransitionAnimationEngine.prototype._fetchNamespace = /** * @param {?} id * @return {?} */ function (id) { return this._namespaceLookup[id]; }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.fetchNamespacesByElement = /** * @param {?} element * @return {?} */ function (element) { // normally there should only be one namespace per element, however // if @triggers are placed on both the component element and then // its host element (within the component code) then there will be // two namespaces returned. We use a set here to simply the dedupe // of namespaces incase there are multiple triggers both the elm and host var /** @type {?} */ namespaces = new Set(); var /** @type {?} */ elementStates = this.statesByElement.get(element); if (elementStates) { var /** @type {?} */ keys = Object.keys(elementStates); for (var /** @type {?} */ i = 0; i < keys.length; i++) { var /** @type {?} */ nsId = elementStates[keys[i]].namespaceId; if (nsId) { var /** @type {?} */ ns = this._fetchNamespace(nsId); if (ns) { namespaces.add(ns); } } } } return namespaces; }; /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} value * @return {?} */ TransitionAnimationEngine.prototype.trigger = /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} value * @return {?} */ function (namespaceId, element, name, value) { if (isElementNode(element)) { this._fetchNamespace(namespaceId).trigger(element, name, value); return true; } return false; }; /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ TransitionAnimationEngine.prototype.insertNode = /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ function (namespaceId, element, parent, insertBefore) { if (!isElementNode(element)) return; // special case for when an element is removed and reinserted (move operation) // when this occurs we do not want to use the element for deletion later var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { details.setForRemoval = false; } // in the event that the namespaceId is blank then the caller // code does not contain any animation code in it, but it is // just being called so that the node is marked as being inserted if (namespaceId) { this._fetchNamespace(namespaceId).insertNode(element, parent); } // only *directives and host elements are inserted before if (insertBefore) { this.collectEnterElement(element); } }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.collectEnterElement = /** * @param {?} element * @return {?} */ function (element) { this.collectedEnterElements.push(element); }; /** * @param {?} element * @param {?} value * @return {?} */ TransitionAnimationEngine.prototype.markElementAsDisabled = /** * @param {?} element * @param {?} value * @return {?} */ function (element, value) { if (value) { if (!this.disabledNodes.has(element)) { this.disabledNodes.add(element); addClass(element, DISABLED_CLASSNAME); } } else if (this.disabledNodes.has(element)) { this.disabledNodes.delete(element); removeClass(element, DISABLED_CLASSNAME); } }; /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ TransitionAnimationEngine.prototype.removeNode = /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ function (namespaceId, element, context) { if (!isElementNode(element)) { this._onRemovalComplete(element, context); return; } var /** @type {?} */ ns = namespaceId ? this._fetchNamespace(namespaceId) : null; if (ns) { ns.removeNode(element, context); } else { this.markElementAsRemoved(namespaceId, element, false, context); } }; /** * @param {?} namespaceId * @param {?} element * @param {?=} hasAnimation * @param {?=} context * @return {?} */ TransitionAnimationEngine.prototype.markElementAsRemoved = /** * @param {?} namespaceId * @param {?} element * @param {?=} hasAnimation * @param {?=} context * @return {?} */ function (namespaceId, element, hasAnimation, context) { this.collectedLeaveElements.push(element); element[REMOVAL_FLAG] = { namespaceId: namespaceId, setForRemoval: context, hasAnimation: hasAnimation, removedBeforeQueried: false }; }; /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ TransitionAnimationEngine.prototype.listen = /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ function (namespaceId, element, name, phase, callback) { if (isElementNode(element)) { return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); } return function () { }; }; /** * @param {?} entry * @param {?} subTimelines * @param {?} enterClassName * @param {?} leaveClassName * @return {?} */ TransitionAnimationEngine.prototype._buildInstruction = /** * @param {?} entry * @param {?} subTimelines * @param {?} enterClassName * @param {?} leaveClassName * @return {?} */ function (entry, subTimelines, enterClassName, leaveClassName) { return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines); }; /** * @param {?} containerElement * @return {?} */ TransitionAnimationEngine.prototype.destroyInnerAnimations = /** * @param {?} containerElement * @return {?} */ function (containerElement) { var _this = this; var /** @type {?} */ elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); elements.forEach(function (element) { return _this.destroyActiveAnimationsForElement(element); }); if (this.playersByQueriedElement.size == 0) return; elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); elements.forEach(function (element) { return _this.finishActiveQueriedAnimationOnElement(element); }); }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.destroyActiveAnimationsForElement = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ players = this.playersByElement.get(element); if (players) { players.forEach(function (player) { // special case for when an element is set for destruction, but hasn't started. // in this situation we want to delay the destruction until the flush occurs // so that any event listeners attached to the player are triggered. if (player.queued) { player.markedForDestroy = true; } else { player.destroy(); } }); } var /** @type {?} */ stateMap = this.statesByElement.get(element); if (stateMap) { Object.keys(stateMap).forEach(function (triggerName) { return stateMap[triggerName] = DELETED_STATE_VALUE; }); } }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.finishActiveQueriedAnimationOnElement = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ players = this.playersByQueriedElement.get(element); if (players) { players.forEach(function (player) { return player.finish(); }); } }; /** * @return {?} */ TransitionAnimationEngine.prototype.whenRenderingDone = /** * @return {?} */ function () { var _this = this; return new Promise(function (resolve) { if (_this.players.length) { return optimizeGroupPlayer(_this.players).onDone(function () { return resolve(); }); } else { resolve(); } }); }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.processLeaveNode = /** * @param {?} element * @return {?} */ function (element) { var _this = this; var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { // this will prevent it from removing it twice element[REMOVAL_FLAG] = NULL_REMOVAL_STATE; if (details.namespaceId) { this.destroyInnerAnimations(element); var /** @type {?} */ ns = this._fetchNamespace(details.namespaceId); if (ns) { ns.clearElementCache(element); } } this._onRemovalComplete(element, details.setForRemoval); } if (this.driver.matchesElement(element, DISABLED_SELECTOR)) { this.markElementAsDisabled(element, false); } this.driver.query(element, DISABLED_SELECTOR, true).forEach(function (node) { _this.markElementAsDisabled(element, false); }); }; /** * @param {?=} microtaskId * @return {?} */ TransitionAnimationEngine.prototype.flush = /** * @param {?=} microtaskId * @return {?} */ function (microtaskId) { var _this = this; if (microtaskId === void 0) { microtaskId = -1; } var /** @type {?} */ players = []; if (this.newHostElements.size) { this.newHostElements.forEach(function (ns, element) { return _this._balanceNamespaceList(ns, element); }); this.newHostElements.clear(); } if (this.totalAnimations && this.collectedEnterElements.length) { for (var /** @type {?} */ i = 0; i < this.collectedEnterElements.length; i++) { var /** @type {?} */ elm = this.collectedEnterElements[i]; addClass(elm, STAR_CLASSNAME); } } if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { var /** @type {?} */ cleanupFns = []; try { players = this._flushAnimations(cleanupFns, microtaskId); } finally { for (var /** @type {?} */ i = 0; i < cleanupFns.length; i++) { cleanupFns[i](); } } } else { for (var /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) { var /** @type {?} */ element = this.collectedLeaveElements[i]; this.processLeaveNode(element); } } this.totalQueuedPlayers = 0; this.collectedEnterElements.length = 0; this.collectedLeaveElements.length = 0; this._flushFns.forEach(function (fn) { return fn(); }); this._flushFns = []; if (this._whenQuietFns.length) { // we move these over to a variable so that // if any new callbacks are registered in another // flush they do not populate the existing set var /** @type {?} */ quietFns_1 = this._whenQuietFns; this._whenQuietFns = []; if (players.length) { optimizeGroupPlayer(players).onDone(function () { quietFns_1.forEach(function (fn) { return fn(); }); }); } else { quietFns_1.forEach(function (fn) { return fn(); }); } } }; /** * @param {?} errors * @return {?} */ TransitionAnimationEngine.prototype.reportError = /** * @param {?} errors * @return {?} */ function (errors) { throw new Error("Unable to process animations due to the following failed trigger transitions\n " + errors.join('\n')); }; /** * @param {?} cleanupFns * @param {?} microtaskId * @return {?} */ TransitionAnimationEngine.prototype._flushAnimations = /** * @param {?} cleanupFns * @param {?} microtaskId * @return {?} */ function (cleanupFns, microtaskId) { var _this = this; var /** @type {?} */ subTimelines = new ElementInstructionMap(); var /** @type {?} */ skippedPlayers = []; var /** @type {?} */ skippedPlayersMap = new Map(); var /** @type {?} */ queuedInstructions = []; var /** @type {?} */ queriedElements = new Map(); var /** @type {?} */ allPreStyleElements = new Map(); var /** @type {?} */ allPostStyleElements = new Map(); var /** @type {?} */ disabledElementsSet = new Set(); this.disabledNodes.forEach(function (node) { disabledElementsSet.add(node); var /** @type {?} */ nodesThatAreDisabled = _this.driver.query(node, QUEUED_SELECTOR, true); for (var /** @type {?} */ i_1 = 0; i_1 < nodesThatAreDisabled.length; i_1++) { disabledElementsSet.add(nodesThatAreDisabled[i_1]); } }); var /** @type {?} */ bodyNode = getBodyNode(); var /** @type {?} */ allTriggerElements = Array.from(this.statesByElement.keys()); var /** @type {?} */ enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements); // this must occur before the instructions are built below such that // the :enter queries match the elements (since the timeline queries // are fired during instruction building). var /** @type {?} */ enterNodeMapIds = new Map(); var /** @type {?} */ i = 0; enterNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = ENTER_CLASSNAME + i++; enterNodeMapIds.set(root, className); nodes.forEach(function (node) { return addClass(node, className); }); }); var /** @type {?} */ allLeaveNodes = []; var /** @type {?} */ mergedLeaveNodes = new Set(); var /** @type {?} */ leaveNodesWithoutAnimations = new Set(); for (var /** @type {?} */ i_2 = 0; i_2 < this.collectedLeaveElements.length; i_2++) { var /** @type {?} */ element = this.collectedLeaveElements[i_2]; var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { allLeaveNodes.push(element); mergedLeaveNodes.add(element); if (details.hasAnimation) { this.driver.query(element, STAR_SELECTOR, true).forEach(function (elm) { return mergedLeaveNodes.add(elm); }); } else { leaveNodesWithoutAnimations.add(element); } } } var /** @type {?} */ leaveNodeMapIds = new Map(); var /** @type {?} */ leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes)); leaveNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = LEAVE_CLASSNAME + i++; leaveNodeMapIds.set(root, className); nodes.forEach(function (node) { return addClass(node, className); }); }); cleanupFns.push(function () { enterNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = /** @type {?} */ ((enterNodeMapIds.get(root))); nodes.forEach(function (node) { return removeClass(node, className); }); }); leaveNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = /** @type {?} */ ((leaveNodeMapIds.get(root))); nodes.forEach(function (node) { return removeClass(node, className); }); }); allLeaveNodes.forEach(function (element) { _this.processLeaveNode(element); }); }); var /** @type {?} */ allPlayers = []; var /** @type {?} */ erroneousTransitions = []; for (var /** @type {?} */ i_3 = this._namespaceList.length - 1; i_3 >= 0; i_3--) { var /** @type {?} */ ns = this._namespaceList[i_3]; ns.drainQueuedTransitions(microtaskId).forEach(function (entry) { var /** @type {?} */ player = entry.player; allPlayers.push(player); var /** @type {?} */ element = entry.element; if (!bodyNode || !_this.driver.containsElement(bodyNode, element)) { player.destroy(); return; } var /** @type {?} */ leaveClassName = /** @type {?} */ ((leaveNodeMapIds.get(element))); var /** @type {?} */ enterClassName = /** @type {?} */ ((enterNodeMapIds.get(element))); var /** @type {?} */ instruction = /** @type {?} */ ((_this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName))); if (instruction.errors && instruction.errors.length) { erroneousTransitions.push(instruction); return; } // if a unmatched transition is queued to go then it SHOULD NOT render // an animation and cancel the previously running animations. if (entry.isFallbackTransition) { player.onStart(function () { return eraseStyles(element, instruction.fromStyles); }); player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); skippedPlayers.push(player); return; } // this means that if a parent animation uses this animation as a sub trigger // then it will instruct the timeline builder to not add a player delay, but // instead stretch the first keyframe gap up until the animation starts. The // reason this is important is to prevent extra initialization styles from being // required by the user in the animation. instruction.timelines.forEach(function (tl) { return tl.stretchStartingKeyframe = true; }); subTimelines.append(element, instruction.timelines); var /** @type {?} */ tuple = { instruction: instruction, player: player, element: element }; queuedInstructions.push(tuple); instruction.queriedElements.forEach(function (element) { return getOrSetAsInMap(queriedElements, element, []).push(player); }); instruction.preStyleProps.forEach(function (stringMap, element) { var /** @type {?} */ props = Object.keys(stringMap); if (props.length) { var /** @type {?} */ setVal_1 = /** @type {?} */ ((allPreStyleElements.get(element))); if (!setVal_1) { allPreStyleElements.set(element, setVal_1 = new Set()); } props.forEach(function (prop) { return setVal_1.add(prop); }); } }); instruction.postStyleProps.forEach(function (stringMap, element) { var /** @type {?} */ props = Object.keys(stringMap); var /** @type {?} */ setVal = /** @type {?} */ ((allPostStyleElements.get(element))); if (!setVal) { allPostStyleElements.set(element, setVal = new Set()); } props.forEach(function (prop) { return setVal.add(prop); }); }); }); } if (erroneousTransitions.length) { var /** @type {?} */ errors_1 = []; erroneousTransitions.forEach(function (instruction) { errors_1.push("@" + instruction.triggerName + " has failed due to:\n"); /** @type {?} */ ((instruction.errors)).forEach(function (error) { return errors_1.push("- " + error + "\n"); }); }); allPlayers.forEach(function (player) { return player.destroy(); }); this.reportError(errors_1); } var /** @type {?} */ allPreviousPlayersMap = new Map(); // this map works to tell which element in the DOM tree is contained by // which animation. Further down below this map will get populated once // the players are built and in doing so it can efficiently figure out // if a sub player is skipped due to a parent player having priority. var /** @type {?} */ animationElementMap = new Map(); queuedInstructions.forEach(function (entry) { var /** @type {?} */ element = entry.element; if (subTimelines.has(element)) { animationElementMap.set(element, element); _this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap); } }); skippedPlayers.forEach(function (player) { var /** @type {?} */ element = player.element; var /** @type {?} */ previousPlayers = _this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); previousPlayers.forEach(function (prevPlayer) { getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer); prevPlayer.destroy(); }); }); // this is a special case for nodes that will be removed (either by) // having their own leave animations or by being queried in a container // that will be removed once a parent animation is complete. The idea // here is that * styles must be identical to ! styles because of // backwards compatibility (* is also filled in by default in many places). // Otherwise * styles will return an empty value or auto since the element // that is being getComputedStyle'd will not be visible (since * = destination) var /** @type {?} */ replaceNodes = allLeaveNodes.filter(function (node) { return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); }); // POST STAGE: fill the * styles var /** @type {?} */ postStylesMap = new Map(); var /** @type {?} */ allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["a" /* AUTO_STYLE */]); allLeaveQueriedNodes.forEach(function (node) { if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { replaceNodes.push(node); } }); // PRE STAGE: fill the ! styles var /** @type {?} */ preStylesMap = new Map(); enterNodeMap.forEach(function (nodes, root) { cloakAndComputeStyles(preStylesMap, _this.driver, new Set(nodes), allPreStyleElements, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["m" /* ɵPRE_STYLE */]); }); replaceNodes.forEach(function (node) { var /** @type {?} */ post = postStylesMap.get(node); var /** @type {?} */ pre = preStylesMap.get(node); postStylesMap.set(node, /** @type {?} */ (Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, post, pre))); }); var /** @type {?} */ rootPlayers = []; var /** @type {?} */ subPlayers = []; var /** @type {?} */ NO_PARENT_ANIMATION_ELEMENT_DETECTED = {}; queuedInstructions.forEach(function (entry) { var element = entry.element, player = entry.player, instruction = entry.instruction; // this means that it was never consumed by a parent animation which // means that it is independent and therefore should be set for animation if (subTimelines.has(element)) { if (disabledElementsSet.has(element)) { player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); skippedPlayers.push(player); return; } // this will flow up the DOM and query the map to figure out // if a parent animation has priority over it. In the situation // that a parent is detected then it will cancel the loop. If // nothing is detected, or it takes a few hops to find a parent, // then it will fill in the missing nodes and signal them as having // a detected parent (or a NO_PARENT value via a special constant). var /** @type {?} */ parentWithAnimation_1 = NO_PARENT_ANIMATION_ELEMENT_DETECTED; if (animationElementMap.size > 1) { var /** @type {?} */ elm = element; var /** @type {?} */ parentsToAdd = []; while (elm = elm.parentNode) { var /** @type {?} */ detectedParent = animationElementMap.get(elm); if (detectedParent) { parentWithAnimation_1 = detectedParent; break; } parentsToAdd.push(elm); } parentsToAdd.forEach(function (parent) { return animationElementMap.set(parent, parentWithAnimation_1); }); } var /** @type {?} */ innerPlayer = _this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); player.setRealPlayer(innerPlayer); if (parentWithAnimation_1 === NO_PARENT_ANIMATION_ELEMENT_DETECTED) { rootPlayers.push(player); } else { var /** @type {?} */ parentPlayers = _this.playersByElement.get(parentWithAnimation_1); if (parentPlayers && parentPlayers.length) { player.parentPlayer = optimizeGroupPlayer(parentPlayers); } skippedPlayers.push(player); } } else { eraseStyles(element, instruction.fromStyles); player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); // there still might be a ancestor player animating this // element therefore we will still add it as a sub player // even if its animation may be disabled subPlayers.push(player); if (disabledElementsSet.has(element)) { skippedPlayers.push(player); } } }); // find all of the sub players' corresponding inner animation player subPlayers.forEach(function (player) { // even if any players are not found for a sub animation then it // will still complete itself after the next tick since it's Noop var /** @type {?} */ playersForElement = skippedPlayersMap.get(player.element); if (playersForElement && playersForElement.length) { var /** @type {?} */ innerPlayer = optimizeGroupPlayer(playersForElement); player.setRealPlayer(innerPlayer); } }); // the reason why we don't actually play the animation is // because all that a skipped player is designed to do is to // fire the start/done transition callback events skippedPlayers.forEach(function (player) { if (player.parentPlayer) { player.syncPlayerEvents(player.parentPlayer); } else { player.destroy(); } }); // run through all of the queued removals and see if they // were picked up by a query. If not then perform the removal // operation right away unless a parent animation is ongoing. for (var /** @type {?} */ i_4 = 0; i_4 < allLeaveNodes.length; i_4++) { var /** @type {?} */ element = allLeaveNodes[i_4]; var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); removeClass(element, LEAVE_CLASSNAME); // this means the element has a removal animation that is being // taken care of and therefore the inner elements will hang around // until that animation is over (or the parent queried animation) if (details && details.hasAnimation) continue; var /** @type {?} */ players = []; // if this element is queried or if it contains queried children // then we want for the element not to be removed from the page // until the queried animations have finished if (queriedElements.size) { var /** @type {?} */ queriedPlayerResults = queriedElements.get(element); if (queriedPlayerResults && queriedPlayerResults.length) { players.push.apply(players, queriedPlayerResults); } var /** @type {?} */ queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true); for (var /** @type {?} */ j = 0; j < queriedInnerElements.length; j++) { var /** @type {?} */ queriedPlayers = queriedElements.get(queriedInnerElements[j]); if (queriedPlayers && queriedPlayers.length) { players.push.apply(players, queriedPlayers); } } } var /** @type {?} */ activePlayers = players.filter(function (p) { return !p.destroyed; }); if (activePlayers.length) { removeNodesAfterAnimationDone(this, element, activePlayers); } else { this.processLeaveNode(element); } } // this is required so the cleanup method doesn't remove them allLeaveNodes.length = 0; rootPlayers.forEach(function (player) { _this.players.push(player); player.onDone(function () { player.destroy(); var /** @type {?} */ index = _this.players.indexOf(player); _this.players.splice(index, 1); }); player.play(); }); return rootPlayers; }; /** * @param {?} namespaceId * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.elementContainsData = /** * @param {?} namespaceId * @param {?} element * @return {?} */ function (namespaceId, element) { var /** @type {?} */ containsData = false; var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) containsData = true; if (this.playersByElement.has(element)) containsData = true; if (this.playersByQueriedElement.has(element)) containsData = true; if (this.statesByElement.has(element)) containsData = true; return this._fetchNamespace(namespaceId).elementContainsData(element) || containsData; }; /** * @param {?} callback * @return {?} */ TransitionAnimationEngine.prototype.afterFlush = /** * @param {?} callback * @return {?} */ function (callback) { this._flushFns.push(callback); }; /** * @param {?} callback * @return {?} */ TransitionAnimationEngine.prototype.afterFlushAnimationsDone = /** * @param {?} callback * @return {?} */ function (callback) { this._whenQuietFns.push(callback); }; /** * @param {?} element * @param {?} isQueriedElement * @param {?=} namespaceId * @param {?=} triggerName * @param {?=} toStateValue * @return {?} */ TransitionAnimationEngine.prototype._getPreviousPlayers = /** * @param {?} element * @param {?} isQueriedElement * @param {?=} namespaceId * @param {?=} triggerName * @param {?=} toStateValue * @return {?} */ function (element, isQueriedElement, namespaceId, triggerName, toStateValue) { var /** @type {?} */ players = []; if (isQueriedElement) { var /** @type {?} */ queriedElementPlayers = this.playersByQueriedElement.get(element); if (queriedElementPlayers) { players = queriedElementPlayers; } } else { var /** @type {?} */ elementPlayers = this.playersByElement.get(element); if (elementPlayers) { var /** @type {?} */ isRemovalAnimation_1 = !toStateValue || toStateValue == VOID_VALUE; elementPlayers.forEach(function (player) { if (player.queued) return; if (!isRemovalAnimation_1 && player.triggerName != triggerName) return; players.push(player); }); } } if (namespaceId || triggerName) { players = players.filter(function (player) { if (namespaceId && namespaceId != player.namespaceId) return false; if (triggerName && triggerName != player.triggerName) return false; return true; }); } return players; }; /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @return {?} */ TransitionAnimationEngine.prototype._beforeAnimationBuild = /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @return {?} */ function (namespaceId, instruction, allPreviousPlayersMap) { var /** @type {?} */ triggerName = instruction.triggerName; var /** @type {?} */ rootElement = instruction.element; // when a removal animation occurs, ALL previous players are collected // and destroyed (even if they are outside of the current namespace) var /** @type {?} */ targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId; var /** @type {?} */ targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName; var _loop_1 = function (timelineInstruction) { var /** @type {?} */ element = timelineInstruction.element; var /** @type {?} */ isQueriedElement = element !== rootElement; var /** @type {?} */ players = getOrSetAsInMap(allPreviousPlayersMap, element, []); var /** @type {?} */ previousPlayers = this_1._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); previousPlayers.forEach(function (player) { var /** @type {?} */ realPlayer = /** @type {?} */ (player.getRealPlayer()); if (realPlayer.beforeDestroy) { realPlayer.beforeDestroy(); } player.destroy(); players.push(player); }); }; var this_1 = this; for (var _i = 0, _a = instruction.timelines; _i < _a.length; _i++) { var timelineInstruction = _a[_i]; _loop_1(timelineInstruction); } // this needs to be done so that the PRE/POST styles can be // computed properly without interfering with the previous animation eraseStyles(rootElement, instruction.fromStyles); }; /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @param {?} skippedPlayersMap * @param {?} preStylesMap * @param {?} postStylesMap * @return {?} */ TransitionAnimationEngine.prototype._buildAnimation = /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @param {?} skippedPlayersMap * @param {?} preStylesMap * @param {?} postStylesMap * @return {?} */ function (namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { var _this = this; var /** @type {?} */ triggerName = instruction.triggerName; var /** @type {?} */ rootElement = instruction.element; // we first run this so that the previous animation player // data can be passed into the successive animation players var /** @type {?} */ allQueriedPlayers = []; var /** @type {?} */ allConsumedElements = new Set(); var /** @type {?} */ allSubElements = new Set(); var /** @type {?} */ allNewPlayers = instruction.timelines.map(function (timelineInstruction) { var /** @type {?} */ element = timelineInstruction.element; allConsumedElements.add(element); // FIXME (matsko): make sure to-be-removed animations are removed properly var /** @type {?} */ details = element[REMOVAL_FLAG]; if (details && details.removedBeforeQueried) return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["d" /* NoopAnimationPlayer */](); var /** @type {?} */ isQueriedElement = element !== rootElement; var /** @type {?} */ previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY) .map(function (p) { return p.getRealPlayer(); })) .filter(function (p) { // the `element` is not apart of the AnimationPlayer definition, but // Mock/WebAnimations // use the element within their implementation. This will be added in Angular5 to // AnimationPlayer var /** @type {?} */ pp = /** @type {?} */ (p); return pp.element ? pp.element === element : false; }); var /** @type {?} */ preStyles = preStylesMap.get(element); var /** @type {?} */ postStyles = postStylesMap.get(element); var /** @type {?} */ keyframes = normalizeKeyframes(_this.driver, _this._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles); var /** @type {?} */ player = _this._buildPlayer(timelineInstruction, keyframes, previousPlayers); // this means that this particular player belongs to a sub trigger. It is // important that we match this player up with the corresponding (@trigger.listener) if (timelineInstruction.subTimeline && skippedPlayersMap) { allSubElements.add(element); } if (isQueriedElement) { var /** @type {?} */ wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element); wrappedPlayer.setRealPlayer(player); allQueriedPlayers.push(wrappedPlayer); } return player; }); allQueriedPlayers.forEach(function (player) { getOrSetAsInMap(_this.playersByQueriedElement, player.element, []).push(player); player.onDone(function () { return deleteOrUnsetInMap(_this.playersByQueriedElement, player.element, player); }); }); allConsumedElements.forEach(function (element) { return addClass(element, NG_ANIMATING_CLASSNAME); }); var /** @type {?} */ player = optimizeGroupPlayer(allNewPlayers); player.onDestroy(function () { allConsumedElements.forEach(function (element) { return removeClass(element, NG_ANIMATING_CLASSNAME); }); setStyles(rootElement, instruction.toStyles); }); // this basically makes all of the callbacks for sub element animations // be dependent on the upper players for when they finish allSubElements.forEach(function (element) { getOrSetAsInMap(skippedPlayersMap, element, []).push(player); }); return player; }; /** * @param {?} instruction * @param {?} keyframes * @param {?} previousPlayers * @return {?} */ TransitionAnimationEngine.prototype._buildPlayer = /** * @param {?} instruction * @param {?} keyframes * @param {?} previousPlayers * @return {?} */ function (instruction, keyframes, previousPlayers) { if (keyframes.length > 0) { return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers); } // special case for when an empty transition|definition is provided // ... there is no point in rendering an empty animation return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["d" /* NoopAnimationPlayer */](); }; return TransitionAnimationEngine; }()); var TransitionAnimationPlayer = (function () { function TransitionAnimationPlayer(namespaceId, triggerName, element) { this.namespaceId = namespaceId; this.triggerName = triggerName; this.element = element; this._player = new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["d" /* NoopAnimationPlayer */](); this._containsRealPlayer = false; this._queuedCallbacks = {}; this.destroyed = false; this.markedForDestroy = false; } Object.defineProperty(TransitionAnimationPlayer.prototype, "queued", { get: /** * @return {?} */ function () { return this._containsRealPlayer == false; }, enumerable: true, configurable: true }); /** * @param {?} player * @return {?} */ TransitionAnimationPlayer.prototype.setRealPlayer = /** * @param {?} player * @return {?} */ function (player) { var _this = this; if (this._containsRealPlayer) return; this._player = player; Object.keys(this._queuedCallbacks).forEach(function (phase) { _this._queuedCallbacks[phase].forEach(function (callback) { return listenOnPlayer(player, phase, undefined, callback); }); }); this._queuedCallbacks = {}; this._containsRealPlayer = true; }; /** * @return {?} */ TransitionAnimationPlayer.prototype.getRealPlayer = /** * @return {?} */ function () { return this._player; }; /** * @param {?} player * @return {?} */ TransitionAnimationPlayer.prototype.syncPlayerEvents = /** * @param {?} player * @return {?} */ function (player) { var _this = this; var /** @type {?} */ p = /** @type {?} */ (this._player); if (p.triggerCallback) { player.onStart(function () { return p.triggerCallback('start'); }); } player.onDone(function () { return _this.finish(); }); player.onDestroy(function () { return _this.destroy(); }); }; /** * @param {?} name * @param {?} callback * @return {?} */ TransitionAnimationPlayer.prototype._queueEvent = /** * @param {?} name * @param {?} callback * @return {?} */ function (name, callback) { getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback); }; /** * @param {?} fn * @return {?} */ TransitionAnimationPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { if (this.queued) { this._queueEvent('done', fn); } this._player.onDone(fn); }; /** * @param {?} fn * @return {?} */ TransitionAnimationPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { if (this.queued) { this._queueEvent('start', fn); } this._player.onStart(fn); }; /** * @param {?} fn * @return {?} */ TransitionAnimationPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { if (this.queued) { this._queueEvent('destroy', fn); } this._player.onDestroy(fn); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.init = /** * @return {?} */ function () { this._player.init(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this.queued ? false : this._player.hasStarted(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.play = /** * @return {?} */ function () { !this.queued && this._player.play(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.pause = /** * @return {?} */ function () { !this.queued && this._player.pause(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.restart = /** * @return {?} */ function () { !this.queued && this._player.restart(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.finish = /** * @return {?} */ function () { this._player.finish(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.destroy = /** * @return {?} */ function () { (/** @type {?} */ (this)).destroyed = true; this._player.destroy(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.reset = /** * @return {?} */ function () { !this.queued && this._player.reset(); }; /** * @param {?} p * @return {?} */ TransitionAnimationPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { if (!this.queued) { this._player.setPosition(p); } }; /** * @return {?} */ TransitionAnimationPlayer.prototype.getPosition = /** * @return {?} */ function () { return this.queued ? 0 : this._player.getPosition(); }; Object.defineProperty(TransitionAnimationPlayer.prototype, "totalTime", { get: /** * @return {?} */ function () { return this._player.totalTime; }, enumerable: true, configurable: true }); /* @internal */ /** * @param {?} phaseName * @return {?} */ TransitionAnimationPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ p = /** @type {?} */ (this._player); if (p.triggerCallback) { p.triggerCallback(phaseName); } }; return TransitionAnimationPlayer; }()); /** * @param {?} map * @param {?} key * @param {?} value * @return {?} */ function deleteOrUnsetInMap(map, key, value) { var /** @type {?} */ currentValues; if (map instanceof Map) { currentValues = map.get(key); if (currentValues) { if (currentValues.length) { var /** @type {?} */ index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { map.delete(key); } } } else { currentValues = map[key]; if (currentValues) { if (currentValues.length) { var /** @type {?} */ index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { delete map[key]; } } } return currentValues; } /** * @param {?} value * @return {?} */ function normalizeTriggerValue(value) { // we use `!= null` here because it's the most simple // way to test against a "falsy" value without mixing // in empty strings or a zero value. DO NOT OPTIMIZE. return value != null ? value : null; } /** * @param {?} node * @return {?} */ function isElementNode(node) { return node && node['nodeType'] === 1; } /** * @param {?} eventName * @return {?} */ function isTriggerEventValid(eventName) { return eventName == 'start' || eventName == 'done'; } /** * @param {?} element * @param {?=} value * @return {?} */ function cloakElement(element, value) { var /** @type {?} */ oldValue = element.style.display; element.style.display = value != null ? value : 'none'; return oldValue; } /** * @param {?} valuesMap * @param {?} driver * @param {?} elements * @param {?} elementPropsMap * @param {?} defaultStyle * @return {?} */ function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) { var /** @type {?} */ cloakVals = []; elements.forEach(function (element) { return cloakVals.push(cloakElement(element)); }); var /** @type {?} */ failedElements = []; elementPropsMap.forEach(function (props, element) { var /** @type {?} */ styles = {}; props.forEach(function (prop) { var /** @type {?} */ value = styles[prop] = driver.computeStyle(element, prop, defaultStyle); // there is no easy way to detect this because a sub element could be removed // by a parent animation element being detached. if (!value || value.length == 0) { element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE; failedElements.push(element); } }); valuesMap.set(element, styles); }); // we use a index variable here since Set.forEach(a, i) does not return // an index value for the closure (but instead just the value) var /** @type {?} */ i = 0; elements.forEach(function (element) { return cloakElement(element, cloakVals[i++]); }); return failedElements; } /** * @param {?} roots * @param {?} nodes * @return {?} */ function buildRootMap(roots, nodes) { var /** @type {?} */ rootMap = new Map(); roots.forEach(function (root) { return rootMap.set(root, []); }); if (nodes.length == 0) return rootMap; var /** @type {?} */ NULL_NODE = 1; var /** @type {?} */ nodeSet = new Set(nodes); var /** @type {?} */ localRootMap = new Map(); /** * @param {?} node * @return {?} */ function getRoot(node) { if (!node) return NULL_NODE; var /** @type {?} */ root = localRootMap.get(node); if (root) return root; var /** @type {?} */ parent = node.parentNode; if (rootMap.has(parent)) { // ngIf inside @trigger root = parent; } else if (nodeSet.has(parent)) { // ngIf inside ngIf root = NULL_NODE; } else { // recurse upwards root = getRoot(parent); } localRootMap.set(node, root); return root; } nodes.forEach(function (node) { var /** @type {?} */ root = getRoot(node); if (root !== NULL_NODE) { /** @type {?} */ ((rootMap.get(root))).push(node); } }); return rootMap; } var CLASSES_CACHE_KEY = '$$classes'; /** * @param {?} element * @param {?} className * @return {?} */ function addClass(element, className) { if (element.classList) { element.classList.add(className); } else { var /** @type {?} */ classes = element[CLASSES_CACHE_KEY]; if (!classes) { classes = element[CLASSES_CACHE_KEY] = {}; } classes[className] = true; } } /** * @param {?} element * @param {?} className * @return {?} */ function removeClass(element, className) { if (element.classList) { element.classList.remove(className); } else { var /** @type {?} */ classes = element[CLASSES_CACHE_KEY]; if (classes) { delete classes[className]; } } } /** * @param {?} engine * @param {?} element * @param {?} players * @return {?} */ function removeNodesAfterAnimationDone(engine, element, players) { optimizeGroupPlayer(players).onDone(function () { return engine.processLeaveNode(element); }); } /** * @param {?} players * @return {?} */ function flattenGroupPlayers(players) { var /** @type {?} */ finalPlayers = []; _flattenGroupPlayersRecur(players, finalPlayers); return finalPlayers; } /** * @param {?} players * @param {?} finalPlayers * @return {?} */ function _flattenGroupPlayersRecur(players, finalPlayers) { for (var /** @type {?} */ i = 0; i < players.length; i++) { var /** @type {?} */ player = players[i]; if (player instanceof __WEBPACK_IMPORTED_MODULE_0__angular_animations__["l" /* ɵAnimationGroupPlayer */]) { _flattenGroupPlayersRecur(player.players, finalPlayers); } else { finalPlayers.push(/** @type {?} */ (player)); } } } /** * @param {?} a * @param {?} b * @return {?} */ function objEquals(a, b) { var /** @type {?} */ k1 = Object.keys(a); var /** @type {?} */ k2 = Object.keys(b); if (k1.length != k2.length) return false; for (var /** @type {?} */ i = 0; i < k1.length; i++) { var /** @type {?} */ prop = k1[i]; if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) return false; } return true; } /** * @param {?} element * @param {?} allPreStyleElements * @param {?} allPostStyleElements * @return {?} */ function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) { var /** @type {?} */ postEntry = allPostStyleElements.get(element); if (!postEntry) return false; var /** @type {?} */ preEntry = allPreStyleElements.get(element); if (preEntry) { postEntry.forEach(function (data) { return /** @type {?} */ ((preEntry)).add(data); }); } else { allPreStyleElements.set(element, postEntry); } allPostStyleElements.delete(element); return true; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var AnimationEngine = (function () { function AnimationEngine(_driver, normalizer) { var _this = this; this._driver = _driver; this._triggerCache = {}; this.onRemovalComplete = function (element, context) { }; this._transitionEngine = new TransitionAnimationEngine(_driver, normalizer); this._timelineEngine = new TimelineAnimationEngine(_driver, normalizer); this._transitionEngine.onRemovalComplete = function (element, context) { return _this.onRemovalComplete(element, context); }; } /** * @param {?} componentId * @param {?} namespaceId * @param {?} hostElement * @param {?} name * @param {?} metadata * @return {?} */ AnimationEngine.prototype.registerTrigger = /** * @param {?} componentId * @param {?} namespaceId * @param {?} hostElement * @param {?} name * @param {?} metadata * @return {?} */ function (componentId, namespaceId, hostElement, name, metadata) { var /** @type {?} */ cacheKey = componentId + '-' + name; var /** @type {?} */ trigger = this._triggerCache[cacheKey]; if (!trigger) { var /** @type {?} */ errors = []; var /** @type {?} */ ast = /** @type {?} */ (buildAnimationAst(this._driver, /** @type {?} */ (metadata), errors)); if (errors.length) { throw new Error("The animation trigger \"" + name + "\" has failed to build due to the following errors:\n - " + errors.join("\n - ")); } trigger = buildTrigger(name, ast); this._triggerCache[cacheKey] = trigger; } this._transitionEngine.registerTrigger(namespaceId, name, trigger); }; /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ AnimationEngine.prototype.register = /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ function (namespaceId, hostElement) { this._transitionEngine.register(namespaceId, hostElement); }; /** * @param {?} namespaceId * @param {?} context * @return {?} */ AnimationEngine.prototype.destroy = /** * @param {?} namespaceId * @param {?} context * @return {?} */ function (namespaceId, context) { this._transitionEngine.destroy(namespaceId, context); }; /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ AnimationEngine.prototype.onInsert = /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ function (namespaceId, element, parent, insertBefore) { this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); }; /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ AnimationEngine.prototype.onRemove = /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ function (namespaceId, element, context) { this._transitionEngine.removeNode(namespaceId, element, context); }; /** * @param {?} element * @param {?} disable * @return {?} */ AnimationEngine.prototype.disableAnimations = /** * @param {?} element * @param {?} disable * @return {?} */ function (element, disable) { this._transitionEngine.markElementAsDisabled(element, disable); }; /** * @param {?} namespaceId * @param {?} element * @param {?} property * @param {?} value * @return {?} */ AnimationEngine.prototype.process = /** * @param {?} namespaceId * @param {?} element * @param {?} property * @param {?} value * @return {?} */ function (namespaceId, element, property, value) { if (property.charAt(0) == '@') { var _a = parseTimelineCommand(property), id = _a[0], action = _a[1]; var /** @type {?} */ args = /** @type {?} */ (value); this._timelineEngine.command(id, element, action, args); } else { this._transitionEngine.trigger(namespaceId, element, property, value); } }; /** * @param {?} namespaceId * @param {?} element * @param {?} eventName * @param {?} eventPhase * @param {?} callback * @return {?} */ AnimationEngine.prototype.listen = /** * @param {?} namespaceId * @param {?} element * @param {?} eventName * @param {?} eventPhase * @param {?} callback * @return {?} */ function (namespaceId, element, eventName, eventPhase, callback) { // @@listen if (eventName.charAt(0) == '@') { var _a = parseTimelineCommand(eventName), id = _a[0], action = _a[1]; return this._timelineEngine.listen(id, element, action, callback); } return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback); }; /** * @param {?=} microtaskId * @return {?} */ AnimationEngine.prototype.flush = /** * @param {?=} microtaskId * @return {?} */ function (microtaskId) { if (microtaskId === void 0) { microtaskId = -1; } this._transitionEngine.flush(microtaskId); }; Object.defineProperty(AnimationEngine.prototype, "players", { get: /** * @return {?} */ function () { return (/** @type {?} */ (this._transitionEngine.players)) .concat(/** @type {?} */ (this._timelineEngine.players)); }, enumerable: true, configurable: true }); /** * @return {?} */ AnimationEngine.prototype.whenRenderingDone = /** * @return {?} */ function () { return this._transitionEngine.whenRenderingDone(); }; return AnimationEngine; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var WebAnimationsPlayer = (function () { function WebAnimationsPlayer(element, keyframes, options, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } var _this = this; this.element = element; this.keyframes = keyframes; this.options = options; this.previousPlayers = previousPlayers; this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._initialized = false; this._finished = false; this._started = false; this._destroyed = false; this.time = 0; this.parentPlayer = null; this.previousStyles = {}; this.currentSnapshot = {}; this._duration = /** @type {?} */ (options['duration']); this._delay = /** @type {?} */ (options['delay']) || 0; this.time = this._duration + this._delay; if (allowPreviousPlayerStylesMerge(this._duration, this._delay)) { previousPlayers.forEach(function (player) { var /** @type {?} */ styles = player.currentSnapshot; Object.keys(styles).forEach(function (prop) { return _this.previousStyles[prop] = styles[prop]; }); }); } } /** * @return {?} */ WebAnimationsPlayer.prototype._onFinish = /** * @return {?} */ function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; /** * @return {?} */ WebAnimationsPlayer.prototype.init = /** * @return {?} */ function () { this._buildPlayer(); this._preparePlayerBeforeStart(); }; /** * @return {?} */ WebAnimationsPlayer.prototype._buildPlayer = /** * @return {?} */ function () { var _this = this; if (this._initialized) return; this._initialized = true; var /** @type {?} */ keyframes = this.keyframes.map(function (styles) { return copyStyles(styles, false); }); var /** @type {?} */ previousStyleProps = Object.keys(this.previousStyles); if (previousStyleProps.length) { var /** @type {?} */ startingKeyframe_1 = keyframes[0]; var /** @type {?} */ missingStyleProps_1 = []; previousStyleProps.forEach(function (prop) { if (!startingKeyframe_1.hasOwnProperty(prop)) { missingStyleProps_1.push(prop); } startingKeyframe_1[prop] = _this.previousStyles[prop]; }); if (missingStyleProps_1.length) { var /** @type {?} */ self_1 = this; var _loop_1 = function () { var /** @type {?} */ kf = keyframes[i]; missingStyleProps_1.forEach(function (prop) { kf[prop] = _computeStyle(self_1.element, prop); }); }; // tslint:disable-next-line for (var /** @type {?} */ i = 1; i < keyframes.length; i++) { _loop_1(); } } } (/** @type {?} */ (this)).domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options); this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {}; this.domPlayer.addEventListener('finish', function () { return _this._onFinish(); }); }; /** * @return {?} */ WebAnimationsPlayer.prototype._preparePlayerBeforeStart = /** * @return {?} */ function () { // this is required so that the player doesn't start to animate right away if (this._delay) { this._resetDomPlayerState(); } else { this.domPlayer.pause(); } }; /** @internal */ /** * \@internal * @param {?} element * @param {?} keyframes * @param {?} options * @return {?} */ WebAnimationsPlayer.prototype._triggerWebAnimation = /** * \@internal * @param {?} element * @param {?} keyframes * @param {?} options * @return {?} */ function (element, keyframes, options) { // jscompiler doesn't seem to know animate is a native property because it's not fully // supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929] return /** @type {?} */ (element['animate'](keyframes, options)); }; /** * @param {?} fn * @return {?} */ WebAnimationsPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { this._onStartFns.push(fn); }; /** * @param {?} fn * @return {?} */ WebAnimationsPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ WebAnimationsPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ WebAnimationsPlayer.prototype.play = /** * @return {?} */ function () { this._buildPlayer(); if (!this.hasStarted()) { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; this._started = true; } this.domPlayer.play(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.pause = /** * @return {?} */ function () { this.init(); this.domPlayer.pause(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.finish = /** * @return {?} */ function () { this.init(); this._onFinish(); this.domPlayer.finish(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.reset = /** * @return {?} */ function () { this._resetDomPlayerState(); this._destroyed = false; this._finished = false; this._started = false; }; /** * @return {?} */ WebAnimationsPlayer.prototype._resetDomPlayerState = /** * @return {?} */ function () { if (this.domPlayer) { this.domPlayer.cancel(); } }; /** * @return {?} */ WebAnimationsPlayer.prototype.restart = /** * @return {?} */ function () { this.reset(); this.play(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this._started; }; /** * @return {?} */ WebAnimationsPlayer.prototype.destroy = /** * @return {?} */ function () { if (!this._destroyed) { this._destroyed = true; this._resetDomPlayerState(); this._onFinish(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; /** * @param {?} p * @return {?} */ WebAnimationsPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { this.domPlayer.currentTime = p * this.time; }; /** * @return {?} */ WebAnimationsPlayer.prototype.getPosition = /** * @return {?} */ function () { return this.domPlayer.currentTime / this.time; }; Object.defineProperty(WebAnimationsPlayer.prototype, "totalTime", { get: /** * @return {?} */ function () { return this._delay + this._duration; }, enumerable: true, configurable: true }); /** * @return {?} */ WebAnimationsPlayer.prototype.beforeDestroy = /** * @return {?} */ function () { var _this = this; var /** @type {?} */ styles = {}; if (this.hasStarted()) { Object.keys(this._finalKeyframe).forEach(function (prop) { if (prop != 'offset') { styles[prop] = _this._finished ? _this._finalKeyframe[prop] : _computeStyle(_this.element, prop); } }); } this.currentSnapshot = styles; }; /* @internal */ /** * @param {?} phaseName * @return {?} */ WebAnimationsPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return WebAnimationsPlayer; }()); /** * @param {?} element * @param {?} prop * @return {?} */ function _computeStyle(element, prop) { return (/** @type {?} */ (window.getComputedStyle(element)))[prop]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var WebAnimationsDriver = (function () { function WebAnimationsDriver() { } /** * @param {?} prop * @return {?} */ WebAnimationsDriver.prototype.validateStyleProperty = /** * @param {?} prop * @return {?} */ function (prop) { return validateStyleProperty(prop); }; /** * @param {?} element * @param {?} selector * @return {?} */ WebAnimationsDriver.prototype.matchesElement = /** * @param {?} element * @param {?} selector * @return {?} */ function (element, selector) { return matchesElement(element, selector); }; /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ WebAnimationsDriver.prototype.containsElement = /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ function (elm1, elm2) { return containsElement(elm1, elm2); }; /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ WebAnimationsDriver.prototype.query = /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ function (element, selector, multi) { return invokeQuery(element, selector, multi); }; /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ WebAnimationsDriver.prototype.computeStyle = /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ function (element, prop, defaultValue) { return /** @type {?} */ ((/** @type {?} */ (window.getComputedStyle(element)))[prop]); }; /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ WebAnimationsDriver.prototype.animate = /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ function (element, keyframes, duration, delay, easing, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } var /** @type {?} */ fill = delay == 0 ? 'both' : 'forwards'; var /** @type {?} */ playerOptions = { duration: duration, delay: delay, fill: fill }; // we check for this to avoid having a null|undefined value be present // for the easing (which results in an error for certain browsers #9752) if (easing) { playerOptions['easing'] = easing; } var /** @type {?} */ previousWebAnimationPlayers = /** @type {?} */ (previousPlayers.filter(function (player) { return player instanceof WebAnimationsPlayer; })); return new WebAnimationsPlayer(element, keyframes, playerOptions, previousWebAnimationPlayers); }; return WebAnimationsDriver; }()); /** * @return {?} */ function supportsWebAnimations() { return typeof Element !== 'undefined' && typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all animation APIs of the animation browser package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=browser.js.map /***/ }), /***/ "../../../cdk/esm5/a11y.es5.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export FocusTrapDirective */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ActiveDescendantKeyManager; }); /* unused harmony export MESSAGES_CONTAINER_ID */ /* unused harmony export CDK_DESCRIBEDBY_ID_PREFIX */ /* unused harmony export CDK_DESCRIBEDBY_HOST_ATTRIBUTE */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return AriaDescriber; }); /* unused harmony export ARIA_DESCRIBER_PROVIDER_FACTORY */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ARIA_DESCRIBER_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return isFakeMousedownFromScreenReader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return FocusKeyManager; }); /* unused harmony export FocusTrap */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return FocusTrapFactory; }); /* unused harmony export FocusTrapDeprecatedDirective */ /* unused harmony export CdkTrapFocus */ /* unused harmony export InteractivityChecker */ /* unused harmony export ListKeyManager */ /* unused harmony export LIVE_ANNOUNCER_ELEMENT_TOKEN */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return LiveAnnouncer; }); /* unused harmony export LIVE_ANNOUNCER_PROVIDER_FACTORY */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return LIVE_ANNOUNCER_PROVIDER; }); /* unused harmony export TOUCH_BUFFER_MS */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return FocusMonitor; }); /* unused harmony export CdkMonitorFocus */ /* unused harmony export FOCUS_MONITOR_PROVIDER_FACTORY */ /* unused harmony export FOCUS_MONITOR_PROVIDER */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return A11yModule; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("../../../core/esm5/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_cdk_coercion__ = __webpack_require__("../../../cdk/esm5/coercion.es5.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operators_take__ = __webpack_require__("../../../../rxjs/_esm5/operators/take.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_cdk_platform__ = __webpack_require__("../../../cdk/esm5/platform.es5.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_common__ = __webpack_require__("../../../common/esm5/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_tslib__ = __webpack_require__("../../../../tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_Subject__ = __webpack_require__("../../../../rxjs/_esm5/Subject.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_Subscription__ = __webpack_require__("../../../../rxjs/_esm5/Subscription.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__angular_cdk_keycodes__ = __webpack_require__("../../../cdk/esm5/keycodes.es5.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_rxjs_operators_debounceTime__ = __webpack_require__("../../../../rxjs/_esm5/operators/debounceTime.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_rxjs_operators_filter__ = __webpack_require__("../../../../rxjs/_esm5/operators/filter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_rxjs_operators_map__ = __webpack_require__("../../../../rxjs/_esm5/operators/map.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_rxjs_operators_tap__ = __webpack_require__("../../../../rxjs/_esm5/operators/tap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_rxjs_observable_of__ = __webpack_require__("../../../../rxjs/_esm5/observable/of.js"); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Utility for checking the interactivity of an element, such as whether is is focusable or * tabbable. */ var InteractivityChecker = (function () { function InteractivityChecker(_platform) { this._platform = _platform; } /** * Gets whether an element is disabled. * * @param element Element to be checked. * @returns Whether the element is disabled. */ /** * Gets whether an element is disabled. * * @param {?} element Element to be checked. * @return {?} Whether the element is disabled. */ InteractivityChecker.prototype.isDisabled = /** * Gets whether an element is disabled. * * @param {?} element Element to be checked. * @return {?} Whether the element is disabled. */ function (element) { // This does not capture some cases, such as a non-form control with a disabled attribute or // a form control inside of a disabled form, but should capture the most common cases. return element.hasAttribute('disabled'); }; /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. * * @returns Whether the element is visible. */ /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. * * @param {?} element * @return {?} Whether the element is visible. */ InteractivityChecker.prototype.isVisible = /** * Gets whether an element is visible for the purposes of interactivity. * * This will capture states like `display: none` and `visibility: hidden`, but not things like * being clipped by an `overflow: hidden` parent or being outside the viewport. * * @param {?} element * @return {?} Whether the element is visible. */ function (element) { return hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; }; /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. * * @param element Element to be checked. * @returns Whether the element is tabbable. */ /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. * * @param {?} element Element to be checked. * @return {?} Whether the element is tabbable. */ InteractivityChecker.prototype.isTabbable = /** * Gets whether an element can be reached via Tab key. * Assumes that the element has already been checked with isFocusable. * * @param {?} element Element to be checked. * @return {?} Whether the element is tabbable. */ function (element) { // Nothing is tabbable on the the server 😎 if (!this._platform.isBrowser) { return false; } var /** @type {?} */ frameElement = /** @type {?} */ (getWindow(element).frameElement); if (frameElement) { var /** @type {?} */ frameType = frameElement && frameElement.nodeName.toLowerCase(); // Frame elements inherit their tabindex onto all child elements. if (getTabIndexValue(frameElement) === -1) { return false; } // Webkit and Blink consider anything inside of an element as non-tabbable. if ((this._platform.BLINK || this._platform.WEBKIT) && frameType === 'object') { return false; } // Webkit and Blink disable tabbing to an element inside of an invisible frame. if ((this._platform.BLINK || this._platform.WEBKIT) && !this.isVisible(frameElement)) { return false; } } var /** @type {?} */ nodeName = element.nodeName.toLowerCase(); var /** @type {?} */ tabIndexValue = getTabIndexValue(element); if (element.hasAttribute('contenteditable')) { return tabIndexValue !== -1; } if (nodeName === 'iframe') { // The frames may be tabbable depending on content, but it's not possibly to reliably // investigate the content of the frames. return false; } if (nodeName === 'audio') { if (!element.hasAttribute('controls')) { // By default an