From a6553e5bec478043d2f5afccd0f0a30c197168fc Mon Sep 17 00:00:00 2001 From: stefankiesz <85728496+stefankiesz@users.noreply.github.com> Date: Wed, 15 Jan 2025 19:17:11 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20awslabs/?= =?UTF-8?q?amazon-kinesis-video-streams-webrtc-sdk-js@d6dab16b693da2a3aea7?= =?UTF-8?q?93403cabbff05a529468=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kvs-webrtc.js | 687 +++++++++++++++++++++++++++++----------------- kvs-webrtc.min.js | 4 +- 2 files changed, 442 insertions(+), 249 deletions(-) diff --git a/kvs-webrtc.js b/kvs-webrtc.js index 112f98d..93517b2 100644 --- a/kvs-webrtc.js +++ b/kvs-webrtc.js @@ -1,4 +1,4 @@ -/* Amazon Kinesis Video Streams WebRTC SDK for JavaScript v2.3.1 +/* Amazon Kinesis Video Streams WebRTC SDK for JavaScript v2.3.2 Copyright 2019-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. This product includes software developed at @@ -570,7 +570,7 @@ var Role; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SigV4RequestSigner = void 0; -var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); +var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); var isomorphic_webcrypto_1 = tslib_1.__importDefault(__webpack_require__(/*! isomorphic-webcrypto */ "isomorphic-webcrypto")); var utils_1 = __webpack_require__(/*! ./internal/utils */ "./src/internal/utils.ts"); /** @@ -808,7 +808,7 @@ exports.SigV4RequestSigner = SigV4RequestSigner; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SignalingClient = void 0; -var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); +var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); var events_1 = __webpack_require__(/*! events */ "./node_modules/events/events.js"); var Role_1 = __webpack_require__(/*! ./Role */ "./src/Role.ts"); var SigV4RequestSigner_1 = __webpack_require__(/*! ./SigV4RequestSigner */ "./src/SigV4RequestSigner.ts"); @@ -1219,14 +1219,43 @@ function validateValueNil(value, valueName) { /***/ }), -/***/ "./node_modules/tslib/tslib.es6.js": -/*!*****************************************!*\ - !*** ./node_modules/tslib/tslib.es6.js ***! - \*****************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { +/***/ "./node_modules/ws/browser.js": +/*!************************************!*\ + !*** ./node_modules/ws/browser.js ***! + \************************************/ +/***/ ((module) => { + + + +module.exports = function () { + throw new Error( + 'ws does not work in the browser. Browser clients must use the native ' + + 'WebSocket object' + ); +}; + + +/***/ }), + +/***/ "isomorphic-webcrypto": +/*!*************************!*\ + !*** external "crypto" ***! + \*************************/ +/***/ ((module) => { + +module.exports = window["crypto"]; + +/***/ }), + +/***/ "./node_modules/tslib/tslib.es6.mjs": +/*!******************************************!*\ + !*** ./node_modules/tslib/tslib.es6.mjs ***! + \******************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ __addDisposableResource: () => (/* binding */ __addDisposableResource), /* harmony export */ __assign: () => (/* binding */ __assign), /* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator), /* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator), @@ -1234,9 +1263,12 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __await: () => (/* binding */ __await), /* harmony export */ __awaiter: () => (/* binding */ __awaiter), /* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet), +/* harmony export */ __classPrivateFieldIn: () => (/* binding */ __classPrivateFieldIn), /* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet), /* harmony export */ __createBinding: () => (/* binding */ __createBinding), /* harmony export */ __decorate: () => (/* binding */ __decorate), +/* harmony export */ __disposeResources: () => (/* binding */ __disposeResources), +/* harmony export */ __esDecorate: () => (/* binding */ __esDecorate), /* harmony export */ __exportStar: () => (/* binding */ __exportStar), /* harmony export */ __extends: () => (/* binding */ __extends), /* harmony export */ __generator: () => (/* binding */ __generator), @@ -1245,259 +1277,420 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject), /* harmony export */ __metadata: () => (/* binding */ __metadata), /* harmony export */ __param: () => (/* binding */ __param), +/* harmony export */ __propKey: () => (/* binding */ __propKey), /* harmony export */ __read: () => (/* binding */ __read), /* harmony export */ __rest: () => (/* binding */ __rest), +/* harmony export */ __rewriteRelativeImportExtension: () => (/* binding */ __rewriteRelativeImportExtension), +/* harmony export */ __runInitializers: () => (/* binding */ __runInitializers), +/* harmony export */ __setFunctionName: () => (/* binding */ __setFunctionName), /* harmony export */ __spread: () => (/* binding */ __spread), +/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray), /* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays), -/* harmony export */ __values: () => (/* binding */ __values) +/* harmony export */ __values: () => (/* binding */ __values), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -function __createBinding(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -} - -function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -} +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} -/***/ }), +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} -/***/ "./node_modules/ws/browser.js": -/*!************************************!*\ - !*** ./node_modules/ws/browser.js ***! - \************************************/ -/***/ ((module) => { +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} -module.exports = function () { - throw new Error( - 'ws does not work in the browser. Browser clients must use the native ' + - 'WebSocket object' - ); +function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; }; +function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; -/***/ }), +function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; -/***/ "isomorphic-webcrypto": -/*!*************************!*\ - !*** external "crypto" ***! - \*************************/ -/***/ ((module) => { +function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); +}; + +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); +} + +function __rewriteRelativeImportExtension(path, preserveJsx) { + if (typeof path === "string" && /^\.\.?\//.test(path)) { + return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { + return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); + }); + } + return path; +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, + __rewriteRelativeImportExtension, +}); -module.exports = window["crypto"]; /***/ }) @@ -1584,11 +1777,11 @@ var QueryParams_1 = __webpack_require__(/*! ./QueryParams */ "./src/QueryParams. Object.defineProperty(exports, "QueryParams", ({ enumerable: true, get: function () { return QueryParams_1.QueryParams; } })); var RequestSigner_1 = __webpack_require__(/*! ./RequestSigner */ "./src/RequestSigner.ts"); Object.defineProperty(exports, "RequestSigner", ({ enumerable: true, get: function () { return RequestSigner_1.RequestSigner; } })); -exports.VERSION = "2.3.1"; +exports.VERSION = "2.3.2"; })(); window.KVSWebRTC = __webpack_exports__; /******/ })() ; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia3ZzLXdlYnJ0Yy5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRWE7O0FBRWI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBLEVBQUU7QUFDRjtBQUNBO0FBQ0E7QUFDQTtBQUNBLEVBQUU7QUFDRjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0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yZWF0ZShiKSA6IChfXy5wcm90b3R5cGUgPSBiLnByb3RvdHlwZSwgbmV3IF9fKCkpO1xyXG59XHJcblxyXG5leHBvcnQgdmFyIF9fYXNzaWduID0gZnVuY3Rpb24oKSB7XHJcbiAgICBfX2Fzc2lnbiA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gX19hc3NpZ24odCkge1xyXG4gICAgICAgIGZvciAodmFyIHMsIGkgPSAxLCBuID0gYXJndW1lbnRzLmxlbmd0aDsgaSA8IG47IGkrKykge1xyXG4gICAgICAgICAgICBzID0gYXJndW1lbnRzW2ldO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkpIHRbcF0gPSBzW3BdO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdDtcclxuICAgIH1cclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19yZXN0KHMsIGUpIHtcclxuICAgIHZhciB0ID0ge307XHJcbiAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkgJiYgZS5pbmRleE9mKHApIDwgMClcclxuICAgICAgICB0W3BdID0gc1twXTtcclxuICAgIGlmIChzICE9IG51bGwgJiYgdHlwZW9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgPT09IFwiZnVuY3Rpb25cIilcclxuICAgICAgICBmb3IgKHZhciBpID0gMCwgcCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMocyk7IGkgPCBwLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgIGlmIChlLmluZGV4T2YocFtpXSkgPCAwICYmIE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lc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b3AgPSBbb3BbMF0gJiAyLCB0LnZhbHVlXTtcclxuICAgICAgICAgICAgc3dpdGNoIChvcFswXSkge1xyXG4gICAgICAgICAgICAgICAgY2FzZSAwOiBjYXNlIDE6IHQgPSBvcDsgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICBjYXNlIDQ6IF8ubGFiZWwrKzsgcmV0dXJuIHsgdmFsdWU6IG9wWzFdLCBkb25lOiBmYWxzZSB9O1xyXG4gICAgICAgICAgICAgICAgY2FzZSA1OiBfLmxhYmVsKys7IHkgPSBvcFsxXTsgb3AgPSBbMF07IGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgY2FzZSA3OiBvcCA9IF8ub3BzLnBvcCgpOyBfLnRyeXMucG9wKCk7IGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICBpZiAoISh0ID0gXy50cnlzLCB0ID0gdC5sZW5ndGggPiAwICYmIHRbdC5sZW5ndGggLSAxXSkgJiYgKG9wWzBdID09PSA2IHx8IG9wWzBdID09PSAyKSkgeyBfID0gMDsgY29udGludWU7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAob3BbMF0gPT09IDMgJiYgKCF0IHx8IChvcFsxXSA+IHRbMF0gJiYgb3BbMV0gPCB0WzNdKSkpIHsgXy5sYWJlbCA9IG9wWzFdOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmIChvcFswXSA9PT0gNiAmJiBfLmxhYmVsIDwgdFsxXSkgeyBfLmxhYmVsID0gdFsxXTsgdCA9IG9wOyBicmVhazsgfVxyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0ICYmIF8ubGFiZWwgPCB0WzJdKSB7IF8ubGFiZWwgPSB0WzJdOyBfLm9wcy5wdXNoKG9wKTsgYnJlYWs7IH1cclxuICAgICAgICAgICAgICAgICAgICBpZiAodFsyXSkgXy5vcHMucG9wKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgX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ICAgb3JpZ2luYWxMaXN0ZW5lciA9IGxpc3RbaV0ubGlzdGVuZXI7XG4gICAgICAgICAgICBwb3NpdGlvbiA9IGk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAocG9zaXRpb24gPCAwKVxuICAgICAgICAgIHJldHVybiB0aGlzO1xuXG4gICAgICAgIGlmIChwb3NpdGlvbiA9PT0gMClcbiAgICAgICAgICBsaXN0LnNoaWZ0KCk7XG4gICAgICAgIGVsc2Uge1xuICAgICAgICAgIHNwbGljZU9uZShsaXN0LCBwb3NpdGlvbik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobGlzdC5sZW5ndGggPT09IDEpXG4gICAgICAgICAgZXZlbnRzW3R5cGVdID0gbGlzdFswXTtcblxuICAgICAgICBpZiAoZXZlbnRzLnJlbW92ZUxpc3RlbmVyICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgdGhpcy5lbWl0KCdyZW1vdmVMaXN0ZW5lcicsIHR5cGUsIG9yaWdpbmFsTGlzdGVuZXIgfHwgbGlzdGVuZXIpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gdGhpcztcbiAgICB9O1xuXG5FdmVudEVtaXR0ZXIucHJvdG90eXBlLm9mZiA9IEV2ZW50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlTGlzdGVuZXI7XG5cbkV2ZW50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlQWxsTGlzdGVuZXJzID1cbiAgICBmdW5jdGlvbiByZW1vdmVBbGxMaXN0ZW5lcnModHlwZSkge1xuICAgICAgdmFyIGxpc3RlbmVycywgZXZlbnRzLCBpO1xuXG4gICAgICBldmVudHMgPSB0aGlzLl9ldmVudHM7XG4gICAgICBpZiAoZXZlbnRzID09PSB1bmRlZmluZWQpXG4gICAgICAgIHJldHVybiB0aGlzO1xuXG4gICAgICAvLyBub3QgbGlzdGVuaW5nIGZvciByZW1vdmVMaXN0ZW5lciwgb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24gV2ViIFNlcnZpY2VzLCBJbmMuIChodHRwOi8vYXdzLmFtYXpvbi5jb20vKS5cbiovXG5leHBvcnQgeyBSb2xlIH0gZnJvbSAnLi9Sb2xlJztcbmV4cG9ydCB7IFNpZ25hbGluZ0NsaWVudCB9IGZyb20gJy4vU2lnbmFsaW5nQ2xpZW50JztcbmV4cG9ydCB7IFNpZ1Y0UmVxdWVzdFNpZ25lciB9IGZyb20gJy4vU2lnVjRSZXF1ZXN0U2lnbmVyJztcbmV4cG9ydCB7IFF1ZXJ5UGFyYW1zIH0gZnJvbSAnLi9RdWVyeVBhcmFtcyc7XG5leHBvcnQgeyBSZXF1ZXN0U2lnbmVyIH0gZnJvbSAnLi9SZXF1ZXN0U2lnbmVyJztcblxuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBwcm9jZXNzLmVudi5QQUNLQUdFX1ZFUlNJT047XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/kvs-webrtc.min.js b/kvs-webrtc.min.js index 967c7ae..b099cb5 100644 --- a/kvs-webrtc.min.js +++ b/kvs-webrtc.min.js @@ -1,7 +1,7 @@ -/* Amazon Kinesis Video Streams WebRTC SDK for JavaScript v2.3.1 +/* Amazon Kinesis Video Streams WebRTC SDK for JavaScript v2.3.2 Copyright 2019-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. This product includes software developed at Amazon Web Services, Inc. (http://aws.amazon.com/). -License at kvs-webrtc.LICENSE */(()=>{"use strict";var e={7:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}v(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&v(e,"error",t,n)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var i,o,s,u;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var u=c.length,l=p(c,u);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},359:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},810:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},821:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Role=void 0,function(e){e.MASTER="MASTER",e.VIEWER="VIEWER"}(n||(t.Role=n={}))},87:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SigV4RequestSigner=void 0;var r=n(215),i=r.__importDefault(n(143)),o=n(874),s=function(){function e(t,n,r){void 0===r&&(r=e.DEFAULT_SERVICE),this.region=t,this.credentials=n,this.service=r}return e.prototype.getSignedURL=function(t,n){return r.__awaiter(this,arguments,Promise,(function(t,n,i){var s,a,c,u,l,f,d,h,p,v,y,g,m,_,b,S,w,E,O,C,I,P,A;return void 0===i&&(i=new Date),r.__generator(this,(function(r){switch(r.label){case 0:return"function"!=typeof this.credentials.getPromise?[3,2]:[4,this.credentials.getPromise()];case 1:r.sent(),r.label=2;case 2:if((0,o.validateValueNonNil)(this.credentials.accessKeyId,"credentials.accessKeyId"),(0,o.validateValueNonNil)(this.credentials.secretAccessKey,"credentials.secretAccessKey"),s=e.getDateTimeString(i),a=e.getDateString(i),u="".concat(c="wss","://"),!t.startsWith(u))throw new Error("Endpoint '".concat(t,"' is not a secure WebSocket endpoint. It should start with '").concat(u,"'."));if(t.includes("?"))throw new Error("Endpoint '".concat(t,"' should not contain any query parameters."));return(l=t.indexOf("/",u.length))<0?(f=t.substring(u.length),d="/"):(f=t.substring(u.length,l),d=t.substring(l)),h=["host"].join(";"),p="GET",v=a+"/"+this.region+"/"+this.service+"/aws4_request",y=Object.assign({},n,{"X-Amz-Algorithm":e.DEFAULT_ALGORITHM,"X-Amz-Credential":this.credentials.accessKeyId+"/"+v,"X-Amz-Date":s,"X-Amz-Expires":"299","X-Amz-SignedHeaders":h}),this.credentials.sessionToken&&Object.assign(y,{"X-Amz-Security-Token":this.credentials.sessionToken}),g=e.createQueryString(y),m={host:f},_=e.createHeadersString(m),[4,e.sha256("")];case 3:return b=r.sent(),S=[p,d,g,_,h,b].join("\n"),[4,e.sha256(S)];case 4:return w=r.sent(),E=[e.DEFAULT_ALGORITHM,s,v,w].join("\n"),[4,this.getSignatureKey(a)];case 5:return O=r.sent(),P=(I=e).toHex,[4,e.hmac(O,E)];case 6:return[4,P.apply(I,[r.sent()])];case 7:return C=r.sent(),A=Object.assign({},y,{"X-Amz-Signature":C}),[2,c+"://"+f+d+"?"+e.createQueryString(A)]}}))}))},e.prototype.getSignatureKey=function(t){return r.__awaiter(this,void 0,Promise,(function(){var n,i,o;return r.__generator(this,(function(r){switch(r.label){case 0:return[4,e.hmac("AWS4"+this.credentials.secretAccessKey,t)];case 1:return n=r.sent(),[4,e.hmac(n,this.region)];case 2:return i=r.sent(),[4,e.hmac(i,this.service)];case 3:return o=r.sent(),[4,e.hmac(o,"aws4_request")];case 4:return[2,r.sent()]}}))}))},e.createHeadersString=function(e){return Object.keys(e).map((function(t){return"".concat(t,":").concat(e[t],"\n")})).join()},e.createQueryString=function(e){return Object.keys(e).sort().map((function(t){return"".concat(t,"=").concat(encodeURIComponent(e[t]))})).join("&")},e.getDateTimeString=function(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z").replace(/[:\-]/g,"")},e.getDateString=function(e){return this.getDateTimeString(e).substring(0,8)},e.sha256=function(e){return r.__awaiter(this,void 0,Promise,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:return[4,i.default.subtle.digest({name:"SHA-256"},this.toUint8Array(e))];case 1:return t=n.sent(),[2,this.toHex(t)]}}))}))},e.hmac=function(e,t){return r.__awaiter(this,void 0,Promise,(function(){var n,o,s;return r.__generator(this,(function(r){switch(r.label){case 0:return n="string"==typeof e?this.toUint8Array(e).buffer:e,o=this.toUint8Array(t).buffer,[4,i.default.subtle.importKey("raw",n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"])];case 1:return s=r.sent(),[4,i.default.subtle.sign({name:"HMAC",hash:{name:"SHA-256"}},s,o)];case 2:return[2,r.sent()]}}))}))},e.toUint8Array=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,i=e.length;r{Object.defineProperty(t,"__esModule",{value:!0}),t.SignalingClient=void 0;var r,i,o=n(215),s=n(7),a=n(821),c=n(87),u=o.__importDefault(n(214)),l=n(874);!function(e){e.SDP_ANSWER="SDP_ANSWER",e.SDP_OFFER="SDP_OFFER",e.ICE_CANDIDATE="ICE_CANDIDATE",e.STATUS_RESPONSE="STATUS_RESPONSE"}(r||(r={})),function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(i||(i={}));var f=function(e){function t(t){var n=e.call(this)||this;return n.websocket=null,n.readyState=i.CLOSED,n.pendingIceCandidatesByClientId={},n.hasReceivedRemoteSDPByClientId={},(0,l.validateValueNonNil)(t,"SignalingClientConfig"),(0,l.validateValueNonNil)(t.role,"role"),t.role===a.Role.VIEWER?(0,l.validateValueNonNil)(t.clientId,"clientId"):(0,l.validateValueNil)(t.clientId,"clientId"),(0,l.validateValueNonNil)(t.channelARN,"channelARN"),(0,l.validateValueNonNil)(t.region,"region"),(0,l.validateValueNonNil)(t.channelEndpoint,"channelEndpoint"),n.config=o.__assign({},t),t.requestSigner?n.requestSigner=t.requestSigner:((0,l.validateValueNonNil)(t.credentials,"credentials"),n.requestSigner=new c.SigV4RequestSigner(t.region,t.credentials)),n.dateProvider=new u.default(t.systemClockOffset||0),n.onOpen=n.onOpen.bind(n),n.onMessage=n.onMessage.bind(n),n.onError=n.onError.bind(n),n.onClose=n.onClose.bind(n),n}return o.__extends(t,e),t.prototype.open=function(){var e=this;if(this.readyState!==i.CLOSED)throw new Error("Client is already open, opening, or closing");this.readyState=i.CONNECTING,this.asyncOpen().then().catch((function(t){return e.onError(t)}))},t.prototype.asyncOpen=function(){return o.__awaiter(this,void 0,Promise,(function(){var e,t;return o.__generator(this,(function(r){switch(r.label){case 0:return e={"X-Amz-ChannelARN":this.config.channelARN},this.config.role===a.Role.VIEWER&&(e["X-Amz-ClientId"]=this.config.clientId),[4,this.requestSigner.getSignedURL(this.config.channelEndpoint,e,this.dateProvider.getDate())];case 1:return t=r.sent(),this.readyState!==i.CONNECTING?[2]:(this.websocket=new(WebSocket||n(591))(t),this.websocket.addEventListener("open",this.onOpen),this.websocket.addEventListener("message",this.onMessage),this.websocket.addEventListener("error",this.onError),this.websocket.addEventListener("close",this.onClose),[2])}}))}))},t.prototype.close=function(){null!==this.websocket?(this.readyState=i.CLOSING,this.websocket.close()):this.readyState!==i.CLOSED&&this.onClose()},t.prototype.sendSdpOffer=function(e,t,n){this.sendMessage(r.SDP_OFFER,e,t,n)},t.prototype.sendSdpAnswer=function(e,t,n){this.sendMessage(r.SDP_ANSWER,e,t,n)},t.prototype.sendIceCandidate=function(e,t,n){this.sendMessage(r.ICE_CANDIDATE,e,t,n)},t.prototype.sendMessage=function(e,n,r,o){if(this.readyState!==i.OPEN)throw new Error("Could not send message because the connection to the signaling service is not open.");this.validateRecipientClientId(r),this.validateCorrelationId(o),this.websocket.send(JSON.stringify({action:e,messagePayload:t.serializeJSONObjectAsBase64String(n),recipientClientId:r||void 0,correlationId:o||void 0}))},t.prototype.cleanupWebSocket=function(){null!==this.websocket&&(this.websocket.removeEventListener("open",this.onOpen),this.websocket.removeEventListener("message",this.onMessage),this.websocket.removeEventListener("error",this.onError),this.websocket.removeEventListener("close",this.onClose),this.websocket=null)},t.prototype.onOpen=function(){this.readyState=i.OPEN,this.emit("open")},t.prototype.onMessage=function(e){var n,i;try{n=JSON.parse(e.data)}catch(e){return}try{i=t.parseJSONObjectFromBase64String(n.messagePayload)}catch(e){}var o=n.messageType,s=n.senderClientId,a=n.statusResponse;if(i||a)switch(o){case r.SDP_OFFER:return this.emit("sdpOffer",i,s),void this.emitPendingIceCandidates(s);case r.SDP_ANSWER:return this.emit("sdpAnswer",i,s),void this.emitPendingIceCandidates(s);case r.ICE_CANDIDATE:return void this.emitOrQueueIceCandidate(i,s);case r.STATUS_RESPONSE:return void this.emit("statusResponse",a)}},t.parseJSONObjectFromBase64String=function(e){try{return JSON.parse(atob(e))}catch(t){return JSON.parse(Buffer.from(e,"base64").toString())}},t.serializeJSONObjectAsBase64String=function(e){try{return btoa(JSON.stringify(e))}catch(t){return Buffer.from(JSON.stringify(e)).toString("base64")}},t.prototype.emitOrQueueIceCandidate=function(e,n){var r=n||t.DEFAULT_CLIENT_ID;this.hasReceivedRemoteSDPByClientId[r]?this.emit("iceCandidate",e,n):(this.pendingIceCandidatesByClientId[r]||(this.pendingIceCandidatesByClientId[r]=[]),this.pendingIceCandidatesByClientId[r].push(e))},t.prototype.emitPendingIceCandidates=function(e){var n=this,r=e||t.DEFAULT_CLIENT_ID;this.hasReceivedRemoteSDPByClientId[r]=!0;var i=this.pendingIceCandidatesByClientId[r];i&&(delete this.pendingIceCandidatesByClientId[r],i.forEach((function(t){n.emit("iceCandidate",t,e)})))},t.prototype.validateRecipientClientId=function(e){if(this.config.role===a.Role.VIEWER&&e)throw new Error("Unexpected recipient client id. As the VIEWER, messages must not be sent with a recipient client id.")},t.prototype.validateCorrelationId=function(e){if(e&&!/^[a-zA-Z0-9_.-]{1,256}$/.test(e))throw new Error("Correlation id does not fit the constraint!")},t.prototype.onError=function(e){this.emit("error",e)},t.prototype.onClose=function(){this.readyState=i.CLOSED,this.cleanupWebSocket(),this.emit("close")},t.DEFAULT_CLIENT_ID="MASTER",t}(s.EventEmitter);t.SignalingClient=f},214:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this.clockOffsetMs=e}return e.prototype.getDate=function(){return new Date(Date.now()+this.clockOffsetMs)},e}();t.default=n},874:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateValueNonNil=function(e,t){if(null===e)throw new Error("".concat(t," cannot be null"));if(void 0===e)throw new Error("".concat(t," cannot be undefined"));if(""===e)throw new Error("".concat(t," cannot be empty"))},t.validateValueNil=function(e,t){if(null!=e&&""!==e)throw new Error("".concat(t," should be null"))}},215:(e,t,n)=>{n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>b,__asyncGenerator:()=>_,__asyncValues:()=>S,__await:()=>m,__awaiter:()=>l,__classPrivateFieldGet:()=>C,__classPrivateFieldSet:()=>I,__createBinding:()=>d,__decorate:()=>a,__exportStar:()=>h,__extends:()=>i,__generator:()=>f,__importDefault:()=>O,__importStar:()=>E,__makeTemplateObject:()=>w,__metadata:()=>u,__param:()=>c,__read:()=>v,__rest:()=>s,__spread:()=>y,__spreadArrays:()=>g,__values:()=>p});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){return function(n,r){t(n,r,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function y(){for(var e=[],t=0;t1||a(e,t)}))})}function a(e,t){try{(n=i[e](t)).value instanceof m?Promise.resolve(n.value.v).then(c,u):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function b(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function O(e){return e&&e.__esModule?e:{default:e}}function C(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},591:e=>{e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},143:e=>{e.exports=window.crypto}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=e.RequestSigner=e.QueryParams=e.SigV4RequestSigner=e.SignalingClient=e.Role=void 0;var t=n(821);Object.defineProperty(e,"Role",{enumerable:!0,get:function(){return t.Role}});var i=n(574);Object.defineProperty(e,"SignalingClient",{enumerable:!0,get:function(){return i.SignalingClient}});var o=n(87);Object.defineProperty(e,"SigV4RequestSigner",{enumerable:!0,get:function(){return o.SigV4RequestSigner}});var s=n(359);Object.defineProperty(e,"QueryParams",{enumerable:!0,get:function(){return s.QueryParams}});var a=n(810);Object.defineProperty(e,"RequestSigner",{enumerable:!0,get:function(){return a.RequestSigner}}),e.VERSION="2.3.1"})(),window.KVSWebRTC=r})(); \ No newline at end of file +License at kvs-webrtc.LICENSE */(()=>{"use strict";var e={7:e=>{var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,n)}(e,o,{once:!0})}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){var o,i,s,u;if(a(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=c(e))>0&&s.length>o&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=l.bind(r);return o.listener=n,r.wrapFn=o,o}function p(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var u=c.length,l=h(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},i.prototype.listenerCount=d,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},359:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},810:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},821:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Role=void 0,function(e){e.MASTER="MASTER",e.VIEWER="VIEWER"}(n||(t.Role=n={}))},87:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SigV4RequestSigner=void 0;var r=n(635),o=r.__importDefault(n(143)),i=n(874),s=function(){function e(t,n,r){void 0===r&&(r=e.DEFAULT_SERVICE),this.region=t,this.credentials=n,this.service=r}return e.prototype.getSignedURL=function(t,n){return r.__awaiter(this,arguments,Promise,(function(t,n,o){var s,a,c,u,l,f,p,d,h,y,v,_,g,m,b,w,S,E,O,C,P,I,j;return void 0===o&&(o=new Date),r.__generator(this,(function(r){switch(r.label){case 0:return"function"!=typeof this.credentials.getPromise?[3,2]:[4,this.credentials.getPromise()];case 1:r.sent(),r.label=2;case 2:if((0,i.validateValueNonNil)(this.credentials.accessKeyId,"credentials.accessKeyId"),(0,i.validateValueNonNil)(this.credentials.secretAccessKey,"credentials.secretAccessKey"),s=e.getDateTimeString(o),a=e.getDateString(o),u="".concat(c="wss","://"),!t.startsWith(u))throw new Error("Endpoint '".concat(t,"' is not a secure WebSocket endpoint. It should start with '").concat(u,"'."));if(t.includes("?"))throw new Error("Endpoint '".concat(t,"' should not contain any query parameters."));return(l=t.indexOf("/",u.length))<0?(f=t.substring(u.length),p="/"):(f=t.substring(u.length,l),p=t.substring(l)),d=["host"].join(";"),h="GET",y=a+"/"+this.region+"/"+this.service+"/aws4_request",v=Object.assign({},n,{"X-Amz-Algorithm":e.DEFAULT_ALGORITHM,"X-Amz-Credential":this.credentials.accessKeyId+"/"+y,"X-Amz-Date":s,"X-Amz-Expires":"299","X-Amz-SignedHeaders":d}),this.credentials.sessionToken&&Object.assign(v,{"X-Amz-Security-Token":this.credentials.sessionToken}),_=e.createQueryString(v),g={host:f},m=e.createHeadersString(g),[4,e.sha256("")];case 3:return b=r.sent(),w=[h,p,_,m,d,b].join("\n"),[4,e.sha256(w)];case 4:return S=r.sent(),E=[e.DEFAULT_ALGORITHM,s,y,S].join("\n"),[4,this.getSignatureKey(a)];case 5:return O=r.sent(),I=(P=e).toHex,[4,e.hmac(O,E)];case 6:return[4,I.apply(P,[r.sent()])];case 7:return C=r.sent(),j=Object.assign({},v,{"X-Amz-Signature":C}),[2,c+"://"+f+p+"?"+e.createQueryString(j)]}}))}))},e.prototype.getSignatureKey=function(t){return r.__awaiter(this,void 0,Promise,(function(){var n,o,i;return r.__generator(this,(function(r){switch(r.label){case 0:return[4,e.hmac("AWS4"+this.credentials.secretAccessKey,t)];case 1:return n=r.sent(),[4,e.hmac(n,this.region)];case 2:return o=r.sent(),[4,e.hmac(o,this.service)];case 3:return i=r.sent(),[4,e.hmac(i,"aws4_request")];case 4:return[2,r.sent()]}}))}))},e.createHeadersString=function(e){return Object.keys(e).map((function(t){return"".concat(t,":").concat(e[t],"\n")})).join()},e.createQueryString=function(e){return Object.keys(e).sort().map((function(t){return"".concat(t,"=").concat(encodeURIComponent(e[t]))})).join("&")},e.getDateTimeString=function(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z").replace(/[:\-]/g,"")},e.getDateString=function(e){return this.getDateTimeString(e).substring(0,8)},e.sha256=function(e){return r.__awaiter(this,void 0,Promise,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:return[4,o.default.subtle.digest({name:"SHA-256"},this.toUint8Array(e))];case 1:return t=n.sent(),[2,this.toHex(t)]}}))}))},e.hmac=function(e,t){return r.__awaiter(this,void 0,Promise,(function(){var n,i,s;return r.__generator(this,(function(r){switch(r.label){case 0:return n="string"==typeof e?this.toUint8Array(e).buffer:e,i=this.toUint8Array(t).buffer,[4,o.default.subtle.importKey("raw",n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"])];case 1:return s=r.sent(),[4,o.default.subtle.sign({name:"HMAC",hash:{name:"SHA-256"}},s,i)];case 2:return[2,r.sent()]}}))}))},e.toUint8Array=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,o=e.length;r{Object.defineProperty(t,"__esModule",{value:!0}),t.SignalingClient=void 0;var r,o,i=n(635),s=n(7),a=n(821),c=n(87),u=i.__importDefault(n(214)),l=n(874);!function(e){e.SDP_ANSWER="SDP_ANSWER",e.SDP_OFFER="SDP_OFFER",e.ICE_CANDIDATE="ICE_CANDIDATE",e.STATUS_RESPONSE="STATUS_RESPONSE"}(r||(r={})),function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(o||(o={}));var f=function(e){function t(t){var n=e.call(this)||this;return n.websocket=null,n.readyState=o.CLOSED,n.pendingIceCandidatesByClientId={},n.hasReceivedRemoteSDPByClientId={},(0,l.validateValueNonNil)(t,"SignalingClientConfig"),(0,l.validateValueNonNil)(t.role,"role"),t.role===a.Role.VIEWER?(0,l.validateValueNonNil)(t.clientId,"clientId"):(0,l.validateValueNil)(t.clientId,"clientId"),(0,l.validateValueNonNil)(t.channelARN,"channelARN"),(0,l.validateValueNonNil)(t.region,"region"),(0,l.validateValueNonNil)(t.channelEndpoint,"channelEndpoint"),n.config=i.__assign({},t),t.requestSigner?n.requestSigner=t.requestSigner:((0,l.validateValueNonNil)(t.credentials,"credentials"),n.requestSigner=new c.SigV4RequestSigner(t.region,t.credentials)),n.dateProvider=new u.default(t.systemClockOffset||0),n.onOpen=n.onOpen.bind(n),n.onMessage=n.onMessage.bind(n),n.onError=n.onError.bind(n),n.onClose=n.onClose.bind(n),n}return i.__extends(t,e),t.prototype.open=function(){var e=this;if(this.readyState!==o.CLOSED)throw new Error("Client is already open, opening, or closing");this.readyState=o.CONNECTING,this.asyncOpen().then().catch((function(t){return e.onError(t)}))},t.prototype.asyncOpen=function(){return i.__awaiter(this,void 0,Promise,(function(){var e,t;return i.__generator(this,(function(r){switch(r.label){case 0:return e={"X-Amz-ChannelARN":this.config.channelARN},this.config.role===a.Role.VIEWER&&(e["X-Amz-ClientId"]=this.config.clientId),[4,this.requestSigner.getSignedURL(this.config.channelEndpoint,e,this.dateProvider.getDate())];case 1:return t=r.sent(),this.readyState!==o.CONNECTING?[2]:(this.websocket=new(WebSocket||n(591))(t),this.websocket.addEventListener("open",this.onOpen),this.websocket.addEventListener("message",this.onMessage),this.websocket.addEventListener("error",this.onError),this.websocket.addEventListener("close",this.onClose),[2])}}))}))},t.prototype.close=function(){null!==this.websocket?(this.readyState=o.CLOSING,this.websocket.close()):this.readyState!==o.CLOSED&&this.onClose()},t.prototype.sendSdpOffer=function(e,t,n){this.sendMessage(r.SDP_OFFER,e,t,n)},t.prototype.sendSdpAnswer=function(e,t,n){this.sendMessage(r.SDP_ANSWER,e,t,n)},t.prototype.sendIceCandidate=function(e,t,n){this.sendMessage(r.ICE_CANDIDATE,e,t,n)},t.prototype.sendMessage=function(e,n,r,i){if(this.readyState!==o.OPEN)throw new Error("Could not send message because the connection to the signaling service is not open.");this.validateRecipientClientId(r),this.validateCorrelationId(i),this.websocket.send(JSON.stringify({action:e,messagePayload:t.serializeJSONObjectAsBase64String(n),recipientClientId:r||void 0,correlationId:i||void 0}))},t.prototype.cleanupWebSocket=function(){null!==this.websocket&&(this.websocket.removeEventListener("open",this.onOpen),this.websocket.removeEventListener("message",this.onMessage),this.websocket.removeEventListener("error",this.onError),this.websocket.removeEventListener("close",this.onClose),this.websocket=null)},t.prototype.onOpen=function(){this.readyState=o.OPEN,this.emit("open")},t.prototype.onMessage=function(e){var n,o;try{n=JSON.parse(e.data)}catch(e){return}try{o=t.parseJSONObjectFromBase64String(n.messagePayload)}catch(e){}var i=n.messageType,s=n.senderClientId,a=n.statusResponse;if(o||a)switch(i){case r.SDP_OFFER:return this.emit("sdpOffer",o,s),void this.emitPendingIceCandidates(s);case r.SDP_ANSWER:return this.emit("sdpAnswer",o,s),void this.emitPendingIceCandidates(s);case r.ICE_CANDIDATE:return void this.emitOrQueueIceCandidate(o,s);case r.STATUS_RESPONSE:return void this.emit("statusResponse",a)}},t.parseJSONObjectFromBase64String=function(e){try{return JSON.parse(atob(e))}catch(t){return JSON.parse(Buffer.from(e,"base64").toString())}},t.serializeJSONObjectAsBase64String=function(e){try{return btoa(JSON.stringify(e))}catch(t){return Buffer.from(JSON.stringify(e)).toString("base64")}},t.prototype.emitOrQueueIceCandidate=function(e,n){var r=n||t.DEFAULT_CLIENT_ID;this.hasReceivedRemoteSDPByClientId[r]?this.emit("iceCandidate",e,n):(this.pendingIceCandidatesByClientId[r]||(this.pendingIceCandidatesByClientId[r]=[]),this.pendingIceCandidatesByClientId[r].push(e))},t.prototype.emitPendingIceCandidates=function(e){var n=this,r=e||t.DEFAULT_CLIENT_ID;this.hasReceivedRemoteSDPByClientId[r]=!0;var o=this.pendingIceCandidatesByClientId[r];o&&(delete this.pendingIceCandidatesByClientId[r],o.forEach((function(t){n.emit("iceCandidate",t,e)})))},t.prototype.validateRecipientClientId=function(e){if(this.config.role===a.Role.VIEWER&&e)throw new Error("Unexpected recipient client id. As the VIEWER, messages must not be sent with a recipient client id.")},t.prototype.validateCorrelationId=function(e){if(e&&!/^[a-zA-Z0-9_.-]{1,256}$/.test(e))throw new Error("Correlation id does not fit the constraint!")},t.prototype.onError=function(e){this.emit("error",e)},t.prototype.onClose=function(){this.readyState=o.CLOSED,this.cleanupWebSocket(),this.emit("close")},t.DEFAULT_CLIENT_ID="MASTER",t}(s.EventEmitter);t.SignalingClient=f},214:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this.clockOffsetMs=e}return e.prototype.getDate=function(){return new Date(Date.now()+this.clockOffsetMs)},e}();t.default=n},874:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateValueNonNil=function(e,t){if(null===e)throw new Error("".concat(t," cannot be null"));if(void 0===e)throw new Error("".concat(t," cannot be undefined"));if(""===e)throw new Error("".concat(t," cannot be empty"))},t.validateValueNil=function(e,t){if(null!=e&&""!==e)throw new Error("".concat(t," should be null"))}},591:e=>{e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},143:e=>{e.exports=window.crypto},635:(e,t,n)=>{n.r(t),n.d(t,{__addDisposableResource:()=>x,__assign:()=>i,__asyncDelegator:()=>C,__asyncGenerator:()=>O,__asyncValues:()=>P,__await:()=>E,__awaiter:()=>h,__classPrivateFieldGet:()=>L,__classPrivateFieldIn:()=>D,__classPrivateFieldSet:()=>T,__createBinding:()=>v,__decorate:()=>a,__disposeResources:()=>M,__esDecorate:()=>u,__exportStar:()=>_,__extends:()=>o,__generator:()=>y,__importDefault:()=>N,__importStar:()=>R,__makeTemplateObject:()=>I,__metadata:()=>d,__param:()=>c,__propKey:()=>f,__read:()=>m,__rest:()=>s,__rewriteRelativeImportExtension:()=>F,__runInitializers:()=>l,__setFunctionName:()=>p,__spread:()=>b,__spreadArray:()=>S,__spreadArrays:()=>w,__values:()=>g,default:()=>V});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r,o,i){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=r.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?r.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),p=!1,d=n.length-1;d>=0;d--){var h={};for(var y in r)h[y]="access"===y?{}:r[y];for(var y in r.access)h.access[y]=r.access[y];h.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(s(e||null))};var v=(0,n[d])("accessor"===c?{get:f.get,set:f.set}:f[u],h);if("accessor"===c){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(a=s(v.get))&&(f.get=a),(a=s(v.set))&&(f.set=a),(a=s(v.init))&&o.unshift(a)}else(a=s(v))&&("field"===c?o.unshift(a):f[u]=a)}l&&Object.defineProperty(l,r.name,f),p=!0}function l(e,t,n){for(var r=arguments.length>2,o=0;o0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function b(){for(var e=[],t=0;t1||a(e,t)}))},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=o[e](t)).value instanceof E?Promise.resolve(n.value.v).then(c,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function C(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:E(e[r](t)),done:!1}:o?o(t):t}:o}}function P(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=g(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function I(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var j=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},A=function(e){return A=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},A(e)};function R(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=A(e),r=0;r{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=e.RequestSigner=e.QueryParams=e.SigV4RequestSigner=e.SignalingClient=e.Role=void 0;var t=n(821);Object.defineProperty(e,"Role",{enumerable:!0,get:function(){return t.Role}});var o=n(574);Object.defineProperty(e,"SignalingClient",{enumerable:!0,get:function(){return o.SignalingClient}});var i=n(87);Object.defineProperty(e,"SigV4RequestSigner",{enumerable:!0,get:function(){return i.SigV4RequestSigner}});var s=n(359);Object.defineProperty(e,"QueryParams",{enumerable:!0,get:function(){return s.QueryParams}});var a=n(810);Object.defineProperty(e,"RequestSigner",{enumerable:!0,get:function(){return a.RequestSigner}}),e.VERSION="2.3.2"})(),window.KVSWebRTC=r})(); \ No newline at end of file