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C,aAAa,CACjB,AAAA,EAAc,mBAAmB,CACjC,+CAED,MACD,CAGA,GAAI,AAAE,GAAU,CAAC,AAAA,GAAK,UAAU,CAAC,GAAS,CACzC,IAAI,CAAC,aAAa,CAAC,AAAA,EAAc,SAAS,CAAE,CAAC,IAAI,EAAE,EAAO,YAAY,CAAC,EACvE,MACD,CAEI,EACH,IAAI,CAAC,WAAW,CAAC,GAEjB,IAAI,CAAC,IAAI,CACP,UAAU,GACV,IAAI,CAAC,AAAC,GAAO,IAAI,CAAC,WAAW,CAAC,IAC9B,KAAK,CAAC,AAAC,GAAU,IAAI,CAAC,MAAM,CAAC,AAAA,EAAc,WAAW,CAAE,GAE5D,CA6bD,CAvnBa,GACY,WAAA,CAAc,SrB9GjC,OAAQ,MAAM,CAAG,CACtB,KAAA,GACA,KAAA,EACD,EAEM,OAAQ,IAAI,CAAG,E,C","sources":["","lib/global.ts","lib/util.ts","lib/dataconnection/BufferedConnection/binaryPackChunker.ts","node_modules/peerjs-js-binarypack/dist/binarypack.mjs","node_modules/peerjs-js-binarypack/lib/binarypack.ts","node_modules/peerjs-js-binarypack/lib/bufferbuilder.ts","lib/supports.ts","node_modules/webrtc-adapter/src/js/adapter_core.js","node_modules/webrtc-adapter/src/js/adapter_factory.js","node_modules/webrtc-adapter/src/js/utils.js","node_modules/webrtc-adapter/src/js/chrome/chrome_shim.js","node_modules/webrtc-adapter/src/js/chrome/getusermedia.js","node_modules/webrtc-adapter/src/js/chrome/getdisplaymedia.js","node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js","node_modules/webrtc-adapter/src/js/firefox/getusermedia.js","node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js","node_modules/webrtc-adapter/src/js/safari/safari_shim.js","node_modules/webrtc-adapter/src/js/common_shim.js","node_modules/sdp/sdp.js","lib/utils/validateId.ts","lib/utils/randomToken.ts","lib/peer.ts","lib/logger.ts","lib/socket.ts","node_modules/eventemitter3/index.js","lib/enums.ts","package.json","lib/mediaconnection.ts","lib/negotiator.ts","lib/baseconnection.ts","lib/peerError.ts","lib/api.ts","lib/dataconnection/BufferedConnection/BinaryPack.ts","lib/dataconnection/BufferedConnection/BufferedConnection.ts","lib/dataconnection/DataConnection.ts","lib/dataconnection/BufferedConnection/Raw.ts","lib/dataconnection/BufferedConnection/Json.ts"],"sourcesContent":["(() => {\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\nclass $337647a69164cf0a$export$f1c5f4c9cb95390b {\n constructor(){\n this.chunkedMTU = 16300 // The original 60000 bytes setting does not work when sending data from Firefox to Chrome, which is \"cut off\" after 16384 bytes and delivered individually.\n ;\n // Binary stuff\n this._dataCount = 1;\n this.chunk = (blob)=>{\n const chunks = [];\n const size = blob.byteLength;\n const total = Math.ceil(size / this.chunkedMTU);\n let index = 0;\n let start = 0;\n while(start < size){\n const end = Math.min(size, start + this.chunkedMTU);\n const b = blob.slice(start, end);\n const chunk = {\n __peerData: this._dataCount,\n n: index,\n data: b,\n total: total\n };\n chunks.push(chunk);\n start = end;\n index++;\n }\n this._dataCount++;\n return chunks;\n };\n }\n}\nfunction $337647a69164cf0a$export$52c89ebcdc4f53f2(bufs) {\n let size = 0;\n for (const buf of bufs)size += buf.byteLength;\n const result = new Uint8Array(size);\n let offset = 0;\n for (const buf of bufs){\n result.set(buf, offset);\n offset += buf.byteLength;\n }\n return result;\n}\n\n\nclass $41cdfe0a3ede2608$var$$e8379818650e2442$export$93654d4f2d6cd524 {\n append_buffer(data) {\n this.flush();\n this._parts.push(data);\n }\n append(data) {\n this._pieces.push(data);\n }\n flush() {\n if (this._pieces.length > 0) {\n const buf = new Uint8Array(this._pieces);\n this._parts.push(buf);\n this._pieces = [];\n }\n }\n toArrayBuffer() {\n const buffer = [];\n for (const part of this._parts)buffer.push(part);\n return $41cdfe0a3ede2608$var$$e8379818650e2442$var$concatArrayBuffers(buffer).buffer;\n }\n constructor(){\n this.encoder = new TextEncoder();\n this._pieces = [];\n this._parts = [];\n }\n}\nfunction $41cdfe0a3ede2608$var$$e8379818650e2442$var$concatArrayBuffers(bufs) {\n let size = 0;\n for (const buf of bufs)size += buf.byteLength;\n const result = new Uint8Array(size);\n let offset = 0;\n for (const buf of bufs){\n const view = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n result.set(view, offset);\n offset += buf.byteLength;\n }\n return result;\n}\nfunction $41cdfe0a3ede2608$export$417857010dc9287f(data) {\n const unpacker = new $41cdfe0a3ede2608$var$$0cfd7828ad59115f$var$Unpacker(data);\n return unpacker.unpack();\n}\nfunction $41cdfe0a3ede2608$export$2a703dbb0cb35339(data) {\n const packer = new $41cdfe0a3ede2608$export$b9ec4b114aa40074();\n const res = packer.pack(data);\n if (res instanceof Promise) return res.then(()=>packer.getBuffer());\n return packer.getBuffer();\n}\nclass $41cdfe0a3ede2608$var$$0cfd7828ad59115f$var$Unpacker {\n unpack() {\n const type = this.unpack_uint8();\n if (type < 0x80) return type;\n else if ((type ^ 0xe0) < 0x20) return (type ^ 0xe0) - 0x20;\n let size;\n if ((size = type ^ 0xa0) <= 0x0f) return this.unpack_raw(size);\n else if ((size = type ^ 0xb0) <= 0x0f) return this.unpack_string(size);\n else if ((size = type ^ 0x90) <= 0x0f) return this.unpack_array(size);\n else if ((size = type ^ 0x80) <= 0x0f) return this.unpack_map(size);\n switch(type){\n case 0xc0:\n return null;\n case 0xc1:\n return undefined;\n case 0xc2:\n return false;\n case 0xc3:\n return true;\n case 0xca:\n return this.unpack_float();\n case 0xcb:\n return this.unpack_double();\n case 0xcc:\n return this.unpack_uint8();\n case 0xcd:\n return this.unpack_uint16();\n case 0xce:\n return this.unpack_uint32();\n case 0xcf:\n return this.unpack_uint64();\n case 0xd0:\n return this.unpack_int8();\n case 0xd1:\n return this.unpack_int16();\n case 0xd2:\n return this.unpack_int32();\n case 0xd3:\n return this.unpack_int64();\n case 0xd4:\n return undefined;\n case 0xd5:\n return undefined;\n case 0xd6:\n return undefined;\n case 0xd7:\n return undefined;\n case 0xd8:\n size = this.unpack_uint16();\n return this.unpack_string(size);\n case 0xd9:\n size = this.unpack_uint32();\n return this.unpack_string(size);\n case 0xda:\n size = this.unpack_uint16();\n return this.unpack_raw(size);\n case 0xdb:\n size = this.unpack_uint32();\n return this.unpack_raw(size);\n case 0xdc:\n size = this.unpack_uint16();\n return this.unpack_array(size);\n case 0xdd:\n size = this.unpack_uint32();\n return this.unpack_array(size);\n case 0xde:\n size = this.unpack_uint16();\n return this.unpack_map(size);\n case 0xdf:\n size = this.unpack_uint32();\n return this.unpack_map(size);\n }\n }\n unpack_uint8() {\n const byte = this.dataView[this.index] & 0xff;\n this.index++;\n return byte;\n }\n unpack_uint16() {\n const bytes = this.read(2);\n const uint16 = (bytes[0] & 0xff) * 256 + (bytes[1] & 0xff);\n this.index += 2;\n return uint16;\n }\n unpack_uint32() {\n const bytes = this.read(4);\n const uint32 = ((bytes[0] * 256 + bytes[1]) * 256 + bytes[2]) * 256 + bytes[3];\n this.index += 4;\n return uint32;\n }\n unpack_uint64() {\n const bytes = this.read(8);\n const uint64 = ((((((bytes[0] * 256 + bytes[1]) * 256 + bytes[2]) * 256 + bytes[3]) * 256 + bytes[4]) * 256 + bytes[5]) * 256 + bytes[6]) * 256 + bytes[7];\n this.index += 8;\n return uint64;\n }\n unpack_int8() {\n const uint8 = this.unpack_uint8();\n return uint8 < 0x80 ? uint8 : uint8 - 256;\n }\n unpack_int16() {\n const uint16 = this.unpack_uint16();\n return uint16 < 0x8000 ? uint16 : uint16 - 65536;\n }\n unpack_int32() {\n const uint32 = this.unpack_uint32();\n return uint32 < 2 ** 31 ? uint32 : uint32 - 2 ** 32;\n }\n unpack_int64() {\n const uint64 = this.unpack_uint64();\n return uint64 < 2 ** 63 ? uint64 : uint64 - 2 ** 64;\n }\n unpack_raw(size) {\n if (this.length < this.index + size) throw new Error(`BinaryPackFailure: index is out of range ${this.index} ${size} ${this.length}`);\n const buf = this.dataBuffer.slice(this.index, this.index + size);\n this.index += size;\n return buf;\n }\n unpack_string(size) {\n const bytes = this.read(size);\n let i = 0;\n let str = \"\";\n let c;\n let code;\n while(i < size){\n c = bytes[i];\n // The length of a UTF-8 sequence is specified in the first byte:\n // 0xxxxxxx means length 1,\n // 110xxxxx means length 2,\n // 1110xxxx means length 3,\n // 11110xxx means length 4.\n // 10xxxxxx is for non-initial bytes.\n if (c < 0xa0) {\n // One-byte sequence: bits 0xxxxxxx\n code = c;\n i++;\n } else if ((c ^ 0xc0) < 0x20) {\n // Two-byte sequence: bits 110xxxxx 10xxxxxx\n code = (c & 0x1f) << 6 | bytes[i + 1] & 0x3f;\n i += 2;\n } else if ((c ^ 0xe0) < 0x10) {\n // Three-byte sequence: bits 1110xxxx 10xxxxxx 10xxxxxx\n code = (c & 0x0f) << 12 | (bytes[i + 1] & 0x3f) << 6 | bytes[i + 2] & 0x3f;\n i += 3;\n } else {\n // Four-byte sequence: bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n code = (c & 0x07) << 18 | (bytes[i + 1] & 0x3f) << 12 | (bytes[i + 2] & 0x3f) << 6 | bytes[i + 3] & 0x3f;\n i += 4;\n }\n str += String.fromCodePoint(code);\n }\n this.index += size;\n return str;\n }\n unpack_array(size) {\n const objects = new Array(size);\n for(let i = 0; i < size; i++)objects[i] = this.unpack();\n return objects;\n }\n unpack_map(size) {\n const map = {};\n for(let i = 0; i < size; i++){\n const key = this.unpack();\n map[key] = this.unpack();\n }\n return map;\n }\n unpack_float() {\n const uint32 = this.unpack_uint32();\n const sign = uint32 >> 31;\n const exp = (uint32 >> 23 & 0xff) - 127;\n const fraction = uint32 & 0x7fffff | 0x800000;\n return (sign === 0 ? 1 : -1) * fraction * 2 ** (exp - 23);\n }\n unpack_double() {\n const h32 = this.unpack_uint32();\n const l32 = this.unpack_uint32();\n const sign = h32 >> 31;\n const exp = (h32 >> 20 & 0x7ff) - 1023;\n const hfrac = h32 & 0xfffff | 0x100000;\n const frac = hfrac * 2 ** (exp - 20) + l32 * 2 ** (exp - 52);\n return (sign === 0 ? 1 : -1) * frac;\n }\n read(length) {\n const j = this.index;\n if (j + length <= this.length) return this.dataView.subarray(j, j + length);\n else throw new Error(\"BinaryPackFailure: read index out of range\");\n }\n constructor(data){\n this.index = 0;\n this.dataBuffer = data;\n this.dataView = new Uint8Array(this.dataBuffer);\n this.length = this.dataBuffer.byteLength;\n }\n}\nclass $41cdfe0a3ede2608$export$b9ec4b114aa40074 {\n getBuffer() {\n return this._bufferBuilder.toArrayBuffer();\n }\n pack(value) {\n if (typeof value === \"string\") this.pack_string(value);\n else if (typeof value === \"number\") {\n if (Math.floor(value) === value) this.pack_integer(value);\n else this.pack_double(value);\n } else if (typeof value === \"boolean\") {\n if (value === true) this._bufferBuilder.append(0xc3);\n else if (value === false) this._bufferBuilder.append(0xc2);\n } else if (value === undefined) this._bufferBuilder.append(0xc0);\n else if (typeof value === \"object\") {\n if (value === null) this._bufferBuilder.append(0xc0);\n else {\n const constructor = value.constructor;\n if (value instanceof Array) {\n const res = this.pack_array(value);\n if (res instanceof Promise) return res.then(()=>this._bufferBuilder.flush());\n } else if (value instanceof ArrayBuffer) this.pack_bin(new Uint8Array(value));\n else if (\"BYTES_PER_ELEMENT\" in value) {\n const v = value;\n this.pack_bin(new Uint8Array(v.buffer, v.byteOffset, v.byteLength));\n } else if (value instanceof Date) this.pack_string(value.toString());\n else if (value instanceof Blob) return value.arrayBuffer().then((buffer)=>{\n this.pack_bin(new Uint8Array(buffer));\n this._bufferBuilder.flush();\n });\n else if (constructor == Object || constructor.toString().startsWith(\"class\")) {\n const res = this.pack_object(value);\n if (res instanceof Promise) return res.then(()=>this._bufferBuilder.flush());\n } else throw new Error(`Type \"${constructor.toString()}\" not yet supported`);\n }\n } else throw new Error(`Type \"${typeof value}\" not yet supported`);\n this._bufferBuilder.flush();\n }\n pack_bin(blob) {\n const length = blob.length;\n if (length <= 0x0f) this.pack_uint8(0xa0 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xda);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xdb);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n this._bufferBuilder.append_buffer(blob);\n }\n pack_string(str) {\n const encoded = this._textEncoder.encode(str);\n const length = encoded.length;\n if (length <= 0x0f) this.pack_uint8(0xb0 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xd8);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xd9);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n this._bufferBuilder.append_buffer(encoded);\n }\n pack_array(ary) {\n const length = ary.length;\n if (length <= 0x0f) this.pack_uint8(0x90 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xdc);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xdd);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n const packNext = (index)=>{\n if (index < length) {\n const res = this.pack(ary[index]);\n if (res instanceof Promise) return res.then(()=>packNext(index + 1));\n return packNext(index + 1);\n }\n };\n return packNext(0);\n }\n pack_integer(num) {\n if (num >= -32 && num <= 0x7f) this._bufferBuilder.append(num & 0xff);\n else if (num >= 0x00 && num <= 0xff) {\n this._bufferBuilder.append(0xcc);\n this.pack_uint8(num);\n } else if (num >= -128 && num <= 0x7f) {\n this._bufferBuilder.append(0xd0);\n this.pack_int8(num);\n } else if (num >= 0x0000 && num <= 0xffff) {\n this._bufferBuilder.append(0xcd);\n this.pack_uint16(num);\n } else if (num >= -32768 && num <= 0x7fff) {\n this._bufferBuilder.append(0xd1);\n this.pack_int16(num);\n } else if (num >= 0x00000000 && num <= 0xffffffff) {\n this._bufferBuilder.append(0xce);\n this.pack_uint32(num);\n } else if (num >= -2147483648 && num <= 0x7fffffff) {\n this._bufferBuilder.append(0xd2);\n this.pack_int32(num);\n } else if (num >= -9223372036854776000 && num <= 0x7fffffffffffffff) {\n this._bufferBuilder.append(0xd3);\n this.pack_int64(num);\n } else if (num >= 0x0000000000000000 && num <= 0xffffffffffffffff) {\n this._bufferBuilder.append(0xcf);\n this.pack_uint64(num);\n } else throw new Error(\"Invalid integer\");\n }\n pack_double(num) {\n let sign = 0;\n if (num < 0) {\n sign = 1;\n num = -num;\n }\n const exp = Math.floor(Math.log(num) / Math.LN2);\n const frac0 = num / 2 ** exp - 1;\n const frac1 = Math.floor(frac0 * 2 ** 52);\n const b32 = 2 ** 32;\n const h32 = sign << 31 | exp + 1023 << 20 | frac1 / b32 & 0x0fffff;\n const l32 = frac1 % b32;\n this._bufferBuilder.append(0xcb);\n this.pack_int32(h32);\n this.pack_int32(l32);\n }\n pack_object(obj) {\n const keys = Object.keys(obj);\n const length = keys.length;\n if (length <= 0x0f) this.pack_uint8(0x80 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xde);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xdf);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n const packNext = (index)=>{\n if (index < keys.length) {\n const prop = keys[index];\n // eslint-disable-next-line no-prototype-builtins\n if (obj.hasOwnProperty(prop)) {\n this.pack(prop);\n const res = this.pack(obj[prop]);\n if (res instanceof Promise) return res.then(()=>packNext(index + 1));\n }\n return packNext(index + 1);\n }\n };\n return packNext(0);\n }\n pack_uint8(num) {\n this._bufferBuilder.append(num);\n }\n pack_uint16(num) {\n this._bufferBuilder.append(num >> 8);\n this._bufferBuilder.append(num & 0xff);\n }\n pack_uint32(num) {\n const n = num & 0xffffffff;\n this._bufferBuilder.append((n & 0xff000000) >>> 24);\n this._bufferBuilder.append((n & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((n & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(n & 0x000000ff);\n }\n pack_uint64(num) {\n const high = num / 2 ** 32;\n const low = num % 2 ** 32;\n this._bufferBuilder.append((high & 0xff000000) >>> 24);\n this._bufferBuilder.append((high & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((high & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(high & 0x000000ff);\n this._bufferBuilder.append((low & 0xff000000) >>> 24);\n this._bufferBuilder.append((low & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((low & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(low & 0x000000ff);\n }\n pack_int8(num) {\n this._bufferBuilder.append(num & 0xff);\n }\n pack_int16(num) {\n this._bufferBuilder.append((num & 0xff00) >> 8);\n this._bufferBuilder.append(num & 0xff);\n }\n pack_int32(num) {\n this._bufferBuilder.append(num >>> 24 & 0xff);\n this._bufferBuilder.append((num & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((num & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(num & 0x000000ff);\n }\n pack_int64(num) {\n const high = Math.floor(num / 2 ** 32);\n const low = num % 2 ** 32;\n this._bufferBuilder.append((high & 0xff000000) >>> 24);\n this._bufferBuilder.append((high & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((high & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(high & 0x000000ff);\n this._bufferBuilder.append((low & 0xff000000) >>> 24);\n this._bufferBuilder.append((low & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((low & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(low & 0x000000ff);\n }\n constructor(){\n this._bufferBuilder = new $41cdfe0a3ede2608$var$$e8379818650e2442$export$93654d4f2d6cd524();\n this._textEncoder = new TextEncoder();\n }\n}\n\n\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ /*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \"use strict\";\nlet $11d9b3e4fc7791e1$var$logDisabled_ = true;\nlet $11d9b3e4fc7791e1$var$deprecationWarnings_ = true;\nfunction $11d9b3e4fc7791e1$export$e3c02be309be1f23(uastring, expr, pos) {\n const match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n}\nfunction $11d9b3e4fc7791e1$export$1f48841962b828b1(window1, eventNameToWrap, wrapper) {\n if (!window1.RTCPeerConnection) return;\n const proto = window1.RTCPeerConnection.prototype;\n const nativeAddEventListener = proto.addEventListener;\n proto.addEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap) return nativeAddEventListener.apply(this, arguments);\n const wrappedCallback = (e)=>{\n const modifiedEvent = wrapper(e);\n if (modifiedEvent) {\n if (cb.handleEvent) cb.handleEvent(modifiedEvent);\n else cb(modifiedEvent);\n }\n };\n this._eventMap = this._eventMap || {};\n if (!this._eventMap[eventNameToWrap]) this._eventMap[eventNameToWrap] = new Map();\n this._eventMap[eventNameToWrap].set(cb, wrappedCallback);\n return nativeAddEventListener.apply(this, [\n nativeEventName,\n wrappedCallback\n ]);\n };\n const nativeRemoveEventListener = proto.removeEventListener;\n proto.removeEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap || !this._eventMap || !this._eventMap[eventNameToWrap]) return nativeRemoveEventListener.apply(this, arguments);\n if (!this._eventMap[eventNameToWrap].has(cb)) return nativeRemoveEventListener.apply(this, arguments);\n const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);\n this._eventMap[eventNameToWrap].delete(cb);\n if (this._eventMap[eventNameToWrap].size === 0) delete this._eventMap[eventNameToWrap];\n if (Object.keys(this._eventMap).length === 0) delete this._eventMap;\n return nativeRemoveEventListener.apply(this, [\n nativeEventName,\n unwrappedCb\n ]);\n };\n Object.defineProperty(proto, \"on\" + eventNameToWrap, {\n get () {\n return this[\"_on\" + eventNameToWrap];\n },\n set (cb) {\n if (this[\"_on\" + eventNameToWrap]) {\n this.removeEventListener(eventNameToWrap, this[\"_on\" + eventNameToWrap]);\n delete this[\"_on\" + eventNameToWrap];\n }\n if (cb) this.addEventListener(eventNameToWrap, this[\"_on\" + eventNameToWrap] = cb);\n },\n enumerable: true,\n configurable: true\n });\n}\nfunction $11d9b3e4fc7791e1$export$afbfee8cc06fd3e4(bool) {\n if (typeof bool !== \"boolean\") return new Error(\"Argument type: \" + typeof bool + \". Please use a boolean.\");\n $11d9b3e4fc7791e1$var$logDisabled_ = bool;\n return bool ? \"adapter.js logging disabled\" : \"adapter.js logging enabled\";\n}\nfunction $11d9b3e4fc7791e1$export$51516be4b019e41e(bool) {\n if (typeof bool !== \"boolean\") return new Error(\"Argument type: \" + typeof bool + \". Please use a boolean.\");\n $11d9b3e4fc7791e1$var$deprecationWarnings_ = !bool;\n return \"adapter.js deprecation warnings \" + (bool ? \"disabled\" : \"enabled\");\n}\nfunction $11d9b3e4fc7791e1$export$bef1f36f5486a6a3() {\n if (typeof window === \"object\") {\n if ($11d9b3e4fc7791e1$var$logDisabled_) return;\n if (typeof console !== \"undefined\" && typeof console.log === \"function\") console.log.apply(console, arguments);\n }\n}\nfunction $11d9b3e4fc7791e1$export$cdd73fc4100a6ef4(oldMethod, newMethod) {\n if (!$11d9b3e4fc7791e1$var$deprecationWarnings_) return;\n console.warn(oldMethod + \" is deprecated, please use \" + newMethod + \" instead.\");\n}\nfunction $11d9b3e4fc7791e1$export$2d31490a0c05f094(window1) {\n // Returned result object.\n const result = {\n browser: null,\n version: null\n };\n // Fail early if it's not a browser\n if (typeof window1 === \"undefined\" || !window1.navigator || !window1.navigator.userAgent) {\n result.browser = \"Not a browser.\";\n return result;\n }\n const { navigator: navigator } = window1;\n if (navigator.mozGetUserMedia) {\n result.browser = \"firefox\";\n result.version = $11d9b3e4fc7791e1$export$e3c02be309be1f23(navigator.userAgent, /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia || window1.isSecureContext === false && window1.webkitRTCPeerConnection) {\n // Chrome, Chromium, Webview, Opera.\n // Version matches Chrome/WebRTC version.\n // Chrome 74 removed webkitGetUserMedia on http as well so we need the\n // more complicated fallback to webkitRTCPeerConnection.\n result.browser = \"chrome\";\n result.version = $11d9b3e4fc7791e1$export$e3c02be309be1f23(navigator.userAgent, /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else if (window1.RTCPeerConnection && navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) {\n result.browser = \"safari\";\n result.version = $11d9b3e4fc7791e1$export$e3c02be309be1f23(navigator.userAgent, /AppleWebKit\\/(\\d+)\\./, 1);\n result.supportsUnifiedPlan = window1.RTCRtpTransceiver && \"currentDirection\" in window1.RTCRtpTransceiver.prototype;\n } else {\n result.browser = \"Not a supported browser.\";\n return result;\n }\n return result;\n}\n/**\n * Checks if something is an object.\n *\n * @param {*} val The something you want to check.\n * @return true if val is an object, false otherwise.\n */ function $11d9b3e4fc7791e1$var$isObject(val) {\n return Object.prototype.toString.call(val) === \"[object Object]\";\n}\nfunction $11d9b3e4fc7791e1$export$15384eac40dc88c8(data) {\n if (!$11d9b3e4fc7791e1$var$isObject(data)) return data;\n return Object.keys(data).reduce(function(accumulator, key) {\n const isObj = $11d9b3e4fc7791e1$var$isObject(data[key]);\n const value = isObj ? $11d9b3e4fc7791e1$export$15384eac40dc88c8(data[key]) : data[key];\n const isEmptyObject = isObj && !Object.keys(value).length;\n if (value === undefined || isEmptyObject) return accumulator;\n return Object.assign(accumulator, {\n [key]: value\n });\n }, {});\n}\nfunction $11d9b3e4fc7791e1$export$571b373e75babb58(stats, base, resultSet) {\n if (!base || resultSet.has(base.id)) return;\n resultSet.set(base.id, base);\n Object.keys(base).forEach((name)=>{\n if (name.endsWith(\"Id\")) $11d9b3e4fc7791e1$export$571b373e75babb58(stats, stats.get(base[name]), resultSet);\n else if (name.endsWith(\"Ids\")) base[name].forEach((id)=>{\n $11d9b3e4fc7791e1$export$571b373e75babb58(stats, stats.get(id), resultSet);\n });\n });\n}\nfunction $11d9b3e4fc7791e1$export$93439ffc3f787d51(result, track, outbound) {\n const streamStatsType = outbound ? \"outbound-rtp\" : \"inbound-rtp\";\n const filteredResult = new Map();\n if (track === null) return filteredResult;\n const trackStats = [];\n result.forEach((value)=>{\n if (value.type === \"track\" && value.trackIdentifier === track.id) trackStats.push(value);\n });\n trackStats.forEach((trackStat)=>{\n result.forEach((stats)=>{\n if (stats.type === streamStatsType && stats.trackId === trackStat.id) $11d9b3e4fc7791e1$export$571b373e75babb58(result, stats, filteredResult);\n });\n });\n return filteredResult;\n}\n\n\nvar $041f4f4318baab2c$exports = {};\n\n$parcel$export($041f4f4318baab2c$exports, \"shimMediaStream\", () => $041f4f4318baab2c$export$33ee24e7a300bcd1);\n$parcel$export($041f4f4318baab2c$exports, \"shimOnTrack\", () => $041f4f4318baab2c$export$f358708f68ab068);\n$parcel$export($041f4f4318baab2c$exports, \"shimGetSendersWithDtmf\", () => $041f4f4318baab2c$export$a41a030a2842f5d6);\n$parcel$export($041f4f4318baab2c$exports, \"shimGetStats\", () => $041f4f4318baab2c$export$90608323826f0b17);\n$parcel$export($041f4f4318baab2c$exports, \"shimSenderReceiverGetStats\", () => $041f4f4318baab2c$export$f2f0f2338114eb4b);\n$parcel$export($041f4f4318baab2c$exports, \"shimAddTrackRemoveTrackWithNative\", () => $041f4f4318baab2c$export$30e3cdd46f8d5100);\n$parcel$export($041f4f4318baab2c$exports, \"shimAddTrackRemoveTrack\", () => $041f4f4318baab2c$export$9588259fcf4ebc91);\n$parcel$export($041f4f4318baab2c$exports, \"shimPeerConnection\", () => $041f4f4318baab2c$export$852a08dda9a55ea7);\n$parcel$export($041f4f4318baab2c$exports, \"fixNegotiationNeeded\", () => $041f4f4318baab2c$export$341293bbeaae37cb);\n$parcel$export($041f4f4318baab2c$exports, \"shimGetUserMedia\", () => $b54ff3b82f3d51d6$export$1ed4910f4d37dc5e);\n$parcel$export($041f4f4318baab2c$exports, \"shimGetDisplayMedia\", () => $4cbb13d690da2bd9$export$97270b87351d9c04);\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \n\"use strict\";\nconst $b54ff3b82f3d51d6$var$logging = $11d9b3e4fc7791e1$export$bef1f36f5486a6a3;\nfunction $b54ff3b82f3d51d6$export$1ed4910f4d37dc5e(window, browserDetails) {\n const navigator = window && window.navigator;\n if (!navigator.mediaDevices) return;\n const constraintsToChrome_ = function(c) {\n if (typeof c !== \"object\" || c.mandatory || c.optional) return c;\n const cc = {};\n Object.keys(c).forEach((key)=>{\n if (key === \"require\" || key === \"advanced\" || key === \"mediaSource\") return;\n const r = typeof c[key] === \"object\" ? c[key] : {\n ideal: c[key]\n };\n if (r.exact !== undefined && typeof r.exact === \"number\") r.min = r.max = r.exact;\n const oldname_ = function(prefix, name) {\n if (prefix) return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n return name === \"deviceId\" ? \"sourceId\" : name;\n };\n if (r.ideal !== undefined) {\n cc.optional = cc.optional || [];\n let oc = {};\n if (typeof r.ideal === \"number\") {\n oc[oldname_(\"min\", key)] = r.ideal;\n cc.optional.push(oc);\n oc = {};\n oc[oldname_(\"max\", key)] = r.ideal;\n cc.optional.push(oc);\n } else {\n oc[oldname_(\"\", key)] = r.ideal;\n cc.optional.push(oc);\n }\n }\n if (r.exact !== undefined && typeof r.exact !== \"number\") {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(\"\", key)] = r.exact;\n } else [\n \"min\",\n \"max\"\n ].forEach((mix)=>{\n if (r[mix] !== undefined) {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(mix, key)] = r[mix];\n }\n });\n });\n if (c.advanced) cc.optional = (cc.optional || []).concat(c.advanced);\n return cc;\n };\n const shimConstraints_ = function(constraints, func) {\n if (browserDetails.version >= 61) return func(constraints);\n constraints = JSON.parse(JSON.stringify(constraints));\n if (constraints && typeof constraints.audio === \"object\") {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n constraints = JSON.parse(JSON.stringify(constraints));\n remap(constraints.audio, \"autoGainControl\", \"googAutoGainControl\");\n remap(constraints.audio, \"noiseSuppression\", \"googNoiseSuppression\");\n constraints.audio = constraintsToChrome_(constraints.audio);\n }\n if (constraints && typeof constraints.video === \"object\") {\n // Shim facingMode for mobile & surface pro.\n let face = constraints.video.facingMode;\n face = face && (typeof face === \"object\" ? face : {\n ideal: face\n });\n const getSupportedFacingModeLies = browserDetails.version < 66;\n if (face && (face.exact === \"user\" || face.exact === \"environment\" || face.ideal === \"user\" || face.ideal === \"environment\") && !(navigator.mediaDevices.getSupportedConstraints && navigator.mediaDevices.getSupportedConstraints().facingMode && !getSupportedFacingModeLies)) {\n delete constraints.video.facingMode;\n let matches;\n if (face.exact === \"environment\" || face.ideal === \"environment\") matches = [\n \"back\",\n \"rear\"\n ];\n else if (face.exact === \"user\" || face.ideal === \"user\") matches = [\n \"front\"\n ];\n if (matches) // Look for matches in label, or use last cam for back (typical).\n return navigator.mediaDevices.enumerateDevices().then((devices)=>{\n devices = devices.filter((d)=>d.kind === \"videoinput\");\n let dev = devices.find((d)=>matches.some((match)=>d.label.toLowerCase().includes(match)));\n if (!dev && devices.length && matches.includes(\"back\")) dev = devices[devices.length - 1]; // more likely the back cam\n if (dev) constraints.video.deviceId = face.exact ? {\n exact: dev.deviceId\n } : {\n ideal: dev.deviceId\n };\n constraints.video = constraintsToChrome_(constraints.video);\n $b54ff3b82f3d51d6$var$logging(\"chrome: \" + JSON.stringify(constraints));\n return func(constraints);\n });\n }\n constraints.video = constraintsToChrome_(constraints.video);\n }\n $b54ff3b82f3d51d6$var$logging(\"chrome: \" + JSON.stringify(constraints));\n return func(constraints);\n };\n const shimError_ = function(e) {\n if (browserDetails.version >= 64) return e;\n return {\n name: ({\n PermissionDeniedError: \"NotAllowedError\",\n PermissionDismissedError: \"NotAllowedError\",\n InvalidStateError: \"NotAllowedError\",\n DevicesNotFoundError: \"NotFoundError\",\n ConstraintNotSatisfiedError: \"OverconstrainedError\",\n TrackStartError: \"NotReadableError\",\n MediaDeviceFailedDueToShutdown: \"NotAllowedError\",\n MediaDeviceKillSwitchOn: \"NotAllowedError\",\n TabCaptureError: \"AbortError\",\n ScreenCaptureError: \"AbortError\",\n DeviceCaptureError: \"AbortError\"\n })[e.name] || e.name,\n message: e.message,\n constraint: e.constraint || e.constraintName,\n toString () {\n return this.name + (this.message && \": \") + this.message;\n }\n };\n };\n const getUserMedia_ = function(constraints, onSuccess, onError) {\n shimConstraints_(constraints, (c)=>{\n navigator.webkitGetUserMedia(c, onSuccess, (e)=>{\n if (onError) onError(shimError_(e));\n });\n });\n };\n navigator.getUserMedia = getUserMedia_.bind(navigator);\n // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia\n // function which returns a Promise, it does not accept spec-style\n // constraints.\n if (navigator.mediaDevices.getUserMedia) {\n const origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(cs) {\n return shimConstraints_(cs, (c)=>origGetUserMedia(c).then((stream)=>{\n if (c.audio && !stream.getAudioTracks().length || c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach((track)=>{\n track.stop();\n });\n throw new DOMException(\"\", \"NotFoundError\");\n }\n return stream;\n }, (e)=>Promise.reject(shimError_(e))));\n };\n }\n}\n\n\n/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \"use strict\";\nfunction $4cbb13d690da2bd9$export$97270b87351d9c04(window, getSourceId) {\n if (window.navigator.mediaDevices && \"getDisplayMedia\" in window.navigator.mediaDevices) return;\n if (!window.navigator.mediaDevices) return;\n // getSourceId is a function that returns a promise resolving with\n // the sourceId of the screen/window/tab to be shared.\n if (typeof getSourceId !== \"function\") {\n console.error(\"shimGetDisplayMedia: getSourceId argument is not a function\");\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {\n return getSourceId(constraints).then((sourceId)=>{\n const widthSpecified = constraints.video && constraints.video.width;\n const heightSpecified = constraints.video && constraints.video.height;\n const frameRateSpecified = constraints.video && constraints.video.frameRate;\n constraints.video = {\n mandatory: {\n chromeMediaSource: \"desktop\",\n chromeMediaSourceId: sourceId,\n maxFrameRate: frameRateSpecified || 3\n }\n };\n if (widthSpecified) constraints.video.mandatory.maxWidth = widthSpecified;\n if (heightSpecified) constraints.video.mandatory.maxHeight = heightSpecified;\n return window.navigator.mediaDevices.getUserMedia(constraints);\n });\n };\n}\n\n\n\"use strict\";\nfunction $041f4f4318baab2c$export$33ee24e7a300bcd1(window) {\n window.MediaStream = window.MediaStream || window.webkitMediaStream;\n}\nfunction $041f4f4318baab2c$export$f358708f68ab068(window) {\n if (typeof window === \"object\" && window.RTCPeerConnection && !(\"ontrack\" in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, \"ontrack\", {\n get () {\n return this._ontrack;\n },\n set (f) {\n if (this._ontrack) this.removeEventListener(\"track\", this._ontrack);\n this.addEventListener(\"track\", this._ontrack = f);\n },\n enumerable: true,\n configurable: true\n });\n const origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {\n if (!this._ontrackpoly) {\n this._ontrackpoly = (e)=>{\n // onaddstream does not fire when a track is added to an existing\n // stream. But stream.onaddtrack is implemented so we use that.\n e.stream.addEventListener(\"addtrack\", (te)=>{\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) receiver = this.getReceivers().find((r)=>r.track && r.track.id === te.track.id);\n else receiver = {\n track: te.track\n };\n const event = new Event(\"track\");\n event.track = te.track;\n event.receiver = receiver;\n event.transceiver = {\n receiver: receiver\n };\n event.streams = [\n e.stream\n ];\n this.dispatchEvent(event);\n });\n e.stream.getTracks().forEach((track)=>{\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) receiver = this.getReceivers().find((r)=>r.track && r.track.id === track.id);\n else receiver = {\n track: track\n };\n const event = new Event(\"track\");\n event.track = track;\n event.receiver = receiver;\n event.transceiver = {\n receiver: receiver\n };\n event.streams = [\n e.stream\n ];\n this.dispatchEvent(event);\n });\n };\n this.addEventListener(\"addstream\", this._ontrackpoly);\n }\n return origSetRemoteDescription.apply(this, arguments);\n };\n } else // even if RTCRtpTransceiver is in window, it is only used and\n // emitted in unified-plan. Unfortunately this means we need\n // to unconditionally wrap the event.\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"track\", (e)=>{\n if (!e.transceiver) Object.defineProperty(e, \"transceiver\", {\n value: {\n receiver: e.receiver\n }\n });\n return e;\n });\n}\nfunction $041f4f4318baab2c$export$a41a030a2842f5d6(window) {\n // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.\n if (typeof window === \"object\" && window.RTCPeerConnection && !(\"getSenders\" in window.RTCPeerConnection.prototype) && \"createDTMFSender\" in window.RTCPeerConnection.prototype) {\n const shimSenderWithDtmf = function(pc, track) {\n return {\n track: track,\n get dtmf () {\n if (this._dtmf === undefined) {\n if (track.kind === \"audio\") this._dtmf = pc.createDTMFSender(track);\n else this._dtmf = null;\n }\n return this._dtmf;\n },\n _pc: pc\n };\n };\n // augment addTrack when getSenders is not available.\n if (!window.RTCPeerConnection.prototype.getSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n this._senders = this._senders || [];\n return this._senders.slice(); // return a copy of the internal state.\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {\n let sender = origAddTrack.apply(this, arguments);\n if (!sender) {\n sender = shimSenderWithDtmf(this, track);\n this._senders.push(sender);\n }\n return sender;\n };\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {\n origRemoveTrack.apply(this, arguments);\n const idx = this._senders.indexOf(sender);\n if (idx !== -1) this._senders.splice(idx, 1);\n };\n }\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._senders = this._senders || [];\n origAddStream.apply(this, [\n stream\n ]);\n stream.getTracks().forEach((track)=>{\n this._senders.push(shimSenderWithDtmf(this, track));\n });\n };\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n this._senders = this._senders || [];\n origRemoveStream.apply(this, [\n stream\n ]);\n stream.getTracks().forEach((track)=>{\n const sender = this._senders.find((s)=>s.track === track);\n if (sender) this._senders.splice(this._senders.indexOf(sender), 1);\n });\n };\n } else if (typeof window === \"object\" && window.RTCPeerConnection && \"getSenders\" in window.RTCPeerConnection.prototype && \"createDTMFSender\" in window.RTCPeerConnection.prototype && window.RTCRtpSender && !(\"dtmf\" in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach((sender)=>sender._pc = this);\n return senders;\n };\n Object.defineProperty(window.RTCRtpSender.prototype, \"dtmf\", {\n get () {\n if (this._dtmf === undefined) {\n if (this.track.kind === \"audio\") this._dtmf = this._pc.createDTMFSender(this.track);\n else this._dtmf = null;\n }\n return this._dtmf;\n }\n });\n }\n}\nfunction $041f4f4318baab2c$export$90608323826f0b17(window) {\n if (!window.RTCPeerConnection) return;\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n // If selector is a function then we are in the old style stats so just\n // pass back the original getStats format to avoid breaking old users.\n if (arguments.length > 0 && typeof selector === \"function\") return origGetStats.apply(this, arguments);\n // When spec-style getStats is supported, return those when called with\n // either no arguments or the selector argument is null.\n if (origGetStats.length === 0 && (arguments.length === 0 || typeof selector !== \"function\")) return origGetStats.apply(this, []);\n const fixChromeStats_ = function(response) {\n const standardReport = {};\n const reports = response.result();\n reports.forEach((report)=>{\n const standardStats = {\n id: report.id,\n timestamp: report.timestamp,\n type: {\n localcandidate: \"local-candidate\",\n remotecandidate: \"remote-candidate\"\n }[report.type] || report.type\n };\n report.names().forEach((name)=>{\n standardStats[name] = report.stat(name);\n });\n standardReport[standardStats.id] = standardStats;\n });\n return standardReport;\n };\n // shim getStats with maplike support\n const makeMapStats = function(stats) {\n return new Map(Object.keys(stats).map((key)=>[\n key,\n stats[key]\n ]));\n };\n if (arguments.length >= 2) {\n const successCallbackWrapper_ = function(response) {\n onSucc(makeMapStats(fixChromeStats_(response)));\n };\n return origGetStats.apply(this, [\n successCallbackWrapper_,\n selector\n ]);\n }\n // promise-support\n return new Promise((resolve, reject)=>{\n origGetStats.apply(this, [\n function(response) {\n resolve(makeMapStats(fixChromeStats_(response)));\n },\n reject\n ]);\n }).then(onSucc, onErr);\n };\n}\nfunction $041f4f4318baab2c$export$f2f0f2338114eb4b(window) {\n if (!(typeof window === \"object\" && window.RTCPeerConnection && window.RTCRtpSender && window.RTCRtpReceiver)) return;\n // shim sender stats.\n if (!(\"getStats\" in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach((sender)=>sender._pc = this);\n return senders;\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n window.RTCRtpSender.prototype.getStats = function getStats() {\n const sender = this;\n return this._pc.getStats().then((result)=>/* Note: this will include stats of all senders that\n * send a track with the same id as sender.track as\n * it is not possible to identify the RTCRtpSender.\n */ $11d9b3e4fc7791e1$export$93439ffc3f787d51(result, sender.track, true));\n };\n }\n // shim receiver stats.\n if (!(\"getStats\" in window.RTCRtpReceiver.prototype)) {\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach((receiver)=>receiver._pc = this);\n return receivers;\n };\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"track\", (e)=>{\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n const receiver = this;\n return this._pc.getStats().then((result)=>$11d9b3e4fc7791e1$export$93439ffc3f787d51(result, receiver.track, false));\n };\n }\n if (!(\"getStats\" in window.RTCRtpSender.prototype && \"getStats\" in window.RTCRtpReceiver.prototype)) return;\n // shim RTCPeerConnection.getStats(track).\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n if (arguments.length > 0 && arguments[0] instanceof window.MediaStreamTrack) {\n const track = arguments[0];\n let sender;\n let receiver;\n let err;\n this.getSenders().forEach((s)=>{\n if (s.track === track) {\n if (sender) err = true;\n else sender = s;\n }\n });\n this.getReceivers().forEach((r)=>{\n if (r.track === track) {\n if (receiver) err = true;\n else receiver = r;\n }\n return r.track === track;\n });\n if (err || sender && receiver) return Promise.reject(new DOMException(\"There are more than one sender or receiver for the track.\", \"InvalidAccessError\"));\n else if (sender) return sender.getStats();\n else if (receiver) return receiver.getStats();\n return Promise.reject(new DOMException(\"There is no sender or receiver for the track.\", \"InvalidAccessError\"));\n }\n return origGetStats.apply(this, arguments);\n };\n}\nfunction $041f4f4318baab2c$export$30e3cdd46f8d5100(window) {\n // shim addTrack/removeTrack with native variants in order to make\n // the interactions with legacy getLocalStreams behave as in other browsers.\n // Keeps a mapping stream.id => [stream, rtpsenders...]\n window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n return Object.keys(this._shimmedLocalStreams).map((streamId)=>this._shimmedLocalStreams[streamId][0]);\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {\n if (!stream) return origAddTrack.apply(this, arguments);\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n const sender = origAddTrack.apply(this, arguments);\n if (!this._shimmedLocalStreams[stream.id]) this._shimmedLocalStreams[stream.id] = [\n stream,\n sender\n ];\n else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) this._shimmedLocalStreams[stream.id].push(sender);\n return sender;\n };\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n stream.getTracks().forEach((track)=>{\n const alreadyExists = this.getSenders().find((s)=>s.track === track);\n if (alreadyExists) throw new DOMException(\"Track already exists.\", \"InvalidAccessError\");\n });\n const existingSenders = this.getSenders();\n origAddStream.apply(this, arguments);\n const newSenders = this.getSenders().filter((newSender)=>existingSenders.indexOf(newSender) === -1);\n this._shimmedLocalStreams[stream.id] = [\n stream\n ].concat(newSenders);\n };\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n delete this._shimmedLocalStreams[stream.id];\n return origRemoveStream.apply(this, arguments);\n };\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n if (sender) Object.keys(this._shimmedLocalStreams).forEach((streamId)=>{\n const idx = this._shimmedLocalStreams[streamId].indexOf(sender);\n if (idx !== -1) this._shimmedLocalStreams[streamId].splice(idx, 1);\n if (this._shimmedLocalStreams[streamId].length === 1) delete this._shimmedLocalStreams[streamId];\n });\n return origRemoveTrack.apply(this, arguments);\n };\n}\nfunction $041f4f4318baab2c$export$9588259fcf4ebc91(window, browserDetails) {\n if (!window.RTCPeerConnection) return;\n // shim addTrack and removeTrack.\n if (window.RTCPeerConnection.prototype.addTrack && browserDetails.version >= 65) return $041f4f4318baab2c$export$30e3cdd46f8d5100(window);\n // also shim pc.getLocalStreams when addTrack is shimmed\n // to return the original streams.\n const origGetLocalStreams = window.RTCPeerConnection.prototype.getLocalStreams;\n window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {\n const nativeStreams = origGetLocalStreams.apply(this);\n this._reverseStreams = this._reverseStreams || {};\n return nativeStreams.map((stream)=>this._reverseStreams[stream.id]);\n };\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n stream.getTracks().forEach((track)=>{\n const alreadyExists = this.getSenders().find((s)=>s.track === track);\n if (alreadyExists) throw new DOMException(\"Track already exists.\", \"InvalidAccessError\");\n });\n // Add identity mapping for consistency with addTrack.\n // Unless this is being used with a stream from addTrack.\n if (!this._reverseStreams[stream.id]) {\n const newStream = new window.MediaStream(stream.getTracks());\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n stream = newStream;\n }\n origAddStream.apply(this, [\n stream\n ]);\n };\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n origRemoveStream.apply(this, [\n this._streams[stream.id] || stream\n ]);\n delete this._reverseStreams[this._streams[stream.id] ? this._streams[stream.id].id : stream.id];\n delete this._streams[stream.id];\n };\n window.RTCPeerConnection.prototype.addTrack = function addTrack(track, stream) {\n if (this.signalingState === \"closed\") throw new DOMException(\"The RTCPeerConnection's signalingState is 'closed'.\", \"InvalidStateError\");\n const streams = [].slice.call(arguments, 1);\n if (streams.length !== 1 || !streams[0].getTracks().find((t)=>t === track)) // this is not fully correct but all we can manage without\n // [[associated MediaStreams]] internal slot.\n throw new DOMException(\"The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.\", \"NotSupportedError\");\n const alreadyExists = this.getSenders().find((s)=>s.track === track);\n if (alreadyExists) throw new DOMException(\"Track already exists.\", \"InvalidAccessError\");\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n const oldStream = this._streams[stream.id];\n if (oldStream) {\n // this is using odd Chrome behaviour, use with caution:\n // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815\n // Note: we rely on the high-level addTrack/dtmf shim to\n // create the sender with a dtmf sender.\n oldStream.addTrack(track);\n // Trigger ONN async.\n Promise.resolve().then(()=>{\n this.dispatchEvent(new Event(\"negotiationneeded\"));\n });\n } else {\n const newStream = new window.MediaStream([\n track\n ]);\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n this.addStream(newStream);\n }\n return this.getSenders().find((s)=>s.track === track);\n };\n // replace the internal stream id with the external one and\n // vice versa.\n function replaceInternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach((internalId)=>{\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(internalStream.id, \"g\"), externalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp: sdp\n });\n }\n function replaceExternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach((internalId)=>{\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(externalStream.id, \"g\"), internalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp: sdp\n });\n }\n [\n \"createOffer\",\n \"createAnswer\"\n ].forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {\n [method] () {\n const args = arguments;\n const isLegacyCall = arguments.length && typeof arguments[0] === \"function\";\n if (isLegacyCall) return nativeMethod.apply(this, [\n (description)=>{\n const desc = replaceInternalStreamId(this, description);\n args[0].apply(null, [\n desc\n ]);\n },\n (err)=>{\n if (args[1]) args[1].apply(null, err);\n },\n arguments[2]\n ]);\n return nativeMethod.apply(this, arguments).then((description)=>replaceInternalStreamId(this, description));\n }\n };\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n const origSetLocalDescription = window.RTCPeerConnection.prototype.setLocalDescription;\n window.RTCPeerConnection.prototype.setLocalDescription = function setLocalDescription() {\n if (!arguments.length || !arguments[0].type) return origSetLocalDescription.apply(this, arguments);\n arguments[0] = replaceExternalStreamId(this, arguments[0]);\n return origSetLocalDescription.apply(this, arguments);\n };\n // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier\n const origLocalDescription = Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype, \"localDescription\");\n Object.defineProperty(window.RTCPeerConnection.prototype, \"localDescription\", {\n get () {\n const description = origLocalDescription.get.apply(this);\n if (description.type === \"\") return description;\n return replaceInternalStreamId(this, description);\n }\n });\n window.RTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {\n if (this.signalingState === \"closed\") throw new DOMException(\"The RTCPeerConnection's signalingState is 'closed'.\", \"InvalidStateError\");\n // We can not yet check for sender instanceof RTCRtpSender\n // since we shim RTPSender. So we check if sender._pc is set.\n if (!sender._pc) throw new DOMException(\"Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.\", \"TypeError\");\n const isLocal = sender._pc === this;\n if (!isLocal) throw new DOMException(\"Sender was not created by this connection.\", \"InvalidAccessError\");\n // Search for the native stream the senders track belongs to.\n this._streams = this._streams || {};\n let stream;\n Object.keys(this._streams).forEach((streamid)=>{\n const hasTrack = this._streams[streamid].getTracks().find((track)=>sender.track === track);\n if (hasTrack) stream = this._streams[streamid];\n });\n if (stream) {\n if (stream.getTracks().length === 1) // if this is the last track of the stream, remove the stream. This\n // takes care of any shimmed _senders.\n this.removeStream(this._reverseStreams[stream.id]);\n else // relying on the same odd chrome behaviour as above.\n stream.removeTrack(sender.track);\n this.dispatchEvent(new Event(\"negotiationneeded\"));\n }\n };\n}\nfunction $041f4f4318baab2c$export$852a08dda9a55ea7(window, browserDetails) {\n if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) // very basic support for old versions.\n window.RTCPeerConnection = window.webkitRTCPeerConnection;\n if (!window.RTCPeerConnection) return;\n // shim implicit creation of RTCSessionDescription/RTCIceCandidate\n if (browserDetails.version < 53) [\n \"setLocalDescription\",\n \"setRemoteDescription\",\n \"addIceCandidate\"\n ].forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {\n [method] () {\n arguments[0] = new (method === \"addIceCandidate\" ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }\n };\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n}\nfunction $041f4f4318baab2c$export$341293bbeaae37cb(window, browserDetails) {\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"negotiationneeded\", (e)=>{\n const pc = e.target;\n if (browserDetails.version < 72 || pc.getConfiguration && pc.getConfiguration().sdpSemantics === \"plan-b\") {\n if (pc.signalingState !== \"stable\") return;\n }\n return e;\n });\n}\n\n\nvar $5ba25c21eb1c0af8$exports = {};\n\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimOnTrack\", () => $5ba25c21eb1c0af8$export$f358708f68ab068);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimPeerConnection\", () => $5ba25c21eb1c0af8$export$852a08dda9a55ea7);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimSenderGetStats\", () => $5ba25c21eb1c0af8$export$f0525502095c04ef);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimReceiverGetStats\", () => $5ba25c21eb1c0af8$export$83d69126527b1171);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimRemoveStream\", () => $5ba25c21eb1c0af8$export$825e523ef749bd8c);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimRTCDataChannel\", () => $5ba25c21eb1c0af8$export$ff9cb3bc8990e8f7);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimAddTransceiver\", () => $5ba25c21eb1c0af8$export$70c77533b6e9908d);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimGetParameters\", () => $5ba25c21eb1c0af8$export$66238223c298fbaa);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimCreateOffer\", () => $5ba25c21eb1c0af8$export$51beccf0e777b843);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimCreateAnswer\", () => $5ba25c21eb1c0af8$export$df0b46e7cef08150);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimGetUserMedia\", () => $138811b977baa945$export$1ed4910f4d37dc5e);\n$parcel$export($5ba25c21eb1c0af8$exports, \"shimGetDisplayMedia\", () => $d08a6680f3298ef0$export$97270b87351d9c04);\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \n\"use strict\";\nfunction $138811b977baa945$export$1ed4910f4d37dc5e(window, browserDetails) {\n const navigator = window && window.navigator;\n const MediaStreamTrack = window && window.MediaStreamTrack;\n navigator.getUserMedia = function(constraints, onSuccess, onError) {\n // Replace Firefox 44+'s deprecation warning with unprefixed version.\n $11d9b3e4fc7791e1$export$cdd73fc4100a6ef4(\"navigator.getUserMedia\", \"navigator.mediaDevices.getUserMedia\");\n navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);\n };\n if (!(browserDetails.version > 55 && \"autoGainControl\" in navigator.mediaDevices.getSupportedConstraints())) {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n const nativeGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n if (typeof c === \"object\" && typeof c.audio === \"object\") {\n c = JSON.parse(JSON.stringify(c));\n remap(c.audio, \"autoGainControl\", \"mozAutoGainControl\");\n remap(c.audio, \"noiseSuppression\", \"mozNoiseSuppression\");\n }\n return nativeGetUserMedia(c);\n };\n if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {\n const nativeGetSettings = MediaStreamTrack.prototype.getSettings;\n MediaStreamTrack.prototype.getSettings = function() {\n const obj = nativeGetSettings.apply(this, arguments);\n remap(obj, \"mozAutoGainControl\", \"autoGainControl\");\n remap(obj, \"mozNoiseSuppression\", \"noiseSuppression\");\n return obj;\n };\n }\n if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {\n const nativeApplyConstraints = MediaStreamTrack.prototype.applyConstraints;\n MediaStreamTrack.prototype.applyConstraints = function(c) {\n if (this.kind === \"audio\" && typeof c === \"object\") {\n c = JSON.parse(JSON.stringify(c));\n remap(c, \"autoGainControl\", \"mozAutoGainControl\");\n remap(c, \"noiseSuppression\", \"mozNoiseSuppression\");\n }\n return nativeApplyConstraints.apply(this, [\n c\n ]);\n };\n }\n }\n}\n\n\n/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ \"use strict\";\nfunction $d08a6680f3298ef0$export$97270b87351d9c04(window, preferredMediaSource) {\n if (window.navigator.mediaDevices && \"getDisplayMedia\" in window.navigator.mediaDevices) return;\n if (!window.navigator.mediaDevices) return;\n window.navigator.mediaDevices.getDisplayMedia = function getDisplayMedia(constraints) {\n if (!(constraints && constraints.video)) {\n const err = new DOMException(\"getDisplayMedia without video constraints is undefined\");\n err.name = \"NotFoundError\";\n // from https://heycam.github.io/webidl/#idl-DOMException-error-names\n err.code = 8;\n return Promise.reject(err);\n }\n if (constraints.video === true) constraints.video = {\n mediaSource: preferredMediaSource\n };\n else constraints.video.mediaSource = preferredMediaSource;\n return window.navigator.mediaDevices.getUserMedia(constraints);\n };\n}\n\n\n\"use strict\";\nfunction $5ba25c21eb1c0af8$export$f358708f68ab068(window) {\n if (typeof window === \"object\" && window.RTCTrackEvent && \"receiver\" in window.RTCTrackEvent.prototype && !(\"transceiver\" in window.RTCTrackEvent.prototype)) Object.defineProperty(window.RTCTrackEvent.prototype, \"transceiver\", {\n get () {\n return {\n receiver: this.receiver\n };\n }\n });\n}\nfunction $5ba25c21eb1c0af8$export$852a08dda9a55ea7(window, browserDetails) {\n if (typeof window !== \"object\" || !(window.RTCPeerConnection || window.mozRTCPeerConnection)) return; // probably media.peerconnection.enabled=false in about:config\n if (!window.RTCPeerConnection && window.mozRTCPeerConnection) // very basic support for old versions.\n window.RTCPeerConnection = window.mozRTCPeerConnection;\n if (browserDetails.version < 53) // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n [\n \"setLocalDescription\",\n \"setRemoteDescription\",\n \"addIceCandidate\"\n ].forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {\n [method] () {\n arguments[0] = new (method === \"addIceCandidate\" ? window.RTCIceCandidate : window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }\n };\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n const modernStatsTypes = {\n inboundrtp: \"inbound-rtp\",\n outboundrtp: \"outbound-rtp\",\n candidatepair: \"candidate-pair\",\n localcandidate: \"local-candidate\",\n remotecandidate: \"remote-candidate\"\n };\n const nativeGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n return nativeGetStats.apply(this, [\n selector || null\n ]).then((stats)=>{\n if (browserDetails.version < 53 && !onSucc) // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach((stat)=>{\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== \"TypeError\") throw e;\n // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n stats.forEach((stat, i)=>{\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n return stats;\n }).then(onSucc, onErr);\n };\n}\nfunction $5ba25c21eb1c0af8$export$f0525502095c04ef(window) {\n if (!(typeof window === \"object\" && window.RTCPeerConnection && window.RTCRtpSender)) return;\n if (window.RTCRtpSender && \"getStats\" in window.RTCRtpSender.prototype) return;\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach((sender)=>sender._pc = this);\n return senders;\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n window.RTCRtpSender.prototype.getStats = function getStats() {\n return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map());\n };\n}\nfunction $5ba25c21eb1c0af8$export$83d69126527b1171(window) {\n if (!(typeof window === \"object\" && window.RTCPeerConnection && window.RTCRtpSender)) return;\n if (window.RTCRtpSender && \"getStats\" in window.RTCRtpReceiver.prototype) return;\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach((receiver)=>receiver._pc = this);\n return receivers;\n };\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"track\", (e)=>{\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n return this._pc.getStats(this.track);\n };\n}\nfunction $5ba25c21eb1c0af8$export$825e523ef749bd8c(window) {\n if (!window.RTCPeerConnection || \"removeStream\" in window.RTCPeerConnection.prototype) return;\n window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n $11d9b3e4fc7791e1$export$cdd73fc4100a6ef4(\"removeStream\", \"removeTrack\");\n this.getSenders().forEach((sender)=>{\n if (sender.track && stream.getTracks().includes(sender.track)) this.removeTrack(sender);\n });\n };\n}\nfunction $5ba25c21eb1c0af8$export$ff9cb3bc8990e8f7(window) {\n // rename DataChannel to RTCDataChannel (native fix in FF60):\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851\n if (window.DataChannel && !window.RTCDataChannel) window.RTCDataChannel = window.DataChannel;\n}\nfunction $5ba25c21eb1c0af8$export$70c77533b6e9908d(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === \"object\" && window.RTCPeerConnection)) return;\n const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;\n if (origAddTransceiver) window.RTCPeerConnection.prototype.addTransceiver = function addTransceiver() {\n this.setParametersPromises = [];\n // WebIDL input coercion and validation\n let sendEncodings = arguments[1] && arguments[1].sendEncodings;\n if (sendEncodings === undefined) sendEncodings = [];\n sendEncodings = [\n ...sendEncodings\n ];\n const shouldPerformCheck = sendEncodings.length > 0;\n if (shouldPerformCheck) // If sendEncodings params are provided, validate grammar\n sendEncodings.forEach((encodingParam)=>{\n if (\"rid\" in encodingParam) {\n const ridRegex = /^[a-z0-9]{0,16}$/i;\n if (!ridRegex.test(encodingParam.rid)) throw new TypeError(\"Invalid RID value provided.\");\n }\n if (\"scaleResolutionDownBy\" in encodingParam) {\n if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) throw new RangeError(\"scale_resolution_down_by must be >= 1.0\");\n }\n if (\"maxFramerate\" in encodingParam) {\n if (!(parseFloat(encodingParam.maxFramerate) >= 0)) throw new RangeError(\"max_framerate must be >= 0.0\");\n }\n });\n const transceiver = origAddTransceiver.apply(this, arguments);\n if (shouldPerformCheck) {\n // Check if the init options were applied. If not we do this in an\n // asynchronous way and save the promise reference in a global object.\n // This is an ugly hack, but at the same time is way more robust than\n // checking the sender parameters before and after the createOffer\n // Also note that after the createoffer we are not 100% sure that\n // the params were asynchronously applied so we might miss the\n // opportunity to recreate offer.\n const { sender: sender } = transceiver;\n const params = sender.getParameters();\n if (!(\"encodings\" in params) || // Avoid being fooled by patched getParameters() below.\n params.encodings.length === 1 && Object.keys(params.encodings[0]).length === 0) {\n params.encodings = sendEncodings;\n sender.sendEncodings = sendEncodings;\n this.setParametersPromises.push(sender.setParameters(params).then(()=>{\n delete sender.sendEncodings;\n }).catch(()=>{\n delete sender.sendEncodings;\n }));\n }\n }\n return transceiver;\n };\n}\nfunction $5ba25c21eb1c0af8$export$66238223c298fbaa(window) {\n if (!(typeof window === \"object\" && window.RTCRtpSender)) return;\n const origGetParameters = window.RTCRtpSender.prototype.getParameters;\n if (origGetParameters) window.RTCRtpSender.prototype.getParameters = function getParameters() {\n const params = origGetParameters.apply(this, arguments);\n if (!(\"encodings\" in params)) params.encodings = [].concat(this.sendEncodings || [\n {}\n ]);\n return params;\n };\n}\nfunction $5ba25c21eb1c0af8$export$51beccf0e777b843(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === \"object\" && window.RTCPeerConnection)) return;\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer = function createOffer() {\n if (this.setParametersPromises && this.setParametersPromises.length) return Promise.all(this.setParametersPromises).then(()=>{\n return origCreateOffer.apply(this, arguments);\n }).finally(()=>{\n this.setParametersPromises = [];\n });\n return origCreateOffer.apply(this, arguments);\n };\n}\nfunction $5ba25c21eb1c0af8$export$df0b46e7cef08150(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === \"object\" && window.RTCPeerConnection)) return;\n const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;\n window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {\n if (this.setParametersPromises && this.setParametersPromises.length) return Promise.all(this.setParametersPromises).then(()=>{\n return origCreateAnswer.apply(this, arguments);\n }).finally(()=>{\n this.setParametersPromises = [];\n });\n return origCreateAnswer.apply(this, arguments);\n };\n}\n\n\nvar $93a503258ac80079$exports = {};\n\n$parcel$export($93a503258ac80079$exports, \"shimLocalStreamsAPI\", () => $93a503258ac80079$export$8df41282f4fdcea2);\n$parcel$export($93a503258ac80079$exports, \"shimRemoteStreamsAPI\", () => $93a503258ac80079$export$762aa4cbb4f2f857);\n$parcel$export($93a503258ac80079$exports, \"shimCallbacksAPI\", () => $93a503258ac80079$export$da31df245debdd3);\n$parcel$export($93a503258ac80079$exports, \"shimGetUserMedia\", () => $93a503258ac80079$export$1ed4910f4d37dc5e);\n$parcel$export($93a503258ac80079$exports, \"shimConstraints\", () => $93a503258ac80079$export$494a01ac68ba81ac);\n$parcel$export($93a503258ac80079$exports, \"shimRTCIceServerUrls\", () => $93a503258ac80079$export$671a8b47b41b6f41);\n$parcel$export($93a503258ac80079$exports, \"shimTrackEventTransceiver\", () => $93a503258ac80079$export$85d53da088cb1b14);\n$parcel$export($93a503258ac80079$exports, \"shimCreateOfferLegacy\", () => $93a503258ac80079$export$d444266503fdd2d4);\n$parcel$export($93a503258ac80079$exports, \"shimAudioContext\", () => $93a503258ac80079$export$857cd739a7b795d2);\n/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ \n\"use strict\";\nfunction $93a503258ac80079$export$8df41282f4fdcea2(window) {\n if (typeof window !== \"object\" || !window.RTCPeerConnection) return;\n if (!(\"getLocalStreams\" in window.RTCPeerConnection.prototype)) window.RTCPeerConnection.prototype.getLocalStreams = function getLocalStreams() {\n if (!this._localStreams) this._localStreams = [];\n return this._localStreams;\n };\n if (!(\"addStream\" in window.RTCPeerConnection.prototype)) {\n const _addTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n if (!this._localStreams) this._localStreams = [];\n if (!this._localStreams.includes(stream)) this._localStreams.push(stream);\n // Try to emulate Chrome's behaviour of adding in audio-video order.\n // Safari orders by track id.\n stream.getAudioTracks().forEach((track)=>_addTrack.call(this, track, stream));\n stream.getVideoTracks().forEach((track)=>_addTrack.call(this, track, stream));\n };\n window.RTCPeerConnection.prototype.addTrack = function addTrack(track, ...streams) {\n if (streams) streams.forEach((stream)=>{\n if (!this._localStreams) this._localStreams = [\n stream\n ];\n else if (!this._localStreams.includes(stream)) this._localStreams.push(stream);\n });\n return _addTrack.apply(this, arguments);\n };\n }\n if (!(\"removeStream\" in window.RTCPeerConnection.prototype)) window.RTCPeerConnection.prototype.removeStream = function removeStream(stream) {\n if (!this._localStreams) this._localStreams = [];\n const index = this._localStreams.indexOf(stream);\n if (index === -1) return;\n this._localStreams.splice(index, 1);\n const tracks = stream.getTracks();\n this.getSenders().forEach((sender)=>{\n if (tracks.includes(sender.track)) this.removeTrack(sender);\n });\n };\n}\nfunction $93a503258ac80079$export$762aa4cbb4f2f857(window) {\n if (typeof window !== \"object\" || !window.RTCPeerConnection) return;\n if (!(\"getRemoteStreams\" in window.RTCPeerConnection.prototype)) window.RTCPeerConnection.prototype.getRemoteStreams = function getRemoteStreams() {\n return this._remoteStreams ? this._remoteStreams : [];\n };\n if (!(\"onaddstream\" in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, \"onaddstream\", {\n get () {\n return this._onaddstream;\n },\n set (f) {\n if (this._onaddstream) {\n this.removeEventListener(\"addstream\", this._onaddstream);\n this.removeEventListener(\"track\", this._onaddstreampoly);\n }\n this.addEventListener(\"addstream\", this._onaddstream = f);\n this.addEventListener(\"track\", this._onaddstreampoly = (e)=>{\n e.streams.forEach((stream)=>{\n if (!this._remoteStreams) this._remoteStreams = [];\n if (this._remoteStreams.includes(stream)) return;\n this._remoteStreams.push(stream);\n const event = new Event(\"addstream\");\n event.stream = stream;\n this.dispatchEvent(event);\n });\n });\n }\n });\n const origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {\n const pc = this;\n if (!this._onaddstreampoly) this.addEventListener(\"track\", this._onaddstreampoly = function(e) {\n e.streams.forEach((stream)=>{\n if (!pc._remoteStreams) pc._remoteStreams = [];\n if (pc._remoteStreams.indexOf(stream) >= 0) return;\n pc._remoteStreams.push(stream);\n const event = new Event(\"addstream\");\n event.stream = stream;\n pc.dispatchEvent(event);\n });\n });\n return origSetRemoteDescription.apply(pc, arguments);\n };\n }\n}\nfunction $93a503258ac80079$export$da31df245debdd3(window) {\n if (typeof window !== \"object\" || !window.RTCPeerConnection) return;\n const prototype = window.RTCPeerConnection.prototype;\n const origCreateOffer = prototype.createOffer;\n const origCreateAnswer = prototype.createAnswer;\n const setLocalDescription = prototype.setLocalDescription;\n const setRemoteDescription = prototype.setRemoteDescription;\n const addIceCandidate = prototype.addIceCandidate;\n prototype.createOffer = function createOffer(successCallback, failureCallback) {\n const options = arguments.length >= 2 ? arguments[2] : arguments[0];\n const promise = origCreateOffer.apply(this, [\n options\n ]);\n if (!failureCallback) return promise;\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.createAnswer = function createAnswer(successCallback, failureCallback) {\n const options = arguments.length >= 2 ? arguments[2] : arguments[0];\n const promise = origCreateAnswer.apply(this, [\n options\n ]);\n if (!failureCallback) return promise;\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n let withCallback = function(description, successCallback, failureCallback) {\n const promise = setLocalDescription.apply(this, [\n description\n ]);\n if (!failureCallback) return promise;\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setLocalDescription = withCallback;\n withCallback = function(description, successCallback, failureCallback) {\n const promise = setRemoteDescription.apply(this, [\n description\n ]);\n if (!failureCallback) return promise;\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setRemoteDescription = withCallback;\n withCallback = function(candidate, successCallback, failureCallback) {\n const promise = addIceCandidate.apply(this, [\n candidate\n ]);\n if (!failureCallback) return promise;\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.addIceCandidate = withCallback;\n}\nfunction $93a503258ac80079$export$1ed4910f4d37dc5e(window) {\n const navigator = window && window.navigator;\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n // shim not needed in Safari 12.1\n const mediaDevices = navigator.mediaDevices;\n const _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);\n navigator.mediaDevices.getUserMedia = (constraints)=>{\n return _getUserMedia($93a503258ac80079$export$494a01ac68ba81ac(constraints));\n };\n }\n if (!navigator.getUserMedia && navigator.mediaDevices && navigator.mediaDevices.getUserMedia) navigator.getUserMedia = (function getUserMedia(constraints, cb, errcb) {\n navigator.mediaDevices.getUserMedia(constraints).then(cb, errcb);\n }).bind(navigator);\n}\nfunction $93a503258ac80079$export$494a01ac68ba81ac(constraints) {\n if (constraints && constraints.video !== undefined) return Object.assign({}, constraints, {\n video: $11d9b3e4fc7791e1$export$15384eac40dc88c8(constraints.video)\n });\n return constraints;\n}\nfunction $93a503258ac80079$export$671a8b47b41b6f41(window) {\n if (!window.RTCPeerConnection) return;\n // migrate from non-spec RTCIceServer.url to RTCIceServer.urls\n const OrigPeerConnection = window.RTCPeerConnection;\n window.RTCPeerConnection = function RTCPeerConnection(pcConfig, pcConstraints) {\n if (pcConfig && pcConfig.iceServers) {\n const newIceServers = [];\n for(let i = 0; i < pcConfig.iceServers.length; i++){\n let server = pcConfig.iceServers[i];\n if (server.urls === undefined && server.url) {\n $11d9b3e4fc7791e1$export$cdd73fc4100a6ef4(\"RTCIceServer.url\", \"RTCIceServer.urls\");\n server = JSON.parse(JSON.stringify(server));\n server.urls = server.url;\n delete server.url;\n newIceServers.push(server);\n } else newIceServers.push(pcConfig.iceServers[i]);\n }\n pcConfig.iceServers = newIceServers;\n }\n return new OrigPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n if (\"generateCertificate\" in OrigPeerConnection) Object.defineProperty(window.RTCPeerConnection, \"generateCertificate\", {\n get () {\n return OrigPeerConnection.generateCertificate;\n }\n });\n}\nfunction $93a503258ac80079$export$85d53da088cb1b14(window) {\n // Add event.transceiver member over deprecated event.receiver\n if (typeof window === \"object\" && window.RTCTrackEvent && \"receiver\" in window.RTCTrackEvent.prototype && !(\"transceiver\" in window.RTCTrackEvent.prototype)) Object.defineProperty(window.RTCTrackEvent.prototype, \"transceiver\", {\n get () {\n return {\n receiver: this.receiver\n };\n }\n });\n}\nfunction $93a503258ac80079$export$d444266503fdd2d4(window) {\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer = function createOffer(offerOptions) {\n if (offerOptions) {\n if (typeof offerOptions.offerToReceiveAudio !== \"undefined\") // support bit values\n offerOptions.offerToReceiveAudio = !!offerOptions.offerToReceiveAudio;\n const audioTransceiver = this.getTransceivers().find((transceiver)=>transceiver.receiver.track.kind === \"audio\");\n if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {\n if (audioTransceiver.direction === \"sendrecv\") {\n if (audioTransceiver.setDirection) audioTransceiver.setDirection(\"sendonly\");\n else audioTransceiver.direction = \"sendonly\";\n } else if (audioTransceiver.direction === \"recvonly\") {\n if (audioTransceiver.setDirection) audioTransceiver.setDirection(\"inactive\");\n else audioTransceiver.direction = \"inactive\";\n }\n } else if (offerOptions.offerToReceiveAudio === true && !audioTransceiver) this.addTransceiver(\"audio\", {\n direction: \"recvonly\"\n });\n if (typeof offerOptions.offerToReceiveVideo !== \"undefined\") // support bit values\n offerOptions.offerToReceiveVideo = !!offerOptions.offerToReceiveVideo;\n const videoTransceiver = this.getTransceivers().find((transceiver)=>transceiver.receiver.track.kind === \"video\");\n if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {\n if (videoTransceiver.direction === \"sendrecv\") {\n if (videoTransceiver.setDirection) videoTransceiver.setDirection(\"sendonly\");\n else videoTransceiver.direction = \"sendonly\";\n } else if (videoTransceiver.direction === \"recvonly\") {\n if (videoTransceiver.setDirection) videoTransceiver.setDirection(\"inactive\");\n else videoTransceiver.direction = \"inactive\";\n }\n } else if (offerOptions.offerToReceiveVideo === true && !videoTransceiver) this.addTransceiver(\"video\", {\n direction: \"recvonly\"\n });\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\nfunction $93a503258ac80079$export$857cd739a7b795d2(window) {\n if (typeof window !== \"object\" || window.AudioContext) return;\n window.AudioContext = window.webkitAudioContext;\n}\n\n\nvar $f8e30544afcd11f0$exports = {};\n\n$parcel$export($f8e30544afcd11f0$exports, \"shimRTCIceCandidate\", () => $f8e30544afcd11f0$export$cf133661e444ccfe);\n$parcel$export($f8e30544afcd11f0$exports, \"shimRTCIceCandidateRelayProtocol\", () => $f8e30544afcd11f0$export$fdafb8d8280e29b5);\n$parcel$export($f8e30544afcd11f0$exports, \"shimMaxMessageSize\", () => $f8e30544afcd11f0$export$a99147c78a56edc4);\n$parcel$export($f8e30544afcd11f0$exports, \"shimSendThrowTypeError\", () => $f8e30544afcd11f0$export$d461c8d5c5db5da7);\n$parcel$export($f8e30544afcd11f0$exports, \"shimConnectionState\", () => $f8e30544afcd11f0$export$63bb816cc75460);\n$parcel$export($f8e30544afcd11f0$exports, \"removeExtmapAllowMixed\", () => $f8e30544afcd11f0$export$a57d114344295149);\n$parcel$export($f8e30544afcd11f0$exports, \"shimAddIceCandidateNullOrEmpty\", () => $f8e30544afcd11f0$export$51d5e40b48c771c7);\n$parcel$export($f8e30544afcd11f0$exports, \"shimParameterlessSetLocalDescription\", () => $f8e30544afcd11f0$export$7170d04e59f9d553);\n/*\n * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */ /* eslint-env node */ var $30b3171bddcf6271$exports = {};\n/* eslint-env node */ \"use strict\";\n// SDP helpers.\nconst $30b3171bddcf6271$var$SDPUtils = {};\n// Generate an alphanumeric identifier for cname or mids.\n// TODO: use UUIDs instead? https://gist.github.com/jed/982883\n$30b3171bddcf6271$var$SDPUtils.generateIdentifier = function() {\n return Math.random().toString(36).substring(2, 12);\n};\n// The RTCP CNAME used by all peerconnections from the same JS.\n$30b3171bddcf6271$var$SDPUtils.localCName = $30b3171bddcf6271$var$SDPUtils.generateIdentifier();\n// Splits SDP into lines, dealing with both CRLF and LF.\n$30b3171bddcf6271$var$SDPUtils.splitLines = function(blob) {\n return blob.trim().split(\"\\n\").map((line)=>line.trim());\n};\n// Splits SDP into sessionpart and mediasections. Ensures CRLF.\n$30b3171bddcf6271$var$SDPUtils.splitSections = function(blob) {\n const parts = blob.split(\"\\nm=\");\n return parts.map((part, index)=>(index > 0 ? \"m=\" + part : part).trim() + \"\\r\\n\");\n};\n// Returns the session description.\n$30b3171bddcf6271$var$SDPUtils.getDescription = function(blob) {\n const sections = $30b3171bddcf6271$var$SDPUtils.splitSections(blob);\n return sections && sections[0];\n};\n// Returns the individual media sections.\n$30b3171bddcf6271$var$SDPUtils.getMediaSections = function(blob) {\n const sections = $30b3171bddcf6271$var$SDPUtils.splitSections(blob);\n sections.shift();\n return sections;\n};\n// Returns lines that start with a certain prefix.\n$30b3171bddcf6271$var$SDPUtils.matchPrefix = function(blob, prefix) {\n return $30b3171bddcf6271$var$SDPUtils.splitLines(blob).filter((line)=>line.indexOf(prefix) === 0);\n};\n// Parses an ICE candidate line. Sample input:\n// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8\n// rport 55996\"\n// Input can be prefixed with a=.\n$30b3171bddcf6271$var$SDPUtils.parseCandidate = function(line) {\n let parts;\n // Parse both variants.\n if (line.indexOf(\"a=candidate:\") === 0) parts = line.substring(12).split(\" \");\n else parts = line.substring(10).split(\" \");\n const candidate = {\n foundation: parts[0],\n component: {\n 1: \"rtp\",\n 2: \"rtcp\"\n }[parts[1]] || parts[1],\n protocol: parts[2].toLowerCase(),\n priority: parseInt(parts[3], 10),\n ip: parts[4],\n address: parts[4],\n port: parseInt(parts[5], 10),\n // skip parts[6] == 'typ'\n type: parts[7]\n };\n for(let i = 8; i < parts.length; i += 2)switch(parts[i]){\n case \"raddr\":\n candidate.relatedAddress = parts[i + 1];\n break;\n case \"rport\":\n candidate.relatedPort = parseInt(parts[i + 1], 10);\n break;\n case \"tcptype\":\n candidate.tcpType = parts[i + 1];\n break;\n case \"ufrag\":\n candidate.ufrag = parts[i + 1]; // for backward compatibility.\n candidate.usernameFragment = parts[i + 1];\n break;\n default:\n if (candidate[parts[i]] === undefined) candidate[parts[i]] = parts[i + 1];\n break;\n }\n return candidate;\n};\n// Translates a candidate object into SDP candidate attribute.\n// This does not include the a= prefix!\n$30b3171bddcf6271$var$SDPUtils.writeCandidate = function(candidate) {\n const sdp = [];\n sdp.push(candidate.foundation);\n const component = candidate.component;\n if (component === \"rtp\") sdp.push(1);\n else if (component === \"rtcp\") sdp.push(2);\n else sdp.push(component);\n sdp.push(candidate.protocol.toUpperCase());\n sdp.push(candidate.priority);\n sdp.push(candidate.address || candidate.ip);\n sdp.push(candidate.port);\n const type = candidate.type;\n sdp.push(\"typ\");\n sdp.push(type);\n if (type !== \"host\" && candidate.relatedAddress && candidate.relatedPort) {\n sdp.push(\"raddr\");\n sdp.push(candidate.relatedAddress);\n sdp.push(\"rport\");\n sdp.push(candidate.relatedPort);\n }\n if (candidate.tcpType && candidate.protocol.toLowerCase() === \"tcp\") {\n sdp.push(\"tcptype\");\n sdp.push(candidate.tcpType);\n }\n if (candidate.usernameFragment || candidate.ufrag) {\n sdp.push(\"ufrag\");\n sdp.push(candidate.usernameFragment || candidate.ufrag);\n }\n return \"candidate:\" + sdp.join(\" \");\n};\n// Parses an ice-options line, returns an array of option tags.\n// Sample input:\n// a=ice-options:foo bar\n$30b3171bddcf6271$var$SDPUtils.parseIceOptions = function(line) {\n return line.substring(14).split(\" \");\n};\n// Parses a rtpmap line, returns RTCRtpCoddecParameters. Sample input:\n// a=rtpmap:111 opus/48000/2\n$30b3171bddcf6271$var$SDPUtils.parseRtpMap = function(line) {\n let parts = line.substring(9).split(\" \");\n const parsed = {\n payloadType: parseInt(parts.shift(), 10)\n };\n parts = parts[0].split(\"/\");\n parsed.name = parts[0];\n parsed.clockRate = parseInt(parts[1], 10); // was: clockrate\n parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;\n // legacy alias, got renamed back to channels in ORTC.\n parsed.numChannels = parsed.channels;\n return parsed;\n};\n// Generates a rtpmap line from RTCRtpCodecCapability or\n// RTCRtpCodecParameters.\n$30b3171bddcf6271$var$SDPUtils.writeRtpMap = function(codec) {\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) pt = codec.preferredPayloadType;\n const channels = codec.channels || codec.numChannels || 1;\n return \"a=rtpmap:\" + pt + \" \" + codec.name + \"/\" + codec.clockRate + (channels !== 1 ? \"/\" + channels : \"\") + \"\\r\\n\";\n};\n// Parses a extmap line (headerextension from RFC 5285). Sample input:\n// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\n// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset\n$30b3171bddcf6271$var$SDPUtils.parseExtmap = function(line) {\n const parts = line.substring(9).split(\" \");\n return {\n id: parseInt(parts[0], 10),\n direction: parts[0].indexOf(\"/\") > 0 ? parts[0].split(\"/\")[1] : \"sendrecv\",\n uri: parts[1],\n attributes: parts.slice(2).join(\" \")\n };\n};\n// Generates an extmap line from RTCRtpHeaderExtensionParameters or\n// RTCRtpHeaderExtension.\n$30b3171bddcf6271$var$SDPUtils.writeExtmap = function(headerExtension) {\n return \"a=extmap:\" + (headerExtension.id || headerExtension.preferredId) + (headerExtension.direction && headerExtension.direction !== \"sendrecv\" ? \"/\" + headerExtension.direction : \"\") + \" \" + headerExtension.uri + (headerExtension.attributes ? \" \" + headerExtension.attributes : \"\") + \"\\r\\n\";\n};\n// Parses a fmtp line, returns dictionary. Sample input:\n// a=fmtp:96 vbr=on;cng=on\n// Also deals with vbr=on; cng=on\n$30b3171bddcf6271$var$SDPUtils.parseFmtp = function(line) {\n const parsed = {};\n let kv;\n const parts = line.substring(line.indexOf(\" \") + 1).split(\";\");\n for(let j = 0; j < parts.length; j++){\n kv = parts[j].trim().split(\"=\");\n parsed[kv[0].trim()] = kv[1];\n }\n return parsed;\n};\n// Generates a fmtp line from RTCRtpCodecCapability or RTCRtpCodecParameters.\n$30b3171bddcf6271$var$SDPUtils.writeFmtp = function(codec) {\n let line = \"\";\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) pt = codec.preferredPayloadType;\n if (codec.parameters && Object.keys(codec.parameters).length) {\n const params = [];\n Object.keys(codec.parameters).forEach((param)=>{\n if (codec.parameters[param] !== undefined) params.push(param + \"=\" + codec.parameters[param]);\n else params.push(param);\n });\n line += \"a=fmtp:\" + pt + \" \" + params.join(\";\") + \"\\r\\n\";\n }\n return line;\n};\n// Parses a rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:\n// a=rtcp-fb:98 nack rpsi\n$30b3171bddcf6271$var$SDPUtils.parseRtcpFb = function(line) {\n const parts = line.substring(line.indexOf(\" \") + 1).split(\" \");\n return {\n type: parts.shift(),\n parameter: parts.join(\" \")\n };\n};\n// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.\n$30b3171bddcf6271$var$SDPUtils.writeRtcpFb = function(codec) {\n let lines = \"\";\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) pt = codec.preferredPayloadType;\n if (codec.rtcpFeedback && codec.rtcpFeedback.length) // FIXME: special handling for trr-int?\n codec.rtcpFeedback.forEach((fb)=>{\n lines += \"a=rtcp-fb:\" + pt + \" \" + fb.type + (fb.parameter && fb.parameter.length ? \" \" + fb.parameter : \"\") + \"\\r\\n\";\n });\n return lines;\n};\n// Parses a RFC 5576 ssrc media attribute. Sample input:\n// a=ssrc:3735928559 cname:something\n$30b3171bddcf6271$var$SDPUtils.parseSsrcMedia = function(line) {\n const sp = line.indexOf(\" \");\n const parts = {\n ssrc: parseInt(line.substring(7, sp), 10)\n };\n const colon = line.indexOf(\":\", sp);\n if (colon > -1) {\n parts.attribute = line.substring(sp + 1, colon);\n parts.value = line.substring(colon + 1);\n } else parts.attribute = line.substring(sp + 1);\n return parts;\n};\n// Parse a ssrc-group line (see RFC 5576). Sample input:\n// a=ssrc-group:semantics 12 34\n$30b3171bddcf6271$var$SDPUtils.parseSsrcGroup = function(line) {\n const parts = line.substring(13).split(\" \");\n return {\n semantics: parts.shift(),\n ssrcs: parts.map((ssrc)=>parseInt(ssrc, 10))\n };\n};\n// Extracts the MID (RFC 5888) from a media section.\n// Returns the MID or undefined if no mid line was found.\n$30b3171bddcf6271$var$SDPUtils.getMid = function(mediaSection) {\n const mid = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=mid:\")[0];\n if (mid) return mid.substring(6);\n};\n// Parses a fingerprint line for DTLS-SRTP.\n$30b3171bddcf6271$var$SDPUtils.parseFingerprint = function(line) {\n const parts = line.substring(14).split(\" \");\n return {\n algorithm: parts[0].toLowerCase(),\n value: parts[1].toUpperCase()\n };\n};\n// Extracts DTLS parameters from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the fingerprint line as input. See also getIceParameters.\n$30b3171bddcf6271$var$SDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {\n const lines = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection + sessionpart, \"a=fingerprint:\");\n // Note: a=setup line is ignored since we use the 'auto' role in Edge.\n return {\n role: \"auto\",\n fingerprints: lines.map($30b3171bddcf6271$var$SDPUtils.parseFingerprint)\n };\n};\n// Serializes DTLS parameters to SDP.\n$30b3171bddcf6271$var$SDPUtils.writeDtlsParameters = function(params, setupType) {\n let sdp = \"a=setup:\" + setupType + \"\\r\\n\";\n params.fingerprints.forEach((fp)=>{\n sdp += \"a=fingerprint:\" + fp.algorithm + \" \" + fp.value + \"\\r\\n\";\n });\n return sdp;\n};\n// Parses a=crypto lines into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#dictionary-rtcsrtpsdesparameters-members\n$30b3171bddcf6271$var$SDPUtils.parseCryptoLine = function(line) {\n const parts = line.substring(9).split(\" \");\n return {\n tag: parseInt(parts[0], 10),\n cryptoSuite: parts[1],\n keyParams: parts[2],\n sessionParams: parts.slice(3)\n };\n};\n$30b3171bddcf6271$var$SDPUtils.writeCryptoLine = function(parameters) {\n return \"a=crypto:\" + parameters.tag + \" \" + parameters.cryptoSuite + \" \" + (typeof parameters.keyParams === \"object\" ? $30b3171bddcf6271$var$SDPUtils.writeCryptoKeyParams(parameters.keyParams) : parameters.keyParams) + (parameters.sessionParams ? \" \" + parameters.sessionParams.join(\" \") : \"\") + \"\\r\\n\";\n};\n// Parses the crypto key parameters into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#rtcsrtpkeyparam*\n$30b3171bddcf6271$var$SDPUtils.parseCryptoKeyParams = function(keyParams) {\n if (keyParams.indexOf(\"inline:\") !== 0) return null;\n const parts = keyParams.substring(7).split(\"|\");\n return {\n keyMethod: \"inline\",\n keySalt: parts[0],\n lifeTime: parts[1],\n mkiValue: parts[2] ? parts[2].split(\":\")[0] : undefined,\n mkiLength: parts[2] ? parts[2].split(\":\")[1] : undefined\n };\n};\n$30b3171bddcf6271$var$SDPUtils.writeCryptoKeyParams = function(keyParams) {\n return keyParams.keyMethod + \":\" + keyParams.keySalt + (keyParams.lifeTime ? \"|\" + keyParams.lifeTime : \"\") + (keyParams.mkiValue && keyParams.mkiLength ? \"|\" + keyParams.mkiValue + \":\" + keyParams.mkiLength : \"\");\n};\n// Extracts all SDES parameters.\n$30b3171bddcf6271$var$SDPUtils.getCryptoParameters = function(mediaSection, sessionpart) {\n const lines = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection + sessionpart, \"a=crypto:\");\n return lines.map($30b3171bddcf6271$var$SDPUtils.parseCryptoLine);\n};\n// Parses ICE information from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the ice-ufrag and ice-pwd lines as input.\n$30b3171bddcf6271$var$SDPUtils.getIceParameters = function(mediaSection, sessionpart) {\n const ufrag = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection + sessionpart, \"a=ice-ufrag:\")[0];\n const pwd = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection + sessionpart, \"a=ice-pwd:\")[0];\n if (!(ufrag && pwd)) return null;\n return {\n usernameFragment: ufrag.substring(12),\n password: pwd.substring(10)\n };\n};\n// Serializes ICE parameters to SDP.\n$30b3171bddcf6271$var$SDPUtils.writeIceParameters = function(params) {\n let sdp = \"a=ice-ufrag:\" + params.usernameFragment + \"\\r\\n\" + \"a=ice-pwd:\" + params.password + \"\\r\\n\";\n if (params.iceLite) sdp += \"a=ice-lite\\r\\n\";\n return sdp;\n};\n// Parses the SDP media section and returns RTCRtpParameters.\n$30b3171bddcf6271$var$SDPUtils.parseRtpParameters = function(mediaSection) {\n const description = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: [],\n rtcp: []\n };\n const lines = $30b3171bddcf6271$var$SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(\" \");\n description.profile = mline[2];\n for(let i = 3; i < mline.length; i++){\n const pt = mline[i];\n const rtpmapline = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=rtpmap:\" + pt + \" \")[0];\n if (rtpmapline) {\n const codec = $30b3171bddcf6271$var$SDPUtils.parseRtpMap(rtpmapline);\n const fmtps = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=fmtp:\" + pt + \" \");\n // Only the first a=fmtp: is considered.\n codec.parameters = fmtps.length ? $30b3171bddcf6271$var$SDPUtils.parseFmtp(fmtps[0]) : {};\n codec.rtcpFeedback = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=rtcp-fb:\" + pt + \" \").map($30b3171bddcf6271$var$SDPUtils.parseRtcpFb);\n description.codecs.push(codec);\n // parse FEC mechanisms from rtpmap lines.\n switch(codec.name.toUpperCase()){\n case \"RED\":\n case \"ULPFEC\":\n description.fecMechanisms.push(codec.name.toUpperCase());\n break;\n default:\n break;\n }\n }\n }\n $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=extmap:\").forEach((line)=>{\n description.headerExtensions.push($30b3171bddcf6271$var$SDPUtils.parseExtmap(line));\n });\n const wildcardRtcpFb = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=rtcp-fb:* \").map($30b3171bddcf6271$var$SDPUtils.parseRtcpFb);\n description.codecs.forEach((codec)=>{\n wildcardRtcpFb.forEach((fb)=>{\n const duplicate = codec.rtcpFeedback.find((existingFeedback)=>{\n return existingFeedback.type === fb.type && existingFeedback.parameter === fb.parameter;\n });\n if (!duplicate) codec.rtcpFeedback.push(fb);\n });\n });\n // FIXME: parse rtcp.\n return description;\n};\n// Generates parts of the SDP media section describing the capabilities /\n// parameters.\n$30b3171bddcf6271$var$SDPUtils.writeRtpDescription = function(kind, caps) {\n let sdp = \"\";\n // Build the mline.\n sdp += \"m=\" + kind + \" \";\n sdp += caps.codecs.length > 0 ? \"9\" : \"0\"; // reject if no codecs.\n sdp += \" \" + (caps.profile || \"UDP/TLS/RTP/SAVPF\") + \" \";\n sdp += caps.codecs.map((codec)=>{\n if (codec.preferredPayloadType !== undefined) return codec.preferredPayloadType;\n return codec.payloadType;\n }).join(\" \") + \"\\r\\n\";\n sdp += \"c=IN IP4 0.0.0.0\\r\\n\";\n sdp += \"a=rtcp:9 IN IP4 0.0.0.0\\r\\n\";\n // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.\n caps.codecs.forEach((codec)=>{\n sdp += $30b3171bddcf6271$var$SDPUtils.writeRtpMap(codec);\n sdp += $30b3171bddcf6271$var$SDPUtils.writeFmtp(codec);\n sdp += $30b3171bddcf6271$var$SDPUtils.writeRtcpFb(codec);\n });\n let maxptime = 0;\n caps.codecs.forEach((codec)=>{\n if (codec.maxptime > maxptime) maxptime = codec.maxptime;\n });\n if (maxptime > 0) sdp += \"a=maxptime:\" + maxptime + \"\\r\\n\";\n if (caps.headerExtensions) caps.headerExtensions.forEach((extension)=>{\n sdp += $30b3171bddcf6271$var$SDPUtils.writeExtmap(extension);\n });\n // FIXME: write fecMechanisms.\n return sdp;\n};\n// Parses the SDP media section and returns an array of\n// RTCRtpEncodingParameters.\n$30b3171bddcf6271$var$SDPUtils.parseRtpEncodingParameters = function(mediaSection) {\n const encodingParameters = [];\n const description = $30b3171bddcf6271$var$SDPUtils.parseRtpParameters(mediaSection);\n const hasRed = description.fecMechanisms.indexOf(\"RED\") !== -1;\n const hasUlpfec = description.fecMechanisms.indexOf(\"ULPFEC\") !== -1;\n // filter a=ssrc:... cname:, ignore PlanB-msid\n const ssrcs = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=ssrc:\").map((line)=>$30b3171bddcf6271$var$SDPUtils.parseSsrcMedia(line)).filter((parts)=>parts.attribute === \"cname\");\n const primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;\n let secondarySsrc;\n const flows = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=ssrc-group:FID\").map((line)=>{\n const parts = line.substring(17).split(\" \");\n return parts.map((part)=>parseInt(part, 10));\n });\n if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) secondarySsrc = flows[0][1];\n description.codecs.forEach((codec)=>{\n if (codec.name.toUpperCase() === \"RTX\" && codec.parameters.apt) {\n let encParam = {\n ssrc: primarySsrc,\n codecPayloadType: parseInt(codec.parameters.apt, 10)\n };\n if (primarySsrc && secondarySsrc) encParam.rtx = {\n ssrc: secondarySsrc\n };\n encodingParameters.push(encParam);\n if (hasRed) {\n encParam = JSON.parse(JSON.stringify(encParam));\n encParam.fec = {\n ssrc: primarySsrc,\n mechanism: hasUlpfec ? \"red+ulpfec\" : \"red\"\n };\n encodingParameters.push(encParam);\n }\n }\n });\n if (encodingParameters.length === 0 && primarySsrc) encodingParameters.push({\n ssrc: primarySsrc\n });\n // we support both b=AS and b=TIAS but interpret AS as TIAS.\n let bandwidth = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"b=\");\n if (bandwidth.length) {\n if (bandwidth[0].indexOf(\"b=TIAS:\") === 0) bandwidth = parseInt(bandwidth[0].substring(7), 10);\n else if (bandwidth[0].indexOf(\"b=AS:\") === 0) // use formula from JSEP to convert b=AS to TIAS value.\n bandwidth = parseInt(bandwidth[0].substring(5), 10) * 950 - 16000;\n else bandwidth = undefined;\n encodingParameters.forEach((params)=>{\n params.maxBitrate = bandwidth;\n });\n }\n return encodingParameters;\n};\n// parses http://draft.ortc.org/#rtcrtcpparameters*\n$30b3171bddcf6271$var$SDPUtils.parseRtcpParameters = function(mediaSection) {\n const rtcpParameters = {};\n // Gets the first SSRC. Note that with RTX there might be multiple\n // SSRCs.\n const remoteSsrc = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=ssrc:\").map((line)=>$30b3171bddcf6271$var$SDPUtils.parseSsrcMedia(line)).filter((obj)=>obj.attribute === \"cname\")[0];\n if (remoteSsrc) {\n rtcpParameters.cname = remoteSsrc.value;\n rtcpParameters.ssrc = remoteSsrc.ssrc;\n }\n // Edge uses the compound attribute instead of reducedSize\n // compound is !reducedSize\n const rsize = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=rtcp-rsize\");\n rtcpParameters.reducedSize = rsize.length > 0;\n rtcpParameters.compound = rsize.length === 0;\n // parses the rtcp-mux attrіbute.\n // Note that Edge does not support unmuxed RTCP.\n const mux = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=rtcp-mux\");\n rtcpParameters.mux = mux.length > 0;\n return rtcpParameters;\n};\n$30b3171bddcf6271$var$SDPUtils.writeRtcpParameters = function(rtcpParameters) {\n let sdp = \"\";\n if (rtcpParameters.reducedSize) sdp += \"a=rtcp-rsize\\r\\n\";\n if (rtcpParameters.mux) sdp += \"a=rtcp-mux\\r\\n\";\n if (rtcpParameters.ssrc !== undefined && rtcpParameters.cname) sdp += \"a=ssrc:\" + rtcpParameters.ssrc + \" cname:\" + rtcpParameters.cname + \"\\r\\n\";\n return sdp;\n};\n// parses either a=msid: or a=ssrc:... msid lines and returns\n// the id of the MediaStream and MediaStreamTrack.\n$30b3171bddcf6271$var$SDPUtils.parseMsid = function(mediaSection) {\n let parts;\n const spec = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=msid:\");\n if (spec.length === 1) {\n parts = spec[0].substring(7).split(\" \");\n return {\n stream: parts[0],\n track: parts[1]\n };\n }\n const planB = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=ssrc:\").map((line)=>$30b3171bddcf6271$var$SDPUtils.parseSsrcMedia(line)).filter((msidParts)=>msidParts.attribute === \"msid\");\n if (planB.length > 0) {\n parts = planB[0].value.split(\" \");\n return {\n stream: parts[0],\n track: parts[1]\n };\n }\n};\n// SCTP\n// parses draft-ietf-mmusic-sctp-sdp-26 first and falls back\n// to draft-ietf-mmusic-sctp-sdp-05\n$30b3171bddcf6271$var$SDPUtils.parseSctpDescription = function(mediaSection) {\n const mline = $30b3171bddcf6271$var$SDPUtils.parseMLine(mediaSection);\n const maxSizeLine = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=max-message-size:\");\n let maxMessageSize;\n if (maxSizeLine.length > 0) maxMessageSize = parseInt(maxSizeLine[0].substring(19), 10);\n if (isNaN(maxMessageSize)) maxMessageSize = 65536;\n const sctpPort = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=sctp-port:\");\n if (sctpPort.length > 0) return {\n port: parseInt(sctpPort[0].substring(12), 10),\n protocol: mline.fmt,\n maxMessageSize: maxMessageSize\n };\n const sctpMapLines = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"a=sctpmap:\");\n if (sctpMapLines.length > 0) {\n const parts = sctpMapLines[0].substring(10).split(\" \");\n return {\n port: parseInt(parts[0], 10),\n protocol: parts[1],\n maxMessageSize: maxMessageSize\n };\n }\n};\n// SCTP\n// outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers\n// support by now receiving in this format, unless we originally parsed\n// as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line\n// protocol of DTLS/SCTP -- without UDP/ or TCP/)\n$30b3171bddcf6271$var$SDPUtils.writeSctpDescription = function(media, sctp) {\n let output = [];\n if (media.protocol !== \"DTLS/SCTP\") output = [\n \"m=\" + media.kind + \" 9 \" + media.protocol + \" \" + sctp.protocol + \"\\r\\n\",\n \"c=IN IP4 0.0.0.0\\r\\n\",\n \"a=sctp-port:\" + sctp.port + \"\\r\\n\"\n ];\n else output = [\n \"m=\" + media.kind + \" 9 \" + media.protocol + \" \" + sctp.port + \"\\r\\n\",\n \"c=IN IP4 0.0.0.0\\r\\n\",\n \"a=sctpmap:\" + sctp.port + \" \" + sctp.protocol + \" 65535\\r\\n\"\n ];\n if (sctp.maxMessageSize !== undefined) output.push(\"a=max-message-size:\" + sctp.maxMessageSize + \"\\r\\n\");\n return output.join(\"\");\n};\n// Generate a session ID for SDP.\n// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1\n// recommends using a cryptographically random +ve 64-bit value\n// but right now this should be acceptable and within the right range\n$30b3171bddcf6271$var$SDPUtils.generateSessionId = function() {\n return Math.random().toString().substr(2, 22);\n};\n// Write boiler plate for start of SDP\n// sessId argument is optional - if not supplied it will\n// be generated randomly\n// sessVersion is optional and defaults to 2\n// sessUser is optional and defaults to 'thisisadapterortc'\n$30b3171bddcf6271$var$SDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) {\n let sessionId;\n const version = sessVer !== undefined ? sessVer : 2;\n if (sessId) sessionId = sessId;\n else sessionId = $30b3171bddcf6271$var$SDPUtils.generateSessionId();\n const user = sessUser || \"thisisadapterortc\";\n // FIXME: sess-id should be an NTP timestamp.\n return \"v=0\\r\\no=\" + user + \" \" + sessionId + \" \" + version + \" IN IP4 127.0.0.1\\r\\n\" + \"s=-\\r\\n\" + \"t=0 0\\r\\n\";\n};\n// Gets the direction from the mediaSection or the sessionpart.\n$30b3171bddcf6271$var$SDPUtils.getDirection = function(mediaSection, sessionpart) {\n // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.\n const lines = $30b3171bddcf6271$var$SDPUtils.splitLines(mediaSection);\n for(let i = 0; i < lines.length; i++)switch(lines[i]){\n case \"a=sendrecv\":\n case \"a=sendonly\":\n case \"a=recvonly\":\n case \"a=inactive\":\n return lines[i].substring(2);\n default:\n }\n if (sessionpart) return $30b3171bddcf6271$var$SDPUtils.getDirection(sessionpart);\n return \"sendrecv\";\n};\n$30b3171bddcf6271$var$SDPUtils.getKind = function(mediaSection) {\n const lines = $30b3171bddcf6271$var$SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(\" \");\n return mline[0].substring(2);\n};\n$30b3171bddcf6271$var$SDPUtils.isRejected = function(mediaSection) {\n return mediaSection.split(\" \", 2)[1] === \"0\";\n};\n$30b3171bddcf6271$var$SDPUtils.parseMLine = function(mediaSection) {\n const lines = $30b3171bddcf6271$var$SDPUtils.splitLines(mediaSection);\n const parts = lines[0].substring(2).split(\" \");\n return {\n kind: parts[0],\n port: parseInt(parts[1], 10),\n protocol: parts[2],\n fmt: parts.slice(3).join(\" \")\n };\n};\n$30b3171bddcf6271$var$SDPUtils.parseOLine = function(mediaSection) {\n const line = $30b3171bddcf6271$var$SDPUtils.matchPrefix(mediaSection, \"o=\")[0];\n const parts = line.substring(2).split(\" \");\n return {\n username: parts[0],\n sessionId: parts[1],\n sessionVersion: parseInt(parts[2], 10),\n netType: parts[3],\n addressType: parts[4],\n address: parts[5]\n };\n};\n// a very naive interpretation of a valid SDP.\n$30b3171bddcf6271$var$SDPUtils.isValidSDP = function(blob) {\n if (typeof blob !== \"string\" || blob.length === 0) return false;\n const lines = $30b3171bddcf6271$var$SDPUtils.splitLines(blob);\n for(let i = 0; i < lines.length; i++){\n if (lines[i].length < 2 || lines[i].charAt(1) !== \"=\") return false;\n // TODO: check the modifier a bit more.\n }\n return true;\n};\n$30b3171bddcf6271$exports = $30b3171bddcf6271$var$SDPUtils;\n\n\n\n\"use strict\";\nfunction $f8e30544afcd11f0$export$cf133661e444ccfe(window) {\n // foundation is arbitrarily chosen as an indicator for full support for\n // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface\n if (!window.RTCIceCandidate || window.RTCIceCandidate && \"foundation\" in window.RTCIceCandidate.prototype) return;\n const NativeRTCIceCandidate = window.RTCIceCandidate;\n window.RTCIceCandidate = function RTCIceCandidate(args) {\n // Remove the a= which shouldn't be part of the candidate string.\n if (typeof args === \"object\" && args.candidate && args.candidate.indexOf(\"a=\") === 0) {\n args = JSON.parse(JSON.stringify(args));\n args.candidate = args.candidate.substring(2);\n }\n if (args.candidate && args.candidate.length) {\n // Augment the native candidate with the parsed fields.\n const nativeCandidate = new NativeRTCIceCandidate(args);\n const parsedCandidate = (0, (/*@__PURE__*/$parcel$interopDefault($30b3171bddcf6271$exports))).parseCandidate(args.candidate);\n for(const key in parsedCandidate)if (!(key in nativeCandidate)) Object.defineProperty(nativeCandidate, key, {\n value: parsedCandidate[key]\n });\n // Override serializer to not serialize the extra attributes.\n nativeCandidate.toJSON = function toJSON() {\n return {\n candidate: nativeCandidate.candidate,\n sdpMid: nativeCandidate.sdpMid,\n sdpMLineIndex: nativeCandidate.sdpMLineIndex,\n usernameFragment: nativeCandidate.usernameFragment\n };\n };\n return nativeCandidate;\n }\n return new NativeRTCIceCandidate(args);\n };\n window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"icecandidate\", (e)=>{\n if (e.candidate) Object.defineProperty(e, \"candidate\", {\n value: new window.RTCIceCandidate(e.candidate),\n writable: \"false\"\n });\n return e;\n });\n}\nfunction $f8e30544afcd11f0$export$fdafb8d8280e29b5(window) {\n if (!window.RTCIceCandidate || window.RTCIceCandidate && \"relayProtocol\" in window.RTCIceCandidate.prototype) return;\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"icecandidate\", (e)=>{\n if (e.candidate) {\n const parsedCandidate = (0, (/*@__PURE__*/$parcel$interopDefault($30b3171bddcf6271$exports))).parseCandidate(e.candidate.candidate);\n if (parsedCandidate.type === \"relay\") // This is a libwebrtc-specific mapping of local type preference\n // to relayProtocol.\n e.candidate.relayProtocol = ({\n 0: \"tls\",\n 1: \"tcp\",\n 2: \"udp\"\n })[parsedCandidate.priority >> 24];\n }\n return e;\n });\n}\nfunction $f8e30544afcd11f0$export$a99147c78a56edc4(window, browserDetails) {\n if (!window.RTCPeerConnection) return;\n if (!(\"sctp\" in window.RTCPeerConnection.prototype)) Object.defineProperty(window.RTCPeerConnection.prototype, \"sctp\", {\n get () {\n return typeof this._sctp === \"undefined\" ? null : this._sctp;\n }\n });\n const sctpInDescription = function(description) {\n if (!description || !description.sdp) return false;\n const sections = (0, (/*@__PURE__*/$parcel$interopDefault($30b3171bddcf6271$exports))).splitSections(description.sdp);\n sections.shift();\n return sections.some((mediaSection)=>{\n const mLine = (0, (/*@__PURE__*/$parcel$interopDefault($30b3171bddcf6271$exports))).parseMLine(mediaSection);\n return mLine && mLine.kind === \"application\" && mLine.protocol.indexOf(\"SCTP\") !== -1;\n });\n };\n const getRemoteFirefoxVersion = function(description) {\n // TODO: Is there a better solution for detecting Firefox?\n const match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\\d+)/);\n if (match === null || match.length < 2) return -1;\n const version = parseInt(match[1], 10);\n // Test for NaN (yes, this is ugly)\n return version !== version ? -1 : version;\n };\n const getCanSendMaxMessageSize = function(remoteIsFirefox) {\n // Every implementation we know can send at least 64 KiB.\n // Note: Although Chrome is technically able to send up to 256 KiB, the\n // data does not reach the other peer reliably.\n // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419\n let canSendMaxMessageSize = 65536;\n if (browserDetails.browser === \"firefox\") {\n if (browserDetails.version < 57) {\n if (remoteIsFirefox === -1) // FF < 57 will send in 16 KiB chunks using the deprecated PPID\n // fragmentation.\n canSendMaxMessageSize = 16384;\n else // However, other FF (and RAWRTC) can reassemble PPID-fragmented\n // messages. Thus, supporting ~2 GiB when sending.\n canSendMaxMessageSize = 2147483637;\n } else if (browserDetails.version < 60) // Currently, all FF >= 57 will reset the remote maximum message size\n // to the default value when a data channel is created at a later\n // stage. :(\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n canSendMaxMessageSize = browserDetails.version === 57 ? 65535 : 65536;\n else // FF >= 60 supports sending ~2 GiB\n canSendMaxMessageSize = 2147483637;\n }\n return canSendMaxMessageSize;\n };\n const getMaxMessageSize = function(description, remoteIsFirefox) {\n // Note: 65536 bytes is the default value from the SDP spec. Also,\n // every implementation we know supports receiving 65536 bytes.\n let maxMessageSize = 65536;\n // FF 57 has a slightly incorrect default remote max message size, so\n // we need to adjust it here to avoid a failure when sending.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697\n if (browserDetails.browser === \"firefox\" && browserDetails.version === 57) maxMessageSize = 65535;\n const match = (0, (/*@__PURE__*/$parcel$interopDefault($30b3171bddcf6271$exports))).matchPrefix(description.sdp, \"a=max-message-size:\");\n if (match.length > 0) maxMessageSize = parseInt(match[0].substring(19), 10);\n else if (browserDetails.browser === \"firefox\" && remoteIsFirefox !== -1) // If the maximum message size is not present in the remote SDP and\n // both local and remote are Firefox, the remote peer can receive\n // ~2 GiB.\n maxMessageSize = 2147483637;\n return maxMessageSize;\n };\n const origSetRemoteDescription = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {\n this._sctp = null;\n // Chrome decided to not expose .sctp in plan-b mode.\n // As usual, adapter.js has to do an 'ugly worakaround'\n // to cover up the mess.\n if (browserDetails.browser === \"chrome\" && browserDetails.version >= 76) {\n const { sdpSemantics: sdpSemantics } = this.getConfiguration();\n if (sdpSemantics === \"plan-b\") Object.defineProperty(this, \"sctp\", {\n get () {\n return typeof this._sctp === \"undefined\" ? null : this._sctp;\n },\n enumerable: true,\n configurable: true\n });\n }\n if (sctpInDescription(arguments[0])) {\n // Check if the remote is FF.\n const isFirefox = getRemoteFirefoxVersion(arguments[0]);\n // Get the maximum message size the local peer is capable of sending\n const canSendMMS = getCanSendMaxMessageSize(isFirefox);\n // Get the maximum message size of the remote peer.\n const remoteMMS = getMaxMessageSize(arguments[0], isFirefox);\n // Determine final maximum message size\n let maxMessageSize;\n if (canSendMMS === 0 && remoteMMS === 0) maxMessageSize = Number.POSITIVE_INFINITY;\n else if (canSendMMS === 0 || remoteMMS === 0) maxMessageSize = Math.max(canSendMMS, remoteMMS);\n else maxMessageSize = Math.min(canSendMMS, remoteMMS);\n // Create a dummy RTCSctpTransport object and the 'maxMessageSize'\n // attribute.\n const sctp = {};\n Object.defineProperty(sctp, \"maxMessageSize\", {\n get () {\n return maxMessageSize;\n }\n });\n this._sctp = sctp;\n }\n return origSetRemoteDescription.apply(this, arguments);\n };\n}\nfunction $f8e30544afcd11f0$export$d461c8d5c5db5da7(window) {\n if (!(window.RTCPeerConnection && \"createDataChannel\" in window.RTCPeerConnection.prototype)) return;\n // Note: Although Firefox >= 57 has a native implementation, the maximum\n // message size can be reset for all data channels at a later stage.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n function wrapDcSend(dc, pc) {\n const origDataChannelSend = dc.send;\n dc.send = function send() {\n const data = arguments[0];\n const length = data.length || data.size || data.byteLength;\n if (dc.readyState === \"open\" && pc.sctp && length > pc.sctp.maxMessageSize) throw new TypeError(\"Message too large (can send a maximum of \" + pc.sctp.maxMessageSize + \" bytes)\");\n return origDataChannelSend.apply(dc, arguments);\n };\n }\n const origCreateDataChannel = window.RTCPeerConnection.prototype.createDataChannel;\n window.RTCPeerConnection.prototype.createDataChannel = function createDataChannel() {\n const dataChannel = origCreateDataChannel.apply(this, arguments);\n wrapDcSend(dataChannel, this);\n return dataChannel;\n };\n $11d9b3e4fc7791e1$export$1f48841962b828b1(window, \"datachannel\", (e)=>{\n wrapDcSend(e.channel, e.target);\n return e;\n });\n}\nfunction $f8e30544afcd11f0$export$63bb816cc75460(window) {\n if (!window.RTCPeerConnection || \"connectionState\" in window.RTCPeerConnection.prototype) return;\n const proto = window.RTCPeerConnection.prototype;\n Object.defineProperty(proto, \"connectionState\", {\n get () {\n return ({\n completed: \"connected\",\n checking: \"connecting\"\n })[this.iceConnectionState] || this.iceConnectionState;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(proto, \"onconnectionstatechange\", {\n get () {\n return this._onconnectionstatechange || null;\n },\n set (cb) {\n if (this._onconnectionstatechange) {\n this.removeEventListener(\"connectionstatechange\", this._onconnectionstatechange);\n delete this._onconnectionstatechange;\n }\n if (cb) this.addEventListener(\"connectionstatechange\", this._onconnectionstatechange = cb);\n },\n enumerable: true,\n configurable: true\n });\n [\n \"setLocalDescription\",\n \"setRemoteDescription\"\n ].forEach((method)=>{\n const origMethod = proto[method];\n proto[method] = function() {\n if (!this._connectionstatechangepoly) {\n this._connectionstatechangepoly = (e)=>{\n const pc = e.target;\n if (pc._lastConnectionState !== pc.connectionState) {\n pc._lastConnectionState = pc.connectionState;\n const newEvent = new Event(\"connectionstatechange\", e);\n pc.dispatchEvent(newEvent);\n }\n return e;\n };\n this.addEventListener(\"iceconnectionstatechange\", this._connectionstatechangepoly);\n }\n return origMethod.apply(this, arguments);\n };\n });\n}\nfunction $f8e30544afcd11f0$export$a57d114344295149(window, browserDetails) {\n /* remove a=extmap-allow-mixed for webrtc.org < M71 */ if (!window.RTCPeerConnection) return;\n if (browserDetails.browser === \"chrome\" && browserDetails.version >= 71) return;\n if (browserDetails.browser === \"safari\" && browserDetails.version >= 605) return;\n const nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription(desc) {\n if (desc && desc.sdp && desc.sdp.indexOf(\"\\na=extmap-allow-mixed\") !== -1) {\n const sdp = desc.sdp.split(\"\\n\").filter((line)=>{\n return line.trim() !== \"a=extmap-allow-mixed\";\n }).join(\"\\n\");\n // Safari enforces read-only-ness of RTCSessionDescription fields.\n if (window.RTCSessionDescription && desc instanceof window.RTCSessionDescription) arguments[0] = new window.RTCSessionDescription({\n type: desc.type,\n sdp: sdp\n });\n else desc.sdp = sdp;\n }\n return nativeSRD.apply(this, arguments);\n };\n}\nfunction $f8e30544afcd11f0$export$51d5e40b48c771c7(window, browserDetails) {\n // Support for addIceCandidate(null or undefined)\n // as well as addIceCandidate({candidate: \"\", ...})\n // https://bugs.chromium.org/p/chromium/issues/detail?id=978582\n // Note: must be called before other polyfills which change the signature.\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) return;\n const nativeAddIceCandidate = window.RTCPeerConnection.prototype.addIceCandidate;\n if (!nativeAddIceCandidate || nativeAddIceCandidate.length === 0) return;\n window.RTCPeerConnection.prototype.addIceCandidate = function addIceCandidate() {\n if (!arguments[0]) {\n if (arguments[1]) arguments[1].apply(null);\n return Promise.resolve();\n }\n // Firefox 68+ emits and processes {candidate: \"\", ...}, ignore\n // in older versions.\n // Native support for ignoring exists for Chrome M77+.\n // Safari ignores as well, exact version unknown but works in the same\n // version that also ignores addIceCandidate(null).\n if ((browserDetails.browser === \"chrome\" && browserDetails.version < 78 || browserDetails.browser === \"firefox\" && browserDetails.version < 68 || browserDetails.browser === \"safari\") && arguments[0] && arguments[0].candidate === \"\") return Promise.resolve();\n return nativeAddIceCandidate.apply(this, arguments);\n };\n}\nfunction $f8e30544afcd11f0$export$7170d04e59f9d553(window, browserDetails) {\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) return;\n const nativeSetLocalDescription = window.RTCPeerConnection.prototype.setLocalDescription;\n if (!nativeSetLocalDescription || nativeSetLocalDescription.length === 0) return;\n window.RTCPeerConnection.prototype.setLocalDescription = function setLocalDescription() {\n let desc = arguments[0] || {};\n if (typeof desc !== \"object\" || desc.type && desc.sdp) return nativeSetLocalDescription.apply(this, arguments);\n // The remaining steps should technically happen when SLD comes off the\n // RTCPeerConnection's operations chain (not ahead of going on it), but\n // this is too difficult to shim. Instead, this shim only covers the\n // common case where the operations chain is empty. This is imperfect, but\n // should cover many cases. Rationale: Even if we can't reduce the glare\n // window to zero on imperfect implementations, there's value in tapping\n // into the perfect negotiation pattern that several browsers support.\n desc = {\n type: desc.type,\n sdp: desc.sdp\n };\n if (!desc.type) switch(this.signalingState){\n case \"stable\":\n case \"have-local-offer\":\n case \"have-remote-pranswer\":\n desc.type = \"offer\";\n break;\n default:\n desc.type = \"answer\";\n break;\n }\n if (desc.sdp || desc.type !== \"offer\" && desc.type !== \"answer\") return nativeSetLocalDescription.apply(this, [\n desc\n ]);\n const func = desc.type === \"offer\" ? this.createOffer : this.createAnswer;\n return func.apply(this).then((d)=>nativeSetLocalDescription.apply(this, [\n d\n ]));\n };\n}\n\n\n\nfunction $53a477c62a90b792$export$e77bf46c04ac7d12({ window: window } = {}, options = {\n shimChrome: true,\n shimFirefox: true,\n shimSafari: true\n}) {\n // Utils.\n const logging = $11d9b3e4fc7791e1$export$bef1f36f5486a6a3;\n const browserDetails = $11d9b3e4fc7791e1$export$2d31490a0c05f094(window);\n const adapter = {\n browserDetails: browserDetails,\n commonShim: $f8e30544afcd11f0$exports,\n extractVersion: $11d9b3e4fc7791e1$export$e3c02be309be1f23,\n disableLog: $11d9b3e4fc7791e1$export$afbfee8cc06fd3e4,\n disableWarnings: $11d9b3e4fc7791e1$export$51516be4b019e41e,\n sdp: // Expose sdp as a convenience. For production apps include directly.\n $30b3171bddcf6271$exports\n };\n // Shim browser if found.\n switch(browserDetails.browser){\n case \"chrome\":\n if (!$041f4f4318baab2c$exports || !$041f4f4318baab2c$exports.shimPeerConnection || !options.shimChrome) {\n logging(\"Chrome shim is not included in this adapter release.\");\n return adapter;\n }\n if (browserDetails.version === null) {\n logging(\"Chrome shim can not determine version, not shimming.\");\n return adapter;\n }\n logging(\"adapter.js shimming chrome.\");\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = $041f4f4318baab2c$exports;\n // Must be called before shimPeerConnection.\n $f8e30544afcd11f0$export$51d5e40b48c771c7(window, browserDetails);\n $f8e30544afcd11f0$export$7170d04e59f9d553(window, browserDetails);\n $041f4f4318baab2c$exports.shimGetUserMedia(window, browserDetails);\n $041f4f4318baab2c$exports.shimMediaStream(window, browserDetails);\n $041f4f4318baab2c$exports.shimPeerConnection(window, browserDetails);\n $041f4f4318baab2c$exports.shimOnTrack(window, browserDetails);\n $041f4f4318baab2c$exports.shimAddTrackRemoveTrack(window, browserDetails);\n $041f4f4318baab2c$exports.shimGetSendersWithDtmf(window, browserDetails);\n $041f4f4318baab2c$exports.shimGetStats(window, browserDetails);\n $041f4f4318baab2c$exports.shimSenderReceiverGetStats(window, browserDetails);\n $041f4f4318baab2c$exports.fixNegotiationNeeded(window, browserDetails);\n $f8e30544afcd11f0$export$cf133661e444ccfe(window, browserDetails);\n $f8e30544afcd11f0$export$fdafb8d8280e29b5(window, browserDetails);\n $f8e30544afcd11f0$export$63bb816cc75460(window, browserDetails);\n $f8e30544afcd11f0$export$a99147c78a56edc4(window, browserDetails);\n $f8e30544afcd11f0$export$d461c8d5c5db5da7(window, browserDetails);\n $f8e30544afcd11f0$export$a57d114344295149(window, browserDetails);\n break;\n case \"firefox\":\n if (!$5ba25c21eb1c0af8$exports || !$5ba25c21eb1c0af8$exports.shimPeerConnection || !options.shimFirefox) {\n logging(\"Firefox shim is not included in this adapter release.\");\n return adapter;\n }\n logging(\"adapter.js shimming firefox.\");\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = $5ba25c21eb1c0af8$exports;\n // Must be called before shimPeerConnection.\n $f8e30544afcd11f0$export$51d5e40b48c771c7(window, browserDetails);\n $f8e30544afcd11f0$export$7170d04e59f9d553(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimGetUserMedia(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimPeerConnection(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimOnTrack(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimRemoveStream(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimSenderGetStats(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimReceiverGetStats(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimRTCDataChannel(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimAddTransceiver(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimGetParameters(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimCreateOffer(window, browserDetails);\n $5ba25c21eb1c0af8$exports.shimCreateAnswer(window, browserDetails);\n $f8e30544afcd11f0$export$cf133661e444ccfe(window, browserDetails);\n $f8e30544afcd11f0$export$63bb816cc75460(window, browserDetails);\n $f8e30544afcd11f0$export$a99147c78a56edc4(window, browserDetails);\n $f8e30544afcd11f0$export$d461c8d5c5db5da7(window, browserDetails);\n break;\n case \"safari\":\n if (!$93a503258ac80079$exports || !options.shimSafari) {\n logging(\"Safari shim is not included in this adapter release.\");\n return adapter;\n }\n logging(\"adapter.js shimming safari.\");\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = $93a503258ac80079$exports;\n // Must be called before shimCallbackAPI.\n $f8e30544afcd11f0$export$51d5e40b48c771c7(window, browserDetails);\n $f8e30544afcd11f0$export$7170d04e59f9d553(window, browserDetails);\n $93a503258ac80079$exports.shimRTCIceServerUrls(window, browserDetails);\n $93a503258ac80079$exports.shimCreateOfferLegacy(window, browserDetails);\n $93a503258ac80079$exports.shimCallbacksAPI(window, browserDetails);\n $93a503258ac80079$exports.shimLocalStreamsAPI(window, browserDetails);\n $93a503258ac80079$exports.shimRemoteStreamsAPI(window, browserDetails);\n $93a503258ac80079$exports.shimTrackEventTransceiver(window, browserDetails);\n $93a503258ac80079$exports.shimGetUserMedia(window, browserDetails);\n $93a503258ac80079$exports.shimAudioContext(window, browserDetails);\n $f8e30544afcd11f0$export$cf133661e444ccfe(window, browserDetails);\n $f8e30544afcd11f0$export$fdafb8d8280e29b5(window, browserDetails);\n $f8e30544afcd11f0$export$a99147c78a56edc4(window, browserDetails);\n $f8e30544afcd11f0$export$d461c8d5c5db5da7(window, browserDetails);\n $f8e30544afcd11f0$export$a57d114344295149(window, browserDetails);\n break;\n default:\n logging(\"Unsupported browser!\");\n break;\n }\n return adapter;\n}\n\n\n\"use strict\";\nconst $cd55ff0e0516c779$var$adapter = (0, $53a477c62a90b792$export$e77bf46c04ac7d12)({\n window: typeof window === \"undefined\" ? undefined : window\n});\nvar $cd55ff0e0516c779$export$2e2bcd8739ae039 = $cd55ff0e0516c779$var$adapter;\n\n\nconst $f719426f9499296d$var$webRTCAdapter = //@ts-ignore\n(0, $cd55ff0e0516c779$export$2e2bcd8739ae039).default || (0, $cd55ff0e0516c779$export$2e2bcd8739ae039);\nconst $f719426f9499296d$export$25be9502477c137d = new class {\n isWebRTCSupported() {\n return typeof RTCPeerConnection !== \"undefined\";\n }\n isBrowserSupported() {\n const browser = this.getBrowser();\n const version = this.getVersion();\n const validBrowser = this.supportedBrowsers.includes(browser);\n if (!validBrowser) return false;\n if (browser === \"chrome\") return version >= this.minChromeVersion;\n if (browser === \"firefox\") return version >= this.minFirefoxVersion;\n if (browser === \"safari\") return !this.isIOS && version >= this.minSafariVersion;\n return false;\n }\n getBrowser() {\n return $f719426f9499296d$var$webRTCAdapter.browserDetails.browser;\n }\n getVersion() {\n return $f719426f9499296d$var$webRTCAdapter.browserDetails.version || 0;\n }\n isUnifiedPlanSupported() {\n const browser = this.getBrowser();\n const version = $f719426f9499296d$var$webRTCAdapter.browserDetails.version || 0;\n if (browser === \"chrome\" && version < this.minChromeVersion) return false;\n if (browser === \"firefox\" && version >= this.minFirefoxVersion) return true;\n if (!window.RTCRtpTransceiver || !(\"currentDirection\" in RTCRtpTransceiver.prototype)) return false;\n let tempPc;\n let supported = false;\n try {\n tempPc = new RTCPeerConnection();\n tempPc.addTransceiver(\"audio\");\n supported = true;\n } catch (e) {} finally{\n if (tempPc) tempPc.close();\n }\n return supported;\n }\n toString() {\n return `Supports:\n browser:${this.getBrowser()}\n version:${this.getVersion()}\n isIOS:${this.isIOS}\n isWebRTCSupported:${this.isWebRTCSupported()}\n isBrowserSupported:${this.isBrowserSupported()}\n isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`;\n }\n constructor(){\n this.isIOS = [\n \"iPad\",\n \"iPhone\",\n \"iPod\"\n ].includes(navigator.platform);\n this.supportedBrowsers = [\n \"firefox\",\n \"chrome\",\n \"safari\"\n ];\n this.minFirefoxVersion = 59;\n this.minChromeVersion = 72;\n this.minSafariVersion = 605;\n }\n}();\n\n\nconst $fdc87120bf726113$export$f35f128fd59ea256 = (id)=>{\n // Allow empty ids\n return !id || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(id);\n};\n\n\nconst $eb24a05d5e66c1f6$export$4e61f672936bec77 = ()=>Math.random().toString(36).slice(2);\n\n\nconst $0c88dccd73f5641e$var$DEFAULT_CONFIG = {\n iceServers: [\n {\n urls: \"stun:stun.l.google.com:19302\"\n },\n {\n urls: [\n \"turn:eu-0.turn.peerjs.com:3478\",\n \"turn:us-0.turn.peerjs.com:3478\"\n ],\n username: \"peerjs\",\n credential: \"peerjsp\"\n }\n ],\n sdpSemantics: \"unified-plan\"\n};\nclass $0c88dccd73f5641e$export$f8f26dd395d7e1bd extends (0, $337647a69164cf0a$export$f1c5f4c9cb95390b) {\n noop() {}\n blobToArrayBuffer(blob, cb) {\n const fr = new FileReader();\n fr.onload = function(evt) {\n if (evt.target) cb(evt.target.result);\n };\n fr.readAsArrayBuffer(blob);\n return fr;\n }\n binaryStringToArrayBuffer(binary) {\n const byteArray = new Uint8Array(binary.length);\n for(let i = 0; i < binary.length; i++)byteArray[i] = binary.charCodeAt(i) & 0xff;\n return byteArray.buffer;\n }\n isSecure() {\n return location.protocol === \"https:\";\n }\n constructor(...args){\n super(...args);\n this.CLOUD_HOST = \"0.peerjs.com\";\n this.CLOUD_PORT = 443;\n // Browsers that need chunking:\n this.chunkedBrowsers = {\n Chrome: 1,\n chrome: 1\n };\n // Returns browser-agnostic default config\n this.defaultConfig = $0c88dccd73f5641e$var$DEFAULT_CONFIG;\n this.browser = (0, $f719426f9499296d$export$25be9502477c137d).getBrowser();\n this.browserVersion = (0, $f719426f9499296d$export$25be9502477c137d).getVersion();\n this.pack = $41cdfe0a3ede2608$export$2a703dbb0cb35339;\n this.unpack = $41cdfe0a3ede2608$export$417857010dc9287f;\n /**\n\t * A hash of WebRTC features mapped to booleans that correspond to whether the feature is supported by the current browser.\n\t *\n\t * :::caution\n\t * Only the properties documented here are guaranteed to be present on `util.supports`\n\t * :::\n\t */ this.supports = function() {\n const supported = {\n browser: (0, $f719426f9499296d$export$25be9502477c137d).isBrowserSupported(),\n webRTC: (0, $f719426f9499296d$export$25be9502477c137d).isWebRTCSupported(),\n audioVideo: false,\n data: false,\n binaryBlob: false,\n reliable: false\n };\n if (!supported.webRTC) return supported;\n let pc;\n try {\n pc = new RTCPeerConnection($0c88dccd73f5641e$var$DEFAULT_CONFIG);\n supported.audioVideo = true;\n let dc;\n try {\n dc = pc.createDataChannel(\"_PEERJSTEST\", {\n ordered: true\n });\n supported.data = true;\n supported.reliable = !!dc.ordered;\n // Binary test\n try {\n dc.binaryType = \"blob\";\n supported.binaryBlob = !(0, $f719426f9499296d$export$25be9502477c137d).isIOS;\n } catch (e) {}\n } catch (e) {} finally{\n if (dc) dc.close();\n }\n } catch (e) {} finally{\n if (pc) pc.close();\n }\n return supported;\n }();\n // Ensure alphanumeric ids\n this.validateId = (0, $fdc87120bf726113$export$f35f128fd59ea256);\n this.randomToken = (0, $eb24a05d5e66c1f6$export$4e61f672936bec77);\n }\n}\nconst $0c88dccd73f5641e$export$7debb50ef11d5e0b = new $0c88dccd73f5641e$export$f8f26dd395d7e1bd();\n\n\n\nconst $6adb9b697958aa01$var$LOG_PREFIX = \"PeerJS: \";\nvar $6adb9b697958aa01$export$243e62d78d3b544d;\n(function(LogLevel) {\n /**\n\t * Prints no logs.\n\t */ LogLevel[LogLevel[\"Disabled\"] = 0] = \"Disabled\";\n /**\n\t * Prints only errors.\n\t */ LogLevel[LogLevel[\"Errors\"] = 1] = \"Errors\";\n /**\n\t * Prints errors and warnings.\n\t */ LogLevel[LogLevel[\"Warnings\"] = 2] = \"Warnings\";\n /**\n\t * Prints all logs.\n\t */ LogLevel[LogLevel[\"All\"] = 3] = \"All\";\n})($6adb9b697958aa01$export$243e62d78d3b544d || ($6adb9b697958aa01$export$243e62d78d3b544d = {}));\nclass $6adb9b697958aa01$var$Logger {\n get logLevel() {\n return this._logLevel;\n }\n set logLevel(logLevel) {\n this._logLevel = logLevel;\n }\n log(...args) {\n if (this._logLevel >= 3) this._print(3, ...args);\n }\n warn(...args) {\n if (this._logLevel >= 2) this._print(2, ...args);\n }\n error(...args) {\n if (this._logLevel >= 1) this._print(1, ...args);\n }\n setLogFunction(fn) {\n this._print = fn;\n }\n _print(logLevel, ...rest) {\n const copy = [\n $6adb9b697958aa01$var$LOG_PREFIX,\n ...rest\n ];\n for(const i in copy)if (copy[i] instanceof Error) copy[i] = \"(\" + copy[i].name + \") \" + copy[i].message;\n if (logLevel >= 3) console.log(...copy);\n else if (logLevel >= 2) console.warn(\"WARNING\", ...copy);\n else if (logLevel >= 1) console.error(\"ERROR\", ...copy);\n }\n constructor(){\n this._logLevel = 0;\n }\n}\nvar $6adb9b697958aa01$export$2e2bcd8739ae039 = new $6adb9b697958aa01$var$Logger();\n\n\nvar $6af28e6583ade012$exports = {};\n\"use strict\";\nvar $6af28e6583ade012$var$has = Object.prototype.hasOwnProperty, $6af28e6583ade012$var$prefix = \"~\";\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */ function $6af28e6583ade012$var$Events() {}\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n $6af28e6583ade012$var$Events.prototype = Object.create(null);\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new $6af28e6583ade012$var$Events().__proto__) $6af28e6583ade012$var$prefix = false;\n}\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */ function $6af28e6583ade012$var$EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */ function $6af28e6583ade012$var$addListener(emitter, event, fn, context, once) {\n if (typeof fn !== \"function\") throw new TypeError(\"The listener must be a function\");\n var listener = new $6af28e6583ade012$var$EE(fn, context || emitter, once), evt = $6af28e6583ade012$var$prefix ? $6af28e6583ade012$var$prefix + event : event;\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [\n emitter._events[evt],\n listener\n ];\n return emitter;\n}\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */ function $6af28e6583ade012$var$clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new $6af28e6583ade012$var$Events();\n else delete emitter._events[evt];\n}\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */ function $6af28e6583ade012$var$EventEmitter() {\n this._events = new $6af28e6583ade012$var$Events();\n this._eventsCount = 0;\n}\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.eventNames = function eventNames() {\n var names = [], events, name;\n if (this._eventsCount === 0) return names;\n for(name in events = this._events)if ($6af28e6583ade012$var$has.call(events, name)) names.push($6af28e6583ade012$var$prefix ? name.slice(1) : name);\n if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));\n return names;\n};\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.listeners = function listeners(event) {\n var evt = $6af28e6583ade012$var$prefix ? $6af28e6583ade012$var$prefix + event : event, handlers = this._events[evt];\n if (!handlers) return [];\n if (handlers.fn) return [\n handlers.fn\n ];\n for(var i = 0, l = handlers.length, ee = new Array(l); i < l; i++)ee[i] = handlers[i].fn;\n return ee;\n};\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = $6af28e6583ade012$var$prefix ? $6af28e6583ade012$var$prefix + event : event, listeners = this._events[evt];\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = $6af28e6583ade012$var$prefix ? $6af28e6583ade012$var$prefix + event : event;\n if (!this._events[evt]) return false;\n var listeners = this._events[evt], len = arguments.length, args, i;\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n switch(len){\n case 1:\n return listeners.fn.call(listeners.context), true;\n case 2:\n return listeners.fn.call(listeners.context, a1), true;\n case 3:\n return listeners.fn.call(listeners.context, a1, a2), true;\n case 4:\n return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5:\n return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6:\n return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n for(i = 1, args = new Array(len - 1); i < len; i++)args[i - 1] = arguments[i];\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length, j;\n for(i = 0; i < length; i++){\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n switch(len){\n case 1:\n listeners[i].fn.call(listeners[i].context);\n break;\n case 2:\n listeners[i].fn.call(listeners[i].context, a1);\n break;\n case 3:\n listeners[i].fn.call(listeners[i].context, a1, a2);\n break;\n case 4:\n listeners[i].fn.call(listeners[i].context, a1, a2, a3);\n break;\n default:\n if (!args) for(j = 1, args = new Array(len - 1); j < len; j++)args[j - 1] = arguments[j];\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n return true;\n};\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.on = function on(event, fn, context) {\n return $6af28e6583ade012$var$addListener(this, event, fn, context, false);\n};\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.once = function once(event, fn, context) {\n return $6af28e6583ade012$var$addListener(this, event, fn, context, true);\n};\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = $6af28e6583ade012$var$prefix ? $6af28e6583ade012$var$prefix + event : event;\n if (!this._events[evt]) return this;\n if (!fn) {\n $6af28e6583ade012$var$clearEvent(this, evt);\n return this;\n }\n var listeners = this._events[evt];\n if (listeners.fn) {\n if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) $6af28e6583ade012$var$clearEvent(this, evt);\n } else {\n for(var i = 0, events = [], length = listeners.length; i < length; i++)if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else $6af28e6583ade012$var$clearEvent(this, evt);\n }\n return this;\n};\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */ $6af28e6583ade012$var$EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n if (event) {\n evt = $6af28e6583ade012$var$prefix ? $6af28e6583ade012$var$prefix + event : event;\n if (this._events[evt]) $6af28e6583ade012$var$clearEvent(this, evt);\n } else {\n this._events = new $6af28e6583ade012$var$Events();\n this._eventsCount = 0;\n }\n return this;\n};\n//\n// Alias methods names because people roll like that.\n//\n$6af28e6583ade012$var$EventEmitter.prototype.off = $6af28e6583ade012$var$EventEmitter.prototype.removeListener;\n$6af28e6583ade012$var$EventEmitter.prototype.addListener = $6af28e6583ade012$var$EventEmitter.prototype.on;\n//\n// Expose the prefix.\n//\n$6af28e6583ade012$var$EventEmitter.prefixed = $6af28e6583ade012$var$prefix;\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\n$6af28e6583ade012$var$EventEmitter.EventEmitter = $6af28e6583ade012$var$EventEmitter;\n$6af28e6583ade012$exports = $6af28e6583ade012$var$EventEmitter;\n\n\n\nvar $200acda04d260725$export$3157d57b4135e3bc;\n(function(ConnectionType) {\n ConnectionType[\"Data\"] = \"data\";\n ConnectionType[\"Media\"] = \"media\";\n})($200acda04d260725$export$3157d57b4135e3bc || ($200acda04d260725$export$3157d57b4135e3bc = {}));\nvar $200acda04d260725$export$9547aaa2e39030ff;\n(function(PeerErrorType) {\n /**\n\t * The client's browser does not support some or all WebRTC features that you are trying to use.\n\t */ PeerErrorType[\"BrowserIncompatible\"] = \"browser-incompatible\";\n /**\n\t * You've already disconnected this peer from the server and can no longer make any new connections on it.\n\t */ PeerErrorType[\"Disconnected\"] = \"disconnected\";\n /**\n\t * The ID passed into the Peer constructor contains illegal characters.\n\t */ PeerErrorType[\"InvalidID\"] = \"invalid-id\";\n /**\n\t * The API key passed into the Peer constructor contains illegal characters or is not in the system (cloud server only).\n\t */ PeerErrorType[\"InvalidKey\"] = \"invalid-key\";\n /**\n\t * Lost or cannot establish a connection to the signalling server.\n\t */ PeerErrorType[\"Network\"] = \"network\";\n /**\n\t * The peer you're trying to connect to does not exist.\n\t */ PeerErrorType[\"PeerUnavailable\"] = \"peer-unavailable\";\n /**\n\t * PeerJS is being used securely, but the cloud server does not support SSL. Use a custom PeerServer.\n\t */ PeerErrorType[\"SslUnavailable\"] = \"ssl-unavailable\";\n /**\n\t * Unable to reach the server.\n\t */ PeerErrorType[\"ServerError\"] = \"server-error\";\n /**\n\t * An error from the underlying socket.\n\t */ PeerErrorType[\"SocketError\"] = \"socket-error\";\n /**\n\t * The underlying socket closed unexpectedly.\n\t */ PeerErrorType[\"SocketClosed\"] = \"socket-closed\";\n /**\n\t * The ID passed into the Peer constructor is already taken.\n\t *\n\t * :::caution\n\t * This error is not fatal if your peer has open peer-to-peer connections.\n\t * This can happen if you attempt to {@apilink Peer.reconnect} a peer that has been disconnected from the server,\n\t * but its old ID has now been taken.\n\t * :::\n\t */ PeerErrorType[\"UnavailableID\"] = \"unavailable-id\";\n /**\n\t * Native WebRTC errors.\n\t */ PeerErrorType[\"WebRTC\"] = \"webrtc\";\n})($200acda04d260725$export$9547aaa2e39030ff || ($200acda04d260725$export$9547aaa2e39030ff = {}));\nvar $200acda04d260725$export$7974935686149686;\n(function(BaseConnectionErrorType) {\n BaseConnectionErrorType[\"NegotiationFailed\"] = \"negotiation-failed\";\n BaseConnectionErrorType[\"ConnectionClosed\"] = \"connection-closed\";\n})($200acda04d260725$export$7974935686149686 || ($200acda04d260725$export$7974935686149686 = {}));\nvar $200acda04d260725$export$49ae800c114df41d;\n(function(DataConnectionErrorType) {\n DataConnectionErrorType[\"NotOpenYet\"] = \"not-open-yet\";\n DataConnectionErrorType[\"MessageToBig\"] = \"message-too-big\";\n})($200acda04d260725$export$49ae800c114df41d || ($200acda04d260725$export$49ae800c114df41d = {}));\nvar $200acda04d260725$export$89f507cf986a947;\n(function(SerializationType) {\n SerializationType[\"Binary\"] = \"binary\";\n SerializationType[\"BinaryUTF8\"] = \"binary-utf8\";\n SerializationType[\"JSON\"] = \"json\";\n SerializationType[\"None\"] = \"raw\";\n})($200acda04d260725$export$89f507cf986a947 || ($200acda04d260725$export$89f507cf986a947 = {}));\nvar $200acda04d260725$export$3b5c4a4b6354f023;\n(function(SocketEventType) {\n SocketEventType[\"Message\"] = \"message\";\n SocketEventType[\"Disconnected\"] = \"disconnected\";\n SocketEventType[\"Error\"] = \"error\";\n SocketEventType[\"Close\"] = \"close\";\n})($200acda04d260725$export$3b5c4a4b6354f023 || ($200acda04d260725$export$3b5c4a4b6354f023 = {}));\nvar $200acda04d260725$export$adb4a1754da6f10d;\n(function(ServerMessageType) {\n ServerMessageType[\"Heartbeat\"] = \"HEARTBEAT\";\n ServerMessageType[\"Candidate\"] = \"CANDIDATE\";\n ServerMessageType[\"Offer\"] = \"OFFER\";\n ServerMessageType[\"Answer\"] = \"ANSWER\";\n ServerMessageType[\"Open\"] = \"OPEN\";\n ServerMessageType[\"Error\"] = \"ERROR\";\n ServerMessageType[\"IdTaken\"] = \"ID-TAKEN\";\n ServerMessageType[\"InvalidKey\"] = \"INVALID-KEY\";\n ServerMessageType[\"Leave\"] = \"LEAVE\";\n ServerMessageType[\"Expire\"] = \"EXPIRE\";\n})($200acda04d260725$export$adb4a1754da6f10d || ($200acda04d260725$export$adb4a1754da6f10d = {}));\n\n\nvar $ccd644f7486bf635$exports = {};\n$ccd644f7486bf635$exports = JSON.parse('{\"name\":\"peerjs\",\"version\":\"1.5.2\",\"keywords\":[\"peerjs\",\"webrtc\",\"p2p\",\"rtc\"],\"description\":\"PeerJS client\",\"homepage\":\"https://peerjs.com\",\"bugs\":{\"url\":\"https://github.com/peers/peerjs/issues\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/peers/peerjs\"},\"license\":\"MIT\",\"contributors\":[\"Michelle Bu \",\"afrokick \",\"ericz \",\"Jairo \",\"Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>\",\"Jairo Caro-Accino Viciana \",\"Carlos Caballero \",\"hc \",\"Muhammad Asif \",\"PrashoonB \",\"Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>\",\"akotynski \",\"lmb \",\"Jairooo \",\"Moritz St\\xfcckler \",\"Simon \",\"Denis Lukov \",\"Philipp Hancke \",\"Hans Oksendahl \",\"Jess \",\"khankuan \",\"DUODVK \",\"XiZhao \",\"Matthias Lohr \",\"=frank tree <=frnktrb@googlemail.com>\",\"Andre Eckardt \",\"Chris Cowan \",\"Alex Chuev \",\"alxnull \",\"Yemel Jardi \",\"Ben Parnell \",\"Benny Lichtner \",\"fresheneesz \",\"bob.barstead@exaptive.com \",\"chandika \",\"emersion \",\"Christopher Van \",\"eddieherm \",\"Eduardo Pinho \",\"Evandro Zanatta \",\"Gardner Bickford \",\"Gian Luca \",\"PatrickJS \",\"jonnyf \",\"Hizkia Felix \",\"Hristo Oskov \",\"Isaac Madwed \",\"Ilya Konanykhin \",\"jasonbarry \",\"Jonathan Burke \",\"Josh Hamit \",\"Jordan Austin \",\"Joel Wetzell \",\"xizhao \",\"Alberto Torres \",\"Jonathan Mayol \",\"Jefferson Felix \",\"Rolf Erik Lekang \",\"Kevin Mai-Husan Chia \",\"Pepijn de Vos \",\"JooYoung \",\"Tobias Speicher \",\"Steve Blaurock \",\"Kyrylo Shegeda \",\"Diwank Singh Tomer \",\"So\\u0308ren Balko \",\"Arpit Solanki \",\"Yuki Ito \",\"Artur Zayats \"],\"funding\":{\"type\":\"opencollective\",\"url\":\"https://opencollective.com/peer\"},\"collective\":{\"type\":\"opencollective\",\"url\":\"https://opencollective.com/peer\"},\"files\":[\"dist/*\"],\"sideEffects\":[\"lib/global.ts\",\"lib/supports.ts\"],\"main\":\"dist/bundler.cjs\",\"module\":\"dist/bundler.mjs\",\"browser-minified\":\"dist/peerjs.min.js\",\"browser-unminified\":\"dist/peerjs.js\",\"browser-minified-cbor\":\"dist/serializer.cbor.mjs\",\"browser-minified-msgpack\":\"dist/serializer.msgpack.mjs\",\"types\":\"dist/types.d.ts\",\"engines\":{\"node\":\">= 14\"},\"targets\":{\"types\":{\"source\":\"lib/exports.ts\"},\"main\":{\"source\":\"lib/exports.ts\",\"sourceMap\":{\"inlineSources\":true}},\"module\":{\"source\":\"lib/exports.ts\",\"includeNodeModules\":[\"eventemitter3\"],\"sourceMap\":{\"inlineSources\":true}},\"browser-minified\":{\"context\":\"browser\",\"outputFormat\":\"global\",\"optimize\":true,\"engines\":{\"browsers\":\"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15\"},\"source\":\"lib/global.ts\"},\"browser-unminified\":{\"context\":\"browser\",\"outputFormat\":\"global\",\"optimize\":false,\"engines\":{\"browsers\":\"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15\"},\"source\":\"lib/global.ts\"},\"browser-minified-cbor\":{\"context\":\"browser\",\"outputFormat\":\"esmodule\",\"isLibrary\":true,\"optimize\":true,\"engines\":{\"browsers\":\"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15\"},\"source\":\"lib/dataconnection/StreamConnection/Cbor.ts\"},\"browser-minified-msgpack\":{\"context\":\"browser\",\"outputFormat\":\"esmodule\",\"isLibrary\":true,\"optimize\":true,\"engines\":{\"browsers\":\"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15\"},\"source\":\"lib/dataconnection/StreamConnection/MsgPack.ts\"}},\"scripts\":{\"contributors\":\"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\\\\"chore(contributors): update and sort contributors list\\\\\"\",\"check\":\"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit\",\"watch\":\"parcel watch\",\"build\":\"rm -rf dist && parcel build\",\"prepublishOnly\":\"npm run build\",\"test\":\"jest\",\"test:watch\":\"jest --watch\",\"coverage\":\"jest --coverage --collectCoverageFrom=\\\\\"./lib/**\\\\\"\",\"format\":\"prettier --write .\",\"format:check\":\"prettier --check .\",\"semantic-release\":\"semantic-release\",\"e2e\":\"wdio run e2e/wdio.local.conf.ts\",\"e2e:bstack\":\"wdio run e2e/wdio.bstack.conf.ts\"},\"devDependencies\":{\"@parcel/config-default\":\"^2.9.3\",\"@parcel/packager-ts\":\"^2.9.3\",\"@parcel/transformer-typescript-tsc\":\"^2.9.3\",\"@parcel/transformer-typescript-types\":\"^2.9.3\",\"@semantic-release/changelog\":\"^6.0.1\",\"@semantic-release/git\":\"^10.0.1\",\"@swc/core\":\"^1.3.27\",\"@swc/jest\":\"^0.2.24\",\"@types/jasmine\":\"^4.3.4\",\"@wdio/browserstack-service\":\"^8.11.2\",\"@wdio/cli\":\"^8.11.2\",\"@wdio/globals\":\"^8.11.2\",\"@wdio/jasmine-framework\":\"^8.11.2\",\"@wdio/local-runner\":\"^8.11.2\",\"@wdio/spec-reporter\":\"^8.11.2\",\"@wdio/types\":\"^8.10.4\",\"http-server\":\"^14.1.1\",\"jest\":\"^29.3.1\",\"jest-environment-jsdom\":\"^29.3.1\",\"mock-socket\":\"^9.0.0\",\"parcel\":\"^2.9.3\",\"prettier\":\"^3.0.0\",\"semantic-release\":\"^21.0.0\",\"ts-node\":\"^10.9.1\",\"typescript\":\"^5.0.0\",\"wdio-geckodriver-service\":\"^5.0.1\"},\"dependencies\":{\"@msgpack/msgpack\":\"^2.8.0\",\"cbor-x\":\"1.5.4\",\"eventemitter3\":\"^4.0.7\",\"peerjs-js-binarypack\":\"^2.1.0\",\"webrtc-adapter\":\"^8.0.0\"},\"alias\":{\"process\":false,\"buffer\":false}}');\n\n\nclass $9dca0f9415f15a97$export$4798917dbf149b79 extends (0, $6af28e6583ade012$exports.EventEmitter) {\n start(id, token) {\n this._id = id;\n const wsUrl = `${this._baseUrl}&id=${id}&token=${token}`;\n if (!!this._socket || !this._disconnected) return;\n this._socket = new WebSocket(wsUrl + \"&version=\" + (0, $ccd644f7486bf635$exports.version));\n this._disconnected = false;\n this._socket.onmessage = (event)=>{\n let data;\n try {\n data = JSON.parse(event.data);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Server message received:\", data);\n } catch (e) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Invalid server message\", event.data);\n return;\n }\n this.emit((0, $200acda04d260725$export$3b5c4a4b6354f023).Message, data);\n };\n this._socket.onclose = (event)=>{\n if (this._disconnected) return;\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Socket closed.\", event);\n this._cleanup();\n this._disconnected = true;\n this.emit((0, $200acda04d260725$export$3b5c4a4b6354f023).Disconnected);\n };\n // Take care of the queue of connections if necessary and make sure Peer knows\n // socket is open.\n this._socket.onopen = ()=>{\n if (this._disconnected) return;\n this._sendQueuedMessages();\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Socket open\");\n this._scheduleHeartbeat();\n };\n }\n _scheduleHeartbeat() {\n this._wsPingTimer = setTimeout(()=>{\n this._sendHeartbeat();\n }, this.pingInterval);\n }\n _sendHeartbeat() {\n if (!this._wsOpen()) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Cannot send heartbeat, because socket closed`);\n return;\n }\n const message = JSON.stringify({\n type: (0, $200acda04d260725$export$adb4a1754da6f10d).Heartbeat\n });\n this._socket.send(message);\n this._scheduleHeartbeat();\n }\n /** Is the websocket currently open? */ _wsOpen() {\n return !!this._socket && this._socket.readyState === 1;\n }\n /** Send queued messages. */ _sendQueuedMessages() {\n //Create copy of queue and clear it,\n //because send method push the message back to queue if smth will go wrong\n const copiedQueue = [\n ...this._messagesQueue\n ];\n this._messagesQueue = [];\n for (const message of copiedQueue)this.send(message);\n }\n /** Exposed send for DC & Peer. */ send(data) {\n if (this._disconnected) return;\n // If we didn't get an ID yet, we can't yet send anything so we should queue\n // up these messages.\n if (!this._id) {\n this._messagesQueue.push(data);\n return;\n }\n if (!data.type) {\n this.emit((0, $200acda04d260725$export$3b5c4a4b6354f023).Error, \"Invalid message\");\n return;\n }\n if (!this._wsOpen()) return;\n const message = JSON.stringify(data);\n this._socket.send(message);\n }\n close() {\n if (this._disconnected) return;\n this._cleanup();\n this._disconnected = true;\n }\n _cleanup() {\n if (this._socket) {\n this._socket.onopen = this._socket.onmessage = this._socket.onclose = null;\n this._socket.close();\n this._socket = undefined;\n }\n clearTimeout(this._wsPingTimer);\n }\n constructor(secure, host, port, path, key, pingInterval = 5000){\n super();\n this.pingInterval = pingInterval;\n this._disconnected = true;\n this._messagesQueue = [];\n const wsProtocol = secure ? \"wss://\" : \"ws://\";\n this._baseUrl = wsProtocol + host + \":\" + port + path + \"peerjs?key=\" + key;\n }\n}\n\n\n\n\n\n\nclass $09f4090c200a4747$export$89e6bb5ad64bf4a {\n /** Returns a PeerConnection object set up correctly (for data, media). */ startConnection(options) {\n const peerConnection = this._startPeerConnection();\n // Set the connection's PC.\n this.connection.peerConnection = peerConnection;\n if (this.connection.type === (0, $200acda04d260725$export$3157d57b4135e3bc).Media && options._stream) this._addTracksToConnection(options._stream, peerConnection);\n // What do we need to do now?\n if (options.originator) {\n const dataConnection = this.connection;\n const config = {\n ordered: !!options.reliable\n };\n const dataChannel = peerConnection.createDataChannel(dataConnection.label, config);\n dataConnection._initializeDataChannel(dataChannel);\n this._makeOffer();\n } else this.handleSDP(\"OFFER\", options.sdp);\n }\n /** Start a PC. */ _startPeerConnection() {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Creating RTCPeerConnection.\");\n const peerConnection = new RTCPeerConnection(this.connection.provider.options.config);\n this._setupListeners(peerConnection);\n return peerConnection;\n }\n /** Set up various WebRTC listeners. */ _setupListeners(peerConnection) {\n const peerId = this.connection.peer;\n const connectionId = this.connection.connectionId;\n const connectionType = this.connection.type;\n const provider = this.connection.provider;\n // ICE CANDIDATES.\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Listening for ICE candidates.\");\n peerConnection.onicecandidate = (evt)=>{\n if (!evt.candidate || !evt.candidate.candidate) return;\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Received ICE candidates for ${peerId}:`, evt.candidate);\n provider.socket.send({\n type: (0, $200acda04d260725$export$adb4a1754da6f10d).Candidate,\n payload: {\n candidate: evt.candidate,\n type: connectionType,\n connectionId: connectionId\n },\n dst: peerId\n });\n };\n peerConnection.oniceconnectionstatechange = ()=>{\n switch(peerConnection.iceConnectionState){\n case \"failed\":\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"iceConnectionState is failed, closing connections to \" + peerId);\n this.connection.emitError((0, $200acda04d260725$export$7974935686149686).NegotiationFailed, \"Negotiation of connection to \" + peerId + \" failed.\");\n this.connection.close();\n break;\n case \"closed\":\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"iceConnectionState is closed, closing connections to \" + peerId);\n this.connection.emitError((0, $200acda04d260725$export$7974935686149686).ConnectionClosed, \"Connection to \" + peerId + \" closed.\");\n this.connection.close();\n break;\n case \"disconnected\":\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"iceConnectionState changed to disconnected on the connection with \" + peerId);\n break;\n case \"completed\":\n peerConnection.onicecandidate = ()=>{};\n break;\n }\n this.connection.emit(\"iceStateChanged\", peerConnection.iceConnectionState);\n };\n // DATACONNECTION.\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Listening for data channel\");\n // Fired between offer and answer, so options should already be saved\n // in the options hash.\n peerConnection.ondatachannel = (evt)=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Received data channel\");\n const dataChannel = evt.channel;\n const connection = provider.getConnection(peerId, connectionId);\n connection._initializeDataChannel(dataChannel);\n };\n // MEDIACONNECTION.\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Listening for remote stream\");\n peerConnection.ontrack = (evt)=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Received remote stream\");\n const stream = evt.streams[0];\n const connection = provider.getConnection(peerId, connectionId);\n if (connection.type === (0, $200acda04d260725$export$3157d57b4135e3bc).Media) {\n const mediaConnection = connection;\n this._addStreamToMediaConnection(stream, mediaConnection);\n }\n };\n }\n cleanup() {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Cleaning up PeerConnection to \" + this.connection.peer);\n const peerConnection = this.connection.peerConnection;\n if (!peerConnection) return;\n this.connection.peerConnection = null;\n //unsubscribe from all PeerConnection's events\n peerConnection.onicecandidate = peerConnection.oniceconnectionstatechange = peerConnection.ondatachannel = peerConnection.ontrack = ()=>{};\n const peerConnectionNotClosed = peerConnection.signalingState !== \"closed\";\n let dataChannelNotClosed = false;\n const dataChannel = this.connection.dataChannel;\n if (dataChannel) dataChannelNotClosed = !!dataChannel.readyState && dataChannel.readyState !== \"closed\";\n if (peerConnectionNotClosed || dataChannelNotClosed) peerConnection.close();\n }\n async _makeOffer() {\n const peerConnection = this.connection.peerConnection;\n const provider = this.connection.provider;\n try {\n const offer = await peerConnection.createOffer(this.connection.options.constraints);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Created offer.\");\n if (this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform === \"function\") offer.sdp = this.connection.options.sdpTransform(offer.sdp) || offer.sdp;\n try {\n await peerConnection.setLocalDescription(offer);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Set localDescription:\", offer, `for:${this.connection.peer}`);\n let payload = {\n sdp: offer,\n type: this.connection.type,\n connectionId: this.connection.connectionId,\n metadata: this.connection.metadata\n };\n if (this.connection.type === (0, $200acda04d260725$export$3157d57b4135e3bc).Data) {\n const dataConnection = this.connection;\n payload = {\n ...payload,\n label: dataConnection.label,\n reliable: dataConnection.reliable,\n serialization: dataConnection.serialization\n };\n }\n provider.socket.send({\n type: (0, $200acda04d260725$export$adb4a1754da6f10d).Offer,\n payload: payload,\n dst: this.connection.peer\n });\n } catch (err) {\n // TODO: investigate why _makeOffer is being called from the answer\n if (err != \"OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer\") {\n provider.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).WebRTC, err);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Failed to setLocalDescription, \", err);\n }\n }\n } catch (err_1) {\n provider.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).WebRTC, err_1);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Failed to createOffer, \", err_1);\n }\n }\n async _makeAnswer() {\n const peerConnection = this.connection.peerConnection;\n const provider = this.connection.provider;\n try {\n const answer = await peerConnection.createAnswer();\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Created answer.\");\n if (this.connection.options.sdpTransform && typeof this.connection.options.sdpTransform === \"function\") answer.sdp = this.connection.options.sdpTransform(answer.sdp) || answer.sdp;\n try {\n await peerConnection.setLocalDescription(answer);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Set localDescription:`, answer, `for:${this.connection.peer}`);\n provider.socket.send({\n type: (0, $200acda04d260725$export$adb4a1754da6f10d).Answer,\n payload: {\n sdp: answer,\n type: this.connection.type,\n connectionId: this.connection.connectionId\n },\n dst: this.connection.peer\n });\n } catch (err) {\n provider.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).WebRTC, err);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Failed to setLocalDescription, \", err);\n }\n } catch (err_1) {\n provider.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).WebRTC, err_1);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Failed to create answer, \", err_1);\n }\n }\n /** Handle an SDP. */ async handleSDP(type, sdp) {\n sdp = new RTCSessionDescription(sdp);\n const peerConnection = this.connection.peerConnection;\n const provider = this.connection.provider;\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Setting remote description\", sdp);\n const self = this;\n try {\n await peerConnection.setRemoteDescription(sdp);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Set remoteDescription:${type} for:${this.connection.peer}`);\n if (type === \"OFFER\") await self._makeAnswer();\n } catch (err) {\n provider.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).WebRTC, err);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Failed to setRemoteDescription, \", err);\n }\n }\n /** Handle a candidate. */ async handleCandidate(ice) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`handleCandidate:`, ice);\n try {\n await this.connection.peerConnection.addIceCandidate(ice);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Added ICE candidate for:${this.connection.peer}`);\n } catch (err) {\n this.connection.provider.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).WebRTC, err);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Failed to handleCandidate, \", err);\n }\n }\n _addTracksToConnection(stream, peerConnection) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`add tracks from stream ${stream.id} to peer connection`);\n if (!peerConnection.addTrack) return (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(`Your browser does't support RTCPeerConnection#addTrack. Ignored.`);\n stream.getTracks().forEach((track)=>{\n peerConnection.addTrack(track, stream);\n });\n }\n _addStreamToMediaConnection(stream, mediaConnection) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`add stream ${stream.id} to media connection ${mediaConnection.connectionId}`);\n mediaConnection.addStream(stream);\n }\n constructor(connection){\n this.connection = connection;\n }\n}\n\n\n\n\n\nclass $a084ca3b0aa8dd08$export$6a678e589c8a4542 extends (0, $6af28e6583ade012$exports.EventEmitter) {\n /**\n\t * Emits a typed error message.\n\t *\n\t * @internal\n\t */ emitError(type, err) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(\"Error:\", err);\n // @ts-ignore\n this.emit(\"error\", new $a084ca3b0aa8dd08$export$98871882f492de82(`${type}`, err));\n }\n}\nclass $a084ca3b0aa8dd08$export$98871882f492de82 extends Error {\n /**\n\t * @internal\n\t */ constructor(type, err){\n if (typeof err === \"string\") super(err);\n else {\n super();\n Object.assign(this, err);\n }\n this.type = type;\n }\n}\n\n\nclass $e7e1c6f19b5349be$export$23a2a68283c24d80 extends (0, $a084ca3b0aa8dd08$export$6a678e589c8a4542) {\n /**\n\t * Whether the media connection is active (e.g. your call has been answered).\n\t * You can check this if you want to set a maximum wait time for a one-sided call.\n\t */ get open() {\n return this._open;\n }\n constructor(/**\n\t\t * The ID of the peer on the other end of this connection.\n\t\t */ peer, provider, options){\n super();\n this.peer = peer;\n this.provider = provider;\n this.options = options;\n this._open = false;\n this.metadata = options.metadata;\n }\n}\n\n\nclass $b568d66a5799a705$export$4a84e95a2324ac29 extends (0, $e7e1c6f19b5349be$export$23a2a68283c24d80) {\n /**\n\t * For media connections, this is always 'media'.\n\t */ get type() {\n return (0, $200acda04d260725$export$3157d57b4135e3bc).Media;\n }\n get localStream() {\n return this._localStream;\n }\n get remoteStream() {\n return this._remoteStream;\n }\n /** Called by the Negotiator when the DataChannel is ready. */ _initializeDataChannel(dc) {\n this.dataChannel = dc;\n this.dataChannel.onopen = ()=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`DC#${this.connectionId} dc connection success`);\n this.emit(\"willCloseOnRemote\");\n };\n this.dataChannel.onclose = ()=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`DC#${this.connectionId} dc closed for:`, this.peer);\n this.close();\n };\n }\n addStream(remoteStream) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(\"Receiving stream\", remoteStream);\n this._remoteStream = remoteStream;\n super.emit(\"stream\", remoteStream); // Should we call this `open`?\n }\n /**\n\t * @internal\n\t */ handleMessage(message) {\n const type = message.type;\n const payload = message.payload;\n switch(message.type){\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Answer:\n // Forward to negotiator\n this._negotiator.handleSDP(type, payload.sdp);\n this._open = true;\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Candidate:\n this._negotiator.handleCandidate(payload.candidate);\n break;\n default:\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(`Unrecognized message type:${type} from peer:${this.peer}`);\n break;\n }\n }\n /**\n * When receiving a {@apilink PeerEvents | `call`} event on a peer, you can call\n * `answer` on the media connection provided by the callback to accept the call\n * and optionally send your own media stream.\n\n *\n * @param stream A WebRTC media stream.\n * @param options\n * @returns\n */ answer(stream, options = {}) {\n if (this._localStream) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(\"Local stream already exists on this MediaConnection. Are you answering a call twice?\");\n return;\n }\n this._localStream = stream;\n if (options && options.sdpTransform) this.options.sdpTransform = options.sdpTransform;\n this._negotiator.startConnection({\n ...this.options._payload,\n _stream: stream\n });\n // Retrieve lost messages stored because PeerConnection not set up.\n const messages = this.provider._getMessages(this.connectionId);\n for (const message of messages)this.handleMessage(message);\n this._open = true;\n }\n /**\n\t * Exposed functionality for users.\n\t */ /**\n\t * Closes the media connection.\n\t */ close() {\n if (this._negotiator) {\n this._negotiator.cleanup();\n this._negotiator = null;\n }\n this._localStream = null;\n this._remoteStream = null;\n if (this.provider) {\n this.provider._removeConnection(this);\n this.provider = null;\n }\n if (this.options && this.options._stream) this.options._stream = null;\n if (!this.open) return;\n this._open = false;\n super.emit(\"close\");\n }\n constructor(peerId, provider, options){\n super(peerId, provider, options);\n this._localStream = this.options._stream;\n this.connectionId = this.options.connectionId || $b568d66a5799a705$export$4a84e95a2324ac29.ID_PREFIX + (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).randomToken();\n this._negotiator = new (0, $09f4090c200a4747$export$89e6bb5ad64bf4a)(this);\n if (this._localStream) this._negotiator.startConnection({\n _stream: this._localStream,\n originator: true\n });\n }\n}\n$b568d66a5799a705$export$4a84e95a2324ac29.ID_PREFIX = \"mc_\";\n\n\n\n\n\n\nclass $916c68e858bb49ef$export$2c4e825dc9120f87 {\n _buildRequest(method) {\n const protocol = this._options.secure ? \"https\" : \"http\";\n const { host: host, port: port, path: path, key: key } = this._options;\n const url = new URL(`${protocol}://${host}:${port}${path}${key}/${method}`);\n // TODO: Why timestamp, why random?\n url.searchParams.set(\"ts\", `${Date.now()}${Math.random()}`);\n url.searchParams.set(\"version\", (0, $ccd644f7486bf635$exports.version));\n return fetch(url.href, {\n referrerPolicy: this._options.referrerPolicy\n });\n }\n /** Get a unique ID from the server via XHR and initialize with it. */ async retrieveId() {\n try {\n const response = await this._buildRequest(\"id\");\n if (response.status !== 200) throw new Error(`Error. Status:${response.status}`);\n return response.text();\n } catch (error) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(\"Error retrieving ID\", error);\n let pathError = \"\";\n if (this._options.path === \"/\" && this._options.host !== (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).CLOUD_HOST) pathError = \" If you passed in a `path` to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer.\";\n throw new Error(\"Could not get an ID from the server.\" + pathError);\n }\n }\n /** @deprecated */ async listAllPeers() {\n try {\n const response = await this._buildRequest(\"peers\");\n if (response.status !== 200) {\n if (response.status === 401) {\n let helpfulError = \"\";\n if (this._options.host === (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).CLOUD_HOST) helpfulError = \"It looks like you're using the cloud server. You can email team@peerjs.com to enable peer listing for your API key.\";\n else helpfulError = \"You need to enable `allow_discovery` on your self-hosted PeerServer to use this feature.\";\n throw new Error(\"It doesn't look like you have permission to list peers IDs. \" + helpfulError);\n }\n throw new Error(`Error. Status:${response.status}`);\n }\n return response.json();\n } catch (error) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(\"Error retrieving list peers\", error);\n throw new Error(\"Could not get list peers from the server.\" + error);\n }\n }\n constructor(_options){\n this._options = _options;\n }\n}\n\n\n\n\n\n\n\n\n\n\nclass $4f9d208d5e349370$export$d365f7ad9d7df9c9 extends (0, $e7e1c6f19b5349be$export$23a2a68283c24d80) {\n get type() {\n return (0, $200acda04d260725$export$3157d57b4135e3bc).Data;\n }\n /** Called by the Negotiator when the DataChannel is ready. */ _initializeDataChannel(dc) {\n this.dataChannel = dc;\n this.dataChannel.onopen = ()=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`DC#${this.connectionId} dc connection success`);\n this._open = true;\n this.emit(\"open\");\n };\n this.dataChannel.onmessage = (e)=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`DC#${this.connectionId} dc onmessage:`, e.data);\n // this._handleDataMessage(e);\n };\n this.dataChannel.onclose = ()=>{\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`DC#${this.connectionId} dc closed for:`, this.peer);\n this.close();\n };\n }\n /**\n\t * Exposed functionality for users.\n\t */ /** Allows user to close connection. */ close(options) {\n if (options?.flush) {\n this.send({\n __peerData: {\n type: \"close\"\n }\n });\n return;\n }\n if (this._negotiator) {\n this._negotiator.cleanup();\n this._negotiator = null;\n }\n if (this.provider) {\n this.provider._removeConnection(this);\n this.provider = null;\n }\n if (this.dataChannel) {\n this.dataChannel.onopen = null;\n this.dataChannel.onmessage = null;\n this.dataChannel.onclose = null;\n this.dataChannel = null;\n }\n if (!this.open) return;\n this._open = false;\n super.emit(\"close\");\n }\n /** Allows user to send data. */ send(data, chunked = false) {\n if (!this.open) {\n this.emitError((0, $200acda04d260725$export$49ae800c114df41d).NotOpenYet, \"Connection is not open. You should listen for the `open` event before sending messages.\");\n return;\n }\n return this._send(data, chunked);\n }\n async handleMessage(message) {\n const payload = message.payload;\n switch(message.type){\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Answer:\n await this._negotiator.handleSDP(message.type, payload.sdp);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Candidate:\n await this._negotiator.handleCandidate(payload.candidate);\n break;\n default:\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(\"Unrecognized message type:\", message.type, \"from peer:\", this.peer);\n break;\n }\n }\n constructor(peerId, provider, options){\n super(peerId, provider, options);\n this.connectionId = this.options.connectionId || $4f9d208d5e349370$export$d365f7ad9d7df9c9.ID_PREFIX + (0, $eb24a05d5e66c1f6$export$4e61f672936bec77)();\n this.label = this.options.label || this.connectionId;\n this.reliable = !!this.options.reliable;\n this._negotiator = new (0, $09f4090c200a4747$export$89e6bb5ad64bf4a)(this);\n this._negotiator.startConnection(this.options._payload || {\n originator: true,\n reliable: this.reliable\n });\n }\n}\n$4f9d208d5e349370$export$d365f7ad9d7df9c9.ID_PREFIX = \"dc_\";\n$4f9d208d5e349370$export$d365f7ad9d7df9c9.MAX_BUFFERED_AMOUNT = 8388608;\n\n\nclass $5a8a3892973da73a$export$ff7c9d4c11d94e8b extends (0, $4f9d208d5e349370$export$d365f7ad9d7df9c9) {\n get bufferSize() {\n return this._bufferSize;\n }\n _initializeDataChannel(dc) {\n super._initializeDataChannel(dc);\n this.dataChannel.binaryType = \"arraybuffer\";\n this.dataChannel.addEventListener(\"message\", (e)=>this._handleDataMessage(e));\n }\n _bufferedSend(msg) {\n if (this._buffering || !this._trySend(msg)) {\n this._buffer.push(msg);\n this._bufferSize = this._buffer.length;\n }\n }\n // Returns true if the send succeeds.\n _trySend(msg) {\n if (!this.open) return false;\n if (this.dataChannel.bufferedAmount > (0, $4f9d208d5e349370$export$d365f7ad9d7df9c9).MAX_BUFFERED_AMOUNT) {\n this._buffering = true;\n setTimeout(()=>{\n this._buffering = false;\n this._tryBuffer();\n }, 50);\n return false;\n }\n try {\n this.dataChannel.send(msg);\n } catch (e) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(`DC#:${this.connectionId} Error when sending:`, e);\n this._buffering = true;\n this.close();\n return false;\n }\n return true;\n }\n // Try to send the first message in the buffer.\n _tryBuffer() {\n if (!this.open) return;\n if (this._buffer.length === 0) return;\n const msg = this._buffer[0];\n if (this._trySend(msg)) {\n this._buffer.shift();\n this._bufferSize = this._buffer.length;\n this._tryBuffer();\n }\n }\n close(options) {\n if (options?.flush) {\n this.send({\n __peerData: {\n type: \"close\"\n }\n });\n return;\n }\n this._buffer = [];\n this._bufferSize = 0;\n super.close();\n }\n constructor(...args){\n super(...args);\n this._buffer = [];\n this._bufferSize = 0;\n this._buffering = false;\n }\n}\n\n\n\n\nclass $e27c324aebf32a14$export$f0a5a64d5bb37108 extends (0, $5a8a3892973da73a$export$ff7c9d4c11d94e8b) {\n close(options) {\n super.close(options);\n this._chunkedData = {};\n }\n // Handles a DataChannel message.\n _handleDataMessage({ data: data }) {\n const deserializedData = (0, $41cdfe0a3ede2608$export$417857010dc9287f)(data);\n // PeerJS specific message\n const peerData = deserializedData[\"__peerData\"];\n if (peerData) {\n if (peerData.type === \"close\") {\n this.close();\n return;\n }\n // Chunked data -- piece things back together.\n // @ts-ignore\n this._handleChunk(deserializedData);\n return;\n }\n this.emit(\"data\", deserializedData);\n }\n _handleChunk(data) {\n const id = data.__peerData;\n const chunkInfo = this._chunkedData[id] || {\n data: [],\n count: 0,\n total: data.total\n };\n chunkInfo.data[data.n] = new Uint8Array(data.data);\n chunkInfo.count++;\n this._chunkedData[id] = chunkInfo;\n if (chunkInfo.total === chunkInfo.count) {\n // Clean up before making the recursive call to `_handleDataMessage`.\n delete this._chunkedData[id];\n // We've received all the chunks--time to construct the complete data.\n // const data = new Blob(chunkInfo.data);\n const data = (0, $337647a69164cf0a$export$52c89ebcdc4f53f2)(chunkInfo.data);\n this._handleDataMessage({\n data: data\n });\n }\n }\n _send(data, chunked) {\n const blob = (0, $41cdfe0a3ede2608$export$2a703dbb0cb35339)(data);\n if (blob instanceof Promise) return this._send_blob(blob);\n if (!chunked && blob.byteLength > this.chunker.chunkedMTU) {\n this._sendChunks(blob);\n return;\n }\n this._bufferedSend(blob);\n }\n async _send_blob(blobPromise) {\n const blob = await blobPromise;\n if (blob.byteLength > this.chunker.chunkedMTU) {\n this._sendChunks(blob);\n return;\n }\n this._bufferedSend(blob);\n }\n _sendChunks(blob) {\n const blobs = this.chunker.chunk(blob);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`DC#${this.connectionId} Try to send ${blobs.length} chunks...`);\n for (const blob of blobs)this.send(blob, true);\n }\n constructor(peerId, provider, options){\n super(peerId, provider, options);\n this.chunker = new (0, $337647a69164cf0a$export$f1c5f4c9cb95390b)();\n this.serialization = (0, $200acda04d260725$export$89f507cf986a947).Binary;\n this._chunkedData = {};\n }\n}\n\n\n\n\nclass $f1ddf74f51c0f6f4$export$6f88fe47d32c9c94 extends (0, $5a8a3892973da73a$export$ff7c9d4c11d94e8b) {\n _handleDataMessage({ data: data }) {\n super.emit(\"data\", data);\n }\n _send(data, _chunked) {\n this._bufferedSend(data);\n }\n constructor(...args){\n super(...args);\n this.serialization = (0, $200acda04d260725$export$89f507cf986a947).None;\n }\n}\n\n\n\n\n\nclass $c051ae28a1212d1c$export$48880ac635f47186 extends (0, $5a8a3892973da73a$export$ff7c9d4c11d94e8b) {\n // Handles a DataChannel message.\n _handleDataMessage({ data: data }) {\n const deserializedData = this.parse(this.decoder.decode(data));\n // PeerJS specific message\n const peerData = deserializedData[\"__peerData\"];\n if (peerData && peerData.type === \"close\") {\n this.close();\n return;\n }\n this.emit(\"data\", deserializedData);\n }\n _send(data, _chunked) {\n const encodedData = this.encoder.encode(this.stringify(data));\n if (encodedData.byteLength >= (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).chunkedMTU) {\n this.emitError((0, $200acda04d260725$export$49ae800c114df41d).MessageToBig, \"Message too big for JSON channel\");\n return;\n }\n this._bufferedSend(encodedData);\n }\n constructor(...args){\n super(...args);\n this.serialization = (0, $200acda04d260725$export$89f507cf986a947).JSON;\n this.encoder = new TextEncoder();\n this.decoder = new TextDecoder();\n this.stringify = JSON.stringify;\n this.parse = JSON.parse;\n }\n}\n\n\n\nclass $400fc96dabc502a5$var$PeerOptions {\n}\nclass $400fc96dabc502a5$export$ecd1fc136c422448 extends (0, $a084ca3b0aa8dd08$export$6a678e589c8a4542) {\n /**\n\t * The brokering ID of this peer\n\t *\n\t * If no ID was specified in {@apilink Peer | the constructor},\n\t * this will be `undefined` until the {@apilink PeerEvents | `open`} event is emitted.\n\t */ get id() {\n return this._id;\n }\n get options() {\n return this._options;\n }\n get open() {\n return this._open;\n }\n /**\n\t * @internal\n\t */ get socket() {\n return this._socket;\n }\n /**\n\t * A hash of all connections associated with this peer, keyed by the remote peer's ID.\n\t * @deprecated\n\t * Return type will change from Object to Map\n\t */ get connections() {\n const plainConnections = Object.create(null);\n for (const [k, v] of this._connections)plainConnections[k] = v;\n return plainConnections;\n }\n /**\n\t * true if this peer and all of its connections can no longer be used.\n\t */ get destroyed() {\n return this._destroyed;\n }\n /**\n\t * false if there is an active connection to the PeerServer.\n\t */ get disconnected() {\n return this._disconnected;\n }\n _createServerConnection() {\n const socket = new (0, $9dca0f9415f15a97$export$4798917dbf149b79)(this._options.secure, this._options.host, this._options.port, this._options.path, this._options.key, this._options.pingInterval);\n socket.on((0, $200acda04d260725$export$3b5c4a4b6354f023).Message, (data)=>{\n this._handleMessage(data);\n });\n socket.on((0, $200acda04d260725$export$3b5c4a4b6354f023).Error, (error)=>{\n this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).SocketError, error);\n });\n socket.on((0, $200acda04d260725$export$3b5c4a4b6354f023).Disconnected, ()=>{\n if (this.disconnected) return;\n this.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).Network, \"Lost connection to server.\");\n this.disconnect();\n });\n socket.on((0, $200acda04d260725$export$3b5c4a4b6354f023).Close, ()=>{\n if (this.disconnected) return;\n this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).SocketClosed, \"Underlying socket is already closed.\");\n });\n return socket;\n }\n /** Initialize a connection with the server. */ _initialize(id) {\n this._id = id;\n this.socket.start(id, this._options.token);\n }\n /** Handles messages from the server. */ _handleMessage(message) {\n const type = message.type;\n const payload = message.payload;\n const peerId = message.src;\n switch(type){\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Open:\n this._lastServerId = this.id;\n this._open = true;\n this.emit(\"open\", this.id);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Error:\n this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).ServerError, payload.msg);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).IdTaken:\n this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).UnavailableID, `ID \"${this.id}\" is taken`);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).InvalidKey:\n this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).InvalidKey, `API KEY \"${this._options.key}\" is invalid`);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Leave:\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Received leave message from ${peerId}`);\n this._cleanupPeer(peerId);\n this._connections.delete(peerId);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Expire:\n this.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).PeerUnavailable, `Could not connect to peer ${peerId}`);\n break;\n case (0, $200acda04d260725$export$adb4a1754da6f10d).Offer:\n {\n // we should consider switching this to CALL/CONNECT, but this is the least breaking option.\n const connectionId = payload.connectionId;\n let connection = this.getConnection(peerId, connectionId);\n if (connection) {\n connection.close();\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(`Offer received for existing Connection ID:${connectionId}`);\n }\n // Create a new connection.\n if (payload.type === (0, $200acda04d260725$export$3157d57b4135e3bc).Media) {\n const mediaConnection = new (0, $b568d66a5799a705$export$4a84e95a2324ac29)(peerId, this, {\n connectionId: connectionId,\n _payload: payload,\n metadata: payload.metadata\n });\n connection = mediaConnection;\n this._addConnection(peerId, connection);\n this.emit(\"call\", mediaConnection);\n } else if (payload.type === (0, $200acda04d260725$export$3157d57b4135e3bc).Data) {\n const dataConnection = new this._serializers[payload.serialization](peerId, this, {\n connectionId: connectionId,\n _payload: payload,\n metadata: payload.metadata,\n label: payload.label,\n serialization: payload.serialization,\n reliable: payload.reliable\n });\n connection = dataConnection;\n this._addConnection(peerId, connection);\n this.emit(\"connection\", dataConnection);\n } else {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(`Received malformed connection type:${payload.type}`);\n return;\n }\n // Find messages.\n const messages = this._getMessages(connectionId);\n for (const message of messages)connection.handleMessage(message);\n break;\n }\n default:\n {\n if (!payload) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(`You received a malformed message from ${peerId} of type ${type}`);\n return;\n }\n const connectionId = payload.connectionId;\n const connection = this.getConnection(peerId, connectionId);\n if (connection && connection.peerConnection) // Pass it on.\n connection.handleMessage(message);\n else if (connectionId) // Store for possible later use\n this._storeMessage(connectionId, message);\n else (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(\"You received an unrecognized message:\", message);\n break;\n }\n }\n }\n /** Stores messages without a set up connection, to be claimed later. */ _storeMessage(connectionId, message) {\n if (!this._lostMessages.has(connectionId)) this._lostMessages.set(connectionId, []);\n this._lostMessages.get(connectionId).push(message);\n }\n /**\n\t * Retrieve messages from lost message store\n\t * @internal\n\t */ //TODO Change it to private\n _getMessages(connectionId) {\n const messages = this._lostMessages.get(connectionId);\n if (messages) {\n this._lostMessages.delete(connectionId);\n return messages;\n }\n return [];\n }\n /**\n\t * Connects to the remote peer specified by id and returns a data connection.\n\t * @param peer The brokering ID of the remote peer (their {@apilink Peer.id}).\n\t * @param options for specifying details about Peer Connection\n\t */ connect(peer, options = {}) {\n options = {\n serialization: \"default\",\n ...options\n };\n if (this.disconnected) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(\"You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available.\");\n this.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).Disconnected, \"Cannot connect to new Peer after disconnecting from server.\");\n return;\n }\n const dataConnection = new this._serializers[options.serialization](peer, this, options);\n this._addConnection(peer, dataConnection);\n return dataConnection;\n }\n /**\n\t * Calls the remote peer specified by id and returns a media connection.\n\t * @param peer The brokering ID of the remote peer (their peer.id).\n\t * @param stream The caller's media stream\n\t * @param options Metadata associated with the connection, passed in by whoever initiated the connection.\n\t */ call(peer, stream, options = {}) {\n if (this.disconnected) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).warn(\"You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect.\");\n this.emitError((0, $200acda04d260725$export$9547aaa2e39030ff).Disconnected, \"Cannot connect to new Peer after disconnecting from server.\");\n return;\n }\n if (!stream) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(\"To call a peer, you must provide a stream from your browser's `getUserMedia`.\");\n return;\n }\n const mediaConnection = new (0, $b568d66a5799a705$export$4a84e95a2324ac29)(peer, this, {\n ...options,\n _stream: stream\n });\n this._addConnection(peer, mediaConnection);\n return mediaConnection;\n }\n /** Add a data/media connection to this peer. */ _addConnection(peerId, connection) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`add connection ${connection.type}:${connection.connectionId} to peerId:${peerId}`);\n if (!this._connections.has(peerId)) this._connections.set(peerId, []);\n this._connections.get(peerId).push(connection);\n }\n //TODO should be private\n _removeConnection(connection) {\n const connections = this._connections.get(connection.peer);\n if (connections) {\n const index = connections.indexOf(connection);\n if (index !== -1) connections.splice(index, 1);\n }\n //remove from lost messages\n this._lostMessages.delete(connection.connectionId);\n }\n /** Retrieve a data/media connection for this peer. */ getConnection(peerId, connectionId) {\n const connections = this._connections.get(peerId);\n if (!connections) return null;\n for (const connection of connections){\n if (connection.connectionId === connectionId) return connection;\n }\n return null;\n }\n _delayedAbort(type, message) {\n setTimeout(()=>{\n this._abort(type, message);\n }, 0);\n }\n /**\n\t * Emits an error message and destroys the Peer.\n\t * The Peer is not destroyed if it's in a disconnected state, in which case\n\t * it retains its disconnected state and its existing connections.\n\t */ _abort(type, message) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(\"Aborting!\");\n this.emitError(type, message);\n if (!this._lastServerId) this.destroy();\n else this.disconnect();\n }\n /**\n\t * Destroys the Peer: closes all active connections as well as the connection\n\t * to the server.\n\t *\n\t * :::caution\n\t * This cannot be undone; the respective peer object will no longer be able\n\t * to create or receive any connections, its ID will be forfeited on the server,\n\t * and all of its data and media connections will be closed.\n\t * :::\n\t */ destroy() {\n if (this.destroyed) return;\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Destroy peer with ID:${this.id}`);\n this.disconnect();\n this._cleanup();\n this._destroyed = true;\n this.emit(\"close\");\n }\n /** Disconnects every connection on this peer. */ _cleanup() {\n for (const peerId of this._connections.keys()){\n this._cleanupPeer(peerId);\n this._connections.delete(peerId);\n }\n this.socket.removeAllListeners();\n }\n /** Closes all connections to this peer. */ _cleanupPeer(peerId) {\n const connections = this._connections.get(peerId);\n if (!connections) return;\n for (const connection of connections)connection.close();\n }\n /**\n\t * Disconnects the Peer's connection to the PeerServer. Does not close any\n\t * active connections.\n\t * Warning: The peer can no longer create or accept connections after being\n\t * disconnected. It also cannot reconnect to the server.\n\t */ disconnect() {\n if (this.disconnected) return;\n const currentId = this.id;\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Disconnect peer with ID:${currentId}`);\n this._disconnected = true;\n this._open = false;\n this.socket.close();\n this._lastServerId = currentId;\n this._id = null;\n this.emit(\"disconnected\", currentId);\n }\n /** Attempts to reconnect with the same ID.\n\t *\n\t * Only {@apilink Peer.disconnect | disconnected peers} can be reconnected.\n\t * Destroyed peers cannot be reconnected.\n\t * If the connection fails (as an example, if the peer's old ID is now taken),\n\t * the peer's existing connections will not close, but any associated errors events will fire.\n\t */ reconnect() {\n if (this.disconnected && !this.destroyed) {\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).log(`Attempting reconnection to server with ID ${this._lastServerId}`);\n this._disconnected = false;\n this._initialize(this._lastServerId);\n } else if (this.destroyed) throw new Error(\"This peer cannot reconnect to the server. It has already been destroyed.\");\n else if (!this.disconnected && !this.open) // Do nothing. We're still connecting the first time.\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).error(\"In a hurry? We're still trying to make the initial connection!\");\n else throw new Error(`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`);\n }\n /**\n\t * Get a list of available peer IDs. If you're running your own server, you'll\n\t * want to set allow_discovery: true in the PeerServer options. If you're using\n\t * the cloud server, email team@peerjs.com to get the functionality enabled for\n\t * your key.\n\t */ listAllPeers(cb = (_)=>{}) {\n this._api.listAllPeers().then((peers)=>cb(peers)).catch((error)=>this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).ServerError, error));\n }\n constructor(id, options){\n super();\n this._serializers = {\n raw: (0, $f1ddf74f51c0f6f4$export$6f88fe47d32c9c94),\n json: (0, $c051ae28a1212d1c$export$48880ac635f47186),\n binary: (0, $e27c324aebf32a14$export$f0a5a64d5bb37108),\n \"binary-utf8\": (0, $e27c324aebf32a14$export$f0a5a64d5bb37108),\n default: (0, $e27c324aebf32a14$export$f0a5a64d5bb37108)\n };\n this._id = null;\n this._lastServerId = null;\n // States.\n this._destroyed = false // Connections have been killed\n ;\n this._disconnected = false // Connection to PeerServer killed but P2P connections still active\n ;\n this._open = false // Sockets and such are not yet open.\n ;\n this._connections = new Map() // All connections for this peer.\n ;\n this._lostMessages = new Map() // src => [list of messages]\n ;\n let userId;\n // Deal with overloading\n if (id && id.constructor == Object) options = id;\n else if (id) userId = id.toString();\n // Configurize options\n options = {\n debug: 0,\n host: (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).CLOUD_HOST,\n port: (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).CLOUD_PORT,\n path: \"/\",\n key: $400fc96dabc502a5$export$ecd1fc136c422448.DEFAULT_KEY,\n token: (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).randomToken(),\n config: (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).defaultConfig,\n referrerPolicy: \"strict-origin-when-cross-origin\",\n serializers: {},\n ...options\n };\n this._options = options;\n this._serializers = {\n ...this._serializers,\n ...this.options.serializers\n };\n // Detect relative URL host.\n if (this._options.host === \"/\") this._options.host = window.location.hostname;\n // Set path correctly.\n if (this._options.path) {\n if (this._options.path[0] !== \"/\") this._options.path = \"/\" + this._options.path;\n if (this._options.path[this._options.path.length - 1] !== \"/\") this._options.path += \"/\";\n }\n // Set whether we use SSL to same as current host\n if (this._options.secure === undefined && this._options.host !== (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).CLOUD_HOST) this._options.secure = (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).isSecure();\n else if (this._options.host == (0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).CLOUD_HOST) this._options.secure = true;\n // Set a custom log function if present\n if (this._options.logFunction) (0, $6adb9b697958aa01$export$2e2bcd8739ae039).setLogFunction(this._options.logFunction);\n (0, $6adb9b697958aa01$export$2e2bcd8739ae039).logLevel = this._options.debug || 0;\n this._api = new (0, $916c68e858bb49ef$export$2c4e825dc9120f87)(options);\n this._socket = this._createServerConnection();\n // Sanity checks\n // Ensure WebRTC supported\n if (!(0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).supports.audioVideo && !(0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).supports.data) {\n this._delayedAbort((0, $200acda04d260725$export$9547aaa2e39030ff).BrowserIncompatible, \"The current browser does not support WebRTC\");\n return;\n }\n // Ensure alphanumeric id\n if (!!userId && !(0, $0c88dccd73f5641e$export$7debb50ef11d5e0b).validateId(userId)) {\n this._delayedAbort((0, $200acda04d260725$export$9547aaa2e39030ff).InvalidID, `ID \"${userId}\" is invalid`);\n return;\n }\n if (userId) this._initialize(userId);\n else this._api.retrieveId().then((id)=>this._initialize(id)).catch((error)=>this._abort((0, $200acda04d260725$export$9547aaa2e39030ff).ServerError, error));\n }\n}\n$400fc96dabc502a5$export$ecd1fc136c422448.DEFAULT_KEY = \"peerjs\";\n\n\nwindow.peerjs = {\n Peer: $400fc96dabc502a5$export$ecd1fc136c422448,\n util: $0c88dccd73f5641e$export$7debb50ef11d5e0b\n};\n/** @deprecated Should use peerjs namespace */ window.Peer = (0, $400fc96dabc502a5$export$ecd1fc136c422448);\n\n})();\n//# sourceMappingURL=peerjs.min.js.map\n","import { util } from \"./util\";\nimport { Peer } from \"./peer\";\n\n(window).peerjs = {\n\tPeer,\n\tutil,\n};\n/** @deprecated Should use peerjs namespace */\n(window).Peer = Peer;\n","import { BinaryPackChunker } from \"./dataconnection/BufferedConnection/binaryPackChunker\";\nimport * as BinaryPack from \"peerjs-js-binarypack\";\nimport { Supports } from \"./supports\";\nimport { validateId } from \"./utils/validateId\";\nimport { randomToken } from \"./utils/randomToken\";\n\nexport interface UtilSupportsObj {\n\t/**\n\t * The current browser.\n\t * This property can be useful in determining whether two peers can connect.\n\t *\n\t * ```ts\n\t * if (util.browser === 'firefox') {\n\t * // OK to peer with Firefox peers.\n\t * }\n\t * ```\n\t *\n\t * `util.browser` can currently have the values\n\t * `'firefox', 'chrome', 'safari', 'edge', 'Not a supported browser.', 'Not a browser.' (unknown WebRTC-compatible agent).\n\t */\n\tbrowser: boolean;\n\twebRTC: boolean;\n\t/**\n\t * True if the current browser supports media streams and PeerConnection.\n\t */\n\taudioVideo: boolean;\n\t/**\n\t * True if the current browser supports DataChannel and PeerConnection.\n\t */\n\tdata: boolean;\n\tbinaryBlob: boolean;\n\t/**\n\t * True if the current browser supports reliable DataChannels.\n\t */\n\treliable: boolean;\n}\n\nconst DEFAULT_CONFIG = {\n\ticeServers: [\n\t\t{ urls: \"stun:stun.l.google.com:19302\" },\n\t\t{\n\t\t\turls: [\n\t\t\t\t\"turn:eu-0.turn.peerjs.com:3478\",\n\t\t\t\t\"turn:us-0.turn.peerjs.com:3478\",\n\t\t\t],\n\t\t\tusername: \"peerjs\",\n\t\t\tcredential: \"peerjsp\",\n\t\t},\n\t],\n\tsdpSemantics: \"unified-plan\",\n};\n\nexport class Util extends BinaryPackChunker {\n\tnoop(): void {}\n\n\treadonly CLOUD_HOST = \"0.peerjs.com\";\n\treadonly CLOUD_PORT = 443;\n\n\t// Browsers that need chunking:\n\treadonly chunkedBrowsers = { Chrome: 1, chrome: 1 };\n\n\t// Returns browser-agnostic default config\n\treadonly defaultConfig = DEFAULT_CONFIG;\n\n\treadonly browser = Supports.getBrowser();\n\treadonly browserVersion = Supports.getVersion();\n\n\tpack = BinaryPack.pack;\n\tunpack = BinaryPack.unpack;\n\n\t/**\n\t * A hash of WebRTC features mapped to booleans that correspond to whether the feature is supported by the current browser.\n\t *\n\t * :::caution\n\t * Only the properties documented here are guaranteed to be present on `util.supports`\n\t * :::\n\t */\n\treadonly supports = (function () {\n\t\tconst supported: UtilSupportsObj = {\n\t\t\tbrowser: Supports.isBrowserSupported(),\n\t\t\twebRTC: Supports.isWebRTCSupported(),\n\t\t\taudioVideo: false,\n\t\t\tdata: false,\n\t\t\tbinaryBlob: false,\n\t\t\treliable: false,\n\t\t};\n\n\t\tif (!supported.webRTC) return supported;\n\n\t\tlet pc: RTCPeerConnection;\n\n\t\ttry {\n\t\t\tpc = new RTCPeerConnection(DEFAULT_CONFIG);\n\n\t\t\tsupported.audioVideo = true;\n\n\t\t\tlet dc: RTCDataChannel;\n\n\t\t\ttry {\n\t\t\t\tdc = pc.createDataChannel(\"_PEERJSTEST\", { ordered: true });\n\t\t\t\tsupported.data = true;\n\t\t\t\tsupported.reliable = !!dc.ordered;\n\n\t\t\t\t// Binary test\n\t\t\t\ttry {\n\t\t\t\t\tdc.binaryType = \"blob\";\n\t\t\t\t\tsupported.binaryBlob = !Supports.isIOS;\n\t\t\t\t} catch (e) {}\n\t\t\t} catch (e) {\n\t\t\t} finally {\n\t\t\t\tif (dc) {\n\t\t\t\t\tdc.close();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t} finally {\n\t\t\tif (pc) {\n\t\t\t\tpc.close();\n\t\t\t}\n\t\t}\n\n\t\treturn supported;\n\t})();\n\n\t// Ensure alphanumeric ids\n\tvalidateId = validateId;\n\trandomToken = randomToken;\n\n\tblobToArrayBuffer(\n\t\tblob: Blob,\n\t\tcb: (arg: ArrayBuffer | null) => void,\n\t): FileReader {\n\t\tconst fr = new FileReader();\n\n\t\tfr.onload = function (evt) {\n\t\t\tif (evt.target) {\n\t\t\t\tcb(evt.target.result as ArrayBuffer);\n\t\t\t}\n\t\t};\n\n\t\tfr.readAsArrayBuffer(blob);\n\n\t\treturn fr;\n\t}\n\n\tbinaryStringToArrayBuffer(binary: string): ArrayBuffer | SharedArrayBuffer {\n\t\tconst byteArray = new Uint8Array(binary.length);\n\n\t\tfor (let i = 0; i < binary.length; i++) {\n\t\t\tbyteArray[i] = binary.charCodeAt(i) & 0xff;\n\t\t}\n\n\t\treturn byteArray.buffer;\n\t}\n\tisSecure(): boolean {\n\t\treturn location.protocol === \"https:\";\n\t}\n}\n\n/**\n * Provides a variety of helpful utilities.\n *\n * :::caution\n * Only the utilities documented here are guaranteed to be present on `util`.\n * Undocumented utilities can be removed without warning.\n * We don't consider these to be breaking changes.\n * :::\n */\nexport const util = new Util();\n","export class BinaryPackChunker {\n\treadonly chunkedMTU = 16300; // The original 60000 bytes setting does not work when sending data from Firefox to Chrome, which is \"cut off\" after 16384 bytes and delivered individually.\n\n\t// Binary stuff\n\n\tprivate _dataCount: number = 1;\n\n\tchunk = (\n\t\tblob: ArrayBuffer,\n\t): { __peerData: number; n: number; total: number; data: Uint8Array }[] => {\n\t\tconst chunks = [];\n\t\tconst size = blob.byteLength;\n\t\tconst total = Math.ceil(size / this.chunkedMTU);\n\n\t\tlet index = 0;\n\t\tlet start = 0;\n\n\t\twhile (start < size) {\n\t\t\tconst end = Math.min(size, start + this.chunkedMTU);\n\t\t\tconst b = blob.slice(start, end);\n\n\t\t\tconst chunk = {\n\t\t\t\t__peerData: this._dataCount,\n\t\t\t\tn: index,\n\t\t\t\tdata: b,\n\t\t\t\ttotal,\n\t\t\t};\n\n\t\t\tchunks.push(chunk);\n\n\t\t\tstart = end;\n\t\t\tindex++;\n\t\t}\n\n\t\tthis._dataCount++;\n\n\t\treturn chunks;\n\t};\n}\n\nexport function concatArrayBuffers(bufs: Uint8Array[]) {\n\tlet size = 0;\n\tfor (const buf of bufs) {\n\t\tsize += buf.byteLength;\n\t}\n\tconst result = new Uint8Array(size);\n\tlet offset = 0;\n\tfor (const buf of bufs) {\n\t\tresult.set(buf, offset);\n\t\toffset += buf.byteLength;\n\t}\n\treturn result;\n}\n","class $e8379818650e2442$export$93654d4f2d6cd524 {\n constructor(){\n this.encoder = new TextEncoder();\n this._pieces = [];\n this._parts = [];\n }\n append_buffer(data) {\n this.flush();\n this._parts.push(data);\n }\n append(data) {\n this._pieces.push(data);\n }\n flush() {\n if (this._pieces.length > 0) {\n const buf = new Uint8Array(this._pieces);\n this._parts.push(buf);\n this._pieces = [];\n }\n }\n toArrayBuffer() {\n const buffer = [];\n for (const part of this._parts)buffer.push(part);\n return $e8379818650e2442$var$concatArrayBuffers(buffer).buffer;\n }\n}\nfunction $e8379818650e2442$var$concatArrayBuffers(bufs) {\n let size = 0;\n for (const buf of bufs)size += buf.byteLength;\n const result = new Uint8Array(size);\n let offset = 0;\n for (const buf of bufs){\n const view = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n result.set(view, offset);\n offset += buf.byteLength;\n }\n return result;\n}\n\n\nfunction $0cfd7828ad59115f$export$417857010dc9287f(data) {\n const unpacker = new $0cfd7828ad59115f$var$Unpacker(data);\n return unpacker.unpack();\n}\nfunction $0cfd7828ad59115f$export$2a703dbb0cb35339(data) {\n const packer = new $0cfd7828ad59115f$export$b9ec4b114aa40074();\n const res = packer.pack(data);\n if (res instanceof Promise) return res.then(()=>packer.getBuffer());\n return packer.getBuffer();\n}\nclass $0cfd7828ad59115f$var$Unpacker {\n constructor(data){\n this.index = 0;\n this.dataBuffer = data;\n this.dataView = new Uint8Array(this.dataBuffer);\n this.length = this.dataBuffer.byteLength;\n }\n unpack() {\n const type = this.unpack_uint8();\n if (type < 0x80) return type;\n else if ((type ^ 0xe0) < 0x20) return (type ^ 0xe0) - 0x20;\n let size;\n if ((size = type ^ 0xa0) <= 0x0f) return this.unpack_raw(size);\n else if ((size = type ^ 0xb0) <= 0x0f) return this.unpack_string(size);\n else if ((size = type ^ 0x90) <= 0x0f) return this.unpack_array(size);\n else if ((size = type ^ 0x80) <= 0x0f) return this.unpack_map(size);\n switch(type){\n case 0xc0:\n return null;\n case 0xc1:\n return undefined;\n case 0xc2:\n return false;\n case 0xc3:\n return true;\n case 0xca:\n return this.unpack_float();\n case 0xcb:\n return this.unpack_double();\n case 0xcc:\n return this.unpack_uint8();\n case 0xcd:\n return this.unpack_uint16();\n case 0xce:\n return this.unpack_uint32();\n case 0xcf:\n return this.unpack_uint64();\n case 0xd0:\n return this.unpack_int8();\n case 0xd1:\n return this.unpack_int16();\n case 0xd2:\n return this.unpack_int32();\n case 0xd3:\n return this.unpack_int64();\n case 0xd4:\n return undefined;\n case 0xd5:\n return undefined;\n case 0xd6:\n return undefined;\n case 0xd7:\n return undefined;\n case 0xd8:\n size = this.unpack_uint16();\n return this.unpack_string(size);\n case 0xd9:\n size = this.unpack_uint32();\n return this.unpack_string(size);\n case 0xda:\n size = this.unpack_uint16();\n return this.unpack_raw(size);\n case 0xdb:\n size = this.unpack_uint32();\n return this.unpack_raw(size);\n case 0xdc:\n size = this.unpack_uint16();\n return this.unpack_array(size);\n case 0xdd:\n size = this.unpack_uint32();\n return this.unpack_array(size);\n case 0xde:\n size = this.unpack_uint16();\n return this.unpack_map(size);\n case 0xdf:\n size = this.unpack_uint32();\n return this.unpack_map(size);\n }\n }\n unpack_uint8() {\n const byte = this.dataView[this.index] & 0xff;\n this.index++;\n return byte;\n }\n unpack_uint16() {\n const bytes = this.read(2);\n const uint16 = (bytes[0] & 0xff) * 256 + (bytes[1] & 0xff);\n this.index += 2;\n return uint16;\n }\n unpack_uint32() {\n const bytes = this.read(4);\n const uint32 = ((bytes[0] * 256 + bytes[1]) * 256 + bytes[2]) * 256 + bytes[3];\n this.index += 4;\n return uint32;\n }\n unpack_uint64() {\n const bytes = this.read(8);\n const uint64 = ((((((bytes[0] * 256 + bytes[1]) * 256 + bytes[2]) * 256 + bytes[3]) * 256 + bytes[4]) * 256 + bytes[5]) * 256 + bytes[6]) * 256 + bytes[7];\n this.index += 8;\n return uint64;\n }\n unpack_int8() {\n const uint8 = this.unpack_uint8();\n return uint8 < 0x80 ? uint8 : uint8 - 256;\n }\n unpack_int16() {\n const uint16 = this.unpack_uint16();\n return uint16 < 0x8000 ? uint16 : uint16 - 65536;\n }\n unpack_int32() {\n const uint32 = this.unpack_uint32();\n return uint32 < 2 ** 31 ? uint32 : uint32 - 2 ** 32;\n }\n unpack_int64() {\n const uint64 = this.unpack_uint64();\n return uint64 < 2 ** 63 ? uint64 : uint64 - 2 ** 64;\n }\n unpack_raw(size) {\n if (this.length < this.index + size) throw new Error(`BinaryPackFailure: index is out of range ${this.index} ${size} ${this.length}`);\n const buf = this.dataBuffer.slice(this.index, this.index + size);\n this.index += size;\n return buf;\n }\n unpack_string(size) {\n const bytes = this.read(size);\n let i = 0;\n let str = \"\";\n let c;\n let code;\n while(i < size){\n c = bytes[i];\n // The length of a UTF-8 sequence is specified in the first byte:\n // 0xxxxxxx means length 1,\n // 110xxxxx means length 2,\n // 1110xxxx means length 3,\n // 11110xxx means length 4.\n // 10xxxxxx is for non-initial bytes.\n if (c < 0xa0) {\n // One-byte sequence: bits 0xxxxxxx\n code = c;\n i++;\n } else if ((c ^ 0xc0) < 0x20) {\n // Two-byte sequence: bits 110xxxxx 10xxxxxx\n code = (c & 0x1f) << 6 | bytes[i + 1] & 0x3f;\n i += 2;\n } else if ((c ^ 0xe0) < 0x10) {\n // Three-byte sequence: bits 1110xxxx 10xxxxxx 10xxxxxx\n code = (c & 0x0f) << 12 | (bytes[i + 1] & 0x3f) << 6 | bytes[i + 2] & 0x3f;\n i += 3;\n } else {\n // Four-byte sequence: bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n code = (c & 0x07) << 18 | (bytes[i + 1] & 0x3f) << 12 | (bytes[i + 2] & 0x3f) << 6 | bytes[i + 3] & 0x3f;\n i += 4;\n }\n str += String.fromCodePoint(code);\n }\n this.index += size;\n return str;\n }\n unpack_array(size) {\n const objects = new Array(size);\n for(let i = 0; i < size; i++)objects[i] = this.unpack();\n return objects;\n }\n unpack_map(size) {\n const map = {};\n for(let i = 0; i < size; i++){\n const key = this.unpack();\n map[key] = this.unpack();\n }\n return map;\n }\n unpack_float() {\n const uint32 = this.unpack_uint32();\n const sign = uint32 >> 31;\n const exp = (uint32 >> 23 & 0xff) - 127;\n const fraction = uint32 & 0x7fffff | 0x800000;\n return (sign === 0 ? 1 : -1) * fraction * 2 ** (exp - 23);\n }\n unpack_double() {\n const h32 = this.unpack_uint32();\n const l32 = this.unpack_uint32();\n const sign = h32 >> 31;\n const exp = (h32 >> 20 & 0x7ff) - 1023;\n const hfrac = h32 & 0xfffff | 0x100000;\n const frac = hfrac * 2 ** (exp - 20) + l32 * 2 ** (exp - 52);\n return (sign === 0 ? 1 : -1) * frac;\n }\n read(length) {\n const j = this.index;\n if (j + length <= this.length) return this.dataView.subarray(j, j + length);\n else throw new Error(\"BinaryPackFailure: read index out of range\");\n }\n}\nclass $0cfd7828ad59115f$export$b9ec4b114aa40074 {\n getBuffer() {\n return this._bufferBuilder.toArrayBuffer();\n }\n pack(value) {\n if (typeof value === \"string\") this.pack_string(value);\n else if (typeof value === \"number\") {\n if (Math.floor(value) === value) this.pack_integer(value);\n else this.pack_double(value);\n } else if (typeof value === \"boolean\") {\n if (value === true) this._bufferBuilder.append(0xc3);\n else if (value === false) this._bufferBuilder.append(0xc2);\n } else if (value === undefined) this._bufferBuilder.append(0xc0);\n else if (typeof value === \"object\") {\n if (value === null) this._bufferBuilder.append(0xc0);\n else {\n const constructor = value.constructor;\n if (value instanceof Array) {\n const res = this.pack_array(value);\n if (res instanceof Promise) return res.then(()=>this._bufferBuilder.flush());\n } else if (value instanceof ArrayBuffer) this.pack_bin(new Uint8Array(value));\n else if (\"BYTES_PER_ELEMENT\" in value) {\n const v = value;\n this.pack_bin(new Uint8Array(v.buffer, v.byteOffset, v.byteLength));\n } else if (value instanceof Date) this.pack_string(value.toString());\n else if (value instanceof Blob) return value.arrayBuffer().then((buffer)=>{\n this.pack_bin(new Uint8Array(buffer));\n this._bufferBuilder.flush();\n });\n else if (constructor == Object || constructor.toString().startsWith(\"class\")) {\n const res = this.pack_object(value);\n if (res instanceof Promise) return res.then(()=>this._bufferBuilder.flush());\n } else throw new Error(`Type \"${constructor.toString()}\" not yet supported`);\n }\n } else throw new Error(`Type \"${typeof value}\" not yet supported`);\n this._bufferBuilder.flush();\n }\n pack_bin(blob) {\n const length = blob.length;\n if (length <= 0x0f) this.pack_uint8(0xa0 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xda);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xdb);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n this._bufferBuilder.append_buffer(blob);\n }\n pack_string(str) {\n const encoded = this._textEncoder.encode(str);\n const length = encoded.length;\n if (length <= 0x0f) this.pack_uint8(0xb0 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xd8);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xd9);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n this._bufferBuilder.append_buffer(encoded);\n }\n pack_array(ary) {\n const length = ary.length;\n if (length <= 0x0f) this.pack_uint8(0x90 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xdc);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xdd);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n const packNext = (index)=>{\n if (index < length) {\n const res = this.pack(ary[index]);\n if (res instanceof Promise) return res.then(()=>packNext(index + 1));\n return packNext(index + 1);\n }\n };\n return packNext(0);\n }\n pack_integer(num) {\n if (num >= -32 && num <= 0x7f) this._bufferBuilder.append(num & 0xff);\n else if (num >= 0x00 && num <= 0xff) {\n this._bufferBuilder.append(0xcc);\n this.pack_uint8(num);\n } else if (num >= -128 && num <= 0x7f) {\n this._bufferBuilder.append(0xd0);\n this.pack_int8(num);\n } else if (num >= 0x0000 && num <= 0xffff) {\n this._bufferBuilder.append(0xcd);\n this.pack_uint16(num);\n } else if (num >= -32768 && num <= 0x7fff) {\n this._bufferBuilder.append(0xd1);\n this.pack_int16(num);\n } else if (num >= 0x00000000 && num <= 0xffffffff) {\n this._bufferBuilder.append(0xce);\n this.pack_uint32(num);\n } else if (num >= -2147483648 && num <= 0x7fffffff) {\n this._bufferBuilder.append(0xd2);\n this.pack_int32(num);\n } else if (num >= -9223372036854776000 && num <= 0x7fffffffffffffff) {\n this._bufferBuilder.append(0xd3);\n this.pack_int64(num);\n } else if (num >= 0x0000000000000000 && num <= 0xffffffffffffffff) {\n this._bufferBuilder.append(0xcf);\n this.pack_uint64(num);\n } else throw new Error(\"Invalid integer\");\n }\n pack_double(num) {\n let sign = 0;\n if (num < 0) {\n sign = 1;\n num = -num;\n }\n const exp = Math.floor(Math.log(num) / Math.LN2);\n const frac0 = num / 2 ** exp - 1;\n const frac1 = Math.floor(frac0 * 2 ** 52);\n const b32 = 2 ** 32;\n const h32 = sign << 31 | exp + 1023 << 20 | frac1 / b32 & 0x0fffff;\n const l32 = frac1 % b32;\n this._bufferBuilder.append(0xcb);\n this.pack_int32(h32);\n this.pack_int32(l32);\n }\n pack_object(obj) {\n const keys = Object.keys(obj);\n const length = keys.length;\n if (length <= 0x0f) this.pack_uint8(0x80 + length);\n else if (length <= 0xffff) {\n this._bufferBuilder.append(0xde);\n this.pack_uint16(length);\n } else if (length <= 0xffffffff) {\n this._bufferBuilder.append(0xdf);\n this.pack_uint32(length);\n } else throw new Error(\"Invalid length\");\n const packNext = (index)=>{\n if (index < keys.length) {\n const prop = keys[index];\n // eslint-disable-next-line no-prototype-builtins\n if (obj.hasOwnProperty(prop)) {\n this.pack(prop);\n const res = this.pack(obj[prop]);\n if (res instanceof Promise) return res.then(()=>packNext(index + 1));\n }\n return packNext(index + 1);\n }\n };\n return packNext(0);\n }\n pack_uint8(num) {\n this._bufferBuilder.append(num);\n }\n pack_uint16(num) {\n this._bufferBuilder.append(num >> 8);\n this._bufferBuilder.append(num & 0xff);\n }\n pack_uint32(num) {\n const n = num & 0xffffffff;\n this._bufferBuilder.append((n & 0xff000000) >>> 24);\n this._bufferBuilder.append((n & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((n & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(n & 0x000000ff);\n }\n pack_uint64(num) {\n const high = num / 2 ** 32;\n const low = num % 2 ** 32;\n this._bufferBuilder.append((high & 0xff000000) >>> 24);\n this._bufferBuilder.append((high & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((high & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(high & 0x000000ff);\n this._bufferBuilder.append((low & 0xff000000) >>> 24);\n this._bufferBuilder.append((low & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((low & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(low & 0x000000ff);\n }\n pack_int8(num) {\n this._bufferBuilder.append(num & 0xff);\n }\n pack_int16(num) {\n this._bufferBuilder.append((num & 0xff00) >> 8);\n this._bufferBuilder.append(num & 0xff);\n }\n pack_int32(num) {\n this._bufferBuilder.append(num >>> 24 & 0xff);\n this._bufferBuilder.append((num & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((num & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(num & 0x000000ff);\n }\n pack_int64(num) {\n const high = Math.floor(num / 2 ** 32);\n const low = num % 2 ** 32;\n this._bufferBuilder.append((high & 0xff000000) >>> 24);\n this._bufferBuilder.append((high & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((high & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(high & 0x000000ff);\n this._bufferBuilder.append((low & 0xff000000) >>> 24);\n this._bufferBuilder.append((low & 0x00ff0000) >>> 16);\n this._bufferBuilder.append((low & 0x0000ff00) >>> 8);\n this._bufferBuilder.append(low & 0x000000ff);\n }\n constructor(){\n this._bufferBuilder = new (0, $e8379818650e2442$export$93654d4f2d6cd524)();\n this._textEncoder = new TextEncoder();\n }\n}\n\n\nexport {$0cfd7828ad59115f$export$417857010dc9287f as unpack, $0cfd7828ad59115f$export$2a703dbb0cb35339 as pack, $0cfd7828ad59115f$export$b9ec4b114aa40074 as Packer};\n//# sourceMappingURL=binarypack.mjs.map\n","import { BufferBuilder } from \"./bufferbuilder\";\n\nexport type Packable =\n\t| null\n\t| undefined\n\t| string\n\t| number\n\t| boolean\n\t| Date\n\t| ArrayBuffer\n\t| Blob\n\t| Array\n\t| { [key: string]: Packable }\n\t| ({ BYTES_PER_ELEMENT: number } & ArrayBufferView);\nexport type Unpackable =\n\t| null\n\t| undefined\n\t| string\n\t| number\n\t| boolean\n\t| ArrayBuffer\n\t| Array\n\t| { [key: string]: Unpackable };\n\nexport function unpack(data: ArrayBuffer) {\n\tconst unpacker = new Unpacker(data);\n\treturn unpacker.unpack() as T;\n}\n\nexport function pack(data: Packable) {\n\tconst packer = new Packer();\n\tconst res = packer.pack(data);\n\tif (res instanceof Promise) {\n\t\treturn res.then(() => packer.getBuffer());\n\t}\n\treturn packer.getBuffer();\n}\n\nclass Unpacker {\n\tprivate index: number;\n\tprivate readonly dataBuffer: ArrayBuffer;\n\tprivate readonly dataView: Uint8Array;\n\tprivate readonly length: number;\n\n\tconstructor(data: ArrayBuffer) {\n\t\tthis.index = 0;\n\t\tthis.dataBuffer = data;\n\t\tthis.dataView = new Uint8Array(this.dataBuffer);\n\t\tthis.length = this.dataBuffer.byteLength;\n\t}\n\n\tunpack(): Unpackable {\n\t\tconst type = this.unpack_uint8();\n\t\tif (type < 0x80) {\n\t\t\treturn type;\n\t\t} else if ((type ^ 0xe0) < 0x20) {\n\t\t\treturn (type ^ 0xe0) - 0x20;\n\t\t}\n\n\t\tlet size;\n\t\tif ((size = type ^ 0xa0) <= 0x0f) {\n\t\t\treturn this.unpack_raw(size);\n\t\t} else if ((size = type ^ 0xb0) <= 0x0f) {\n\t\t\treturn this.unpack_string(size);\n\t\t} else if ((size = type ^ 0x90) <= 0x0f) {\n\t\t\treturn this.unpack_array(size);\n\t\t} else if ((size = type ^ 0x80) <= 0x0f) {\n\t\t\treturn this.unpack_map(size);\n\t\t}\n\n\t\tswitch (type) {\n\t\t\tcase 0xc0:\n\t\t\t\treturn null;\n\t\t\tcase 0xc1:\n\t\t\t\treturn undefined;\n\t\t\tcase 0xc2:\n\t\t\t\treturn false;\n\t\t\tcase 0xc3:\n\t\t\t\treturn true;\n\t\t\tcase 0xca:\n\t\t\t\treturn this.unpack_float();\n\t\t\tcase 0xcb:\n\t\t\t\treturn this.unpack_double();\n\t\t\tcase 0xcc:\n\t\t\t\treturn this.unpack_uint8();\n\t\t\tcase 0xcd:\n\t\t\t\treturn this.unpack_uint16();\n\t\t\tcase 0xce:\n\t\t\t\treturn this.unpack_uint32();\n\t\t\tcase 0xcf:\n\t\t\t\treturn this.unpack_uint64();\n\t\t\tcase 0xd0:\n\t\t\t\treturn this.unpack_int8();\n\t\t\tcase 0xd1:\n\t\t\t\treturn this.unpack_int16();\n\t\t\tcase 0xd2:\n\t\t\t\treturn this.unpack_int32();\n\t\t\tcase 0xd3:\n\t\t\t\treturn this.unpack_int64();\n\t\t\tcase 0xd4:\n\t\t\t\treturn undefined;\n\t\t\tcase 0xd5:\n\t\t\t\treturn undefined;\n\t\t\tcase 0xd6:\n\t\t\t\treturn undefined;\n\t\t\tcase 0xd7:\n\t\t\t\treturn undefined;\n\t\t\tcase 0xd8:\n\t\t\t\tsize = this.unpack_uint16();\n\t\t\t\treturn this.unpack_string(size);\n\t\t\tcase 0xd9:\n\t\t\t\tsize = this.unpack_uint32();\n\t\t\t\treturn this.unpack_string(size);\n\t\t\tcase 0xda:\n\t\t\t\tsize = this.unpack_uint16();\n\t\t\t\treturn this.unpack_raw(size);\n\t\t\tcase 0xdb:\n\t\t\t\tsize = this.unpack_uint32();\n\t\t\t\treturn this.unpack_raw(size);\n\t\t\tcase 0xdc:\n\t\t\t\tsize = this.unpack_uint16();\n\t\t\t\treturn this.unpack_array(size);\n\t\t\tcase 0xdd:\n\t\t\t\tsize = this.unpack_uint32();\n\t\t\t\treturn this.unpack_array(size);\n\t\t\tcase 0xde:\n\t\t\t\tsize = this.unpack_uint16();\n\t\t\t\treturn this.unpack_map(size);\n\t\t\tcase 0xdf:\n\t\t\t\tsize = this.unpack_uint32();\n\t\t\t\treturn this.unpack_map(size);\n\t\t}\n\t}\n\n\tunpack_uint8() {\n\t\tconst byte = this.dataView[this.index] & 0xff;\n\t\tthis.index++;\n\t\treturn byte;\n\t}\n\n\tunpack_uint16() {\n\t\tconst bytes = this.read(2);\n\t\tconst uint16 = (bytes[0] & 0xff) * 256 + (bytes[1] & 0xff);\n\t\tthis.index += 2;\n\t\treturn uint16;\n\t}\n\n\tunpack_uint32() {\n\t\tconst bytes = this.read(4);\n\t\tconst uint32 =\n\t\t\t((bytes[0] * 256 + bytes[1]) * 256 + bytes[2]) * 256 + bytes[3];\n\t\tthis.index += 4;\n\t\treturn uint32;\n\t}\n\n\tunpack_uint64() {\n\t\tconst bytes = this.read(8);\n\t\tconst uint64 =\n\t\t\t((((((bytes[0] * 256 + bytes[1]) * 256 + bytes[2]) * 256 + bytes[3]) *\n\t\t\t\t256 +\n\t\t\t\tbytes[4]) *\n\t\t\t\t256 +\n\t\t\t\tbytes[5]) *\n\t\t\t\t256 +\n\t\t\t\tbytes[6]) *\n\t\t\t\t256 +\n\t\t\tbytes[7];\n\t\tthis.index += 8;\n\t\treturn uint64;\n\t}\n\n\tunpack_int8() {\n\t\tconst uint8 = this.unpack_uint8();\n\t\treturn uint8 < 0x80 ? uint8 : uint8 - (1 << 8);\n\t}\n\n\tunpack_int16() {\n\t\tconst uint16 = this.unpack_uint16();\n\t\treturn uint16 < 0x8000 ? uint16 : uint16 - (1 << 16);\n\t}\n\n\tunpack_int32() {\n\t\tconst uint32 = this.unpack_uint32();\n\t\treturn uint32 < 2 ** 31 ? uint32 : uint32 - 2 ** 32;\n\t}\n\n\tunpack_int64() {\n\t\tconst uint64 = this.unpack_uint64();\n\t\treturn uint64 < 2 ** 63 ? uint64 : uint64 - 2 ** 64;\n\t}\n\n\tunpack_raw(size: number) {\n\t\tif (this.length < this.index + size) {\n\t\t\tthrow new Error(\n\t\t\t\t`BinaryPackFailure: index is out of range ${this.index} ${size} ${this.length}`,\n\t\t\t);\n\t\t}\n\t\tconst buf = this.dataBuffer.slice(this.index, this.index + size);\n\t\tthis.index += size;\n\n\t\treturn buf;\n\t}\n\n\tunpack_string(size: number) {\n\t\tconst bytes = this.read(size);\n\t\tlet i = 0;\n\t\tlet str = \"\";\n\t\tlet c;\n\t\tlet code;\n\n\t\twhile (i < size) {\n\t\t\tc = bytes[i];\n\t\t\t// The length of a UTF-8 sequence is specified in the first byte:\n\t\t\t// 0xxxxxxx means length 1,\n\t\t\t// 110xxxxx means length 2,\n\t\t\t// 1110xxxx means length 3,\n\t\t\t// 11110xxx means length 4.\n\t\t\t// 10xxxxxx is for non-initial bytes.\n\t\t\tif (c < 0xa0) {\n\t\t\t\t// One-byte sequence: bits 0xxxxxxx\n\t\t\t\tcode = c;\n\t\t\t\ti++;\n\t\t\t} else if ((c ^ 0xc0) < 0x20) {\n\t\t\t\t// Two-byte sequence: bits 110xxxxx 10xxxxxx\n\t\t\t\tcode = ((c & 0x1f) << 6) | (bytes[i + 1] & 0x3f);\n\t\t\t\ti += 2;\n\t\t\t} else if ((c ^ 0xe0) < 0x10) {\n\t\t\t\t// Three-byte sequence: bits 1110xxxx 10xxxxxx 10xxxxxx\n\t\t\t\tcode =\n\t\t\t\t\t((c & 0x0f) << 12) |\n\t\t\t\t\t((bytes[i + 1] & 0x3f) << 6) |\n\t\t\t\t\t(bytes[i + 2] & 0x3f);\n\t\t\t\ti += 3;\n\t\t\t} else {\n\t\t\t\t// Four-byte sequence: bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n\t\t\t\tcode =\n\t\t\t\t\t((c & 0x07) << 18) |\n\t\t\t\t\t((bytes[i + 1] & 0x3f) << 12) |\n\t\t\t\t\t((bytes[i + 2] & 0x3f) << 6) |\n\t\t\t\t\t(bytes[i + 3] & 0x3f);\n\t\t\t\ti += 4;\n\t\t\t}\n\t\t\tstr += String.fromCodePoint(code);\n\t\t}\n\n\t\tthis.index += size;\n\t\treturn str;\n\t}\n\n\tunpack_array(size: number) {\n\t\tconst objects = new Array(size);\n\t\tfor (let i = 0; i < size; i++) {\n\t\t\tobjects[i] = this.unpack();\n\t\t}\n\t\treturn objects;\n\t}\n\n\tunpack_map(size: number) {\n\t\tconst map: { [key: string]: Unpackable } = {};\n\t\tfor (let i = 0; i < size; i++) {\n\t\t\tconst key = this.unpack() as string;\n\t\t\tmap[key] = this.unpack();\n\t\t}\n\t\treturn map;\n\t}\n\n\tunpack_float() {\n\t\tconst uint32 = this.unpack_uint32();\n\t\tconst sign = uint32 >> 31;\n\t\tconst exp = ((uint32 >> 23) & 0xff) - 127;\n\t\tconst fraction = (uint32 & 0x7fffff) | 0x800000;\n\t\treturn (sign === 0 ? 1 : -1) * fraction * 2 ** (exp - 23);\n\t}\n\n\tunpack_double() {\n\t\tconst h32 = this.unpack_uint32();\n\t\tconst l32 = this.unpack_uint32();\n\t\tconst sign = h32 >> 31;\n\t\tconst exp = ((h32 >> 20) & 0x7ff) - 1023;\n\t\tconst hfrac = (h32 & 0xfffff) | 0x100000;\n\t\tconst frac = hfrac * 2 ** (exp - 20) + l32 * 2 ** (exp - 52);\n\t\treturn (sign === 0 ? 1 : -1) * frac;\n\t}\n\n\tread(length: number) {\n\t\tconst j = this.index;\n\t\tif (j + length <= this.length) {\n\t\t\treturn this.dataView.subarray(j, j + length);\n\t\t} else {\n\t\t\tthrow new Error(\"BinaryPackFailure: read index out of range\");\n\t\t}\n\t}\n}\n\nexport class Packer {\n\tprivate _bufferBuilder = new BufferBuilder();\n\tprivate _textEncoder = new TextEncoder();\n\n\tgetBuffer() {\n\t\treturn this._bufferBuilder.toArrayBuffer();\n\t}\n\n\tpack(value: Packable) {\n\t\tif (typeof value === \"string\") {\n\t\t\tthis.pack_string(value);\n\t\t} else if (typeof value === \"number\") {\n\t\t\tif (Math.floor(value) === value) {\n\t\t\t\tthis.pack_integer(value);\n\t\t\t} else {\n\t\t\t\tthis.pack_double(value);\n\t\t\t}\n\t\t} else if (typeof value === \"boolean\") {\n\t\t\tif (value === true) {\n\t\t\t\tthis._bufferBuilder.append(0xc3);\n\t\t\t} else if (value === false) {\n\t\t\t\tthis._bufferBuilder.append(0xc2);\n\t\t\t}\n\t\t} else if (value === undefined) {\n\t\t\tthis._bufferBuilder.append(0xc0);\n\t\t} else if (typeof value === \"object\") {\n\t\t\tif (value === null) {\n\t\t\t\tthis._bufferBuilder.append(0xc0);\n\t\t\t} else {\n\t\t\t\tconst constructor = value.constructor;\n\t\t\t\tif (value instanceof Array) {\n\t\t\t\t\tconst res = this.pack_array(value);\n\t\t\t\t\tif (res instanceof Promise) {\n\t\t\t\t\t\treturn res.then(() => this._bufferBuilder.flush());\n\t\t\t\t\t}\n\t\t\t\t} else if (value instanceof ArrayBuffer) {\n\t\t\t\t\tthis.pack_bin(new Uint8Array(value));\n\t\t\t\t} else if (\"BYTES_PER_ELEMENT\" in value) {\n\t\t\t\t\tconst v = value as unknown as DataView;\n\t\t\t\t\tthis.pack_bin(new Uint8Array(v.buffer, v.byteOffset, v.byteLength));\n\t\t\t\t} else if (value instanceof Date) {\n\t\t\t\t\tthis.pack_string(value.toString());\n\t\t\t\t} else if (value instanceof Blob) {\n\t\t\t\t\treturn value.arrayBuffer().then((buffer) => {\n\t\t\t\t\t\tthis.pack_bin(new Uint8Array(buffer));\n\t\t\t\t\t\tthis._bufferBuilder.flush();\n\t\t\t\t\t});\n\t\t\t\t\t// this.pack_bin(new Uint8Array(await value.arrayBuffer()));\n\t\t\t\t} else if (\n\t\t\t\t\tconstructor == Object ||\n\t\t\t\t\tconstructor.toString().startsWith(\"class\")\n\t\t\t\t) {\n\t\t\t\t\tconst res = this.pack_object(value);\n\t\t\t\t\tif (res instanceof Promise) {\n\t\t\t\t\t\treturn res.then(() => this._bufferBuilder.flush());\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Type \"${constructor.toString()}\" not yet supported`);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`Type \"${typeof value}\" not yet supported`);\n\t\t}\n\t\tthis._bufferBuilder.flush();\n\t}\n\n\tpack_bin(blob: Uint8Array) {\n\t\tconst length = blob.length;\n\n\t\tif (length <= 0x0f) {\n\t\t\tthis.pack_uint8(0xa0 + length);\n\t\t} else if (length <= 0xffff) {\n\t\t\tthis._bufferBuilder.append(0xda);\n\t\t\tthis.pack_uint16(length);\n\t\t} else if (length <= 0xffffffff) {\n\t\t\tthis._bufferBuilder.append(0xdb);\n\t\t\tthis.pack_uint32(length);\n\t\t} else {\n\t\t\tthrow new Error(\"Invalid length\");\n\t\t}\n\t\tthis._bufferBuilder.append_buffer(blob);\n\t}\n\n\tpack_string(str: string) {\n\t\tconst encoded = this._textEncoder.encode(str);\n\t\tconst length = encoded.length;\n\n\t\tif (length <= 0x0f) {\n\t\t\tthis.pack_uint8(0xb0 + length);\n\t\t} else if (length <= 0xffff) {\n\t\t\tthis._bufferBuilder.append(0xd8);\n\t\t\tthis.pack_uint16(length);\n\t\t} else if (length <= 0xffffffff) {\n\t\t\tthis._bufferBuilder.append(0xd9);\n\t\t\tthis.pack_uint32(length);\n\t\t} else {\n\t\t\tthrow new Error(\"Invalid length\");\n\t\t}\n\t\tthis._bufferBuilder.append_buffer(encoded);\n\t}\n\n\tpack_array(ary: Packable[]) {\n\t\tconst length = ary.length;\n\t\tif (length <= 0x0f) {\n\t\t\tthis.pack_uint8(0x90 + length);\n\t\t} else if (length <= 0xffff) {\n\t\t\tthis._bufferBuilder.append(0xdc);\n\t\t\tthis.pack_uint16(length);\n\t\t} else if (length <= 0xffffffff) {\n\t\t\tthis._bufferBuilder.append(0xdd);\n\t\t\tthis.pack_uint32(length);\n\t\t} else {\n\t\t\tthrow new Error(\"Invalid length\");\n\t\t}\n\n\t\tconst packNext = (index: number): Promise | void => {\n\t\t\tif (index < length) {\n\t\t\t\tconst res = this.pack(ary[index]);\n\t\t\t\tif (res instanceof Promise) {\n\t\t\t\t\treturn res.then(() => packNext(index + 1));\n\t\t\t\t}\n\t\t\t\treturn packNext(index + 1);\n\t\t\t}\n\t\t};\n\n\t\treturn packNext(0);\n\t}\n\n\tpack_integer(num: number) {\n\t\tif (num >= -0x20 && num <= 0x7f) {\n\t\t\tthis._bufferBuilder.append(num & 0xff);\n\t\t} else if (num >= 0x00 && num <= 0xff) {\n\t\t\tthis._bufferBuilder.append(0xcc);\n\t\t\tthis.pack_uint8(num);\n\t\t} else if (num >= -0x80 && num <= 0x7f) {\n\t\t\tthis._bufferBuilder.append(0xd0);\n\t\t\tthis.pack_int8(num);\n\t\t} else if (num >= 0x0000 && num <= 0xffff) {\n\t\t\tthis._bufferBuilder.append(0xcd);\n\t\t\tthis.pack_uint16(num);\n\t\t} else if (num >= -0x8000 && num <= 0x7fff) {\n\t\t\tthis._bufferBuilder.append(0xd1);\n\t\t\tthis.pack_int16(num);\n\t\t} else if (num >= 0x00000000 && num <= 0xffffffff) {\n\t\t\tthis._bufferBuilder.append(0xce);\n\t\t\tthis.pack_uint32(num);\n\t\t} else if (num >= -0x80000000 && num <= 0x7fffffff) {\n\t\t\tthis._bufferBuilder.append(0xd2);\n\t\t\tthis.pack_int32(num);\n\t\t} else if (num >= -0x8000000000000000 && num <= 0x7fffffffffffffff) {\n\t\t\tthis._bufferBuilder.append(0xd3);\n\t\t\tthis.pack_int64(num);\n\t\t} else if (num >= 0x0000000000000000 && num <= 0xffffffffffffffff) {\n\t\t\tthis._bufferBuilder.append(0xcf);\n\t\t\tthis.pack_uint64(num);\n\t\t} else {\n\t\t\tthrow new Error(\"Invalid integer\");\n\t\t}\n\t}\n\n\tpack_double(num: number) {\n\t\tlet sign = 0;\n\t\tif (num < 0) {\n\t\t\tsign = 1;\n\t\t\tnum = -num;\n\t\t}\n\t\tconst exp = Math.floor(Math.log(num) / Math.LN2);\n\t\tconst frac0 = num / 2 ** exp - 1;\n\t\tconst frac1 = Math.floor(frac0 * 2 ** 52);\n\t\tconst b32 = 2 ** 32;\n\t\tconst h32 =\n\t\t\t(sign << 31) | ((exp + 1023) << 20) | ((frac1 / b32) & 0x0fffff);\n\t\tconst l32 = frac1 % b32;\n\t\tthis._bufferBuilder.append(0xcb);\n\t\tthis.pack_int32(h32);\n\t\tthis.pack_int32(l32);\n\t}\n\n\tpack_object(obj: { [key: string]: Packable }) {\n\t\tconst keys = Object.keys(obj);\n\t\tconst length = keys.length;\n\t\tif (length <= 0x0f) {\n\t\t\tthis.pack_uint8(0x80 + length);\n\t\t} else if (length <= 0xffff) {\n\t\t\tthis._bufferBuilder.append(0xde);\n\t\t\tthis.pack_uint16(length);\n\t\t} else if (length <= 0xffffffff) {\n\t\t\tthis._bufferBuilder.append(0xdf);\n\t\t\tthis.pack_uint32(length);\n\t\t} else {\n\t\t\tthrow new Error(\"Invalid length\");\n\t\t}\n\n\t\tconst packNext = (index: number): Promise | void => {\n\t\t\tif (index < keys.length) {\n\t\t\t\tconst prop = keys[index];\n\t\t\t\t// eslint-disable-next-line no-prototype-builtins\n\t\t\t\tif (obj.hasOwnProperty(prop)) {\n\t\t\t\t\tthis.pack(prop);\n\t\t\t\t\tconst res = this.pack(obj[prop]);\n\t\t\t\t\tif (res instanceof Promise) {\n\t\t\t\t\t\treturn res.then(() => packNext(index + 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn packNext(index + 1);\n\t\t\t}\n\t\t};\n\n\t\treturn packNext(0);\n\t}\n\n\tpack_uint8(num: number) {\n\t\tthis._bufferBuilder.append(num);\n\t}\n\n\tpack_uint16(num: number) {\n\t\tthis._bufferBuilder.append(num >> 8);\n\t\tthis._bufferBuilder.append(num & 0xff);\n\t}\n\n\tpack_uint32(num: number) {\n\t\tconst n = num & 0xffffffff;\n\t\tthis._bufferBuilder.append((n & 0xff000000) >>> 24);\n\t\tthis._bufferBuilder.append((n & 0x00ff0000) >>> 16);\n\t\tthis._bufferBuilder.append((n & 0x0000ff00) >>> 8);\n\t\tthis._bufferBuilder.append(n & 0x000000ff);\n\t}\n\n\tpack_uint64(num: number) {\n\t\tconst high = num / 2 ** 32;\n\t\tconst low = num % 2 ** 32;\n\t\tthis._bufferBuilder.append((high & 0xff000000) >>> 24);\n\t\tthis._bufferBuilder.append((high & 0x00ff0000) >>> 16);\n\t\tthis._bufferBuilder.append((high & 0x0000ff00) >>> 8);\n\t\tthis._bufferBuilder.append(high & 0x000000ff);\n\t\tthis._bufferBuilder.append((low & 0xff000000) >>> 24);\n\t\tthis._bufferBuilder.append((low & 0x00ff0000) >>> 16);\n\t\tthis._bufferBuilder.append((low & 0x0000ff00) >>> 8);\n\t\tthis._bufferBuilder.append(low & 0x000000ff);\n\t}\n\n\tpack_int8(num: number) {\n\t\tthis._bufferBuilder.append(num & 0xff);\n\t}\n\n\tpack_int16(num: number) {\n\t\tthis._bufferBuilder.append((num & 0xff00) >> 8);\n\t\tthis._bufferBuilder.append(num & 0xff);\n\t}\n\n\tpack_int32(num: number) {\n\t\tthis._bufferBuilder.append((num >>> 24) & 0xff);\n\t\tthis._bufferBuilder.append((num & 0x00ff0000) >>> 16);\n\t\tthis._bufferBuilder.append((num & 0x0000ff00) >>> 8);\n\t\tthis._bufferBuilder.append(num & 0x000000ff);\n\t}\n\n\tpack_int64(num: number) {\n\t\tconst high = Math.floor(num / 2 ** 32);\n\t\tconst low = num % 2 ** 32;\n\t\tthis._bufferBuilder.append((high & 0xff000000) >>> 24);\n\t\tthis._bufferBuilder.append((high & 0x00ff0000) >>> 16);\n\t\tthis._bufferBuilder.append((high & 0x0000ff00) >>> 8);\n\t\tthis._bufferBuilder.append(high & 0x000000ff);\n\t\tthis._bufferBuilder.append((low & 0xff000000) >>> 24);\n\t\tthis._bufferBuilder.append((low & 0x00ff0000) >>> 16);\n\t\tthis._bufferBuilder.append((low & 0x0000ff00) >>> 8);\n\t\tthis._bufferBuilder.append(low & 0x000000ff);\n\t}\n}\n","class BufferBuilder {\n\tprivate _pieces: number[];\n\tprivate readonly _parts: ArrayBufferView[];\n\n\tconstructor() {\n\t\tthis._pieces = [];\n\t\tthis._parts = [];\n\t}\n\n\tappend_buffer(data: ArrayBufferView) {\n\t\tthis.flush();\n\t\tthis._parts.push(data);\n\t}\n\n\tappend(data: number) {\n\t\tthis._pieces.push(data);\n\t}\n\n\tflush() {\n\t\tif (this._pieces.length > 0) {\n\t\t\tconst buf = new Uint8Array(this._pieces);\n\t\t\tthis._parts.push(buf);\n\t\t\tthis._pieces = [];\n\t\t}\n\t}\n\n\tprivate encoder = new TextEncoder();\n\n\tpublic toArrayBuffer() {\n\t\tconst buffer = [];\n\t\tfor (const part of this._parts) {\n\t\t\tbuffer.push(part);\n\t\t}\n\t\treturn concatArrayBuffers(buffer).buffer;\n\t}\n}\n\nexport { BufferBuilder };\n\nfunction concatArrayBuffers(bufs: ArrayBufferView[]) {\n\tlet size = 0;\n\tfor (const buf of bufs) {\n\t\tsize += buf.byteLength;\n\t}\n\tconst result = new Uint8Array(size);\n\tlet offset = 0;\n\tfor (const buf of bufs) {\n\t\tconst view = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n\t\tresult.set(view, offset);\n\t\toffset += buf.byteLength;\n\t}\n\treturn result;\n}\n","import webRTCAdapter_import from \"webrtc-adapter\";\n\nconst webRTCAdapter: typeof webRTCAdapter_import =\n\t//@ts-ignore\n\twebRTCAdapter_import.default || webRTCAdapter_import;\n\nexport const Supports = new (class {\n\treadonly isIOS = [\"iPad\", \"iPhone\", \"iPod\"].includes(navigator.platform);\n\treadonly supportedBrowsers = [\"firefox\", \"chrome\", \"safari\"];\n\n\treadonly minFirefoxVersion = 59;\n\treadonly minChromeVersion = 72;\n\treadonly minSafariVersion = 605;\n\n\tisWebRTCSupported(): boolean {\n\t\treturn typeof RTCPeerConnection !== \"undefined\";\n\t}\n\n\tisBrowserSupported(): boolean {\n\t\tconst browser = this.getBrowser();\n\t\tconst version = this.getVersion();\n\n\t\tconst validBrowser = this.supportedBrowsers.includes(browser);\n\n\t\tif (!validBrowser) return false;\n\n\t\tif (browser === \"chrome\") return version >= this.minChromeVersion;\n\t\tif (browser === \"firefox\") return version >= this.minFirefoxVersion;\n\t\tif (browser === \"safari\")\n\t\t\treturn !this.isIOS && version >= this.minSafariVersion;\n\n\t\treturn false;\n\t}\n\n\tgetBrowser(): string {\n\t\treturn webRTCAdapter.browserDetails.browser;\n\t}\n\n\tgetVersion(): number {\n\t\treturn webRTCAdapter.browserDetails.version || 0;\n\t}\n\n\tisUnifiedPlanSupported(): boolean {\n\t\tconst browser = this.getBrowser();\n\t\tconst version = webRTCAdapter.browserDetails.version || 0;\n\n\t\tif (browser === \"chrome\" && version < this.minChromeVersion) return false;\n\t\tif (browser === \"firefox\" && version >= this.minFirefoxVersion) return true;\n\t\tif (\n\t\t\t!window.RTCRtpTransceiver ||\n\t\t\t!(\"currentDirection\" in RTCRtpTransceiver.prototype)\n\t\t)\n\t\t\treturn false;\n\n\t\tlet tempPc: RTCPeerConnection;\n\t\tlet supported = false;\n\n\t\ttry {\n\t\t\ttempPc = new RTCPeerConnection();\n\t\t\ttempPc.addTransceiver(\"audio\");\n\t\t\tsupported = true;\n\t\t} catch (e) {\n\t\t} finally {\n\t\t\tif (tempPc) {\n\t\t\t\ttempPc.close();\n\t\t\t}\n\t\t}\n\n\t\treturn supported;\n\t}\n\n\ttoString(): string {\n\t\treturn `Supports:\n browser:${this.getBrowser()}\n version:${this.getVersion()}\n isIOS:${this.isIOS}\n isWebRTCSupported:${this.isWebRTCSupported()}\n isBrowserSupported:${this.isBrowserSupported()}\n isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`;\n\t}\n})();\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n\n'use strict';\n\nimport {adapterFactory} from './adapter_factory.js';\n\nconst adapter =\n adapterFactory({window: typeof window === 'undefined' ? undefined : window});\nexport default adapter;\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\nimport * as utils from './utils';\n\n// Browser shims.\nimport * as chromeShim from './chrome/chrome_shim';\nimport * as firefoxShim from './firefox/firefox_shim';\nimport * as safariShim from './safari/safari_shim';\nimport * as commonShim from './common_shim';\nimport * as sdp from 'sdp';\n\n// Shimming starts here.\nexport function adapterFactory({window} = {}, options = {\n shimChrome: true,\n shimFirefox: true,\n shimSafari: true,\n}) {\n // Utils.\n const logging = utils.log;\n const browserDetails = utils.detectBrowser(window);\n\n const adapter = {\n browserDetails,\n commonShim,\n extractVersion: utils.extractVersion,\n disableLog: utils.disableLog,\n disableWarnings: utils.disableWarnings,\n // Expose sdp as a convenience. For production apps include directly.\n sdp,\n };\n\n // Shim browser if found.\n switch (browserDetails.browser) {\n case 'chrome':\n if (!chromeShim || !chromeShim.shimPeerConnection ||\n !options.shimChrome) {\n logging('Chrome shim is not included in this adapter release.');\n return adapter;\n }\n if (browserDetails.version === null) {\n logging('Chrome shim can not determine version, not shimming.');\n return adapter;\n }\n logging('adapter.js shimming chrome.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = chromeShim;\n\n // Must be called before shimPeerConnection.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n chromeShim.shimGetUserMedia(window, browserDetails);\n chromeShim.shimMediaStream(window, browserDetails);\n chromeShim.shimPeerConnection(window, browserDetails);\n chromeShim.shimOnTrack(window, browserDetails);\n chromeShim.shimAddTrackRemoveTrack(window, browserDetails);\n chromeShim.shimGetSendersWithDtmf(window, browserDetails);\n chromeShim.shimGetStats(window, browserDetails);\n chromeShim.shimSenderReceiverGetStats(window, browserDetails);\n chromeShim.fixNegotiationNeeded(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimRTCIceCandidateRelayProtocol(window, browserDetails);\n commonShim.shimConnectionState(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n commonShim.removeExtmapAllowMixed(window, browserDetails);\n break;\n case 'firefox':\n if (!firefoxShim || !firefoxShim.shimPeerConnection ||\n !options.shimFirefox) {\n logging('Firefox shim is not included in this adapter release.');\n return adapter;\n }\n logging('adapter.js shimming firefox.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = firefoxShim;\n\n // Must be called before shimPeerConnection.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n firefoxShim.shimGetUserMedia(window, browserDetails);\n firefoxShim.shimPeerConnection(window, browserDetails);\n firefoxShim.shimOnTrack(window, browserDetails);\n firefoxShim.shimRemoveStream(window, browserDetails);\n firefoxShim.shimSenderGetStats(window, browserDetails);\n firefoxShim.shimReceiverGetStats(window, browserDetails);\n firefoxShim.shimRTCDataChannel(window, browserDetails);\n firefoxShim.shimAddTransceiver(window, browserDetails);\n firefoxShim.shimGetParameters(window, browserDetails);\n firefoxShim.shimCreateOffer(window, browserDetails);\n firefoxShim.shimCreateAnswer(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimConnectionState(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n break;\n case 'safari':\n if (!safariShim || !options.shimSafari) {\n logging('Safari shim is not included in this adapter release.');\n return adapter;\n }\n logging('adapter.js shimming safari.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = safariShim;\n\n // Must be called before shimCallbackAPI.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n safariShim.shimRTCIceServerUrls(window, browserDetails);\n safariShim.shimCreateOfferLegacy(window, browserDetails);\n safariShim.shimCallbacksAPI(window, browserDetails);\n safariShim.shimLocalStreamsAPI(window, browserDetails);\n safariShim.shimRemoteStreamsAPI(window, browserDetails);\n safariShim.shimTrackEventTransceiver(window, browserDetails);\n safariShim.shimGetUserMedia(window, browserDetails);\n safariShim.shimAudioContext(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimRTCIceCandidateRelayProtocol(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n commonShim.removeExtmapAllowMixed(window, browserDetails);\n break;\n default:\n logging('Unsupported browser!');\n break;\n }\n\n return adapter;\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nlet logDisabled_ = true;\nlet deprecationWarnings_ = true;\n\n/**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\nexport function extractVersion(uastring, expr, pos) {\n const match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n}\n\n// Wraps the peerconnection event eventNameToWrap in a function\n// which returns the modified event object (or false to prevent\n// the event).\nexport function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {\n if (!window.RTCPeerConnection) {\n return;\n }\n const proto = window.RTCPeerConnection.prototype;\n const nativeAddEventListener = proto.addEventListener;\n proto.addEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap) {\n return nativeAddEventListener.apply(this, arguments);\n }\n const wrappedCallback = (e) => {\n const modifiedEvent = wrapper(e);\n if (modifiedEvent) {\n if (cb.handleEvent) {\n cb.handleEvent(modifiedEvent);\n } else {\n cb(modifiedEvent);\n }\n }\n };\n this._eventMap = this._eventMap || {};\n if (!this._eventMap[eventNameToWrap]) {\n this._eventMap[eventNameToWrap] = new Map();\n }\n this._eventMap[eventNameToWrap].set(cb, wrappedCallback);\n return nativeAddEventListener.apply(this, [nativeEventName,\n wrappedCallback]);\n };\n\n const nativeRemoveEventListener = proto.removeEventListener;\n proto.removeEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap || !this._eventMap\n || !this._eventMap[eventNameToWrap]) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (!this._eventMap[eventNameToWrap].has(cb)) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);\n this._eventMap[eventNameToWrap].delete(cb);\n if (this._eventMap[eventNameToWrap].size === 0) {\n delete this._eventMap[eventNameToWrap];\n }\n if (Object.keys(this._eventMap).length === 0) {\n delete this._eventMap;\n }\n return nativeRemoveEventListener.apply(this, [nativeEventName,\n unwrappedCb]);\n };\n\n Object.defineProperty(proto, 'on' + eventNameToWrap, {\n get() {\n return this['_on' + eventNameToWrap];\n },\n set(cb) {\n if (this['_on' + eventNameToWrap]) {\n this.removeEventListener(eventNameToWrap,\n this['_on' + eventNameToWrap]);\n delete this['_on' + eventNameToWrap];\n }\n if (cb) {\n this.addEventListener(eventNameToWrap,\n this['_on' + eventNameToWrap] = cb);\n }\n },\n enumerable: true,\n configurable: true\n });\n}\n\nexport function disableLog(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n logDisabled_ = bool;\n return (bool) ? 'adapter.js logging disabled' :\n 'adapter.js logging enabled';\n}\n\n/**\n * Disable or enable deprecation warnings\n * @param {!boolean} bool set to true to disable warnings.\n */\nexport function disableWarnings(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n deprecationWarnings_ = !bool;\n return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');\n}\n\nexport function log() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n}\n\n/**\n * Shows a deprecation warning suggesting the modern and spec-compatible API.\n */\nexport function deprecated(oldMethod, newMethod) {\n if (!deprecationWarnings_) {\n return;\n }\n console.warn(oldMethod + ' is deprecated, please use ' + newMethod +\n ' instead.');\n}\n\n/**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\nexport function detectBrowser(window) {\n // Returned result object.\n const result = {browser: null, version: null};\n\n // Fail early if it's not a browser\n if (typeof window === 'undefined' || !window.navigator ||\n !window.navigator.userAgent) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n const {navigator} = window;\n\n if (navigator.mozGetUserMedia) { // Firefox.\n result.browser = 'firefox';\n result.version = extractVersion(navigator.userAgent,\n /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia ||\n (window.isSecureContext === false && window.webkitRTCPeerConnection)) {\n // Chrome, Chromium, Webview, Opera.\n // Version matches Chrome/WebRTC version.\n // Chrome 74 removed webkitGetUserMedia on http as well so we need the\n // more complicated fallback to webkitRTCPeerConnection.\n result.browser = 'chrome';\n result.version = extractVersion(navigator.userAgent,\n /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else if (window.RTCPeerConnection &&\n navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) { // Safari.\n result.browser = 'safari';\n result.version = extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n result.supportsUnifiedPlan = window.RTCRtpTransceiver &&\n 'currentDirection' in window.RTCRtpTransceiver.prototype;\n } else { // Default fallthrough: not supported.\n result.browser = 'Not a supported browser.';\n return result;\n }\n\n return result;\n}\n\n/**\n * Checks if something is an object.\n *\n * @param {*} val The something you want to check.\n * @return true if val is an object, false otherwise.\n */\nfunction isObject(val) {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Remove all empty objects and undefined values\n * from a nested object -- an enhanced and vanilla version\n * of Lodash's `compact`.\n */\nexport function compactObject(data) {\n if (!isObject(data)) {\n return data;\n }\n\n return Object.keys(data).reduce(function(accumulator, key) {\n const isObj = isObject(data[key]);\n const value = isObj ? compactObject(data[key]) : data[key];\n const isEmptyObject = isObj && !Object.keys(value).length;\n if (value === undefined || isEmptyObject) {\n return accumulator;\n }\n return Object.assign(accumulator, {[key]: value});\n }, {});\n}\n\n/* iterates the stats graph recursively. */\nexport function walkStats(stats, base, resultSet) {\n if (!base || resultSet.has(base.id)) {\n return;\n }\n resultSet.set(base.id, base);\n Object.keys(base).forEach(name => {\n if (name.endsWith('Id')) {\n walkStats(stats, stats.get(base[name]), resultSet);\n } else if (name.endsWith('Ids')) {\n base[name].forEach(id => {\n walkStats(stats, stats.get(id), resultSet);\n });\n }\n });\n}\n\n/* filter getStats for a sender/receiver track. */\nexport function filterStats(result, track, outbound) {\n const streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';\n const filteredResult = new Map();\n if (track === null) {\n return filteredResult;\n }\n const trackStats = [];\n result.forEach(value => {\n if (value.type === 'track' &&\n value.trackIdentifier === track.id) {\n trackStats.push(value);\n }\n });\n trackStats.forEach(trackStat => {\n result.forEach(stats => {\n if (stats.type === streamStatsType && stats.trackId === trackStat.id) {\n walkStats(result, stats, filteredResult);\n }\n });\n });\n return filteredResult;\n}\n\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nimport * as utils from '../utils.js';\n\nexport {shimGetUserMedia} from './getusermedia';\nexport {shimGetDisplayMedia} from './getdisplaymedia';\n\nexport function shimMediaStream(window) {\n window.MediaStream = window.MediaStream || window.webkitMediaStream;\n}\n\nexport function shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get() {\n return this._ontrack;\n },\n set(f) {\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n }\n this.addEventListener('track', this._ontrack = f);\n },\n enumerable: true,\n configurable: true\n });\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n if (!this._ontrackpoly) {\n this._ontrackpoly = (e) => {\n // onaddstream does not fire when a track is added to an existing\n // stream. But stream.onaddtrack is implemented so we use that.\n e.stream.addEventListener('addtrack', te => {\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) {\n receiver = this.getReceivers()\n .find(r => r.track && r.track.id === te.track.id);\n } else {\n receiver = {track: te.track};\n }\n\n const event = new Event('track');\n event.track = te.track;\n event.receiver = receiver;\n event.transceiver = {receiver};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n });\n e.stream.getTracks().forEach(track => {\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) {\n receiver = this.getReceivers()\n .find(r => r.track && r.track.id === track.id);\n } else {\n receiver = {track};\n }\n const event = new Event('track');\n event.track = track;\n event.receiver = receiver;\n event.transceiver = {receiver};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n });\n };\n this.addEventListener('addstream', this._ontrackpoly);\n }\n return origSetRemoteDescription.apply(this, arguments);\n };\n } else {\n // even if RTCRtpTransceiver is in window, it is only used and\n // emitted in unified-plan. Unfortunately this means we need\n // to unconditionally wrap the event.\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n if (!e.transceiver) {\n Object.defineProperty(e, 'transceiver',\n {value: {receiver: e.receiver}});\n }\n return e;\n });\n }\n}\n\nexport function shimGetSendersWithDtmf(window) {\n // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('getSenders' in window.RTCPeerConnection.prototype) &&\n 'createDTMFSender' in window.RTCPeerConnection.prototype) {\n const shimSenderWithDtmf = function(pc, track) {\n return {\n track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n },\n _pc: pc\n };\n };\n\n // augment addTrack when getSenders is not available.\n if (!window.RTCPeerConnection.prototype.getSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n this._senders = this._senders || [];\n return this._senders.slice(); // return a copy of the internal state.\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n let sender = origAddTrack.apply(this, arguments);\n if (!sender) {\n sender = shimSenderWithDtmf(this, track);\n this._senders.push(sender);\n }\n return sender;\n };\n\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n origRemoveTrack.apply(this, arguments);\n const idx = this._senders.indexOf(sender);\n if (idx !== -1) {\n this._senders.splice(idx, 1);\n }\n };\n }\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._senders = this._senders || [];\n origAddStream.apply(this, [stream]);\n stream.getTracks().forEach(track => {\n this._senders.push(shimSenderWithDtmf(this, track));\n });\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._senders = this._senders || [];\n origRemoveStream.apply(this, [stream]);\n\n stream.getTracks().forEach(track => {\n const sender = this._senders.find(s => s.track === track);\n if (sender) { // remove sender\n this._senders.splice(this._senders.indexOf(sender), 1);\n }\n });\n };\n } else if (typeof window === 'object' && window.RTCPeerConnection &&\n 'getSenders' in window.RTCPeerConnection.prototype &&\n 'createDTMFSender' in window.RTCPeerConnection.prototype &&\n window.RTCRtpSender &&\n !('dtmf' in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n\n Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {\n get() {\n if (this._dtmf === undefined) {\n if (this.track.kind === 'audio') {\n this._dtmf = this._pc.createDTMFSender(this.track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n });\n }\n}\n\nexport function shimGetStats(window) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n\n // If selector is a function then we are in the old style stats so just\n // pass back the original getStats format to avoid breaking old users.\n if (arguments.length > 0 && typeof selector === 'function') {\n return origGetStats.apply(this, arguments);\n }\n\n // When spec-style getStats is supported, return those when called with\n // either no arguments or the selector argument is null.\n if (origGetStats.length === 0 && (arguments.length === 0 ||\n typeof selector !== 'function')) {\n return origGetStats.apply(this, []);\n }\n\n const fixChromeStats_ = function(response) {\n const standardReport = {};\n const reports = response.result();\n reports.forEach(report => {\n const standardStats = {\n id: report.id,\n timestamp: report.timestamp,\n type: {\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[report.type] || report.type\n };\n report.names().forEach(name => {\n standardStats[name] = report.stat(name);\n });\n standardReport[standardStats.id] = standardStats;\n });\n\n return standardReport;\n };\n\n // shim getStats with maplike support\n const makeMapStats = function(stats) {\n return new Map(Object.keys(stats).map(key => [key, stats[key]]));\n };\n\n if (arguments.length >= 2) {\n const successCallbackWrapper_ = function(response) {\n onSucc(makeMapStats(fixChromeStats_(response)));\n };\n\n return origGetStats.apply(this, [successCallbackWrapper_,\n selector]);\n }\n\n // promise-support\n return new Promise((resolve, reject) => {\n origGetStats.apply(this, [\n function(response) {\n resolve(makeMapStats(fixChromeStats_(response)));\n }, reject]);\n }).then(onSucc, onErr);\n };\n}\n\nexport function shimSenderReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender && window.RTCRtpReceiver)) {\n return;\n }\n\n // shim sender stats.\n if (!('getStats' in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n window.RTCRtpSender.prototype.getStats = function getStats() {\n const sender = this;\n return this._pc.getStats().then(result =>\n /* Note: this will include stats of all senders that\n * send a track with the same id as sender.track as\n * it is not possible to identify the RTCRtpSender.\n */\n utils.filterStats(result, sender.track, true));\n };\n }\n\n // shim receiver stats.\n if (!('getStats' in window.RTCRtpReceiver.prototype)) {\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers =\n function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n const receiver = this;\n return this._pc.getStats().then(result =>\n utils.filterStats(result, receiver.track, false));\n };\n }\n\n if (!('getStats' in window.RTCRtpSender.prototype &&\n 'getStats' in window.RTCRtpReceiver.prototype)) {\n return;\n }\n\n // shim RTCPeerConnection.getStats(track).\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n if (arguments.length > 0 &&\n arguments[0] instanceof window.MediaStreamTrack) {\n const track = arguments[0];\n let sender;\n let receiver;\n let err;\n this.getSenders().forEach(s => {\n if (s.track === track) {\n if (sender) {\n err = true;\n } else {\n sender = s;\n }\n }\n });\n this.getReceivers().forEach(r => {\n if (r.track === track) {\n if (receiver) {\n err = true;\n } else {\n receiver = r;\n }\n }\n return r.track === track;\n });\n if (err || (sender && receiver)) {\n return Promise.reject(new DOMException(\n 'There are more than one sender or receiver for the track.',\n 'InvalidAccessError'));\n } else if (sender) {\n return sender.getStats();\n } else if (receiver) {\n return receiver.getStats();\n }\n return Promise.reject(new DOMException(\n 'There is no sender or receiver for the track.',\n 'InvalidAccessError'));\n }\n return origGetStats.apply(this, arguments);\n };\n}\n\nexport function shimAddTrackRemoveTrackWithNative(window) {\n // shim addTrack/removeTrack with native variants in order to make\n // the interactions with legacy getLocalStreams behave as in other browsers.\n // Keeps a mapping stream.id => [stream, rtpsenders...]\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n return Object.keys(this._shimmedLocalStreams)\n .map(streamId => this._shimmedLocalStreams[streamId][0]);\n };\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n if (!stream) {\n return origAddTrack.apply(this, arguments);\n }\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n\n const sender = origAddTrack.apply(this, arguments);\n if (!this._shimmedLocalStreams[stream.id]) {\n this._shimmedLocalStreams[stream.id] = [stream, sender];\n } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) {\n this._shimmedLocalStreams[stream.id].push(sender);\n }\n return sender;\n };\n\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n\n stream.getTracks().forEach(track => {\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n });\n const existingSenders = this.getSenders();\n origAddStream.apply(this, arguments);\n const newSenders = this.getSenders()\n .filter(newSender => existingSenders.indexOf(newSender) === -1);\n this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders);\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n delete this._shimmedLocalStreams[stream.id];\n return origRemoveStream.apply(this, arguments);\n };\n\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n if (sender) {\n Object.keys(this._shimmedLocalStreams).forEach(streamId => {\n const idx = this._shimmedLocalStreams[streamId].indexOf(sender);\n if (idx !== -1) {\n this._shimmedLocalStreams[streamId].splice(idx, 1);\n }\n if (this._shimmedLocalStreams[streamId].length === 1) {\n delete this._shimmedLocalStreams[streamId];\n }\n });\n }\n return origRemoveTrack.apply(this, arguments);\n };\n}\n\nexport function shimAddTrackRemoveTrack(window, browserDetails) {\n if (!window.RTCPeerConnection) {\n return;\n }\n // shim addTrack and removeTrack.\n if (window.RTCPeerConnection.prototype.addTrack &&\n browserDetails.version >= 65) {\n return shimAddTrackRemoveTrackWithNative(window);\n }\n\n // also shim pc.getLocalStreams when addTrack is shimmed\n // to return the original streams.\n const origGetLocalStreams = window.RTCPeerConnection.prototype\n .getLocalStreams;\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n const nativeStreams = origGetLocalStreams.apply(this);\n this._reverseStreams = this._reverseStreams || {};\n return nativeStreams.map(stream => this._reverseStreams[stream.id]);\n };\n\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n\n stream.getTracks().forEach(track => {\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n });\n // Add identity mapping for consistency with addTrack.\n // Unless this is being used with a stream from addTrack.\n if (!this._reverseStreams[stream.id]) {\n const newStream = new window.MediaStream(stream.getTracks());\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n stream = newStream;\n }\n origAddStream.apply(this, [stream]);\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n\n origRemoveStream.apply(this, [(this._streams[stream.id] || stream)]);\n delete this._reverseStreams[(this._streams[stream.id] ?\n this._streams[stream.id].id : stream.id)];\n delete this._streams[stream.id];\n };\n\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n if (this.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n const streams = [].slice.call(arguments, 1);\n if (streams.length !== 1 ||\n !streams[0].getTracks().find(t => t === track)) {\n // this is not fully correct but all we can manage without\n // [[associated MediaStreams]] internal slot.\n throw new DOMException(\n 'The adapter.js addTrack polyfill only supports a single ' +\n ' stream which is associated with the specified track.',\n 'NotSupportedError');\n }\n\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n const oldStream = this._streams[stream.id];\n if (oldStream) {\n // this is using odd Chrome behaviour, use with caution:\n // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815\n // Note: we rely on the high-level addTrack/dtmf shim to\n // create the sender with a dtmf sender.\n oldStream.addTrack(track);\n\n // Trigger ONN async.\n Promise.resolve().then(() => {\n this.dispatchEvent(new Event('negotiationneeded'));\n });\n } else {\n const newStream = new window.MediaStream([track]);\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n this.addStream(newStream);\n }\n return this.getSenders().find(s => s.track === track);\n };\n\n // replace the internal stream id with the external one and\n // vice versa.\n function replaceInternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach(internalId => {\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(internalStream.id, 'g'),\n externalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp\n });\n }\n function replaceExternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach(internalId => {\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(externalStream.id, 'g'),\n internalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp\n });\n }\n ['createOffer', 'createAnswer'].forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n const args = arguments;\n const isLegacyCall = arguments.length &&\n typeof arguments[0] === 'function';\n if (isLegacyCall) {\n return nativeMethod.apply(this, [\n (description) => {\n const desc = replaceInternalStreamId(this, description);\n args[0].apply(null, [desc]);\n },\n (err) => {\n if (args[1]) {\n args[1].apply(null, err);\n }\n }, arguments[2]\n ]);\n }\n return nativeMethod.apply(this, arguments)\n .then(description => replaceInternalStreamId(this, description));\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n\n const origSetLocalDescription =\n window.RTCPeerConnection.prototype.setLocalDescription;\n window.RTCPeerConnection.prototype.setLocalDescription =\n function setLocalDescription() {\n if (!arguments.length || !arguments[0].type) {\n return origSetLocalDescription.apply(this, arguments);\n }\n arguments[0] = replaceExternalStreamId(this, arguments[0]);\n return origSetLocalDescription.apply(this, arguments);\n };\n\n // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier\n\n const origLocalDescription = Object.getOwnPropertyDescriptor(\n window.RTCPeerConnection.prototype, 'localDescription');\n Object.defineProperty(window.RTCPeerConnection.prototype,\n 'localDescription', {\n get() {\n const description = origLocalDescription.get.apply(this);\n if (description.type === '') {\n return description;\n }\n return replaceInternalStreamId(this, description);\n }\n });\n\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n if (this.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n // We can not yet check for sender instanceof RTCRtpSender\n // since we shim RTPSender. So we check if sender._pc is set.\n if (!sender._pc) {\n throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' +\n 'does not implement interface RTCRtpSender.', 'TypeError');\n }\n const isLocal = sender._pc === this;\n if (!isLocal) {\n throw new DOMException('Sender was not created by this connection.',\n 'InvalidAccessError');\n }\n\n // Search for the native stream the senders track belongs to.\n this._streams = this._streams || {};\n let stream;\n Object.keys(this._streams).forEach(streamid => {\n const hasTrack = this._streams[streamid].getTracks()\n .find(track => sender.track === track);\n if (hasTrack) {\n stream = this._streams[streamid];\n }\n });\n\n if (stream) {\n if (stream.getTracks().length === 1) {\n // if this is the last track of the stream, remove the stream. This\n // takes care of any shimmed _senders.\n this.removeStream(this._reverseStreams[stream.id]);\n } else {\n // relying on the same odd chrome behaviour as above.\n stream.removeTrack(sender.track);\n }\n this.dispatchEvent(new Event('negotiationneeded'));\n }\n };\n}\n\nexport function shimPeerConnection(window, browserDetails) {\n if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.webkitRTCPeerConnection;\n }\n if (!window.RTCPeerConnection) {\n return;\n }\n\n // shim implicit creation of RTCSessionDescription/RTCIceCandidate\n if (browserDetails.version < 53) {\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n window.RTCIceCandidate :\n window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n}\n\n// Attempt to fix ONN in plan-b mode.\nexport function fixNegotiationNeeded(window, browserDetails) {\n utils.wrapPeerConnectionEvent(window, 'negotiationneeded', e => {\n const pc = e.target;\n if (browserDetails.version < 72 || (pc.getConfiguration &&\n pc.getConfiguration().sdpSemantics === 'plan-b')) {\n if (pc.signalingState !== 'stable') {\n return;\n }\n }\n return e;\n });\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nimport * as utils from '../utils.js';\nconst logging = utils.log;\n\nexport function shimGetUserMedia(window, browserDetails) {\n const navigator = window && window.navigator;\n\n if (!navigator.mediaDevices) {\n return;\n }\n\n const constraintsToChrome_ = function(c) {\n if (typeof c !== 'object' || c.mandatory || c.optional) {\n return c;\n }\n const cc = {};\n Object.keys(c).forEach(key => {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n const r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};\n if (r.exact !== undefined && typeof r.exact === 'number') {\n r.min = r.max = r.exact;\n }\n const oldname_ = function(prefix, name) {\n if (prefix) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n }\n return (name === 'deviceId') ? 'sourceId' : name;\n };\n if (r.ideal !== undefined) {\n cc.optional = cc.optional || [];\n let oc = {};\n if (typeof r.ideal === 'number') {\n oc[oldname_('min', key)] = r.ideal;\n cc.optional.push(oc);\n oc = {};\n oc[oldname_('max', key)] = r.ideal;\n cc.optional.push(oc);\n } else {\n oc[oldname_('', key)] = r.ideal;\n cc.optional.push(oc);\n }\n }\n if (r.exact !== undefined && typeof r.exact !== 'number') {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_('', key)] = r.exact;\n } else {\n ['min', 'max'].forEach(mix => {\n if (r[mix] !== undefined) {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(mix, key)] = r[mix];\n }\n });\n }\n });\n if (c.advanced) {\n cc.optional = (cc.optional || []).concat(c.advanced);\n }\n return cc;\n };\n\n const shimConstraints_ = function(constraints, func) {\n if (browserDetails.version >= 61) {\n return func(constraints);\n }\n constraints = JSON.parse(JSON.stringify(constraints));\n if (constraints && typeof constraints.audio === 'object') {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n constraints = JSON.parse(JSON.stringify(constraints));\n remap(constraints.audio, 'autoGainControl', 'googAutoGainControl');\n remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression');\n constraints.audio = constraintsToChrome_(constraints.audio);\n }\n if (constraints && typeof constraints.video === 'object') {\n // Shim facingMode for mobile & surface pro.\n let face = constraints.video.facingMode;\n face = face && ((typeof face === 'object') ? face : {ideal: face});\n const getSupportedFacingModeLies = browserDetails.version < 66;\n\n if ((face && (face.exact === 'user' || face.exact === 'environment' ||\n face.ideal === 'user' || face.ideal === 'environment')) &&\n !(navigator.mediaDevices.getSupportedConstraints &&\n navigator.mediaDevices.getSupportedConstraints().facingMode &&\n !getSupportedFacingModeLies)) {\n delete constraints.video.facingMode;\n let matches;\n if (face.exact === 'environment' || face.ideal === 'environment') {\n matches = ['back', 'rear'];\n } else if (face.exact === 'user' || face.ideal === 'user') {\n matches = ['front'];\n }\n if (matches) {\n // Look for matches in label, or use last cam for back (typical).\n return navigator.mediaDevices.enumerateDevices()\n .then(devices => {\n devices = devices.filter(d => d.kind === 'videoinput');\n let dev = devices.find(d => matches.some(match =>\n d.label.toLowerCase().includes(match)));\n if (!dev && devices.length && matches.includes('back')) {\n dev = devices[devices.length - 1]; // more likely the back cam\n }\n if (dev) {\n constraints.video.deviceId = face.exact\n ? {exact: dev.deviceId}\n : {ideal: dev.deviceId};\n }\n constraints.video = constraintsToChrome_(constraints.video);\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n });\n }\n }\n constraints.video = constraintsToChrome_(constraints.video);\n }\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n };\n\n const shimError_ = function(e) {\n if (browserDetails.version >= 64) {\n return e;\n }\n return {\n name: {\n PermissionDeniedError: 'NotAllowedError',\n PermissionDismissedError: 'NotAllowedError',\n InvalidStateError: 'NotAllowedError',\n DevicesNotFoundError: 'NotFoundError',\n ConstraintNotSatisfiedError: 'OverconstrainedError',\n TrackStartError: 'NotReadableError',\n MediaDeviceFailedDueToShutdown: 'NotAllowedError',\n MediaDeviceKillSwitchOn: 'NotAllowedError',\n TabCaptureError: 'AbortError',\n ScreenCaptureError: 'AbortError',\n DeviceCaptureError: 'AbortError'\n }[e.name] || e.name,\n message: e.message,\n constraint: e.constraint || e.constraintName,\n toString() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n const getUserMedia_ = function(constraints, onSuccess, onError) {\n shimConstraints_(constraints, c => {\n navigator.webkitGetUserMedia(c, onSuccess, e => {\n if (onError) {\n onError(shimError_(e));\n }\n });\n });\n };\n navigator.getUserMedia = getUserMedia_.bind(navigator);\n\n // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia\n // function which returns a Promise, it does not accept spec-style\n // constraints.\n if (navigator.mediaDevices.getUserMedia) {\n const origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(cs) {\n return shimConstraints_(cs, c => origGetUserMedia(c).then(stream => {\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(track => {\n track.stop();\n });\n throw new DOMException('', 'NotFoundError');\n }\n return stream;\n }, e => Promise.reject(shimError_(e))));\n };\n }\n}\n","/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nexport function shimGetDisplayMedia(window, getSourceId) {\n if (window.navigator.mediaDevices &&\n 'getDisplayMedia' in window.navigator.mediaDevices) {\n return;\n }\n if (!(window.navigator.mediaDevices)) {\n return;\n }\n // getSourceId is a function that returns a promise resolving with\n // the sourceId of the screen/window/tab to be shared.\n if (typeof getSourceId !== 'function') {\n console.error('shimGetDisplayMedia: getSourceId argument is not ' +\n 'a function');\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia =\n function getDisplayMedia(constraints) {\n return getSourceId(constraints)\n .then(sourceId => {\n const widthSpecified = constraints.video && constraints.video.width;\n const heightSpecified = constraints.video &&\n constraints.video.height;\n const frameRateSpecified = constraints.video &&\n constraints.video.frameRate;\n constraints.video = {\n mandatory: {\n chromeMediaSource: 'desktop',\n chromeMediaSourceId: sourceId,\n maxFrameRate: frameRateSpecified || 3\n }\n };\n if (widthSpecified) {\n constraints.video.mandatory.maxWidth = widthSpecified;\n }\n if (heightSpecified) {\n constraints.video.mandatory.maxHeight = heightSpecified;\n }\n return window.navigator.mediaDevices.getUserMedia(constraints);\n });\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport * as utils from '../utils';\nexport {shimGetUserMedia} from './getusermedia';\nexport {shimGetDisplayMedia} from './getdisplaymedia';\n\nexport function shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCTrackEvent &&\n ('receiver' in window.RTCTrackEvent.prototype) &&\n !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {receiver: this.receiver};\n }\n });\n }\n}\n\nexport function shimPeerConnection(window, browserDetails) {\n if (typeof window !== 'object' ||\n !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.mozRTCPeerConnection;\n }\n\n if (browserDetails.version < 53) {\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n window.RTCIceCandidate :\n window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n\n const modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n\n const nativeGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n return nativeGetStats.apply(this, [selector || null])\n .then(stats => {\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(stat => {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n stats.forEach((stat, i) => {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n return stats;\n })\n .then(onSucc, onErr);\n };\n}\n\nexport function shimSenderGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender)) {\n return;\n }\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {\n return;\n }\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n window.RTCRtpSender.prototype.getStats = function getStats() {\n return this.track ? this._pc.getStats(this.track) :\n Promise.resolve(new Map());\n };\n}\n\nexport function shimReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender)) {\n return;\n }\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {\n return;\n }\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n return this._pc.getStats(this.track);\n };\n}\n\nexport function shimRemoveStream(window) {\n if (!window.RTCPeerConnection ||\n 'removeStream' in window.RTCPeerConnection.prototype) {\n return;\n }\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n utils.deprecated('removeStream', 'removeTrack');\n this.getSenders().forEach(sender => {\n if (sender.track && stream.getTracks().includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n}\n\nexport function shimRTCDataChannel(window) {\n // rename DataChannel to RTCDataChannel (native fix in FF60):\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851\n if (window.DataChannel && !window.RTCDataChannel) {\n window.RTCDataChannel = window.DataChannel;\n }\n}\n\nexport function shimAddTransceiver(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;\n if (origAddTransceiver) {\n window.RTCPeerConnection.prototype.addTransceiver =\n function addTransceiver() {\n this.setParametersPromises = [];\n // WebIDL input coercion and validation\n let sendEncodings = arguments[1] && arguments[1].sendEncodings;\n if (sendEncodings === undefined) {\n sendEncodings = [];\n }\n sendEncodings = [...sendEncodings];\n const shouldPerformCheck = sendEncodings.length > 0;\n if (shouldPerformCheck) {\n // If sendEncodings params are provided, validate grammar\n sendEncodings.forEach((encodingParam) => {\n if ('rid' in encodingParam) {\n const ridRegex = /^[a-z0-9]{0,16}$/i;\n if (!ridRegex.test(encodingParam.rid)) {\n throw new TypeError('Invalid RID value provided.');\n }\n }\n if ('scaleResolutionDownBy' in encodingParam) {\n if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {\n throw new RangeError('scale_resolution_down_by must be >= 1.0');\n }\n }\n if ('maxFramerate' in encodingParam) {\n if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {\n throw new RangeError('max_framerate must be >= 0.0');\n }\n }\n });\n }\n const transceiver = origAddTransceiver.apply(this, arguments);\n if (shouldPerformCheck) {\n // Check if the init options were applied. If not we do this in an\n // asynchronous way and save the promise reference in a global object.\n // This is an ugly hack, but at the same time is way more robust than\n // checking the sender parameters before and after the createOffer\n // Also note that after the createoffer we are not 100% sure that\n // the params were asynchronously applied so we might miss the\n // opportunity to recreate offer.\n const {sender} = transceiver;\n const params = sender.getParameters();\n if (!('encodings' in params) ||\n // Avoid being fooled by patched getParameters() below.\n (params.encodings.length === 1 &&\n Object.keys(params.encodings[0]).length === 0)) {\n params.encodings = sendEncodings;\n sender.sendEncodings = sendEncodings;\n this.setParametersPromises.push(sender.setParameters(params)\n .then(() => {\n delete sender.sendEncodings;\n }).catch(() => {\n delete sender.sendEncodings;\n })\n );\n }\n }\n return transceiver;\n };\n }\n}\n\nexport function shimGetParameters(window) {\n if (!(typeof window === 'object' && window.RTCRtpSender)) {\n return;\n }\n const origGetParameters = window.RTCRtpSender.prototype.getParameters;\n if (origGetParameters) {\n window.RTCRtpSender.prototype.getParameters =\n function getParameters() {\n const params = origGetParameters.apply(this, arguments);\n if (!('encodings' in params)) {\n params.encodings = [].concat(this.sendEncodings || [{}]);\n }\n return params;\n };\n }\n}\n\nexport function shimCreateOffer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer = function createOffer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises)\n .then(() => {\n return origCreateOffer.apply(this, arguments);\n })\n .finally(() => {\n this.setParametersPromises = [];\n });\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\n\nexport function shimCreateAnswer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;\n window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises)\n .then(() => {\n return origCreateAnswer.apply(this, arguments);\n })\n .finally(() => {\n this.setParametersPromises = [];\n });\n }\n return origCreateAnswer.apply(this, arguments);\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport * as utils from '../utils';\n\nexport function shimGetUserMedia(window, browserDetails) {\n const navigator = window && window.navigator;\n const MediaStreamTrack = window && window.MediaStreamTrack;\n\n navigator.getUserMedia = function(constraints, onSuccess, onError) {\n // Replace Firefox 44+'s deprecation warning with unprefixed version.\n utils.deprecated('navigator.getUserMedia',\n 'navigator.mediaDevices.getUserMedia');\n navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);\n };\n\n if (!(browserDetails.version > 55 &&\n 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n\n const nativeGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n if (typeof c === 'object' && typeof c.audio === 'object') {\n c = JSON.parse(JSON.stringify(c));\n remap(c.audio, 'autoGainControl', 'mozAutoGainControl');\n remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression');\n }\n return nativeGetUserMedia(c);\n };\n\n if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {\n const nativeGetSettings = MediaStreamTrack.prototype.getSettings;\n MediaStreamTrack.prototype.getSettings = function() {\n const obj = nativeGetSettings.apply(this, arguments);\n remap(obj, 'mozAutoGainControl', 'autoGainControl');\n remap(obj, 'mozNoiseSuppression', 'noiseSuppression');\n return obj;\n };\n }\n\n if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {\n const nativeApplyConstraints =\n MediaStreamTrack.prototype.applyConstraints;\n MediaStreamTrack.prototype.applyConstraints = function(c) {\n if (this.kind === 'audio' && typeof c === 'object') {\n c = JSON.parse(JSON.stringify(c));\n remap(c, 'autoGainControl', 'mozAutoGainControl');\n remap(c, 'noiseSuppression', 'mozNoiseSuppression');\n }\n return nativeApplyConstraints.apply(this, [c]);\n };\n }\n }\n}\n","/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nexport function shimGetDisplayMedia(window, preferredMediaSource) {\n if (window.navigator.mediaDevices &&\n 'getDisplayMedia' in window.navigator.mediaDevices) {\n return;\n }\n if (!(window.navigator.mediaDevices)) {\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia =\n function getDisplayMedia(constraints) {\n if (!(constraints && constraints.video)) {\n const err = new DOMException('getDisplayMedia without video ' +\n 'constraints is undefined');\n err.name = 'NotFoundError';\n // from https://heycam.github.io/webidl/#idl-DOMException-error-names\n err.code = 8;\n return Promise.reject(err);\n }\n if (constraints.video === true) {\n constraints.video = {mediaSource: preferredMediaSource};\n } else {\n constraints.video.mediaSource = preferredMediaSource;\n }\n return window.navigator.mediaDevices.getUserMedia(constraints);\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n'use strict';\nimport * as utils from '../utils';\n\nexport function shimLocalStreamsAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n return this._localStreams;\n };\n }\n if (!('addStream' in window.RTCPeerConnection.prototype)) {\n const _addTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n if (!this._localStreams.includes(stream)) {\n this._localStreams.push(stream);\n }\n // Try to emulate Chrome's behaviour of adding in audio-video order.\n // Safari orders by track id.\n stream.getAudioTracks().forEach(track => _addTrack.call(this, track,\n stream));\n stream.getVideoTracks().forEach(track => _addTrack.call(this, track,\n stream));\n };\n\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, ...streams) {\n if (streams) {\n streams.forEach((stream) => {\n if (!this._localStreams) {\n this._localStreams = [stream];\n } else if (!this._localStreams.includes(stream)) {\n this._localStreams.push(stream);\n }\n });\n }\n return _addTrack.apply(this, arguments);\n };\n }\n if (!('removeStream' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n const index = this._localStreams.indexOf(stream);\n if (index === -1) {\n return;\n }\n this._localStreams.splice(index, 1);\n const tracks = stream.getTracks();\n this.getSenders().forEach(sender => {\n if (tracks.includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n }\n}\n\nexport function shimRemoteStreamsAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.getRemoteStreams =\n function getRemoteStreams() {\n return this._remoteStreams ? this._remoteStreams : [];\n };\n }\n if (!('onaddstream' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {\n get() {\n return this._onaddstream;\n },\n set(f) {\n if (this._onaddstream) {\n this.removeEventListener('addstream', this._onaddstream);\n this.removeEventListener('track', this._onaddstreampoly);\n }\n this.addEventListener('addstream', this._onaddstream = f);\n this.addEventListener('track', this._onaddstreampoly = (e) => {\n e.streams.forEach(stream => {\n if (!this._remoteStreams) {\n this._remoteStreams = [];\n }\n if (this._remoteStreams.includes(stream)) {\n return;\n }\n this._remoteStreams.push(stream);\n const event = new Event('addstream');\n event.stream = stream;\n this.dispatchEvent(event);\n });\n });\n }\n });\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n const pc = this;\n if (!this._onaddstreampoly) {\n this.addEventListener('track', this._onaddstreampoly = function(e) {\n e.streams.forEach(stream => {\n if (!pc._remoteStreams) {\n pc._remoteStreams = [];\n }\n if (pc._remoteStreams.indexOf(stream) >= 0) {\n return;\n }\n pc._remoteStreams.push(stream);\n const event = new Event('addstream');\n event.stream = stream;\n pc.dispatchEvent(event);\n });\n });\n }\n return origSetRemoteDescription.apply(pc, arguments);\n };\n }\n}\n\nexport function shimCallbacksAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n const prototype = window.RTCPeerConnection.prototype;\n const origCreateOffer = prototype.createOffer;\n const origCreateAnswer = prototype.createAnswer;\n const setLocalDescription = prototype.setLocalDescription;\n const setRemoteDescription = prototype.setRemoteDescription;\n const addIceCandidate = prototype.addIceCandidate;\n\n prototype.createOffer =\n function createOffer(successCallback, failureCallback) {\n const options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n const promise = origCreateOffer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n prototype.createAnswer =\n function createAnswer(successCallback, failureCallback) {\n const options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n const promise = origCreateAnswer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n let withCallback = function(description, successCallback, failureCallback) {\n const promise = setLocalDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setLocalDescription = withCallback;\n\n withCallback = function(description, successCallback, failureCallback) {\n const promise = setRemoteDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setRemoteDescription = withCallback;\n\n withCallback = function(candidate, successCallback, failureCallback) {\n const promise = addIceCandidate.apply(this, [candidate]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.addIceCandidate = withCallback;\n}\n\nexport function shimGetUserMedia(window) {\n const navigator = window && window.navigator;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n // shim not needed in Safari 12.1\n const mediaDevices = navigator.mediaDevices;\n const _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);\n navigator.mediaDevices.getUserMedia = (constraints) => {\n return _getUserMedia(shimConstraints(constraints));\n };\n }\n\n if (!navigator.getUserMedia && navigator.mediaDevices &&\n navigator.mediaDevices.getUserMedia) {\n navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) {\n navigator.mediaDevices.getUserMedia(constraints)\n .then(cb, errcb);\n }.bind(navigator);\n }\n}\n\nexport function shimConstraints(constraints) {\n if (constraints && constraints.video !== undefined) {\n return Object.assign({},\n constraints,\n {video: utils.compactObject(constraints.video)}\n );\n }\n\n return constraints;\n}\n\nexport function shimRTCIceServerUrls(window) {\n if (!window.RTCPeerConnection) {\n return;\n }\n // migrate from non-spec RTCIceServer.url to RTCIceServer.urls\n const OrigPeerConnection = window.RTCPeerConnection;\n window.RTCPeerConnection =\n function RTCPeerConnection(pcConfig, pcConstraints) {\n if (pcConfig && pcConfig.iceServers) {\n const newIceServers = [];\n for (let i = 0; i < pcConfig.iceServers.length; i++) {\n let server = pcConfig.iceServers[i];\n if (server.urls === undefined && server.url) {\n utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');\n server = JSON.parse(JSON.stringify(server));\n server.urls = server.url;\n delete server.url;\n newIceServers.push(server);\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n return new OrigPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n if ('generateCertificate' in OrigPeerConnection) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get() {\n return OrigPeerConnection.generateCertificate;\n }\n });\n }\n}\n\nexport function shimTrackEventTransceiver(window) {\n // Add event.transceiver member over deprecated event.receiver\n if (typeof window === 'object' && window.RTCTrackEvent &&\n 'receiver' in window.RTCTrackEvent.prototype &&\n !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {receiver: this.receiver};\n }\n });\n }\n}\n\nexport function shimCreateOfferLegacy(window) {\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer =\n function createOffer(offerOptions) {\n if (offerOptions) {\n if (typeof offerOptions.offerToReceiveAudio !== 'undefined') {\n // support bit values\n offerOptions.offerToReceiveAudio =\n !!offerOptions.offerToReceiveAudio;\n }\n const audioTransceiver = this.getTransceivers().find(transceiver =>\n transceiver.receiver.track.kind === 'audio');\n if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {\n if (audioTransceiver.direction === 'sendrecv') {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection('sendonly');\n } else {\n audioTransceiver.direction = 'sendonly';\n }\n } else if (audioTransceiver.direction === 'recvonly') {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection('inactive');\n } else {\n audioTransceiver.direction = 'inactive';\n }\n }\n } else if (offerOptions.offerToReceiveAudio === true &&\n !audioTransceiver) {\n this.addTransceiver('audio', {direction: 'recvonly'});\n }\n\n if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {\n // support bit values\n offerOptions.offerToReceiveVideo =\n !!offerOptions.offerToReceiveVideo;\n }\n const videoTransceiver = this.getTransceivers().find(transceiver =>\n transceiver.receiver.track.kind === 'video');\n if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {\n if (videoTransceiver.direction === 'sendrecv') {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection('sendonly');\n } else {\n videoTransceiver.direction = 'sendonly';\n }\n } else if (videoTransceiver.direction === 'recvonly') {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection('inactive');\n } else {\n videoTransceiver.direction = 'inactive';\n }\n }\n } else if (offerOptions.offerToReceiveVideo === true &&\n !videoTransceiver) {\n this.addTransceiver('video', {direction: 'recvonly'});\n }\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\n\nexport function shimAudioContext(window) {\n if (typeof window !== 'object' || window.AudioContext) {\n return;\n }\n window.AudioContext = window.webkitAudioContext;\n}\n\n","/*\n * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport SDPUtils from 'sdp';\nimport * as utils from './utils';\n\nexport function shimRTCIceCandidate(window) {\n // foundation is arbitrarily chosen as an indicator for full support for\n // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface\n if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'foundation' in\n window.RTCIceCandidate.prototype)) {\n return;\n }\n\n const NativeRTCIceCandidate = window.RTCIceCandidate;\n window.RTCIceCandidate = function RTCIceCandidate(args) {\n // Remove the a= which shouldn't be part of the candidate string.\n if (typeof args === 'object' && args.candidate &&\n args.candidate.indexOf('a=') === 0) {\n args = JSON.parse(JSON.stringify(args));\n args.candidate = args.candidate.substring(2);\n }\n\n if (args.candidate && args.candidate.length) {\n // Augment the native candidate with the parsed fields.\n const nativeCandidate = new NativeRTCIceCandidate(args);\n const parsedCandidate = SDPUtils.parseCandidate(args.candidate);\n for (const key in parsedCandidate) {\n if (!(key in nativeCandidate)) {\n Object.defineProperty(nativeCandidate, key,\n {value: parsedCandidate[key]});\n }\n }\n\n // Override serializer to not serialize the extra attributes.\n nativeCandidate.toJSON = function toJSON() {\n return {\n candidate: nativeCandidate.candidate,\n sdpMid: nativeCandidate.sdpMid,\n sdpMLineIndex: nativeCandidate.sdpMLineIndex,\n usernameFragment: nativeCandidate.usernameFragment,\n };\n };\n return nativeCandidate;\n }\n return new NativeRTCIceCandidate(args);\n };\n window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;\n\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n utils.wrapPeerConnectionEvent(window, 'icecandidate', e => {\n if (e.candidate) {\n Object.defineProperty(e, 'candidate', {\n value: new window.RTCIceCandidate(e.candidate),\n writable: 'false'\n });\n }\n return e;\n });\n}\n\nexport function shimRTCIceCandidateRelayProtocol(window) {\n if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'relayProtocol' in\n window.RTCIceCandidate.prototype)) {\n return;\n }\n\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n utils.wrapPeerConnectionEvent(window, 'icecandidate', e => {\n if (e.candidate) {\n const parsedCandidate = SDPUtils.parseCandidate(e.candidate.candidate);\n if (parsedCandidate.type === 'relay') {\n // This is a libwebrtc-specific mapping of local type preference\n // to relayProtocol.\n e.candidate.relayProtocol = {\n 0: 'tls',\n 1: 'tcp',\n 2: 'udp',\n }[parsedCandidate.priority >> 24];\n }\n }\n return e;\n });\n}\n\nexport function shimMaxMessageSize(window, browserDetails) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n if (!('sctp' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {\n get() {\n return typeof this._sctp === 'undefined' ? null : this._sctp;\n }\n });\n }\n\n const sctpInDescription = function(description) {\n if (!description || !description.sdp) {\n return false;\n }\n const sections = SDPUtils.splitSections(description.sdp);\n sections.shift();\n return sections.some(mediaSection => {\n const mLine = SDPUtils.parseMLine(mediaSection);\n return mLine && mLine.kind === 'application'\n && mLine.protocol.indexOf('SCTP') !== -1;\n });\n };\n\n const getRemoteFirefoxVersion = function(description) {\n // TODO: Is there a better solution for detecting Firefox?\n const match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\\d+)/);\n if (match === null || match.length < 2) {\n return -1;\n }\n const version = parseInt(match[1], 10);\n // Test for NaN (yes, this is ugly)\n return version !== version ? -1 : version;\n };\n\n const getCanSendMaxMessageSize = function(remoteIsFirefox) {\n // Every implementation we know can send at least 64 KiB.\n // Note: Although Chrome is technically able to send up to 256 KiB, the\n // data does not reach the other peer reliably.\n // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419\n let canSendMaxMessageSize = 65536;\n if (browserDetails.browser === 'firefox') {\n if (browserDetails.version < 57) {\n if (remoteIsFirefox === -1) {\n // FF < 57 will send in 16 KiB chunks using the deprecated PPID\n // fragmentation.\n canSendMaxMessageSize = 16384;\n } else {\n // However, other FF (and RAWRTC) can reassemble PPID-fragmented\n // messages. Thus, supporting ~2 GiB when sending.\n canSendMaxMessageSize = 2147483637;\n }\n } else if (browserDetails.version < 60) {\n // Currently, all FF >= 57 will reset the remote maximum message size\n // to the default value when a data channel is created at a later\n // stage. :(\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n canSendMaxMessageSize =\n browserDetails.version === 57 ? 65535 : 65536;\n } else {\n // FF >= 60 supports sending ~2 GiB\n canSendMaxMessageSize = 2147483637;\n }\n }\n return canSendMaxMessageSize;\n };\n\n const getMaxMessageSize = function(description, remoteIsFirefox) {\n // Note: 65536 bytes is the default value from the SDP spec. Also,\n // every implementation we know supports receiving 65536 bytes.\n let maxMessageSize = 65536;\n\n // FF 57 has a slightly incorrect default remote max message size, so\n // we need to adjust it here to avoid a failure when sending.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697\n if (browserDetails.browser === 'firefox'\n && browserDetails.version === 57) {\n maxMessageSize = 65535;\n }\n\n const match = SDPUtils.matchPrefix(description.sdp,\n 'a=max-message-size:');\n if (match.length > 0) {\n maxMessageSize = parseInt(match[0].substring(19), 10);\n } else if (browserDetails.browser === 'firefox' &&\n remoteIsFirefox !== -1) {\n // If the maximum message size is not present in the remote SDP and\n // both local and remote are Firefox, the remote peer can receive\n // ~2 GiB.\n maxMessageSize = 2147483637;\n }\n return maxMessageSize;\n };\n\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n this._sctp = null;\n // Chrome decided to not expose .sctp in plan-b mode.\n // As usual, adapter.js has to do an 'ugly worakaround'\n // to cover up the mess.\n if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {\n const {sdpSemantics} = this.getConfiguration();\n if (sdpSemantics === 'plan-b') {\n Object.defineProperty(this, 'sctp', {\n get() {\n return typeof this._sctp === 'undefined' ? null : this._sctp;\n },\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n if (sctpInDescription(arguments[0])) {\n // Check if the remote is FF.\n const isFirefox = getRemoteFirefoxVersion(arguments[0]);\n\n // Get the maximum message size the local peer is capable of sending\n const canSendMMS = getCanSendMaxMessageSize(isFirefox);\n\n // Get the maximum message size of the remote peer.\n const remoteMMS = getMaxMessageSize(arguments[0], isFirefox);\n\n // Determine final maximum message size\n let maxMessageSize;\n if (canSendMMS === 0 && remoteMMS === 0) {\n maxMessageSize = Number.POSITIVE_INFINITY;\n } else if (canSendMMS === 0 || remoteMMS === 0) {\n maxMessageSize = Math.max(canSendMMS, remoteMMS);\n } else {\n maxMessageSize = Math.min(canSendMMS, remoteMMS);\n }\n\n // Create a dummy RTCSctpTransport object and the 'maxMessageSize'\n // attribute.\n const sctp = {};\n Object.defineProperty(sctp, 'maxMessageSize', {\n get() {\n return maxMessageSize;\n }\n });\n this._sctp = sctp;\n }\n\n return origSetRemoteDescription.apply(this, arguments);\n };\n}\n\nexport function shimSendThrowTypeError(window) {\n if (!(window.RTCPeerConnection &&\n 'createDataChannel' in window.RTCPeerConnection.prototype)) {\n return;\n }\n\n // Note: Although Firefox >= 57 has a native implementation, the maximum\n // message size can be reset for all data channels at a later stage.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n\n function wrapDcSend(dc, pc) {\n const origDataChannelSend = dc.send;\n dc.send = function send() {\n const data = arguments[0];\n const length = data.length || data.size || data.byteLength;\n if (dc.readyState === 'open' &&\n pc.sctp && length > pc.sctp.maxMessageSize) {\n throw new TypeError('Message too large (can send a maximum of ' +\n pc.sctp.maxMessageSize + ' bytes)');\n }\n return origDataChannelSend.apply(dc, arguments);\n };\n }\n const origCreateDataChannel =\n window.RTCPeerConnection.prototype.createDataChannel;\n window.RTCPeerConnection.prototype.createDataChannel =\n function createDataChannel() {\n const dataChannel = origCreateDataChannel.apply(this, arguments);\n wrapDcSend(dataChannel, this);\n return dataChannel;\n };\n utils.wrapPeerConnectionEvent(window, 'datachannel', e => {\n wrapDcSend(e.channel, e.target);\n return e;\n });\n}\n\n\n/* shims RTCConnectionState by pretending it is the same as iceConnectionState.\n * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12\n * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect\n * since DTLS failures would be hidden. See\n * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827\n * for the Firefox tracking bug.\n */\nexport function shimConnectionState(window) {\n if (!window.RTCPeerConnection ||\n 'connectionState' in window.RTCPeerConnection.prototype) {\n return;\n }\n const proto = window.RTCPeerConnection.prototype;\n Object.defineProperty(proto, 'connectionState', {\n get() {\n return {\n completed: 'connected',\n checking: 'connecting'\n }[this.iceConnectionState] || this.iceConnectionState;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(proto, 'onconnectionstatechange', {\n get() {\n return this._onconnectionstatechange || null;\n },\n set(cb) {\n if (this._onconnectionstatechange) {\n this.removeEventListener('connectionstatechange',\n this._onconnectionstatechange);\n delete this._onconnectionstatechange;\n }\n if (cb) {\n this.addEventListener('connectionstatechange',\n this._onconnectionstatechange = cb);\n }\n },\n enumerable: true,\n configurable: true\n });\n\n ['setLocalDescription', 'setRemoteDescription'].forEach((method) => {\n const origMethod = proto[method];\n proto[method] = function() {\n if (!this._connectionstatechangepoly) {\n this._connectionstatechangepoly = e => {\n const pc = e.target;\n if (pc._lastConnectionState !== pc.connectionState) {\n pc._lastConnectionState = pc.connectionState;\n const newEvent = new Event('connectionstatechange', e);\n pc.dispatchEvent(newEvent);\n }\n return e;\n };\n this.addEventListener('iceconnectionstatechange',\n this._connectionstatechangepoly);\n }\n return origMethod.apply(this, arguments);\n };\n });\n}\n\nexport function removeExtmapAllowMixed(window, browserDetails) {\n /* remove a=extmap-allow-mixed for webrtc.org < M71 */\n if (!window.RTCPeerConnection) {\n return;\n }\n if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) {\n return;\n }\n if (browserDetails.browser === 'safari' && browserDetails.version >= 605) {\n return;\n }\n const nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription(desc) {\n if (desc && desc.sdp && desc.sdp.indexOf('\\na=extmap-allow-mixed') !== -1) {\n const sdp = desc.sdp.split('\\n').filter((line) => {\n return line.trim() !== 'a=extmap-allow-mixed';\n }).join('\\n');\n // Safari enforces read-only-ness of RTCSessionDescription fields.\n if (window.RTCSessionDescription &&\n desc instanceof window.RTCSessionDescription) {\n arguments[0] = new window.RTCSessionDescription({\n type: desc.type,\n sdp,\n });\n } else {\n desc.sdp = sdp;\n }\n }\n return nativeSRD.apply(this, arguments);\n };\n}\n\nexport function shimAddIceCandidateNullOrEmpty(window, browserDetails) {\n // Support for addIceCandidate(null or undefined)\n // as well as addIceCandidate({candidate: \"\", ...})\n // https://bugs.chromium.org/p/chromium/issues/detail?id=978582\n // Note: must be called before other polyfills which change the signature.\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) {\n return;\n }\n const nativeAddIceCandidate =\n window.RTCPeerConnection.prototype.addIceCandidate;\n if (!nativeAddIceCandidate || nativeAddIceCandidate.length === 0) {\n return;\n }\n window.RTCPeerConnection.prototype.addIceCandidate =\n function addIceCandidate() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n // Firefox 68+ emits and processes {candidate: \"\", ...}, ignore\n // in older versions.\n // Native support for ignoring exists for Chrome M77+.\n // Safari ignores as well, exact version unknown but works in the same\n // version that also ignores addIceCandidate(null).\n if (((browserDetails.browser === 'chrome' && browserDetails.version < 78)\n || (browserDetails.browser === 'firefox'\n && browserDetails.version < 68)\n || (browserDetails.browser === 'safari'))\n && arguments[0] && arguments[0].candidate === '') {\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n}\n\n// Note: Make sure to call this ahead of APIs that modify\n// setLocalDescription.length\nexport function shimParameterlessSetLocalDescription(window, browserDetails) {\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) {\n return;\n }\n const nativeSetLocalDescription =\n window.RTCPeerConnection.prototype.setLocalDescription;\n if (!nativeSetLocalDescription || nativeSetLocalDescription.length === 0) {\n return;\n }\n window.RTCPeerConnection.prototype.setLocalDescription =\n function setLocalDescription() {\n let desc = arguments[0] || {};\n if (typeof desc !== 'object' || (desc.type && desc.sdp)) {\n return nativeSetLocalDescription.apply(this, arguments);\n }\n // The remaining steps should technically happen when SLD comes off the\n // RTCPeerConnection's operations chain (not ahead of going on it), but\n // this is too difficult to shim. Instead, this shim only covers the\n // common case where the operations chain is empty. This is imperfect, but\n // should cover many cases. Rationale: Even if we can't reduce the glare\n // window to zero on imperfect implementations, there's value in tapping\n // into the perfect negotiation pattern that several browsers support.\n desc = {type: desc.type, sdp: desc.sdp};\n if (!desc.type) {\n switch (this.signalingState) {\n case 'stable':\n case 'have-local-offer':\n case 'have-remote-pranswer':\n desc.type = 'offer';\n break;\n default:\n desc.type = 'answer';\n break;\n }\n }\n if (desc.sdp || (desc.type !== 'offer' && desc.type !== 'answer')) {\n return nativeSetLocalDescription.apply(this, [desc]);\n }\n const func = desc.type === 'offer' ? this.createOffer : this.createAnswer;\n return func.apply(this)\n .then(d => nativeSetLocalDescription.apply(this, [d]));\n };\n}\n","/* eslint-env node */\n'use strict';\n\n// SDP helpers.\nconst SDPUtils = {};\n\n// Generate an alphanumeric identifier for cname or mids.\n// TODO: use UUIDs instead? https://gist.github.com/jed/982883\nSDPUtils.generateIdentifier = function() {\n return Math.random().toString(36).substring(2, 12);\n};\n\n// The RTCP CNAME used by all peerconnections from the same JS.\nSDPUtils.localCName = SDPUtils.generateIdentifier();\n\n// Splits SDP into lines, dealing with both CRLF and LF.\nSDPUtils.splitLines = function(blob) {\n return blob.trim().split('\\n').map(line => line.trim());\n};\n// Splits SDP into sessionpart and mediasections. Ensures CRLF.\nSDPUtils.splitSections = function(blob) {\n const parts = blob.split('\\nm=');\n return parts.map((part, index) => (index > 0 ?\n 'm=' + part : part).trim() + '\\r\\n');\n};\n\n// Returns the session description.\nSDPUtils.getDescription = function(blob) {\n const sections = SDPUtils.splitSections(blob);\n return sections && sections[0];\n};\n\n// Returns the individual media sections.\nSDPUtils.getMediaSections = function(blob) {\n const sections = SDPUtils.splitSections(blob);\n sections.shift();\n return sections;\n};\n\n// Returns lines that start with a certain prefix.\nSDPUtils.matchPrefix = function(blob, prefix) {\n return SDPUtils.splitLines(blob).filter(line => line.indexOf(prefix) === 0);\n};\n\n// Parses an ICE candidate line. Sample input:\n// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8\n// rport 55996\"\n// Input can be prefixed with a=.\nSDPUtils.parseCandidate = function(line) {\n let parts;\n // Parse both variants.\n if (line.indexOf('a=candidate:') === 0) {\n parts = line.substring(12).split(' ');\n } else {\n parts = line.substring(10).split(' ');\n }\n\n const candidate = {\n foundation: parts[0],\n component: {1: 'rtp', 2: 'rtcp'}[parts[1]] || parts[1],\n protocol: parts[2].toLowerCase(),\n priority: parseInt(parts[3], 10),\n ip: parts[4],\n address: parts[4], // address is an alias for ip.\n port: parseInt(parts[5], 10),\n // skip parts[6] == 'typ'\n type: parts[7],\n };\n\n for (let i = 8; i < parts.length; i += 2) {\n switch (parts[i]) {\n case 'raddr':\n candidate.relatedAddress = parts[i + 1];\n break;\n case 'rport':\n candidate.relatedPort = parseInt(parts[i + 1], 10);\n break;\n case 'tcptype':\n candidate.tcpType = parts[i + 1];\n break;\n case 'ufrag':\n candidate.ufrag = parts[i + 1]; // for backward compatibility.\n candidate.usernameFragment = parts[i + 1];\n break;\n default: // extension handling, in particular ufrag. Don't overwrite.\n if (candidate[parts[i]] === undefined) {\n candidate[parts[i]] = parts[i + 1];\n }\n break;\n }\n }\n return candidate;\n};\n\n// Translates a candidate object into SDP candidate attribute.\n// This does not include the a= prefix!\nSDPUtils.writeCandidate = function(candidate) {\n const sdp = [];\n sdp.push(candidate.foundation);\n\n const component = candidate.component;\n if (component === 'rtp') {\n sdp.push(1);\n } else if (component === 'rtcp') {\n sdp.push(2);\n } else {\n sdp.push(component);\n }\n sdp.push(candidate.protocol.toUpperCase());\n sdp.push(candidate.priority);\n sdp.push(candidate.address || candidate.ip);\n sdp.push(candidate.port);\n\n const type = candidate.type;\n sdp.push('typ');\n sdp.push(type);\n if (type !== 'host' && candidate.relatedAddress &&\n candidate.relatedPort) {\n sdp.push('raddr');\n sdp.push(candidate.relatedAddress);\n sdp.push('rport');\n sdp.push(candidate.relatedPort);\n }\n if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {\n sdp.push('tcptype');\n sdp.push(candidate.tcpType);\n }\n if (candidate.usernameFragment || candidate.ufrag) {\n sdp.push('ufrag');\n sdp.push(candidate.usernameFragment || candidate.ufrag);\n }\n return 'candidate:' + sdp.join(' ');\n};\n\n// Parses an ice-options line, returns an array of option tags.\n// Sample input:\n// a=ice-options:foo bar\nSDPUtils.parseIceOptions = function(line) {\n return line.substring(14).split(' ');\n};\n\n// Parses a rtpmap line, returns RTCRtpCoddecParameters. Sample input:\n// a=rtpmap:111 opus/48000/2\nSDPUtils.parseRtpMap = function(line) {\n let parts = line.substring(9).split(' ');\n const parsed = {\n payloadType: parseInt(parts.shift(), 10), // was: id\n };\n\n parts = parts[0].split('/');\n\n parsed.name = parts[0];\n parsed.clockRate = parseInt(parts[1], 10); // was: clockrate\n parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;\n // legacy alias, got renamed back to channels in ORTC.\n parsed.numChannels = parsed.channels;\n return parsed;\n};\n\n// Generates a rtpmap line from RTCRtpCodecCapability or\n// RTCRtpCodecParameters.\nSDPUtils.writeRtpMap = function(codec) {\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n const channels = codec.channels || codec.numChannels || 1;\n return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate +\n (channels !== 1 ? '/' + channels : '') + '\\r\\n';\n};\n\n// Parses a extmap line (headerextension from RFC 5285). Sample input:\n// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\n// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset\nSDPUtils.parseExtmap = function(line) {\n const parts = line.substring(9).split(' ');\n return {\n id: parseInt(parts[0], 10),\n direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',\n uri: parts[1],\n attributes: parts.slice(2).join(' '),\n };\n};\n\n// Generates an extmap line from RTCRtpHeaderExtensionParameters or\n// RTCRtpHeaderExtension.\nSDPUtils.writeExtmap = function(headerExtension) {\n return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) +\n (headerExtension.direction && headerExtension.direction !== 'sendrecv'\n ? '/' + headerExtension.direction\n : '') +\n ' ' + headerExtension.uri +\n (headerExtension.attributes ? ' ' + headerExtension.attributes : '') +\n '\\r\\n';\n};\n\n// Parses a fmtp line, returns dictionary. Sample input:\n// a=fmtp:96 vbr=on;cng=on\n// Also deals with vbr=on; cng=on\nSDPUtils.parseFmtp = function(line) {\n const parsed = {};\n let kv;\n const parts = line.substring(line.indexOf(' ') + 1).split(';');\n for (let j = 0; j < parts.length; j++) {\n kv = parts[j].trim().split('=');\n parsed[kv[0].trim()] = kv[1];\n }\n return parsed;\n};\n\n// Generates a fmtp line from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeFmtp = function(codec) {\n let line = '';\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.parameters && Object.keys(codec.parameters).length) {\n const params = [];\n Object.keys(codec.parameters).forEach(param => {\n if (codec.parameters[param] !== undefined) {\n params.push(param + '=' + codec.parameters[param]);\n } else {\n params.push(param);\n }\n });\n line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\\r\\n';\n }\n return line;\n};\n\n// Parses a rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:\n// a=rtcp-fb:98 nack rpsi\nSDPUtils.parseRtcpFb = function(line) {\n const parts = line.substring(line.indexOf(' ') + 1).split(' ');\n return {\n type: parts.shift(),\n parameter: parts.join(' '),\n };\n};\n\n// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeRtcpFb = function(codec) {\n let lines = '';\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.rtcpFeedback && codec.rtcpFeedback.length) {\n // FIXME: special handling for trr-int?\n codec.rtcpFeedback.forEach(fb => {\n lines += 'a=rtcp-fb:' + pt + ' ' + fb.type +\n (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') +\n '\\r\\n';\n });\n }\n return lines;\n};\n\n// Parses a RFC 5576 ssrc media attribute. Sample input:\n// a=ssrc:3735928559 cname:something\nSDPUtils.parseSsrcMedia = function(line) {\n const sp = line.indexOf(' ');\n const parts = {\n ssrc: parseInt(line.substring(7, sp), 10),\n };\n const colon = line.indexOf(':', sp);\n if (colon > -1) {\n parts.attribute = line.substring(sp + 1, colon);\n parts.value = line.substring(colon + 1);\n } else {\n parts.attribute = line.substring(sp + 1);\n }\n return parts;\n};\n\n// Parse a ssrc-group line (see RFC 5576). Sample input:\n// a=ssrc-group:semantics 12 34\nSDPUtils.parseSsrcGroup = function(line) {\n const parts = line.substring(13).split(' ');\n return {\n semantics: parts.shift(),\n ssrcs: parts.map(ssrc => parseInt(ssrc, 10)),\n };\n};\n\n// Extracts the MID (RFC 5888) from a media section.\n// Returns the MID or undefined if no mid line was found.\nSDPUtils.getMid = function(mediaSection) {\n const mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];\n if (mid) {\n return mid.substring(6);\n }\n};\n\n// Parses a fingerprint line for DTLS-SRTP.\nSDPUtils.parseFingerprint = function(line) {\n const parts = line.substring(14).split(' ');\n return {\n algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge.\n value: parts[1].toUpperCase(), // the definition is upper-case in RFC 4572.\n };\n};\n\n// Extracts DTLS parameters from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the fingerprint line as input. See also getIceParameters.\nSDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {\n const lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=fingerprint:');\n // Note: a=setup line is ignored since we use the 'auto' role in Edge.\n return {\n role: 'auto',\n fingerprints: lines.map(SDPUtils.parseFingerprint),\n };\n};\n\n// Serializes DTLS parameters to SDP.\nSDPUtils.writeDtlsParameters = function(params, setupType) {\n let sdp = 'a=setup:' + setupType + '\\r\\n';\n params.fingerprints.forEach(fp => {\n sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\\r\\n';\n });\n return sdp;\n};\n\n// Parses a=crypto lines into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#dictionary-rtcsrtpsdesparameters-members\nSDPUtils.parseCryptoLine = function(line) {\n const parts = line.substring(9).split(' ');\n return {\n tag: parseInt(parts[0], 10),\n cryptoSuite: parts[1],\n keyParams: parts[2],\n sessionParams: parts.slice(3),\n };\n};\n\nSDPUtils.writeCryptoLine = function(parameters) {\n return 'a=crypto:' + parameters.tag + ' ' +\n parameters.cryptoSuite + ' ' +\n (typeof parameters.keyParams === 'object'\n ? SDPUtils.writeCryptoKeyParams(parameters.keyParams)\n : parameters.keyParams) +\n (parameters.sessionParams ? ' ' + parameters.sessionParams.join(' ') : '') +\n '\\r\\n';\n};\n\n// Parses the crypto key parameters into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#rtcsrtpkeyparam*\nSDPUtils.parseCryptoKeyParams = function(keyParams) {\n if (keyParams.indexOf('inline:') !== 0) {\n return null;\n }\n const parts = keyParams.substring(7).split('|');\n return {\n keyMethod: 'inline',\n keySalt: parts[0],\n lifeTime: parts[1],\n mkiValue: parts[2] ? parts[2].split(':')[0] : undefined,\n mkiLength: parts[2] ? parts[2].split(':')[1] : undefined,\n };\n};\n\nSDPUtils.writeCryptoKeyParams = function(keyParams) {\n return keyParams.keyMethod + ':'\n + keyParams.keySalt +\n (keyParams.lifeTime ? '|' + keyParams.lifeTime : '') +\n (keyParams.mkiValue && keyParams.mkiLength\n ? '|' + keyParams.mkiValue + ':' + keyParams.mkiLength\n : '');\n};\n\n// Extracts all SDES parameters.\nSDPUtils.getCryptoParameters = function(mediaSection, sessionpart) {\n const lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=crypto:');\n return lines.map(SDPUtils.parseCryptoLine);\n};\n\n// Parses ICE information from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the ice-ufrag and ice-pwd lines as input.\nSDPUtils.getIceParameters = function(mediaSection, sessionpart) {\n const ufrag = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=ice-ufrag:')[0];\n const pwd = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=ice-pwd:')[0];\n if (!(ufrag && pwd)) {\n return null;\n }\n return {\n usernameFragment: ufrag.substring(12),\n password: pwd.substring(10),\n };\n};\n\n// Serializes ICE parameters to SDP.\nSDPUtils.writeIceParameters = function(params) {\n let sdp = 'a=ice-ufrag:' + params.usernameFragment + '\\r\\n' +\n 'a=ice-pwd:' + params.password + '\\r\\n';\n if (params.iceLite) {\n sdp += 'a=ice-lite\\r\\n';\n }\n return sdp;\n};\n\n// Parses the SDP media section and returns RTCRtpParameters.\nSDPUtils.parseRtpParameters = function(mediaSection) {\n const description = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: [],\n rtcp: [],\n };\n const lines = SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(' ');\n description.profile = mline[2];\n for (let i = 3; i < mline.length; i++) { // find all codecs from mline[3..]\n const pt = mline[i];\n const rtpmapline = SDPUtils.matchPrefix(\n mediaSection, 'a=rtpmap:' + pt + ' ')[0];\n if (rtpmapline) {\n const codec = SDPUtils.parseRtpMap(rtpmapline);\n const fmtps = SDPUtils.matchPrefix(\n mediaSection, 'a=fmtp:' + pt + ' ');\n // Only the first a=fmtp: is considered.\n codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};\n codec.rtcpFeedback = SDPUtils.matchPrefix(\n mediaSection, 'a=rtcp-fb:' + pt + ' ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.push(codec);\n // parse FEC mechanisms from rtpmap lines.\n switch (codec.name.toUpperCase()) {\n case 'RED':\n case 'ULPFEC':\n description.fecMechanisms.push(codec.name.toUpperCase());\n break;\n default: // only RED and ULPFEC are recognized as FEC mechanisms.\n break;\n }\n }\n }\n SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(line => {\n description.headerExtensions.push(SDPUtils.parseExtmap(line));\n });\n const wildcardRtcpFb = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-fb:* ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.forEach(codec => {\n wildcardRtcpFb.forEach(fb=> {\n const duplicate = codec.rtcpFeedback.find(existingFeedback => {\n return existingFeedback.type === fb.type &&\n existingFeedback.parameter === fb.parameter;\n });\n if (!duplicate) {\n codec.rtcpFeedback.push(fb);\n }\n });\n });\n // FIXME: parse rtcp.\n return description;\n};\n\n// Generates parts of the SDP media section describing the capabilities /\n// parameters.\nSDPUtils.writeRtpDescription = function(kind, caps) {\n let sdp = '';\n\n // Build the mline.\n sdp += 'm=' + kind + ' ';\n sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.\n sdp += ' ' + (caps.profile || 'UDP/TLS/RTP/SAVPF') + ' ';\n sdp += caps.codecs.map(codec => {\n if (codec.preferredPayloadType !== undefined) {\n return codec.preferredPayloadType;\n }\n return codec.payloadType;\n }).join(' ') + '\\r\\n';\n\n sdp += 'c=IN IP4 0.0.0.0\\r\\n';\n sdp += 'a=rtcp:9 IN IP4 0.0.0.0\\r\\n';\n\n // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.\n caps.codecs.forEach(codec => {\n sdp += SDPUtils.writeRtpMap(codec);\n sdp += SDPUtils.writeFmtp(codec);\n sdp += SDPUtils.writeRtcpFb(codec);\n });\n let maxptime = 0;\n caps.codecs.forEach(codec => {\n if (codec.maxptime > maxptime) {\n maxptime = codec.maxptime;\n }\n });\n if (maxptime > 0) {\n sdp += 'a=maxptime:' + maxptime + '\\r\\n';\n }\n\n if (caps.headerExtensions) {\n caps.headerExtensions.forEach(extension => {\n sdp += SDPUtils.writeExtmap(extension);\n });\n }\n // FIXME: write fecMechanisms.\n return sdp;\n};\n\n// Parses the SDP media section and returns an array of\n// RTCRtpEncodingParameters.\nSDPUtils.parseRtpEncodingParameters = function(mediaSection) {\n const encodingParameters = [];\n const description = SDPUtils.parseRtpParameters(mediaSection);\n const hasRed = description.fecMechanisms.indexOf('RED') !== -1;\n const hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;\n\n // filter a=ssrc:... cname:, ignore PlanB-msid\n const ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(parts => parts.attribute === 'cname');\n const primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;\n let secondarySsrc;\n\n const flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID')\n .map(line => {\n const parts = line.substring(17).split(' ');\n return parts.map(part => parseInt(part, 10));\n });\n if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {\n secondarySsrc = flows[0][1];\n }\n\n description.codecs.forEach(codec => {\n if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {\n let encParam = {\n ssrc: primarySsrc,\n codecPayloadType: parseInt(codec.parameters.apt, 10),\n };\n if (primarySsrc && secondarySsrc) {\n encParam.rtx = {ssrc: secondarySsrc};\n }\n encodingParameters.push(encParam);\n if (hasRed) {\n encParam = JSON.parse(JSON.stringify(encParam));\n encParam.fec = {\n ssrc: primarySsrc,\n mechanism: hasUlpfec ? 'red+ulpfec' : 'red',\n };\n encodingParameters.push(encParam);\n }\n }\n });\n if (encodingParameters.length === 0 && primarySsrc) {\n encodingParameters.push({\n ssrc: primarySsrc,\n });\n }\n\n // we support both b=AS and b=TIAS but interpret AS as TIAS.\n let bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');\n if (bandwidth.length) {\n if (bandwidth[0].indexOf('b=TIAS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substring(7), 10);\n } else if (bandwidth[0].indexOf('b=AS:') === 0) {\n // use formula from JSEP to convert b=AS to TIAS value.\n bandwidth = parseInt(bandwidth[0].substring(5), 10) * 1000 * 0.95\n - (50 * 40 * 8);\n } else {\n bandwidth = undefined;\n }\n encodingParameters.forEach(params => {\n params.maxBitrate = bandwidth;\n });\n }\n return encodingParameters;\n};\n\n// parses http://draft.ortc.org/#rtcrtcpparameters*\nSDPUtils.parseRtcpParameters = function(mediaSection) {\n const rtcpParameters = {};\n\n // Gets the first SSRC. Note that with RTX there might be multiple\n // SSRCs.\n const remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(obj => obj.attribute === 'cname')[0];\n if (remoteSsrc) {\n rtcpParameters.cname = remoteSsrc.value;\n rtcpParameters.ssrc = remoteSsrc.ssrc;\n }\n\n // Edge uses the compound attribute instead of reducedSize\n // compound is !reducedSize\n const rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');\n rtcpParameters.reducedSize = rsize.length > 0;\n rtcpParameters.compound = rsize.length === 0;\n\n // parses the rtcp-mux attrіbute.\n // Note that Edge does not support unmuxed RTCP.\n const mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');\n rtcpParameters.mux = mux.length > 0;\n\n return rtcpParameters;\n};\n\nSDPUtils.writeRtcpParameters = function(rtcpParameters) {\n let sdp = '';\n if (rtcpParameters.reducedSize) {\n sdp += 'a=rtcp-rsize\\r\\n';\n }\n if (rtcpParameters.mux) {\n sdp += 'a=rtcp-mux\\r\\n';\n }\n if (rtcpParameters.ssrc !== undefined && rtcpParameters.cname) {\n sdp += 'a=ssrc:' + rtcpParameters.ssrc +\n ' cname:' + rtcpParameters.cname + '\\r\\n';\n }\n return sdp;\n};\n\n\n// parses either a=msid: or a=ssrc:... msid lines and returns\n// the id of the MediaStream and MediaStreamTrack.\nSDPUtils.parseMsid = function(mediaSection) {\n let parts;\n const spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');\n if (spec.length === 1) {\n parts = spec[0].substring(7).split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n const planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(msidParts => msidParts.attribute === 'msid');\n if (planB.length > 0) {\n parts = planB[0].value.split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n};\n\n// SCTP\n// parses draft-ietf-mmusic-sctp-sdp-26 first and falls back\n// to draft-ietf-mmusic-sctp-sdp-05\nSDPUtils.parseSctpDescription = function(mediaSection) {\n const mline = SDPUtils.parseMLine(mediaSection);\n const maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:');\n let maxMessageSize;\n if (maxSizeLine.length > 0) {\n maxMessageSize = parseInt(maxSizeLine[0].substring(19), 10);\n }\n if (isNaN(maxMessageSize)) {\n maxMessageSize = 65536;\n }\n const sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:');\n if (sctpPort.length > 0) {\n return {\n port: parseInt(sctpPort[0].substring(12), 10),\n protocol: mline.fmt,\n maxMessageSize,\n };\n }\n const sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:');\n if (sctpMapLines.length > 0) {\n const parts = sctpMapLines[0]\n .substring(10)\n .split(' ');\n return {\n port: parseInt(parts[0], 10),\n protocol: parts[1],\n maxMessageSize,\n };\n }\n};\n\n// SCTP\n// outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers\n// support by now receiving in this format, unless we originally parsed\n// as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line\n// protocol of DTLS/SCTP -- without UDP/ or TCP/)\nSDPUtils.writeSctpDescription = function(media, sctp) {\n let output = [];\n if (media.protocol !== 'DTLS/SCTP') {\n output = [\n 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.protocol + '\\r\\n',\n 'c=IN IP4 0.0.0.0\\r\\n',\n 'a=sctp-port:' + sctp.port + '\\r\\n',\n ];\n } else {\n output = [\n 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.port + '\\r\\n',\n 'c=IN IP4 0.0.0.0\\r\\n',\n 'a=sctpmap:' + sctp.port + ' ' + sctp.protocol + ' 65535\\r\\n',\n ];\n }\n if (sctp.maxMessageSize !== undefined) {\n output.push('a=max-message-size:' + sctp.maxMessageSize + '\\r\\n');\n }\n return output.join('');\n};\n\n// Generate a session ID for SDP.\n// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1\n// recommends using a cryptographically random +ve 64-bit value\n// but right now this should be acceptable and within the right range\nSDPUtils.generateSessionId = function() {\n return Math.random().toString().substr(2, 22);\n};\n\n// Write boiler plate for start of SDP\n// sessId argument is optional - if not supplied it will\n// be generated randomly\n// sessVersion is optional and defaults to 2\n// sessUser is optional and defaults to 'thisisadapterortc'\nSDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) {\n let sessionId;\n const version = sessVer !== undefined ? sessVer : 2;\n if (sessId) {\n sessionId = sessId;\n } else {\n sessionId = SDPUtils.generateSessionId();\n }\n const user = sessUser || 'thisisadapterortc';\n // FIXME: sess-id should be an NTP timestamp.\n return 'v=0\\r\\n' +\n 'o=' + user + ' ' + sessionId + ' ' + version +\n ' IN IP4 127.0.0.1\\r\\n' +\n 's=-\\r\\n' +\n 't=0 0\\r\\n';\n};\n\n// Gets the direction from the mediaSection or the sessionpart.\nSDPUtils.getDirection = function(mediaSection, sessionpart) {\n // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.\n const lines = SDPUtils.splitLines(mediaSection);\n for (let i = 0; i < lines.length; i++) {\n switch (lines[i]) {\n case 'a=sendrecv':\n case 'a=sendonly':\n case 'a=recvonly':\n case 'a=inactive':\n return lines[i].substring(2);\n default:\n // FIXME: What should happen here?\n }\n }\n if (sessionpart) {\n return SDPUtils.getDirection(sessionpart);\n }\n return 'sendrecv';\n};\n\nSDPUtils.getKind = function(mediaSection) {\n const lines = SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(' ');\n return mline[0].substring(2);\n};\n\nSDPUtils.isRejected = function(mediaSection) {\n return mediaSection.split(' ', 2)[1] === '0';\n};\n\nSDPUtils.parseMLine = function(mediaSection) {\n const lines = SDPUtils.splitLines(mediaSection);\n const parts = lines[0].substring(2).split(' ');\n return {\n kind: parts[0],\n port: parseInt(parts[1], 10),\n protocol: parts[2],\n fmt: parts.slice(3).join(' '),\n };\n};\n\nSDPUtils.parseOLine = function(mediaSection) {\n const line = SDPUtils.matchPrefix(mediaSection, 'o=')[0];\n const parts = line.substring(2).split(' ');\n return {\n username: parts[0],\n sessionId: parts[1],\n sessionVersion: parseInt(parts[2], 10),\n netType: parts[3],\n addressType: parts[4],\n address: parts[5],\n };\n};\n\n// a very naive interpretation of a valid SDP.\nSDPUtils.isValidSDP = function(blob) {\n if (typeof blob !== 'string' || blob.length === 0) {\n return false;\n }\n const lines = SDPUtils.splitLines(blob);\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {\n return false;\n }\n // TODO: check the modifier a bit more.\n }\n return true;\n};\n\n// Expose public methods.\nif (typeof module === 'object') {\n module.exports = SDPUtils;\n}\n","export const validateId = (id: string): boolean => {\n\t// Allow empty ids\n\treturn !id || /^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/.test(id);\n};\n","export const randomToken = () => Math.random().toString(36).slice(2);\n","import { util } from \"./util\";\nimport logger, { LogLevel } from \"./logger\";\nimport { Socket } from \"./socket\";\nimport { MediaConnection } from \"./mediaconnection\";\nimport type { DataConnection } from \"./dataconnection/DataConnection\";\nimport {\n\tConnectionType,\n\tPeerErrorType,\n\tServerMessageType,\n\tSocketEventType,\n} from \"./enums\";\nimport type { ServerMessage } from \"./servermessage\";\nimport { API } from \"./api\";\nimport type {\n\tCallOption,\n\tPeerConnectOption,\n\tPeerJSOption,\n} from \"./optionInterfaces\";\nimport { BinaryPack } from \"./dataconnection/BufferedConnection/BinaryPack\";\nimport { Raw } from \"./dataconnection/BufferedConnection/Raw\";\nimport { Json } from \"./dataconnection/BufferedConnection/Json\";\n\nimport { EventEmitterWithError, PeerError } from \"./peerError\";\n\nclass PeerOptions implements PeerJSOption {\n\t/**\n\t * Prints log messages depending on the debug level passed in.\n\t */\n\tdebug?: LogLevel;\n\t/**\n\t * Server host. Defaults to `0.peerjs.com`.\n\t * Also accepts `'/'` to signify relative hostname.\n\t */\n\thost?: string;\n\t/**\n\t * Server port. Defaults to `443`.\n\t */\n\tport?: number;\n\t/**\n\t * The path where your self-hosted PeerServer is running. Defaults to `'/'`\n\t */\n\tpath?: string;\n\t/**\n\t * API key for the PeerServer.\n\t * This is not used anymore.\n\t * @deprecated\n\t */\n\tkey?: string;\n\ttoken?: string;\n\t/**\n\t * Configuration hash passed to RTCPeerConnection.\n\t * This hash contains any custom ICE/TURN server configuration.\n\t *\n\t * Defaults to {@apilink util.defaultConfig}\n\t */\n\tconfig?: any;\n\t/**\n\t * Set to true `true` if you're using TLS.\n\t * :::danger\n\t * If possible *always use TLS*\n\t * :::\n\t */\n\tsecure?: boolean;\n\tpingInterval?: number;\n\treferrerPolicy?: ReferrerPolicy;\n\tlogFunction?: (logLevel: LogLevel, ...rest: any[]) => void;\n\tserializers?: SerializerMapping;\n}\n\nexport { type PeerOptions };\n\nexport interface SerializerMapping {\n\t[key: string]: new (\n\t\tpeerId: string,\n\t\tprovider: Peer,\n\t\toptions: any,\n\t) => DataConnection;\n}\n\nexport interface PeerEvents {\n\t/**\n\t * Emitted when a connection to the PeerServer is established.\n\t *\n\t * You may use the peer before this is emitted, but messages to the server will be queued. id is the brokering ID of the peer (which was either provided in the constructor or assigned by the server).You should not wait for this event before connecting to other peers if connection speed is important.\n\t */\n\topen: (id: string) => void;\n\t/**\n\t * Emitted when a new data connection is established from a remote peer.\n\t */\n\tconnection: (dataConnection: DataConnection) => void;\n\t/**\n\t * Emitted when a remote peer attempts to call you.\n\t */\n\tcall: (mediaConnection: MediaConnection) => void;\n\t/**\n\t * Emitted when the peer is destroyed and can no longer accept or create any new connections.\n\t */\n\tclose: () => void;\n\t/**\n\t * Emitted when the peer is disconnected from the signalling server\n\t */\n\tdisconnected: (currentId: string) => void;\n\t/**\n\t * Errors on the peer are almost always fatal and will destroy the peer.\n\t *\n\t * Errors from the underlying socket and PeerConnections are forwarded here.\n\t */\n\terror: (error: PeerError<`${PeerErrorType}`>) => void;\n}\n/**\n * A peer who can initiate connections with other peers.\n */\nexport class Peer extends EventEmitterWithError {\n\tprivate static readonly DEFAULT_KEY = \"peerjs\";\n\n\tprotected readonly _serializers: SerializerMapping = {\n\t\traw: Raw,\n\t\tjson: Json,\n\t\tbinary: BinaryPack,\n\t\t\"binary-utf8\": BinaryPack,\n\n\t\tdefault: BinaryPack,\n\t};\n\tprivate readonly _options: PeerOptions;\n\tprivate readonly _api: API;\n\tprivate readonly _socket: Socket;\n\n\tprivate _id: string | null = null;\n\tprivate _lastServerId: string | null = null;\n\n\t// States.\n\tprivate _destroyed = false; // Connections have been killed\n\tprivate _disconnected = false; // Connection to PeerServer killed but P2P connections still active\n\tprivate _open = false; // Sockets and such are not yet open.\n\tprivate readonly _connections: Map<\n\t\tstring,\n\t\t(DataConnection | MediaConnection)[]\n\t> = new Map(); // All connections for this peer.\n\tprivate readonly _lostMessages: Map = new Map(); // src => [list of messages]\n\t/**\n\t * The brokering ID of this peer\n\t *\n\t * If no ID was specified in {@apilink Peer | the constructor},\n\t * this will be `undefined` until the {@apilink PeerEvents | `open`} event is emitted.\n\t */\n\tget id() {\n\t\treturn this._id;\n\t}\n\n\tget options() {\n\t\treturn this._options;\n\t}\n\n\tget open() {\n\t\treturn this._open;\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tget socket() {\n\t\treturn this._socket;\n\t}\n\n\t/**\n\t * A hash of all connections associated with this peer, keyed by the remote peer's ID.\n\t * @deprecated\n\t * Return type will change from Object to Map\n\t */\n\tget connections(): Object {\n\t\tconst plainConnections = Object.create(null);\n\n\t\tfor (const [k, v] of this._connections) {\n\t\t\tplainConnections[k] = v;\n\t\t}\n\n\t\treturn plainConnections;\n\t}\n\n\t/**\n\t * true if this peer and all of its connections can no longer be used.\n\t */\n\tget destroyed() {\n\t\treturn this._destroyed;\n\t}\n\t/**\n\t * false if there is an active connection to the PeerServer.\n\t */\n\tget disconnected() {\n\t\treturn this._disconnected;\n\t}\n\n\t/**\n\t * A peer can connect to other peers and listen for connections.\n\t */\n\tconstructor();\n\n\t/**\n\t * A peer can connect to other peers and listen for connections.\n\t * @param options for specifying details about PeerServer\n\t */\n\tconstructor(options: PeerOptions);\n\n\t/**\n\t * A peer can connect to other peers and listen for connections.\n\t * @param id Other peers can connect to this peer using the provided ID.\n\t * If no ID is given, one will be generated by the brokering server.\n\t * The ID must start and end with an alphanumeric character (lower or upper case character or a digit). In the middle of the ID spaces, dashes (-) and underscores (_) are allowed. Use {@apilink PeerOptions.metadata } to send identifying information.\n\t * @param options for specifying details about PeerServer\n\t */\n\tconstructor(id: string, options?: PeerOptions);\n\n\tconstructor(id?: string | PeerOptions, options?: PeerOptions) {\n\t\tsuper();\n\n\t\tlet userId: string | undefined;\n\n\t\t// Deal with overloading\n\t\tif (id && id.constructor == Object) {\n\t\t\toptions = id as PeerOptions;\n\t\t} else if (id) {\n\t\t\tuserId = id.toString();\n\t\t}\n\n\t\t// Configurize options\n\t\toptions = {\n\t\t\tdebug: 0, // 1: Errors, 2: Warnings, 3: All logs\n\t\t\thost: util.CLOUD_HOST,\n\t\t\tport: util.CLOUD_PORT,\n\t\t\tpath: \"/\",\n\t\t\tkey: Peer.DEFAULT_KEY,\n\t\t\ttoken: util.randomToken(),\n\t\t\tconfig: util.defaultConfig,\n\t\t\treferrerPolicy: \"strict-origin-when-cross-origin\",\n\t\t\tserializers: {},\n\t\t\t...options,\n\t\t};\n\t\tthis._options = options;\n\t\tthis._serializers = { ...this._serializers, ...this.options.serializers };\n\n\t\t// Detect relative URL host.\n\t\tif (this._options.host === \"/\") {\n\t\t\tthis._options.host = window.location.hostname;\n\t\t}\n\n\t\t// Set path correctly.\n\t\tif (this._options.path) {\n\t\t\tif (this._options.path[0] !== \"/\") {\n\t\t\t\tthis._options.path = \"/\" + this._options.path;\n\t\t\t}\n\t\t\tif (this._options.path[this._options.path.length - 1] !== \"/\") {\n\t\t\t\tthis._options.path += \"/\";\n\t\t\t}\n\t\t}\n\n\t\t// Set whether we use SSL to same as current host\n\t\tif (\n\t\t\tthis._options.secure === undefined &&\n\t\t\tthis._options.host !== util.CLOUD_HOST\n\t\t) {\n\t\t\tthis._options.secure = util.isSecure();\n\t\t} else if (this._options.host == util.CLOUD_HOST) {\n\t\t\tthis._options.secure = true;\n\t\t}\n\t\t// Set a custom log function if present\n\t\tif (this._options.logFunction) {\n\t\t\tlogger.setLogFunction(this._options.logFunction);\n\t\t}\n\n\t\tlogger.logLevel = this._options.debug || 0;\n\n\t\tthis._api = new API(options);\n\t\tthis._socket = this._createServerConnection();\n\n\t\t// Sanity checks\n\t\t// Ensure WebRTC supported\n\t\tif (!util.supports.audioVideo && !util.supports.data) {\n\t\t\tthis._delayedAbort(\n\t\t\t\tPeerErrorType.BrowserIncompatible,\n\t\t\t\t\"The current browser does not support WebRTC\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure alphanumeric id\n\t\tif (!!userId && !util.validateId(userId)) {\n\t\t\tthis._delayedAbort(PeerErrorType.InvalidID, `ID \"${userId}\" is invalid`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (userId) {\n\t\t\tthis._initialize(userId);\n\t\t} else {\n\t\t\tthis._api\n\t\t\t\t.retrieveId()\n\t\t\t\t.then((id) => this._initialize(id))\n\t\t\t\t.catch((error) => this._abort(PeerErrorType.ServerError, error));\n\t\t}\n\t}\n\n\tprivate _createServerConnection(): Socket {\n\t\tconst socket = new Socket(\n\t\t\tthis._options.secure,\n\t\t\tthis._options.host!,\n\t\t\tthis._options.port!,\n\t\t\tthis._options.path!,\n\t\t\tthis._options.key!,\n\t\t\tthis._options.pingInterval,\n\t\t);\n\n\t\tsocket.on(SocketEventType.Message, (data: ServerMessage) => {\n\t\t\tthis._handleMessage(data);\n\t\t});\n\n\t\tsocket.on(SocketEventType.Error, (error: string) => {\n\t\t\tthis._abort(PeerErrorType.SocketError, error);\n\t\t});\n\n\t\tsocket.on(SocketEventType.Disconnected, () => {\n\t\t\tif (this.disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.emitError(PeerErrorType.Network, \"Lost connection to server.\");\n\t\t\tthis.disconnect();\n\t\t});\n\n\t\tsocket.on(SocketEventType.Close, () => {\n\t\t\tif (this.disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._abort(\n\t\t\t\tPeerErrorType.SocketClosed,\n\t\t\t\t\"Underlying socket is already closed.\",\n\t\t\t);\n\t\t});\n\n\t\treturn socket;\n\t}\n\n\t/** Initialize a connection with the server. */\n\tprivate _initialize(id: string): void {\n\t\tthis._id = id;\n\t\tthis.socket.start(id, this._options.token!);\n\t}\n\n\t/** Handles messages from the server. */\n\tprivate _handleMessage(message: ServerMessage): void {\n\t\tconst type = message.type;\n\t\tconst payload = message.payload;\n\t\tconst peerId = message.src;\n\n\t\tswitch (type) {\n\t\t\tcase ServerMessageType.Open: // The connection to the server is open.\n\t\t\t\tthis._lastServerId = this.id;\n\t\t\t\tthis._open = true;\n\t\t\t\tthis.emit(\"open\", this.id);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Error: // Server error.\n\t\t\t\tthis._abort(PeerErrorType.ServerError, payload.msg);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.IdTaken: // The selected ID is taken.\n\t\t\t\tthis._abort(PeerErrorType.UnavailableID, `ID \"${this.id}\" is taken`);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.InvalidKey: // The given API key cannot be found.\n\t\t\t\tthis._abort(\n\t\t\t\t\tPeerErrorType.InvalidKey,\n\t\t\t\t\t`API KEY \"${this._options.key}\" is invalid`,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Leave: // Another peer has closed its connection to this peer.\n\t\t\t\tlogger.log(`Received leave message from ${peerId}`);\n\t\t\t\tthis._cleanupPeer(peerId);\n\t\t\t\tthis._connections.delete(peerId);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Expire: // The offer sent to a peer has expired without response.\n\t\t\t\tthis.emitError(\n\t\t\t\t\tPeerErrorType.PeerUnavailable,\n\t\t\t\t\t`Could not connect to peer ${peerId}`,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Offer: {\n\t\t\t\t// we should consider switching this to CALL/CONNECT, but this is the least breaking option.\n\t\t\t\tconst connectionId = payload.connectionId;\n\t\t\t\tlet connection = this.getConnection(peerId, connectionId);\n\n\t\t\t\tif (connection) {\n\t\t\t\t\tconnection.close();\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`Offer received for existing Connection ID:${connectionId}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Create a new connection.\n\t\t\t\tif (payload.type === ConnectionType.Media) {\n\t\t\t\t\tconst mediaConnection = new MediaConnection(peerId, this, {\n\t\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t\t\t_payload: payload,\n\t\t\t\t\t\tmetadata: payload.metadata,\n\t\t\t\t\t});\n\t\t\t\t\tconnection = mediaConnection;\n\t\t\t\t\tthis._addConnection(peerId, connection);\n\t\t\t\t\tthis.emit(\"call\", mediaConnection);\n\t\t\t\t} else if (payload.type === ConnectionType.Data) {\n\t\t\t\t\tconst dataConnection = new this._serializers[payload.serialization](\n\t\t\t\t\t\tpeerId,\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t\t\t\t_payload: payload,\n\t\t\t\t\t\t\tmetadata: payload.metadata,\n\t\t\t\t\t\t\tlabel: payload.label,\n\t\t\t\t\t\t\tserialization: payload.serialization,\n\t\t\t\t\t\t\treliable: payload.reliable,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\tconnection = dataConnection;\n\n\t\t\t\t\tthis._addConnection(peerId, connection);\n\t\t\t\t\tthis.emit(\"connection\", dataConnection);\n\t\t\t\t} else {\n\t\t\t\t\tlogger.warn(`Received malformed connection type:${payload.type}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Find messages.\n\t\t\t\tconst messages = this._getMessages(connectionId);\n\t\t\t\tfor (const message of messages) {\n\t\t\t\t\tconnection.handleMessage(message);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (!payload) {\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`You received a malformed message from ${peerId} of type ${type}`,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst connectionId = payload.connectionId;\n\t\t\t\tconst connection = this.getConnection(peerId, connectionId);\n\n\t\t\t\tif (connection && connection.peerConnection) {\n\t\t\t\t\t// Pass it on.\n\t\t\t\t\tconnection.handleMessage(message);\n\t\t\t\t} else if (connectionId) {\n\t\t\t\t\t// Store for possible later use\n\t\t\t\t\tthis._storeMessage(connectionId, message);\n\t\t\t\t} else {\n\t\t\t\t\tlogger.warn(\"You received an unrecognized message:\", message);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Stores messages without a set up connection, to be claimed later. */\n\tprivate _storeMessage(connectionId: string, message: ServerMessage): void {\n\t\tif (!this._lostMessages.has(connectionId)) {\n\t\t\tthis._lostMessages.set(connectionId, []);\n\t\t}\n\n\t\tthis._lostMessages.get(connectionId).push(message);\n\t}\n\n\t/**\n\t * Retrieve messages from lost message store\n\t * @internal\n\t */\n\t//TODO Change it to private\n\tpublic _getMessages(connectionId: string): ServerMessage[] {\n\t\tconst messages = this._lostMessages.get(connectionId);\n\n\t\tif (messages) {\n\t\t\tthis._lostMessages.delete(connectionId);\n\t\t\treturn messages;\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * Connects to the remote peer specified by id and returns a data connection.\n\t * @param peer The brokering ID of the remote peer (their {@apilink Peer.id}).\n\t * @param options for specifying details about Peer Connection\n\t */\n\tconnect(peer: string, options: PeerConnectOption = {}): DataConnection {\n\t\toptions = {\n\t\t\tserialization: \"default\",\n\t\t\t...options,\n\t\t};\n\t\tif (this.disconnected) {\n\t\t\tlogger.warn(\n\t\t\t\t\"You cannot connect to a new Peer because you called \" +\n\t\t\t\t\t\".disconnect() on this Peer and ended your connection with the \" +\n\t\t\t\t\t\"server. You can create a new Peer to reconnect, or call reconnect \" +\n\t\t\t\t\t\"on this peer if you believe its ID to still be available.\",\n\t\t\t);\n\t\t\tthis.emitError(\n\t\t\t\tPeerErrorType.Disconnected,\n\t\t\t\t\"Cannot connect to new Peer after disconnecting from server.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst dataConnection = new this._serializers[options.serialization](\n\t\t\tpeer,\n\t\t\tthis,\n\t\t\toptions,\n\t\t);\n\t\tthis._addConnection(peer, dataConnection);\n\t\treturn dataConnection;\n\t}\n\n\t/**\n\t * Calls the remote peer specified by id and returns a media connection.\n\t * @param peer The brokering ID of the remote peer (their peer.id).\n\t * @param stream The caller's media stream\n\t * @param options Metadata associated with the connection, passed in by whoever initiated the connection.\n\t */\n\tcall(\n\t\tpeer: string,\n\t\tstream: MediaStream,\n\t\toptions: CallOption = {},\n\t): MediaConnection {\n\t\tif (this.disconnected) {\n\t\t\tlogger.warn(\n\t\t\t\t\"You cannot connect to a new Peer because you called \" +\n\t\t\t\t\t\".disconnect() on this Peer and ended your connection with the \" +\n\t\t\t\t\t\"server. You can create a new Peer to reconnect.\",\n\t\t\t);\n\t\t\tthis.emitError(\n\t\t\t\tPeerErrorType.Disconnected,\n\t\t\t\t\"Cannot connect to new Peer after disconnecting from server.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!stream) {\n\t\t\tlogger.error(\n\t\t\t\t\"To call a peer, you must provide a stream from your browser's `getUserMedia`.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst mediaConnection = new MediaConnection(peer, this, {\n\t\t\t...options,\n\t\t\t_stream: stream,\n\t\t});\n\t\tthis._addConnection(peer, mediaConnection);\n\t\treturn mediaConnection;\n\t}\n\n\t/** Add a data/media connection to this peer. */\n\tprivate _addConnection(\n\t\tpeerId: string,\n\t\tconnection: MediaConnection | DataConnection,\n\t): void {\n\t\tlogger.log(\n\t\t\t`add connection ${connection.type}:${connection.connectionId} to peerId:${peerId}`,\n\t\t);\n\n\t\tif (!this._connections.has(peerId)) {\n\t\t\tthis._connections.set(peerId, []);\n\t\t}\n\t\tthis._connections.get(peerId).push(connection);\n\t}\n\n\t//TODO should be private\n\t_removeConnection(connection: DataConnection | MediaConnection): void {\n\t\tconst connections = this._connections.get(connection.peer);\n\n\t\tif (connections) {\n\t\t\tconst index = connections.indexOf(connection);\n\n\t\t\tif (index !== -1) {\n\t\t\t\tconnections.splice(index, 1);\n\t\t\t}\n\t\t}\n\n\t\t//remove from lost messages\n\t\tthis._lostMessages.delete(connection.connectionId);\n\t}\n\n\t/** Retrieve a data/media connection for this peer. */\n\tgetConnection(\n\t\tpeerId: string,\n\t\tconnectionId: string,\n\t): null | DataConnection | MediaConnection {\n\t\tconst connections = this._connections.get(peerId);\n\t\tif (!connections) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (const connection of connections) {\n\t\t\tif (connection.connectionId === connectionId) {\n\t\t\t\treturn connection;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate _delayedAbort(type: PeerErrorType, message: string | Error): void {\n\t\tsetTimeout(() => {\n\t\t\tthis._abort(type, message);\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Emits an error message and destroys the Peer.\n\t * The Peer is not destroyed if it's in a disconnected state, in which case\n\t * it retains its disconnected state and its existing connections.\n\t */\n\tprivate _abort(type: PeerErrorType, message: string | Error): void {\n\t\tlogger.error(\"Aborting!\");\n\n\t\tthis.emitError(type, message);\n\n\t\tif (!this._lastServerId) {\n\t\t\tthis.destroy();\n\t\t} else {\n\t\t\tthis.disconnect();\n\t\t}\n\t}\n\n\t/**\n\t * Destroys the Peer: closes all active connections as well as the connection\n\t * to the server.\n\t *\n\t * :::caution\n\t * This cannot be undone; the respective peer object will no longer be able\n\t * to create or receive any connections, its ID will be forfeited on the server,\n\t * and all of its data and media connections will be closed.\n\t * :::\n\t */\n\tdestroy(): void {\n\t\tif (this.destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tlogger.log(`Destroy peer with ID:${this.id}`);\n\n\t\tthis.disconnect();\n\t\tthis._cleanup();\n\n\t\tthis._destroyed = true;\n\n\t\tthis.emit(\"close\");\n\t}\n\n\t/** Disconnects every connection on this peer. */\n\tprivate _cleanup(): void {\n\t\tfor (const peerId of this._connections.keys()) {\n\t\t\tthis._cleanupPeer(peerId);\n\t\t\tthis._connections.delete(peerId);\n\t\t}\n\n\t\tthis.socket.removeAllListeners();\n\t}\n\n\t/** Closes all connections to this peer. */\n\tprivate _cleanupPeer(peerId: string): void {\n\t\tconst connections = this._connections.get(peerId);\n\n\t\tif (!connections) return;\n\n\t\tfor (const connection of connections) {\n\t\t\tconnection.close();\n\t\t}\n\t}\n\n\t/**\n\t * Disconnects the Peer's connection to the PeerServer. Does not close any\n\t * active connections.\n\t * Warning: The peer can no longer create or accept connections after being\n\t * disconnected. It also cannot reconnect to the server.\n\t */\n\tdisconnect(): void {\n\t\tif (this.disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentId = this.id;\n\n\t\tlogger.log(`Disconnect peer with ID:${currentId}`);\n\n\t\tthis._disconnected = true;\n\t\tthis._open = false;\n\n\t\tthis.socket.close();\n\n\t\tthis._lastServerId = currentId;\n\t\tthis._id = null;\n\n\t\tthis.emit(\"disconnected\", currentId);\n\t}\n\n\t/** Attempts to reconnect with the same ID.\n\t *\n\t * Only {@apilink Peer.disconnect | disconnected peers} can be reconnected.\n\t * Destroyed peers cannot be reconnected.\n\t * If the connection fails (as an example, if the peer's old ID is now taken),\n\t * the peer's existing connections will not close, but any associated errors events will fire.\n\t */\n\treconnect(): void {\n\t\tif (this.disconnected && !this.destroyed) {\n\t\t\tlogger.log(\n\t\t\t\t`Attempting reconnection to server with ID ${this._lastServerId}`,\n\t\t\t);\n\t\t\tthis._disconnected = false;\n\t\t\tthis._initialize(this._lastServerId!);\n\t\t} else if (this.destroyed) {\n\t\t\tthrow new Error(\n\t\t\t\t\"This peer cannot reconnect to the server. It has already been destroyed.\",\n\t\t\t);\n\t\t} else if (!this.disconnected && !this.open) {\n\t\t\t// Do nothing. We're still connecting the first time.\n\t\t\tlogger.error(\n\t\t\t\t\"In a hurry? We're still trying to make the initial connection!\",\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`Peer ${this.id} cannot reconnect because it is not disconnected from the server!`,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Get a list of available peer IDs. If you're running your own server, you'll\n\t * want to set allow_discovery: true in the PeerServer options. If you're using\n\t * the cloud server, email team@peerjs.com to get the functionality enabled for\n\t * your key.\n\t */\n\tlistAllPeers(cb = (_: any[]) => {}): void {\n\t\tthis._api\n\t\t\t.listAllPeers()\n\t\t\t.then((peers) => cb(peers))\n\t\t\t.catch((error) => this._abort(PeerErrorType.ServerError, error));\n\t}\n}\n","const LOG_PREFIX = \"PeerJS: \";\n\n/*\nPrints log messages depending on the debug level passed in. Defaults to 0.\n0 Prints no logs.\n1 Prints only errors.\n2 Prints errors and warnings.\n3 Prints all logs.\n*/\nexport enum LogLevel {\n\t/**\n\t * Prints no logs.\n\t */\n\tDisabled,\n\t/**\n\t * Prints only errors.\n\t */\n\tErrors,\n\t/**\n\t * Prints errors and warnings.\n\t */\n\tWarnings,\n\t/**\n\t * Prints all logs.\n\t */\n\tAll,\n}\n\nclass Logger {\n\tprivate _logLevel = LogLevel.Disabled;\n\n\tget logLevel(): LogLevel {\n\t\treturn this._logLevel;\n\t}\n\n\tset logLevel(logLevel: LogLevel) {\n\t\tthis._logLevel = logLevel;\n\t}\n\n\tlog(...args: any[]) {\n\t\tif (this._logLevel >= LogLevel.All) {\n\t\t\tthis._print(LogLevel.All, ...args);\n\t\t}\n\t}\n\n\twarn(...args: any[]) {\n\t\tif (this._logLevel >= LogLevel.Warnings) {\n\t\t\tthis._print(LogLevel.Warnings, ...args);\n\t\t}\n\t}\n\n\terror(...args: any[]) {\n\t\tif (this._logLevel >= LogLevel.Errors) {\n\t\t\tthis._print(LogLevel.Errors, ...args);\n\t\t}\n\t}\n\n\tsetLogFunction(fn: (logLevel: LogLevel, ..._: any[]) => void): void {\n\t\tthis._print = fn;\n\t}\n\n\tprivate _print(logLevel: LogLevel, ...rest: any[]): void {\n\t\tconst copy = [LOG_PREFIX, ...rest];\n\n\t\tfor (const i in copy) {\n\t\t\tif (copy[i] instanceof Error) {\n\t\t\t\tcopy[i] = \"(\" + copy[i].name + \") \" + copy[i].message;\n\t\t\t}\n\t\t}\n\n\t\tif (logLevel >= LogLevel.All) {\n\t\t\tconsole.log(...copy);\n\t\t} else if (logLevel >= LogLevel.Warnings) {\n\t\t\tconsole.warn(\"WARNING\", ...copy);\n\t\t} else if (logLevel >= LogLevel.Errors) {\n\t\t\tconsole.error(\"ERROR\", ...copy);\n\t\t}\n\t}\n}\n\nexport default new Logger();\n","import { EventEmitter } from \"eventemitter3\";\nimport logger from \"./logger\";\nimport { ServerMessageType, SocketEventType } from \"./enums\";\nimport { version } from \"../package.json\";\n\n/**\n * An abstraction on top of WebSockets to provide fastest\n * possible connection for peers.\n */\nexport class Socket extends EventEmitter {\n\tprivate _disconnected: boolean = true;\n\tprivate _id?: string;\n\tprivate _messagesQueue: Array = [];\n\tprivate _socket?: WebSocket;\n\tprivate _wsPingTimer?: any;\n\tprivate readonly _baseUrl: string;\n\n\tconstructor(\n\t\tsecure: any,\n\t\thost: string,\n\t\tport: number,\n\t\tpath: string,\n\t\tkey: string,\n\t\tprivate readonly pingInterval: number = 5000,\n\t) {\n\t\tsuper();\n\n\t\tconst wsProtocol = secure ? \"wss://\" : \"ws://\";\n\n\t\tthis._baseUrl = wsProtocol + host + \":\" + port + path + \"peerjs?key=\" + key;\n\t}\n\n\tstart(id: string, token: string): void {\n\t\tthis._id = id;\n\n\t\tconst wsUrl = `${this._baseUrl}&id=${id}&token=${token}`;\n\n\t\tif (!!this._socket || !this._disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._socket = new WebSocket(wsUrl + \"&version=\" + version);\n\t\tthis._disconnected = false;\n\n\t\tthis._socket.onmessage = (event) => {\n\t\t\tlet data;\n\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse(event.data);\n\t\t\t\tlogger.log(\"Server message received:\", data);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.log(\"Invalid server message\", event.data);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.emit(SocketEventType.Message, data);\n\t\t};\n\n\t\tthis._socket.onclose = (event) => {\n\t\t\tif (this._disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlogger.log(\"Socket closed.\", event);\n\n\t\t\tthis._cleanup();\n\t\t\tthis._disconnected = true;\n\n\t\t\tthis.emit(SocketEventType.Disconnected);\n\t\t};\n\n\t\t// Take care of the queue of connections if necessary and make sure Peer knows\n\t\t// socket is open.\n\t\tthis._socket.onopen = () => {\n\t\t\tif (this._disconnected) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._sendQueuedMessages();\n\n\t\t\tlogger.log(\"Socket open\");\n\n\t\t\tthis._scheduleHeartbeat();\n\t\t};\n\t}\n\n\tprivate _scheduleHeartbeat(): void {\n\t\tthis._wsPingTimer = setTimeout(() => {\n\t\t\tthis._sendHeartbeat();\n\t\t}, this.pingInterval);\n\t}\n\n\tprivate _sendHeartbeat(): void {\n\t\tif (!this._wsOpen()) {\n\t\t\tlogger.log(`Cannot send heartbeat, because socket closed`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = JSON.stringify({ type: ServerMessageType.Heartbeat });\n\n\t\tthis._socket!.send(message);\n\n\t\tthis._scheduleHeartbeat();\n\t}\n\n\t/** Is the websocket currently open? */\n\tprivate _wsOpen(): boolean {\n\t\treturn !!this._socket && this._socket.readyState === 1;\n\t}\n\n\t/** Send queued messages. */\n\tprivate _sendQueuedMessages(): void {\n\t\t//Create copy of queue and clear it,\n\t\t//because send method push the message back to queue if smth will go wrong\n\t\tconst copiedQueue = [...this._messagesQueue];\n\t\tthis._messagesQueue = [];\n\n\t\tfor (const message of copiedQueue) {\n\t\t\tthis.send(message);\n\t\t}\n\t}\n\n\t/** Exposed send for DC & Peer. */\n\tsend(data: any): void {\n\t\tif (this._disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If we didn't get an ID yet, we can't yet send anything so we should queue\n\t\t// up these messages.\n\t\tif (!this._id) {\n\t\t\tthis._messagesQueue.push(data);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!data.type) {\n\t\t\tthis.emit(SocketEventType.Error, \"Invalid message\");\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._wsOpen()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst message = JSON.stringify(data);\n\n\t\tthis._socket!.send(message);\n\t}\n\n\tclose(): void {\n\t\tif (this._disconnected) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._cleanup();\n\n\t\tthis._disconnected = true;\n\t}\n\n\tprivate _cleanup(): void {\n\t\tif (this._socket) {\n\t\t\tthis._socket.onopen =\n\t\t\t\tthis._socket.onmessage =\n\t\t\t\tthis._socket.onclose =\n\t\t\t\t\tnull;\n\t\t\tthis._socket.close();\n\t\t\tthis._socket = undefined;\n\t\t}\n\n\t\tclearTimeout(this._wsPingTimer!);\n\t}\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","export enum ConnectionType {\n\tData = \"data\",\n\tMedia = \"media\",\n}\n\nexport enum PeerErrorType {\n\t/**\n\t * The client's browser does not support some or all WebRTC features that you are trying to use.\n\t */\n\tBrowserIncompatible = \"browser-incompatible\",\n\t/**\n\t * You've already disconnected this peer from the server and can no longer make any new connections on it.\n\t */\n\tDisconnected = \"disconnected\",\n\t/**\n\t * The ID passed into the Peer constructor contains illegal characters.\n\t */\n\tInvalidID = \"invalid-id\",\n\t/**\n\t * The API key passed into the Peer constructor contains illegal characters or is not in the system (cloud server only).\n\t */\n\tInvalidKey = \"invalid-key\",\n\t/**\n\t * Lost or cannot establish a connection to the signalling server.\n\t */\n\tNetwork = \"network\",\n\t/**\n\t * The peer you're trying to connect to does not exist.\n\t */\n\tPeerUnavailable = \"peer-unavailable\",\n\t/**\n\t * PeerJS is being used securely, but the cloud server does not support SSL. Use a custom PeerServer.\n\t */\n\tSslUnavailable = \"ssl-unavailable\",\n\t/**\n\t * Unable to reach the server.\n\t */\n\tServerError = \"server-error\",\n\t/**\n\t * An error from the underlying socket.\n\t */\n\tSocketError = \"socket-error\",\n\t/**\n\t * The underlying socket closed unexpectedly.\n\t */\n\tSocketClosed = \"socket-closed\",\n\t/**\n\t * The ID passed into the Peer constructor is already taken.\n\t *\n\t * :::caution\n\t * This error is not fatal if your peer has open peer-to-peer connections.\n\t * This can happen if you attempt to {@apilink Peer.reconnect} a peer that has been disconnected from the server,\n\t * but its old ID has now been taken.\n\t * :::\n\t */\n\tUnavailableID = \"unavailable-id\",\n\t/**\n\t * Native WebRTC errors.\n\t */\n\tWebRTC = \"webrtc\",\n}\n\nexport enum BaseConnectionErrorType {\n\tNegotiationFailed = \"negotiation-failed\",\n\tConnectionClosed = \"connection-closed\",\n}\n\nexport enum DataConnectionErrorType {\n\tNotOpenYet = \"not-open-yet\",\n\tMessageToBig = \"message-too-big\",\n}\n\nexport enum SerializationType {\n\tBinary = \"binary\",\n\tBinaryUTF8 = \"binary-utf8\",\n\tJSON = \"json\",\n\tNone = \"raw\",\n}\n\nexport enum SocketEventType {\n\tMessage = \"message\",\n\tDisconnected = \"disconnected\",\n\tError = \"error\",\n\tClose = \"close\",\n}\n\nexport enum ServerMessageType {\n\tHeartbeat = \"HEARTBEAT\",\n\tCandidate = \"CANDIDATE\",\n\tOffer = \"OFFER\",\n\tAnswer = \"ANSWER\",\n\tOpen = \"OPEN\", // The connection to the server is open.\n\tError = \"ERROR\", // Server error.\n\tIdTaken = \"ID-TAKEN\", // The selected ID is taken.\n\tInvalidKey = \"INVALID-KEY\", // The given API key cannot be found.\n\tLeave = \"LEAVE\", // Another peer has closed its connection to this peer.\n\tExpire = \"EXPIRE\", // The offer sent to a peer has expired without response.\n}\n","{\n\t\"name\": \"peerjs\",\n\t\"version\": \"1.5.2\",\n\t\"keywords\": [\n\t\t\"peerjs\",\n\t\t\"webrtc\",\n\t\t\"p2p\",\n\t\t\"rtc\"\n\t],\n\t\"description\": \"PeerJS client\",\n\t\"homepage\": \"https://peerjs.com\",\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/peers/peerjs/issues\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/peers/peerjs\"\n\t},\n\t\"license\": \"MIT\",\n\t\"contributors\": [\n\t\t\"Michelle Bu \",\n\t\t\"afrokick \",\n\t\t\"ericz \",\n\t\t\"Jairo \",\n\t\t\"Jonas Gloning <34194370+jonasgloning@users.noreply.github.com>\",\n\t\t\"Jairo Caro-Accino Viciana \",\n\t\t\"Carlos Caballero \",\n\t\t\"hc \",\n\t\t\"Muhammad Asif \",\n\t\t\"PrashoonB \",\n\t\t\"Harsh Bardhan Mishra <47351025+HarshCasper@users.noreply.github.com>\",\n\t\t\"akotynski \",\n\t\t\"lmb \",\n\t\t\"Jairooo \",\n\t\t\"Moritz Stückler \",\n\t\t\"Simon \",\n\t\t\"Denis Lukov \",\n\t\t\"Philipp Hancke \",\n\t\t\"Hans Oksendahl \",\n\t\t\"Jess \",\n\t\t\"khankuan \",\n\t\t\"DUODVK \",\n\t\t\"XiZhao \",\n\t\t\"Matthias Lohr \",\n\t\t\"=frank tree <=frnktrb@googlemail.com>\",\n\t\t\"Andre Eckardt \",\n\t\t\"Chris Cowan \",\n\t\t\"Alex Chuev \",\n\t\t\"alxnull \",\n\t\t\"Yemel Jardi \",\n\t\t\"Ben Parnell \",\n\t\t\"Benny Lichtner \",\n\t\t\"fresheneesz \",\n\t\t\"bob.barstead@exaptive.com \",\n\t\t\"chandika \",\n\t\t\"emersion \",\n\t\t\"Christopher Van \",\n\t\t\"eddieherm \",\n\t\t\"Eduardo Pinho \",\n\t\t\"Evandro Zanatta \",\n\t\t\"Gardner Bickford \",\n\t\t\"Gian Luca \",\n\t\t\"PatrickJS \",\n\t\t\"jonnyf \",\n\t\t\"Hizkia Felix \",\n\t\t\"Hristo Oskov \",\n\t\t\"Isaac Madwed \",\n\t\t\"Ilya Konanykhin \",\n\t\t\"jasonbarry \",\n\t\t\"Jonathan Burke \",\n\t\t\"Josh Hamit \",\n\t\t\"Jordan Austin \",\n\t\t\"Joel Wetzell \",\n\t\t\"xizhao \",\n\t\t\"Alberto Torres \",\n\t\t\"Jonathan Mayol \",\n\t\t\"Jefferson Felix \",\n\t\t\"Rolf Erik Lekang \",\n\t\t\"Kevin Mai-Husan Chia \",\n\t\t\"Pepijn de Vos \",\n\t\t\"JooYoung \",\n\t\t\"Tobias Speicher \",\n\t\t\"Steve Blaurock \",\n\t\t\"Kyrylo Shegeda \",\n\t\t\"Diwank Singh Tomer \",\n\t\t\"Sören Balko \",\n\t\t\"Arpit Solanki \",\n\t\t\"Yuki Ito \",\n\t\t\"Artur Zayats \"\n\t],\n\t\"funding\": {\n\t\t\"type\": \"opencollective\",\n\t\t\"url\": \"https://opencollective.com/peer\"\n\t},\n\t\"collective\": {\n\t\t\"type\": \"opencollective\",\n\t\t\"url\": \"https://opencollective.com/peer\"\n\t},\n\t\"files\": [\n\t\t\"dist/*\"\n\t],\n\t\"sideEffects\": [\n\t\t\"lib/global.ts\",\n\t\t\"lib/supports.ts\"\n\t],\n\t\"main\": \"dist/bundler.cjs\",\n\t\"module\": \"dist/bundler.mjs\",\n\t\"browser-minified\": \"dist/peerjs.min.js\",\n\t\"browser-unminified\": \"dist/peerjs.js\",\n\t\"browser-minified-cbor\": \"dist/serializer.cbor.mjs\",\n\t\"browser-minified-msgpack\": \"dist/serializer.msgpack.mjs\",\n\t\"types\": \"dist/types.d.ts\",\n\t\"engines\": {\n\t\t\"node\": \">= 14\"\n\t},\n\t\"targets\": {\n\t\t\"types\": {\n\t\t\t\"source\": \"lib/exports.ts\"\n\t\t},\n\t\t\"main\": {\n\t\t\t\"source\": \"lib/exports.ts\",\n\t\t\t\"sourceMap\": {\n\t\t\t\t\"inlineSources\": true\n\t\t\t}\n\t\t},\n\t\t\"module\": {\n\t\t\t\"source\": \"lib/exports.ts\",\n\t\t\t\"includeNodeModules\": [\n\t\t\t\t\"eventemitter3\"\n\t\t\t],\n\t\t\t\"sourceMap\": {\n\t\t\t\t\"inlineSources\": true\n\t\t\t}\n\t\t},\n\t\t\"browser-minified\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"global\",\n\t\t\t\"optimize\": true,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/global.ts\"\n\t\t},\n\t\t\"browser-unminified\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"global\",\n\t\t\t\"optimize\": false,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 80, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/global.ts\"\n\t\t},\n\t\t\"browser-minified-cbor\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"esmodule\",\n\t\t\t\"isLibrary\": true,\n\t\t\t\"optimize\": true,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/dataconnection/StreamConnection/Cbor.ts\"\n\t\t},\n\t\t\"browser-minified-msgpack\": {\n\t\t\t\"context\": \"browser\",\n\t\t\t\"outputFormat\": \"esmodule\",\n\t\t\t\"isLibrary\": true,\n\t\t\t\"optimize\": true,\n\t\t\t\"engines\": {\n\t\t\t\t\"browsers\": \"chrome >= 83, edge >= 83, firefox >= 102, safari >= 15\"\n\t\t\t},\n\t\t\t\"source\": \"lib/dataconnection/StreamConnection/MsgPack.ts\"\n\t\t}\n\t},\n\t\"scripts\": {\n\t\t\"contributors\": \"git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \\\"chore(contributors): update and sort contributors list\\\"\",\n\t\t\"check\": \"tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit\",\n\t\t\"watch\": \"parcel watch\",\n\t\t\"build\": \"rm -rf dist && parcel build\",\n\t\t\"prepublishOnly\": \"npm run build\",\n\t\t\"test\": \"jest\",\n\t\t\"test:watch\": \"jest --watch\",\n\t\t\"coverage\": \"jest --coverage --collectCoverageFrom=\\\"./lib/**\\\"\",\n\t\t\"format\": \"prettier --write .\",\n\t\t\"format:check\": \"prettier --check .\",\n\t\t\"semantic-release\": \"semantic-release\",\n\t\t\"e2e\": \"wdio run e2e/wdio.local.conf.ts\",\n\t\t\"e2e:bstack\": \"wdio run e2e/wdio.bstack.conf.ts\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@parcel/config-default\": \"^2.9.3\",\n\t\t\"@parcel/packager-ts\": \"^2.9.3\",\n\t\t\"@parcel/transformer-typescript-tsc\": \"^2.9.3\",\n\t\t\"@parcel/transformer-typescript-types\": \"^2.9.3\",\n\t\t\"@semantic-release/changelog\": \"^6.0.1\",\n\t\t\"@semantic-release/git\": \"^10.0.1\",\n\t\t\"@swc/core\": \"^1.3.27\",\n\t\t\"@swc/jest\": \"^0.2.24\",\n\t\t\"@types/jasmine\": \"^4.3.4\",\n\t\t\"@wdio/browserstack-service\": \"^8.11.2\",\n\t\t\"@wdio/cli\": \"^8.11.2\",\n\t\t\"@wdio/globals\": \"^8.11.2\",\n\t\t\"@wdio/jasmine-framework\": \"^8.11.2\",\n\t\t\"@wdio/local-runner\": \"^8.11.2\",\n\t\t\"@wdio/spec-reporter\": \"^8.11.2\",\n\t\t\"@wdio/types\": \"^8.10.4\",\n\t\t\"http-server\": \"^14.1.1\",\n\t\t\"jest\": \"^29.3.1\",\n\t\t\"jest-environment-jsdom\": \"^29.3.1\",\n\t\t\"mock-socket\": \"^9.0.0\",\n\t\t\"parcel\": \"^2.9.3\",\n\t\t\"prettier\": \"^3.0.0\",\n\t\t\"semantic-release\": \"^21.0.0\",\n\t\t\"ts-node\": \"^10.9.1\",\n\t\t\"typescript\": \"^5.0.0\",\n\t\t\"wdio-geckodriver-service\": \"^5.0.1\"\n\t},\n\t\"dependencies\": {\n\t\t\"@msgpack/msgpack\": \"^2.8.0\",\n\t\t\"cbor-x\": \"1.5.4\",\n\t\t\"eventemitter3\": \"^4.0.7\",\n\t\t\"peerjs-js-binarypack\": \"^2.1.0\",\n\t\t\"webrtc-adapter\": \"^8.0.0\"\n\t},\n\t\"alias\": {\n\t\t\"process\": false,\n\t\t\"buffer\": false\n\t}\n}\n","import { util } from \"./util\";\nimport logger from \"./logger\";\nimport { Negotiator } from \"./negotiator\";\nimport { ConnectionType, ServerMessageType } from \"./enums\";\nimport type { Peer } from \"./peer\";\nimport { BaseConnection, type BaseConnectionEvents } from \"./baseconnection\";\nimport type { ServerMessage } from \"./servermessage\";\nimport type { AnswerOption } from \"./optionInterfaces\";\n\nexport interface MediaConnectionEvents extends BaseConnectionEvents {\n\t/**\n\t * Emitted when a connection to the PeerServer is established.\n\t *\n\t * ```ts\n\t * mediaConnection.on('stream', (stream) => { ... });\n\t * ```\n\t */\n\tstream: (stream: MediaStream) => void;\n\t/**\n\t * Emitted when the auxiliary data channel is established.\n\t * After this event, hanging up will close the connection cleanly on the remote peer.\n\t * @beta\n\t */\n\twillCloseOnRemote: () => void;\n}\n\n/**\n * Wraps WebRTC's media streams.\n * To get one, use {@apilink Peer.call} or listen for the {@apilink PeerEvents | `call`} event.\n */\nexport class MediaConnection extends BaseConnection {\n\tprivate static readonly ID_PREFIX = \"mc_\";\n\treadonly label: string;\n\n\tprivate _negotiator: Negotiator;\n\tprivate _localStream: MediaStream;\n\tprivate _remoteStream: MediaStream;\n\n\t/**\n\t * For media connections, this is always 'media'.\n\t */\n\tget type() {\n\t\treturn ConnectionType.Media;\n\t}\n\n\tget localStream(): MediaStream {\n\t\treturn this._localStream;\n\t}\n\n\tget remoteStream(): MediaStream {\n\t\treturn this._remoteStream;\n\t}\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\n\t\tthis._localStream = this.options._stream;\n\t\tthis.connectionId =\n\t\t\tthis.options.connectionId ||\n\t\t\tMediaConnection.ID_PREFIX + util.randomToken();\n\n\t\tthis._negotiator = new Negotiator(this);\n\n\t\tif (this._localStream) {\n\t\t\tthis._negotiator.startConnection({\n\t\t\t\t_stream: this._localStream,\n\t\t\t\toriginator: true,\n\t\t\t});\n\t\t}\n\t}\n\n\t/** Called by the Negotiator when the DataChannel is ready. */\n\toverride _initializeDataChannel(dc: RTCDataChannel): void {\n\t\tthis.dataChannel = dc;\n\n\t\tthis.dataChannel.onopen = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc connection success`);\n\t\t\tthis.emit(\"willCloseOnRemote\");\n\t\t};\n\n\t\tthis.dataChannel.onclose = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc closed for:`, this.peer);\n\t\t\tthis.close();\n\t\t};\n\t}\n\taddStream(remoteStream) {\n\t\tlogger.log(\"Receiving stream\", remoteStream);\n\n\t\tthis._remoteStream = remoteStream;\n\t\tsuper.emit(\"stream\", remoteStream); // Should we call this `open`?\n\t}\n\n\t/**\n\t * @internal\n\t */\n\thandleMessage(message: ServerMessage): void {\n\t\tconst type = message.type;\n\t\tconst payload = message.payload;\n\n\t\tswitch (message.type) {\n\t\t\tcase ServerMessageType.Answer:\n\t\t\t\t// Forward to negotiator\n\t\t\t\tvoid this._negotiator.handleSDP(type, payload.sdp);\n\t\t\t\tthis._open = true;\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Candidate:\n\t\t\t\tvoid this._negotiator.handleCandidate(payload.candidate);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlogger.warn(`Unrecognized message type:${type} from peer:${this.peer}`);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n * When receiving a {@apilink PeerEvents | `call`} event on a peer, you can call\n * `answer` on the media connection provided by the callback to accept the call\n * and optionally send your own media stream.\n\n *\n * @param stream A WebRTC media stream.\n * @param options\n * @returns\n */\n\tanswer(stream?: MediaStream, options: AnswerOption = {}): void {\n\t\tif (this._localStream) {\n\t\t\tlogger.warn(\n\t\t\t\t\"Local stream already exists on this MediaConnection. Are you answering a call twice?\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._localStream = stream;\n\n\t\tif (options && options.sdpTransform) {\n\t\t\tthis.options.sdpTransform = options.sdpTransform;\n\t\t}\n\n\t\tthis._negotiator.startConnection({\n\t\t\t...this.options._payload,\n\t\t\t_stream: stream,\n\t\t});\n\t\t// Retrieve lost messages stored because PeerConnection not set up.\n\t\tconst messages = this.provider._getMessages(this.connectionId);\n\n\t\tfor (const message of messages) {\n\t\t\tthis.handleMessage(message);\n\t\t}\n\n\t\tthis._open = true;\n\t}\n\n\t/**\n\t * Exposed functionality for users.\n\t */\n\n\t/**\n\t * Closes the media connection.\n\t */\n\tclose(): void {\n\t\tif (this._negotiator) {\n\t\t\tthis._negotiator.cleanup();\n\t\t\tthis._negotiator = null;\n\t\t}\n\n\t\tthis._localStream = null;\n\t\tthis._remoteStream = null;\n\n\t\tif (this.provider) {\n\t\t\tthis.provider._removeConnection(this);\n\n\t\t\tthis.provider = null;\n\t\t}\n\n\t\tif (this.options && this.options._stream) {\n\t\t\tthis.options._stream = null;\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._open = false;\n\n\t\tsuper.emit(\"close\");\n\t}\n}\n","import logger from \"./logger\";\nimport type { MediaConnection } from \"./mediaconnection\";\nimport type { DataConnection } from \"./dataconnection/DataConnection\";\nimport {\n\tBaseConnectionErrorType,\n\tConnectionType,\n\tPeerErrorType,\n\tServerMessageType,\n} from \"./enums\";\nimport type { BaseConnection, BaseConnectionEvents } from \"./baseconnection\";\nimport type { ValidEventTypes } from \"eventemitter3\";\n\n/**\n * Manages all negotiations between Peers.\n */\nexport class Negotiator<\n\tEvents extends ValidEventTypes,\n\tConnectionType extends BaseConnection,\n> {\n\tconstructor(readonly connection: ConnectionType) {}\n\n\t/** Returns a PeerConnection object set up correctly (for data, media). */\n\tstartConnection(options: any) {\n\t\tconst peerConnection = this._startPeerConnection();\n\n\t\t// Set the connection's PC.\n\t\tthis.connection.peerConnection = peerConnection;\n\n\t\tif (this.connection.type === ConnectionType.Media && options._stream) {\n\t\t\tthis._addTracksToConnection(options._stream, peerConnection);\n\t\t}\n\n\t\t// What do we need to do now?\n\t\tif (options.originator) {\n\t\t\tconst dataConnection = this.connection;\n\n\t\t\tconst config: RTCDataChannelInit = { ordered: !!options.reliable };\n\n\t\t\tconst dataChannel = peerConnection.createDataChannel(\n\t\t\t\tdataConnection.label,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t\tdataConnection._initializeDataChannel(dataChannel);\n\n\t\t\tvoid this._makeOffer();\n\t\t} else {\n\t\t\tvoid this.handleSDP(\"OFFER\", options.sdp);\n\t\t}\n\t}\n\n\t/** Start a PC. */\n\tprivate _startPeerConnection(): RTCPeerConnection {\n\t\tlogger.log(\"Creating RTCPeerConnection.\");\n\n\t\tconst peerConnection = new RTCPeerConnection(\n\t\t\tthis.connection.provider.options.config,\n\t\t);\n\n\t\tthis._setupListeners(peerConnection);\n\n\t\treturn peerConnection;\n\t}\n\n\t/** Set up various WebRTC listeners. */\n\tprivate _setupListeners(peerConnection: RTCPeerConnection) {\n\t\tconst peerId = this.connection.peer;\n\t\tconst connectionId = this.connection.connectionId;\n\t\tconst connectionType = this.connection.type;\n\t\tconst provider = this.connection.provider;\n\n\t\t// ICE CANDIDATES.\n\t\tlogger.log(\"Listening for ICE candidates.\");\n\n\t\tpeerConnection.onicecandidate = (evt) => {\n\t\t\tif (!evt.candidate || !evt.candidate.candidate) return;\n\n\t\t\tlogger.log(`Received ICE candidates for ${peerId}:`, evt.candidate);\n\n\t\t\tprovider.socket.send({\n\t\t\t\ttype: ServerMessageType.Candidate,\n\t\t\t\tpayload: {\n\t\t\t\t\tcandidate: evt.candidate,\n\t\t\t\t\ttype: connectionType,\n\t\t\t\t\tconnectionId: connectionId,\n\t\t\t\t},\n\t\t\t\tdst: peerId,\n\t\t\t});\n\t\t};\n\n\t\tpeerConnection.oniceconnectionstatechange = () => {\n\t\t\tswitch (peerConnection.iceConnectionState) {\n\t\t\t\tcase \"failed\":\n\t\t\t\t\tlogger.log(\n\t\t\t\t\t\t\"iceConnectionState is failed, closing connections to \" + peerId,\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.emitError(\n\t\t\t\t\t\tBaseConnectionErrorType.NegotiationFailed,\n\t\t\t\t\t\t\"Negotiation of connection to \" + peerId + \" failed.\",\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"closed\":\n\t\t\t\t\tlogger.log(\n\t\t\t\t\t\t\"iceConnectionState is closed, closing connections to \" + peerId,\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.emitError(\n\t\t\t\t\t\tBaseConnectionErrorType.ConnectionClosed,\n\t\t\t\t\t\t\"Connection to \" + peerId + \" closed.\",\n\t\t\t\t\t);\n\t\t\t\t\tthis.connection.close();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"disconnected\":\n\t\t\t\t\tlogger.log(\n\t\t\t\t\t\t\"iceConnectionState changed to disconnected on the connection with \" +\n\t\t\t\t\t\t\tpeerId,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"completed\":\n\t\t\t\t\tpeerConnection.onicecandidate = () => {};\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tthis.connection.emit(\n\t\t\t\t\"iceStateChanged\",\n\t\t\t\tpeerConnection.iceConnectionState,\n\t\t\t);\n\t\t};\n\n\t\t// DATACONNECTION.\n\t\tlogger.log(\"Listening for data channel\");\n\t\t// Fired between offer and answer, so options should already be saved\n\t\t// in the options hash.\n\t\tpeerConnection.ondatachannel = (evt) => {\n\t\t\tlogger.log(\"Received data channel\");\n\n\t\t\tconst dataChannel = evt.channel;\n\t\t\tconst connection = (\n\t\t\t\tprovider.getConnection(peerId, connectionId)\n\t\t\t);\n\n\t\t\tconnection._initializeDataChannel(dataChannel);\n\t\t};\n\n\t\t// MEDIACONNECTION.\n\t\tlogger.log(\"Listening for remote stream\");\n\n\t\tpeerConnection.ontrack = (evt) => {\n\t\t\tlogger.log(\"Received remote stream\");\n\n\t\t\tconst stream = evt.streams[0];\n\t\t\tconst connection = provider.getConnection(peerId, connectionId);\n\n\t\t\tif (connection.type === ConnectionType.Media) {\n\t\t\t\tconst mediaConnection = connection;\n\n\t\t\t\tthis._addStreamToMediaConnection(stream, mediaConnection);\n\t\t\t}\n\t\t};\n\t}\n\n\tcleanup(): void {\n\t\tlogger.log(\"Cleaning up PeerConnection to \" + this.connection.peer);\n\n\t\tconst peerConnection = this.connection.peerConnection;\n\n\t\tif (!peerConnection) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.connection.peerConnection = null;\n\n\t\t//unsubscribe from all PeerConnection's events\n\t\tpeerConnection.onicecandidate =\n\t\t\tpeerConnection.oniceconnectionstatechange =\n\t\t\tpeerConnection.ondatachannel =\n\t\t\tpeerConnection.ontrack =\n\t\t\t\t() => {};\n\n\t\tconst peerConnectionNotClosed = peerConnection.signalingState !== \"closed\";\n\t\tlet dataChannelNotClosed = false;\n\n\t\tconst dataChannel = this.connection.dataChannel;\n\n\t\tif (dataChannel) {\n\t\t\tdataChannelNotClosed =\n\t\t\t\t!!dataChannel.readyState && dataChannel.readyState !== \"closed\";\n\t\t}\n\n\t\tif (peerConnectionNotClosed || dataChannelNotClosed) {\n\t\t\tpeerConnection.close();\n\t\t}\n\t}\n\n\tprivate async _makeOffer(): Promise {\n\t\tconst peerConnection = this.connection.peerConnection;\n\t\tconst provider = this.connection.provider;\n\n\t\ttry {\n\t\t\tconst offer = await peerConnection.createOffer(\n\t\t\t\tthis.connection.options.constraints,\n\t\t\t);\n\n\t\t\tlogger.log(\"Created offer.\");\n\n\t\t\tif (\n\t\t\t\tthis.connection.options.sdpTransform &&\n\t\t\t\ttypeof this.connection.options.sdpTransform === \"function\"\n\t\t\t) {\n\t\t\t\toffer.sdp =\n\t\t\t\t\tthis.connection.options.sdpTransform(offer.sdp) || offer.sdp;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait peerConnection.setLocalDescription(offer);\n\n\t\t\t\tlogger.log(\n\t\t\t\t\t\"Set localDescription:\",\n\t\t\t\t\toffer,\n\t\t\t\t\t`for:${this.connection.peer}`,\n\t\t\t\t);\n\n\t\t\t\tlet payload: any = {\n\t\t\t\t\tsdp: offer,\n\t\t\t\t\ttype: this.connection.type,\n\t\t\t\t\tconnectionId: this.connection.connectionId,\n\t\t\t\t\tmetadata: this.connection.metadata,\n\t\t\t\t};\n\n\t\t\t\tif (this.connection.type === ConnectionType.Data) {\n\t\t\t\t\tconst dataConnection = (this.connection);\n\n\t\t\t\t\tpayload = {\n\t\t\t\t\t\t...payload,\n\t\t\t\t\t\tlabel: dataConnection.label,\n\t\t\t\t\t\treliable: dataConnection.reliable,\n\t\t\t\t\t\tserialization: dataConnection.serialization,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tprovider.socket.send({\n\t\t\t\t\ttype: ServerMessageType.Offer,\n\t\t\t\t\tpayload,\n\t\t\t\t\tdst: this.connection.peer,\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\t// TODO: investigate why _makeOffer is being called from the answer\n\t\t\t\tif (\n\t\t\t\t\terr !=\n\t\t\t\t\t\"OperationError: Failed to set local offer sdp: Called in wrong state: kHaveRemoteOffer\"\n\t\t\t\t) {\n\t\t\t\t\tprovider.emitError(PeerErrorType.WebRTC, err);\n\t\t\t\t\tlogger.log(\"Failed to setLocalDescription, \", err);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err_1) {\n\t\t\tprovider.emitError(PeerErrorType.WebRTC, err_1);\n\t\t\tlogger.log(\"Failed to createOffer, \", err_1);\n\t\t}\n\t}\n\n\tprivate async _makeAnswer(): Promise {\n\t\tconst peerConnection = this.connection.peerConnection;\n\t\tconst provider = this.connection.provider;\n\n\t\ttry {\n\t\t\tconst answer = await peerConnection.createAnswer();\n\t\t\tlogger.log(\"Created answer.\");\n\n\t\t\tif (\n\t\t\t\tthis.connection.options.sdpTransform &&\n\t\t\t\ttypeof this.connection.options.sdpTransform === \"function\"\n\t\t\t) {\n\t\t\t\tanswer.sdp =\n\t\t\t\t\tthis.connection.options.sdpTransform(answer.sdp) || answer.sdp;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait peerConnection.setLocalDescription(answer);\n\n\t\t\t\tlogger.log(\n\t\t\t\t\t`Set localDescription:`,\n\t\t\t\t\tanswer,\n\t\t\t\t\t`for:${this.connection.peer}`,\n\t\t\t\t);\n\n\t\t\t\tprovider.socket.send({\n\t\t\t\t\ttype: ServerMessageType.Answer,\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\tsdp: answer,\n\t\t\t\t\t\ttype: this.connection.type,\n\t\t\t\t\t\tconnectionId: this.connection.connectionId,\n\t\t\t\t\t},\n\t\t\t\t\tdst: this.connection.peer,\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\tprovider.emitError(PeerErrorType.WebRTC, err);\n\t\t\t\tlogger.log(\"Failed to setLocalDescription, \", err);\n\t\t\t}\n\t\t} catch (err_1) {\n\t\t\tprovider.emitError(PeerErrorType.WebRTC, err_1);\n\t\t\tlogger.log(\"Failed to create answer, \", err_1);\n\t\t}\n\t}\n\n\t/** Handle an SDP. */\n\tasync handleSDP(type: string, sdp: any): Promise {\n\t\tsdp = new RTCSessionDescription(sdp);\n\t\tconst peerConnection = this.connection.peerConnection;\n\t\tconst provider = this.connection.provider;\n\n\t\tlogger.log(\"Setting remote description\", sdp);\n\n\t\tconst self = this;\n\n\t\ttry {\n\t\t\tawait peerConnection.setRemoteDescription(sdp);\n\t\t\tlogger.log(`Set remoteDescription:${type} for:${this.connection.peer}`);\n\t\t\tif (type === \"OFFER\") {\n\t\t\t\tawait self._makeAnswer();\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tprovider.emitError(PeerErrorType.WebRTC, err);\n\t\t\tlogger.log(\"Failed to setRemoteDescription, \", err);\n\t\t}\n\t}\n\n\t/** Handle a candidate. */\n\tasync handleCandidate(ice: RTCIceCandidate) {\n\t\tlogger.log(`handleCandidate:`, ice);\n\n\t\ttry {\n\t\t\tawait this.connection.peerConnection.addIceCandidate(ice);\n\t\t\tlogger.log(`Added ICE candidate for:${this.connection.peer}`);\n\t\t} catch (err) {\n\t\t\tthis.connection.provider.emitError(PeerErrorType.WebRTC, err);\n\t\t\tlogger.log(\"Failed to handleCandidate, \", err);\n\t\t}\n\t}\n\n\tprivate _addTracksToConnection(\n\t\tstream: MediaStream,\n\t\tpeerConnection: RTCPeerConnection,\n\t): void {\n\t\tlogger.log(`add tracks from stream ${stream.id} to peer connection`);\n\n\t\tif (!peerConnection.addTrack) {\n\t\t\treturn logger.error(\n\t\t\t\t`Your browser does't support RTCPeerConnection#addTrack. Ignored.`,\n\t\t\t);\n\t\t}\n\n\t\tstream.getTracks().forEach((track) => {\n\t\t\tpeerConnection.addTrack(track, stream);\n\t\t});\n\t}\n\n\tprivate _addStreamToMediaConnection(\n\t\tstream: MediaStream,\n\t\tmediaConnection: MediaConnection,\n\t): void {\n\t\tlogger.log(\n\t\t\t`add stream ${stream.id} to media connection ${mediaConnection.connectionId}`,\n\t\t);\n\n\t\tmediaConnection.addStream(stream);\n\t}\n}\n","import type { Peer } from \"./peer\";\nimport type { ServerMessage } from \"./servermessage\";\nimport type { ConnectionType } from \"./enums\";\nimport { BaseConnectionErrorType } from \"./enums\";\nimport {\n\tEventEmitterWithError,\n\ttype EventsWithError,\n\tPeerError,\n} from \"./peerError\";\nimport type { ValidEventTypes } from \"eventemitter3\";\n\nexport interface BaseConnectionEvents<\n\tErrorType extends string = BaseConnectionErrorType,\n> extends EventsWithError {\n\t/**\n\t * Emitted when either you or the remote peer closes the connection.\n\t *\n\t * ```ts\n\t * connection.on('close', () => { ... });\n\t * ```\n\t */\n\tclose: () => void;\n\t/**\n\t * ```ts\n\t * connection.on('error', (error) => { ... });\n\t * ```\n\t */\n\terror: (error: PeerError<`${ErrorType}`>) => void;\n\ticeStateChanged: (state: RTCIceConnectionState) => void;\n}\n\nexport abstract class BaseConnection<\n\tSubClassEvents extends ValidEventTypes,\n\tErrorType extends string = never,\n> extends EventEmitterWithError<\n\tErrorType | BaseConnectionErrorType,\n\tSubClassEvents & BaseConnectionEvents\n> {\n\tprotected _open = false;\n\n\t/**\n\t * Any type of metadata associated with the connection,\n\t * passed in by whoever initiated the connection.\n\t */\n\treadonly metadata: any;\n\tconnectionId: string;\n\n\tpeerConnection: RTCPeerConnection;\n\tdataChannel: RTCDataChannel;\n\n\tabstract get type(): ConnectionType;\n\n\t/**\n\t * The optional label passed in or assigned by PeerJS when the connection was initiated.\n\t */\n\tlabel: string;\n\n\t/**\n\t * Whether the media connection is active (e.g. your call has been answered).\n\t * You can check this if you want to set a maximum wait time for a one-sided call.\n\t */\n\tget open() {\n\t\treturn this._open;\n\t}\n\n\tprotected constructor(\n\t\t/**\n\t\t * The ID of the peer on the other end of this connection.\n\t\t */\n\t\treadonly peer: string,\n\t\tpublic provider: Peer,\n\t\treadonly options: any,\n\t) {\n\t\tsuper();\n\n\t\tthis.metadata = options.metadata;\n\t}\n\n\tabstract close(): void;\n\n\t/**\n\t * @internal\n\t */\n\tabstract handleMessage(message: ServerMessage): void;\n\n\t/**\n\t * Called by the Negotiator when the DataChannel is ready.\n\t * @internal\n\t * */\n\tabstract _initializeDataChannel(dc: RTCDataChannel): void;\n}\n","import { EventEmitter } from \"eventemitter3\";\nimport logger from \"./logger\";\n\nexport interface EventsWithError {\n\terror: (error: PeerError<`${ErrorType}`>) => void;\n}\n\nexport class EventEmitterWithError<\n\tErrorType extends string,\n\tEvents extends EventsWithError,\n> extends EventEmitter {\n\t/**\n\t * Emits a typed error message.\n\t *\n\t * @internal\n\t */\n\temitError(type: ErrorType, err: string | Error): void {\n\t\tlogger.error(\"Error:\", err);\n\n\t\t// @ts-ignore\n\t\tthis.emit(\"error\", new PeerError<`${ErrorType}`>(`${type}`, err));\n\t}\n}\n/**\n * A PeerError is emitted whenever an error occurs.\n * It always has a `.type`, which can be used to identify the error.\n */\nexport class PeerError extends Error {\n\t/**\n\t * @internal\n\t */\n\tconstructor(type: T, err: Error | string) {\n\t\tif (typeof err === \"string\") {\n\t\t\tsuper(err);\n\t\t} else {\n\t\t\tsuper();\n\t\t\tObject.assign(this, err);\n\t\t}\n\n\t\tthis.type = type;\n\t}\n\n\tpublic type: T;\n}\n","import { util } from \"./util\";\nimport logger from \"./logger\";\nimport type { PeerJSOption } from \"./optionInterfaces\";\nimport { version } from \"../package.json\";\n\nexport class API {\n\tconstructor(private readonly _options: PeerJSOption) {}\n\n\tprivate _buildRequest(method: string): Promise {\n\t\tconst protocol = this._options.secure ? \"https\" : \"http\";\n\t\tconst { host, port, path, key } = this._options;\n\t\tconst url = new URL(`${protocol}://${host}:${port}${path}${key}/${method}`);\n\t\t// TODO: Why timestamp, why random?\n\t\turl.searchParams.set(\"ts\", `${Date.now()}${Math.random()}`);\n\t\turl.searchParams.set(\"version\", version);\n\t\treturn fetch(url.href, {\n\t\t\treferrerPolicy: this._options.referrerPolicy,\n\t\t});\n\t}\n\n\t/** Get a unique ID from the server via XHR and initialize with it. */\n\tasync retrieveId(): Promise {\n\t\ttry {\n\t\t\tconst response = await this._buildRequest(\"id\");\n\n\t\t\tif (response.status !== 200) {\n\t\t\t\tthrow new Error(`Error. Status:${response.status}`);\n\t\t\t}\n\n\t\t\treturn response.text();\n\t\t} catch (error) {\n\t\t\tlogger.error(\"Error retrieving ID\", error);\n\n\t\t\tlet pathError = \"\";\n\n\t\t\tif (\n\t\t\t\tthis._options.path === \"/\" &&\n\t\t\t\tthis._options.host !== util.CLOUD_HOST\n\t\t\t) {\n\t\t\t\tpathError =\n\t\t\t\t\t\" If you passed in a `path` to your self-hosted PeerServer, \" +\n\t\t\t\t\t\"you'll also need to pass in that same path when creating a new \" +\n\t\t\t\t\t\"Peer.\";\n\t\t\t}\n\n\t\t\tthrow new Error(\"Could not get an ID from the server.\" + pathError);\n\t\t}\n\t}\n\n\t/** @deprecated */\n\tasync listAllPeers(): Promise {\n\t\ttry {\n\t\t\tconst response = await this._buildRequest(\"peers\");\n\n\t\t\tif (response.status !== 200) {\n\t\t\t\tif (response.status === 401) {\n\t\t\t\t\tlet helpfulError = \"\";\n\n\t\t\t\t\tif (this._options.host === util.CLOUD_HOST) {\n\t\t\t\t\t\thelpfulError =\n\t\t\t\t\t\t\t\"It looks like you're using the cloud server. You can email \" +\n\t\t\t\t\t\t\t\"team@peerjs.com to enable peer listing for your API key.\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\thelpfulError =\n\t\t\t\t\t\t\t\"You need to enable `allow_discovery` on your self-hosted \" +\n\t\t\t\t\t\t\t\"PeerServer to use this feature.\";\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"It doesn't look like you have permission to list peers IDs. \" +\n\t\t\t\t\t\t\thelpfulError,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(`Error. Status:${response.status}`);\n\t\t\t}\n\n\t\t\treturn response.json();\n\t\t} catch (error) {\n\t\t\tlogger.error(\"Error retrieving list peers\", error);\n\n\t\t\tthrow new Error(\"Could not get list peers from the server.\" + error);\n\t\t}\n\t}\n}\n","import { BinaryPackChunker, concatArrayBuffers } from \"./binaryPackChunker\";\nimport logger from \"../../logger\";\nimport type { Peer } from \"../../peer\";\nimport { BufferedConnection } from \"./BufferedConnection\";\nimport { SerializationType } from \"../../enums\";\nimport { pack, type Packable, unpack } from \"peerjs-js-binarypack\";\n\nexport class BinaryPack extends BufferedConnection {\n\tprivate readonly chunker = new BinaryPackChunker();\n\treadonly serialization = SerializationType.Binary;\n\n\tprivate _chunkedData: {\n\t\t[id: number]: {\n\t\t\tdata: Uint8Array[];\n\t\t\tcount: number;\n\t\t\ttotal: number;\n\t\t};\n\t} = {};\n\n\tpublic override close(options?: { flush?: boolean }) {\n\t\tsuper.close(options);\n\t\tthis._chunkedData = {};\n\t}\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\t}\n\n\t// Handles a DataChannel message.\n\tprotected override _handleDataMessage({ data }: { data: Uint8Array }): void {\n\t\tconst deserializedData = unpack(data);\n\n\t\t// PeerJS specific message\n\t\tconst peerData = deserializedData[\"__peerData\"];\n\t\tif (peerData) {\n\t\t\tif (peerData.type === \"close\") {\n\t\t\t\tthis.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Chunked data -- piece things back together.\n\t\t\t// @ts-ignore\n\t\t\tthis._handleChunk(deserializedData);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emit(\"data\", deserializedData);\n\t}\n\n\tprivate _handleChunk(data: {\n\t\t__peerData: number;\n\t\tn: number;\n\t\ttotal: number;\n\t\tdata: ArrayBuffer;\n\t}): void {\n\t\tconst id = data.__peerData;\n\t\tconst chunkInfo = this._chunkedData[id] || {\n\t\t\tdata: [],\n\t\t\tcount: 0,\n\t\t\ttotal: data.total,\n\t\t};\n\n\t\tchunkInfo.data[data.n] = new Uint8Array(data.data);\n\t\tchunkInfo.count++;\n\t\tthis._chunkedData[id] = chunkInfo;\n\n\t\tif (chunkInfo.total === chunkInfo.count) {\n\t\t\t// Clean up before making the recursive call to `_handleDataMessage`.\n\t\t\tdelete this._chunkedData[id];\n\n\t\t\t// We've received all the chunks--time to construct the complete data.\n\t\t\t// const data = new Blob(chunkInfo.data);\n\t\t\tconst data = concatArrayBuffers(chunkInfo.data);\n\t\t\tthis._handleDataMessage({ data });\n\t\t}\n\t}\n\n\tprotected override _send(data: Packable, chunked: boolean) {\n\t\tconst blob = pack(data);\n\t\tif (blob instanceof Promise) {\n\t\t\treturn this._send_blob(blob);\n\t\t}\n\n\t\tif (!chunked && blob.byteLength > this.chunker.chunkedMTU) {\n\t\t\tthis._sendChunks(blob);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._bufferedSend(blob);\n\t}\n\tprivate async _send_blob(blobPromise: Promise) {\n\t\tconst blob = await blobPromise;\n\t\tif (blob.byteLength > this.chunker.chunkedMTU) {\n\t\t\tthis._sendChunks(blob);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._bufferedSend(blob);\n\t}\n\n\tprivate _sendChunks(blob: ArrayBuffer) {\n\t\tconst blobs = this.chunker.chunk(blob);\n\t\tlogger.log(`DC#${this.connectionId} Try to send ${blobs.length} chunks...`);\n\n\t\tfor (const blob of blobs) {\n\t\t\tthis.send(blob, true);\n\t\t}\n\t}\n}\n","import logger from \"../../logger\";\nimport { DataConnection } from \"../DataConnection\";\n\nexport abstract class BufferedConnection extends DataConnection {\n\tprivate _buffer: any[] = [];\n\tprivate _bufferSize = 0;\n\tprivate _buffering = false;\n\n\tpublic get bufferSize(): number {\n\t\treturn this._bufferSize;\n\t}\n\n\tpublic override _initializeDataChannel(dc: RTCDataChannel) {\n\t\tsuper._initializeDataChannel(dc);\n\t\tthis.dataChannel.binaryType = \"arraybuffer\";\n\t\tthis.dataChannel.addEventListener(\"message\", (e) =>\n\t\t\tthis._handleDataMessage(e),\n\t\t);\n\t}\n\n\tprotected abstract _handleDataMessage(e: MessageEvent): void;\n\n\tprotected _bufferedSend(msg: ArrayBuffer): void {\n\t\tif (this._buffering || !this._trySend(msg)) {\n\t\t\tthis._buffer.push(msg);\n\t\t\tthis._bufferSize = this._buffer.length;\n\t\t}\n\t}\n\n\t// Returns true if the send succeeds.\n\tprivate _trySend(msg: ArrayBuffer): boolean {\n\t\tif (!this.open) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (this.dataChannel.bufferedAmount > DataConnection.MAX_BUFFERED_AMOUNT) {\n\t\t\tthis._buffering = true;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis._buffering = false;\n\t\t\t\tthis._tryBuffer();\n\t\t\t}, 50);\n\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.dataChannel.send(msg);\n\t\t} catch (e) {\n\t\t\tlogger.error(`DC#:${this.connectionId} Error when sending:`, e);\n\t\t\tthis._buffering = true;\n\n\t\t\tthis.close();\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t// Try to send the first message in the buffer.\n\tprivate _tryBuffer(): void {\n\t\tif (!this.open) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._buffer.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst msg = this._buffer[0];\n\n\t\tif (this._trySend(msg)) {\n\t\t\tthis._buffer.shift();\n\t\t\tthis._bufferSize = this._buffer.length;\n\t\t\tthis._tryBuffer();\n\t\t}\n\t}\n\n\tpublic override close(options?: { flush?: boolean }) {\n\t\tif (options?.flush) {\n\t\t\tthis.send({\n\t\t\t\t__peerData: {\n\t\t\t\t\ttype: \"close\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis._buffer = [];\n\t\tthis._bufferSize = 0;\n\t\tsuper.close();\n\t}\n}\n","import logger from \"../logger\";\nimport { Negotiator } from \"../negotiator\";\nimport {\n\tBaseConnectionErrorType,\n\tConnectionType,\n\tDataConnectionErrorType,\n\tServerMessageType,\n} from \"../enums\";\nimport type { Peer } from \"../peer\";\nimport { BaseConnection, type BaseConnectionEvents } from \"../baseconnection\";\nimport type { ServerMessage } from \"../servermessage\";\nimport type { EventsWithError } from \"../peerError\";\nimport { randomToken } from \"../utils/randomToken\";\n\nexport interface DataConnectionEvents\n\textends EventsWithError,\n\t\tBaseConnectionEvents {\n\t/**\n\t * Emitted when data is received from the remote peer.\n\t */\n\tdata: (data: unknown) => void;\n\t/**\n\t * Emitted when the connection is established and ready-to-use.\n\t */\n\topen: () => void;\n}\n\n/**\n * Wraps a DataChannel between two Peers.\n */\nexport abstract class DataConnection extends BaseConnection<\n\tDataConnectionEvents,\n\tDataConnectionErrorType\n> {\n\tprotected static readonly ID_PREFIX = \"dc_\";\n\tprotected static readonly MAX_BUFFERED_AMOUNT = 8 * 1024 * 1024;\n\n\tprivate _negotiator: Negotiator;\n\tabstract readonly serialization: string;\n\treadonly reliable: boolean;\n\n\tpublic get type() {\n\t\treturn ConnectionType.Data;\n\t}\n\n\tconstructor(peerId: string, provider: Peer, options: any) {\n\t\tsuper(peerId, provider, options);\n\n\t\tthis.connectionId =\n\t\t\tthis.options.connectionId || DataConnection.ID_PREFIX + randomToken();\n\n\t\tthis.label = this.options.label || this.connectionId;\n\t\tthis.reliable = !!this.options.reliable;\n\n\t\tthis._negotiator = new Negotiator(this);\n\n\t\tthis._negotiator.startConnection(\n\t\t\tthis.options._payload || {\n\t\t\t\toriginator: true,\n\t\t\t\treliable: this.reliable,\n\t\t\t},\n\t\t);\n\t}\n\n\t/** Called by the Negotiator when the DataChannel is ready. */\n\toverride _initializeDataChannel(dc: RTCDataChannel): void {\n\t\tthis.dataChannel = dc;\n\n\t\tthis.dataChannel.onopen = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc connection success`);\n\t\t\tthis._open = true;\n\t\t\tthis.emit(\"open\");\n\t\t};\n\n\t\tthis.dataChannel.onmessage = (e) => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc onmessage:`, e.data);\n\t\t\t// this._handleDataMessage(e);\n\t\t};\n\n\t\tthis.dataChannel.onclose = () => {\n\t\t\tlogger.log(`DC#${this.connectionId} dc closed for:`, this.peer);\n\t\t\tthis.close();\n\t\t};\n\t}\n\n\t/**\n\t * Exposed functionality for users.\n\t */\n\n\t/** Allows user to close connection. */\n\tclose(options?: { flush?: boolean }): void {\n\t\tif (options?.flush) {\n\t\t\tthis.send({\n\t\t\t\t__peerData: {\n\t\t\t\t\ttype: \"close\",\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (this._negotiator) {\n\t\t\tthis._negotiator.cleanup();\n\t\t\tthis._negotiator = null;\n\t\t}\n\n\t\tif (this.provider) {\n\t\t\tthis.provider._removeConnection(this);\n\n\t\t\tthis.provider = null;\n\t\t}\n\n\t\tif (this.dataChannel) {\n\t\t\tthis.dataChannel.onopen = null;\n\t\t\tthis.dataChannel.onmessage = null;\n\t\t\tthis.dataChannel.onclose = null;\n\t\t\tthis.dataChannel = null;\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._open = false;\n\n\t\tsuper.emit(\"close\");\n\t}\n\n\tprotected abstract _send(data: any, chunked: boolean): void | Promise;\n\n\t/** Allows user to send data. */\n\tpublic send(data: any, chunked = false) {\n\t\tif (!this.open) {\n\t\t\tthis.emitError(\n\t\t\t\tDataConnectionErrorType.NotOpenYet,\n\t\t\t\t\"Connection is not open. You should listen for the `open` event before sending messages.\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\treturn this._send(data, chunked);\n\t}\n\n\tasync handleMessage(message: ServerMessage) {\n\t\tconst payload = message.payload;\n\n\t\tswitch (message.type) {\n\t\t\tcase ServerMessageType.Answer:\n\t\t\t\tawait this._negotiator.handleSDP(message.type, payload.sdp);\n\t\t\t\tbreak;\n\t\t\tcase ServerMessageType.Candidate:\n\t\t\t\tawait this._negotiator.handleCandidate(payload.candidate);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlogger.warn(\n\t\t\t\t\t\"Unrecognized message type:\",\n\t\t\t\t\tmessage.type,\n\t\t\t\t\t\"from peer:\",\n\t\t\t\t\tthis.peer,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n","import { BufferedConnection } from \"./BufferedConnection\";\nimport { SerializationType } from \"../../enums\";\n\nexport class Raw extends BufferedConnection {\n\treadonly serialization = SerializationType.None;\n\n\tprotected _handleDataMessage({ data }) {\n\t\tsuper.emit(\"data\", data);\n\t}\n\n\toverride _send(data, _chunked) {\n\t\tthis._bufferedSend(data);\n\t}\n}\n","import { BufferedConnection } from \"./BufferedConnection\";\nimport { DataConnectionErrorType, SerializationType } from \"../../enums\";\nimport { util } from \"../../util\";\n\nexport class Json extends BufferedConnection {\n\treadonly serialization = SerializationType.JSON;\n\tprivate readonly encoder = new TextEncoder();\n\tprivate readonly decoder = new TextDecoder();\n\n\tstringify: (data: any) => string = JSON.stringify;\n\tparse: (data: string) => any = JSON.parse;\n\n\t// Handles a DataChannel message.\n\tprotected override _handleDataMessage({ data }: { data: Uint8Array }): void {\n\t\tconst deserializedData = this.parse(this.decoder.decode(data));\n\n\t\t// PeerJS specific message\n\t\tconst peerData = deserializedData[\"__peerData\"];\n\t\tif (peerData && peerData.type === \"close\") {\n\t\t\tthis.close();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emit(\"data\", deserializedData);\n\t}\n\n\toverride _send(data, _chunked) {\n\t\tconst encodedData = this.encoder.encode(this.stringify(data));\n\t\tif (encodedData.byteLength >= util.chunkedMTU) {\n\t\t\tthis.emitError(\n\t\t\t\tDataConnectionErrorType.MessageToBig,\n\t\t\t\t\"Message too big for JSON channel\",\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis._bufferedSend(encodedData);\n\t}\n}\n"],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$interopDefault","a","__esModule","default","$337647a69164cf0a$export$f1c5f4c9cb95390b","constructor","chunkedMTU","_dataCount","chunk","blob","chunks","size","byteLength","total","Math","ceil","index","start","end","min","b","slice","__peerData","data","push","$41cdfe0a3ede2608$var$$e8379818650e2442$export$93654d4f2d6cd524","append_buffer","flush","_parts","append","_pieces","length","buf","Uint8Array","toArrayBuffer","buffer","part","$41cdfe0a3ede2608$var$$e8379818650e2442$var$concatArrayBuffers","bufs","result","offset","view","byteOffset","encoder","TextEncoder","$41cdfe0a3ede2608$export$417857010dc9287f","unpacker","$41cdfe0a3ede2608$var$$0cfd7828ad59115f$var$Unpacker","unpack","$41cdfe0a3ede2608$export$2a703dbb0cb35339","packer","$41cdfe0a3ede2608$export$b9ec4b114aa40074","res","pack","Promise","then","getBuffer","type","unpack_uint8","unpack_raw","unpack_string","unpack_array","unpack_map","unpack_float","unpack_double","unpack_uint16","unpack_uint32","unpack_uint64","unpack_int8","unpack_int16","unpack_int32","unpack_int64","byte","dataView","bytes","read","uint16","uint32","uint64","uint8","Error","dataBuffer","c","code","i","str","String","fromCodePoint","objects","Array","map","sign","exp","h32","l32","hfrac","j","subarray","_bufferBuilder","value","pack_string","floor","pack_integer","pack_double","undefined","pack_array","ArrayBuffer","pack_bin","Date","toString","Blob","arrayBuffer","startsWith","pack_object","pack_uint8","pack_uint16","pack_uint32","encoded","_textEncoder","encode","ary","packNext","num","pack_int8","pack_int16","pack_int32","pack_int64","pack_uint64","log","LN2","frac1","frac0","obj","keys","prop","hasOwnProperty","high","low","$11d9b3e4fc7791e1$var$logDisabled_","$11d9b3e4fc7791e1$var$deprecationWarnings_","$11d9b3e4fc7791e1$export$e3c02be309be1f23","uastring","expr","pos","match","parseInt","$11d9b3e4fc7791e1$export$1f48841962b828b1","window1","eventNameToWrap","wrapper","RTCPeerConnection","proto","prototype","nativeAddEventListener","addEventListener","nativeEventName","cb","apply","arguments","wrappedCallback","modifiedEvent","handleEvent","_eventMap","Map","nativeRemoveEventListener","removeEventListener","has","unwrappedCb","delete","$11d9b3e4fc7791e1$export$afbfee8cc06fd3e4","bool","$11d9b3e4fc7791e1$export$51516be4b019e41e","$11d9b3e4fc7791e1$export$bef1f36f5486a6a3","window","console","$11d9b3e4fc7791e1$export$cdd73fc4100a6ef4","oldMethod","newMethod","warn","$11d9b3e4fc7791e1$var$isObject","val","call","$11d9b3e4fc7791e1$export$93439ffc3f787d51","track","outbound","streamStatsType","filteredResult","trackStats","forEach","trackIdentifier","id","trackStat","stats","trackId","$11d9b3e4fc7791e1$export$571b373e75babb58","base","resultSet","name","endsWith","LogLevel","ConnectionType","PeerErrorType","BaseConnectionErrorType","DataConnectionErrorType","SerializationType","SocketEventType","ServerMessageType","$6adb9b697958aa01$export$243e62d78d3b544d","$200acda04d260725$export$3157d57b4135e3bc","$200acda04d260725$export$9547aaa2e39030ff","$200acda04d260725$export$7974935686149686","$200acda04d260725$export$49ae800c114df41d","$200acda04d260725$export$89f507cf986a947","$200acda04d260725$export$3b5c4a4b6354f023","$200acda04d260725$export$adb4a1754da6f10d","$041f4f4318baab2c$exports","$b54ff3b82f3d51d6$export$1ed4910f4d37dc5e","browserDetails","navigator","mediaDevices","constraintsToChrome_","mandatory","optional","cc","key","r","ideal","exact","max","oldname_","prefix","charAt","toUpperCase","oc","mix","advanced","concat","shimConstraints_","constraints","func","version","JSON","parse","stringify","audio","remap","video","face","facingMode","getSupportedFacingModeLies","getSupportedConstraints","matches","enumerateDevices","devices","dev","filter","d","kind","find","some","label","toLowerCase","includes","deviceId","$b54ff3b82f3d51d6$var$logging","shimError_","PermissionDeniedError","PermissionDismissedError","InvalidStateError","DevicesNotFoundError","ConstraintNotSatisfiedError","TrackStartError","MediaDeviceFailedDueToShutdown","MediaDeviceKillSwitchOn","TabCaptureError","ScreenCaptureError","DeviceCaptureError","message","constraint","constraintName","getUserMedia","getUserMedia_","onSuccess","onError","webkitGetUserMedia","bind","origGetUserMedia","cs","stream","getAudioTracks","getVideoTracks","getTracks","stop","DOMException","reject","$4cbb13d690da2bd9$export$97270b87351d9c04","getSourceId","error","getDisplayMedia","sourceId","widthSpecified","width","heightSpecified","height","frameRateSpecified","frameRate","chromeMediaSource","chromeMediaSourceId","maxFrameRate","maxWidth","maxHeight","$041f4f4318baab2c$export$33ee24e7a300bcd1","MediaStream","webkitMediaStream","$041f4f4318baab2c$export$f358708f68ab068","transceiver","receiver","_ontrack","f","origSetRemoteDescription","setRemoteDescription","_ontrackpoly","te","getReceivers","event","Event","streams","dispatchEvent","$041f4f4318baab2c$export$a41a030a2842f5d6","shimSenderWithDtmf","pc","dtmf","_dtmf","createDTMFSender","_pc","getSenders","_senders","origAddTrack","addTrack","sender","origRemoveTrack","removeTrack","idx","indexOf","splice","origAddStream","addStream","origRemoveStream","removeStream","RTCRtpSender","origGetSenders","senders","$041f4f4318baab2c$export$90608323826f0b17","origGetStats","getStats","selector","onSucc","onErr","fixChromeStats_","response","standardReport","reports","report","standardStats","timestamp","localcandidate","remotecandidate","names","stat","makeMapStats","resolve","$041f4f4318baab2c$export$f2f0f2338114eb4b","RTCRtpReceiver","origGetReceivers","receivers","srcElement","MediaStreamTrack","err","$041f4f4318baab2c$export$30e3cdd46f8d5100","getLocalStreams","_shimmedLocalStreams","streamId","existingSenders","newSenders","newSender","$041f4f4318baab2c$export$9588259fcf4ebc91","origGetLocalStreams","nativeStreams","_reverseStreams","_streams","newStream","replaceInternalStreamId","description","sdp","internalId","externalStream","internalStream","replace","RegExp","RTCSessionDescription","signalingState","t","oldStream","method","nativeMethod","methodObj","args","isLegacyCall","desc","origSetLocalDescription","setLocalDescription","origLocalDescription","getOwnPropertyDescriptor","streamid","$041f4f4318baab2c$export$852a08dda9a55ea7","webkitRTCPeerConnection","RTCIceCandidate","$041f4f4318baab2c$export$341293bbeaae37cb","target","getConfiguration","sdpSemantics","$5ba25c21eb1c0af8$exports","$138811b977baa945$export$1ed4910f4d37dc5e","nativeGetUserMedia","getSettings","nativeGetSettings","applyConstraints","nativeApplyConstraints","$d08a6680f3298ef0$export$97270b87351d9c04","preferredMediaSource","mediaSource","$5ba25c21eb1c0af8$export$f358708f68ab068","RTCTrackEvent","$5ba25c21eb1c0af8$export$852a08dda9a55ea7","mozRTCPeerConnection","modernStatsTypes","inboundrtp","outboundrtp","candidatepair","nativeGetStats","assign","$5ba25c21eb1c0af8$export$f0525502095c04ef","$5ba25c21eb1c0af8$export$83d69126527b1171","$5ba25c21eb1c0af8$export$825e523ef749bd8c","$5ba25c21eb1c0af8$export$ff9cb3bc8990e8f7","DataChannel","RTCDataChannel","$5ba25c21eb1c0af8$export$70c77533b6e9908d","origAddTransceiver","addTransceiver","setParametersPromises","sendEncodings","shouldPerformCheck","encodingParam","ridRegex","test","rid","TypeError","parseFloat","scaleResolutionDownBy","RangeError","maxFramerate","params","getParameters","encodings","setParameters","catch","$5ba25c21eb1c0af8$export$66238223c298fbaa","origGetParameters","$5ba25c21eb1c0af8$export$51beccf0e777b843","origCreateOffer","createOffer","all","finally","$5ba25c21eb1c0af8$export$df0b46e7cef08150","origCreateAnswer","createAnswer","$93a503258ac80079$exports","$93a503258ac80079$export$8df41282f4fdcea2","_localStreams","_addTrack","tracks","$93a503258ac80079$export$762aa4cbb4f2f857","getRemoteStreams","_remoteStreams","_onaddstream","_onaddstreampoly","$93a503258ac80079$export$da31df245debdd3","addIceCandidate","successCallback","failureCallback","options","promise","withCallback","candidate","$93a503258ac80079$export$1ed4910f4d37dc5e","_getUserMedia","$93a503258ac80079$export$494a01ac68ba81ac","errcb","$11d9b3e4fc7791e1$export$15384eac40dc88c8","reduce","accumulator","isObj","isEmptyObject","$93a503258ac80079$export$671a8b47b41b6f41","OrigPeerConnection","pcConfig","pcConstraints","iceServers","newIceServers","server","urls","url","generateCertificate","$93a503258ac80079$export$85d53da088cb1b14","$93a503258ac80079$export$d444266503fdd2d4","offerOptions","offerToReceiveAudio","audioTransceiver","getTransceivers","direction","setDirection","offerToReceiveVideo","videoTransceiver","$93a503258ac80079$export$857cd739a7b795d2","AudioContext","webkitAudioContext","$f8e30544afcd11f0$exports","$f8e30544afcd11f0$export$cf133661e444ccfe","$f8e30544afcd11f0$export$fdafb8d8280e29b5","$f8e30544afcd11f0$export$a99147c78a56edc4","$f8e30544afcd11f0$export$d461c8d5c5db5da7","$f8e30544afcd11f0$export$63bb816cc75460","$f8e30544afcd11f0$export$a57d114344295149","$f8e30544afcd11f0$export$51d5e40b48c771c7","$f8e30544afcd11f0$export$7170d04e59f9d553","$30b3171bddcf6271$exports","$30b3171bddcf6271$var$SDPUtils","NativeRTCIceCandidate","substring","nativeCandidate","parsedCandidate","parseCandidate","toJSON","sdpMid","sdpMLineIndex","usernameFragment","writable","relayProtocol","priority","_sctp","sctpInDescription","sections","splitSections","shift","mediaSection","mLine","parseMLine","protocol","getRemoteFirefoxVersion","getCanSendMaxMessageSize","remoteIsFirefox","canSendMaxMessageSize","browser","getMaxMessageSize","maxMessageSize","matchPrefix","isFirefox","canSendMMS","remoteMMS","Number","POSITIVE_INFINITY","sctp","wrapDcSend","dc","origDataChannelSend","send","readyState","origCreateDataChannel","createDataChannel","dataChannel","channel","completed","checking","iceConnectionState","_onconnectionstatechange","origMethod","_connectionstatechangepoly","_lastConnectionState","connectionState","newEvent","nativeSRD","split","line","trim","join","nativeAddIceCandidate","nativeSetLocalDescription","generateIdentifier","random","localCName","splitLines","parts","getDescription","getMediaSections","foundation","component","ip","address","port","relatedAddress","relatedPort","tcpType","ufrag","writeCandidate","parseIceOptions","parseRtpMap","parsed","payloadType","clockRate","channels","numChannels","writeRtpMap","codec","pt","preferredPayloadType","parseExtmap","uri","attributes","writeExtmap","headerExtension","preferredId","parseFmtp","kv","writeFmtp","parameters","param","parseRtcpFb","parameter","writeRtcpFb","lines","rtcpFeedback","fb","parseSsrcMedia","sp","ssrc","colon","attribute","parseSsrcGroup","semantics","ssrcs","getMid","mid","parseFingerprint","algorithm","getDtlsParameters","sessionpart","role","fingerprints","writeDtlsParameters","setupType","fp","parseCryptoLine","tag","cryptoSuite","keyParams","sessionParams","writeCryptoLine","writeCryptoKeyParams","parseCryptoKeyParams","keyMethod","keySalt","lifeTime","mkiValue","mkiLength","getCryptoParameters","getIceParameters","pwd","password","writeIceParameters","iceLite","parseRtpParameters","codecs","headerExtensions","fecMechanisms","rtcp","mline","profile","rtpmapline","fmtps","wildcardRtcpFb","existingFeedback","writeRtpDescription","caps","maxptime","extension","parseRtpEncodingParameters","secondarySsrc","encodingParameters","hasRed","hasUlpfec","primarySsrc","flows","apt","encParam","codecPayloadType","rtx","fec","mechanism","bandwidth","maxBitrate","parseRtcpParameters","rtcpParameters","remoteSsrc","cname","rsize","reducedSize","compound","mux","writeRtcpParameters","parseMsid","spec","planB","msidParts","parseSctpDescription","maxSizeLine","isNaN","sctpPort","fmt","sctpMapLines","writeSctpDescription","media","output","generateSessionId","substr","writeSessionBoilerplate","sessId","sessVer","sessUser","getDirection","getKind","isRejected","parseOLine","username","sessionId","sessionVersion","netType","addressType","isValidSDP","$cd55ff0e0516c779$var$adapter","shimChrome","shimFirefox","shimSafari","$11d9b3e4fc7791e1$export$2d31490a0c05f094","userAgent","mozGetUserMedia","isSecureContext","supportsUnifiedPlan","RTCRtpTransceiver","adapter","commonShim","extractVersion","disableLog","disableWarnings","shimPeerConnection","logging","browserShim","shimGetUserMedia","shimMediaStream","shimOnTrack","shimAddTrackRemoveTrack","shimGetSendersWithDtmf","shimGetStats","shimSenderReceiverGetStats","fixNegotiationNeeded","shimRemoveStream","shimSenderGetStats","shimReceiverGetStats","shimRTCDataChannel","shimAddTransceiver","shimGetParameters","shimCreateOffer","shimCreateAnswer","shimRTCIceServerUrls","shimCreateOfferLegacy","shimCallbacksAPI","shimLocalStreamsAPI","shimRemoteStreamsAPI","shimTrackEventTransceiver","shimAudioContext","$f719426f9499296d$var$webRTCAdapter","$f719426f9499296d$export$25be9502477c137d","isWebRTCSupported","isBrowserSupported","getBrowser","getVersion","supportedBrowsers","minChromeVersion","minFirefoxVersion","isIOS","minSafariVersion","isUnifiedPlanSupported","tempPc","supported","close","platform","$fdc87120bf726113$export$f35f128fd59ea256","$eb24a05d5e66c1f6$export$4e61f672936bec77","$0c88dccd73f5641e$var$DEFAULT_CONFIG","credential","$0c88dccd73f5641e$export$7debb50ef11d5e0b","noop","blobToArrayBuffer","fr","FileReader","onload","evt","readAsArrayBuffer","binaryStringToArrayBuffer","binary","byteArray","charCodeAt","isSecure","location","CLOUD_HOST","CLOUD_PORT","chunkedBrowsers","Chrome","chrome","defaultConfig","browserVersion","supports","webRTC","audioVideo","binaryBlob","reliable","ordered","binaryType","validateId","randomToken","$6adb9b697958aa01$export$2e2bcd8739ae039","logLevel","_logLevel","_print","setLogFunction","fn","rest","copy","$6af28e6583ade012$exports","$6af28e6583ade012$var$has","$6af28e6583ade012$var$prefix","$6af28e6583ade012$var$Events","$6af28e6583ade012$var$EE","context","once","$6af28e6583ade012$var$addListener","emitter","listener","_events","_eventsCount","$6af28e6583ade012$var$clearEvent","$6af28e6583ade012$var$EventEmitter","create","__proto__","eventNames","events","getOwnPropertySymbols","listeners","handlers","l","ee","listenerCount","emit","a1","a2","a3","a4","a5","len","removeListener","on","removeAllListeners","off","addListener","prefixed","EventEmitter","$ccd644f7486bf635$exports","$9dca0f9415f15a97$export$4798917dbf149b79","token","_id","wsUrl","_baseUrl","_socket","_disconnected","WebSocket","onmessage","Message","onclose","_cleanup","Disconnected","onopen","_sendQueuedMessages","_scheduleHeartbeat","_wsPingTimer","setTimeout","_sendHeartbeat","pingInterval","_wsOpen","Heartbeat","copiedQueue","_messagesQueue","clearTimeout","secure","host","path","wsProtocol","$09f4090c200a4747$export$89e6bb5ad64bf4a","startConnection","peerConnection","_startPeerConnection","connection","Media","_stream","_addTracksToConnection","originator","dataConnection","config","_initializeDataChannel","_makeOffer","handleSDP","provider","_setupListeners","peerId","peer","connectionId","connectionType","onicecandidate","socket","Candidate","payload","dst","oniceconnectionstatechange","emitError","NegotiationFailed","ConnectionClosed","ondatachannel","getConnection","ontrack","_addStreamToMediaConnection","cleanup","peerConnectionNotClosed","dataChannelNotClosed","offer","sdpTransform","metadata","Data","serialization","Offer","WebRTC","err_1","_makeAnswer","answer","Answer","self","handleCandidate","ice","mediaConnection","$a084ca3b0aa8dd08$export$6a678e589c8a4542","$a084ca3b0aa8dd08$export$98871882f492de82","$e7e1c6f19b5349be$export$23a2a68283c24d80","open","_open","$b568d66a5799a705$export$4a84e95a2324ac29","localStream","_localStream","remoteStream","_remoteStream","handleMessage","_negotiator","_payload","_getMessages","_removeConnection","ID_PREFIX","$916c68e858bb49ef$export$2c4e825dc9120f87","_buildRequest","_options","URL","searchParams","now","fetch","href","referrerPolicy","retrieveId","status","text","pathError","listAllPeers","helpfulError","json","$4f9d208d5e349370$export$d365f7ad9d7df9c9","chunked","NotOpenYet","_send","MAX_BUFFERED_AMOUNT","$5a8a3892973da73a$export$ff7c9d4c11d94e8b","bufferSize","_bufferSize","_handleDataMessage","_bufferedSend","msg","_buffering","_trySend","_buffer","bufferedAmount","_tryBuffer","$e27c324aebf32a14$export$f0a5a64d5bb37108","_chunkedData","deserializedData","peerData","_handleChunk","chunkInfo","count","_send_blob","chunker","_sendChunks","blobPromise","blobs","Binary","$f1ddf74f51c0f6f4$export$6f88fe47d32c9c94","_chunked","None","$c051ae28a1212d1c$export$48880ac635f47186","decoder","decode","encodedData","MessageToBig","TextDecoder","$400fc96dabc502a5$export$ecd1fc136c422448","connections","plainConnections","k","_connections","destroyed","_destroyed","disconnected","_createServerConnection","_handleMessage","_abort","SocketError","Network","disconnect","Close","SocketClosed","_initialize","src","Open","_lastServerId","ServerError","IdTaken","UnavailableID","InvalidKey","Leave","_cleanupPeer","Expire","PeerUnavailable","_addConnection","_serializers","_storeMessage","_lostMessages","messages","connect","_delayedAbort","destroy","currentId","reconnect","_","_api","peers","userId","raw","debug","DEFAULT_KEY","serializers","hostname","logFunction","BrowserIncompatible","InvalidID","peerjs","Peer","util"],"version":3,"file":"peerjs.min.js.map"}