/******/ (function(modules) { // webpackBootstrap /******/ // install a JSONP callback for chunk loading /******/ function webpackJsonpCallback(data) { /******/ var chunkIds = data[0]; /******/ var moreModules = data[1]; /******/ /******/ /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0, resolves = []; /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ resolves.push(installedChunks[chunkId][0]); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ for(moduleId in moreModules) { /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { /******/ modules[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(parentJsonpFunction) parentJsonpFunction(data); /******/ /******/ while(resolves.length) { /******/ resolves.shift()(); /******/ } /******/ /******/ }; /******/ /******/ /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "/js/app": 0 /******/ }; /******/ /******/ /******/ /******/ // script path function /******/ function jsonpScriptSrc(chunkId) { /******/ return __webpack_require__.p + "js/chunks/" + ({}[chunkId]||chunkId) + ".js?id=" + {"0":"13c35861eb9ac0fc0484","1":"c1a388a8f1322a4e8192"}[chunkId] + "" /******/ } /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // This file contains only the entry chunk. /******/ // The chunk loading function for additional chunks /******/ __webpack_require__.e = function requireEnsure(chunkId) { /******/ var promises = []; /******/ /******/ /******/ // JSONP chunk loading for javascript /******/ /******/ var installedChunkData = installedChunks[chunkId]; /******/ if(installedChunkData !== 0) { // 0 means "already installed". /******/ /******/ // a Promise means "currently loading". /******/ if(installedChunkData) { /******/ promises.push(installedChunkData[2]); /******/ } else { /******/ // setup Promise in chunk cache /******/ var promise = new Promise(function(resolve, reject) { /******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; /******/ }); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading /******/ var script = document.createElement('script'); /******/ var onScriptComplete; /******/ /******/ script.charset = 'utf-8'; /******/ script.timeout = 120; /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } /******/ script.src = jsonpScriptSrc(chunkId); /******/ /******/ // create error before stack unwound to get useful stacktrace later /******/ var error = new Error(); /******/ onScriptComplete = function (event) { /******/ // avoid mem leaks in IE. /******/ script.onerror = script.onload = null; /******/ clearTimeout(timeout); /******/ var chunk = installedChunks[chunkId]; /******/ if(chunk !== 0) { /******/ if(chunk) { /******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type); /******/ var realSrc = event && event.target && event.target.src; /******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'; /******/ error.name = 'ChunkLoadError'; /******/ error.type = errorType; /******/ error.request = realSrc; /******/ chunk[1](error); /******/ } /******/ installedChunks[chunkId] = undefined; /******/ } /******/ }; /******/ var timeout = setTimeout(function(){ /******/ onScriptComplete({ type: 'timeout', target: script }); /******/ }, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ document.head.appendChild(script); /******/ } /******/ } /******/ return Promise.all(promises); /******/ }; /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/"; /******/ /******/ // on error function for async loading /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); /******/ jsonpArray.push = webpackJsonpCallback; /******/ jsonpArray = jsonpArray.slice(); /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); /******/ var parentJsonpFunction = oldJsonpFunction; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/@opentok/client/dist/js/opentok.js": /*!*********************************************************!*\ !*** ./node_modules/@opentok/client/dist/js/opentok.js ***! \*********************************************************/ /*! no static exports found */ /*! all exports used */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * @license OpenTok.js 2.17.3 32ce4158c * * Copyright (c) 2010-2020 TokBox, Inc. * Subject to the applicable Software Development Kit (SDK) License Agreement: * https://tokbox.com/support/sdk_license * * Date: Thu, 28 May 2020 09:27:20 GMT */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else {} })(window, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 309); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ (function (global, factory) { true ? module.exports = factory() : undefined; }(this, (function () { 'use strict'; function objectOrFunction(x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); } function isFunction(x) { return typeof x === 'function'; } var _isArray = void 0; if (Array.isArray) { _isArray = Array.isArray; } else { _isArray = function (x) { return Object.prototype.toString.call(x) === '[object Array]'; }; } var isArray = _isArray; var len = 0; var vertxNext = void 0; var customSchedulerFn = void 0; var asap = function asap(callback, arg) { queue[len] = callback; queue[len + 1] = arg; len += 2; if (len === 2) { // If len is 2, that means that we need to schedule an async flush. // If additional callbacks are queued before the queue is flushed, they // will be processed by this flush that we are scheduling. if (customSchedulerFn) { customSchedulerFn(flush); } else { scheduleFlush(); } } }; function setScheduler(scheduleFn) { customSchedulerFn = scheduleFn; } function setAsap(asapFn) { asap = asapFn; } var browserWindow = typeof window !== 'undefined' ? window : undefined; var browserGlobal = browserWindow || {}; var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; // test for web worker but not in IE10 var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; // node function useNextTick() { // node version 0.10.x displays a deprecation warning when nextTick is used recursively // see https://github.com/cujojs/when/issues/410 for details return function () { return process.nextTick(flush); }; } // vertx function useVertxTimer() { if (typeof vertxNext !== 'undefined') { return function () { vertxNext(flush); }; } return useSetTimeout(); } function useMutationObserver() { var iterations = 0; var observer = new BrowserMutationObserver(flush); var node = document.createTextNode(''); observer.observe(node, { characterData: true }); return function () { node.data = iterations = ++iterations % 2; }; } // web worker function useMessageChannel() { var channel = new MessageChannel(); channel.port1.onmessage = flush; return function () { return channel.port2.postMessage(0); }; } function useSetTimeout() { // Store setTimeout reference so es6-promise will be unaffected by // other code modifying setTimeout (like sinon.useFakeTimers()) var globalSetTimeout = setTimeout; return function () { return globalSetTimeout(flush, 1); }; } var queue = new Array(1000); function flush() { for (var i = 0; i < len; i += 2) { var callback = queue[i]; var arg = queue[i + 1]; callback(arg); queue[i] = undefined; queue[i + 1] = undefined; } len = 0; } function attemptVertx() { try { var vertx = Function('return this')().require('vertx'); vertxNext = vertx.runOnLoop || vertx.runOnContext; return useVertxTimer(); } catch (e) { return useSetTimeout(); } } var scheduleFlush = void 0; // Decide what async method to use to triggering processing of queued callbacks: if (isNode) { scheduleFlush = useNextTick(); } else if (BrowserMutationObserver) { scheduleFlush = useMutationObserver(); } else if (isWorker) { scheduleFlush = useMessageChannel(); } else if (browserWindow === undefined && "function" === 'function') { scheduleFlush = attemptVertx(); } else { scheduleFlush = useSetTimeout(); } function then(onFulfillment, onRejection) { var parent = this; var child = new this.constructor(noop); if (child[PROMISE_ID] === undefined) { makePromise(child); } var _state = parent._state; if (_state) { var callback = arguments[_state - 1]; asap(function () { return invokeCallback(_state, child, callback, parent._result); }); } else { subscribe(parent, child, onFulfillment, onRejection); } return child; } /** `Promise.resolve` returns a promise that will become resolved with the passed `value`. It is shorthand for the following: ```javascript let promise = new Promise(function(resolve, reject){ resolve(1); }); promise.then(function(value){ // value === 1 }); ``` Instead of writing the above, your code now simply becomes the following: ```javascript let promise = Promise.resolve(1); promise.then(function(value){ // value === 1 }); ``` @method resolve @static @param {Any} value value that the returned promise will be resolved with Useful for tooling. @return {Promise} a promise that will become fulfilled with the given `value` */ function resolve$1(object) { /*jshint validthis:true */ var Constructor = this; if (object && typeof object === 'object' && object.constructor === Constructor) { return object; } var promise = new Constructor(noop); resolve(promise, object); return promise; } var PROMISE_ID = Math.random().toString(36).substring(2); function noop() {} var PENDING = void 0; var FULFILLED = 1; var REJECTED = 2; function selfFulfillment() { return new TypeError("You cannot resolve a promise with itself"); } function cannotReturnOwn() { return new TypeError('A promises callback cannot return that same promise.'); } function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { try { then$$1.call(value, fulfillmentHandler, rejectionHandler); } catch (e) { return e; } } function handleForeignThenable(promise, thenable, then$$1) { asap(function (promise) { var sealed = false; var error = tryThen(then$$1, thenable, function (value) { if (sealed) { return; } sealed = true; if (thenable !== value) { resolve(promise, value); } else { fulfill(promise, value); } }, function (reason) { if (sealed) { return; } sealed = true; reject(promise, reason); }, 'Settle: ' + (promise._label || ' unknown promise')); if (!sealed && error) { sealed = true; reject(promise, error); } }, promise); } function handleOwnThenable(promise, thenable) { if (thenable._state === FULFILLED) { fulfill(promise, thenable._result); } else if (thenable._state === REJECTED) { reject(promise, thenable._result); } else { subscribe(thenable, undefined, function (value) { return resolve(promise, value); }, function (reason) { return reject(promise, reason); }); } } function handleMaybeThenable(promise, maybeThenable, then$$1) { if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { handleOwnThenable(promise, maybeThenable); } else { if (then$$1 === undefined) { fulfill(promise, maybeThenable); } else if (isFunction(then$$1)) { handleForeignThenable(promise, maybeThenable, then$$1); } else { fulfill(promise, maybeThenable); } } } function resolve(promise, value) { if (promise === value) { reject(promise, selfFulfillment()); } else if (objectOrFunction(value)) { var then$$1 = void 0; try { then$$1 = value.then; } catch (error) { reject(promise, error); return; } handleMaybeThenable(promise, value, then$$1); } else { fulfill(promise, value); } } function publishRejection(promise) { if (promise._onerror) { promise._onerror(promise._result); } publish(promise); } function fulfill(promise, value) { if (promise._state !== PENDING) { return; } promise._result = value; promise._state = FULFILLED; if (promise._subscribers.length !== 0) { asap(publish, promise); } } function reject(promise, reason) { if (promise._state !== PENDING) { return; } promise._state = REJECTED; promise._result = reason; asap(publishRejection, promise); } function subscribe(parent, child, onFulfillment, onRejection) { var _subscribers = parent._subscribers; var length = _subscribers.length; parent._onerror = null; _subscribers[length] = child; _subscribers[length + FULFILLED] = onFulfillment; _subscribers[length + REJECTED] = onRejection; if (length === 0 && parent._state) { asap(publish, parent); } } function publish(promise) { var subscribers = promise._subscribers; var settled = promise._state; if (subscribers.length === 0) { return; } var child = void 0, callback = void 0, detail = promise._result; for (var i = 0; i < subscribers.length; i += 3) { child = subscribers[i]; callback = subscribers[i + settled]; if (child) { invokeCallback(settled, child, callback, detail); } else { callback(detail); } } promise._subscribers.length = 0; } function invokeCallback(settled, promise, callback, detail) { var hasCallback = isFunction(callback), value = void 0, error = void 0, succeeded = true; if (hasCallback) { try { value = callback(detail); } catch (e) { succeeded = false; error = e; } if (promise === value) { reject(promise, cannotReturnOwn()); return; } } else { value = detail; } if (promise._state !== PENDING) { // noop } else if (hasCallback && succeeded) { resolve(promise, value); } else if (succeeded === false) { reject(promise, error); } else if (settled === FULFILLED) { fulfill(promise, value); } else if (settled === REJECTED) { reject(promise, value); } } function initializePromise(promise, resolver) { try { resolver(function resolvePromise(value) { resolve(promise, value); }, function rejectPromise(reason) { reject(promise, reason); }); } catch (e) { reject(promise, e); } } var id = 0; function nextId() { return id++; } function makePromise(promise) { promise[PROMISE_ID] = id++; promise._state = undefined; promise._result = undefined; promise._subscribers = []; } function validationError() { return new Error('Array Methods must be provided an Array'); } var Enumerator = function () { function Enumerator(Constructor, input) { this._instanceConstructor = Constructor; this.promise = new Constructor(noop); if (!this.promise[PROMISE_ID]) { makePromise(this.promise); } if (isArray(input)) { this.length = input.length; this._remaining = input.length; this._result = new Array(this.length); if (this.length === 0) { fulfill(this.promise, this._result); } else { this.length = this.length || 0; this._enumerate(input); if (this._remaining === 0) { fulfill(this.promise, this._result); } } } else { reject(this.promise, validationError()); } } Enumerator.prototype._enumerate = function _enumerate(input) { for (var i = 0; this._state === PENDING && i < input.length; i++) { this._eachEntry(input[i], i); } }; Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { var c = this._instanceConstructor; var resolve$$1 = c.resolve; if (resolve$$1 === resolve$1) { var _then = void 0; var error = void 0; var didError = false; try { _then = entry.then; } catch (e) { didError = true; error = e; } if (_then === then && entry._state !== PENDING) { this._settledAt(entry._state, i, entry._result); } else if (typeof _then !== 'function') { this._remaining--; this._result[i] = entry; } else if (c === Promise$1) { var promise = new c(noop); if (didError) { reject(promise, error); } else { handleMaybeThenable(promise, entry, _then); } this._willSettleAt(promise, i); } else { this._willSettleAt(new c(function (resolve$$1) { return resolve$$1(entry); }), i); } } else { this._willSettleAt(resolve$$1(entry), i); } }; Enumerator.prototype._settledAt = function _settledAt(state, i, value) { var promise = this.promise; if (promise._state === PENDING) { this._remaining--; if (state === REJECTED) { reject(promise, value); } else { this._result[i] = value; } } if (this._remaining === 0) { fulfill(promise, this._result); } }; Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { var enumerator = this; subscribe(promise, undefined, function (value) { return enumerator._settledAt(FULFILLED, i, value); }, function (reason) { return enumerator._settledAt(REJECTED, i, reason); }); }; return Enumerator; }(); /** `Promise.all` accepts an array of promises, and returns a new promise which is fulfilled with an array of fulfillment values for the passed promises, or rejected with the reason of the first passed promise to be rejected. It casts all elements of the passed iterable to promises as it runs this algorithm. Example: ```javascript let promise1 = resolve(1); let promise2 = resolve(2); let promise3 = resolve(3); let promises = [ promise1, promise2, promise3 ]; Promise.all(promises).then(function(array){ // The array here would be [ 1, 2, 3 ]; }); ``` If any of the `promises` given to `all` are rejected, the first promise that is rejected will be given as an argument to the returned promises's rejection handler. For example: Example: ```javascript let promise1 = resolve(1); let promise2 = reject(new Error("2")); let promise3 = reject(new Error("3")); let promises = [ promise1, promise2, promise3 ]; Promise.all(promises).then(function(array){ // Code here never runs because there are rejected promises! }, function(error) { // error.message === "2" }); ``` @method all @static @param {Array} entries array of promises @param {String} label optional string for labeling the promise. Useful for tooling. @return {Promise} promise that is fulfilled when all `promises` have been fulfilled, or rejected if any of them become rejected. @static */ function all(entries) { return new Enumerator(this, entries).promise; } /** `Promise.race` returns a new promise which is settled in the same way as the first passed promise to settle. Example: ```javascript let promise1 = new Promise(function(resolve, reject){ setTimeout(function(){ resolve('promise 1'); }, 200); }); let promise2 = new Promise(function(resolve, reject){ setTimeout(function(){ resolve('promise 2'); }, 100); }); Promise.race([promise1, promise2]).then(function(result){ // result === 'promise 2' because it was resolved before promise1 // was resolved. }); ``` `Promise.race` is deterministic in that only the state of the first settled promise matters. For example, even if other promises given to the `promises` array argument are resolved, but the first settled promise has become rejected before the other promises became fulfilled, the returned promise will become rejected: ```javascript let promise1 = new Promise(function(resolve, reject){ setTimeout(function(){ resolve('promise 1'); }, 200); }); let promise2 = new Promise(function(resolve, reject){ setTimeout(function(){ reject(new Error('promise 2')); }, 100); }); Promise.race([promise1, promise2]).then(function(result){ // Code here never runs }, function(reason){ // reason.message === 'promise 2' because promise 2 became rejected before // promise 1 became fulfilled }); ``` An example real-world use case is implementing timeouts: ```javascript Promise.race([ajax('foo.json'), timeout(5000)]) ``` @method race @static @param {Array} promises array of promises to observe Useful for tooling. @return {Promise} a promise which settles in the same way as the first passed promise to settle. */ function race(entries) { /*jshint validthis:true */ var Constructor = this; if (!isArray(entries)) { return new Constructor(function (_, reject) { return reject(new TypeError('You must pass an array to race.')); }); } else { return new Constructor(function (resolve, reject) { var length = entries.length; for (var i = 0; i < length; i++) { Constructor.resolve(entries[i]).then(resolve, reject); } }); } } /** `Promise.reject` returns a promise rejected with the passed `reason`. It is shorthand for the following: ```javascript let promise = new Promise(function(resolve, reject){ reject(new Error('WHOOPS')); }); promise.then(function(value){ // Code here doesn't run because the promise is rejected! }, function(reason){ // reason.message === 'WHOOPS' }); ``` Instead of writing the above, your code now simply becomes the following: ```javascript let promise = Promise.reject(new Error('WHOOPS')); promise.then(function(value){ // Code here doesn't run because the promise is rejected! }, function(reason){ // reason.message === 'WHOOPS' }); ``` @method reject @static @param {Any} reason value that the returned promise will be rejected with. Useful for tooling. @return {Promise} a promise rejected with the given `reason`. */ function reject$1(reason) { /*jshint validthis:true */ var Constructor = this; var promise = new Constructor(noop); reject(promise, reason); return promise; } function needsResolver() { throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); } function needsNew() { throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); } /** Promise objects represent the eventual result of an asynchronous operation. The primary way of interacting with a promise is through its `then` method, which registers callbacks to receive either a promise's eventual value or the reason why the promise cannot be fulfilled. Terminology ----------- - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - `thenable` is an object or function that defines a `then` method. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - `exception` is a value that is thrown using the throw statement. - `reason` is a value that indicates why a promise was rejected. - `settled` the final resting state of a promise, fulfilled or rejected. A promise can be in one of three states: pending, fulfilled, or rejected. Promises that are fulfilled have a fulfillment value and are in the fulfilled state. Promises that are rejected have a rejection reason and are in the rejected state. A fulfillment value is never a thenable. Promises can also be said to *resolve* a value. If this value is also a promise, then the original promise's settled state will match the value's settled state. So a promise that *resolves* a promise that rejects will itself reject, and a promise that *resolves* a promise that fulfills will itself fulfill. Basic Usage: ------------ ```js let promise = new Promise(function(resolve, reject) { // on success resolve(value); // on failure reject(reason); }); promise.then(function(value) { // on fulfillment }, function(reason) { // on rejection }); ``` Advanced Usage: --------------- Promises shine when abstracting away asynchronous interactions such as `XMLHttpRequest`s. ```js function getJSON(url) { return new Promise(function(resolve, reject){ let xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.onreadystatechange = handler; xhr.responseType = 'json'; xhr.setRequestHeader('Accept', 'application/json'); xhr.send(); function handler() { if (this.readyState === this.DONE) { if (this.status === 200) { resolve(this.response); } else { reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); } } }; }); } getJSON('/posts.json').then(function(json) { // on fulfillment }, function(reason) { // on rejection }); ``` Unlike callbacks, promises are great composable primitives. ```js Promise.all([ getJSON('/posts'), getJSON('/comments') ]).then(function(values){ values[0] // => postsJSON values[1] // => commentsJSON return values; }); ``` @class Promise @param {Function} resolver Useful for tooling. @constructor */ var Promise$1 = function () { function Promise(resolver) { this[PROMISE_ID] = nextId(); this._result = this._state = undefined; this._subscribers = []; if (noop !== resolver) { typeof resolver !== 'function' && needsResolver(); this instanceof Promise ? initializePromise(this, resolver) : needsNew(); } } /** The primary way of interacting with a promise is through its `then` method, which registers callbacks to receive either a promise's eventual value or the reason why the promise cannot be fulfilled. ```js findUser().then(function(user){ // user is available }, function(reason){ // user is unavailable, and you are given the reason why }); ``` Chaining -------- The return value of `then` is itself a promise. This second, 'downstream' promise is resolved with the return value of the first promise's fulfillment or rejection handler, or rejected if the handler throws an exception. ```js findUser().then(function (user) { return user.name; }, function (reason) { return 'default name'; }).then(function (userName) { // If `findUser` fulfilled, `userName` will be the user's name, otherwise it // will be `'default name'` }); findUser().then(function (user) { throw new Error('Found user, but still unhappy'); }, function (reason) { throw new Error('`findUser` rejected and we're unhappy'); }).then(function (value) { // never reached }, function (reason) { // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. }); ``` If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. ```js findUser().then(function (user) { throw new PedagogicalException('Upstream error'); }).then(function (value) { // never reached }).then(function (value) { // never reached }, function (reason) { // The `PedgagocialException` is propagated all the way down to here }); ``` Assimilation ------------ Sometimes the value you want to propagate to a downstream promise can only be retrieved asynchronously. This can be achieved by returning a promise in the fulfillment or rejection handler. The downstream promise will then be pending until the returned promise is settled. This is called *assimilation*. ```js findUser().then(function (user) { return findCommentsByAuthor(user); }).then(function (comments) { // The user's comments are now available }); ``` If the assimliated promise rejects, then the downstream promise will also reject. ```js findUser().then(function (user) { return findCommentsByAuthor(user); }).then(function (comments) { // If `findCommentsByAuthor` fulfills, we'll have the value here }, function (reason) { // If `findCommentsByAuthor` rejects, we'll have the reason here }); ``` Simple Example -------------- Synchronous Example ```javascript let result; try { result = findResult(); // success } catch(reason) { // failure } ``` Errback Example ```js findResult(function(result, err){ if (err) { // failure } else { // success } }); ``` Promise Example; ```javascript findResult().then(function(result){ // success }, function(reason){ // failure }); ``` Advanced Example -------------- Synchronous Example ```javascript let author, books; try { author = findAuthor(); books = findBooksByAuthor(author); // success } catch(reason) { // failure } ``` Errback Example ```js function foundBooks(books) { } function failure(reason) { } findAuthor(function(author, err){ if (err) { failure(err); // failure } else { try { findBoooksByAuthor(author, function(books, err) { if (err) { failure(err); } else { try { foundBooks(books); } catch(reason) { failure(reason); } } }); } catch(error) { failure(err); } // success } }); ``` Promise Example; ```javascript findAuthor(). then(findBooksByAuthor). then(function(books){ // found books }).catch(function(reason){ // something went wrong }); ``` @method then @param {Function} onFulfilled @param {Function} onRejected Useful for tooling. @return {Promise} */ /** `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same as the catch block of a try/catch statement. ```js function findAuthor(){ throw new Error('couldn't find that author'); } // synchronous try { findAuthor(); } catch(reason) { // something went wrong } // async with promises findAuthor().catch(function(reason){ // something went wrong }); ``` @method catch @param {Function} onRejection Useful for tooling. @return {Promise} */ Promise.prototype.catch = function _catch(onRejection) { return this.then(null, onRejection); }; /** `finally` will be invoked regardless of the promise's fate just as native try/catch/finally behaves Synchronous example: ```js findAuthor() { if (Math.random() > 0.5) { throw new Error(); } return new Author(); } try { return findAuthor(); // succeed or fail } catch(error) { return findOtherAuther(); } finally { // always runs // doesn't affect the return value } ``` Asynchronous example: ```js findAuthor().catch(function(reason){ return findOtherAuther(); }).finally(function(){ // author was either found, or not }); ``` @method finally @param {Function} callback @return {Promise} */ Promise.prototype.finally = function _finally(callback) { var promise = this; var constructor = promise.constructor; if (isFunction(callback)) { return promise.then(function (value) { return constructor.resolve(callback()).then(function () { return value; }); }, function (reason) { return constructor.resolve(callback()).then(function () { throw reason; }); }); } return promise.then(callback, callback); }; return Promise; }(); Promise$1.prototype.then = then; Promise$1.all = all; Promise$1.race = race; Promise$1.resolve = resolve$1; Promise$1.reject = reject$1; Promise$1._setScheduler = setScheduler; Promise$1._setAsap = setAsap; Promise$1._asap = asap; /*global self*/ function polyfill() { var local = void 0; if (typeof (typeof window !== undefined ? window : global) !== 'undefined') { local = (typeof window !== undefined ? window : global); } else if (typeof self !== 'undefined') { local = self; } else { try { local = Function('return this')(); } catch (e) { throw new Error('polyfill failed because global object is unavailable in this environment'); } } var P = local.Promise; if (P) { var promiseToString = null; try { promiseToString = Object.prototype.toString.call(P.resolve()); } catch (e) { // silently ignored } if (promiseToString === '[object Promise]' && !P.cast) { return; } } local.Promise = Promise$1; } // Strange compat.. Promise$1.polyfill = polyfill; Promise$1.Promise = Promise$1; return Promise$1; }))); //# sourceMappingURL=es6-promise.map /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(67))) /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const debug = __webpack_require__(449); const memoize = __webpack_require__(215); const logLevels = __webpack_require__(127); /** * @typedef {Object} Logger * @property {Function} error * @property {Function} warn * @property {Function} info * @property {Function} log * @property {Function} debug * @property {Function} spam */ const createLogger = memoize(namespace => { /** @type Logger */ const API = {}; const setMethods = () => { Object.keys(logLevels).forEach(name => { const method = logLevels[name].method; const log = debug("OpenTok:" + namespace + ":" + name.toLowerCase()); log.log = console[method].bind(console); API[name.toLowerCase()] = log; }); }; setMethods(); return API; }); createLogger.setLogLevel = level => { let oldRules; try { oldRules = (typeof window !== undefined ? window : global).localStorage.debug; } catch (err) { // will get Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': // The document is sandboxed and lacks the 'allow-same-origin' flag. oldRules = ''; } const newDebugRules = Object.keys(logLevels).map(name => (level >= logLevels[name].priority ? '' : '-') + "(autogen)?OpenTok:*:" + name.toLowerCase()); const debugStr = [...newDebugRules, ...(oldRules || '').split(/[\s,]/).filter(rule => rule.indexOf('(autogen)?') === -1)].filter(x => x).join(','); debug.enable(debugStr); }; module.exports = createLogger; /***/ }), /* 2 */ /***/ (function(module, exports) { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = _interopRequireDefault; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { /* * Environment details * * Contains information about the current environment. * * @property name The name of the Environment (Chrome, FF, Node, etc) * @property version Usually a Float, except in Node which uses a String * @property userAgent The raw user agent * */ const env = { version: -1, // @todo why is the default -1? name: 'unknown' }; if (process && process.versions && typeof process.versions.node === 'string') { env.name = 'Node'; env.isNode = true; env.version = parseInt(process.versions.node, 10); env.userAgent = env.name + " " + env.version; } else { env.userAgent = (typeof window !== undefined ? window : global).navigator.userAgent.toLowerCase(); // @todo why lowercase? env.appName = (typeof window !== undefined ? window : global).navigator.appName; env.navigatorVendor = undefined; env.name = 'unknown'; if (env.userAgent.indexOf('opera') > -1 || env.userAgent.indexOf('opr/') > -1) { env.name = 'Opera'; env.isOpera = true; if (/opr\/([0-9]{1,}[.0-9]{0,})/.exec(env.userAgent) !== null) { env.version = parseFloat(RegExp.$1); } } else if (env.userAgent.indexOf('firefox') > -1) { env.name = 'Firefox'; env.isFirefox = true; if (/firefox\/([0-9]{1,}[.0-9]{0,})/.exec(env.userAgent) !== null) { env.version = parseFloat(RegExp.$1); } } else if (env.appName === 'Microsoft Internet Explorer') { // IE 10 and below env.name = 'IE'; env.isIE = true; if (/msie ([0-9]{1,}[.0-9]{0,})/.exec(env.userAgent) !== null) { env.version = parseFloat(RegExp.$1); } } else if (env.userAgent.match(/edge?\/(\d+)(?:\.\d+)+$/)) { env.name = 'Edge'; env.isEdge = true; const version = RegExp.$1; env.version = parseInt(version, 10); } else if (env.appName === 'Netscape' && env.userAgent.indexOf('trident') > -1) { // IE 11+ env.name = 'IE'; env.isIE = true; if (/trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(env.userAgent) !== null) { env.version = parseFloat(RegExp.$1); } } else if (env.userAgent.indexOf('chrome') > -1) { env.name = 'Chrome'; env.isElectron = env.userAgent.indexOf('electron/') > -1; if (!env.isElectron) { env.isChrome = true; } if (/chrome\/([0-9]{1,}[.0-9]{0,})/.exec(env.userAgent) !== null) { env.version = parseFloat(RegExp.$1); } } else if ((typeof window !== undefined ? window : global).navigator.vendor && (typeof window !== undefined ? window : global).navigator.vendor.toLowerCase().indexOf('apple') > -1) { env.name = 'Safari'; env.isSafari = true; if (/version\/([0-9]{1,}[.0-9]{0,})/.exec(env.userAgent) !== null) { env.version = parseFloat(RegExp.$1); } } // The Chromium-based Edge was released on this version env.isChromiumEdge = env.name === 'Edge' && env.version >= 79; // Prior versions ofo Edge versions were based on a proprietary, non-Chromium // code base env.isLegacyEdge = env.name === 'Edge' && env.version < 79; env.userAgent = (typeof window !== undefined ? window : global).navigator.userAgent; env.protocol = (typeof window !== undefined ? window : global).location.protocol; env.hostName = (typeof window !== undefined ? window : global).location.hostName; } module.exports = env; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(67))) /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable no-underscore-dangle */ // The top-level namespace, also performs basic DOMElement selecting. // // @example Get the DOM element with the id of 'domId' // OTHelpers('#domId') // // @example Get all video elements // OTHelpers('video') // // @example Get all elements with the class name of 'foo' // OTHelpers('.foo') // // @example Get all elements with the class name of 'foo', // and do something with the first. // var collection = OTHelpers('.foo'); // console.log(collection.first); // // // The second argument is the context, that is document or parent Element, to // select from. // // @example Get a video element within the element with the id of 'domId' // OTHelpers('video', OTHelpers('#domId')) // // // // OTHelpers will accept any of the following and return a collection: // OTHelpers() // OTHelpers('css selector', optionalParentNode) // OTHelpers(DomNode) // OTHelpers([array of DomNode]) // // The collection is a ElementCollection object, see the ElementCollection docs for usage info. // const OTHelpers = __webpack_require__(221); const setDeprecatedProperty = __webpack_require__(223); const eventing = __webpack_require__(5); const log = __webpack_require__(1); OTHelpers.logging = log('OT.$'); OTHelpers.ElementCollection = __webpack_require__(222); OTHelpers.env = __webpack_require__(3); OTHelpers.ajax = __webpack_require__(236); OTHelpers.statable = __webpack_require__(513); OTHelpers.Analytics = __webpack_require__(238); OTHelpers.Collection = __webpack_require__(241); OTHelpers.domExtras = __webpack_require__(517); OTHelpers.Error = __webpack_require__(242); setDeprecatedProperty(OTHelpers, 'useLogHelpers', { value(mixin) { const logging = log('useLogHelpersDeprecatedMixin'); // eslint-disable-next-line no-param-reassign Object.keys(logging).forEach(key => { mixin[key] = logging[key]; }); return mixin; }, name: 'OT.useLogHelpers', getWarning: 'Please use an external library for your debugging needs' }); OTHelpers.defaults = __webpack_require__(133); setDeprecatedProperty(OTHelpers, 'eventing', { value: eventing, name: 'OT.$.eventing', getWarning: 'Please use an external library to create an event emitter.' }); // TODO: Remove the need for this kind of bazzadry. Object.keys(OTHelpers).forEach(key => { const component = OTHelpers[key]; const attachments = component._attachToOTHelpers || {}; Object.keys(attachments).forEach(attachmentName => { if (Object.hasOwnProperty.call(OTHelpers, attachmentName) && !(key === 'util' && attachmentName === 'bind')) { console.warn("More than one module is trying to define " + attachmentName + " on OTHelpers."); } OTHelpers[attachmentName] = attachments[attachmentName]; }); }); module.exports = OTHelpers; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const Events = __webpack_require__(43); const isFunction = __webpack_require__(13); const logging = __webpack_require__(1)('Events'); const assign = __webpack_require__(6); const weakMemoizeBind = __webpack_require__(463); /** * This base class defines the on, once, and off * methods of objects that can dispatch events. * * @class EventDispatcher */ module.exports = function eventing(self) { const ee = new Events(); ee.on('newListener', eventName => { ee.emit(eventName + ":added"); }); ee.on('removeListener', eventName => { ee.emit(eventName + ":removed"); }); const eventingMixin = { /** * Adds an event handler function for one or more events. * *

* The following code adds an event handler for one event: *

* *
     * obj.on("eventName", function (event) {
     *     // This is the event handler.
     * });
     * 
* *

If you pass in multiple event names and a handler method, the handler is * registered for each of those events:

* *
     * obj.on("eventName1 eventName2",
     *        function (event) {
     *            // This is the event handler.
     *        });
     * 
* *

You can also pass in a third context parameter (which is optional) to * define the value of this in the handler method:

* *
obj.on("eventName",
     *        function (event) {
     *            // This is the event handler.
     *        },
     *        obj);
     * 
* *

* The method also supports an alternate syntax, in which the first parameter is an object * that is a hash map of event names and handler functions and the second parameter (optional) * is the context for this in each handler: *

*
     * obj.on(
     *    {
     *       eventName1: function (event) {
     *               // This is the handler for eventName1.
     *           },
     *       eventName2:  function (event) {
     *               // This is the handler for eventName2.
     *           }
     *    },
     *    obj);
     * 
* *

* If you do not add a handler for an event, the event is ignored locally. *

* * @param {String} type The string identifying the type of event. You can specify multiple event * names in this string, separating them with a space. The event handler will process each of * the events. * @param {Function} handler The handler function to process the event. This function takes * the event object as a parameter. * @param {Object} context (Optional) Defines the value of this in the event * handler function. * * @returns {EventDispatcher} The EventDispatcher object. * * @memberOf EventDispatcher * @method #on * @see off() * @see once() * @see Events */ on(eventNames, handlerOrContext, context) { if (typeof eventNames === 'string' && handlerOrContext) { eventNames.split(' ').forEach(eventName => { ee.on(eventName, weakMemoizeBind(handlerOrContext, context)); }); } else { Object.keys(eventNames).forEach(eventName => { ee.on(eventName, weakMemoizeBind(eventNames[eventName], handlerOrContext)); }); } return this; }, /** * Removes an event handler or handlers. * *

If you pass in one event name and a handler method, the handler is removed for that * event:

* *
obj.off("eventName", eventHandler);
* *

If you pass in multiple event names and a handler method, the handler is removed for * those events:

* *
obj.off("eventName1 eventName2", eventHandler);
* *

If you pass in an event name (or names) and no handler method, all handlers are * removed for those events:

* *
obj.off("event1Name event2Name");
* *

If you pass in no arguments, all event handlers are removed for all events * dispatched by the object:

* *
obj.off();
* *

* The method also supports an alternate syntax, in which the first parameter is an object that * is a hash map of event names and handler functions and the second parameter (optional) is * the context for this in each handler: *

*
     * obj.off(
     *    {
     *       eventName1: event1Handler,
     *       eventName2: event2Handler
     *    });
     * 
* * @param {String} type (Optional) The string identifying the type of event. You can * use a space to specify multiple events, as in "accessAllowed accessDenied * accessDialogClosed". If you pass in no type value (or other arguments), * all event handlers are removed for the object. * @param {Function} handler (Optional) The event handler function to remove. The handler * must be the same function object as was passed into on(). Be careful with * helpers like bind() that return a new function when called. If you pass in * no handler, all event handlers are removed for the specified event * type. * @param {Object} context (Optional) If you specify a context, the event handler * is removed for all specified events and handlers that use the specified context. (The * context must match the context passed into on().) * * @returns {Object} The object that dispatched the event. * * @memberOf EventDispatcher * @method #off * @see on() * @see once() * @see Events */ off(eventNames, handlerOrContext, context) { if (typeof eventNames === 'string') { this.off(eventNames.split(' '), handlerOrContext, context); } else if (Array.isArray(eventNames)) { eventNames.forEach(eventName => { if (handlerOrContext && isFunction(handlerOrContext)) { ee.removeListener(eventName, weakMemoizeBind(handlerOrContext, context)); } else { ee.removeAllListeners(eventName); } }); } else if (!eventNames) { ee.removeAllListeners(); } else { Object.keys(eventNames).forEach(eventName => { // @todo was {foo: undefined} expected to remove all foo events? ee.removeListener(eventName, weakMemoizeBind(eventNames[eventName], handlerOrContext)); }); } return this; }, /** * Adds an event handler function for one or more events. Once the handler is called, * the specified handler method is removed as a handler for this event. (When you use * the on() method to add an event handler, the handler is not * removed when it is called.) The once() method is the equivilent of * calling the on() * method and calling off() the first time the handler is invoked. * *

* The following code adds a one-time event handler for one event: *

* *
     * obj.once("eventName", function (event) {
     *    // This is the event handler.
     * });
     * 
* *

If you pass in multiple event names and a handler method, the handler is registered * for each of those events:

* *
obj.once("eventName1 eventName2"
     *          function (event) {
     *              // This is the event handler.
     *          });
     * 
* *

You can also pass in a third context parameter (which is optional) to define * the value of * this in the handler method:

* *
obj.once("eventName",
     *          function (event) {
     *              // This is the event handler.
     *          },
     *          obj);
     * 
* *

* The method also supports an alternate syntax, in which the first parameter is an object that * is a hash map of event names and handler functions and the second parameter (optional) is the * context for this in each handler: *

*
     * obj.once(
     *    {
     *       eventName1: function (event) {
     *                  // This is the event handler for eventName1.
     *           },
     *       eventName2:  function (event) {
     *                  // This is the event handler for eventName1.
     *           }
     *    },
     *    obj);
     * 
* * @param {String} type The string identifying the type of event. You can specify multiple * event names in this string, separating them with a space. The event handler will process * the first occurence of the events. After the first event, the handler is removed (for * all specified events). * @param {Function} handler The handler function to process the event. This function takes * the event object as a parameter. * @param {Object} context (Optional) Defines the value of this in the event * handler function. * * @returns {Object} The object that dispatched the event. * * @memberOf EventDispatcher * @method #once * @see on() * @see off() * @see Events */ once(eventNames, handlerOrContext, context) { if (typeof eventNames === 'string' && handlerOrContext) { eventNames.split(' ').forEach(eventName => { ee.once(eventName, weakMemoizeBind(handlerOrContext, context)); }); } else { Object.keys(eventNames).forEach(eventName => { ee.once(eventName, weakMemoizeBind(eventNames[eventName], handlerOrContext)); }); } return this; }, /** * Execute any listeners bound to the +event+ Event. * * Each handler will be executed. * * @param [Event] event An Event object. * @return this */ dispatchEvent(event) { if (!event.type) { throw new Error('dispatchEvent: Event has no type'); } if (!event.target) { event.target = this; // eslint-disable-line no-param-reassign } this.trigger(event.type, event); return this; }, /** * Execute each handler for the event called +name+. * * Each handler will be executed, and any exceptions that they throw will * be caught and logged * * @example * foo.on('bar', function(name, message) { * alert("Hello " + name + ": " + message); * }); * * foo.trigger('OpenTok', 'asdf'); // -> Hello OpenTok: asdf * * @param {String} eventName The name of this event. * @param {Array} arguments The arguments handlers will be called with * * @return this */ trigger(eventName) { try { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } ee.emit(eventName, ...args); } catch (e) { console.error('An error occurred in an event handler', e); } return this; }, // Alias of trigger for easier node compatibility emit() { return self.trigger(...arguments); }, /** * @deprecated use on() or once() instead. *

* This method registers a method as an event listener for a specific event. *

* *

* If a handler is not registered for an event, the event is ignored locally. If the * event listener function does not exist, the event is ignored locally. *

*

* Throws an exception if the listener name is invalid. *

* * @param {String} type The string identifying the type of event. * * @param {Function} listener The function to be invoked when the object dispatches the event. * * @param {Object} context (Optional) Defines the value of this in the event * handler function. * * @memberOf EventDispatcher * @method #addEventListener * @see on() * @see once() * @see Events */ addEventListener(eventName, handler, context) { logging.warn('The addEventListener() method is deprecated. Use on() or once() instead.'); return self.on(eventName, handler, context); }, /** * @deprecated use off() instead. *

* Removes an event listener for a specific event. *

* *

* Throws an exception if the listener name is invalid. *

* * @param {String} type The string identifying the type of event. * * @param {Function} listener The event listener function to remove. * * @param {Object} context (Optional) If you specify a context, the event * handler is removed for all specified events and event listeners that use the specified context. (The context must match the context passed into * addEventListener().) * * @memberOf EventDispatcher * @method #removeEventListener * @see off() * @see Events */ // See 'off' for usage. // @depreciated will become a private helper function in the future. removeEventListener(eventName, handler, context) { logging.warn('The removeEventListener() method is deprecated. Use off() instead.'); return self.off(eventName, handler, context); }, listenerCount(eventName) { return ee.listenerCount(eventName); } }; return assign(self, eventingMixin); }; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { var assignValue = __webpack_require__(80), copyObject = __webpack_require__(38), createAssigner = __webpack_require__(224), isArrayLike = __webpack_require__(21), isPrototype = __webpack_require__(65), keys = __webpack_require__(27); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assignIn * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assign({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3 } */ var assign = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { if (hasOwnProperty.call(source, key)) { assignValue(object, key, source[key]); } } }); module.exports = assign; /***/ }), /* 7 */ /***/ (function(module, exports) { /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Note: Some of these descriptions here are more specific than the name would suggest, because we // only use them in one place. However, this shouldn't prevent us from using the error elsewhere if // the name fits, and we should update the description to be more general when this happens. module.exports = { // The API key does not match the token or session. AUTHENTICATION_ERROR: 'OT_AUTHENTICATION_ERROR', // JSON response was badly formed. BADLY_FORMED_RESPONSE: 'OT_BADLY_FORMED_RESPONSE', // Unable to publish because your browser failed to get access to your microphone. You may need to // fully quit and restart your browser to get it to work. // See https://bugs.chromium.org/p/webrtc/issues/detail?id=4799 for more details. CHROME_MICROPHONE_ACQUISITION_ERROR: 'OT_CHROME_MICROPHONE_ACQUISITION_ERROR', // Failed to connect to session. CONNECT_FAILED: 'OT_CONNECT_FAILED', // The session has exceded the maximum number of simultaneous connections. CONNECTION_LIMIT_EXCEEDED: 'OT_CONNECTION_LIMIT_EXCEEDED', // The constraints for getting user media could not be satisfied. CONSTRAINTS_NOT_SATISFIED: 'OT_CONSTRAINTS_NOT_SATISFIED', // Failed to create peer connection. CREATE_PEER_CONNECTION_FAILED: 'OT_CREATE_PEER_CONNECTION_FAILED', // Action failed due to session disconnection. DISCONNECTED: 'OT_DISCONNECTED', // Received an unexpected empty response from the server. EMPTY_RESPONSE_BODY: 'OT_EMPTY_RESPONSE_BODY', // The hardware to fulfil the user media request appears to exist but could not be acquired. It // might be in use by another application. HARDWARE_UNAVAILABLE: 'OT_HARDWARE_UNAVAILABLE', // Something went wrong while establishing WebRTC connectivity. ICE_WORKFLOW_FAILED: 'OT_ICE_WORKFLOW_FAILED', // Received an invalid HTTP status. This may be considered invalid for the endpoint only and not // HTTP in general. INVALID_HTTP_STATUS: 'OT_INVALID_HTTP_STATUS', // One or more parameters was not valid or not provided. INVALID_PARAMETER: 'OT_INVALID_PARAMETER', // The session id was invalid. INVALID_SESSION_ID: 'OT_INVALID_SESSION_ID', // The fetching of the stream for the video element has been aborted. MEDIA_ERR_ABORTED: 'OT_MEDIA_ERR_ABORTED', // A decoding error occurred while trying to play the stream in the video element. MEDIA_ERR_DECODE: 'OT_MEDIA_ERR_DECODE', // A network error caused the stream to stop being fetched. MEDIA_ERR_NETWORK: 'OT_MEDIA_ERR_NETWORK', // The stream has been detected to be not suitable for playback. MEDIA_ERR_SRC_NOT_SUPPORTED: 'OT_MEDIA_ERR_SRC_NOT_SUPPORTED', // The ended event on the video element fired MEDIA_ENDED: 'OT_MEDIA_ENDED', // No devices were found to provide the media stream. NO_DEVICES_FOUND: 'OT_NO_DEVICES_FOUND', // Video and audio was disabled. You need to enable at least one. NO_VALID_CONSTRAINTS: 'OT_NO_VALID_CONSTRAINTS', // Couldn't perform action due to not being connected. NOT_CONNECTED: 'OT_NOT_CONNECTED', // A resource was not found. NOT_FOUND: 'OT_NOT_FOUND', // Something in the user media request is not supported. NOT_SUPPORTED: 'OT_NOT_SUPPORTED', // An action was not permitted. PERMISSION_DENIED: 'OT_PERMISSION_DENIED', // The signal could not be sent due to the rate limit. RATE_LIMIT_EXCEEDED: 'OT_RATE_LIMIT_EXCEEDED', // Error calling OT.reportIssue(). Check the client\'s network connection. REPORT_ISSUE_FAILED: 'OT_REPORT_ISSUE_FAILED', // Screen-sharing support in this browser requires an extension, but the extension is not // installed. SCREEN_SHARING_EXTENSION_NOT_INSTALLED: 'OT_SCREEN_SHARING_EXTENSION_NOT_INSTALLED', // Screen-sharing support in this browser requires an extension, but one has not been registered. SCREEN_SHARING_EXTENSION_NOT_REGISTERED: 'OT_SCREEN_SHARING_EXTENSION_NOT_REGISTERED', // Screen sharing is not supported in the browser. SCREEN_SHARING_NOT_SUPPORTED: 'OT_SCREEN_SHARING_NOT_SUPPORTED', // The WebRTC connection failed during setDescription. SET_REMOTE_DESCRIPTION_FAILED: 'OT_SET_REMOTE_DESCRIPTION_FAILED', // Rumor.Socket cannot connect when it is already connecting or connected. SOCKET_ALREADY_CONNECTED_CONNECTING: 'OT_SOCKET_ALREADY_CONNECTED_CONNECTING', // A connection was closed abnormally (that is, with no close frame being sent) when a status code // is expected. SOCKET_CLOSE_ABNORMAL: 'OT_SOCKET_CLOSE_ABNORMAL', // Exception was thrown during Rumor connection, possibly because of a blocked port. SOCKET_CLOSE_CONNECT_EXCEPTION: 'OT_SOCKET_CLOSE_CONNECT_EXCEPTION', // Connectivity loss was detected as it was too long since the socket received the last PONG // message. SOCKET_CLOSE_CONNECTIVITY_LOSS: 'OT_SOCKET_CLOSE_CONNECTIVITY_LOSS', // Falling back on this error for socket close because a more suitable one was not found. SOCKET_CLOSE_FALLBACK_CODE: 'OT_SOCKET_CLOSE_FALLBACK_CODE', // An endpoint received data within a message that was not consistent with the type of the message // (e.g., non-UTF-8 [RFC3629] data within a text message) SOCKET_CLOSE_INCONSISTENT_DATA: 'OT_SOCKET_CLOSE_INCONSISTENT_DATA', // No status code was provided even though one was expected. SOCKET_CLOSE_NO_STATUS: 'OT_SOCKET_CLOSE_NO_STATUS', // An endpoint received a message that violates its policy. This is a generic status code that // can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if // there is a need to hide specific details about the policy. SOCKET_CLOSE_POLICY_VIOLATION: 'OT_SOCKET_CLOSE_POLICY_VIOLATION', // The endpoint is going away, either because of a server failure or because the browser is // navigating away from the page that opened the connection. SOCKET_CLOSE_GOING_AWAY: 'OT_SOCKET_CLOSE_GOING_AWAY', // A protocol error occurred. SOCKET_CLOSE_PROTOCOL_ERROR: 'OT_SOCKET_CLOSE_PROTOCOL_ERROR', // Timed out while waiting for the Rumor socket to connect. SOCKET_CLOSE_TIMEOUT: 'OT_SOCKET_CLOSE_TIMEOUT', // An endpoint received a message that is too big for it to process SOCKET_CLOSE_TOO_LARGE: 'OT_SOCKET_CLOSE_TOO_LARGE', // An endpoint encountered an unexpected condition that prevented it from fulfilling the request. SOCKET_CLOSE_UNEXPECTED_CONDITION: 'OT_SOCKET_CLOSE_UNEXPECTED_CONDITION', // An endpoint has indicated that reconnections are not available. SOCKET_CLOSE_UNSUPPORTED: 'OT_SOCKET_CLOSE_UNSUPPORTED', // Failed to create the stream in the server model. STREAM_CREATE_FAILED: 'OT_STREAM_CREATE_FAILED', // The stream was destroyed before it could be subscribed to. STREAM_DESTROYED: 'OT_STREAM_DESTROYED', // The session has exceded the maximum number of simultaneous streams. STREAM_LIMIT_EXCEEDED: 'OT_STREAM_LIMIT_EXCEEDED', // Couldn't subscribe to the stream because it was not found. STREAM_NOT_FOUND: 'OT_STREAM_NOT_FOUND', // Couldn't connect due to a terms of service violation. TERMS_OF_SERVICE_FAILURE: 'OT_TERMS_OF_SERVICE_FAILURE', // A timer expired while waiting for an action to occur. TIMEOUT: 'OT_TIMEOUT', // The operation was cancelled CANCEL: 'OT_CANCEL', // Generic media abort error UNABLE_TO_CAPTURE_MEDIA: 'OT_UNABLE_TO_CAPTURE_MEDIA', // Generic/ Unknown screen share error UNABLE_TO_CAPTURE_SCREEN: 'OT_UNABLE_TO_CAPTURE_SCREEN', // The error code received was unexpected. UNEXPECTED_ERROR_CODE: 'OT_UNEXPECTED_ERROR_CODE', // Received an unexpected HTTP status. UNEXPECTED_HTTP_STATUS: 'OT_UNEXPECTED_HTTP_STATUS', // An unexpected server response was received which could not be handled. UNEXPECTED_SERVER_RESPONSE: 'OT_UNEXPECTED_SERVER_RESPONSE', // An unknown anvil error occurred. UNKNOWN_HTTP_ERROR: 'OT_UNKNOWN_HTTP_ERROR', UNSUPPORTED_BROWSER: 'OT_UNSUPPORTED_BROWSER', // Access to user media was denied. USER_MEDIA_ACCESS_DENIED: 'OT_USER_MEDIA_ACCESS_DENIED', // There was a cross domain error or the server responded with invalid JSON. XDOMAIN_OR_PARSING_ERROR: 'OT_XDOMAIN_OR_PARSING_ERROR', API_KEY_DISABLED: 'OT_API_KEY_DISABLED', // There was an error when trying to get the list of supported codecs. UNABLE_TO_ACCESS_MEDIA_ENGINE: 'OT_UNABLE_TO_ACCESS_MEDIA_ENGINE' }; /***/ }), /* 9 */ /***/ (function(module, exports) { /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; module.exports = isArray; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { var freeGlobal = __webpack_require__(168); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { JS_EXCEPTION: 2000, AUTHENTICATION_ERROR: 1004, INVALID_SESSION_ID: 1005, CONNECT_FAILED: 1006, CONNECT_REJECTED: 1007, CONNECTION_TIMEOUT: 1008, NOT_CONNECTED: 1010, INVALID_PARAMETER: 1011, P2P_CONNECTION_FAILED: 1013, API_RESPONSE_FAILURE: 1014, TERMS_OF_SERVICE_FAILURE: 1026, CONNECTION_LIMIT_EXCEEDED: 1027, UNABLE_TO_PUBLISH: 1500, UNABLE_TO_SUBSCRIBE: 1501, UNSUPPORTED_VIDEO_CODEC: 1502, UNABLE_TO_FORCE_DISCONNECT: 1520, UNABLE_TO_FORCE_UNPUBLISH: 1530, PUBLISHER_ICE_WORKFLOW_FAILED: 1553, SUBSCRIBER_ICE_WORKFLOW_FAILED: 1554, STREAM_LIMIT_EXCEEDED: 1605, UNEXPECTED_SERVER_RESPONSE: 2001, REPORT_ISSUE_ERROR: 2011, ANVIL_BADLY_FORMED_RESPONSE: 3001, ANVIL_INVALID_HTTP_STATUS: 3002, ANVIL_XDOMAIN_OR_PARSING_ERROR: 3003, ANVIL_UNKNOWN_HTTP_ERROR: 3004, ANVIL_UNEXPECTED_ERROR_CODE: 3005, ANVIL_EMPTY_RESPONSE_BODY: 3006, ANVIL_CONNECT_FAILED: 3007, UNABLE_TO_ACCESS_MEDIA_ENGINE: 5001 }; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // @todo enable the following disabled rules see OPENTOK-31136 for more info /* eslint-disable no-param-reassign, global-require */ module.exports = function otErrorFactory(deps) { if (deps === void 0) { deps = {}; } const errorReporting = deps.errorReporting || __webpack_require__(185)(); const Errors = deps.Errors || __webpack_require__(8); const OTErrorClass = deps.OTErrorClass || __webpack_require__(33); const names = Object.keys(Errors).map(shortName => Errors[shortName]); return function otError(name, plainError, code) { if (names.indexOf(name) === -1) { return new Error("Attempt to use invalid error name (" + name + "). Original message: " + plainError.message); } if (!(plainError instanceof Error || /^\[object .*Error\]$/.test(Object.prototype.toString.call(plainError)))) { return new Error("Did not pass Error as second argument: " + plainError); } // OTErrorClass is the deprecated OT.Error class from the docs. const error = new OTErrorClass(undefined, plainError.message); error.name = name; if (!plainError.stack) { try { throw plainError; } catch (e) {// IE populates the error's .stack when it is thrown, nothing to do here } } error.stack = plainError.stack; if (code) { error.code = code; } errorReporting.send(error); return error; }; }; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { var baseGetTag = __webpack_require__(26), isObject = __webpack_require__(7); /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', proxyTag = '[object Proxy]'; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } module.exports = isFunction; /***/ }), /* 14 */ /***/ (function(module, exports) { /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } module.exports = isObjectLike; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { var v1 = __webpack_require__(515); var v4 = __webpack_require__(516); var uuid = v4; uuid.v1 = v1; uuid.v4 = v4; module.exports = uuid; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(187); var isBuffer = __webpack_require__(378); /*global toString:true*/ // utils is a library of generic helper functions non-specific to axios var toString = Object.prototype.toString; /** * Determine if a value is an Array * * @param {Object} val The value to test * @returns {boolean} True if value is an Array, otherwise false */ function isArray(val) { return toString.call(val) === '[object Array]'; } /** * Determine if a value is an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ function isArrayBuffer(val) { return toString.call(val) === '[object ArrayBuffer]'; } /** * Determine if a value is a FormData * * @param {Object} val The value to test * @returns {boolean} True if value is an FormData, otherwise false */ function isFormData(val) { return (typeof FormData !== 'undefined') && (val instanceof FormData); } /** * Determine if a value is a view on an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false */ function isArrayBufferView(val) { var result; if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { result = ArrayBuffer.isView(val); } else { result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } return result; } /** * Determine if a value is a String * * @param {Object} val The value to test * @returns {boolean} True if value is a String, otherwise false */ function isString(val) { return typeof val === 'string'; } /** * Determine if a value is a Number * * @param {Object} val The value to test * @returns {boolean} True if value is a Number, otherwise false */ function isNumber(val) { return typeof val === 'number'; } /** * Determine if a value is undefined * * @param {Object} val The value to test * @returns {boolean} True if the value is undefined, otherwise false */ function isUndefined(val) { return typeof val === 'undefined'; } /** * Determine if a value is an Object * * @param {Object} val The value to test * @returns {boolean} True if value is an Object, otherwise false */ function isObject(val) { return val !== null && typeof val === 'object'; } /** * Determine if a value is a Date * * @param {Object} val The value to test * @returns {boolean} True if value is a Date, otherwise false */ function isDate(val) { return toString.call(val) === '[object Date]'; } /** * Determine if a value is a File * * @param {Object} val The value to test * @returns {boolean} True if value is a File, otherwise false */ function isFile(val) { return toString.call(val) === '[object File]'; } /** * Determine if a value is a Blob * * @param {Object} val The value to test * @returns {boolean} True if value is a Blob, otherwise false */ function isBlob(val) { return toString.call(val) === '[object Blob]'; } /** * Determine if a value is a Function * * @param {Object} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ function isFunction(val) { return toString.call(val) === '[object Function]'; } /** * Determine if a value is a Stream * * @param {Object} val The value to test * @returns {boolean} True if value is a Stream, otherwise false */ function isStream(val) { return isObject(val) && isFunction(val.pipe); } /** * Determine if a value is a URLSearchParams object * * @param {Object} val The value to test * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ function isURLSearchParams(val) { return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } /** * Trim excess whitespace off the beginning and end of a string * * @param {String} str The String to trim * @returns {String} The String freed of excess whitespace */ function trim(str) { return str.replace(/^\s*/, '').replace(/\s*$/, ''); } /** * Determine if we're running in a standard browser environment * * This allows axios to run in a web worker, and react-native. * Both environments support XMLHttpRequest, but not fully standard globals. * * web workers: * typeof window -> undefined * typeof document -> undefined * * react-native: * navigator.product -> 'ReactNative' */ function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); } /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ function forEach(obj, fn) { // Don't bother if no value provided if (obj === null || typeof obj === 'undefined') { return; } // Force an array if not already something iterable if (typeof obj !== 'object') { /*eslint no-param-reassign:0*/ obj = [obj]; } if (isArray(obj)) { // Iterate over array values for (var i = 0, l = obj.length; i < l; i++) { fn.call(null, obj[i], i, obj); } } else { // Iterate over object keys for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn.call(null, obj[key], key, obj); } } } } /** * Accepts varargs expecting each argument to be an object, then * immutably merges the properties of each object and returns result. * * When multiple objects contain the same key the later object in * the arguments list will take precedence. * * Example: * * ```js * var result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * * @param {Object} obj1 Object to merge * @returns {Object} Result of all merge properties */ function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { if (typeof result[key] === 'object' && typeof val === 'object') { result[key] = merge(result[key], val); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } /** * Extends object a by mutably adding to it the properties of object b. * * @param {Object} a The object to be extended * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * @return {Object} The resulting value of object a */ function extend(a, b, thisArg) { forEach(b, function assignValue(val, key) { if (thisArg && typeof val === 'function') { a[key] = bind(val, thisArg); } else { a[key] = val; } }); return a; } module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, isBuffer: isBuffer, isFormData: isFormData, isArrayBufferView: isArrayBufferView, isString: isString, isNumber: isNumber, isObject: isObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, isBlob: isBlob, isFunction: isFunction, isStream: isStream, isURLSearchParams: isURLSearchParams, isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, extend: extend, trim: trim }; /***/ }), /* 17 */ /***/ (function(module, exports) { function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } module.exports = _defineProperty; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(583); /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Promise) {function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } module.exports = _asyncToGenerator; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(0))) /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _interopRequireDefault = __webpack_require__(2); var _createClass2 = _interopRequireDefault(__webpack_require__(40)); var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(55)); // @todo enable the following disabled rules see OPENTOK-31136 for more info /* eslint-disable no-param-reassign, global-require, max-len */ const Event = __webpack_require__(135); const eventNames = __webpack_require__(24); module.exports = function EventsFactory(deps) { if (deps === void 0) { deps = {}; } const logging = deps.logging || __webpack_require__(1)('Events'); const Events = {}; /** * The Event object defines the basic OpenTok event object that is passed to * event listeners. Other OpenTok event classes implement the properties and methods of * the Event object.

* *

For example, the Stream object dispatches a streamPropertyChanged event when * the stream's properties are updated. You add a callback for an event using the * on() method of the Stream object:

* *
   * stream.on("streamPropertyChanged", function (event) {
   *     alert("Properties changed for stream " + event.target.streamId);
   * });
* * @class Event * @property {Boolean} cancelable Whether the event has a default behavior that is cancelable * (true) or not (false). You can cancel the default behavior by * calling the preventDefault() method of the Event object in the callback * function. (See preventDefault().) * * @property {Object} target The object that dispatched the event. * * @property {String} type The type of event. */ /** * Prevents the default behavior associated with the event from taking place. * *

To see whether an event has a default behavior, check the cancelable property * of the event object.

* *

Call the preventDefault() method in the callback function for the event.

* *

The following events have default behaviors:

* * * * @method #preventDefault * @memberof Event */ /** * Whether the default event behavior has been prevented via a call to * preventDefault() (true) or not (false). * See preventDefault(). * @method #isDefaultPrevented * @return {Boolean} * @memberof Event */ /** * The {@link OT} class dispatches exception events when the OpenTok API encounters * an exception (error). The ExceptionEvent object defines the properties of the event * object that is dispatched. * *

Note that you set up a callback for the exception event by calling the * OT.on() method.

* * @class ExceptionEvent * @property {Number} code The error code. The following is a list of error codes:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* code * * * title *
* 1004 * * * Authentication error *
* 1005 * * * Invalid Session ID *
* 1006 * * * Connect Failed *
* 1007 * * * Connect Rejected *
* 1008 * * * Connect Time-out *
* 1009 * * * Security Error *
* 1010 * * * Not Connected *
* 1011 * * * Invalid Parameter *
* 1013 * * Connection Failed *
* 1014 * * API Response Failure *
* 1026 * * Terms of Service Violation: Export Compliance *
* 1500 * * Unable to Publish *
* 1520 * * Unable to Force Disconnect *
* 1530 * * Unable to Force Unpublish *
* 1535 * * Force Unpublish on Invalid Stream *
* 2000 * * * Internal Error *
* 2010 * * * Report Issue Failure *
* *

Check the message property for more details about the error.

* * @property {String} message The error message. * * @property {Object} target The object that the event pertains to. For an * exception event, this will be an object other than the OT object * (such as a Session object or a Publisher object). * * @property {String} title The error title. * @augments Event */ Events.ExceptionEvent = function ExceptionEvent(type, message, title, code, component, target, error) { return new Event(type, false, { error, message, title, code, component, target }); }; Events.IssueReportedEvent = function IssueReportedEvent(type, issueId) { return new Event(type, false, { issueId }); }; // Triggered when the JS dynamic config and the DOM have loaded. Events.EnvLoadedEvent = function EnvLoadedEvent(type) { return new Event(type, false); }; /** * Defines connectionCreated and connectionDestroyed events dispatched * by the {@link Session} object. *

* The Session object dispatches a connectionCreated event when a client (including * your own) connects to a Session. It also dispatches a connectionCreated event for * every client in the session when you first connect. (when your local client connects, the * Session object also dispatches a sessionConnected event, defined by the * {@link SessionConnectEvent} class.) *

* While you are connected to the session, the Session object dispatches a * connectionDestroyed event when another client disconnects from the Session. * (When you disconnect, the Session object also dispatches a sessionDisconnected * event, defined by the {@link SessionDisconnectEvent} class.) * *

Example
* *

The following code keeps a running total of the number of connections to a session * by monitoring the connections property of the sessionConnect, * connectionCreated and connectionDestroyed events:

* *
var apiKey = ""; // Replace with your API key. See https://tokbox.com/account
   * var sessionID = ""; // Replace with your own session ID.
   *                     // See https://tokbox.com/developer/guides/create-session/.
   * var token = ""; // Replace with a generated token that has been assigned the moderator role.
   *                 // See https://tokbox.com/developer/guides/create-token/.
   * var connectionCount = 0;
   *
   * var session = OT.initSession(apiKey, sessionID);
   * session.on("connectionCreated", function(event) {
   *    connectionCount++;
   *    displayConnectionCount();
   * });
   * session.on("connectionDestroyed", function(event) {
   *    connectionCount--;
   *    displayConnectionCount();
   * });
   * session.connect(token);
   *
   * function displayConnectionCount() {
   *     document.getElementById("connectionCountField").value = connectionCount.toString();
   * }
* *

This example assumes that there is an input text field in the HTML DOM * with the id set to "connectionCountField":

* *
<input type="text" id="connectionCountField" value="0"></input>
* * * @property {Connection} connection A Connection object for the connection that was * created or deleted. * * @property {Array} connections Deprecated. Use the connection property. A * connectionCreated or connectionDestroyed event is dispatched * for each connection created and destroyed in the session. * * @property {String} reason For a connectionDestroyed event, * a description of why the connection ended. This property can have the following values: *

* * *

Depending on the context, this description may allow the developer to refine * the course of action they take in response to an event.

* *

For a connectionCreated event, this string is undefined.

* * @class ConnectionEvent * @augments Event */ let connectionEventPluralDeprecationWarningShown = false; Events.ConnectionEvent = /*#__PURE__*/function (_Event) { (0, _inheritsLoose2.default)(ConnectionEvent, _Event); function ConnectionEvent(type, connection, reason) { return _Event.call(this, type, false, { connection, reason }) || this; } (0, _createClass2.default)(ConnectionEvent, [{ key: "connections", get: function get() { if (!connectionEventPluralDeprecationWarningShown) { logging.warn('OT.ConnectionEvent connections property is deprecated, ' + 'use connection instead.'); connectionEventPluralDeprecationWarningShown = true; } return [this.connection]; } }]); return ConnectionEvent; }(Event); /** * StreamEvent is an event that can have the type "streamCreated" or "streamDestroyed". * These events are dispatched by the Session object when another client starts or * stops publishing a stream to a {@link Session}. For a local client's stream, the * Publisher object dispatches the event. * *

Example — streamCreated event dispatched * by the Session object

*

The following code initializes a session and sets up an event listener for when * a stream published by another client is created:

* *
   * session.on("streamCreated", function(event) {
   *   // streamContainer is a DOM element
   *   subscriber = session.subscribe(event.stream, targetElement);
   * }).connect(token);
   * 
* *

Example — streamDestroyed event dispatched * by the Session object

* *

The following code initializes a session and sets up an event listener for when * other clients' streams end:

* *
   * session.on("streamDestroyed", function(event) {
   *     console.log("Stream " + event.stream.name + " ended. " + event.reason);
   * }).connect(token);
   * 
* *

Example — streamCreated event dispatched * by a Publisher object

*

The following code publishes a stream and adds an event listener for when the streaming * starts

* *
   * var publisher = session.publish(targetElement)
   *   .on("streamCreated", function(event) {
   *     console.log("Publisher started streaming.");
   *   );
   * 
* *

Example — streamDestroyed event * dispatched by a Publisher object

* *

The following code publishes a stream, and leaves the Publisher in the HTML DOM * when the streaming stops:

* *
   * var publisher = session.publish(targetElement)
   *   .on("streamDestroyed", function(event) {
   *     event.preventDefault();
   *     console.log("Publisher stopped streaming.");
   *   );
   * 
* * @class StreamEvent * * @property {Boolean} cancelable Whether the event has a default behavior that is cancelable * (true) or not (false). You can cancel the default behavior by * calling the preventDefault() method of the StreamEvent object in the event * listener function. The streamDestroyed event is cancelable. * (See preventDefault().) * * @property {String} reason For a streamDestroyed event, * a description of why the session disconnected. This property can have one of the following * values: *

* * *

Depending on the context, this description may allow the developer to refine * the course of action they take in response to an event.

* *

For a streamCreated event, this string is undefined.

* * @property {Stream} stream A Stream object corresponding to the stream that was added (in the * case of a streamCreated event) or deleted (in the case of a * streamDestroyed event). * * @property {Array} streams Deprecated. Use the stream property. A * streamCreated or streamDestroyed event is dispatched for * each stream added or destroyed. * * @augments Event */ let streamEventPluralDeprecationWarningShown = false; Events.StreamEvent = /*#__PURE__*/function (_Event2) { (0, _inheritsLoose2.default)(StreamEvent, _Event2); function StreamEvent(type, stream, reason, cancelable) { return _Event2.call(this, type, cancelable, { stream, reason }) || this; } (0, _createClass2.default)(StreamEvent, [{ key: "streams", get: function get() { if (!streamEventPluralDeprecationWarningShown) { logging.warn('OT.StreamEvent streams property is deprecated, use stream instead.'); streamEventPluralDeprecationWarningShown = true; } return [this.stream]; } }]); return StreamEvent; }(Event); /** * Prevents the default behavior associated with the event from taking place. * *

For the streamDestroyed event dispatched by the Session object, * the default behavior is that all Subscriber objects that are subscribed to the stream are * unsubscribed and removed from the HTML DOM. Each Subscriber object dispatches a * destroyed event when the element is removed from the HTML DOM. If you call the * preventDefault() method in the event listener for the streamDestroyed * event, the default behavior is prevented and you can clean up Subscriber objects using your * own code. See * Session.getSubscribersForStream().

*

* For the streamDestroyed event dispatched by a Publisher object, the default * behavior is that the Publisher object is removed from the HTML DOM. The Publisher object * dispatches a destroyed event when the element is removed from the HTML DOM. * If you call the preventDefault() method in the event listener for the * streamDestroyed event, the default behavior is prevented, and you can * retain the Publisher for reuse or clean it up using your own code. *

*

To see whether an event has a default behavior, check the cancelable property of * the event object.

* *

* Call the preventDefault() method in the event listener function for the event. *

* * @method #preventDefault * @memberof StreamEvent */ /** * The Session object dispatches SessionConnectEvent object when a session has successfully * connected in response to a call to the connect() method of the Session object. *

* In version 2.2, the completionHandler of the Session.connect() method * indicates success or failure in connecting to the session. * * @class SessionConnectEvent * @property {Array} connections Deprecated in version 2.2 (and set to an empty array). In * version 2.2, listen for the connectionCreated event dispatched by the Session * object. In version 2.2, the Session object dispatches a connectionCreated event * for each connection (including your own). This includes connections present when you first * connect to the session. * * @property {Array} streams Deprecated in version 2.2 (and set to an empty array). In version * 2.2, listen for the streamCreated event dispatched by the Session object. In * version 2.2, the Session object dispatches a streamCreated event for each stream * other than those published by your client. This includes streams * present when you first connect to the session. * * @see Session.connect()

* @augments Event */ let sessionConnectedConnectionsDeprecationWarningShown = false; let sessionConnectedStreamsDeprecationWarningShown = false; let sessionConnectedArchivesDeprecationWarningShown = false; Events.SessionConnectEvent = /*#__PURE__*/function (_Event3) { (0, _inheritsLoose2.default)(SessionConnectEvent, _Event3); function SessionConnectEvent(type) { return _Event3.call(this, type, false) || this; } // eslint-disable-next-line class-methods-use-this (0, _createClass2.default)(SessionConnectEvent, [{ key: "connections", get: function get() { if (!sessionConnectedConnectionsDeprecationWarningShown) { logging.warn('OT.SessionConnectedEvent no longer includes connections. Listen ' + 'for connectionCreated events instead.'); sessionConnectedConnectionsDeprecationWarningShown = true; } return []; } // eslint-disable-next-line class-methods-use-this }, { key: "streams", get: function get() { if (!sessionConnectedStreamsDeprecationWarningShown) { logging.warn('OT.SessionConnectedEvent no longer includes streams. Listen for ' + 'streamCreated events instead.'); sessionConnectedStreamsDeprecationWarningShown = true; } return []; } // eslint-disable-next-line class-methods-use-this }, { key: "archives", get: function get() { if (!sessionConnectedArchivesDeprecationWarningShown) { logging.warn('OT.SessionConnectedEvent no longer includes archives. Listen for ' + 'archiveStarted events instead.'); sessionConnectedArchivesDeprecationWarningShown = true; } return []; } }]); return SessionConnectEvent; }(Event); Events.SessionReconnectingEvent = function SessionReconnectedEvent() { return new Event(eventNames.SESSION_RECONNECTING, false); }; Events.SessionReconnectedEvent = function SessionReconnectedEvent() { return new Event(eventNames.SESSION_RECONNECTED); }; /** * The Session object dispatches SessionDisconnectEvent object when a session has disconnected. * This event may be dispatched asynchronously in response to a successful call to the * disconnect() method of the session object. * *

* Example *

*

* The following code initializes a session and sets up an event listener for when a session is * disconnected. *

*
var apiKey = ""; // Replace with your API key. See https://tokbox.com/account
   *  var sessionID = ""; // Replace with your own session ID.
   *                      // See https://tokbox.com/developer/guides/create-session/
   *  var token = ""; // Replace with a generated token that has been assigned the moderator role.
   *                  // See https://tokbox.com/developer/guides/create-token/
   *
   *  var session = OT.initSession(apiKey, sessionID);
   *  session.on("sessionDisconnected", function(event) {
   *      alert("The session disconnected. " + event.reason);
   *  });
   *  session.connect(token);
   *  
* * @property {String} reason A description of why the session disconnected. * This property can have the following values: *

* *