PageSourceSearch

https://hilbi.com/_next/static/chunks/2237-1331a36fbb07156b.js

js hilbi.com collected 2026-10-02 10:53:31 UTC 418,429 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f1b6185d-18a0-4d22-a3fb-575aaa471fb5",e._sentryDebugIdIdentifier="sentry-dbid-f1b6185d-18a0-4d22-a3fb-575aaa471fb5")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2237],{17187:function(e){"use strict";var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise(function(n,r){var i;function o(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}v(e,t,a,{once:!0}),"error"!==t&&(i={once:!0},"function"==typeof e.on&&v(e,"error",o,i))})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,n,r){if(s(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=c(e))>0&&a.length>i&&!a.warned){a.warned=!0;var i,o,a,u=Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function v(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else if("function"==typeof e.addEventListener)e.addEventListener(t,function i(o){r.once&&e.removeEventListener(t,i),n(o)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a}
1,set:function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var a,s=Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else for(var u=c.length,l=h(c,u),n=0;n<u;++n)r(l[n],this,t);return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,r,i,o,a;if(s(t),void 0===(r=this._events)||void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0==arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},53316:function(e){function t(e,t,n,r){var i=null==r||"number"==typeof r||"boolean"==typeof r?r:n(r),o=t.get(i);return void 0===o&&(o=e.call(this,r),t.set(i,o)),o}function n(e,t,n){var r=Array.prototype.slice.call(arguments,3),i=n(r),o=t.get(i);return void 0===o&&(o=e.apply(this,r),t.set(i,o)),o}function r(){return JSON.stringify(arguments)}function i(){this.cache=Object.create(null)}i.prototype.has=function(e){return e in this.cache},i.prototype.get=function(e){return this.cache[e]},i.prototype.set=function(e,t){this.cache[e]=t};var o={create:function(){return new i}};e.exports=function(e,i){var a=i&&i.cache?i.cache:o,s=i&&i.serializer?i.serializer:r;return(i&&i.strategy?i.strategy:function(e,r){var i,o,a=1===e.length?t:n;return i=r.cache.create(),o=r.serializer,a.bind(this,e,i,o)})(e,{cache:a,serializer:s})},e.exports.strategies={variadic:function(e,t){var r,i;return r=t.cache.create(),i=t.serializer,n.bind(this,e,r,i)},monadic:function(e,n){var r,i;return r=n.cache.create(),i=n.serializer,t.bind(this,e,r,i)}}},74837:function(e){"use strict";var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o={};
1((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(o,{default:()=>d,excludePostNominals:()=>u,nameFixer:()=>l,setOptions:()=>c}),e.exports=((e,o,a,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of r(o))i.call(e,c)||c===a||t(e,c,{get:()=>o[c],enumerable:!(s=n(o,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),o);var a=class{EXCEPTIONS=[[/\bMacEdo/,"Macedo"],[/\bMacEvicius/,"Macevicius"],[/\bMacHado/,"Machado"],[/\bMacHar/,"Machar"],[/\bMacHin/,"Machin"],[/\bMacHlin/,"Machlin"],[/\bMacIas/,"Macias"],[/\bMacIulis/,"Maciulis"],[/\bMacKie/,"Mackie"],[/\bMacKle/,"Mackle"],[/\bMacKlin/,"Macklin"],[/\bMacKmin/,"Mackmin"],[/\bMacQuarie/,"Macquarie"],[/\bMacOmber/,"Macomber"],[/\bMacIn/,"Macin"],[/\bMacKintosh/,"Mackintosh"],[/\bMacKen/,"Macken"],[/\bMacHen/,"Machen"],[/\bMacisaac/,"MacIsaac"],[/\bMacHiel/,"Machiel"],[/\bMacIol/,"Maciol"],[/\bMacKell/,"Mackell"],[/\bMacKlem/,"Macklem"],[/\bMacKrell/,"Mackrell"],[/\bMacLin/,"Maclin"],[/\bMacKey/,"Mackey"],[/\bMacKley/,"Mackley"],[/\bMacHell/,"Machell"],[/\bMacHon/,"Machon"]];REPLACEMENTS=[[/\b(Al)(\s+\w)/,"al$2"],[/\b(Ap)\b/,"ap"],[/\b(Bin|Binti|Binte)\b/,"bin"],[/\bDell([ae])\b/,"dell$1"],[/\bD([aeiou])\b/,"d$1"],[/\bD([ao]s)\b/,"d$1"],[/\bDe([lrn])\b/,"de$1"],[/\bL([eo])\b/,"l$1"],[/\b(El)\b/,"el"],[/\b(La)\b/,"la"],[/\b(Te)([rn])\b/,"te$2"],[/\b(Van)(\s+\w)/,"van$2"],[/\b(Von)\b/,"von"]];HEBREW=[[/\b(Ben)(\s+\w)/,"ben$2"],[/\b(Bat)(\s+\w)/,"bat$2"]];CONJUNCTIONS=["Y","E","I"];ROMAN_REGEX=/\b((?:[Xx]{1,3}|[Xx][Ll]|[Ll][Xx]{0,3})?(?:[Ii]{1,3}|[Ii][VvXx]|[Vv][Ii]{0,3})?)\b/g;POST_NOMINALS=["ACILEx","ACSM","ADC","AEPC","AFC","AFM","AICSM","AKC","AM","ARBRIBA","ARCS","ARRC","ARSM","AUH","AUS","BA","BArch","BCh","BChir","BCL","BDS","BEd","BEM","BEng","BM","BS","BSc","BSW","BVM&S","BVScBVetMed","CB","CBE","CEng","CertHE","CGC","CGM","CH","CIE","CMarEngCMarSci","CMarTech","CMG","CMILT","CML","CPhT","CPLCTP","CPM","CQSW","CSciTeach","CSI","CTL","CVO","DBE","DBEnv","DC","DCB","DCM","DCMG","DConstMgt","DCVO","DD","DEM","DFC","DFM","DIC","Dip","DipHE","DipLP","DipSW","DL","DLitt","DLP","DPhil","DProf","DPT","DREst","DSC","DSM","DSO","DSocSci","ED","EdD","EJLog","EMLog","EN","EngD","EngTech","ERD","ESLog","FADO","FAWM","FBDOFCOptom","FCEM","FCILEx","FCILT","FCSP.","FdAFdSc","FdEng","FFHOM","FFPM","FRCAFFPMRCA","FRCGP","FRCOG","FRCP","FRCPsych","FRCS","FRCVS","FSCR.","GBE","GC","GCB","GCIE","GCILEx","GCMG","GCSI","GCVO","GM","HNC","HNCert","HND","HNDip","ICTTech","IDSM","IEng","IMarEng","IOMCPM","ISO","J","JP","JrLog","KBE","KC","KCB","KCIE","KCMG","KCSI","KCVO","KG","KP","KT","LFHOM","LG","LJ","LLB","LLD","LLM","Log","LPE","LVO","MA","MAcc","MAnth","MArch","MarEngTech","MB","MBA","MBChB","MBE","MBEIOM","MBiochem","MC","MCEM","MCGI","MCh.","MChem","MChiro","MClinRes","MComp","MCOptom","MCSM","MCSP","MD","MEarthSc","MEng","MEnt","MEP","MFHOM","MFin","MFPM","MGeol","MILT","MJur","MLA","MLitt","MM","MMath","MMathStat","MMORSE","MMus","MOst","MP","MPAMEd","MPharm","MPhil","MPhys","MRCGP","MRCOG","MRCP","MRCPath","MRCPCHFRCPCH","MRCPsych","MRCS","MRCVS","MRes","MSc","MScChiro","MSci","MSCR","MSM","MSocSc","MSP","MSt","MSW","MSYP","MVO","NPQH","OBE","OBI","OM","OND","PgC","PGCAP","PGCE","PgCert","PGCHE","PgCLTHE","PgD","PGDE","PgDip","PhD","PLog","PLS","QAM","QC","QFSM","QGM","QHC","QHDS","QHNS","QHP","QHS","QPM","QS","QTSCSci","RD","RFHN","RGN","RHV","RIAI","RIAS","RM","RMN","RN","RN1RNA","RN2","RN3","RN4","RN5","RN6","RN7","RN8","RN9","RNC","RNLD","RNMH","ROH","RRC","RSAW","RSci","RSciTech","RSCN","RSN","RVM","RVN","SCHM","SCJ","SCLD","SEN","SGM","SL","SPANSPMH","SPCC","SPCN","SPDN","SPHP","SPLD","SrLog","SRN","SROT","TD","UD","V100","V200","V300","VC","VD","VetMB","VN","VRD"];LOWER_CASE_WORDS=["The","Of","And"];postNominalsExcluded=[];INITIAL_NAME_REGEX=/\b(Aj|[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]{2})\s/;INITIAL_NAME_EXCEPTIONS=["Mr","Ms","Dr","St","Jr","Sr","Lt"];
1options={lazy:!0,irish:!0,spanish:!0,roman:!0,hebrew:!0,postNominal:!0};bckOptions={...this.options};constructor(e){this.setOptions(e)}setOptions(e){this.options={...this.options,...e}}backupOptions(){this.bckOptions={...this.options}}restoreOptions(){this.options={...this.bckOptions}}excludePostNominals(e){this.postNominalsExcluded=this.postNominalsExcluded.concat(e)}nameFixer(e,t={}){if(""===e||(this.backupOptions(),this.setOptions(t),this.options.lazy&&this.skipMixed(e)))return e;for(let[t,n]of(e=this.capitalizeFirstLetters(e),e=this.lowercaseFinalS(e),e=this.updateIrish(e),this.getReplacements()))e=e.replace(t,n);return e=this.correctInitialNames(e),e=this.correctLowerCaseWords(e),e=this.processOptions(e),this.restoreOptions(),e}processOptions(e){return this.options.roman&&(e=this.updateRoman(e)),this.options.spanish&&(e=this.updateSpanish(e)),this.options.postNominal&&(e=this.fixPostNominal(e)),e}capitalizeFirstLetters(e){return(e=e.toLowerCase()).replace(/([\s,.:;"'(-]|^)([^\s,.:;"'(-])/g,(...e)=>e[1]+e[2].toUpperCase())}lowercaseFinalS(e){return e.replace(/'([^\s,.:;"'(-])([\s,.:;"'(-]|$)/g,(...e)=>"'"+e[1].toLowerCase()+e[2])}getReplacements(){let e=this.REPLACEMENTS;return this.options.hebrew&&(e=e.concat(this.HEBREW)),e}updateIrish(e){return this.options.irish?((/.*?\bMac[A-Za-z]{2,}[^aciozj]\b/.test(e)||/.*?\bMc/.test(e))&&(e=this.updateMac(e)),e.replace(/\bMacmurdo/,"MacMurdo").replace(/\bMacisaac/,"MacIsaac")):e}updateMac(e){for(let[t,n]of(e=e.replace(/\b(Ma?c)([A-Za-z]+)/,(...e)=>e[1]+e[2].charAt(0).toUpperCase()+e[2].substring(1)),this.EXCEPTIONS))e=e.replace(t,n);return e}updateRoman(e){return e.replace(this.ROMAN_REGEX,(...e)=>e[0].toUpperCase())}updateSpanish(e){for(let t of this.CONJUNCTIONS)e=e.replace(RegExp(`([\\s,.:;"'-(]|^)${t}([\\s,:;"'-(]|$)`,"g"),(...e)=>e[1]+t.toLowerCase()+e[2]);return e}correctInitialNames(e){return e.replace(this.INITIAL_NAME_REGEX,(...e)=>{let t=e[0];return this.INITIAL_NAME_EXCEPTIONS.includes(e[1])?t:t.toUpperCase()})}correctLowerCaseWords(e){for(let t of this.LOWER_CASE_WORDS)e=e.replace(RegExp(`([\\s,.:;"'-(]|^)${t}([\\s,.:;"'-(]|$)`,"g"),(...e)=>e[1]+t.toLowerCase()+e[2]);return e}fixPostNominal(e){for(let t of this.POST_NOMINALS.filter(e=>!this.postNominalsExcluded.includes(e)))e=e.replace(RegExp(`([\\s,.:;"'-(]|^)${this.capitalizeFirstLetters(t)}([\\s,.:;"'-(]|$)`,"g"),(...e)=>e[1]+t+e[2]);return e}skipMixed(e){let t=e[0]===e[0].toLowerCase(),n=e.toLowerCase()===e||e.toUpperCase()===e;return!(t||n)}},s=new a,c=e=>s.setOptions(e),u=e=>s.excludePostNominals(e),l=(e,t)=>s.nameFixer(e,t),d=a},9008:function(e,t,n){e.exports=n(23867)},64970:function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/react-webcam.tsx")}({
1"./src/react-webcam.tsx":function(e,t,n){"use strict";n.r(t);var r,i=n("react"),o=(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function c(){return!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)}"undefined"!=typeof window&&(void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(e){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return t?new Promise(function(n,r){t.call(navigator,e,n,r)}):Promise.reject(Error("getUserMedia is not implemented in this browser"))}));var u=function(e){function t(t){var n=e.call(this,t)||this;return n.canvas=null,n.ctx=null,n.requestUserMediaId=0,n.unmounted=!1,n.state={hasUserMedia:!1},n}return o(t,e),t.prototype.componentDidMount=function(){var e=this.state,t=this.props;if(this.unmounted=!1,!c()){t.onUserMediaError("getUserMedia not supported");return}e.hasUserMedia||this.requestUserMedia(),t.children&&"function"!=typeof t.children&&console.warn("children must be a function")},t.prototype.componentDidUpdate=function(e){var t=this.props;if(!c()){t.onUserMediaError("getUserMedia not supported");return}var n=JSON.stringify(e.audioConstraints)!==JSON.stringify(t.audioConstraints),r=JSON.stringify(e.videoConstraints)!==JSON.stringify(t.videoConstraints),i=e.minScreenshotWidth!==t.minScreenshotWidth,o=e.minScreenshotHeight!==t.minScreenshotHeight;(r||i||o)&&(this.canvas=null,this.ctx=null),(n||r)&&(this.stopAndCleanup(),this.requestUserMedia())},t.prototype.componentWillUnmount=function(){this.unmounted=!0,this.stopAndCleanup()},t.stopMediaStream=function(e){e&&(e.getVideoTracks&&e.getAudioTracks?(e.getVideoTracks().map(function(t){e.removeTrack(t),t.stop()}),e.getAudioTracks().map(function(t){e.removeTrack(t),t.stop()})):e.stop())},t.prototype.stopAndCleanup=function(){var e=this.state;e.hasUserMedia&&(t.stopMediaStream(this.stream),e.src&&window.URL.revokeObjectURL(e.src))},t.prototype.getScreenshot=function(e){var t=this.state,n=this.props;if(!t.hasUserMedia)return null;var r=this.getCanvas(e);return r&&r.toDataURL(n.screenshotFormat,n.screenshotQuality)},t.prototype.getCanvas=function(e){var t=this.state,n=this.props;if(!this.video||!t.hasUserMedia||!this.video.videoHeight)return null;if(!this.ctx){var r=this.video.videoWidth,i=this.video.videoHeight;if(!this.props.forceScreenshotSourceSize){var o=r/i;i=(r=n.minScreenshotWidth||this.video.clientWidth)/o,n.minScreenshotHeight&&i<n.minScreenshotHeight&&(r=(i=n.minScreenshotHeight)*o)}this.canvas=document.createElement("canvas"),this.canvas.width=(null==e?void 0:e.width)||r,this.canvas.height=(null==e?void 0:e.height)||i,this.ctx=this.canvas.getContext("2d")}var a=this.ctx,s=this.canvas;return a&&s&&(s.width=(null==e?void 0:e.width)||s.width,s.height=(null==e?void 0:e.height)||s.height,n.mirrored&&(a.translate(s.width,0),a.scale(-1,1)),a.imageSmoothingEnabled=n.imageSmoothing,a.drawImage(this.video,0,0,(null==e?void 0:e.width)||s.width,(null==e?void 0:e.height)||s.height),n.mirrored&&(a.scale(-1,1),a.translate(-s.width,0))),s},t.prototype.requestUserMedia=function(){var e=this,n=this.props,r=function(r,i){var o={video:void 0===i||i};n.audio&&(o.audio=void 0===r||r),e.requestUserMediaId++;var a=e.requestUserMediaId;navigator.mediaDevices.getUserMedia(o).then(function(n){e.unmounted||a!==e.requestUserMediaId?t.stopMediaStream(n):e.handleUserMedia(null,n)}).catch(function(t){e.handleUserMedia(t)})};if("mediaDevices"in navigator)r(n.audioConstraints,n.videoConstraints);else{var i=function(e){return{optional:[{sourceId:e}]}},o=function(e){var t=e.deviceId;return"string"==typeof t?t:Array.isArray(t)&&t.length>0?t[0]:"object"==typeof t&&t.ideal?t.ideal:null};MediaStreamTrack.getSources(function(e){var t=null,a=null;e.forEach(function(e){"audio"===e.kind?t=e.id:"video"===e.kind&&(a=e.id)});var s=o(n.audioConstraints);s&&(t=s);var c=o(n.videoConstraints);c&&(a=c),r(i(t),i(a))})}},t.prototype.handleUserMedia=function(e,t){var n=this.props;if(e||!t){this.setState({hasUserMedia:!1}),n.onUserMediaError(e);return}this.stream=t;try{this.video&&(this.video.srcObject=t),this.setState({hasUserMedia:!0})}catch(e){this.setState({hasUserMedia:!0,src:window.URL.createObjectURL(t)})}n.onUserMedia(t)},t.prototype.render=function(){var e=this,t=this.state,n=this.props,r=n.audio,o=(n.forceScreenshotSourceSize,n.disablePictureInPicture),c=(n.onUserMedia,n.onUserMediaError,n.screenshotFormat,n.screenshotQuality,n.minScreenshotWidth,n.minScreenshotHeight,n.audioConstraints,n.videoConstraints,n.imageSmoothing,n.mirrored),u=n.style,l=void 0===u?{}:u,d=n.children,p=s(n,["audio","forceScreenshotSourceSize","disablePictureInPicture","onUserMedia","onUserMediaError","screenshotFormat","screenshotQuality","minScreenshotWidth","minScreenshotHeight","audioConstraints","videoConstraints","imageSmoothing","mirrored","style","children"]),f=c?a(a({},l),{transform:(l.transform||"")+" scaleX(-1)"}):l,h={getScreenshot:this.getScreenshot.bind(this)};return i.createElement(i.Fragment,null,i.createElement("video",a({autoPlay:!0,disablePictureInPicture:o,src:t.src,muted:!r,playsInl
1ine:!0,ref:function(t){e.video=t},style:f},p)),d&&d(h))},t.defaultProps={audio:!1,disablePictureInPicture:!1,forceScreenshotSourceSize:!1,imageSmoothing:!0,mirrored:!1,onUserMedia:function(){},onUserMediaError:function(){},screenshotFormat:"image/webp",screenshotQuality:.92},t}(i.Component);t.default=u}
1,react:function(t,n){t.exports=e}}).default},e.exports=r(n(67294))},63651:function(e,t,n){"use strict";var r=n(17422);e.exports=function(e,t,n,i){var o,a=Error("Canceled");return new r(function(s,c,u){var l;e(function(e){return u()?r.reject(a):n(l=t(e)).then(function(e){if(u())throw a;return o=e()})}).then(function(e){if(u())throw e.disconnect(),a;s(i(l,e))}).catch(function(e){c(e)})},function(){o&&o.cancel()})}},21060:function(e,t,n){"use strict";var r=n(39778).MediaStreamTrack,i=n(67476),o=i.guessBrowser,a=i.guessBrowserVersion,s=i.isCodecSupported,c=n(63651),u=n(53111),l=n(81299),d=n(99849),p=n(58363),f=n(20186),h=f.LocalAudioTrack,v=f.LocalDataTrack,m=f.LocalVideoTrack,_=n(27453),y=n(77081),g=n(89528),b=n(96971),k=b.asLocalTrack,w=b.buildLogLevels,S=b.filterObject,T=b.isNonArrayObject,C=n(62097),O=C.DEFAULT_ENVIRONMENT,P=C.DEFAULT_LOG_LEVEL,E=C.DEFAULT_LOGGER_NAME,R=C.DEFAULT_REALM,L=C.DEFAULT_REGION,j=C.WS_SERVER,M=C.SDK_NAME,x=C.SDK_VERSION,A=C.typeErrors,D=n(17422),I=n(13451),N=n(36372),V=n(324).kG,F="safari"===o()&&a(),B=0,U=!1,H=!1;if(F){var W=F.major,Q=F.minor;H=W<12||12===W&&Q<1}var G=new Set([{didWarn:!1,shouldDelete:!0,name:"abortOnIceServersTimeout"},{didWarn:!1,shouldDelete:!0,name:"dscpTagging",newName:"enableDscp"},{didWarn:!1,shouldDelete:!0,name:"iceServersTimeout"},{didWarn:!1,shouldDelete:!1,name:"eventListener",newName:"Video.Logger"},{didWarn:!1,shouldDelete:!1,name:"logLevel",newName:"Video.Logger"}]),q=new Set([{didWarn:!1,shouldDelete:!1,name:"maxTracks",newName:"bandwidthProfile.video.clientTrackSwitchOffControl"},{didWarn:!1,shouldDelete:!1,name:"renderDimensions",newName:"bandwidthProfile.video.contentPreferencesMode"}]);function K(e,t,n){n.forEach(function(n){var r=n.didWarn,i=n.name,o=n.newName,a=n.shouldDelete;i in e&&void 0!==e[i]&&(o&&a&&(e[o]=e[i]),a&&delete e[i],r||["error","off"].includes(t.level)||(t.warn('The ConnectOptions "'+i+'" is '+(o?'deprecated and scheduled for removal. Please use "'+o+'" instead.':"no longer applicable and will be ignored.")),n.didWarn=!0))})}function z(e,t,n,r,i,o){var a=e.createLocalParticipantSignaling(n,r);return t.debug("Creating a new LocalParticipant:",a),new i.LocalParticipant(a,o,i)}function $(e,t,n){var r=new y(t,n,e),i=e.log;return i.debug("Creating a new Room:",r),n.on("stateChanged",function e(t){"disconnected"===t&&(i.info("Disconnected from Room:",r.toString()),n.removeListener("stateChanged",e))}),r}function J(e,t,n,r,i,o){return t.log.debug("Creating a new RoomSignaling"),n.connect(o._signaling,e,r,i,t)}function Y(e,t){var n=e.log;return e.shouldStopLocalTracks=!e.tracks,e.shouldStopLocalTracks?n.info("LocalTracks were not provided, so they will be acquired automatically before connecting to the Room. LocalTracks will be released if connecting to the Room fails or if the Room is disconnected"):(n.info("Getting LocalTracks"),n.debug("Options:",e)),e.createLocalTracks(e).then(function(r){var i=t(r);return i.catch(function(){e.shouldStopLocalTracks&&(n.info("The automatically acquired LocalTracks will now be stopped"),r.forEach(function(e){e.stop()}))}),i})}function X(e){var t="string"==typeof e?{codec:e}:e;switch(t.codec.toLowerCase()){case"opus":return Object.assign({dtx:!0},t);case"vp8":return Object.assign({simulcast:!1},t);default:return t}}e.exports=function(e,t){if(void 0===t&&(t={}),!T(t))return D.reject(A.INVALID_TYPE("options","object"));var n,i=t.Log||N,o=t.loggerName||E,a=t.logLevel||P,f=w(a),y="[connect #"+ ++B+"]";try{n=new i("default",y,f,o)}catch(e){return D.reject(e)}K(t,n,G);var b="auto"===t.preferredVideoCodecs;if(b&&(t.preferredVideoCodecs=[{codec:"VP8",simulcast:!0,adaptiveSimulcast:!0}]),t.maxVideoBitrate&&b)return n.error('ConnectOptions "maxVideoBitrate" is not compatible with "preferredVideoCodecs=auto"'),D.reject(A.ILLEGAL_INVOKE("connect",'ConnectOptions "maxVideoBitrate" is not compatible with "preferredVideoCodecs=auto"'));t=Object.assign({automaticSubscription:!0,dominantSpeaker:!1,enableDscp:!1,environment:O,eventListener:null,insights:!0,LocalAudioTrack:h,LocalDataTrack:v,LocalParticipant:l,LocalVideoTrack:m,Log:i,MediaStreamTrack:r,loggerName:o,logLevel:a,maxAudioBitrate:null,maxVideoBitrate:null,name:null,networkMonitor:!0,networkQuality:!1,preferredAudioCodecs:[],preferredVideoCodecs:[],realm:R,region:L,signaling:g},S(t));var C={};"string"==typeof t.wsServerInsights&&(C.gateway=t.wsServerInsights);var F=new(t.insights?d:p)(e,M,x,t.environment,t.realm,C),W=j(t.environment,t.region);if((t=Object.assign({eventObserver:new I(F,Date.now(),n,t.eventListener),wsServer:W},t)).log=n,H&&!U&&"error"!==n.logLevel&&"off"!==n.logLevel&&(U=!0,n.warn("Support for Safari 12.0 and below is limited because it does not support VP8. This means you may experience codec issues in Group Rooms. You may also experience codec issues in Peer-to-Peer (P2P) Rooms containing Android- or iOS-based Participants who do not support H.264. However, P2P Rooms with browser-based Participants should work. For more information, please refer to this guide: https://www.twilio.com/docs/video/javascript-v2-developing-safari-11")),"string"!=typeof e)return D.reject(A.INVALID_TYPE("token","string"));var Q=Object.assign({},t);if(delete Q.name,"tracks"in t){if(!Array.isArray(t.tracks))return D.reject(A.INVALID_TYPE("options.tracks","Array of LocalAudioTrack, LocalVideoTrack or MediaStreamTrack"));try{t.tracks=t.tracks.map(function(e){return k(e,Q)})}catch(e){return D.reject(e)}}var Z=V(t.bandwidthProfile);if(Z)return D.reject(Z);t.clientTrackSwitchOffControl="disabled",t.contentPreferencesMode="disabled",t.bandwidthProfile&&(t.clientTrackSwitchOffControl="auto",t.contentPreferencesMode="auto",t.bandwidthProfile.video&&(K(t.bandwidthProfile.video,n,q),"maxTracks"in t.bandwidthProfile.video?t.clientTrackSwitchOffControl="disabled":"manual"===t.bandwidthProfile.video.clientTrackSwitchOffControl?t.clientTrackSwitchOffControl="manual":t.clientTrackSwitchOffControl="auto","renderDimensions"in t.bandwidthProfile.video?t.contentPreferencesMode="disabled":"manual"===t.bandwidthProfile.video.contentPreferencesMode?t.contentPreferencesMode="manual":t.contentPreferencesMode="auto"));var ee=new t.signaling(t.wsServer,t);n.info("Connecting to a Room"),n.debug("Options:",t);var et=new u({maxAudioBitrate:t.maxAudioBitrate,maxVideoBitrate:t.maxVideoBitrate},b),en={audio:t.preferredAudioCodecs.map(X),video:t.preferredVideoCodecs.map(X)},er=new _(T(t.networkQuality)?t.networkQuality:{});["audio","video"].forEach(function(e){return en[e].forEach(function(t){var r=t.codec;return s(r,e).then(function(t){return!t&&n.warn("The preferred "+e+' codec "'+r+'" will be ignored as it is not supported by the browser.')})})});var ei=c(Y.bind(null,t),z.bind(null,ee,n,et,er,t),J.bind(null,e,t,ee,et,en),$.bind(null,t));return ei.then(function(e){return F.connect(e.sid,e.localParticipant.sid),n.info("Connected to Room:",e.toString()),n.info("Room name:",e.name),n.debug("Room:",e),e.once("disconnected",function(){return F.disconnect()}),e},function(e){F.disconnect(),ei._isCanceled?n.info("Attempt to connect to a Room was canceled"):n.info("Error while connecting to a Room:",e)}),ei}},79218:function(e,t,n){"use strict";var r=n(62097),i=r.DEFAULT_LOG_LEVEL,o=r.DEFAULT_LOGGER_NAME;function a(e,t){t=Object.assign({loggerName:o,logLevel:i},t);var n={};n.loggerName=t.loggerName,n.logLevel=t.logLevel,delete t.loggerName,delete t.logLevel;var r=t.createLocalTracks;return delete t.createLocalTracks,n[e]=!(Object.keys(t).length>0)||t,r(n).then(function(e){return e[0]})}
1e.exports={audio:function(e){return a("audio",e)},video:function(e){return a("video",e)}}},14769:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},s=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.createLocalTracks=void 0;var c=n(28151),u=n(96971).buildLogLevels,l=n(39778),d=l.getUserMedia,p=l.MediaStreamTrack,f=n(20186),h=f.LocalAudioTrack,v=f.LocalDataTrack,m=f.LocalVideoTrack,_=n(36372),y=n(62097),g=y.DEFAULT_LOG_LEVEL,b=y.DEFAULT_LOGGER_NAME,k=y.typeErrors.INVALID_VALUE,w=n(26245),S=0;t.createLocalTracks=function(e){return i(this,void 0,void 0,function(){var t,n,l,f,y,T,C,O,P,E,R,L,j,M=this;return o(this,function(x){switch(x.label){case 0:if(n=r({audio:t=!(e&&("audio"in e||"video"in e)),getUserMedia:d,loggerName:b,logLevel:g,LocalAudioTrack:h,LocalDataTrack:v,LocalVideoTrack:m,MediaStreamTrack:p,Log:_,video:t},e),l="[createLocalTracks #"+ ++S+"]",f=u(n.logLevel),T=Object.assign({log:y=new n.Log("default",l,f,n.loggerName)},n),delete T.name,!1===n.audio&&!1===n.video)return y.info("Neither audio nor video requested, so returning empty LocalTracks"),[2,[]];if(n.tracks)return y.info("Adding user-provided LocalTracks"),y.debug("LocalTracks:",n.tracks),[2,n.tracks];if((C={audio:"object"==typeof n.audio&&n.audio.name?{name:n.audio.name}:{defaultDeviceCaptureMode:"auto"},video:"object"==typeof n.video&&n.video.name?{name:n.video.name}:{}}).audio.isCreatedByCreateLocalTracks=!0,C.video.isCreatedByCreateLocalTracks=!0,"object"==typeof n.audio){if("boolean"==typeof n.audio.workaroundWebKitBug1208516&&(C.audio.workaroundWebKitBug1208516=n.audio.workaroundWebKitBug1208516),"noiseCancellationOptions"in n.audio&&(O=n.audio.noiseCancellationOptions,delete n.audio.noiseCancellationOptions),"defaultDeviceCaptureMode"in n.audio){if(["auto","manual"].every(function(e){return e!==n.audio.defaultDeviceCaptureMode}))throw k("CreateLocalAudioTrackOptions.defaultDeviceCaptureMode",["auto","manual"]);C.audio.defaultDeviceCaptureMode=n.audio.defaultDeviceCaptureMode}else C.audio.defaultDeviceCaptureMode="auto"}"object"==typeof n.video&&"boolean"==typeof n.video.workaroundWebKitBug1208516&&(C.video.workaroundWebKitBug1208516=n.video.workaroundWebKitBug1208516),"object"==typeof n.audio&&delete n.audio.name,"object"==typeof n.video&&delete n.video.name,P={audio:n.audio,video:n.video},E="object"==typeof n.audio&&n.audio.workaroundWebKitBug180748,x.label=1;case 1:return x.trys.push([1,4,,5]),[4,E?w(y,n.getUserMedia,P):n.getUserMedia(P)];case 2:return L=s(s([],a((R=x.sent()).getAudioTracks())),a(R.getVideoTracks())),y.info("Call to getUserMedia successful; got tracks:",L),[4,Promise.all(L.map(function(e){return i(M,void 0,void 0,function(){var t,n,i;return o(this,function(o){switch(o.label){case 0:if(!("audio"===e.kind&&O))return[3,2];return[4,c.applyNoiseCancellation(e,O,y)];case 1:return n=(t=o.sent()).cleanTrack,i=t.noiseCancellation,[2,new T.LocalAudioTrack(n,r(r(r({},C.audio),T),{noiseCancellation:i}))];case 2:if("audio"===e.kind)return[2,new T.LocalAudioTrack(e,r(r({},C.audio),T))];o.label=3;case 3:return[2,new T.LocalVideoTrack(e,r(r({},C.video),T))]}})})}))];case 3:return[2,x.sent()];case 4:throw j=x.sent(),y.warn("Call to getUserMedia failed:",j),j;case 5:return[2]}})})}},39538:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(65069),a=n(32003),s=function(e){function t(t){var n=e.call(this,t.label,t.maxPacketLifeTime,t.maxRetransmits,t.ordered)||this;return Object.defineProperties(n,{_dataChannel:{value:t}}),t.binaryType="arraybuffer",t.addEventListener("message",function(e){n.emit("message",e.data)}),t.addEventListener("close",function(){n.emit("close")}),n}return i(t,e),t.prototype.stop=function(){this._dataChannel.close(),e.prototype.stop.call(this)},t.prototype.toDataTransport=function(){return new a(this._dataChannel)},t}(o);e.exports=s},34716:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(65069),a=n(96971).makeUUID,s=function(e){function t(t,n,r){var i=e.call(this,a(),t,n,r)||this;return Object.defineProperties(i,{_clones:{value:new Set},_dataChannels:{value:new Set}}),i}return i(t,e),t.prototype._addClone=function(e){this._clones.add(e)},t.prototype.removeClone=function(e){this._clones.delete(e)},t.prototype.addDataChannel=function(e){return this._dataChannels.add(e),this},t.prototype.clone=function(){var e=this,n=new t(this.maxPacketLifeTime,this.maxRetransmits,this.ordered);return this._addClone(n),n.once("stopped",function(){return e.removeClone(n)}),n},t.prototype.removeDataChannel=function(e){return this._dataChannels.delete(e),this},t.prototype.send=function(e){return this._dataChannels.forEach(function(t){try{t.send(e)}catch(e){}}),this._clones.forEach(function(t){try{t.send(e)}catch(e){}}),this},t.prototype.stop=function(){this._dataChannels.forEach(function(e){return e.close()}),this._clones.forEach(function(e){return e.stop()}),e.prototype.stop.call(this)},t}(o);e.exports=s},65069:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r,i){var o=e.call(this,t,"data")||this;return Object.defineProperties(o,{maxPacketLifeTime:{enumerable:!0,value:n},maxRetransmits:{enumerable:!0,value:r},ordered:{enumerable:!0,value:i}}),o}return i(t,e),t}(n(69430));e.exports=o},32003:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t){var n=e.call(this)||this;return Object.defineProperties(n,{_dataChannel:{value:t},_messageQueue:{value:[]}}),t.addEventListener("open",function(){n._messageQueue.splice(0).forEach(function(e){return n._publish(e)})}),t.addEventListener("message",function(e){var t=e.data;try{var r=JSON.parse(t);n.emit("message",r)}catch(e){}}),n.publish({type:"ready"}),n}return i(t,e),t.prototype._publish=function(e){var t=JSON.stringify(e);try{this._dataChannel.send(t)}catch(e){}},t.prototype.publish=function(e){var t=this._dataChannel;return"closing"!==t.readyState&&"closed"!==t.readyState&&("connecting"===t.readyState?this._messageQueue.push(e):this._publish(e),!0)},t}(n(17187).EventEmitter);e.exports=o},53111:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this)||this;return Object.defineProperties(r,{maxAudioBitrate:{value:(t=Object.assign({maxAudioBitrate:null,maxVideoBitrate:null},t)).maxAudioBitrate,writable:!0},maxVideoBitrate:{value:t.maxVideoBitrate,writable:!0},adaptiveSimulcast:{value:n}}),r}return i(t,e),t.prototype.toJSON=function(){return{maxAudioBitrate:this.maxAudioBitrate,maxVideoBitrate:this.maxVideoBitrate}},t.prototype.update=function(e){var t=this;e=Object.assign({maxAudioBitrate:this.maxAudioBitrate,maxVideoBitrate:this.maxVideoBitrate},e),["maxAudioBitrate","maxVideoBitrate"].reduce(function(n,r){return t[r]!==e[r]&&(t[r]=e[r],n=!0),n},!1)&&this.emit("changed")},t}(n(17187).EventEmitter);e.exports=o},73029:function(e,t,n){"use strict";var r=n(17187).EventEmitter,i=n(96971).hidePrivateAndCertainPublicPropertiesInClass;e.exports=i(r,["domain"])},87255:function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},o=n(17187).EventEmitter,a=function(){function e(){Object.defineProperties(this,{_eventEmitter:{value:new o}})}return e.prototype.dispatchEvent=function(e){return this._eventEmitter.emit(e.type,e)},e.prototype.addEventListener=function(){var e;return(e=this._eventEmitter).addListener.apply(e,i([],r(arguments)))},e.prototype.removeEventListener=function(){var e;return(e=this._eventEmitter).removeListener.apply(e,i([],r(arguments)))},e}();e.exports=a},98445:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(14769),o=n(46200),a={connect:n(21060),createLocalAudioTrack:n(79218).audio,createLocalVideoTrack:n(79218).video,isSupported:n(21746)(),version:n(1730).version,Logger:n(85021),LocalAudioTrack:n(20186).LocalAudioTrack,LocalDataTrack:n(20186).LocalDataTrack,LocalVideoTrack:n(20186).LocalVideoTrack},s=a.isSupported,c=a.version,u=a.Logger,l=a.LocalAudioTrack,d=a.LocalVideoTrack,p=a.LocalDataTrack;e.exports={connect:function(e,t){var n=r({createLocalTracks:i.createLocalTracks},t);return a.connect(e,n)},createLocalAudioTrack:function(e){var t=r({createLocalTracks:i.createLocalTracks},e);return a.createLocalAudioTrack(t)},createLocalVideoTrack:function(e){var t=r({createLocalTracks:i.createLocalTracks},e);return a.createLocalVideoTrack(t)},createLocalTracks:i.createLocalTracks,runPreflight:o.runPreflight,isSupported:s,version:c,Logger:u,LocalAudioTrack:l,LocalVideoTrack:d,LocalDataTrack:p}},81299:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(39778).MediaStreamTrack,a=n(96971),s=a.asLocalTrack,c=a.asLocalTrackPublication,u=a.trackClass,l=n(62097),d=l.typeErrors,p=l.trackPriority,f=n(324).Wv,h=n(20186),v=h.LocalAudioTrack,m=h.LocalDataTrack,_=h.LocalVideoTrack,y=n(87959),g=n(55197),b=n(73445),k=function(e){function t(t,n,r){var i=this,a=(r=Object.assign({LocalAudioTrack:v,LocalVideoTrack:_,LocalDataTrack:m,MediaStreamTrack:o,LocalAudioTrackPublication:y,LocalVideoTrackPublication:b,LocalDataTrackPublication:g,shouldStopLocalTracks:!1,tracks:n},r)).shouldStopLocalTracks?new Set(n.filter(function(e){return"data"!==e.kind})):new Set;return Object.defineProperties(i=e.call(this,t,r)||this,{_eventObserver:{value:r.eventObserver},_LocalAudioTrack:{value:r.LocalAudioTrack},_LocalDataTrack:{value:r.LocalDataTrack},_LocalVideoTrack:{value:r.LocalVideoTrack},_MediaStreamTrack:{value:r.MediaStreamTrack},_LocalAudioTrackPublication:{value:r.LocalAudioTrackPublication},_LocalDataTrackPublication:{value:r.LocalDataTrackPublication},_LocalVideoTrackPublication:{value:r.LocalVideoTrackPublication},_tracksToStop:{value:a},signalingRegion:{enumerable:!0,get:function(){return t.signalingRegion}}}),i._handleTrackSignalingEvents(),i}return i(t,e),t.prototype._addTrack=function(t,n,r){var i=e.prototype._addTrack.call(this,t,n);return i&&"disconnected"!==this.state&&this._addLocalTrack(t,r),i},t.prototype._addLocalTrack=function(e,t){var n,r=null===(n=e.noiseCancellation)||void 0===n?void 0:n.vendor;this._signaling.addTrack(e._trackSender,e.name,t,r),this._log.info("Added a new "+u(e,!0)+":",e.id),this._log.debug(u(e,!0)+":",e)},t.prototype._removeTrack=function(t,n){var r=e.prototype._removeTrack.call(this,t,n);return r&&"disconnected"!==this.state&&(this._signaling.removeTrack(t._trackSender),this._log.info("Removed a "+u(t,!0)+":",t.id),this._log.debug(u(t,!0)+":",t)),r},t.prototype._getTrackEvents=function(){return e.prototype._getTrackEvents.call(this).concat([["disabled","trackDisabled"],["enabled","trackEnabled"],["stopped","trackStopped"]])},t.prototype.toString=function(){return"[LocalParticipant #"+this._instanceId+(this.sid?": "+this.sid:"")+"]"},t.prototype._handleTrackSignalingEvents=function(){var e=this,t=this._log;if("disconnected"!==this.state){var n=function(n){var r=e._signaling.getPublication(n._trackSender);r&&(r.disable(),t.debug("Disabled the "+u(n,!0)+":",n.id))},r=function(n){var r=e._signaling.getPublication(n._trackSender);r&&(r.enable(),t.debug("Enabled the "+u(n,!0)+":",n.id))},i=function(t){var n=e._signaling.getPublication(t._trackSender);return n&&n.stop(),n},o=function(a){t.debug("Transitioned to state:",a),"disconnected"===a?(t.debug("Removing LocalTrack event listeners"),e._signaling.removeListener("stateChanged",o),e.removeListener("trackDisabled",n),e.removeListener("trackEnabled",r),e.removeListener("trackStopped",i),e._tracks.forEach(function(e){var t=i(e);t&&e._trackSender.removeClone(t._trackTransceiver)}),t.info("LocalParticipant disconnected. Stopping "+e._tracksToStop.size+" automatically-acquired LocalTracks"),e._tracksToStop.forEac
1h(function(e){e.stop()})):"connected"===a&&(t.info("reconnected"),setTimeout(function(){return e.emit("reconnected")},0))};this.on("trackDisabled",n),this.on("trackEnabled",r),this.on("trackStopped",i),this._signaling.on("stateChanged",o),this._tracks.forEach(function(n){e._addLocalTrack(n,p.PRIORITY_STANDARD),e._getOrCreateLocalTrackPublication(n).catch(function(e){t.warn("Failed to get or create LocalTrackPublication for "+n+":",e)})})}},t.prototype._getOrCreateLocalTrackPublication=function(e){var t=w(this.tracks,e);if(t)return Promise.resolve(t);var n=this._log,r=this,i=this._signaling.getPublication(e._trackSender);return i?new Promise(function(o,a){i.on("updated",function s(){var l=i.error;if(l){i.removeListener("updated",s),n.warn("Failed to publish the "+u(e,!0)+": "+l.message),r._removeTrack(e,e.id),setTimeout(function(){r.emit("trackPublicationFailed",l,e)}),a(l);return}if(!r._tracks.has(e.id)){i.removeListener("updated",s),a(Error("The "+e+" was unpublished"));return}if(i.sid){i.removeListener("updated",s);var d={log:n,LocalAudioTrackPublication:r._LocalAudioTrackPublication,LocalDataTrackPublication:r._LocalDataTrackPublication,LocalVideoTrackPublication:r._LocalVideoTrackPublication};t=w(r.tracks,e);var p=function(e){return r.emit("trackWarning",e,t)},f=function(){return r.emit("trackWarningsCleared",t)};t||(t=c(e,i,function(e){t.removeListener("trackWarning",p),t.removeListener("trackWarningsCleared",f),r.unpublishTrack(e.track)},d),r._addTrackPublication(t)),t.on("warning",p),t.on("warningsCleared",f);var h=r._signaling.state;("connected"===h||"connecting"===h)&&(e._processorEventObserver&&e._processorEventObserver.on("event",function(e){r._eventObserver.emit("event",{name:e.name,payload:e.data,group:"video-processor",level:"info"})}),e.processedTrack&&(e._captureFrames(),e._setSenderMediaStreamTrack(!0))),"connected"===h&&setTimeout(function(){r.emit("trackPublished",t)}),o(t)}})}):Promise.reject(Error("Unexpected error: The "+e+" cannot be published"))},t.prototype.publishTrack=function(e,t){var n,r=w(this.tracks,e);if(r)return Promise.resolve(r);t=Object.assign({log:this._log,priority:p.PRIORITY_STANDARD,LocalAudioTrack:this._LocalAudioTrack,LocalDataTrack:this._LocalDataTrack,LocalVideoTrack:this._LocalVideoTrack,MediaStreamTrack:this._MediaStreamTrack},t);try{n=s(e,t)}catch(e){return Promise.reject(e)}var i=n.noiseCancellation,o=this._signaling.audioProcessors;i&&!o.includes(i.vendor)&&(this._log.warn(i.vendor+" is not supported in this room. disabling it permanently"),i.disablePermanently());var a=Object.values(p);if(!a.includes(t.priority))return Promise.reject(d.INVALID_VALUE("LocalTrackPublishOptions.priority",a));var c=this._addTrack(n,n.id,t.priority)||this._tracks.get(n.id);return this._getOrCreateLocalTrackPublication(c)},t.prototype.publishTracks=function(e){if(!Array.isArray(e))throw d.INVALID_TYPE("tracks","Array of LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack");return Promise.all(e.map(this.publishTrack,this))},t.prototype.setBandwidthProfile=function(){this._log.warn("setBandwidthProfile is not implemented yet and may be available in future versions of twilio-video.js")},t.prototype.setNetworkQualityConfiguration=function(e){if("object"!=typeof e||null===e)throw d.INVALID_TYPE("networkQualityConfiguration","NetworkQualityConfiguration");return["local","remote"].forEach(function(t){if(t in e&&("number"!=typeof e[t]||isNaN(e[t])))throw d.INVALID_TYPE("networkQualityConfiguration."+t,"number")}),this._signaling.setNetworkQualityConfiguration(e),this},t.prototype.setParameters=function(e){if(void 0!==e&&"object"!=typeof e)throw d.INVALID_TYPE("encodingParameters","EncodingParameters, null or undefined");if(e){if(this._signaling.getParameters().adaptiveSimulcast&&e.maxVideoBitrate)throw d.INVALID_TYPE("encodingParameters",'encodingParameters.maxVideoBitrate is not compatible with "preferredVideoCodecs=auto"');["maxAudioBitrate","maxVideoBitrate"].forEach(function(t){if(void 0!==e[t]&&"number"!=typeof e[t]&&null!==e[t])throw d.INVALID_TYPE("encodingParameters."+t,"number, null or undefined")})}else null===e&&(e={maxAudioBitrate:null,maxVideoBitrate:null});return this._signaling.setParameters(e),this},t.prototype.unpublishTrack=function(e){f(e,{LocalAudioTrack:this._LocalAudioTrack,LocalDataTrack:this._LocalDataTrack,LocalVideoTrack:this._LocalVideoTrack,MediaStreamTrack:this._MediaStreamTrack});var t=this._tracks.get(e.id);if(!t||(this._signaling.getPublication(t._trackSender).publishFailed(Error("The "+t+" was unpublished")),!(t=this._removeTrack(t,t.id))))return null;var n=w(this.tracks,t);return n&&this._removeTrackPublication(n),n},t.prototype.unpublishTracks=function(e){var t=this;if(!Array.isArray(e))throw d.INVALID_TYPE("tracks","Array of LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack");return e.reduce(function(e,n){var r=t.unpublishTrack(n);return r?e.concat(r):e},[])},t}(n(48948));function w(e,t){return Array.from(e.values()).find(function(e){return e.track===t||e.track.mediaStreamTrack===t})||null}e.exports=k},4592:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){return e.call(this,t,n)||this}return i(t,e),t.prototype.attach=function(){return e.prototype.attach.apply(this,arguments)},t.prototype.detach=function(){return e.prototype.detach.apply(this,arguments)},t}(n(39361));e.exports=o},20186:function(e,t,n){"use strict";e.exports={LocalAudioTrack:n(71662),LocalVideoTrack:n(82987),LocalDataTrack:n(94352)}},71662:function(e,t,n){"use strict";var r=n(14526),i=n(52935);function o(e,t){var n=new i(e,t);return Object.setPrototypeOf(n,o.prototype),n}r(o,i),e.exports=o},94352:function(e,t,n){"use strict";var r=n(14526),i=n(40429);function o(e){var t=new i(e);return Object.setPrototypeOf(t,o.prototype),t}r(o,i),e.exports=o},82987:function(e,t,n){"use strict";var r=n(14526),i=n(10566);function o(e,t){var n=new i(e,t);return Object.setPrototypeOf(n,o.prototype),n}r(o,i),e.exports=o},74958:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(73029),a=n(96971),s=a.buildLogLevels,c=a.valueToJSON,u=n(62097).DEFAULT_LOG_LEVEL,l=n(36372),d=0,p=function(e){function t(t,n,r){var i=this;r=Object.assign({name:t,log:null,logLevel:u},r),i=e.call(this)||this;var o=String(r.name),a=s(r.logLevel),c=r.log?r.log.createLog("media",i):new l("media",i,a,r.loggerName);return Object.defineProperties(i,{_instanceId:{value:++d},_log:{value:c},kind:{enumerable:!0,value:n},name:{enumerable:!0,value:o}}),i}return i(t,e),t.prototype.toJSON=function(){return c(this)},t}(o);e.exports=p},52935:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(49943).isIOS,a=n(48685),s=n(67476).isIOSChrome,c=n(4592),u=function(e){function t(t,n){var r=this,i=(null==n?void 0:n.noiseCancellation)||null,a=(r=e.call(this,t,n)||this)._log,s=t.label,c=t.getSettings(),u=c.deviceId,l=c.groupId;return Object.defineProperties(r,{_currentDefaultDeviceInfo:{value:{deviceId:void 0===u?"":u,groupId:void 0===l?"":l,label:void 0===s?"":s},writable:!0},_defaultDeviceCaptureMode:{value:!o()&&r._isCreatedByCreateLocalTracks&&"object"==typeof navigator&&"object"==typeof navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.addEventListener&&"function"==typeof navigator.mediaDevices.enumerateDevices?(null==n?void 0:n.defaultDeviceCaptureMode)||"auto":"manual"},_onDeviceChange:{value:function(){navigator.mediaDevices.enumerateDevices().then(function(e){var t=e.find(function(e){var t=e.deviceId;return"audioinput"===e.kind&&"default"!==t});t&&["deviceId","groupId"].some(function(e){return t[e]!==r._currentDefaultDeviceInfo[e]})&&(a.info("Default device changed, restarting the LocalAudioTrack"),a.debug('Old default device: "'+r._currentDefaultDeviceInfo.deviceId+'" => "'+r._currentDefaultDeviceInfo.label+'"'),a.debug('New default device: "'+t.deviceId+'" => "'+t.label+'"'),r._currentDefaultDeviceInfo=t,r._restartDefaultDevice().catch(function(e){return a.warn("Failed to restart: "+e.message)}))},function(e){a.warn("Failed to run enumerateDevices(): "+e.message)})}},_restartOnDefaultDeviceChangeCleanup:{value:null,writable:!0},noiseCancellation:{enumerable:!0,value:i,writable:!1}}),a.debug("defaultDeviceCaptureMode:",r._defaultDeviceCaptureMode),r._maybeRestartOnDefaultDeviceChange(),r}return i(t,e),t.prototype.toString=function(){return"[LocalAudioTrack #"+this._instanceId+": "+this.id+"]"},t.prototype.attach=function(t){return(t=e.prototype.attach.call(this,t)).muted=!0,t},t.prototype._end=function(){return e.prototype._end.apply(this,arguments)},t.prototype._maybeRestartOnDefaultDeviceChange=function(){var e=this,t=this._constraints,n=this._defaultDeviceCaptureMode,r=this._log,i=(this.noiseCancellation?this.noiseCancellation.sourceTrack:this.mediaStreamTrack).getSettings().deviceId,o=function(e){return e!==i||"default"===e},a=function e(t){return(void 0===t&&(t={}),"string"==typeof t)?o(t):Array.isArray(t)?t.every(o):t.exact?e(t.exact):!t.ideal||e(t.ideal)}(t.deviceId);"auto"===n&&a?this._restartOnDefaultDeviceChangeCleanup||(r.info("LocalAudioTrack will be restarted if the default device changes"),navigator.mediaDevices.addEventListener("devicechange",this._onDeviceChange),this._restartOnDefaultDeviceChangeCleanup=function(){r.info("Cleaning up the listener to restart the LocalAudioTrack if the default device changes"),navigator.mediaDevices.removeEventListener("devicechange",e._onDeviceChange),e._restartOnDefaultDeviceChangeCleanup=null}):(r.info("LocalAudioTrack will NOT be restarted if the default device changes"),this._restartOnDefaultDeviceChangeCleanup&&this._restartOnDefaultDeviceChangeCleanup())},t.prototype._reacquireTrack=function(t){var n=this;return(this._log.debug("_reacquireTrack: ",t),this.noiseCancellation)?this.noiseCancellation.reacquireTrack(function(){return e.prototype._reacquireTrack.call(n,t)}):e.prototype._reacquireTrack.call(this,t)},t.prototype._restartDefaultDevice=function(){var e=this,t=Object.assign({},this._constraints),n=Object.assign({},t,{deviceId:this._currentDefaultDeviceInfo.deviceId});return this.restart(n).then(function(){e._constraints=t,e._maybeRestartOnDefaultDeviceChange()})},t.prototype._setMediaStreamTrack=function(t){var n=this,r=this._log,i=this.noiseCancellation,o=e.prototype._setMediaStreamTrack.call(this,t);return s()&&i&&(r.debug("iOS Chrome detected, checking if the restarted Krisp audio is silent"),o=o.then(function(){return a(n._dummyEl)}).then(function(t){return r.debug("Krisp audio is "+(t?"silent, using source audio":"not silent")),t&&i.disablePermanently().then(function(){return e.prototype._setMediaStreamTrack.call(n,i.sourceTrack)})})),o},t.prototype.disable=function(){return e.prototype.disable.apply(this,arguments)},t.prototype.enable=function(){return e.prototype.enable.apply(this,arguments)},t.prototype.restart=function(){return e.prototype.restart.apply(this,arguments)},t.prototype.stop=function(){return this.noiseCancellation&&this.noiseCancellation.stop(),this._restartOnDefaultDeviceChangeCleanup&&this._restartOnDefaultDeviceChangeCleanup(),e.prototype.stop.apply(this,arguments)},t}(n(85820)(c));e.exports=u},87959:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i)||this}return i(t,e),t.prototype.toString=function(){return"[LocalAudioTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(n(6345));e.exports=o},40429:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(74958),a=n(34716),s=function(e){function t(t){var n=this,r=new(t=Object.assign({DataTrackSender:a,maxPacketLifeTime:null,maxRetransmits:null,ordered:!0}
1,t)).DataTrackSender(t.maxPacketLifeTime,t.maxRetransmits,t.ordered);return Object.defineProperties(n=e.call(this,r.id,"data",t)||this,{_trackSender:{value:r},id:{enumerable:!0,value:r.id},maxPacketLifeTime:{enumerable:!0,value:t.maxPacketLifeTime},maxRetransmits:{enumerable:!0,value:t.maxRetransmits},ordered:{enumerable:!0,value:t.ordered},reliable:{enumerable:!0,value:null===t.maxPacketLifeTime&&null===t.maxRetransmits}}),n}return i(t,e),t.prototype.send=function(e){this._trackSender.send(e)},t}(o);e.exports=s},55197:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i)||this}return i(t,e),t.prototype.toString=function(){return"[LocalDataTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(n(6345));e.exports=o},85820:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(39778).getUserMedia,a=n(49943).isIOS,s=n(96971),c=s.capitalize,u=s.defer,l=s.waitForSometime,d=s.waitForEvent,p=n(62097).typeErrors.ILLEGAL_INVOKE,f=n(48685),h=n(38815),v=n(68379),m=n(74919),_=n(26245),y=n(42259);function g(e){var t=e._log,n=e.kind,r=e._noiseCancellation,i={audio:f,video:h}[n],o=function(){return r?r.sourceTrack:e.mediaStreamTrack},a=e._dummyEl,s=o(),c=null;function p(){return Promise.race([d(s,"unmute"),l(50)]).then(function(){var n,r,s;return n=e._workaroundWebKitBug1208516Cleanup,r=e.isStopped&&!!n,s=o().muted,Promise.resolve().then(function(){return"visible"===document.visibilityState&&!c&&(s||r||a.play().then(function(){return i(a)}).then(function(e){return e?t.warn("Silence detected"):t.info("Non-silence detected"),e}).catch(function(e){t.warn("Failed to detect silence:",e)}).finally(function(){e.processedTrack||a.pause()}))})}).then(function(r){return r&&!c&&(c=u(),e._restart().finally(function(){a=e._dummyEl,g(),s=o(),y(),c.resolve(),c=null}).catch(function(e){t.error("failed to restart track: ",e)})),(c&&c.promise||Promise.resolve()).finally(function(){return m.resolveDeferred(n)})}).catch(function(e){t.error("error in maybeRestart: "+e.message)})}function _(){var t=e._log,n=e.kind;t.info("Muted"),t.debug("LocalMediaTrack:",e),m.startDeferred(n)}function y(){s.addEventListener("ended",p),s.addEventListener("mute",_),s.addEventListener("unmute",p)}function g(){s.removeEventListener("ended",p),s.removeEventListener("mute",_),s.removeEventListener("unmute",p)}var b=function(e){return!!e&&p()};return v.onVisibilityChange(1,b),y(),function(){v.offVisibilityChange(1,b),g()}}e.exports=function(e){return function(e){function t(t,n){var r=this;n=Object.assign({getUserMedia:o,isCreatedByCreateLocalTracks:!1,workaroundWebKitBug1208516:a()&&"object"==typeof document&&"function"==typeof document.addEventListener&&"string"==typeof document.visibilityState,gUMSilentTrackWorkaround:_},n);var i=new y(t),s=i.kind;return Object.defineProperties(r=e.call(this,i,n)||this,{_constraints:{value:"object"==typeof n[s]?n[s]:{},writable:!0},_getUserMedia:{value:n.getUserMedia},_gUMSilentTrackWorkaround:{value:n.gUMSilentTrackWorkaround},_eventsToReemitters:{value:new Map([["muted",function(){return r.emit("muted",r)}],["unmuted",function(){return r.emit("unmuted",r)}]])},_workaroundWebKitBug1208516:{value:n.workaroundWebKitBug1208516},_workaroundWebKitBug1208516Cleanup:{value:null,writable:!0},_didCallEnd:{value:!1,writable:!0},_isCreatedByCreateLocalTracks:{value:n.isCreatedByCreateLocalTracks},_noiseCancellation:{value:n.noiseCancellation||null},_trackSender:{value:i},id:{enumerable:!0,value:i.id},isEnabled:{enumerable:!0,get:function(){return i.enabled}},isMuted:{enumerable:!0,get:function(){return i.muted}},isStopped:{enumerable:!0,get:function(){return"ended"===i.readyState}}}),r._workaroundWebKitBug1208516&&(r._workaroundWebKitBug1208516Cleanup=g(r)),r._reemitTrackSenderEvents(),r}return i(t,e),t.prototype._end=function(){var t=this;this._didCallEnd||(e.prototype._end.call(this),this._didCallEnd=!0,this._eventsToReemitters.forEac
1h(function(e,n){return t._trackSender.removeListener(n,e)}),this.emit("stopped",this))},t.prototype._initialize=function(){this._didCallEnd&&(this._didCallEnd=!1),this._eventsToReemitters&&this._reemitTrackSenderEvents(),e.prototype._initialize.call(this)},t.prototype._reacquireTrack=function(e){var t,n=this._getUserMedia,r=this._gUMSilentTrackWorkaround,i=this._log,o=this.mediaStreamTrack.kind;i.info("Re-acquiring the MediaStreamTrack"),i.debug("Constraints:",e);var a=Object.assign({audio:!1,video:!1},((t={})[o]=e,t));return(this._workaroundWebKitBug1208516Cleanup?r(i,n,a):n(a)).then(function(e){return e.getTracks()[0]})},t.prototype._reemitTrackSenderEvents=function(){var e=this;this._eventsToReemitters.forEach(function(t,n){return e._trackSender.on(n,t)}),this._trackSender.dequeue("muted"),this._trackSender.dequeue("unmuted")},t.prototype._restart=function(e){var t=this,n=this._log;return e=e||this._constraints,this._stop(),this._reacquireTrack(e).catch(function(t){throw n.error("Failed to re-acquire the MediaStreamTrack:",{error:t,constraints:e}),t}).then(function(r){return n.info("Re-acquired the MediaStreamTrack"),n.debug("MediaStreamTrack:",r),t._constraints=Object.assign({},e),t._setMediaStreamTrack(r)})},t.prototype._setMediaStreamTrack=function(e){var t=this;return e.enabled=this.mediaStreamTrack.enabled,this._stop(),(this._unprocessedTrack?Promise.resolve().then(function(){t._unprocessedTrack=e}):this._trackSender.setMediaStreamTrack(e).catch(function(n){t._log.warn("setMediaStreamTrack failed:",{error:n,mediaStreamTrack:e})})).then(function(){t._initialize(),t._getAllAttachedElements().forEach(function(e){return t._attach(e)})})},t.prototype._stop=function(){return this.mediaStreamTrack.stop(),this._end(),this},t.prototype.enable=function(e){return(e="boolean"!=typeof e||e)!==this.mediaStreamTrack.enabled&&(this._log.info((e?"En":"Dis")+"abling"),this.mediaStreamTrack.enabled=e,this.emit(e?"enabled":"disabled",this)),this},t.prototype.disable=function(){return this.enable(!1)},t.prototype.restart=function(e){var t=this,n=this.kind;if(!this._isCreatedByCreateLocalTracks)return Promise.reject(p("restart","can only be called on a Local"+c(n)+"Track that is created using createLocalTracks or createLocal"+c(n)+"Track."));this._workaroundWebKitBug1208516Cleanup&&(this._workaroundWebKitBug1208516Cleanup(),this._workaroundWebKitBug1208516Cleanup=null);var r=this._restart(e);return this._workaroundWebKitBug1208516&&(r=r.finally(function(){t._workaroundWebKitBug1208516Cleanup=g(t)})),r},t.prototype.stop=function(){return this._log.info("Stopping"),this._workaroundWebKitBug1208516Cleanup&&(this._workaroundWebKitBug1208516Cleanup(),this._workaroundWebKitBug1208516Cleanup=null),this._stop()},t}(e)}},6345:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(56379),c=n(62097),u=c.typeErrors,l=c.trackPriority,d=function(e){function t(t,n,r,i){var s=e.call(this,n.name,t.sid,i)||this;return Object.defineProperties(s,{_reemitSignalingEvent:{value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.emit.apply(s,a([e&&e.length?"warning":"warningsCleared"],o(e)))}},_reemitTrackEvent:{value:function(){return s.emit(s.isTrackEnabled?"trackEnabled":"trackDisabled")}},_signaling:{value:t},_unpublish:{value:r},isTrackEnabled:{enumerable:!0,get:function(){return"data"===this.track.kind||this.track.isEnabled}},kind:{enumerable:!0,value:n.kind},priority:{enumerable:!0,get:function(){return t.updatedPriority}},track:{enumerable:!0,value:n}}),["disabled","enabled"].forEach(function(e){return n.on(e,s._reemitTrackEvent)}),["warning","warningsCleared"].forEach(function(e){return t.on(e,s._reemitSignalingEvent)}),s}return i(t,e),t.prototype.toString=function(){return"[LocalTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t.prototype.setPriority=function(e){var t=Object.values(l);if(!t.includes(e))throw u.INVALID_VALUE("priority",t);return this._signaling.setPriority(e),this},t.prototype.unpublish=function(){var e=this;return["disabled","enabled"].forEach(function(t){return e.track.removeListener(t,e._reemitTrackEvent)}),["warning","warningsCleared"].forEach(function(t){return e._signaling.removeListener(t,e._reemitSignalingEvent)}),this._unpublish(this),this},t}(s);e.exports=d},10566:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(49943).isIOS,a=n(38815),s=function(e){function t(t,n){var r=this;return n=Object.assign({workaroundSilentLocalVideo:o()&&"undefined"!=typeof document&&"function"==typeof document.createElement},n),Object.defineProperties(r=e.call(this,t,n)||this,{_workaroundSilentLocalVideo:{value:n.workaroundSilentLocalVideo?c:null},_workaroundSilentLocalVideoCleanup:{value:null,writable:!0}}),r._workaroundSilentLocalVideo&&(r._workaroundSilentLocalVideoCleanup=r._workaroundSilentLocalVideo(r,document)),r}return i(t,e),t.prototype.toString=function(){return"[LocalVideoTrack #"+this._instanceId+": "+this.id+"]"},t.prototype._checkIfCanCaptureFrames=function(){return e.prototype._checkIfCanCaptureFrames.call(this,this._trackSender.isPublishing)},t.prototype._end=function(){return e.prototype._end.apply(this,arguments)},t.prototype._setSenderMediaStreamTrack=function(e){var t=this,n=this.mediaStreamTrack,r=e?this.processedTrack:n;return this._trackSender.setMediaStreamTrack(r).catch(function(e){return t._log.warn("setMediaStreamTrack failed on LocalVideoTrack RTCRtpSender",{error:e,mediaStreamTrack:r})}).then(function(){t._unprocessedTrack=e?n:null})},t.prototype.addProcessor=function(){this._log.debug("Adding VideoProcessor to the LocalVideoTrack");var t=e.prototype.addProcessor.apply(this,arguments);return this.processedTrack?(this._log.debug("Updating LocalVideoTrack's MediaStreamTrack with the processed MediaStreamTrack",this.processedTrack),this._setSenderMediaStreamTrack(!0),t):this._log.warn("Unable to add a VideoProcessor to the LocalVideoTrack")},t.prototype.removeProcessor=function(){var t=this;this._log.debug("Removing VideoProcessor from the LocalVideoTrack");var n=e.prototype.removeProcessor.apply(this,arguments);return this._log.debug("Updating LocalVideoTrack's MediaStreamTrack with the original MediaStreamTrack"),this._setSenderMediaStreamTrack().then(function(){return t._updateElementsMediaStreamTrack()}),n},t.prototype.disable=function(){var t=e.prototype.disable.apply(this,arguments);return this.processedTrack&&(this.processedTrack.enabled=!1),t},t.prototype.enable=function(t){void 0===t&&(t=!0);var n=e.prototype.enable.apply(this,arguments);return this.processedTrack&&(this.processedTrack.enabled=t,t&&(this._captureFrames(),this._log.debug("Updating LocalVideoTrack's MediaStreamTrack with the processed MediaStreamTrack",this.processedTrack),this._setSenderMediaStreamTrack(!0))),n},t.prototype.restart=function(){var t=this;this._workaroundSilentLocalVideoCleanup&&(this._workaroundSilentLocalVideoCleanup(),this._workaroundSilentLocalVideoCleanup=null);var n=e.prototype.restart.apply(this,arguments);return this.processor&&n.then(function(){t._restartProcessor()}),this._workaroundSilentLocalVideo&&n.finally(function(){t._workaroundSilentLocalVideoCleanup=t._workaroundSilentLocalVideo(t,document)}),n},t.prototype.stop=function(){return this._workaroundSilentLocalVideoCleanup&&(this._workaroundSilentLocalVideoCleanup(),this._workaroundSilentLocalVideoCleanup=null),e.prototype.stop.apply(this,arguments)},t}(n(85820)(n(58222)));function c(e,t){var n=e._log,r=e._dummyEl,i=e.mediaStreamTrack;function o(){e.isEnabled&&(n.info("Unmuted, checking silence"),r.play().then(function(){return a(r,t)}).then(function(t){if(!t){n.info("Non-silent frames detected, so no need to restart");return}return n.warn("Silence detected, restarting"),e._stop(),e._restart()}).catch(function(e){n.warn("Failed to detect silence and restart:",e)}).finally(function(){(r=e._dummyEl)&&!r.paused&&!e.processedTrack&&r.pause(),i.removeEventListener("unmute",o),(i=e.mediaStreamTrack).addEventListener("unmute",o)}))}return i.addEventListener("unmute",o),function(){i.removeEventListener("unmute",o)}}e.exports=s},73445:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r,i){return e.call(this,t,n,r,i)||this}return i(t,e),t.prototype.toString=function(){return"[LocalVideoTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(n(6345));e.exports=o},39361:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(49943).isIOS,a=n(39778).MediaStream,s=n(96971),c=s.waitForEvent,u=s.waitForSometime,l=n(74919),d=function(e){function t(t,n){var r=this;n=Object.assign({playPausedElementsIfNotBackgrounded:o()&&"object"==typeof document&&"function"==typeof document.addEventListener&&"string"==typeof document.visibilityState},n),r=e.call(this,t.id,t.kind,n)||this;var i=!1;return n=Object.assign({MediaStream:a},n),Object.defineProperties(r,{_attachments:{value:new Set},_dummyEl:{value:null,writable:!0},_elShims:{value:new WeakMap},_isStarted:{get:function(){return i},set:function(e){i=e}},_playPausedElementsIfNotBackgrounded:{value:n.playPausedElementsIfNotBackgrounded},_shouldShimAttachedElements:{value:n.workaroundWebKitBug212780||n.playPausedElementsIfNotBackgrounded},_unprocessedTrack:{value:null,writable:!0},_MediaStream:{value:n.MediaStream},isStarted:{enumerable:!0,get:function(){return i}},mediaStreamTrack:{enumerable:!0,get:function(){return this._unprocessedTrack||t.track}},processedTrack:{enumerable:!0,value:null,writable:!0}}),r._initialize(),r}return i(t,e),t.prototype._start=function(){this._log.debug("Started"),this._isStarted=!0,this._dummyEl&&(this._dummyEl.oncanplay=null),this.emit("started",this)},t.prototype._initialize=function(){var e=this;this._log.debug("Initializing"),this._dummyEl=this._createElement(),this.mediaStreamTrack.addEventListener("ended",function t(){e._end(),e.mediaStreamTrack.removeEventListener("ended",t)}),this._dummyEl&&(this._dummyEl.muted=!0,this._dummyEl.oncanplay=this._start.bind(this,this._dummyEl),this._attach(this._dummyEl,this.mediaStreamTrack),this._attachments.delete(this._dummyEl))},t.prototype._end=function(){this._log.debug("Ended"),this._dummyEl&&(this._dummyEl.remove(),this._dummyEl.srcObject=null,this._dummyEl.oncanplay=null,this._dummyEl=null)},t.prototype.attach=function(e){var t=this;if("string"==typeof e?e=this._selectElement(e):e||(e=this._createElement()),this._log.debug("Attempting to attach to element:",e),e=this._attach(e),this._shouldShimAttachedElements&&!this._elShims.has(e)){var n,r,i,o,a,s,d=this._playPausedElementsIfNotBackgrounded?function(){var n,r,i;return n=e,r=t._log,i=n.tagName.toLowerCase(),void(r.warn("Unintentionally paused:",n),Promise.race([c(document,"visibilitychange"),u(1e3)]).then(function(){"visible"===document.visibilityState&&l.whenResolved("audio").then(function(){return r.info("Playing unintentionally paused <"+i+"> element"),r.debug("Element:",n),n.play()}).then(function(){r.info("Successfully played unintentionally paused <"+i+"> element"),r.debug("Element:",n)}).catch(function(e){r.warn("Error while playing unintentionally paused <"+i+"> element:",{error:e,el:n})})}))}:null;this._elShims.set(e,(n=e,void 0===(r=d)&&(r=null),i=n.pause,o=n.play,a=!1,n.pause=function(){return a=!0,i.call(n)},n.play=function(){return a=!1,o.call(n)},(s=r?function(){a||r()}:null)&&n.addEventListener("pause",s),{pausedIntentionally:function(){return a},unShim:function(){n.pause=i,n.play=o,s&&n.removeEventListener("pause",s)}}))}return e},t.prototype._attach=function(e,t){void 0===t&&(t=this.processedTrack||this.mediaStreamTrack);var n=e.srcObject;return n instanceof this._MediaStream||(n=new this._MediaStream),n["audio"===t.kind?"getAudioTracks":"getVideoTracks"]().forEac
1h(function(e){n.removeTrack(e)}),n.addTrack(t),e.srcObject=n,e.autoplay=!0,e.playsInline=!0,this._attachments.has(e)||this._attachments.add(e),e},t.prototype._selectElement=function(e){var t=document.querySelector(e);if(!t)throw Error("Selector matched no element: "+e);return t},t.prototype._updateElementsMediaStreamTrack=function(){var e=this;this._log.debug("Reattaching all elements to update mediaStreamTrack"),this._getAllAttachedElements().forEach(function(t){return e._attach(t)})},t.prototype._createElement=function(){return"undefined"!=typeof document?document.createElement(this.kind):null},t.prototype.detach=function(e){var t;return t="string"==typeof e?[this._selectElement(e)]:e?[e]:this._getAllAttachedElements(),this._log.debug("Attempting to detach from elements:",t),this._detachElements(t),e?t[0]:t},t.prototype._detachElements=function(e){return e.map(this._detachElement.bind(this))},t.prototype._detachElement=function(e){if(!this._attachments.has(e))return e;var t=e.srcObject;return t instanceof this._MediaStream&&t.removeTrack(this.processedTrack||this.mediaStreamTrack),this._attachments.delete(e),this._shouldShimAttachedElements&&this._elShims.has(e)&&(this._elShims.get(e).unShim(),this._elShims.delete(e)),e},t.prototype._getAllAttachedElements=function(){var e=[];return this._attachments.forEach(function(t){e.push(t)}),e},t}(n(74958));e.exports=d},28151:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.applyNoiseCancellation=t.NoiseCancellationImpl=void 0;var o=n(44006);n(36372);var a=function(){function e(e,t){this._processor=e,this._sourceTrack=t,this._disabledPermanent=!1}return Object.defineProperty(e.prototype,"vendor",{get:function(){return this._processor.vendor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sourceTrack",{get:function(){return this._sourceTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._processor.isEnabled()},enumerable:!1,configurable:!0}),e.prototype.enable=function(){if(this._disabledPermanent)throw Error(this.vendor+" noise cancellation is disabled permanently for this track");return this._processor.enable(),Promise.resolve()},e.prototype.disable=function(){return this._processor.disable(),Promise.resolve()},e.prototype.reacquireTrack=function(e){return r(this,void 0,void 0,function(){var t,n,r;return i(this,function(i){switch(i.label){case 0:return t=this._processor.isEnabled(),this._processor.disconnect(),[4,e()];case 1:return n=i.sent(),this._sourceTrack=n,[4,this._processor.connect(n)];case 2:return r=i.sent(),t?this._processor.enable():this._processor.disable(),[2,r]}})})},e.prototype.disablePermanently=function(){return this._disabledPermanent=!0,this.disable()},e.prototype.stop=function(){this._processor.disconnect(),this._sourceTrack.stop()},e}();t.NoiseCancellationImpl=a,t.applyNoiseCancellation=function(e,t,n){return r(this,void 0,void 0,function(){var r,s;return i(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,o.createNoiseCancellationAudioProcessor(t,n)];case 1:return[2,{cleanTrack:(r=i.sent()).connect(e),noiseCancellation:new a(r,e)}];case 2:return s=i.sent(),n.warn("Failed to create noise cancellation. Returning normal audio track: "+s),[2,{cleanTrack:e}];case 3:return[2]}})})}},38960:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){return e.call(this,t,n)||this}return i(t,e),t}(n(2854));e.exports=o},77480:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(4592),a=function(e){function t(t,n,r,i,o,a,s){return e.call(this,t,n,r,i,o,a,s)||this}return i(t,e),t.prototype.toString=function(){return"[RemoteAudioTrack #"+this._instanceId+": "+this.sid+"]"},t.prototype._start=function(){e.prototype._start.call(this),this._dummyEl&&(this._dummyEl.srcObject=null,this._dummyEl=null)},t.prototype.setPriority=function(t){return e.prototype.setPriority.call(this,t)},t}(n(80806)(o));e.exports=a},94685:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){return e.call(this,t,n)||this}return i(t,e),t.prototype.toString=function(){return"[RemoteAudioTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(n(34906));e.exports=o},30005:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(74958),c=n(62097),u=c.typeErrors,l=c.trackPriority,d=function(e){function t(t,n,r){var i=e.call(this,n.id,"data",r)||this;return Object.defineProperties(i,{_isSwitchedOff:{value:!1,writable:!0},_priority:{value:null,writable:!0},isEnabled:{enumerable:!0,value:!0},isSwitchedOff:{enumerable:!0,get:function(){return this._isSwitchedOff}},maxPacketLifeTime:{enumerable:!0,value:n.maxPacketLifeTime},maxRetransmits:{enumerable:!0,value:n.maxRetransmits},ordered:{enumerable:!0,value:n.ordered},priority:{enumerable:!0,get:function(){return this._priority}},reliable:{enumerable:!0,value:null===n.maxPacketLifeTime&&null===n.maxRetransmits},sid:{enumerable:!0,value:t}}),n.on("message",function(e){i.emit("message",e,i)}),i}return i(t,e),t.prototype.setPriority=function(e){var t=a([null],o(Object.values(l)));if(!t.includes(e))throw u.INVALID_VALUE("priority",t);return this._priority=e,this},t.prototype._setEnabled=function(){},t.prototype._setSwitchedOff=function(e){this._isSwitchedOff!==e&&(this._isSwitchedOff=e,this.emit
1(e?"switchedOff":"switchedOn",this))},t}(s);e.exports=d},22655:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){return e.call(this,t,n)||this}return i(t,e),t.prototype.toString=function(){return"[RemoteDataTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(n(34906));e.exports=o},80806:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(62097),c=s.typeErrors,u=s.trackPriority,l=n(49943).isIOS,d=n(68379);e.exports=function(e){return function(e){function t(t,n,r,i,o,a,s){var c=this;return s=Object.assign({workaroundWebKitBug212780:l()&&"object"==typeof document&&"function"==typeof document.addEventListener&&"string"==typeof document.visibilityState},s),Object.defineProperties(c=e.call(this,n,s)||this,{_isEnabled:{value:r,writable:!0},_isSwitchedOff:{value:i,writable:!0},_priority:{value:null,writable:!0},_setPriority:{value:o},_setRenderHint:{value:function(e){c._log.debug("updating render hint:",e),a(e)}},isEnabled:{enumerable:!0,get:function(){return this._isEnabled}},isSwitchedOff:{enumerable:!0,get:function(){return this._isSwitchedOff}},priority:{enumerable:!0,get:function(){return this._priority}},sid:{enumerable:!0,value:t},_workaroundWebKitBug212780:{value:s.workaroundWebKitBug212780},_workaroundWebKitBug212780Cleanup:{value:null,writable:!0}}),c}return i(t,e),t.prototype.setPriority=function(e){var t=a([null],o(Object.values(u)));if(!t.includes(e))throw c.INVALID_VALUE("priority",t);return this._priority!==e&&(this._priority=e,this._setPriority(e)),this},t.prototype._setEnabled=function(e){this._isEnabled!==e&&(this._isEnabled=e,this.emit(this._isEnabled?"enabled":"disabled",this))},t.prototype._setSwitchedOff=function(e){this._isSwitchedOff!==e&&(this._isSwitchedOff=e,this.emit(e?"switchedOff":"switchedOn",this))},t.prototype.attach=function(t){var n=e.prototype.attach.call(this,t);return!0!==this.mediaStreamTrack.enabled&&(this.mediaStreamTrack.enabled=!0,this.processedTrack&&(this.processedTrack.enabled=!0),this.processor&&this._captureFrames()),this._workaroundWebKitBug212780&&(this._workaroundWebKitBug212780Cleanup=this._workaroundWebKitBug212780Cleanup||function(e){var t=e._log,n=e.kind;function r(r){r&&e._attachments.forEach(function(r){var i=e._elShims.get(r);r.paused&&i&&!i.pausedIntentionally()&&(t.info("Playing inadvertently paused <"+n+"> element"),t.debug("Element:",r),t.debug("RemoteMediaTrack:",e),r.play().then(function(){t.info("Successfully played inadvertently paused <"+n+"> element"),t.debug("Element:",r),t.debug("RemoteMediaTrack:",e)}).catch(function(i){t.warn("Error while playing inadvertently paused <"+n+"> element:",{err:i,el:r,remoteMediaTrack:e})}))})}return d.onVisibilityChange(2,r),function(){d.offVisibilityChange(2,r)}}(this)),n},t.prototype.detach=function(t){var n=e.prototype.detach.call(this,t);return 0===this._attachments.size&&(this.mediaStreamTrack.enabled=!1,this.processedTrack&&(this.processedTrack.enabled=!1),this._workaroundWebKitBug212780Cleanup&&(this._workaroundWebKitBug212780Cleanup(),this._workaroundWebKitBug212780Cleanup=null)),n},t}(e)}},34906:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t.name,t.sid,n)||this;Object.defineProperties(r,{_signaling:{value:t},_track:{value:null,writable:!0},isSubscribed:{enumerable:!0,get:function(){return!!this._track}},isTrackEnabled:{enumerable:!0,get:function(){return t.isEnabled}},kind:{enumerable:!0,value:t.kind},publishPriority:{enumerable:!0,get:function(){return t.priority}},track:{enumerable:!0,get:function(){return this._track}}});var i=t.error,o=t.isEnabled,a=t.isSwitchedOff,s=t.priority;return t.on("updated",function(){if(i!==t.error){i=t.error,r.emit("subscriptionFailed",t.error);return}o!==t.isEnabled&&(o=t.isEnabled,r.track&&r.track._setEnabled(t.isEnabled),r.emit(t.isEnabled?"trackEnabled":"trackDisabled")),a!==t.isSwitchedOff&&(r._log.debug(r.trackSid+": "+(a?"OFF":"ON")+" => "+(t.isSwitchedOff?"OFF":"ON")),a=t.isSwitchedOff,r.track?(r.track._setSwitchedOff(t.isSwitchedOff),r.emit(a?"trackSwitchedOff":"trackSwitchedOn",r.track)):a&&r._log.warn("Track was not subscribed when switched Off.")),s!==t.priority&&(s=t.priority,r.emit("publishPriorityChanged",s))}),r}return i(t,e),t.prototype.toString=function(){return"[RemoteTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t.prototype._subscribed=function(e){!this._track&&e&&(this._track=e,this.emit("subscribed",e))},t.prototype._unsubscribe=function(){if(this._track){var e=this._track;this._track=null,this.emit("unsubscribed",e)}},t}(n(56379));e.exports=o},12099:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=n(80806),s=n(58222),c=n(68379),u=n(18537).NullObserver,l=n(75317),d=function(e){function t(t,n,r,i,o,a,s){var c=this;return s=Object.assign({clientTrackSwitchOffControl:"auto",contentPreferencesMode:"auto",enableDocumentVisibilityTurnOff:!0},s),s=Object.assign({IntersectionObserver:"undefined"==typeof IntersectionObserver||"auto"!==s.clientTrackSwitchOffControl?u:IntersectionObserver,ResizeObserver:"undefined"==typeof ResizeObserver||"auto"!==s.contentPreferencesMode?u:ResizeObserver},s),Object.defineProperties(c=e.call(this,t,n,r,i,o,a,s)||this,{_enableDocumentVisibilityTurnOff:{value:!0===s.enableDocumentVisibilityTurnOff&&"auto"===s.clientTrackSwitchOffControl},_documentVisibilityTurnOffCleanup:{value:null,writable:!0},_clientTrackSwitchOffControl:{value:s.clientTrackSwitchOffControl},_contentPreferencesMode:{value:s.contentPreferencesMode},_invisibleElements:{value:new WeakSet},_elToPipCallbacks:{value:new WeakMap},_elToPipWindows:{value:new WeakMap},_turnOffTimer:{value:new l(function(){c._setRenderHint({enabled:!1})},50,!1)},_resizeObserver:{value:new s.ResizeObserver(function(e){e.find(function(e){return!c._invisibleElements.has(e.target)})&&f(c)})},_intersectionObserver:{value:new s.IntersectionObserver(function(e){var t=!1;e.forEach(function(e){!c._invisibleElements.has(e.target)!==e.isIntersecting&&(e.isIntersecting?(c._log.debug("intersectionObserver detected: Off => On"),c._invisibleElements.delete(e.target)):(c._log.debug("intersectionObserver detected: On => Off"),c._invisibleElements.add(e.target)),t=!0)}),t&&(p(c),f(c))},{threshold:.25}
1)}}),c}return i(t,e),t.prototype._start=function(t){var n=e.prototype._start.call(this,t);return p(this),n},t.prototype.switchOn=function(){if("manual"!==this._clientTrackSwitchOffControl)throw Error('Invalid state. You can call switchOn only when bandwidthProfile.video.clientTrackSwitchOffControl is set to "manual"');return this._setRenderHint({enabled:!0}),this},t.prototype.switchOff=function(){if("manual"!==this._clientTrackSwitchOffControl)throw Error('Invalid state. You can call switchOff only when bandwidthProfile.video.clientTrackSwitchOffControl is set to "manual"');return this._setRenderHint({enabled:!1}),this},t.prototype.setContentPreferences=function(e){if("manual"!==this._contentPreferencesMode)throw Error('Invalid state. You can call switchOn only when bandwidthProfile.video.contentPreferencesMode is set to "manual"');return e.renderDimensions&&this._setRenderHint({renderDimensions:e.renderDimensions}),this},t.prototype._unObservePip=function(e){var t=this._elToPipCallbacks.get(e);t&&(e.removeEventListener("enterpictureinpicture",t.onEnterPip),e.removeEventListener("leavepictureinpicture",t.onLeavePip),this._elToPipCallbacks.delete(e))},t.prototype._observePip=function(e){var t=this;if(!this._elToPipCallbacks.get(e)){var n=function(n){return t._onEnterPip(n,e)},r=function(n){return t._onLeavePip(n,e)};e.addEventListener("enterpictureinpicture",n),e.addEventListener("leavepictureinpicture",r),this._elToPipCallbacks.set(e,{onEnterPip:n,onLeavePip:r,onResizePip:function(n){return t._onResizePip(n,e)}})}},t.prototype._onEnterPip=function(e,t){this._log.debug("onEnterPip");var n=e.pictureInPictureWindow;this._elToPipWindows.set(t,n);var r=this._elToPipCallbacks.get(t).onResizePip;n.addEventListener("resize",r),p(this)},t.prototype._onLeavePip=function(e,t){this._log.debug("onLeavePip"),this._elToPipWindows.delete(t);var n=this._elToPipCallbacks.get(t).onResizePip;e.pictureInPictureWindow.removeEventListener("resize",n),p(this)},t.prototype._onResizePip=function(){f(this)},t.prototype.attach=function(t){var n=e.prototype.attach.call(this,t);return"auto"===this._clientTrackSwitchOffControl&&this._invisibleElements.add(n),this._intersectionObserver.observe(n),this._resizeObserver.observe(n),this._enableDocumentVisibilityTurnOff&&(this._documentVisibilityTurnOffCleanup=this._documentVisibilityTurnOffCleanup||function(e){function t(){p(e)}return c.onVisibilityChange(1,t),function(){c.offVisibilityChange(1,t)}}(this)),this._observePip(n),n},t.prototype.detach=function(t){var n=this,r=e.prototype.detach.call(this,t);return(Array.isArray(r)?r:[r]).forEach(function(e){n._intersectionObserver.unobserve(e),n._resizeObserver.unobserve(e),n._invisibleElements.delete(e),n._unObservePip(e)}),0===this._attachments.size&&this._documentVisibilityTurnOffCleanup&&(this._documentVisibilityTurnOffCleanup(),this._documentVisibilityTurnOffCleanup=null),p(this),f(this),r},t.prototype.addProcessor=function(){return e.prototype.addProcessor.apply(this,arguments)},t.prototype.removeProcessor=function(){return e.prototype.removeProcessor.apply(this,arguments)},t.prototype.toString=function(){return"[RemoteVideoTrack #"+this._instanceId+": "+this.sid+"]"},t.prototype.setPriority=function(t){return e.prototype.setPriority.call(this,t)},t}(a(s));function p(e){if("auto"===e._clientTrackSwitchOffControl){var t=e._getAllAttachedElements().filter(function(t){return!e._invisibleElements.has(t)});!0==(e._getAllAttachedElements().filter(function(t){return e._elToPipWindows.has(t)}).length>0||"visible"===document.visibilityState&&t.length>0)?(e._turnOffTimer.clear(),e._setRenderHint({enabled:!0})):e._turnOffTimer.isSet||e._turnOffTimer.start()}}function f(e){if("auto"===e._contentPreferencesMode){var t=e._getAllAttachedElements().filter(function(t){return!e._invisibleElements.has(t)}),n=e._getAllAttachedElements().map(function(t){var n=e._elToPipWindows.get(t);return n?{clientHeight:n.height,clientWidth:n.width}:{clientHeight:0,clientWidth:0}}),r=t.concat(n);if(r.length>0){var i=o(r.sort(function(e,t){return t.clientHeight+t.clientWidth-e.clientHeight-e.clientWidth-1}),1)[0],a=i.clientHeight,s=i.clientWidth;e._setRenderHint({renderDimensions:{height:a,width:s}})}}}e.exports=d},26329:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){return e.call(this,t,n)||this}return i(t,e),t.prototype.toString=function(){return"[RemoteVideoTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(n(34906));e.exports=o},42259:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=function(e){function t(t){var n=e.call(this,t.id,t)||this;return Object.defineProperties(n,{_clones:{value:new Set},_eventsToReemitters:{value:new Map([["mute",function(){return n.queue("muted")}],["unmute",function(){return n.queue("unmuted")}]])},_senders:{value:new Set},_senderToPublisherHintCallbacks:{value:new Map},isPublishing:{enumerable:!0,get:function(){return!!this._clones.size}},muted:{enumerable:!0,get:function(){return this._track.muted}}}),n._reemitMediaStreamTrackEvents(),n}return i(t,e),t.prototype._reemitMediaStreamTrackEvents=function(e){void 0===e&&(e=this._track);var t=this._eventsToReemitters,n=this._track;t.forEach(function(t,n){return e.addEventListener(n,t)}),n!==e&&(t.forEach(function(e,t){return n.removeEventListener(t,e)}),n.muted!==e.muted&&t.get(e.muted?"mute":"unmute")())},t.prototype.clone=function(){var e=new t(this.track.clone());return this._clones.add(e),e},t.prototype.removeClone=function(e){this._clones.delete(e)},t.prototype.setMediaStreamTrack=function(e){var t=this,n=Array.from(this._clones),r=Array.from(this._senders);return Promise.all(n.map(function(t){return t.setMediaStreamTrack(e.clone())}).concat(r.map(function(n){return t._replaceTrack(n,e)}))).finally(function(){t._reemitMediaStreamTrackEvents(e),t._track=e})},t.prototype.addSender=function(e,t){return this._senders.add(e),t&&this._senderToPublisherHintCallbacks.set(e,t),this},t.prototype.removeSender=function(e){return this._senders.delete(e),this._senderToPublisherHintCallbacks.delete(e),this},t.prototype.setPublisherHint=function(e){var t=o(Array.from(this._senderToPublisherHintCallbacks.values()),1)[0];return t?t(e):Promise.resolve("COULD_NOT_APPLY_HINT")},t.prototype._replaceTrack=function(e,t){var n=this;return e.replaceTrack(t).then(function(e){return n.setPublisherHint(null).catch(function(){}),n.emit("replaced"),e})},t}(n(2854));e.exports=a},56379:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(73029),a=n(96971),s=a.buildLogLevels,c=a.valueToJSON,u=n(62097).DEFAULT_LOG_LEVEL,l=n(36372),d=0,p=function(e){function t(t,n,r){var i=e.call(this)||this,o=s((r=Object.assign({logLevel:u},r)).logLevel);return Object.defineProperties(i,{_instanceId:{value:d++},_log:{value:r.log?r.log.createLog("default",i):new l("default",i,o,r.loggerName)}
1,trackName:{enumerable:!0,value:t},trackSid:{enumerable:!0,value:n}}),i}return i(t,e),t.prototype.toJSON=function(){return c(this)},t.prototype.toString=function(){return"[TrackPublication #"+this._instanceId+": "+this.trackSid+"]"},t}(o);e.exports=p},2854:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,n.kind)||this;return Object.defineProperties(r,{_track:{value:n,writable:!0},enabled:{enumerable:!0,get:function(){return this._track.enabled}},readyState:{enumerable:!0,get:function(){return this._track.readyState}},track:{enumerable:!0,get:function(){return this._track}}}),r}return i(t,e),t.prototype.stop=function(){this.track.stop(),e.prototype.stop.call(this)},t}(n(69430));e.exports=o},54028:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(17187).EventEmitter,a=n(62097).DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS,s=function(e){function t(t){var n=e.call(this)||this;return Object.defineProperties(n,{_lastStatsSaveTime:{value:null,writable:!0},_lastStatsPublishTime:{value:null,writable:!0},_log:{value:t},_processorInfo:{value:null,writable:!0},_stats:{value:null,writable:!0}}),n.on("add",function(e){n._lastStatsSaveTime=Date.now(),n._lastStatsPublishTime=Date.now(),n._processorInfo=e,n._stats=[],n._reemitEvent("add",n._getEventData())}),n.on("remove",function(){var e=n._getEventData();n._lastStatsSaveTime=null,n._lastStatsPublishTime=null,n._processorInfo=null,n._stats=null,n._reemitEvent("remove",e)}),n.on("start",function(){n._reemitEvent("start",n._getEventData())}),n.on("stop",function(e){n._reemitEvent("stop",Object.assign({message:e},n._getEventData()))}),n.on("stats",function(){return n._maybeEmitStats()}),n}return i(t,e),t.prototype._getEventData=function(){if(!this._processorInfo)return{};var e=this._processorInfo,t=e.processor,n={captureHeight:e.captureHeight,captureWidth:e.captureWidth,inputFrameRate:e.inputFrameRate,isRemoteVideoTrack:e.isRemoteVideoTrack,inputFrameBufferType:e.inputFrameBufferType,outputFrameBufferContextType:e.outputFrameBufferContextType};return n.name=t._name||"VideoProcessor",["assetsPath","blurFilterRadius","debounce","fitType","isSimdEnabled","maskBlurRadius","pipeline","version"].forEach(function(e){var r=t["_"+e];void 0!==r&&(n[e]=r)}),Object.keys(n).forEach(function(e){var t=n[e];"boolean"==typeof t&&(n[e]=t?"true":"false")}),n},t.prototype._maybeEmitStats=function(){if(this._stats&&this._processorInfo){var e=this._processorInfo.processor._benchmark;if(e){var t=Date.now();if(!(t-this._lastStatsSaveTime<1e3)){var n={outputFrameRate:e.getRate("totalProcessingDelay")};if(["captureFrameDelay","imageCompositionDelay","inputImageResizeDelay","processFrameDelay","segmentationDelay"].forEach(function(t){n[t]=e.getAverageDelay(t)}),this._lastStatsSaveTime=t,this._stats.push(n),!(t-this._lastStatsPublishTime<a)){this._lastStatsPublishTime=t;var r=this._stats.splice(0).reduce(function(e,t,r){return Object.keys(n).forEach(function(n){e[n]||(e[n]=0),e[n]=(e[n]*r+t[n])/(r+1)}),e},{});Object.keys(r).forEach(function(e){r[e]=parseFloat(r[e].toFixed(2))}),this._reemitEvent("stats",Object.assign({},r,this._getEventData()))}}}}},t.prototype._reemitEvent=function(e,t){this._log.debug("VideoProcessor:"+e,t),this.emit
1("event",{name:e,data:t})},t}(o);e.exports=s},58222:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(39361),a=n(54028),s=n(62097).DEFAULT_FRAME_RATE,c=function(e){function t(t,n){var r=e.call(this,t,n)||this;return Object.defineProperties(r,{_captureTimeoutId:{value:null,writable:!0},_isCapturing:{value:!1,writable:!0},_inputFrame:{value:null,writable:!0},_outputFrame:{value:null,writable:!0},_processorEventObserver:{value:null,writable:!0},_processorOptions:{value:{},writable:!0},_unmuteHandler:{value:null,writable:!0},dimensions:{enumerable:!0,value:{width:null,height:null}},processor:{enumerable:!0,value:null,writable:!0}}),r._processorEventObserver=new(n.VideoProcessorEventObserver||a)(r._log),r}return i(t,e),t.prototype._checkIfCanCaptureFrames=function(e){void 0===e&&(e=!1);var t=!0,n="",r=this.mediaStreamTrack;return r.enabled||(t=!1,n="MediaStreamTrack is disabled"),"ended"===r.readyState&&(t=!1,n="MediaStreamTrack is ended"),this.processor||(t=!1,n="VideoProcessor not detected."),this._attachments.size||e||(t=!1,n="VideoTrack is not publishing and there is no attached element."),n&&this._log.debug(n),{canCaptureFrames:t,message:n}},t.prototype._captureFrames=function(){var e,t=this;if(this._isCapturing){this._log.debug("Ignoring captureFrames call. Capture is already in progress");return}if(!this._checkIfCanCaptureFrames().canCaptureFrames){this._isCapturing=!1,this._log.debug("Cannot capture frames. Ignoring captureFrames call.");return}this._isCapturing=!0,this._processorEventObserver.emit("start"),this._log.debug("Start capturing frames");var n=Date.now();this._dummyEl.play().then(function(){var r=function(n){clearTimeout(t._captureTimeoutId);var r=t.mediaStreamTrack.getSettings().frameRate,i=Math.floor(1e3/(void 0===r?s:r))-e;(i<0||"number"!=typeof e)&&(i=0),t._captureTimeoutId=setTimeout(n,i)},i=function(){var o=t._checkIfCanCaptureFrames();if(!o.canCaptureFrames){t._isCapturing=!1,t._processorEventObserver.emit("stop",o.message),t._log.debug("Cannot capture frames. Stopping capturing frames.");return}n=Date.now();var a=t.mediaStreamTrack.getSettings(),s=a.width,c=void 0===s?0:s,u=a.height,l=void 0===u?0:u;t._outputFrame&&t._outputFrame.width!==c&&(t._outputFrame.width=c,t._outputFrame.height=l),t._inputFrame&&(t._inputFrame.width!==c&&(t._inputFrame.width=c,t._inputFrame.height=l),t._inputFrame.getContext("2d").drawImage(t._dummyEl,0,0,c,l));var d=null;try{var p="video"===t._processorOptions.inputFrameBufferType?t._dummyEl:t._inputFrame;d=t.processor.processFrame(p,t._outputFrame)}catch(e){t._log.debug("Exception detected after calling processFrame.",e)}
1(d instanceof Promise?d:Promise.resolve(d)).then(function(){t._outputFrame&&("function"==typeof t.processedTrack.requestFrame&&t.processedTrack.requestFrame(),t._processorEventObserver.emit("stats"))}).finally(function(){e=Date.now()-n,r(i)})};r(i)}).catch(function(e){return t._log.error("Video element cannot be played",{error:e,track:t})})},t.prototype._initialize=function(){var n=this;e.prototype._initialize.call(this),this._dummyEl&&(this._dummyEl.onloadedmetadata=function(){u(n,n._dummyEl)&&(n.dimensions.width=n._dummyEl.videoWidth,n.dimensions.height=n._dummyEl.videoHeight)},this._dummyEl.onresize=function(){u(n,n._dummyEl)&&(n.dimensions.width=n._dummyEl.videoWidth,n.dimensions.height=n._dummyEl.videoHeight,n.isStarted&&(n._log.debug("Dimensions changed:",n.dimensions),n.emit(t.DIMENSIONS_CHANGED,n)))})},t.prototype._restartProcessor=function(){var e=this.processor;if(e){var t=Object.assign({},this._processorOptions);this.removeProcessor(e),this.addProcessor(e,t)}},t.prototype._start=function(n){return this.dimensions.width=n.videoWidth,this.dimensions.height=n.videoHeight,this._log.debug("Dimensions:",this.dimensions),this.emit(t.DIMENSIONS_CHANGED,this),e.prototype._start.call(this,n)},t.prototype.addProcessor=function(e,t){var n=this;if(!e||"function"!=typeof e.processFrame)throw Error("Received an invalid VideoProcessor from addProcessor.");if(this.processor)throw Error("A VideoProcessor has already been added.");if(!this._dummyEl)throw Error("VideoTrack has not been initialized.");this._log.debug("Adding VideoProcessor to the VideoTrack",e),this._unmuteHandler||(this._unmuteHandler=function(){n._log.debug("mediaStreamTrack unmuted"),n.processedTrack.muted&&(n._log.debug("mediaStreamTrack is unmuted but processedTrack is muted. Restarting processor."),n._restartProcessor())},this.mediaStreamTrack.addEventListener("unmute",this._unmuteHandler)),this._processorOptions=t||{};var r=this._processorOptions,i=r.inputFrameBufferType,o=r.outputFrameBufferContextType;if("undefined"==typeof OffscreenCanvas&&"offscreencanvas"===i)throw Error("OffscreenCanvas is not supported by this browser.");if(i&&"video"!==i&&"canvas"!==i&&"offscreencanvas"!==i)throw Error("Invalid inputFrameBufferType of "+i);i||(i="undefined"==typeof OffscreenCanvas?"canvas":"offscreencanvas");var a=this.mediaStreamTrack.getSettings(),c=a.width,u=void 0===c?0:c,l=a.height,d=void 0===l?0:l,p=a.frameRate;if("offscreencanvas"===i&&(this._inputFrame=new OffscreenCanvas(u,d)),"canvas"===i&&(this._inputFrame=document.createElement("canvas")),this._inputFrame&&(this._inputFrame.width=u,this._inputFrame.height=d),this._outputFrame=document.createElement("canvas"),this._outputFrame.width=u,this._outputFrame.height=d,o=o||"2d",!this._outputFrame.getContext(o))throw Error("Cannot get outputFrameBufferContextType: "+o+".");var f="undefined"!=typeof CanvasCaptureMediaStreamTrack&&CanvasCaptureMediaStreamTrack.prototype&&"function"==typeof CanvasCaptureMediaStreamTrack.prototype.requestFrame?0:void 0;return this.processedTrack=this._outputFrame.captureStream(f).getTracks()[0],this.processedTrack.enabled=this.mediaStreamTrack.enabled,this.processor=e,this._processorEventObserver.emit("add",{processor:e,captureHeight:d,captureWidth:u,inputFrameRate:void 0===p?s:p,isRemoteVideoTrack:this.toString().includes("RemoteVideoTrack"),inputFrameBufferType:i,outputFrameBufferContextType:o}),this._updateElementsMediaStreamTrack(),this._captureFrames(),this},t.prototype.attach=function(){var t=e.prototype.attach.apply(this,arguments);return this.processor&&this._captureFrames(),t},t.prototype.detach=function(){return e.prototype.detach.apply(this,arguments)},t.prototype.removeProcessor=function(e){if(!e)throw Error("Received an invalid VideoProcessor from removeProcessor.");if(!this.processor)throw Error("No existing VideoProcessor detected.");if(e!==this.processor)throw Error("The provided VideoProcessor is different than the existing one.");return this._processorEventObserver.emit("remove"),this._log.debug("Removing VideoProcessor from the VideoTrack",e),clearTimeout(this._captureTimeoutId),this.mediaStreamTrack.removeEventListener("unmute",this._unmuteHandler),this._processorOptions={},this._unmuteHandler=null,this._isCapturing=!1,this.processor=null,this.processedTrack=null,this._inputFrame=null,this._outputFrame=null,this._updateElementsMediaStreamTrack(),this},t}(o);function u(e,t){return e.dimensions.width!==t.videoWidth||e.dimensions.height!==t.videoHeight}c.DIMENSIONS_CHANGED="dimensionsChanged",e.exports=c},27453:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=n(17187).EventEmitter,s=n(62097),c=s.DEFAULT_NQ_LEVEL_LOCAL,u=s.DEFAULT_NQ_LEVEL_REMOTE,l=s.MAX_NQ_LEVEL,d=n(96971).inRange,p=function(e){function t(t){var n=e.call(this)||this;return Object.defineProperties(n,{local:{value:d((t=Object.assign({local:c,remote:u},t)).local,c,l)?t.local:c,writable:!0},remote:{value:d(t.remote,u,l)?t.remote:u,writable:!0}}),n}return i(t,e),t.prototype.update=function(e){var t=this;e=Object.assign({local:this.local,remote:this.remote},e),[["local",c,3],["remote",u,3]].forEach(function(n){var r=o(n,3),i=r[0],a=r[1],s=r[2];t[i]="number"==typeof e[i]&&d(e[i],a,s)?e[i]:a})},t}(a);e.exports=p},44006:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.createNoiseCancellationAudioProcessor=void 0;var o=n(53974);n(36372);var a={krisp:{supportedVersion:"1.0.0",pluginFile:"krispsdk.mjs"},rnnoise:{supportedVersion:"0.6.0",pluginFile:"rnnoise_sdk.mjs"}},s=function(e){var t=e.supportedVersion,n=e.plugin,r=e.log;if(!n.getVersion||!n.isSupported)throw Error("Plugin does not export getVersion/isSupported api. Are you using old version of the plugin ?");var i=n.getVersion();r.debug("Plugin Version = "+i);var o=t.split(".").map(function(e){return Number(e)}),a=i.split(".").map(function(e){return Number(e)});if(3!==o.length||3!==a.length)throw Error("Unsupported Plugin version format: "+t+", "+i);if(o[0]!==a[0])throw Error("Major version mismatch: [Plugin version "+i+"],  [Supported Version "+t+"]");if(a[1]<o[1])throw Error("Minor version mismatch: [Plugin version "+i+"] < [Supported Version "+t+"]");var s=new AudioContext,c=n.isSupported(s);if(s.close(),!c)throw Error("Noise Cancellation plugin is not supported on your browser")},c=new Map;t.createNoiseCancellationAudioProcessor=function(e,t){return r(this,void 0,void 0,function(){var n,r,u,l,d,p,f,h,v;return i(this,function(i){switch(i.label){case 0:if(n=c.get(e.vendor))return[3,6];if(!(r=a[e.vendor]))throw Error("Unsupported NoiseCancellationOptions.vendor: "+e.vendor);u=r.supportedVersion,l=r.pluginFile,p=(d=e.sdkAssetsPath)+"/"+l,i.label=1;case 1:return i.trys.push([1,5,,6]),t.debug("loading noise cancellation sdk: ",p),[4,o(p)];case 2:if(f=i.sent(),t.debug("Loaded noise cancellation sdk:",f),h=f.default,s({supportedVersion:u,plugin:h,log:t}),h.isInitialized())return[3,4];return t.debug("initializing noise cancellation sdk: ",d),[4,h.init({rootDir:d})];case 3:i.sent(),t.debug("noise cancellation sdk initialized!"),i.label=4;
1case 4:return n={vendor:e.vendor,isInitialized:function(){return h.isInitialized()},isConnected:function(){return h.isConnected()},isEnabled:function(){return h.isEnabled()},disconnect:function(){return h.disconnect()},enable:function(){return h.enable()},disable:function(){return h.disable()},destroy:function(){return h.destroy()},setLogging:function(e){return h.setLogging(e)},connect:function(e){t.debug("connect: ",e.id),h.isConnected()&&h.disconnect();var n=h.connect(new MediaStream([e]));if(!n)throw Error("Error connecting with noise cancellation sdk");var r=n.getAudioTracks()[0];if(!r)throw Error("Error getting clean track from noise cancellation sdk");return h.enable(),r}},c.set(e.vendor,n),[3,6];case 5:throw v=i.sent(),t.error("Error loading noise cancellation sdk:"+p,v),v;case 6:return[2,n]}})})}},48948:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(73029),c=n(77480),u=n(94685),l=n(30005),d=n(22655),p=n(12099),f=n(26329),h=n(96971),v=0,m=function(e){function t(t,n){var r,i,o,a,s=e.call(this)||this,h=(i=(r=(n=Object.assign({RemoteAudioTrack:c,RemoteAudioTrackPublication:u,RemoteDataTrack:l,RemoteDataTrackPublication:d,RemoteVideoTrack:p,RemoteVideoTrackPublication:f,tracks:[]},n)).tracks.map(function(e){return[e.id,e]})).filter(function(e){return"audio"===e[1].kind}),o=r.filter(function(e){return"video"===e[1].kind}),{audioTracks:i,dataTracks:r.filter(function(e){return"data"===e[1].kind}),tracks:r,videoTracks:o}),m=n.log.createLog("default",s),y=new Map(h.audioTracks),g=new Map(h.dataTracks),b=new Map(h.tracks),k=new Map(h.videoTracks);return Object.defineProperties(s,{_RemoteAudioTrack:{value:n.RemoteAudioTrack},_RemoteAudioTrackPublication:{value:n.RemoteAudioTrackPublication},_RemoteDataTrack:{value:n.RemoteDataTrack},_RemoteDataTrackPublication:{value:n.RemoteDataTrackPublication},_RemoteVideoTrack:{value:n.RemoteVideoTrack},_RemoteVideoTrackPublication:{value:n.RemoteVideoTrackPublication},_audioTracks:{value:y},_dataTracks:{value:g},_instanceId:{value:++v},_clientTrackSwitchOffControl:{value:n.clientTrackSwitchOffControl},_contentPreferencesMode:{value:n.contentPreferencesMode},_log:{value:m},_signaling:{value:t},_tracks:{value:b},_trackEventReemitters:{value:new Map},_trackPublicationEventReemitters:{value:new Map},_trackSignalingUpdatedEventCallbacks:{value:new Map},_videoTracks:{value:k},audioTracks:{enumerable:!0,value:new Map},dataTracks:{enumerable:!0,value:new Map},identity:{enumerable:!0,get:function(){return t.identity}},networkQualityLevel:{enumerable:!0,get:function(){return t.networkQualityLevel}},networkQualityStats:{enumerable:!0,get:function(){return t.networkQualityStats}},sid:{enumerable:!0,get:function(){return t.sid}},state:{enumerable:!0,get:function(){return t.state}},tracks:{enumerable:!0,value:new Map},videoTracks:{enumerable:!0,value:new Map}}),s._tracks.forEach(_.bind(null,s)),t.on("networkQualityLevelChanged",function(){return s.emit("networkQualityLevelChanged",s.networkQualityLevel,s.networkQualityStats&&(s.networkQualityStats.audio||s.networkQualityStats.video)?s.networkQualityStats:null)}),a=s._log,"disconnected"!==s.state&&t.on("stateChanged",function e(n){a.debug("Transitioned to state:",n),s.emit(n,s),"disconnected"===n&&(a.debug("Removing Track event reemitters"),t.removeListener("stateChanged",e),s._tracks.forEach(function(e){var t=s._trackEventReemitters.get(e.id);e&&t&&t.forEach(function(t,n){e.removeListener(n,t)})}),t.tracks.forEach(function(e){var t=s._tracks.get(e.id),n=s._trackEventReemitters.get(e.id);
1t&&n&&n.forEach(function(e,n){t.removeListener(n,e)})}),s._trackEventReemitters.clear(),s.tracks.forEach(function(e){s._trackPublicationEventReemitters.get(e.trackSid).forEach(function(t,n){e.removeListener(n,t)})}),s._trackPublicationEventReemitters.clear())}),m.info("Created a new Participant"+(s.identity?": "+s.identity:"")),s}return i(t,e),t.prototype._getTrackEvents=function(){return[["dimensionsChanged","trackDimensionsChanged"],["message","trackMessage"],["started","trackStarted"]]},t.prototype._getTrackPublicationEvents=function(){return[]},t.prototype.toString=function(){return"[Participant #"+this._instanceId+": "+this.sid+"]"},t.prototype._addTrack=function(e,t){var n=this._log;return this._tracks.has(t)?null:(this._tracks.set(t,e),({audio:this._audioTracks,video:this._videoTracks,data:this._dataTracks})[e.kind].set(t,e),_(this,e,t),n.info("Added a new "+h.trackClass(e)+":",t),n.debug(h.trackClass(e)+":",e),e)},t.prototype._addTrackPublication=function(e){var t,n,r=this._log;return this.tracks.has(e.trackSid)?null:(this.tracks.set(e.trackSid,e),({audio:this.audioTracks,data:this.dataTracks,video:this.videoTracks})[e.kind].set(e.trackSid,e),t=this,n=new Map,"disconnected"!==t.state&&(t._getTrackPublicationEvents().forEach(function(r){var i=o(r,2),s=i[0],c=i[1];n.set(s,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t.emit.apply(t,a(a([c],o(n)),[e]))}),e.on(s,n.get(s))}),t._trackPublicationEventReemitters.set(e.trackSid,n)),r.info("Added a new "+h.trackPublicationClass(e)+":",e.trackSid),r.debug(h.trackPublicationClass(e)+":",e),e)},t.prototype._handleTrackSignalingEvents=function(){var e=this._log,t=this._clientTrackSwitchOffControl,n=this._contentPreferencesMode,r=this;if("disconnected"!==this.state){var i=this._RemoteAudioTrack,a=this._RemoteAudioTrackPublication,s=this._RemoteVideoTrack,c=this._RemoteVideoTrackPublication,u=this._RemoteDataTrack,l=this._RemoteDataTrackPublication,d=this._signaling;d.on("trackAdded",p),d.on("trackRemoved",f),d.tracks.forEach(p),d.on("stateChanged",function t(n){"disconnected"===n?(e.debug("Removing event listeners"),d.removeListener("stateChanged",t),d.removeListener("trackAdded",p),d.removeListener("trackRemoved",f)):"connected"===n&&(e.info("reconnected"),setTimeout(function(){return r.emit("reconnected")},0))})}function p(t){var n=new({audio:a,data:l,video:c})[t.kind](t,{log:e});r._addTrackPublication(n);var i=t.isSubscribed;i&&h(t),r._trackSignalingUpdatedEventCallbacks.set(t.sid,function(){if(i!==t.isSubscribed){var e,n,a,s;if(i=t.isSubscribed){h(t);return}n=(e=o(Array.from(r._tracks.entries()).find(function(e){return o(e,2)[1].sid===t.sid}),2))[0],a=e[1],s=r.tracks.get(t.sid),a&&r._removeTrack(a,s,n)}}),t.on("updated",r._trackSignalingUpdatedEventCallbacks.get(t.sid))}function f(e){e.isSubscribed&&e.setTrackTransceiver(null);var t=r._trackSignalingUpdatedEventCallbacks.get(e.sid);t&&(e.removeListener("updated",t),r._trackSignalingUpdatedEventCallbacks.delete(e.sid));var n=r.tracks.get(e.sid);n&&r._removeTrackPublication(n)}function h(o){var a=o.isEnabled,c=o.name,l=o.kind,p=o.sid,f=o.trackTransceiver,h=o.isSwitchedOff,v={audio:i,video:s,data:u}[l],m=r.tracks.get(p);if(v&&l===f.kind){var _={log:e,name:c,clientTrackSwitchOffControl:t,contentPreferencesMode:n},y="data"===l?new v(p,f,_):new v(p,f,a,h,function(e){return d.updateSubscriberTrackPriority(p,e)},function(e){o.isSubscribed&&d.updateTrackRenderHint(p,e)},_);r._addTrack(y,m,f.id)}}},t.prototype._removeTrack=function(e,t){if(!this._tracks.has(t))return null;this._tracks.delete(t),({audio:this._audioTracks,video:this._videoTracks,data:this._dataTracks})[e.kind].delete(t),(this._trackEventReemitters.get(t)||new Map).forEach(function(t,n){e.removeListener(n,t)});var n=this._log;return n.info("Removed a "+h.trackClass(e)+":",t),n.debug(h.trackClass(e)+":",e),e},t.prototype._removeTrackPublication=function(e){if(!(e=this.tracks.get(e.trackSid)))return null;this.tracks.delete(e.trackSid),({audio:this.audioTracks,data:this.dataTracks,video:this.videoTracks})[e.kind].delete(e.trackSid),(this._trackPublicationEventReemitters.get(e.trackSid)||new Map).forEac
1h(function(t,n){e.removeListener(n,t)});var t=this._log;return t.info("Removed a "+h.trackPublicationClass(e)+":",e.trackSid),t.debug(h.trackPublicationClass(e)+":",e),e},t.prototype.toJSON=function(){return h.valueToJSON(this)},t}(s);function _(e,t,n){var r=new Map;"disconnected"!==e.state&&(e._getTrackEvents().forEach(function(n){var i=n[0],s=n[1];r.set(i,function(){var t=[s].concat([].slice.call(arguments));return e.emit.apply(e,a([],o(t)))}),t.on(i,r.get(i))}),e._trackEventReemitters.set(n,r))}e.exports=m},29706:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function o(e,t,n,r){var i=[];return e.forEach(function(e){(0===r.length||r.includes(e.type))&&(0===n.length||n.includes(e.kind))&&"number"==typeof e[t]&&i.push(e[t])}),i}function a(e){return[{key:"transportId",type:"string"},{key:"candidateType",type:"string"},{key:"port",altKeys:["portNumber"],type:"number"},{key:"address",altKeys:["ip","ipAddress"],type:"string"},{key:"priority",type:"number"},{key:"protocol",altKeys:["transport"],type:"string"},{key:"url",type:"string"},{key:"relayProtocol",type:"string"}].reduce(function(t,n){var r=[n.key];n.altKeys&&(r=r.concat(n.altKeys));var i=r.find(function(t){return t in e});return i&&typeof e[i]===n.type&&(t[n.key]=e[i]),t},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.getCombinedConnectionStats=void 0,t.getCombinedConnectionStats=function(e){var t=e.publisher,s=e.subscriber;return n(this,void 0,void 0,function(){var e,n,c,u,l,d,p,f,h,v,m,_,y,g;return r(this,function(r){switch(r.label){case 0:return[4,Promise.all([t,s].map(function(e){return e.getStats()}))];case 1:return n=(e=i.apply(void 0,[r.sent(),2]))[0],l=(u=o(c=e[1],"timestamp",["audio"],["inbound-rtp"])).length>0?u[0]:0,d=o(c,"jitter",["audio"],["inbound-rtp"]).reduce(function(e,t){return Math.max(e,t)},0),p=o(c,"packetsReceived",["audio","video"],["inbound-rtp"]).reduce(function(e,t){return e+t},0),f=o(c,"packetsLost",["audio","video"],["inbound-rtp"]).reduce(function(e,t){return e+t},0),h=o(n,"roundTripTime",["audio","video"],["remote-inbound-rtp"]).reduce(function(e,t){return Math.max(e,t)},0),v=1e3*(o(c,"currentRoundTripTime",[],["candidate-pair"]).reduce(function(e,t){return Math.max(e,t)},0)||h),m=o(n,"bytesSent",[],["candidate-pair"]).reduce(function(e,t){return e+t},0),_=o(c,"bytesReceived",[],["candidate-pair"]).reduce(function(e,t){return e+t},0),y=function(e){var t=null,n=[];e.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId?t=e.selectedCandidatePairId:"candidate-pair"===e.type&&n.push(e)});var r=n.find(function(e){return e.selected||t&&e.id===t});if(!r)return null;var i=e.get(r.localCandidateId),o=e.get(r.remoteCandidateId);return i&&o?{localCandidate:a(i),remoteCandidate:a(o)}:null}
1(c),g=[],c.forEach(function(e){("local-candidate"===e.type||"remote-candidate"===e.type)&&g.push(a(e))}),[2,{timestamp:l,jitter:d,packets:p,packetsLost:f,roundTripTime:v,bytesSent:m,bytesReceived:_,selectedIceCandidatePairStats:y,iceCandidateStats:g}]}})})}},68780:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTurnCredentials=void 0;var r=n(44670),i=n(62097).ICE_VERSION,o=n(78144),a=o.createTwilioError,s=o.SignalingConnectionError,c=n(17187);t.getTurnCredentials=function(e,t){return new Promise(function(n,o){var u=new r(t,{networkMonitor:null,eventObserver:new c.EventEmitter,helloBody:{edge:"roaming",preflight:!0,token:e,type:"ice",version:i}}),l=!1;u.once("close",function(){l||(l=!0,o(new s))}),u.on("message",function(e){var t=e.code,r=e.message,i=e.ice_servers,s=e.type;"iced"!==s&&"error"!==s||l||(l=!0,"iced"===s?n(i):o(a(t,r)),u.close())})})}},12017:function(e,t){"use strict";var n=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},r=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.makeStat=void 0,t.makeStat=function(e){return e&&e.length?{min:Math.min.apply(Math,r([],n(e))),max:Math.max.apply(Math,r([],n(e))),average:e.reduce(function(e,t){return e+t},0)/e.length}:null}},87745:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mosToScore=t.calculateMOS=void 0,t.calculateMOS=function(e,t,n){var r=e+2*t+10,i=0;switch(!0){case r<160:i=94.768-r/40;break;case r<1e3:i=94.768-(r-120)/10}return 1+.035*(i=!0==n<=i/2.5?Math.max(i-2.5*n,6.52):0)+7e-6*i*(i-60)*(100-i)},t.mosToScore=function(e){return e?e>4.2?5:e>4?4:e>3.6?3:e>3?2:1:0}},46200:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.runPreflight=t.PreflightTest=void 0;var c=n(62097),u=n(8646),l=n(87745),d=n(29706),p=n(68780),f=n(12017),h=n(19977),v=n(84441),m=n(96971),_=n(62097).WS_SERVER,y=n(36372),g=n(73029),b=n(99576),k=n(13451),w=n(99849),S=n(97480),T=S.createSID,C=S.sessionSID,O=n(78144),P=O.SignalingConnectionTimeoutError,E=O.MediaConnectionError,R={mediaAcquired:"mediaAcquired",connected:"connected",mediaSubscribed:"mediaSubscribed",mediaStarted:"mediaStarted",dtlsConnected:"dtlsConnected",peerConnectionConnected:"peerConnectionConnected",iceConnected:"iceConnected"};function L(e){return null!=e}var j=0,M=function(e){function t(t,n){var r=e.call(this)||this;r._testTiming=new u.Timer,r._dtlsTiming=new u.Timer,r._iceTiming=new u.Timer,r._peerConnectionTiming=new u.Timer,r._mediaTiming=new u.Timer,r._connectTiming=new u.Timer,r._sentBytesMovingAverage=new b,r._packetLossMovingAverage=new b,r._progressEvents=[],r._receivedBytesMovingAverage=new b;var i=n.environment,o=void 0===i?"prod":i,a=n.region,s=n.duration,l=n.wsServer||_(o,void 0===a?"gll":a);return r._log=new y("default",r,c.DEFAULT_LOG_LEVEL,c.DEFAULT_LOGGER_NAME),r._testDuration=void 0===s?1e4:s,r._instanceId=j++,r._testTiming.start(),r._runPreflightTest(t,o,l),r}return i(t,e),t.prototype.toString=function(){return"[Preflight #"+this._instanceId+"]"},t.prototype.stop=function(){this._stopped=!0},t.prototype._generatePreflightReport=function(e){return this._testTiming.stop(),{testTiming:this._testTiming.getTimeMeasurement(),networkTiming:{dtls:this._dtlsTiming.getTimeMeasurement(),ice:this._iceTiming.getTimeMeasurement(),peerConnection:this._peerConnectionTiming.getTimeMeasurement(),connect:this._connectTiming.getTimeMeasurement(),media:this._mediaTiming.getTimeMeasurement()},stats:{jitter:f.makeStat(null==e?void 0:e.jitter),rtt:f.makeStat(null==e?void 0:e.rtt),packetLoss:f.makeStat(null==e?void 0:e.packetLoss)},selectedIceCandidatePairStats:e?e.selectedIceCandidatePairStats:null,iceCandidateStats:e?e.iceCandidateStats:[],progressEvents:this._progressEvents,mos:f.makeStat(null==e?void 0:e.mos)}},t.prototype._executePreflightStep=function(e,t,n){return a(this,void 0,void 0,function(){var r,i,o,a;return s(this,function(s){switch(s.label){case 0:if(this._log.debug("Executing step: ",e),r=this._testDuration+1e4,this._stopped)throw Error("stopped");i=Promise.resolve().then(t),o=null,a=new Promise(function(t,i){o=setTimeout(function(){i(n||Error(e+" timeout."))},r)}),s.label=1;case 1:return s.trys.push([1,,3,4]),[4,Promise.race([a,i])];case 2:return[2,s.sent()];case 3:return null!==o&&clearTimeout(o),[7];case 4:return[2]}})})},t.prototype._collectNetworkTimings=function(e){var t=this;return new Promise(function(n){e.addEventListener("iceconnectionstatechange",function(){"checking"===e.iceConnectionState&&t._iceTiming.start(),"connected"===e.iceConnectionState&&(t._iceTiming.stop(),t._updateProgress(R.iceConnected),(!r||r&&"connected"===r.state)&&n())}),e.addEventListener("connectionstatechange",function(){"connecting"===e.connectionState&&t._peerConnectionTiming.start(),"connected"===e.connectionState&&(t._peerConnectionTiming.stop(),t._updateProgress(R.peerConnectionConnected))});var r,i=e.getSenders().map(function(e){return e.transport}).find(L);void 0!==i&&(r=i).addEventListener("statechange",function(){"connecting"===r.state&&t._dtlsTiming.start(),"connected"===r.state&&(t._dtlsTiming.stop(),t._updateProgress(R.dtlsConnected),"connected"===e.iceConnectionState&&n())})})},t.prototype._setupInsights=function(e){var t=e.token,n=e.environment,r=void 0===n?c.DEFAULT_ENVIRONMENT:n,i=e.realm,o=void 0===i?c.DEFAULT_REALM:i,a=new w(t,c.SDK_NAME,c.SDK_VERSION,r,o,{});a.connect("PREFLIGHT_ROOM_SID","PREFLIGHT_PARTICIPANT");var s=new k(a,Date.now(),this._log),u=void 0;return{reportToInsights:function(e){var t,n,r=e.report,i=r.stats.jitter||u,o=r.stats.rtt||u,c=r.stats.packetLoss||u,l=r.mos||u,d=new Map;
1r.iceCandidateStats.forEach(function(e){if(e.candidateType&&e.protocol){var t=d.get(e.candidateType)||[];0>t.indexOf(e.protocol)&&t.push(e.protocol),d.set(e.candidateType,t)}});var p=JSON.stringify(Object.fromEntries(d)),f={name:"report",group:"preflight",level:r.error?"error":"info",payload:{sessionSID:C,preflightSID:T("PF"),progressEvents:JSON.stringify(r.progressEvents),testTiming:r.testTiming,dtlsTiming:r.networkTiming.dtls,iceTiming:r.networkTiming.ice,peerConnectionTiming:r.networkTiming.peerConnection,connectTiming:r.networkTiming.connect,mediaTiming:r.networkTiming.media,selectedLocalCandidate:null===(t=r.selectedIceCandidatePairStats)||void 0===t?void 0:t.localCandidate,selectedRemoteCandidate:null===(n=r.selectedIceCandidatePairStats)||void 0===n?void 0:n.remoteCandidate,iceCandidateStats:p,jitterStats:i,rttStats:o,packetLossStats:c,mosStats:l,error:r.error}};s.emit("event",f),setTimeout(function(){return a.disconnect()},2e3)}}},t.prototype._runPreflightTest=function(e,t,n){return a(this,void 0,void 0,function(){var r,i,c,u,l,d,f,m,_,y,g,b,k=this;return s(this,function(w){switch(w.label){case 0:r=[],i=[],c=this._setupInsights({token:e,environment:t}).reportToInsights,w.label=1;case 1:return w.trys.push([1,8,9,10]),u=[],[4,this._executePreflightStep("Acquire media",function(){return[h.syntheticAudio(),v.syntheticVideo({width:640,height:480})]})];case 2:return r=w.sent(),this._updateProgress(R.mediaAcquired),this.emit("debug",{localTracks:r}),this._connectTiming.start(),[4,this._executePreflightStep("Get turn credentials",function(){return p.getTurnCredentials(e,n)},new P)];case 3:return l=w.sent(),this._connectTiming.stop(),this._updateProgress(R.connected),d=new RTCPeerConnection({iceServers:l,iceTransportPolicy:"relay",bundlePolicy:"max-bundle"}),f=new RTCPeerConnection({iceServers:l,bundlePolicy:"max-bundle"}),i.push(d),i.push(f),this._mediaTiming.start(),[4,this._executePreflightStep("Setup Peer Connections",function(){return a(k,void 0,void 0,function(){var e,t,n;return s(this,function(i){switch(i.label){case 0:return d.addEventListener("icecandidate",function(e){return e.candidate&&f.addIceCandidate(e.candidate)}),f.addEventListener("icecandidate",function(e){return e.candidate&&d.addIceCandidate(e.candidate)}),r.forEach(function(e){return d.addTrack(e)}),e=new Promise(function(e){var t=[];f.addEventListener("track",function(n){t.push(n.track),t.length===r.length&&e(t)})}),[4,d.createOffer()];case 1:return t=i.sent(),[4,d.setLocalDescription(t)];case 2:return i.sent(),[4,f.setRemoteDescription(t)];case 3:return i.sent(),[4,f.createAnswer()];case 4:return n=i.sent(),[4,f.setLocalDescription(n)];case 5:return i.sent(),[4,d.setRemoteDescription(n)];case 6:return i.sent(),[4,this._collectNetworkTimings(d)];case 7:return i.sent(),[2,e]}})})},new E)];case 4:return m=w.sent(),this.emit("debug",{remoteTracks:m}),m.forEach(function(e){e.addEventListener("ended",function(){return k._log.warn(e.kind+":ended")}),e.addEventListener("mute",function(){return k._log.warn(e.kind+":muted")}),e.addEventListener("unmute",function(){return k._log.warn(e.kind+":unmuted")})}),this._updateProgress(R.mediaSubscribed),[4,this._executePreflightStep("Wait for tracks to start",function(){return new Promise(function(e){var t=document.createElement("video");t.autoplay=!0,t.playsInline=!0,t.muted=!0,t.srcObject=new MediaStream(m),u.push(t),k.emit("debugElement",t),t.oncanplay=e})},new E)];case 5:return w.sent(),this._mediaTiming.stop(),this._updateProgress(R.mediaStarted),[4,this._executePreflightStep("Collect stats for duration",function(){return k._collectRTCStatsForDuration(k._testDuration,{mos:[],jitter:[],rtt:[],outgoingBitrate:[],incomingBitrate:[],packetLoss:[],selectedIceCandidatePairStats:null,iceCandidateStats:[]},d,f)})];case 6:return _=w.sent(),[4,this._executePreflightStep("Generate report",function(){return k._generatePreflightReport(_)})];case 7:return y=w.sent(),c({report:y}),this.emit("completed",y),[3,10];case 8:return g=w.sent(),b=this._generatePreflightReport(),c({report:o(o({},b),{error:null==g?void 0:g.toString()})}
1),this.emit("failed",g,b),[3,10];case 9:return i.forEach(function(e){return e.close()}),r.forEach(function(e){return e.stop()}),[7];case 10:return[2]}})})},t.prototype._collectRTCStats=function(e,t,n){return a(this,void 0,void 0,function(){var r,i,o,a,c,u,p,f,h,v,m,_,y,g;return s(this,function(s){switch(s.label){case 0:return[4,d.getCombinedConnectionStats({publisher:t,subscriber:n})];case 1:return i=(r=s.sent()).timestamp,o=r.bytesSent,a=r.bytesReceived,c=r.packets,u=r.packetsLost,p=r.roundTripTime,f=r.jitter,h=r.selectedIceCandidatePairStats,v=r.iceCandidateStats,m=e.jitter.length>0,e.jitter.push(f),e.rtt.push(p),this._sentBytesMovingAverage.putSample(o,i),this._receivedBytesMovingAverage.putSample(a,i),this._packetLossMovingAverage.putSample(u,c),m&&(e.outgoingBitrate.push(8e3*this._sentBytesMovingAverage.get()),e.incomingBitrate.push(8e3*this._receivedBytesMovingAverage.get()),y=Math.min(100,100*(_=this._packetLossMovingAverage.get())),e.packetLoss.push(y),g=l.calculateMOS(p,f,_),e.mos.push(g)),e.selectedIceCandidatePairStats||(e.selectedIceCandidatePairStats=h),0===e.iceCandidateStats.length&&(e.iceCandidateStats=v),[2]}})})},t.prototype._collectRTCStatsForDuration=function(e,t,n,r){return a(this,void 0,void 0,function(){var i,o,a;return s(this,function(s){switch(s.label){case 0:return i=Date.now(),o=Math.min(1e3,e),[4,m.waitForSometime(o)];case 1:return s.sent(),[4,this._collectRTCStats(t,n,r)];case 2:if(s.sent(),!((a=e-(Date.now()-i))>0))return[3,4];return[4,this._collectRTCStatsForDuration(a,t,n,r)];case 3:t=s.sent(),s.label=4;case 4:return[2,t]}})})},t.prototype._updateProgress=function(e){var t=Date.now()-this._testTiming.getTimeMeasurement().start;this._progressEvents.push({duration:t,name:e}),this.emit("progress",e)},t}(g);t.PreflightTest=M,t.runPreflight=function(e,t){return void 0===t&&(t={}),new M(e,t)}},19977:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.syntheticAudio=void 0,t.syntheticAudio=function(){var e=n(23585),t={},r=e.getOrCreate(t),i=r.createOscillator(),o=i.connect(r.createMediaStreamDestination());i.start();var a=o.stream.getAudioTracks()[0],s=a.stop;return a.stop=function(){s.call(a),e.release(t)},a}},84441:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.syntheticVideo=void 0,t.syntheticVideo=function(e){var t=void 0===e?{}:e,n=t.width,r=void 0===n?640:n,i=t.height,o=void 0===i?480:i,a=Object.assign(document.createElement("canvas"),{width:r,height:o}),s=a.getContext("2d");s.fillStyle="green",s.fillRect(0,0,a.width,a.height);var c=!1;requestAnimationFrame(function e(){if(!c){var t=Math.round(255*Math.random()),n=Math.round(255*Math.random()),i=Math.round(255*Math.random()),a=Math.round(255*Math.random());s.fillStyle="rgba("+t+", "+n+", "+i+", "+a+")",s.fillRect(Math.random()*r,Math.random()*o,50,50),requestAnimationFrame(e)}});var u=a.captureStream(30).getTracks()[0],l=u.stop;return u.stop=function(){c=!0,l.call(u)},u}},8646:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Timer=void 0;var n=function(){function e(){this._end=void 0,this.start()}return e.prototype.start=function(){return this._start=Date.now(),this},e.prototype.stop=function(){return this._end=Date.now(),this},e.prototype.getTimeMeasurement=function(){return{start:this._start,end:this._end,duration:void 0===this._end?void 0:this._end-this._start}},e}();t.Timer=n},23172:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=function(e){function t(){var t=e.call(this)||this;return Object.defineProperties(t,{_queuedEvents:{value:new Map}}),t}return i(t,e),t.prototype.dequeue=function(e){var t=this,n=!0;
1if(!e)return this._queuedEvents.forEach(function(e,t){n=this.dequeue(t)&&n},this),n;var r=this._queuedEvents.get(e)||[];return this._queuedEvents.delete(e),r.reduce(function(n,r){return t.emit.apply(t,a([],o([e].concat(r))))&&n},n)},t.prototype.queue=function(){var e=[].slice.call(arguments);if(this.emit.apply(this,a([],o(e))))return!0;var t=e[0];return this._queuedEvents.has(t)||this._queuedEvents.set(t,[]),this._queuedEvents.get(t).push(e.slice(1)),!1},t}(n(17187).EventEmitter);e.exports=s},58690:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._handleTrackSignalingEvents(),r.once("disconnected",r._unsubscribeTracks.bind(r)),r}return i(t,e),t.prototype.toString=function(){return"[RemoteParticipant #"+this._instanceId+(this.sid?": "+this.sid:"")+"]"},t.prototype._addTrack=function(t,n,r){return e.prototype._addTrack.call(this,t,r)?(n._subscribed(t),this.emit("trackSubscribed",t,n),t):null},t.prototype._addTrackPublication=function(t){var n=e.prototype._addTrackPublication.call(this,t);return n?(this.emit("trackPublished",n),n):null},t.prototype._getTrackPublicationEvents=function(){return a(a([],o(e.prototype._getTrackPublicationEvents.call(this))),[["subscriptionFailed","trackSubscriptionFailed"],["trackDisabled","trackDisabled"],["trackEnabled","trackEnabled"],["publishPriorityChanged","trackPublishPriorityChanged"],["trackSwitchedOff","trackSwitchedOff"],["trackSwitchedOn","trackSwitchedOn"]])},t.prototype._unsubscribeTracks=function(){var e=this;this.tracks.forEach(function(t){if(t.isSubscribed){var n=t.track;t._unsubscribe(),e.emit("trackUnsubscribed",n,t)}})},t.prototype._removeTrack=function(t,n,r){var i=this._tracks.get(r);return i?(e.prototype._removeTrack.call(this,i,r),n._unsubscribe(),this.emit("trackUnsubscribed",i,n),i):null},t.prototype._removeTrackPublication=function(t){this._signaling.clearTrackHint(t.trackSid);var n=e.prototype._removeTrackPublication.call(this,t);return n?(this.emit("trackUnpublished",n),n):null},t}(n(48948));e.exports=s},77081:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(73029),c=n(58690),u=n(2340),l=n(96971),d=l.flatMap,p=l.valueToJSON,f=0,h=function(e){function t(t,n,r){var i,s,c=e.call(this)||this,u=r.log.createLog("default",c),l=new Map;return Object.defineProperties(c,{_log:{value:u},_clientTrackSwitchOffControl:{value:r.clientTrackSwitchOffControl||"disabled"}
1,_contentPreferencesMode:{value:r.contentPreferencesMode||"disabled"},_instanceId:{value:++f},_options:{value:r},_participants:{value:l},_signaling:{value:n},dominantSpeaker:{enumerable:!0,get:function(){return this.participants.get(n.dominantSpeakerSid)||null}},isRecording:{enumerable:!0,get:function(){return n.recording.isEnabled||!1}},localParticipant:{enumerable:!0,value:t},name:{enumerable:!0,value:n.name},participants:{enumerable:!0,value:l},sid:{enumerable:!0,value:n.sid},state:{enumerable:!0,get:function(){return n.state}},mediaRegion:{enumerable:!0,value:n.mediaRegion}}),(i=["trackWarning","trackWarningsCleared"].map(function(e){return{eventName:e,handler:function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return c.emit.apply(c,a([e],o(a(a([],o(n)),[t]))))}}})).forEach(function(e){var n=e.eventName,r=e.handler;return t.on(n,r)}),c.once("disconnected",function(){return i.forEach(function(e){var n=e.eventName,r=e.handler;return t.removeListener(n,r)})}),function(e,t){t.on("updated",function(){var n=t.isEnabled;e._log.info("Recording "+(n?"started":"stopped")),e.emit("recording"+(n?"Started":"Stopped"))})}(c,n.recording),(s=c._log).debug("Creating a new RemoteParticipant for each ParticipantSignaling in the RoomSignaling"),n.participants.forEac
1h(m.bind(null,c)),s.debug("Setting up RemoteParticipant creation for all subsequent ParticipantSignalings that connect to the RoomSignaling"),n.on("participantConnected",m.bind(null,c)),n.on("dominantSpeakerChanged",function(){return c.emit("dominantSpeakerChanged",c.dominantSpeaker)}),n.on("stateChanged",function e(t,r){switch(s.info("Transitioned to state:",t),t){case"disconnected":c.participants.forEach(function(e){e._unsubscribeTracks()}),c.emit(t,c,r),c.localParticipant.tracks.forEach(function(e){e.unpublish()}),n.removeListener("stateChanged",e);break;case"reconnecting":setTimeout(function(){return c.emit("reconnecting",r)},0);break;default:setTimeout(function(){return c.emit("reconnected")},0)}}),function(e){var t=e.localParticipant._signaling.audioProcessors;e.localParticipant.audioTracks.forEach(function(n){var r=n.track.noiseCancellation;r&&!t.includes(r.vendor)&&(e._log.warn(r.vendor+" is not supported in this room. disabling it permanently"),r.disablePermanently())})}(c),u.info("Created a new Room:",c.name),u.debug("Initial RemoteParticipants:",Array.from(c._participants.values())),c}return i(t,e),t.prototype.toString=function(){return"[Room #"+this._instanceId+": "+this.sid+"]"},t.prototype.disconnect=function(){return this._log.info("Disconnecting"),this._signaling.disconnect(),this},t.prototype.getStats=function(){var e=this;return this._signaling.getStats().then(function(t){return Array.from(t).map(function(t){var n=o(t,2),r=n[0],i=n[1];return new u(r,Object.assign({},i,{localAudioTrackStats:v(e,i.localAudioTrackStats),localVideoTrackStats:v(e,i.localVideoTrackStats)}))})})},t.prototype.refreshInactiveMedia=function(){var e=Array.from(this.localParticipant.tracks.values()).filter(function(e){return"data"!==e.track.kind}).map(function(e){return e.track}),t=d(this.participants,function(e){return Array.from(e.tracks.values())}).filter(function(e){var t=e.track;return t&&"data"!==t.kind}).map(function(e){return e.track}),n=e.concat(t),r=new Event("unmute");e.forEach(function(e){var t=e.isMuted,n=e.mediaStreamTrack;t&&n.dispatchEvent(r)});var i=new Event("pause");return n.forEach(function(e){var t=e._attachments,n=e._elShims;return t.forEach(function(e){var t=n.get(e);e.paused&&t&&!t.pausedIntentionally()&&e.dispatchEvent(i)})}),this},t.prototype.toJSON=function(){return p(this)},t}(s);function v(e,t){var n=e.localParticipant._signaling;return t.reduce(function(e,t){var r=n.tracks.get(t.trackId),i=n.getSender(r);return i?[Object.assign({},t,{trackId:i.id})].concat(e):e},[])}function m(e,t){var n=e._log,r=new c(t,{log:n,clientTrackSwitchOffControl:e._clientTrackSwitchOffControl,contentPreferencesMode:e._contentPreferencesMode});n.info("A new RemoteParticipant connected:",r),e._participants.set(r.sid,r),e.emit("participantConnected",r);var i=[["reconnected","participantReconnected"],["reconnecting","participantReconnecting"],"trackDimensionsChanged","trackDisabled","trackEnabled","trackMessage","trackPublished","trackPublishPriorityChanged","trackStarted","trackSubscribed","trackSubscriptionFailed","trackSwitchedOff","trackSwitchedOn","trackUnpublished","trackUnsubscribed"].map(function(t){var n=o(Array.isArray(t)?t:[t,t],2),i=n[0],s=n[1];function c(){var t=[].slice.call(arguments);t.unshift(s),t.push(r),e.emit.apply(e,a([],o(t)))}return r.on(i,c),[i,c]});r.once("disconnected",function(){var t=e.dominantSpeaker;n.info("RemoteParticipant disconnected:",r),e._participants.delete(r.sid),i.forEac
1h(function(e){r.removeListener(e[0],e[1])}),e.emit("participantDisconnected",r),r===t&&e.emit("dominantSpeakerChanged",e.dominantSpeaker)})}e.exports=h},95743:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(27207),a=n(23178),s=n(13122),c={closed:["opening"],opening:["closed","open"],open:["closed","closing"],closing:["closed","open"]},u=function(e){function t(){return e.call(this,"closed",c)||this}return i(t,e),t.prototype._close=function(e){return this.transition("closing",e),this.transition("closed",e),Promise.resolve(this)},t.prototype._connect=function(e,t,n,r,i){e.connect("PA00000000000000000000000000000000","test");var o=Promise.resolve(new a(e,"RM00000000000000000000000000000000",i));return o.cancel=function(){},o},t.prototype._open=function(e){return this.transition("opening",e),this.transition("open",e),Promise.resolve(this)},t.prototype.close=function(){var e=this;return this.bracket("close",function(t){switch(e.state){case"closed":return e;case"open":return e._close(t);default:throw Error('Unexpected Signaling state "'+e.state+'"')}})},t.prototype.connect=function(e,t,n,r,i){var o=this;return this.bracket("connect",function a(s){switch(o.state){case"closed":return o._open(s).then(a.bind(null,s));case"open":return o.releaseLockCompletely(s),o._connect(e,t,n,r,i);default:throw Error('Unexpected Signaling state "'+o.state+'"')}})},t.prototype.createLocalParticipantSignaling=function(){return new o},t.prototype.open=function(){var e=this;return this.bracket("open",function(t){switch(e.state){case"closed":return e._open(t);case"open":return e;default:throw Error('Unexpected Signaling state "'+e.state+'"')}})},t}(s);e.exports=u},8881:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return Object.defineProperties(t,{_publicationsToTrackSenders:{value:new Map},_trackSendersToPublications:{value:new Map}}),t}return i(t,e),t.prototype.addTrack=function(t,n,r,i){void 0===i&&(i=null);var o=this._createLocalTrackPublicationSignaling(t,n,r,i);return this._trackSendersToPublications.set(t,o),this._publicationsToTrackSenders.set(o,t),e.prototype.addTrack.call(this,o),this},t.prototype.getPublication=function(e){return this._trackSendersToPublications.get(e)||null},t.prototype.getSender=function(e){return this._publicationsToTrackSenders.get(e)||null},t.prototype.removeTrack=function(t){var n=this._trackSendersToPublications.get(t);return n?(this._trackSendersToPublications.delete(t),this._publicationsToTrackSenders.delete(n),e.prototype.removeTrack.call(this,n)&&n.stop(),n):null},t}(n(27207));e.exports=o},70617:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r){var i=this,o="data"===(t=t.clone()).kind||t.track.enabled;return(i=e.call(this,n,t.kind,o,r)||this).setTrackTransceiver(t),Object.defineProperties(i,{_updatedPriority:{value:r,writable:!0},id:{enumerable:!0,value:t.id}}),i}return i(t,e),Object.defineProperty(t.prototype,"updatedPriority",{get:function(){return this._updatedPriority}
1,enumerable:!1,configurable:!0}),t.prototype.enable=function(t){return t="boolean"!=typeof t||t,this.trackTransceiver.track.enabled=t,e.prototype.enable.call(this,t)},t.prototype.publishFailed=function(e){return null!==this._sid||this._error||(this._error=e,0)||this.emit("updated"),this},t.prototype.setPriority=function(e){return this._updatedPriority!==e&&(this._updatedPriority=e,this.emit("updated")),this},t.prototype.setSid=function(t){return this._error?this:e.prototype.setSid.call(this,t)},t.prototype.stop=function(){this.trackTransceiver.stop()},t}(n(38239));e.exports=o},27207:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(13122),a=n(7837),s={connecting:["connected"],connected:["disconnected","reconnecting"],reconnecting:["connected","disconnected"],disconnected:[]},c=function(e){function t(){var t=e.call(this,"connecting",s)||this;return Object.defineProperties(t,{_identity:{writable:!0,value:null},_networkQualityLevel:{value:null,writable:!0},_networkQualityStats:{value:null,writable:!0},_sid:{writable:!0,value:null},identity:{enumerable:!0,get:function(){return this._identity}},sid:{enumerable:!0,get:function(){return this._sid}},tracks:{enumerable:!0,value:new Map}}),t}return i(t,e),Object.defineProperty(t.prototype,"networkQualityLevel",{get:function(){return this._networkQualityLevel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"networkQualityStats",{get:function(){return this._networkQualityStats},enumerable:!1,configurable:!0}),t.prototype.addTrack=function(e){return this.tracks.set(e.id||e.sid,e),this.emit("trackAdded",e),this},t.prototype.disconnect=function(){return"disconnected"!==this.state&&(this.preempt("disconnected"),!0)},t.prototype.removeTrack=function(e){var t=this.tracks.get(e.id||e.sid);return this.tracks.delete(e.id||e.sid),t&&this.emit("trackRemoved",e),t||null},t.prototype.setNetworkQualityLevel=function(e,t){this._networkQualityLevel!==e&&(this._networkQualityLevel=e,this._networkQualityStats=t&&(t.audio||t.video)?new a(t):null,this.emit("networkQualityLevelChanged"))},t.prototype.connect=function(e,t){return("connecting"===this.state||"reconnecting"===this.state)&&(this._sid||(this._sid=e),this._identity||(this._identity=t),this.preempt("connected"),!0)},t.prototype.reconnecting=function(){return("connecting"===this.state||"connected"===this.state)&&(this.preempt("reconnecting"),!0)},t}(o);e.exports=c},631:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return Object.defineProperties(t,{_isEnabled:{value:null,writable:!0},isEnabled:{enumerable:!0,get:function(){return this._isEnabled}}}),t}return i(t,e),t.prototype.disable=function(){return this.enable(!1)},t.prototype.enable=function(e){return e="boolean"!=typeof e||e,this.isEnabled!==e&&(this._isEnabled=e,this.emit("updated")),this},t}(n(17187).EventEmitter);e.exports=o},18090:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this)||this;return r.connect(t,n),r}return i(t,e),t}(n(27207));e.exports=o},75055:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r,i,o,a){var s=e.call(this,n,r,i,o)||this;return Object.defineProperties(s,{_isSwitchedOff:{value:a,writable:!0}}),s.setSid(t),s}return i(t,e),Object.defineProperty(t.prototype,"isSubscribed",{get:function(){return!!this.trackTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSwitchedOff",{get:function(){return this._isSwitchedOff},enumerable:!1,configurable:!0}),t.prototype.subscribeFailed=function(e){return this.error||(this._error=e,this.emit("updated")),this},t.prototype.setPriority=function(e){return this._priority!==e&&(this._priority=e,this.emit("updated")),this},t.prototype.setSwitchedOff=function(e){return this._isSwitchedOff!==e&&(this._isSwitchedOff=e,this.emit("updated")),this},t}(n(38239));e.exports=o},23178:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(631),a=n(13122),s=n(75317),c=n(96971).buildLogLevels,u=n(62097).DEFAULT_LOG_LEVEL,l=n(36372),d=n(78144),p=d.MediaConnectionError,f=d.MediaDTLSTransportFailedError,h=d.SignalingConnectionDisconnectedError,v=0,m={connected:["reconnecting","disconnected"],reconnecting:["connected","disconnected"],disconnected:[]},_=function(e){function t(t,n,r,i){var a=this,d=c((i=Object.assign({logLevel:u,RecordingSignaling:o,Timeout:s},i)).logLevel);a=e.call(this,"connected",m)||this;var p=i.RecordingSignaling,h=new i.Timeout(function(){a._disconnect(a._reconnectingError)},i.sessionTimeout,!1);return Object.defineProperties(a,{_instanceId:{value:v++},_log:{value:i.log?i.log.createLog("default",a):new l("default",a,d,i.loggerName)},_mediaConnectionIsReconnecting:{writable:!0,value:!1},_options:{value:i},_reconnectingError:{value:null,writable:!0},_sessionTimeout:{value:h},dominantSpeakerSid:{enumerable:!0,value:null,writable:!0},localParticipant:{enumerable:!0,value:t},name:{enumerable:!0,value:r},participants:{enumerable:!0,value:new Map},recording:{enumerable:!0,value:new p},sid:{enumerable:!0,value:n}}),a.on("connectionStateChanged",function(){"failed"!==a.connectionState||["disconnected","failed"].includes(a.iceConnectionState)||a._disconnect(new f)}),a.on("iceConnectionStateChanged",function(){return y(a)}),a.on("signalingConnectionStateChanged",function(){return y(a)}),setTimeout(function(){return y(a)}),a}return i(t,e),t.prototype._disconnect=function(e){return"disconnected"!==this.state&&(this.preempt("disconnected",null,[e]),!0)},t.prototype.toString=function(){return"[RoomSignaling #"+this._instanceId+": "+(this.localParticipant?this.localParticipant.sid:"null")+"]"},t.prototype.connectParticipant=function(e){var t=this;return!("disconnected"===e.state||this.participants.has(e.sid))&&(this.participants.set(e.sid,e),e.on("stateChanged",function n(r){"disconnected"===r&&(e.removeListener("stateChanged",n),t.participants.delete(e.sid),t.emit("participantDisconnected",e))}),this.emit("participantConnected",e),!0)},t.prototype.disconnect=function(){return this._disconnect()},t.prototype.setDominantSpeaker=function(e){this.dominantSpeakerSid=e,this.emit("dominantSpeakerChanged")},t}(a);function y(e){var t;if("disconnected"===e.state||"disconnected"===e.signalingConnectionState){e._sessionTimeout.clear();return}"reconnecting"===e.signalingConnectionState?t=e.signalingConnectionState:"failed"===e.iceConnectionState?(e._mediaConnectionIsReconnecting=!0,t="reconnecting"):"new"===e.iceConnectionState||"checking"===e.iceConnectionState?t=e._mediaConnectionIsReconnecting?"reconnecting":"connected":(e._mediaConnectionIsReconnecting=!1,e._reconnectingError=null,e._sessionTimeout.clear(),t="connected"),t!==e.state&&("reconnecting"===t?(e._reconnectingError="reconnecting"===e.signalingConnectionState?new h:new p,e._sessionTimeout.start(),e.preempt(t,null,[e._reconnectingError])):e.preempt(t))}e.exports=_},38239:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r,i){var o=e.call(this)||this,a=null;return Object.defineProperties(o,{_error:{value:null,writable:!0},_isEnabled:{value:r,writable:!0},_priority:{value:i,writable:!0},_trackTransceiver:{value:null,writable:!0},_sid:{get:function(){return a},set:function(e){null===a&&(a=e)}},kind:{enumerable:!0,value:n},name:{enumerable:!0,value:t}}),o}return i(t,e),Object.defineProperty(t.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sid",{get:function(){return this._sid},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trackTransceiver",{get:function(){return this._trackTransceiver},enumerable:!1,configurable:!0}),t.prototype.disable=function(){return this.enable(!1)},t.prototype.enable=function(e){return e="boolean"!=typeof e||e,this.isEnabled!==e&&(this._isEnabled=e,this.emit("updated")),this},t.prototype.setTrackTransceiver=function(e){return e=e||null,this.trackTransceiver!==e&&(this._trackTransceiver=e,this.emit("updated")),this},t.prototype.setSid=function(e){return null===this.sid&&(this._sid=e,this.emit("updated")),this},t}(n(17187).EventEmitter);e.exports=o},44904:function(e,t,n){"use strict";var r=n(17422),i=n(26503),o=n(14803),a=n(61722),s=n(78144),c=s.SignalingConnectionDisconnectedError,u=s.SignalingIncomingMessageInvalidError,l=n(96971),d=l.flatMap,p=l.createRoomConnectEventPayload;e.exports=function(e,t,n,s,l,f){f=Object.assign({PeerConnectionManager:i,RoomV2:o,Transport:a},f);var h,v=l.video[0]&&!0===l.video[0].adaptiveSimulcast,m=f.PeerConnectionManager,_=f.RoomV2,y=f.Transport,g=f.iceServers,b=f.log,k=new m(s,l,f),w=d(n.tracks,function(e){return[e.trackTransceiver]});k.setTrackSenders(w);var S=Error("Canceled"),T=new r(function(r,i,o){var a=f.automaticSubscription,s=f.bandwidthProfile,l=f.dominantSpeaker,d=f.environment,m=f.eventObserver,w=f.loggerName,T=f.logLevel,C=f.name,O=f.networkMonitor,P=f.networkQuality,E=f.notifyWarnings,R=f.realm,L=f.sdpSemantics,j=Object.assign({adaptiveSimulcast:v,automaticSubscription:a,dominantSpeaker:l,environment:d,eventObserver:m,loggerName:w,logLevel:T,networkMonitor:O,networkQuality:P,notifyWarnings:E,iceServers:g,onIced:function(e){return o()?(i(S),Promise.reject(S)):(b.debug("Got ICE servers:",e),f.iceServers=e,k.setConfiguration(f),k.createAndOffer().then(function(){if(o())throw i(S),S;b.debug("createAndOffer() succeeded."),k.dequeue("description")}).catch(function(e){throw b.error("createAndOffer() failed:",e),i(e),e}))},realm:R,renderHints:!!s&&("disabled"!==f.clientTrackSwitchOffControl||"disabled"!==f.contentPreferencesMode),sdpSemantics:L,trackPriority:!!s,trackSwitchOff:!!s},s?{bandwidthProfile:s}:{});h=new y(C,e,n,k,t,j);var M=p(f);m.emit("event",M),h.once("connected",function(e){if(b.debug("Transport connected:",e),o()){i(S);return}if(!e.participant){i(new u);return}r(new _(n,e,h,k,f))}),h.once("stateChanged",function(e,t){"disconnected"===e?(h=null,i(t||new c)):b.debug("Transport state changed:",e)})},function(){h&&(h.disconnect(),h=null)});return T.catch(function(){h&&(h.disconnect(),h=null),k.close()}),T}},58869:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,"active_speaker",n)||this;return Object.defineProperties(r,{_loudestParticipantSid:{value:null,writable:!0}}),r.on("ready",function(e){e.on("message",function(e){"active_speaker"===e.type&&r._setLoudestParticipantSid(e.participant)})}),r}return i(t,e),Object.defineProperty(t.prototype,"loudestParticipantSid",{get:function(){return this._loudestParticipantSid}
1,enumerable:!1,configurable:!0}),t.prototype._setLoudestParticipantSid=function(e){this.loudestParticipantSid!==e&&(this._loudestParticipantSid=e,this.emit("updated"))},t}(n(61014));e.exports=o},75177:function(e,t,n){"use strict";var r=n(95115),i=function(){function e(){Object.defineProperties(this,{_filter:{value:new r({getKey:function(e){return e.ufrag},isLessThanOrEqualTo:function(e,t){return e.revision<=t.revision}})},_ufrag:{writable:!0,value:null},ufrag:{enumerable:!0,get:function(){return this._ufrag}}})}return e.prototype.setUfrag=function(e){this._ufrag=e;var t=this._filter.toMap().get(e);return t?t.candidates:[]},e.prototype.update=function(e){e.candidates=e.candidates||[];var t=this._filter.toMap().get(e.ufrag),n=t?t.candidates:[];return this._filter.update(e)&&this._ufrag===e.ufrag?e.candidates.slice(n.length):[]},e}();e.exports=i},68581:function(e,t,n){"use strict";var r=n(62097),i=r.ICE_ACTIVITY_CHECK_PERIOD_MS,o=r.ICE_INACTIVITY_THRESHOLD_MS,a=function(){function e(e,t){Object.defineProperties(this,{_activityCheckPeriodMs:{value:(t=Object.assign({activityCheckPeriodMs:i,inactivityThresholdMs:o},t)).activityCheckPeriodMs},_inactivityThresholdMs:{value:t.inactivityThresholdMs},_lastActivity:{value:null,writable:!0},_peerConnection:{value:e},_timer:{value:null,writable:!0},_onIceConnectionStateChanged:{value:null,writable:!0}})}return e.prototype._getActivePairStat=function(e){return Array.from(e.values()).find(function(e){return"candidate-pair"===e.type&&e.nominated})||{bytesReceived:0,timestamp:Math.round(new Date().getTime())}},e.prototype._getIceConnectionStats=function(){var e=this;return this._peerConnection.getStats().then(function(t){return e._getActivePairStat(t)}).catch(function(){return null})},e.prototype._scheduleInactivityCallback=function(e){var t=this;e&&null===this._onIceConnectionStateChanged?(this._onIceConnectionStateChanged=function(){"disconnected"===t._peerConnection.iceConnectionState&&e()},this._peerConnection.addEventListener("iceconnectionstatechange",this._onIceConnectionStateChanged)):!e&&this._onIceConnectionStateChanged&&(this._peerConnection.removeEventListener("iceconnectionstatechange",this._onIceConnectionStateChanged),this._onIceConnectionStateChanged=null)},e.prototype.start=function(e){var t=this;this.stop(),this._timer=setInterval(function(){t._getIceConnectionStats().then(function(n){n&&(t._lastActivity&&t._lastActivity.bytesReceived===n.bytesReceived||(t._lastActivity=n,t._scheduleInactivityCallback(null)),n.timestamp-t._lastActivity.timestamp>=t._inactivityThresholdMs&&("disconnected"===t._peerConnection.iceConnectionState?e():null===t._onIceConnectionStateChanged&&t._scheduleInactivityCallback(e)))})},this._activityCheckPeriodMs)},e.prototype.stop=function(){this._scheduleInactivityCallback(null),null!==this._timer&&(clearInterval(this._timer),this._timer=null,this._lastActivity=null)},e}();e.exports=a},89528:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(44904),a=n(60671),s=function(e){function t(t,n){var r=this;return n=Object.assign({createCancelableRoomSignalingPromise:o},n),Object.defineProperties(r=e.call(this)||this,{_createCancelableRoomSignalingPromise:{value:n.createCancelableRoomSignalingPromise},_options:{value:n},_wsServer:{value:t}}),r}return i(t,e),t.prototype._connect=function(e,t,n,r,i){return i=Object.assign({},this._options,i),this._createCancelableRoomSignalingPromise.bind(null,t,this._wsServer,e,n,r,i)},t.prototype.createLocalParticipantSignaling=function(e,t){return new a(e,t)},t}(n(95743));e.exports=s},60671:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(8881),a=n(58876),s=n(62097).DEFAULT_LOG_LEVEL,c=n(36372),u=n(96971),l=u.buildLogLevels,d=u.isDeepEqual,p=function(e){function t(t,n,r){var i=this;r=Object.assign({logLevel:s,LocalTrackPublicationV2:a},r),i=e.call(this)||this;var o=l(r.logLevel);return Object.defineProperties(i,{_bandwidthProfile:{value:null,writable:!0},_bandwidthProfileRevision:{value:0,writable:!0},_encodingParameters:{value:t},_removeListeners:{value:new Map},_LocalTrackPublicationV2:{value:r.LocalTrackPublicationV2},_log:{value:r.log?r.log.createLog("default",i):new c("default",i,o,r.loggerName)},_publishedRevision:{writable:!0,value:0},_revision:{writable:!0,value:1},_signalingRegion:{value:null,writable:!0},audioProcessors:{value:[],writable:!0},bandwidthProfile:{enumerable:!0,get:function(){return this._bandwidthProfile}},bandwidthProfileRevision:{enumerable:!0,get:function(){return this._bandwidthProfileRevision}},networkQualityConfiguration:{enumerable:!0,value:n},revision:{enumerable:!0,get:function(){return this._revision}},signalingRegion:{enumerable:!0,get:function(){return this._signalingRegion}}}),i}return i(t,e),t.prototype.toString=function(){return"[LocalParticipantSignaling: "+this.sid+"]"},t.prototype.setSignalingRegion=function(e){this._signalingRegion||(this._signalingRegion=e)},t.prototype.setBandwidthProfile=function(e){d(this._bandwidthProfile,e)||(this._bandwidthProfile=JSON.parse(JSON.stringify(e)),this._bandwidthProfileRevision++,this.didUpdate())},t.prototype.setAudioProcessors=function(e){this.audioProcessors=e},t.prototype.getParameters=function(){return this._encodingParameters},t.prototype.setParameters=function(e){return this._encodingParameters.update(e),this},t.prototype.update=function(e){return this._publishedRevision>=e.revision||(this._publishedRevision=e.revision,e.tracks.forEach(function(e){var t=this.tracks.get(e.id);t&&t.update(e)},this)),this},t.prototype.updateMediaStates=function(e){return e&&e.tracks&&Array.from(this.tracks.values()).forEach(function(t){var n=e.tracks[t.sid];n&&t.updateMediaStates(n)}),this},t.prototype._createLocalTrackPublicationSignaling=function(e,t,n,r){return new this._LocalTrackPublicationV2(e,t,n,r,{log:this._log})},t.prototype.addTrack=function(t,n,r,i){var o=this;e.prototype.addTrack.call(this,t,n,r,i);var a=this.getPublication(t),s=a.isEnabled,c=a.updatedPriority,u=function(){(s!==a.isEnabled||c!==a.updatedPriority)&&(o.didUpdate(),s=a.isEnabled,c=a.updatedPriority)};return a.on("updated",u),this._removeListener(a),this._removeListeners.set(a,function(){return a.removeListener("updated",u)}),this.didUpdate(),this},t.prototype._removeListener=function(e){var t=this._removeListeners.get(e);t&&t()},t.prototype.getState=function(){return{revision:this.revision,tracks:Array.from(this.tracks.values()).map(function(e){return e.getState()})}},t.prototype.didUpdate=function(){this._revision++,this.emit("updated")},t.prototype.removeTrack=function(t){var n=e.prototype.removeTrack.call(this,t);return n&&(t.removeClone(n.trackTransceiver),this._removeListener(n),this.didUpdate()),n},t.prototype.setNetworkQualityConfiguration=function(e){this.networkQualityConfiguration.update(e)},t.prototype.setPublisherHint=function(e,t){var n=Array.from(this.tracks.values()).find(function(t){return t.sid===e});return n?n.trackTransceiver.setPublisherHint(t):(this._log.warn("track:"+e+" not found"),Promise.resolve("UNKNOWN_TRACK"))},t}(o);e.exports=p},58876:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}
1),o=n(70617),a=n(22665),s=n(78144).createTwilioError,c=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r)||this;return Object.defineProperties(a,{_log:{value:o.log.createLog("default",a)},_mediaStates:{value:{recordings:null},writable:!0},_noiseCancellationVendor:{value:i}}),a}return i(t,e),t.prototype.getState=function(){var e={enabled:this.isEnabled,id:this.id,kind:this.kind,name:this.name,priority:this.updatedPriority};return this._noiseCancellationVendor&&(e.audio_processor=this._noiseCancellationVendor),e},t.prototype.toString=function(){return"[LocalTrackPublicationV2: "+this.sid+"]"},t.prototype.update=function(e){switch(e.state){case"ready":this.setSid(e.sid);break;case"failed":var t=e.error;this.publishFailed(s(t.code,t.message))}return this},t.prototype.updateMediaStates=function(e){if(!e||!e.recordings||this._mediaStates.recordings===e.recordings)return this;switch(this._mediaStates.recordings=e.recordings,this._mediaStates.recordings){case"OK":this._log.info("Warnings have cleared."),this.emit("warningsCleared");break;case"NO_MEDIA":this._log.warn("Recording media lost."),this.emit("warning",a.recordingMediaLost);break;default:this._log.warn("Unknown media state detected: "+this._mediaStates.recordings)}return this},t}(o);e.exports=c},61014:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(17187),a=0,s=function(e){function t(t,n,r){var i=e.call(this)||this;return Object.defineProperties(i,{_instanceId:{value:a++},channel:{value:n},_log:{value:r.log.createLog("default",i)},_getReceiver:{value:t},_receiverPromise:{value:null,writable:!0},_transport:{value:null,writable:!0}}),i}return i(t,e),Object.defineProperty(t.prototype,"isSetup",{get:function(){return!!this._receiverPromise},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return"[MediaSignaling #"+this._instanceId+":"+this.channel+"]"},t.prototype.setup=function(e){var t=this;this._teardown(),this._log.info("setting up msp transport for id:",e);var n=this._getReceiver(e).then(function(e){if("data"!==e.kind&&t._log.error("Expected a DataTrackReceiver"),t._receiverPromise===n){try{t._transport=e.toDataTransport(),t.emit("ready",t._transport)}catch(e){t._log.error("Failed to toDataTransport: "+e.message)}e.once("close",function(){return t._teardown()})}});this._receiverPromise=n},t.prototype._teardown=function(){this._transport&&(this._log.info("Tearing down"),this._transport=null,this._receiverPromise=null,this.emit("teardown"))},t}(o);e.exports=s},16202:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=n(17187),s=n(97396),c=function(e){function t(t,n){var r=e.call(this)||this;return Object.defineProperties(r,{_factories:{value:new WeakMap},_manager:{value:t},_signaling:{value:n}}),n.on("updated",function(){return r.emit("updated")}),r}return i(t,e),Object.defineProperty(t.prototype,"level",{get:function(){return this._signaling.level}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"levels",{get:function(){return this._signaling.levels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteLevels",{get:function(){return this._signaling.remoteLevels},enumerable:!1,configurable:!0}),t.prototype.start=function(){var e=this;this.stop();var t=setTimeout(function(){if(e._timeout===t)Promise.all((e._manager._peerConnections?Array.from(e._manager._peerConnections.values()):[]).map(function(e){return e._peerConnection}).filter(function(e){return"closed"!==e.signalingState}).map(function(t){if(e._factories.has(t))return e._factories.get(t);var n=new s(t);return e._factories.set(t,n),n}).map(function(e){return e.next().catch(function(){return null})})).then(function(e){return e.filter(function(e){return e}).map(function(e){return e.summarize()})}).then(function(n){if(e._timeout===t){if(n.length){var r=o(n,1)[0];e._signaling.put(r)}e.start()}})},200);this._timeout=t},t.prototype.stop=function(){clearTimeout(this._timeout),this._timeout=null},t}(a);e.exports=c},80597:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(61014),a=n(7206),s=n(75317),c=function(e){function t(t,n,r){var i=e.call(this,t,"network_quality",r)||this;return Object.defineProperties(i,{_level:{value:null,writable:!0},_levels:{value:null,writable:!0},_remoteLevels:{value:new Map,writable:!0},_networkQualityInputs:{value:new a},_resendTimer:{value:new s(function(){i._resendTimer.setDelay(1.5*i._resendTimer.delay),i._sendNetworkQualityInputs()},5e3,!1)},_networkQualityReportLevels:{get:function(){return{reportLevel:n.local,remoteReportLevel:n.remote}}}}),i.on("ready",function(e){e.on("message",function(e){i._log.debug("Incoming: ",e),"network_quality"===e.type&&i._handleNetworkQualityMessage(e)})}),i._sendNetworkQualityInputs(),i}return i(t,e),Object.defineProperty(t.prototype,"level",{get:function(){return this._level},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"levels",{get:function(){return this._levels},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteLevels",{get:function(){return this._remoteLevels},enumerable:!1,configurable:!0}),t.prototype._handleNetworkQualityMessage=function(e){var t=this,n=!1,r=null,i=e?e.local:null;"number"==typeof i?(r=i,this._levels=null):"object"==typeof i&&i&&(this._levels=i,r="number"==typeof i.level?i.level:Math.min(i.audio.send,i.audio.recv,i.video.send,i.video.recv)),null!==r&&this.level!==r&&(this._level=r,n=!0),this._remoteLevels=e&&e.remotes?e.remotes.reduce(function(e,r){return(t._remoteLevels.get(r.sid)||{}).level!==r.level&&(n=!0),e.set(r.sid,r)},new Map):this._remoteLevels,n&&this.emit("updated"),this._resendTimer.setDelay(5e3),this._resendTimer.isSet&&setTimeout(function(){return t._sendNetworkQualityInputs()},1e3)},t.prototype._sendNetworkQualityInputs=function(){var e=this;return this._resendTimer.clear(),this._networkQualityInputs.take().then(function(t){e._transport&&e._transport.publish(Object.assign({type:"network_quality"},t,e._networkQualityReportLevels))}).finally(function(){e._resendTimer.start()})},t.prototype.put=function(e){this._networkQualityInputs.put(e)},t}(o);e.exports=c},5773:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(51822),c=n(39778),u=c.RTCIceCandidate,l=c.RTCPeerConnection,d=c.RTCSessionDescription,p=c.getStats,f=n(67476),h=n(62097),v=h.DEFAULT_ICE_GATHERING_TIMEOUT_MS,m=h.DEFAULT_LOG_LEVEL,_=h.DEFAULT_SESSION_TIMEOUT_SEC,y=h.iceRe
1startBackoffConfig,g=n(51062),b=g.addOrRewriteNewTrackIds,k=g.addOrRewriteTrackIds,w=g.createCodecMapForMediaSection,S=g.disableRtx,T=g.enableDtxForOpus,C=g.filterLocalCodecs,O=g.getMediaSections,P=g.removeSSRCAttributes,E=g.revertSimulcast,R=g.setCodecPreferences,L=g.setSimulcast,j=n(75317),M=n(78144),x=M.MediaClientLocalDescFailedError,A=M.MediaClientRemoteDescFailedError,D=n(96971),I=D.buildLogLevels,N=D.getPlatform,V=D.isChromeScreenShareTrack,F=D.oncePerTick,B=D.defer,U=n(75177),H=n(68581),W=n(39538),Q=n(38960),G=n(13122),q=n(36372),K=n(65179),z=n(14799),$=f.guessBrowser(),J=N(),Y=/android/.test(J),X="chrome"===$,Z="firefox"===$,ee="safari"===$,et=0,en={open:["closed","updating"],updating:["closed","open"],closed:[]},er=function(e){function t(t,n,r,i){var o=e.call(this,"open",en)||this,a=es(i=Object.assign({enableDscp:!1,dummyAudioMediaStreamTrack:null,isChromeScreenShareTrack:V,iceServers:[],logLevel:m,offerOptions:{},revertSimulcast:E,sessionTimeout:1e3*_,setCodecPreferences:R,setSimulcast:L,Backoff:s,IceConnectionMonitor:H,RTCIceCandidate:u,RTCPeerConnection:l,RTCSessionDescription:d,Timeout:j},i)),c=I(i.logLevel),p=i.RTCPeerConnection;!0===i.enableDscp&&(i.chromeSpecificConstraints=i.chromeSpecificConstraints||{},i.chromeSpecificConstraints.optional=i.chromeSpecificConstraints.optional||[],i.chromeSpecificConstraints.optional.push({googDscp:!0}));var f=i.log?i.log.createLog("webrtc",o):new q("webrtc",o,c,i.loggerName),h=new p(a,i.chromeSpecificConstraints);return i.dummyAudioMediaStreamTrack&&h.addTrack(i.dummyAudioMediaStreamTrack),Object.defineProperties(o,{_appliedTrackIdsToAttributes:{value:new Map,writable:!0},_dataChannels:{value:new Map},_dataTrackReceivers:{value:new Set},_descriptionRevision:{writable:!0,value:0},_didGenerateLocalCandidates:{writable:!0,value:!1},_enableDscp:{value:i.enableDscp},_encodingParameters:{value:n},_isChromeScreenShareTrack:{value:i.isChromeScreenShareTrack},_iceGatheringFailed:{value:!1,writable:!0},_iceGatheringTimeout:{value:new i.Timeout(function(){return o._handleIceGatheringTimeout()},v,!1)},_iceRestartBackoff:{value:new i.Backoff(y)},_instanceId:{value:++et},_isIceConnectionInactive:{writable:!0,value:!1},_isIceLite:{writable:!0,value:!1},_isIceRestartBackoffInProgress:{writable:!0,value:!1},_isRestartingIce:{writable:!0,value:!1},_lastIceConnectionState:{writable:!0,value:null},_lastStableDescriptionRevision:{writable:!0,value:0},_localCandidates:{writable:!0,value:[]},_localCodecs:{value:new Set},_localCandidatesRevision:{writable:!0,value:1},_localDescriptionWithoutSimulcast:{writable:!0,value:null},_localDescription:{writable:!0,value:null},_localUfrag:{writable:!0,value:null},_log:{value:f},_eventObserver:{value:i.eventObserver},_remoteCodecMaps:{value:new Map},_rtpSenders:{value:new Map},_rtpNewSenders:{value:new Set},_iceConnectionMonitor:{value:new i.IceConnectionMonitor(h)},_mediaTrackReceivers:{value:new Set},_needsAnswer:{writable:!0,value:!1},_negotiationRole:{writable:!0,value:null},_offerOptions:{writable:!0,value:i.offerOptions},_onEncodingParametersChanged:{value:F(function(){o._needsAnswer||el(o)})},_peerConnection:{value:h},_preferredAudioCodecs:{value:r.audio},_preferredVideoCodecs:{value:r.video},_shouldApplyDtx:{value:r.audio.every(function(e){return"opus"!==e.codec})||r.audio.some(function(e){var t=e.codec,n=e.dtx;return"opus"===t&&n})},_queuedDescription:{writable:!0,value:null},_iceReconnectTimeout:{value:new i.Timeout(function(){f.debug("ICE reconnect timed out"),o.close()},i.sessionTimeout,!1)},_recycledTransceivers:{value:{audio:[],video:[]}},_replaceTrackPromises:{value:new Map},_remoteCandidates:{writable:!0,value:new U},_setCodecPreferences:{value:Z&&Y&&r.video[0]&&"h264"!==r.video[0].codec.toLowerCase()?function(e){return e}:i.setCodecPreferences},_setSimulcast:{value:i.setSimulcast},_revertSimulcast:{value:i.revertSimulcast},_RTCIceCandidate:{value:i.RTCIceCandidate},_RTCPeerConnection:{value:i.RTCPeerConnection},_RTCSessionDescription:{value:i.RTCSessionDescription},_shouldOffer:{writable:!0,value:!1},_shouldRestartIce:{writable:!0,value:!1},_trackIdsToAttributes:{value:new Map,writable:!0},_trackMatcher:{writable:!0,value:null},_mediaTrackSenderToPublisherHints:{value:new Map},id:{enumerable:!0,value:t}}),n.on("changed",o._onEncodingParametersChanged),h.addEventListener("connectionstatechange",o._handleConnectionStateChange.bind(o)),h.addEventListener("datachannel",o._handleDataChannelEvent.bind(o)),h.addEventListener("icecandidate",o._handleIceCandidateEvent.bind(o)),h.addEventListener("iceconnectionstatechange",o._handleIceConnectionStateChange.bind(o)),h.addEventListener("icegatheringstatechange",o._handleIceGatheringStateChange.bind(o)),h.addEventListener("signalingstatechange",o._handleSignalingStateChange.bind(o)),h.addEventListener("track",o._handleTrackEvent.bind(o)),o.on("stateChanged",function e(t){"closed"===t&&(o.removeListener("stateChanged",e),o._dataChannels.forEac
1h(function(e,t){o.removeDataTrackSender(t)}))}),o}return i(t,e),t.prototype.toString=function(){return"[PeerConnectionV2 #"+this._instanceId+": "+this.id+"]"},t.prototype.setEffectiveAdaptiveSimulcast=function(e){this._log.debug("Setting setEffectiveAdaptiveSimulcast: ",e),this._preferredVideoCodecs.forEach(function(t){"adaptiveSimulcast"in t&&(t.adaptiveSimulcast=e)})},Object.defineProperty(t.prototype,"_shouldApplySimulcast",{get:function(){return(!!X||!!ee)&&this._preferredVideoCodecs.some(function(e){return"vp8"===e.codec.toLowerCase()&&e.simulcast&&!1!==e.adaptiveSimulcast})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return"failed"===this.iceConnectionState?"failed":this._peerConnection.connectionState||this.iceConnectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iceConnectionState",{get:function(){return this._isIceConnectionInactive&&"disconnected"===this._peerConnection.iceConnectionState||this._iceGatheringFailed?"failed":this._peerConnection.iceConnectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isApplicationSectionNegotiated",{get:function(){return"closed"===this._peerConnection.signalingState||!!this._peerConnection.localDescription&&O(this._peerConnection.localDescription.sdp,"application").length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isAdaptiveSimulcastEnabled",{get:function(){var e=this._preferredVideoCodecs.find(function(e){return"adaptiveSimulcast"in e});return e&&!0===e.adaptiveSimulcast},enumerable:!1,configurable:!0}),t.prototype._maybeUpdateEncodings=function(e,t,n){if(void 0===n&&(n=!1),"video"!==e.kind||"ended"===e.readyState)return!1;var r=e.getSettings(),i=r.height,o=r.width;if("number"!=typeof i||"number"!=typeof o)return!1;var a=f.guessBrowser();return("safari"===a||"chrome"===a&&!!this._isAdaptiveSimulcastEnabled)&&(this._updateEncodings(e,t,n),!0)},t.prototype._updateEncodings=function(e,t,n){if(this._isChromeScreenShareTrack(e)){var r=[{scaleResolutionDownBy:1},{scaleResolutionDownBy:1}];t.forEach(function(e,t){var i=r[t];i?(e.scaleResolutionDownBy=i.scaleResolutionDownBy,n&&delete e.active):(e.active=!1,delete e.scaleResolutionDownBy)})}else{var i=e.getSettings(),o=i.width*i.height,a=[{pixels:518400,maxActiveLayers:3},{pixels:129600,maxActiveLayers:2},{pixels:0,maxActiveLayers:1}].find(function(e){return o>=e.pixels}),s=Math.min(t.length,a.maxActiveLayers);t.forEach(function(e,t){t<s?(e.scaleResolutionDownBy=1<<s-t-1,n&&(e.active=!0)):(e.active=!1,delete e.scaleResolutionDownBy)})}this._log.debug("_updateEncodings:",t.map(function(e,t){return"["+t+": "+e.active+", "+(e.scaleResolutionDownBy||0)+"]"}).join(", "))},t.prototype._addIceCandidate=function(e){var t=this;return Promise.resolve().then(function(){return e=new t._RTCIceCandidate(e),t._peerConnection.addIceCandidate(e)}).catch(function(n){t._log.warn("Failed to add RTCIceCandidate "+(e?'"'+e.candidate+'"':"null")+": "+n.message)})},t.prototype._addIceCandidates=function(e){return Promise.all(e.map(this._addIceCandidate,this)).then(function(){})},t.prototype._addOrUpdateTransceiver=function(e){var t=this,n=function(e,t){var n={audio:e._preferredAudioCodecs.map(function(e){return e.codec.toLowerCase()}),video:e._preferredVideoCodecs.map(function(e){return e.codec.toLowerCase()})}[t],r=e._recycledTransceivers[t],i=n.find(function(t){return e._localCodecs.has(t)});if(!i)return r.shift();var o=r.find(function(t){var n=e._remoteCodecMaps.get(t.mid);return n&&n.has(i)});return o&&r.splice(r.indexOf(o),1),o}(this,e.kind);if(n&&n.sender){var r=n.sender.track?n.sender.track.id:null;return r&&this._log.warn("Reusing transceiver: "+n.mid+"] "+r+" => "+e.id),this._replaceTrackPromises.set(n,n.sender.replaceTrack(e).then(function(){n.direction="sendrecv"},function(){}).finally(function(){t._replaceTrackPromises.delete(n)})),n}return this._peerConnection.addTransceiver(e)},t.prototype._checkIceBox=function(e){var t=ea(e);if(!t)return Promise.resolve();var n=this._remoteCandidates.setUfrag(t);return this._addIceCandidates(n)},t.prototype._answer=function(e){var t=this;return Promise.resolve().then(function(){return t._negotiationRole||(t._negotiationRole="answerer"),t._setRemoteDescription(e)}).catch(function(){throw new A}).then(function(){return t._peerConnection.createAnswer()}).then(function(n){var r=P((n=Z?new t._RTCSessionDescription({sdp:S(n.sdp),type:n.type}):z(n)).sdp,["mslabel","label"]);if(t._shouldApplySimulcast){var i=r;
1r=t._setSimulcast(i,t._trackIdsToAttributes),r=t._revertSimulcast(r,i,e.sdp)}return r=r.replace(/42e015/g,"42e01f"),t._setLocalDescription({type:n.type,sdp:r})}).then(function(){return t._checkIceBox(e)}).then(function(){return t._queuedDescription&&t._updateDescription(t._queuedDescription)}).then(function(){return t._queuedDescription=null,t._maybeReoffer(t._peerConnection.localDescription)}).catch(function(e){var n=e instanceof A?e:new x;throw t._publishMediaWarning({message:"Failed to _answer",code:n.code,error:e}),n})},t.prototype._close=function(){return this._iceConnectionMonitor.stop(),"closed"!==this._peerConnection.signalingState&&(this._peerConnection.close(),this.preempt("closed"),this._encodingParameters.removeListener("changed",this._onEncodingParametersChanged),!0)},t.prototype._handleConnectionStateChange=function(){this.emit("connectionStateChanged")},t.prototype._handleDataChannelEvent=function(e){var t=this,n=e.channel,r=new W(n);this._dataTrackReceivers.add(r),n.addEventListener("close",function(){t._dataTrackReceivers.delete(r)}),this.emit("trackAdded",r)},t.prototype._handleGlare=function(e){var t=this;return this._log.debug("Glare detected; rolling back"),this._isRestartingIce&&(this._log.debug("An ICE restart was in progress; we'll need to restart ICE again after rolling back"),this._isRestartingIce=!1,this._shouldRestartIce=!0),Promise.resolve().then(function(){return t._trackIdsToAttributes=new Map(t._appliedTrackIdsToAttributes),t._setLocalDescription({type:"rollback"})}).then(function(){return t._needsAnswer=!1,t._answer(e)}).then(function(e){return e?Promise.resolve():t._offer()})},t.prototype._publishMediaWarning=function(e){var t=e.message,n=e.code,r=e.error,i=e.sdp;this._eventObserver.emit("event",{level:"warning",name:"error",group:"media",payload:{message:t,code:n,context:JSON.stringify({error:r.message,sdp:i})}})},t.prototype._handleIceCandidateEvent=function(e){e.candidate&&(this._log.debug("Clearing ICE gathering timeout"),this._didGenerateLocalCandidates=!0,this._iceGatheringTimeout.clear(),this._localCandidates.push(e.candidate));var t={ice:{candidates:this._isIceLite?[]:this._localCandidates.slice(),ufrag:this._localUfrag},id:this.id};e.candidate||(t.ice.complete=!0),this._isIceLite&&e.candidate||(t.ice.revision=this._localCandidatesRevision++,this.emit("candidates",t))},t.prototype._handleIceConnectionStateChange=function(){var e=this,t=this._peerConnection.iceConnectionState,n=["connected","completed"].includes(t),r=this._log;r.debug('ICE connection state is "'+t+'"'),n&&(this._iceReconnectTimeout.clear(),this._iceRestartBackoff.reset()),"failed"===this._lastIceConnectionState||"failed"!==t||this._shouldRestartIce||this._isRestartingIce?["disconnected","failed"].includes(this._lastIceConnectionState)&&n&&r.debug("ICE reconnected"):(r.warn("ICE failed"),this._initiateIceRestartBackoff()),"connected"===t?(this._isIceConnectionInactive=!1,this._iceConnectionMonitor.start(function(){e._iceConnectionMonitor.stop(),e._shouldRestartIce||e._isRestartingIce||(r.warn("ICE Connection Monitor detected inactivity"),e._isIceConnectionInactive=!0,e._initiateIceRestartBackoff(),e.emit("iceConnectionStateChanged"),e.emit("connectionStateChanged"))})):["disconnected","completed"].includes(t)||(this._iceConnectionMonitor.stop(),this._isIceConnectionInactive=!1),this._lastIceConnectionState=t,this.emit("iceConnectionStateChanged")},t.prototype._handleIceGatheringTimeout=function(){this._log.warn("ICE failed to gather any local candidates"),this._iceGatheringFailed=!0,this._initiateIceRestartBackoff(),this.emit("iceConnectionStateChanged"),this.emit("connectionStateChanged")},t.prototype._handleIceGatheringStateChange=function(){var e=this._peerConnection.iceGatheringState,t=this._log;t.debug('ICE gathering state is "'+e+'"');var n=this._iceGatheringTimeout,r=n.delay,i=n.isSet;"gathering"!==e||this._didGenerateLocalCandidates||i||(t.debug("Starting ICE gathering timeout: "+r),this._iceGatheringFailed=!1,this._iceGatheringTimeout.start())},t.prototype._handleSignalingStateChange=function(){"stable"===this._peerConnection.signalingState&&(this._appliedTrackIdsToAttributes=new Map(this._trackIdsToAttributes))},t.prototype._handleTrackEvent=function(e){var t=this,n=this._peerConnection.remoteDescription?this._peerConnection.remoteDescription.sdp:null;this._trackMatcher=this._trackMatcher||new K,this._trackMatcher.update(n);var r=e.track,i=new Q(this._trackMatcher.match(e)||r.id,r);
1this._mediaTrackReceivers.forEach(function(e){e.track.id===i.track.id&&t._mediaTrackReceivers.delete(e)}),this._mediaTrackReceivers.add(i),r.addEventListener("ended",function(){return t._mediaTrackReceivers.delete(i)}),this.emit("trackAdded",i)},t.prototype._initiateIceRestart=function(){if("closed"!==this._peerConnection.signalingState){var e=this._log;e.warn("Attempting to restart ICE"),this._didGenerateLocalCandidates=!1,this._isIceRestartBackoffInProgress=!1,this._shouldRestartIce=!0;var t=this._iceReconnectTimeout,n=t.delay;t.isSet||(e.debug("Starting ICE reconnect timeout: "+n),this._iceReconnectTimeout.start()),this.offer().catch(function(t){e.error("offer failed in _initiateIceRestart with: "+t.message)})}},t.prototype._initiateIceRestartBackoff=function(){var e=this;"closed"===this._peerConnection.signalingState||this._isIceRestartBackoffInProgress||(this._log.warn("An ICE restart has been scheduled"),this._isIceRestartBackoffInProgress=!0,this._iceRestartBackoff.backoff(function(){return e._initiateIceRestart()}))},t.prototype._maybeReoffer=function(e){var t=this._shouldOffer;if(e&&e.sdp){var n=this._peerConnection.getSenders().filter(function(e){return e.track});t=["audio","video"].reduce(function(t,r){var i=O(e.sdp,r,"(sendrecv|sendonly)"),o=n.filter(ec.bind(null,r));return t||i.length<o.length},t);var r=this._dataChannels.size>0,i=O(e.sdp,"application").length>0;t=t||r&&!i}return(t?this._offer():Promise.resolve()).then(function(){return t})},t.prototype._offer=function(){var e=this,t=Object.assign({},this._offerOptions);return this._needsAnswer=!0,this._shouldRestartIce&&(this._shouldRestartIce=!1,this._isRestartingIce=!0,t.iceRestart=!0),Promise.all(this._replaceTrackPromises.values()).then(function(){return e._peerConnection.createOffer(t)}).catch(function(t){var n=new x;throw e._publishMediaWarning({message:"Failed to create offer",code:n.code,error:t}),n}).then(function(t){var n=P((t=Z?new e._RTCSessionDescription({sdp:S(t.sdp),type:t.type}):z(t)).sdp,["mslabel","label"]);n=e._peerConnection.remoteDescription?C(n,e._peerConnection.remoteDescription.sdp):n;var r=e._setCodecPreferences(n,e._preferredAudioCodecs,e._preferredVideoCodecs);return e._shouldOffer=!1,e._negotiationRole||(e._negotiationRole="offerer"),e._shouldApplySimulcast&&(e._localDescriptionWithoutSimulcast={type:"offer",sdp:r},r=e._setSimulcast(r,e._trackIdsToAttributes)),e._setLocalDescription({type:"offer",sdp:r})})},t.prototype._getMediaTrackSenderId=function(e){var t=Array.from(this._rtpSenders.keys()).find(function(t){return t.track.id===e});return t?t.id:e},t.prototype._addOrRewriteLocalTrackIds=function(e){var t=this,n=this._peerConnection.getTransceivers().filter(function(e){var t=e.sender;return!e.stopped&&t&&t.track}),r=new Map(n.filter(function(e){return e.mid}).map(function(e){var n=e.mid,r=e.sender;return[n,t._getMediaTrackSenderId(r.track.id)]})),i=k(e.sdp,r),o=n.filter(function(e){return!e.mid}),a=b(i,r,new Map(["audio","video"].map(function(e){return[e,o.filter(function(t){return t.sender.track.kind===e}).map(function(e){var n=e.sender;return t._getMediaTrackSenderId(n.track.id)})]})));return new this._RTCSessionDescription({sdp:a,type:e.type})},t.prototype._rollbackAndApplyOffer=function(e){var t=this;return this._setLocalDescription({type:"rollback"}).then(function(){return t._setLocalDescription(e)})},t.prototype._setLocalDescription=function(e){var t=this;return"rollback"!==e.type&&this._shouldApplyDtx&&(e=new this._RTCSessionDescription({sdp:T(e.sdp),type:e.type})),this._peerConnection.setLocalDescription(e).catch(function(n){t._log.warn('Calling setLocalDescription with an RTCSessionDescription of type "'+e.type+'" failed with the error "'+n.message+'".',n);var r=new x,i={message:'Calling setLocalDescription with an RTCSessionDescription of type "'+e.type+'" failed',code:r.code,error:n};throw e.sdp&&(t._log.warn("The SDP was "+e.sdp),i.sdp=e.sdp),t._publishMediaWarning(i),r}).then(function(){"rollback"!==e.type&&(t._localDescription=t._addOrRewriteLocalTrackIds(e),t._shouldApplyDtx&&(t._localDescription=new t._RTCSessionDescription({sdp:T(t._localDescription.sdp,[]),type:t._localDescription.type})),t._localCandidates=[],"offer"===e.type?t._descriptionRevision++:"answer"===e.type&&(t._lastStableDescriptionRevision=t._descriptionRevision,eu(t)),t._localUfrag=ea(e),t.emit("description",t.getState()))})},t.prototype._setRemoteDescription=function(e){var t=this;return e.sdp&&(e.sdp=this._setCodecPreferences(e.sdp,this._preferredAudioCodecs,this._preferredVideoCodecs),this._shouldApplyDtx?e.sdp=T(e.sdp):e.sdp=T(e.sdp,[]),Z&&(e.sdp=e.sdp.replace(/a=msid:[^ ]+ /g,"a=msid:- ")),this._peerConnection.remoteDescription||(this._isIceLite=/a=ice-lite/.test(e.sdp))),e=new this._RTCSessionDescription(e),Promise.resolve().then(function(){if("answer"===e.type&&t._localDescriptionWithoutSimulcast){var n=t._preferredVideoCodecs.find(function(e){return"adaptiveSimulcast"in e}),r=!!n&&!1===n.adaptiveSimulcast,i=t._revertSimulcast(t._localDescription.sdp,t._localDescriptionWithoutSimulcast.sdp,e.sdp,r);if(t._localDescriptionWithoutSimulcast=null,i!==t._localDescription.sdp)return t._rollbackAndApplyOffer({type:t._localDescription.type,sdp:i})}}).then(function(){return t._peerConnection.setRemoteDescription(e)}).then(function(){"answer"===e.type&&(t._isRestartingIce&&(t._log.debug("An ICE restart was in-progress and is now completed"),t._isRestartingIce=!1),eu(t))},function(n){throw t._log.warn('Calling setRemoteDescription with an RTCSessionDescription of type "'+e.type+'" failed with the error "'+n.message+'".',n),e.sdp&&t._log.warn("The SDP was "+e.sdp),n})},t.prototype._updateDescription=function(e){var t=this;switch(e.type){case"answer":case"pranswer":if(e.revision!==this._descriptionRevision||"have-local-offer"!==this._peerConnection.signalingState)return Promise.resolve();this._descriptionRevision=e.revision;break;
1case"close":return this._close();case"create-offer":if(e.revision<=this._lastStableDescriptionRevision)return Promise.resolve();if(this._needsAnswer)return this._queuedDescription=e,Promise.resolve();return this._descriptionRevision=e.revision,this._offer();case"offer":if(e.revision<=this._lastStableDescriptionRevision||"closed"===this._peerConnection.signalingState)return Promise.resolve();if("have-local-offer"===this._peerConnection.signalingState){if(this._needsAnswer&&0===this._lastStableDescriptionRevision)return this._queuedDescription=e,Promise.resolve();return this._descriptionRevision=e.revision,this._handleGlare(e)}return this._descriptionRevision=e.revision,this._answer(e).then(function(){})}var n=e.revision;return Promise.resolve().then(function(){return t._setRemoteDescription(e)}).catch(function(n){var r=new A;throw t._publishMediaWarning({message:'Calling setRemoteDescription with an RTCSessionDescription of type "'+e.type+'" failed',code:r.code,error:n,sdp:e.sdp}),r}).then(function(){return t._lastStableDescriptionRevision=n,t._needsAnswer=!1,t._checkIceBox(e)}).then(function(){return t._queuedDescription&&t._updateDescription(t._queuedDescription)}).then(function(){return t._queuedDescription=null,t._maybeReoffer(t._peerConnection.localDescription).then(function(){})})},t.prototype._updateIce=function(e){var t=this._remoteCandidates.update(e);return this._addIceCandidates(t)},t.prototype.addDataTrackSender=function(e){if(!this._dataChannels.has(e))try{var t={ordered:e.ordered};null!==e.maxPacketLifeTime&&(t.maxPacketLifeTime=e.maxPacketLifeTime),null!==e.maxRetransmits&&(t.maxRetransmits=e.maxRetransmits);var n=this._peerConnection.createDataChannel(e.id,t);e.addDataChannel(n),this._dataChannels.set(e,n)}catch(t){this._log.warn('Error creating an RTCDataChannel for DataTrack "'+e.id+'": '+t.message)}},t.prototype._handleQueuedPublisherHints=function(){var e=this;"stable"===this._peerConnection.signalingState&&this._mediaTrackSenderToPublisherHints.forEach(function(t,n){var r=t.deferred,i=t.encodings;e._mediaTrackSenderToPublisherHints.delete(n),e._setPublisherHint(n,i).then(function(e){return r.resolve(e)}).catch(function(e){return r.reject(e)})})},t.prototype._setPublisherHint=function(e,t){var n=this;if(Z)return Promise.resolve("COULD_NOT_APPLY_HINT");this._mediaTrackSenderToPublisherHints.has(e)&&(this._mediaTrackSenderToPublisherHints.get(e).deferred.resolve("REQUEST_SKIPPED"),this._mediaTrackSenderToPublisherHints.delete(e));var r=this._rtpSenders.get(e);if(!r)return this._log.warn("Could not apply publisher hint because RTCRtpSender was not found"),Promise.resolve("UNKNOWN_TRACK");if("closed"===this._peerConnection.signalingState)return this._log.warn('Could not apply publisher hint because signalingState was "closed"'),Promise.resolve("COULD_NOT_APPLY_HINT");if("stable"!==this._peerConnection.signalingState){this._log.debug("Queuing up publisher hint because signalingState:",this._peerConnection.signalingState);var i=B();return this._mediaTrackSenderToPublisherHints.set(e,{deferred:i,encodings:t}),i.promise}var o=r.getParameters();return null!==t&&t.forEach(function(e){var t=e.enabled,r=e.layer_index;o.encodings.length>r?(n._log.debug("layer:"+r+", active:"+o.encodings[r].active+" => "+t),o.encodings[r].active=t):n._log.warn("invalid layer:"+r+", active:"+t)}),this._maybeUpdateEncodings(r.track,o.encodings,null===t),r.setParameters(o).then(function(){return"OK"}).catch(function(e){return n._log.error("Failed to apply publisher hints:",e),"COULD_NOT_APPLY_HINT"})},t.prototype.addMediaTrackSender=function(e){var t=this;if(!("closed"===this._peerConnection.signalingState||this._rtpSe
1nders.has(e))){var n=this._addOrUpdateTransceiver(e.track).sender;e.addSender(n,function(n){return t._setPublisherHint(e,n)}),this._rtpNewSenders.add(n),this._rtpSenders.set(e,n)}},t.prototype.close=function(){this._close()&&(this._descriptionRevision++,this._localDescription={type:"close"},this.emit("description",this.getState()))},t.prototype.getTrackReceivers=function(){return Array.from(this._dataTrackReceivers).concat(Array.from(this._mediaTrackReceivers))},t.prototype.getState=function(){if(!this._localDescription)return null;var e="answer"===this._localDescription.type?this._lastStableDescriptionRevision:this._descriptionRevision,t={type:this._localDescription.type,revision:e};return this._localDescription.sdp&&(t.sdp=this._localDescription.sdp),{description:t,id:this.id}},t.prototype.offer=function(){var e=this;return this._needsAnswer||this._isRestartingIce?(this._shouldOffer=!0,Promise.resolve()):this.bracket("offering",function(t){return e.transition("updating",t),(e._needsAnswer||e._isRestartingIce?Promise.resolve():e._offer()).then(function(){e.tryTransition("open",t)},function(n){throw e.tryTransition("open",t),n})})},t.prototype.removeDataTrackSender=function(e){var t=this._dataChannels.get(e);t&&(e.removeDataChannel(t),this._dataChannels.delete(e),t.close())},t.prototype.removeMediaTrackSender=function(e){var t=this._rtpSenders.get(e);t&&("closed"!==this._peerConnection.signalingState&&this._peerConnection.removeTrack(t),e.removeSender(t),this._mediaTrackSenderToPublisherHints.has(e)&&(this._mediaTrackSenderToPublisherHints.get(e).deferred.resolve("UNKNOWN_TRACK"),this._mediaTrackSenderToPublisherHints.delete(e)),this._rtpNewSenders.delete(t),this._rtpSe
1nders.delete(e))},t.prototype.setConfiguration=function(e){"function"==typeof this._peerConnection.setConfiguration&&this._peerConnection.setConfiguration(es(e))},t.prototype.setIceReconnectTimeout=function(e){return this._iceReconnectTimeout.setDelay(e),this._log.debug("Updated ICE reconnection timeout period:",this._iceReconnectTimeout.delay),this},t.prototype.update=function(e){var t=this;return this.bracket("updating",function(n){if("closed"===t.state)return Promise.resolve();t.transition("updating",n);var r=[];return e.ice&&r.push(t._updateIce(e.ice)),e.description&&r.push(t._updateDescription(e.description)),Promise.all(r).then(function(){t.tryTransition("open",n)},function(e){throw t.tryTransition("open",n),e})})},t.prototype.getStats=function(){var e=this;return p(this._peerConnection).then(function(t){return Object.assign(t,{remoteAudioTrackStats:t.remoteAudioTrackStats.map(function(t){return eo(e,t)}),remoteVideoTrackStats:t.remoteVideoTrackStats.map(function(t){return eo(e,t)}),localAudioTrackStats:t.localAudioTrackStats.map(function(t){return ei(e,t)}),localVideoTrackStats:t.localVideoTrackStats.map(function(t){return ei(e,t)})})})},t}(G);function ei(e,t){var n=e._getMediaTrackSenderId(t.trackId);return Object.assign(t,{trackId:n})}function eo(e,t){var n=a([],o(e._mediaTrackReceivers)).find(function(e){return e.track.id===t.trackId});return Object.assign(t,{trackId:n?n.id:null})}function ea(e){if(e.sdp){var t=e.sdp.match(/^a=ice-ufrag:([a-zA-Z0-9+/]+)/m);if(t)return t[1]}return null}function es(e){return Object.assign({bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},e)}function ec(e,t){var n=t.track;return n&&n.kind===e&&"ended"!==n.readyState}function eu(e){var t,n;e._recycledTransceivers.audio=[],e._recycledTransceivers.video=[],e._peerConnection.getTransceivers().forEach(function(t){if(!t.stopped&&!e._replaceTrackPromises.has(t)&&["inactive","recvonly"].includes(t.direction)){var n=t.receiver.track;e._recycledTransceivers[n.kind].push(t)}}),(t=e._peerConnection.localDescription)&&t.sdp&&O(t.sdp).forEach(function(t){w(t).forEach(function(t,n){return e._localCodecs.add(n)})}),(n=e._peerConnection.remoteDescription)&&n.sdp&&O(n.sdp).forEach(function(t){var n=t.match(/^a=mid:(.+)$/m);if(n&&n[1]){var r=n[1],i=w(t);e._remoteCodecMaps.set(r,i)}}),el(e).then(function(){e._handleQueuedPublisherHints()})}function el(e){var t=e._encodingParameters,n=new Map([["audio",t.maxAudioBitrate],["video",t.maxVideoBitrate]]),r=[];return e._peerConnection.getSenders().filter(function(e){return e.track}).forEach(function(t){var i=n.get(t.track.kind),o=t.getParameters();
1null===i||0===i?Array.isArray(o.encodings)&&o.encodings.forEach(function(e){return delete e.maxBitrate}):e._isChromeScreenShareTrack(t.track)?e._log.warn("Not setting maxBitrate for "+t.track.kind+" Track "+t.track.id+" because it appears to be screen share track: "+t.track.label):Z?o.encodings=[{maxBitrate:i}]:o.encodings.forEach(function(e){e.maxBitrate=i}),!Z&&o.encodings.length>0&&("audio"===t.track.kind?o.encodings[0].priority="high":e._isChromeScreenShareTrack(t.track)&&(o.encodings[0].priority="medium"),e._enableDscp&&(o.encodings[0].networkPriority="high"));var a=e._rtpNewSenders.has(t);e._maybeUpdateEncodings(t.track,o.encodings,a),e._rtpNewSenders.delete(t);var s=t.setParameters(o).catch(function(n){e._log.warn("Error while setting encodings parameters for "+t.track.kind+" Track "+t.track.id+": "+(n.message||n.name))});r.push(s)}),Promise.all(r)}e.exports=er},26503:function(e,t,n){"use strict";var r,i,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},s=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},c=n(67476).guessBrowser,u=n(5773),l=n(42259),d=n(23172),p=n(96971),f=n(78144).MediaConnectionError,h="firefox"===c(),v=function(e){function t(t,r,i){var o=e.call(this)||this,a=(i=Object.assign({audioContextFactory:h?n(23585):null,PeerConnectionV2:u},i)).audioContextFactory?i.audioContextFactory.getOrCreate(o):null;return Object.defineProperties(o,{_audioContextFactory:{value:i.audioContextFactory},_closedPeerConnectionIds:{value:new Set},_configuration:{writable:!0,value:null},_configurationDeferred:{writable:!0,value:p.defer()},_connectionState:{value:"new",writable:!0},_dummyAudioTrackSender:{value:a?new l(a.createMediaStreamDestination().stream.getAudioTracks()[0]):null},_encodingParameters:{value:t},_iceConnectionState:{writable:!0,value:"new"},_dataTrackSenders:{writable:!0,value:new Set},_lastConnectionState:{value:"new",writable:!0},_lastIceConnectionState:{writable:!0,value:"new"},_mediaTrackSenders:{writable:!0,value:new Set},_offerOptions:{value:a?{offerToReceiveVideo:!0}:{offerToReceiveAudio:!0,offerToReceiveVideo:!0}},_peerConnections:{value:new Map},_preferredCodecs:{value:r},_sessionTimeout:{value:null,writable:!0},_PeerConnectionV2:{value:i.PeerConnectionV2}}),o}return o(t,e),t.prototype.setEffectiveAdaptiveSimulcast=function(e){this._peerConnections.forEach(function(t){return t.setEffectiveAdaptiveSimulcast(e)}),this._preferredCodecs.video.forEach(function(t){"adaptiveSimulcast"in t&&(t.adaptiveSimulcast=e)})},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iceConnectionState",{get:function(){return this._iceConnectionState},enumerable:!1,configurable:!0}),t.prototype._closeAbsentPeerConnections=function(e){var t=new Set(e.map(function(e){return e.id}));return this._peerConnections.forEach(function(e){t.has(e.id)||e._close()}),this},t.prototype._getConfiguration=function(){return this._configurationDeferred.promise},t.prototype._getOrCreate=function(e,t){var n=this,r=this,i=this._peerConnections.get(e);if(!i){var o=this._PeerConnectionV2,a=Object.assign({dummyAudioMediaStreamTrack:this._dummyAudioTrackSender?this._dummyAudioTrackSender.track:null,offerOptions:this._offerOptions},this._sessionTimeout?{sessionTimeout:this._sessionTimeout}:{},t);try{i=new o(e,this._encodingParameters,this._preferredCodecs,a)}catch(e){throw new f}this._peerConnections.set(i.id,i),i.on("candidates",this.queue.bind(this,"candidates")),i.on("description",this.queue.bind(this,"description")),i.on("trackAdded",this.queue.bind(this,"trackAdded")),i.on("stateChanged",function e(t){"closed"===t&&(i.removeListener("stateChanged",e),r._dataTrackSenders.forEac
1h(function(e){return i.removeDataTrackSender(e)}),r._mediaTrackSenders.forEach(function(e){return i.removeMediaTrackSender(e)}),r._peerConnections.delete(i.id),r._closedPeerConnectionIds.add(i.id),g(r),y(r))}),i.on("connectionStateChanged",function(){return g(n)}),i.on("iceConnectionStateChanged",function(){return y(n)}),this._dataTrackSenders.forEach(i.addDataTrackSender,i),this._mediaTrackSenders.forEach(i.addMediaTrackSender,i),y(this)}return i},t.prototype.close=function(){return this._peerConnections.forEach(function(e){e.close()}),this._dummyAudioTrackSender&&this._dummyAudioTrackSender.stop(),this._audioContextFactory&&this._audioContextFactory.release(this),y(this),this},t.prototype.createAndOffer=function(){var e=this;return this._getConfiguration().then(function(t){var n;do n=p.makeUUID();while(e._peerConnections.has(n));return e._getOrCreate(n,t)}).then(function(e){return e.offer()}).then(function(){return e})},t.prototype.getTrackReceivers=function(){return p.flatMap(this._peerConnections,function(e){return e.getTrackReceivers()})},t.prototype.getStates=function(){var e=[];return this._peerConnections.forEach(function(t){var n=t.getState();n&&e.push(n)}),e},t.prototype.setConfiguration=function(e){return this._configuration&&(this._configurationDeferred=p.defer(),this._peerConnections.forEach(function(t){t.setConfiguration(e)})),this._configuration=e,this._configurationDeferred.resolve(e),this},t.prototype.setIceReconnectTimeout=function(e){return null===this._sessionTimeout&&(this._peerConnections.forEach(function(t){t.setIceReconnectTimeout(e)}),this._sessionTimeout=e),this},t.prototype.setTrackSenders=function(e){var t=new Set(e.filter(function(e){return"data"===e.kind})),n=new Set(e.filter(function(e){return e&&("audio"===e.kind||"video"===e.kind)})),r=function(e,t,n){return{data:{add:p.difference(t,e._dataTrackSenders),remove:p.difference(e._dataTrackSenders,t)},media:{add:p.difference(n,e._mediaTrackSenders),remove:p.difference(e._mediaTrackSenders,n)}}}(this,t,n);return this._dataTrackSenders=t,this._mediaTrackSenders=n,(r.data.add.size||r.data.remove.size||r.media.add.size||r.media.remove.size)&&this._peerConnections.forEach(function(e){r.data.remove.forEach(e.removeDataTrackSender,e),r.media.remove.forEach(e.removeMediaTrackSender,e),r.data.add.forEach(e.addDataTrackSender,e),r.media.add.forEach(e.addMediaTrackSender,e),(r.media.add.size||r.media.remove.size||r.data.add.size&&!e.isApplicationSectionNegotiated)&&e.offer()}),this},t.prototype.update=function(e,t){var n=this;return void 0===t&&(t=!1),t&&this._closeAbsentPeerConnections(e),this._getConfiguration().then(function(t){return Promise.all(e.map(function(e){return n._closedPeerConnectionIds.has(e.id)?null:n._getOrCreate(e.id,t).update(e)}))}).then(function(){return n})},t.prototype.getStats=function(){return Promise.all(Array.from(this._peerConnections.values()).map(function(e){return e.getStats().then(function(t){return[e.id,t]})})).then(function(e){return new Map(e)})},t}(d),m={new:0,checking:1,connecting:2,connected:3,completed:4,disconnected:-1,failed:-2,closed:-3};function _(e){return e.length?(i=i||Object.keys(m).reduce(function(e,t){var n;return Object.assign(e,((n={})[m[t]]=t,n))},{}),e.reduce(function(e,t){return i[Math.max(m[e],m[t])]})):"new"}function y(e){e._lastIceConnectionState=e.iceConnectionState,e._iceConnectionState=_(s([],a(e._peerConnections.values())).map(function(e){return e.iceConnectionState})),e.iceConnectionState!==e._lastIceConnectionState&&e.emit("iceConnectionStateChanged")}function g(e){e._lastConnectionState=e.connectionState,e._connectionState=_(s([],a(e._peerConnections.values())).map(function(e){return e.connectionState})),e.connectionState!==e._lastConnectionState&&e.emit("connectionStateChanged")}e.exports=v},7059:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(61014),a=1,s=function(e){function t(t,n){var r=e.call(this,t,"publisher_hints",n)||this;return r.on("ready",function(e){r._log.debug("publisher_hints transport ready:",e),e.on("message",function(e){(r._log.debug("Incoming: ",e),"publisher_hints"===e.type)?e.publisher&&e.publisher.hints&&e.publisher.id&&r._processPublisherHints(e.publisher.hints,e.publisher.id):r._log.warn("Unknown message type: ",e.type)})}),r}return i(t,e),t.prototype.sendTrackReplaced=function(e){var t=e.trackSid;if(this._transport){var n={type:"client_reset",track:t,id:a++};this._log.debug("Outgoing: ",n),this._transport.publish(n)}},t.prototype.sendHintResponse=function(e){var t=e.id,n=e.hints;if(this._transport){var r={type:"publisher_hints",id:t,hints:n};this._log.debug("Outgoing: ",r),this._transport.publish(r)}}
1,t.prototype._processPublisherHints=function(e,t){try{this.emit("updated",e,t)}catch(e){this._log.error("error processing hints:",e)}},t}(o);e.exports=s},68022:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(){var t=e.call(this)||this;return Object.defineProperties(t,{_revision:{value:1,writable:!0}}),t}return i(t,e),t.prototype.update=function(e){return e.revision<this._revision?this:(this._revision=e.revision,this.enable(e.is_recording))},t}(n(631));e.exports=o},64273:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(18090),a=n(75858),s=function(e){function t(t,n,r,i,o,s){var c=e.call(this,t.sid,t.identity)||this;return Object.defineProperties(c,{_revision:{writable:!0,value:null},_RemoteTrackPublicationV2:{value:(s=Object.assign({RemoteTrackPublicationV2:a},s)).RemoteTrackPublicationV2},_getInitialTrackSwitchOffState:{value:n},updateSubscriberTrackPriority:{value:function(e,t){return r(e,t)}},updateTrackRenderHint:{value:function(e,t){return i(e,t)}},clearTrackHint:{value:function(e){return o(e)}},revision:{enumerable:!0,get:function(){return this._revision}}}),c.update(t)}return i(t,e),t.prototype._getOrCreateTrack=function(e){var t=this._RemoteTrackPublicationV2,n=this.tracks.get(e.sid);if(!n){var r=this._getInitialTrackSwitchOffState(e.sid);n=new t(e,r),this.addTrack(n)}return n},t.prototype.update=function(e){var t=this;if(null!==this.revision&&e.revision<=this.revision)return this;this._revision=e.revision;var n=new Set;switch(e.tracks.forEach(function(e){var r=t._getOrCreateTrack(e);r.update(e),n.add(r)}),this.tracks.forEach(function(e){n.has(e)||t.removeTrack(e)}),e.state){case"disconnected":this.disconnect();break;case"reconnecting":this.reconnecting();break;case"connected":this.connect(this.sid,this.identity)}return this},t}(o);e.exports=s},75858:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){return e.call(this,t.sid,t.name,t.kind,t.enabled,t.priority,n)||this}return i(t,e),t.prototype.update=function(e){return this.enable(e.enabled),this.setPriority(e.priority),this},t}(n(75055));e.exports=o},86714:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(61014),a=n(75317),s=n(96971).isDeepEqual,c=1,u=function(e){function t(t,n){var r=e.call(this,t,"render_hints",n)||this;return Object.defineProperties(r,{_trackSidsToRenderHints:{value:new Map},_responseTimer:{value:new a(function(){r._sendAllHints(),r._responseTimer.setDelay(2*r._responseTimer.delay)},2e3,!1)}}),r.on("ready",function(e){e.on("message",function(e){(r._log.debug("Incoming: ",e),"render_hints"===e.type)?r._processHintResults(e&&e.subscriber&&e.subscriber.hints||[]):r._log.warn("Unknown message type: ",e.type)}),r._sendAllHints()}),r}return i(t,e),t.prototype._sendAllHints=function(){var e=this;
1Array.from(this._trackSidsToRenderHints.keys()).forEach(function(t){var n=e._trackSidsToRenderHints.get(t);n.renderDimensions&&(n.isDimensionDirty=!0),"enabled"in n&&(n.isEnabledDirty=!0)}),this._sendHints()},t.prototype._processHintResults=function(e){var t=this;this._responseTimer.clear(),this._responseTimer.setDelay(2e3),e.forEach(function(e){"OK"!==e.result&&t._log.debug("Server error processing hint:",e)}),this._sendHints()},t.prototype._sendHints=function(){var e=this;if(this._transport&&!this._responseTimer.isSet){var t=[];if(Array.from(this._trackSidsToRenderHints.keys()).forEach(function(n){var r=e._trackSidsToRenderHints.get(n);if(r.isEnabledDirty||r.isDimensionDirty){var i={track:n};r.isEnabledDirty&&(i.enabled=r.enabled,r.isEnabledDirty=!1),r.isDimensionDirty&&(i.render_dimensions=r.renderDimensions,r.isDimensionDirty=!1),t.push(i)}}),t.length>0){var n={type:"render_hints",subscriber:{id:c++,hints:t}};this._log.debug("Outgoing: ",n),this._transport.publish(n),this._responseTimer.start()}}},t.prototype.setTrackHint=function(e,t){var n=this._trackSidsToRenderHints.get(e)||{isEnabledDirty:!1,isDimensionDirty:!1};"enabled"in t&&n.enabled!==t.enabled&&(n.enabled=!!t.enabled,n.isEnabledDirty=!0),t.renderDimensions&&!s(t.renderDimensions,n.renderDimensions)&&(n.renderDimensions=t.renderDimensions,n.isDimensionDirty=!0),this._trackSidsToRenderHints.set(e,n),this._sendHints()},t.prototype.clearTrackHint=function(e){this._trackSidsToRenderHints.delete(e)},t}(o);e.exports=u},14803:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=n(58869),s=n(16202),c=n(80597),u=n(68022),l=n(23178),d=n(64273),p=n(2340),f=n(90799),h=n(88054),v=n(86714),m=n(7059),_=n(96971),y=_.constants.DEFAULT_SESSION_TIMEOUT_SEC,g=_.createBandwidthProfilePayload,b=_.defer,k=_.difference,w=_.filterObject,S=_.flatMap,T=_.oncePerTick,C=n(99576),O=n(78144).createTwil
1ioError,P=function(e){function t(t,n,r,i,o){var l,_,g,b,C,O=this;n.options=Object.assign({session_timeout:y},n.options),o=Object.assign({DominantSpeakerSignaling:a,NetworkQualityMonitor:s,NetworkQualitySignaling:c,RecordingSignaling:u,RemoteParticipantV2:d,TrackPrioritySignaling:f,TrackSwitchOffSignaling:h,bandwidthProfile:null,sessionTimeout:1e3*n.options.session_timeout,statsPublishIntervalMs:1e4},o),t.setBandwidthProfile(o.bandwidthProfile);var P=n.options,E=P.signaling_region,R=P.audio_processors,L=void 0===R?[]:R;t.setSignalingRegion(E),L.includes("krisp")&&L.push("rnnoise"),t.setAudioProcessors(L),i.setIceReconnectTimeout(o.sessionTimeout);var x=function(e){return O._getTrackReceiver(e)},A=(O=e.call(this,t,n.sid,n.name,o)||this)._log;return Object.defineProperties(O,{_disconnectedParticipantRevisions:{value:new Map},_NetworkQualityMonitor:{value:o.NetworkQualityMonitor},_lastBandwidthProfileRevision:{value:t.bandwidthProfileRevision,writable:!0},_mediaStatesWarningsRevision:{value:0,writable:!0},_networkQualityMonitor:{value:null,writable:!0},_networkQualityConfiguration:{value:t.networkQualityConfiguration},_peerConnectionManager:{value:i},_published:{value:new Map},_publishedRevision:{value:0,writable:!0},_RemoteParticipantV2:{value:o.RemoteParticipantV2},_subscribed:{value:new Map},_subscribedRevision:{value:0,writable:!0},_subscriptionFailures:{value:new Map},_dominantSpeakerSignaling:{value:new o.DominantSpeakerSignaling(x,{log:A})},_networkQualitySignaling:{value:new o.NetworkQualitySignaling(x,t.networkQualityConfiguration,{log:A})},_renderHintsSignaling:{value:new v(x,{log:A})},_publisherHintsSignaling:{value:new m(x,{log:A})},_trackPrioritySignaling:{value:new o.TrackPrioritySignaling(x,{log:A})},_trackSwitchOffSignaling:{value:new o.TrackSwitchOffSignaling(x,{log:A})},_pendingSwitchOffStates:{value:new Map},_transport:{value:r},_trackReceiverDeferreds:{value:new Map},mediaRegion:{enumerable:!0,value:n.options.media_region||null}}),O._initTrackSwitchOffSignaling(),O._initDominantSpeakerSignaling(),O._initNetworkQualityMonitorSignaling(),O._initPublisherHintSignaling(),l=O,_=T(function(){l._publishNewLocalParticipantState()}),g=T(function(){var e=S(t.tracks,function(e){return e.trackTransceiver});l._peerConnectionManager.setTrackSenders(e)}),t.on("trackAdded",g),t.on("trackRemoved",g),t.on("updated",_),l.on("stateChanged",function e(n){"disconnected"===n&&(t.removeListener("trackAdded",g),t.removeListener("trackRemoved",g),t.removeListener("updated",_),l.removeListener("stateChanged",e),t.disconnect())}),l.on("signalingConnectionStateChanged",function(){var e=l.localParticipant,t=l.signalingConnectionState,n=e.identity,r=e.sid;switch(t){case"connected":e.connect(r,n);break;case"reconnecting":e.reconnecting()}}),b=O,i.on("description",function(e){b._publishPeerConnectionState(e)}),i.dequeue("description"),i.on("candidates",function(e){b._publishPeerConnectionState(e)}),i.dequeue("candidates"),i.on("trackAdded",b._addTrackReceiver.bind(b)),i.dequeue("trackAdded"),i.getTrackReceivers().forEach(b._addTrackReceiver,b),i.on("connectionStateChanged",function(){b.emit("connectionStateChanged")}),i.on("iceConnectionStateChanged",function(){b.emit("iceConnectionStateChanged"),"failed"===b.iceConnectionState&&(null!==b.localParticipant.networkQualityLevel&&b.localParticipant.setNetworkQualityLevel(0),b.participants.forEac
1h(function(e){null!==e.networkQualityLevel&&e.setNetworkQualityLevel(0)}))}),C=O,r.on("message",C._update.bind(C)),r.on("stateChanged",function e(t,n){"disconnected"===t&&("disconnected"!==C.state&&C._disconnect(n),r.removeListener("stateChanged",e)),C.emit("signalingConnectionStateChanged")}),function(e,t,n){var r=new Map,i=!1,o=setInterval(function(){e.getStats().then(function(e){i=!i,e.forEach(function(e,n){var o=new p(n,e,!0);t.publishEvent("quality","stats-report","info",{audioTrackStats:o.remoteAudioTrackStats.map(function(t,n){return M(t,e.remoteAudioTrackStats[n],r)}),localAudioTrackStats:o.localAudioTrackStats.map(function(t,n){return j(t,e.localAudioTrackStats[n],r)}),localVideoTrackStats:o.localVideoTrackStats.map(function(t,n){return j(t,e.localVideoTrackStats[n],r)}),peerConnectionId:o.peerConnectionId,videoTrackStats:o.remoteVideoTrackStats.map(function(t,n){return M(t,e.remoteVideoTrackStats[n],r)})});var a=S(["localAudioTrackStats","localVideoTrackStats","remoteAudioTrackStats","remoteVideoTrackStats"],function(e){return o[e].map(function(e){var t=e.ssrc;return e.trackSid+"+"+t})});if(k(Array.from(r.keys()),a).forEach(function(e){return r.delete(e)}),i){var s,c=(s=e.activeIceCandidatePair,(s=Object.assign({availableIncomingBitrate:0,availableOutgoingBitrate:0,bytesReceived:0,bytesSent:0,consentRequestsSent:0,currentRoundTripTime:0,lastPacketReceivedTimestamp:0,lastPacketSentTimestamp:0,nominated:!1,peerConnectionId:o.peerConnectionId,priority:0,readable:!1,requestsReceived:0,requestsSent:0,responsesReceived:0,responsesSent:0,retransmissionsReceived:0,retransmissionsSent:0,state:"failed",totalRoundTripTime:0,transportId:"",writable:!1},w(s||{},null))).localCandidate=Object.assign({candidateType:"host",deleted:!1,ip:"",port:0,priority:0,protocol:"udp",url:""},w(s.localCandidate||{},null)),s.remoteCandidate=Object.assign({candidateType:"host",ip:"",port:0,priority:0,protocol:"udp",url:""},w(s.remoteCandidate||{},null)),s);t.publishEvent("quality","active-ice-candidate-pair","info",c)}})},function(){})},n);e.on("stateChanged",function t(n){"disconnected"===n&&(clearInterval(o),e.removeListener("stateChanged",t))})}(O,r,o.statsPublishIntervalMs),O._update(n),O._peerConnectionManager.setEffectiveAdaptiveSimulcast(O._publisherHintsSignaling.isSetup),O}return i(t,e),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._peerConnectionManager.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"signalingConnectionState",{get:function(){return"syncing"===this._transport.state?"reconnecting":this._transport.state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iceConnectionState",{get:function(){return this._peerConnectionManager.iceConnectionState},enumerable:!1,configurable:!0}),t.prototype._deleteTrackReceiverDeferred=function(e){return this._trackReceiverDeferreds.delete(e)},t.prototype._getOrCreateTrackReceiverDeferred=function(e){var t=this._trackReceiverDeferreds.get(e)||b(),n=this._peerConnectionManager.getTrackReceivers().find(function(t){return t.id===e&&"ended"!==t.readyState});return n?t.resolve(n):this._trackReceiverDeferreds.set(e,t),t},t.prototype._addTrackReceiver=function(e){return this._getOrCreateTrackReceiverDeferred(e.id).resolve(e),this},t.prototype._disconnect=function(t){var n=e.prototype._disconnect.call(this,t);return n&&(this._teardownNetworkQualityMonitor(),this._transport.disconnect(),this._peerConnectionManager.close()),this.localParticipant.tracks.forEach(function(e){e.publishFailed(t||Error("LocalParticipant disconnected"))}),n},t.prototype._getTrackReceiver=function(e){var t=this;return this._getOrCreateTrackReceiverDeferred(e).promise.then(function(n){return t._deleteTrackReceiverDeferred(e),n})},t.prototype._getInitialTrackSwitchOffState=function(e){var t=this._pendingSwitchOffStates.get(e)||!1;return this._pendingSwitchOffStates.delete(e),t&&this._log.warn("["+e+"] was initially switched off! "),t},t.prototype._getTrackSidsToTrackSignalings=function(){return new Map(S(this.participants,function(e){return Array.from(e.tracks)}))},t.prototype._getOrCreateRemoteParticipant=function(e){var t=this,n=this._RemoteParticipantV2,r=this.participants.get(e.sid),i=this;return r||((r=new n(e,function(e){return t._getInitialTrackSwitchOffState(e)},function(e,n){return t._trackPrioritySignaling.sendTrackPriorityUpdate(e,"subscribe",n)},function(e,n){return t._renderHintsSignaling.setTrackHint(e,n)},function(e){return t._renderHintsSignaling.clearTrackHint(e)})).on("stateChanged",function e(t){"disconnected"===t&&(r.removeListener("stateChanged",e),i.participants.delete(r.sid),i._disconnectedParticipantRevisions.set(r.sid,r.revision))}),this.connectParticipant(r)),r},t.prototype._getState=function(){return{participant:this.localParticipant.getState()}},t.prototype._maybeAddBandwidthProfile=function(e){var t=this.localParticipant,n=t.bandwidthProfile,r=t.bandwidthProfileRevision;return n&&this._lastBandwidthProfileRevision<r?(this._lastBandwidthProfileRevision=r,Object.assign({bandwidth_profile:g(n)},e)):e}
1,t.prototype._publishNewLocalParticipantState=function(){this._transport.publish(this._maybeAddBandwidthProfile(this._getState()))},t.prototype._publishPeerConnectionState=function(e){this._transport.publish(Object.assign({peer_connections:[e]},this._getState()))},t.prototype._update=function(e){var t,n,r=this;if(e.subscribed&&e.subscribed.revision>this._subscribedRevision){this._subscribedRevision=e.subscribed.revision,e.subscribed.tracks.forEach(function(e){e.id?(r._subscriptionFailures.delete(e.sid),r._subscribed.set(e.sid,e.id)):e.error&&!r._subscriptionFailures.has(e.sid)&&r._subscriptionFailures.set(e.sid,e.error)});var i=new Set(e.subscribed.tracks.filter(function(e){return!!e.id}).map(function(e){return e.sid}));this._subscribed.forEach(function(e,t){i.has(t)||r._subscribed.delete(t)})}var o=new Set;return(e.participants||[]).forEach(function(e){if(e.sid!==r.localParticipant.sid){var t=r._disconnectedParticipantRevisions.get(e.sid);if(!t||!(e.revision<=t)){t&&r._disconnectedParticipantRevisions.delete(e.sid);var n=r._getOrCreateRemoteParticipant(e);n.update(e),o.add(n)}}}
1),"synced"===e.type&&this.participants.forEach(function(e){o.has(e)||e.disconnect()}),t=this,n=t._getTrackSidsToTrackSignalings(),t._subscriptionFailures.forEach(function(e,r){var i=n.get(r);i&&(t._subscriptionFailures.delete(r),i.subscribeFailed(O(e.code,e.message)))}),n.forEach(function(e){var n=t._subscribed.get(e.sid);(!n||e.isSubscribed&&e.trackTransceiver.id!==n)&&e.setTrackTransceiver(null),n&&t._getTrackReceiver(n).then(function(t){return e.setTrackTransceiver(t)})}),e.peer_connections&&this._peerConnectionManager.update(e.peer_connections,"synced"===e.type),e.recording&&this.recording.update(e.recording),e.published&&e.published.revision>this._publishedRevision&&(this._publishedRevision=e.published.revision,e.published.tracks.forEach(function(e){e.sid&&r._published.set(e.id,e.sid)}),this.localParticipant.update(e.published)),e.participant&&this.localParticipant.connect(e.participant.sid,e.participant.identity),[this._dominantSpeakerSignaling,this._networkQualitySignaling,this._trackPrioritySignaling,this._trackSwitchOffSignaling,this._renderHintsSignaling,this._publisherHintsSignaling].forEach(function(t){var n=t.channel;!t.isSetup&&e.media_signaling&&e.media_signaling[n]&&e.media_signaling[n].transport&&"data-channel"===e.media_signaling[n].transport.type&&t.setup(e.media_signaling[n].transport.label)}
1),"warning"===e.type&&e.states&&e.states.revision>this._mediaStatesWarningsRevision&&(this._mediaStatesWarningsRevision=e.states.revision,this.localParticipant.updateMediaStates(e.states)),this},t.prototype._initPublisherHintSignaling=function(){var e=this;this._publisherHintsSignaling.on("updated",function(t,n){Promise.all(t.map(function(t){return e.localParticipant.setPublisherHint(t.track,t.encodings).then(function(e){return{track:t.track,result:e}})})).then(function(t){e._publisherHintsSignaling.sendHintResponse({id:n,hints:t})})});var t=function(t){"video"===t.kind&&t.trackTransceiver.on("replaced",function(){e._publisherHintsSignaling.sendTrackReplaced({trackSid:t.sid})})};Array.from(this.localParticipant.tracks.values()).forEach(function(e){return t(e)}),this.localParticipant.on("trackAdded",function(e){return t(e)})},t.prototype._initTrackSwitchOffSignaling=function(){var e=this;this._trackSwitchOffSignaling.on("updated",function(t,n){try{e._log.debug("received trackSwitch: ",{tracksOn:n,tracksOff:t});var r=new Map;n.forEach(function(e){return r.set(e,!0)}),t.forEach(function(t){r.get(t)&&e._log.warn(t+" is DUPLICATED in both tracksOff and tracksOn list"),r.set(t,!1)}
1),e.participants.forEach(function(e){e.tracks.forEach(function(e){var t=r.get(e.sid);void 0!==t&&(e.setSwitchedOff(!t),r.delete(e.sid))})}),r.forEach(function(t,n){return e._pendingSwitchOffStates.set(n,!t)})}catch(t){e._log.error("error processing track switch off:",t)}})},t.prototype._initDominantSpeakerSignaling=function(){var e=this;this._dominantSpeakerSignaling.on("updated",function(){return e.setDominantSpeaker(e._dominantSpeakerSignaling.loudestParticipantSid)})},t.prototype._initNetworkQualityMonitorSignaling=function(){var e=this;this._networkQualitySignaling.on("ready",function(){var t=new e._NetworkQualityMonitor(e._peerConnectionManager,e._networkQualitySignaling);e._networkQualityMonitor=t,t.on("updated",function(){"failed"!==e.iceConnectionState&&(e.localParticipant.setNetworkQualityLevel(t.level,t.levels),e.participants.forEach(function(e){var n=t.remoteLevels.get(e.sid);n&&e.setNetworkQualityLevel(n.level,n)}))}),t.start()}),this._networkQualitySignaling.on("teardown",function(){return e._teardownNetworkQualityMonitor()})},t.prototype._teardownNetworkQualityMonitor=function(){this._networkQualityMonitor&&(this._networkQualityMonitor.stop(),this._networkQualityMonitor=null)},t.prototype.getStats=function(){var e=this;return this._peerConnectionManager.getStats().then(function(t){return new Map(Array.from(t).map(function(t){var n=o(t,2),r=n[0],i=n[1];return[r,Object.assign({},i,{localAudioTrackStats:R(e,i.localAudioTrackStats),localVideoTrackStats:R(e,i.localVideoTrackStats),remoteAudioTrackStats:L(e,i.remoteAudioTrackStats),remoteVideoTrackStats:L(e,i.remoteVideoTrackStats)})]}))})},t}(l);function E(e,t){return t.reduce(function(t,n){var r=e.get(n.trackId);return r?[Object.assign({},n,{trackSid:r})].concat(t):t},[])}function R(e,t){return E(e._published,t)}function L(e,t){return E(new Map(Array.from(e._subscribed.entries()).map(function(e){var t=o(e,2),n=t[0];return[t[1],n]})),t)}function j(e,t,n){var r=t.framesEncoded,i=t.packetsSent,o=t.totalEncodeTime,a=t.totalPacketSendDelay,s=Object.assign({},e),c=e.trackSid+"+"+e.ssrc,u=n.get(c)||new Map;if("number"==typeof o&&"number"==typeof r){var l=u.get("avgEncodeDelay")||new C;l.putSample(1e3*o,r),s.avgEncodeDelay=Math.round(l.get()),u.set("avgEncodeDelay",l)}if("number"==typeof a&&"number"==typeof i){var d=u.get("avgPacketSendDelay")||new C;d.putSample(1e3*a,i),s.avgPacketSendDelay=Math.round(d.get()),u.set("avgPacketSendDelay",d)}return n.set(c,u),s}function M(e,t,n){var r=t.estimatedPlayoutTimestamp,i=t.framesDecoded,o=t.jitterBufferDelay,a=t.jitterBufferEmittedCount,s=t.totalDecodeTime,c=Object.assign({},e),u=e.trackSid+"+"+e.ssrc,l=n.get(u)||new Map;if("number"==typeof r&&(c.estimatedPlayoutTimestamp=r),"number"==typeof i&&"number"==typeof s){var d=l.get("avgDecodeDelay")||new C;d.putSample(1e3*s,i),c.avgDecodeDelay=Math.round(d.get()),l.set("avgDecodeDelay",d)}if("number"==typeof o&&"number"==typeof a){var p=l.get("avgJitterBufferDelay")||new C;p.putSample(1e3*o,a),c.avgJitterBufferDelay=Math.round(p.get()),l.set("avgJitterBufferDelay",p)}return n.set(u,l),c}e.exports=P},90799:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,"track_priority",n)||this;return Object.defineProperties(r,{_enqueuedPriorityUpdates:{value:new Map}}),r.on("ready",function(e){Array.from(r._enqueuedPriorityUpdates.keys()).forEach(function(t){e.publish({type:"track_priority",track:t,subscribe:r._enqueuedPriorityUpdates.get(t)})})}),r}return i(t,e),t.prototype.sendTrackPriorityUpdate=function(e,t,n){if("subscribe"!==t)throw Error("only subscribe priorities are supported, found: "+t);this._enqueuedPriorityUpdates.set(e,n),this._transport&&this._transport.publish({type:"track_priority",track:e,subscribe:n})},t}(n(61014));e.exports=o},88054:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,"track_switch_off",n)||this;return r.on("ready",function(e){e.on("message",function(e){"track_switch_off"===e.type&&r._setTrackSwitchOffUpdates(e.off||[],e.on||[])})}),r}return i(t,e),t.prototype._setTrackSwitchOffUpdates=function(e,t){this.emit("updated",e,t)},t}(n(61014));e.exports=o},61722:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(13122),a=n(44670),s=n(51822),c=n(62097).reconnectBackoffConfig,u=n(75317),l=n(62097),d=l.SDK_NAME,p=l.SDK_VERSION,f=l.SDP_FORMAT,h=n(96971),v=h.createBandwidthProfilePayload,m=h.createMediaSignalingPayload,_=h.createMediaWarningsPayload,y=h.createSubscribePayload,g=h.getUserAgent,b=h.isNonArrayObject,k=n(78144),w=k.createTwil
1ioError,S=k.RoomCompletedError,T=k.SignalingConnectionError,C=k.SignalingServerBusyError,O={connecting:["connected","disconnected"],connected:["disconnected","syncing"],syncing:["connected","disconnected"],disconnected:[]},P=function(e){function t(t,n,r,i,o,u){var l=this;return u=Object.assign({Backoff:s,TwilioConnection:a,iceServers:null,trackPriority:!0,trackSwitchOff:!0,renderHints:!0,userAgent:g()},u),Object.defineProperties(l=e.call(this,"connecting",O)||this,{_accessToken:{value:n},_automaticSubscription:{value:u.automaticSubscription},_bandwidthProfile:{value:u.bandwidthProfile},_dominantSpeaker:{value:u.dominantSpeaker},_adaptiveSimulcast:{value:u.adaptiveSimulcast},_eventObserver:{value:u.eventObserver,writable:!1},_renderHints:{value:u.renderHints},_iceServersStatus:{value:Array.isArray(u.iceServers)?"overrode":"acquire"},_localParticipant:{value:r},_name:{value:t},_networkQuality:{value:b(u.networkQuality)||u.networkQuality},_notifyWarnings:{value:u.notifyWarnings},_options:{value:u},_peerConnectionManager:{value:i},_sessionTimer:{value:null,writable:!0},_sessionTimeoutMS:{value:0,writable:!0},_reconnectBackoff:{value:new u.Backoff(c)},_session:{value:null,writable:!0},_trackPriority:{value:u.trackPriority},_trackSwitchOff:{value:u.trackSwitchOff},_twilioConnection:{value:null,writable:!0},_updatesReceived:{value:[]},_updatesToSend:{value:[]},_userAgent:{value:u.userAgent},_wsServer:{value:o}}),function(e){function t(){if("disconnected"!==e.state){e._twilioConnection&&e._twilioConnection.removeListener("message",r);var t=e._iceServersStatus,i=e._options,o=e._wsServer,a=e.state,s=i.TwilioConnection,c=new s(o,Ob
1ject.assign({helloBody:"connecting"===a&&"acquire"===t?e._createIceMessage():e._createConnectOrSyncOrDisconnectMessage()},i));c.once("close",function(e){e===s.CloseReason.LOCAL?n():n(Error(e))}),c.on("message",r),e._twilioConnection=c}}function n(n){if("disconnected"!==e.state){if(!n){e.disconnect();return}var r=e._getReconnectTimer();if(!r){var i=n.message===a.CloseReason.BUSY?new C:new T;e.disconnect(i);return}"connected"===e.state&&e.preempt("syncing"),r.then(t)}}function r(t){if("disconnected"!==e.state){if("error"===t.type){e.disconnect(w(t.code,t.message));return}switch(e.state){case"connected":switch(t.type){case"connected":case"synced":case"update":case"warning":e.emit("message",t);return;case"disconnected":e.disconnect("completed"===t.status?new S:null);return;default:return}case"connecting":switch(t.type){case"iced":e._options.onIced(t.ice_servers).then(function(){e._sendConnectOrSyncOrDisconnectMessage()});return;case"connected":e._setSession(t.session,t.options.session_timeout),e.emit("connected",t),e.preempt("connected");return;case"synced":case"update":e._updatesReceived.push(t);return;case"disconnected":e.disconnect("completed"===t.status?new S:null);return;default:return}case"syncing":switch(t.type){case"connected":case"update":e._updatesReceived.push(t);return;case"synced":e._clearReconnectTimer(),e.emit("message",t),e.preempt("connected");return;case"disconnected":e.disconnect("completed"===t.status?new S:null);return;default:return}default:return}}}e.on("stateChanged",function t(n){switch(n){case"connected":var i=e._updatesToSend.splice(0);i.length&&e.publish(i.reduce(function(e,t){return!e.participant&&t.participant?e.participant=t.participant:e.participant&&t.participant&&t.participant.revision>e.participant.revision&&(e.participant=t.participant),!e.peer_connections&&t.peer_connections?e.peer_connections=E(t.peer_connections):e.peer_connections&&t.peer_connections&&(e.peer_connections=E(e.peer_connections.concat(t.peer_connections))),e},{})),e._updatesReceived.splice(0).forEach(function(t){return e.emit("message",t)});return;case"disconnected":e._twilioConnection.removeListener("message",r),e.removeListener("stateChanged",t);return;default:return}});var i=e._options,o=e._iceServersStatus,s=i.iceServers,c=i.onIced;"overrode"===o?c(s).then(t):t()}(l),l}return i(t,e),t.prototype._createConnectOrSyncOrDisconnectMessage=function(){if("connected"===this.state)return null;if("disconnected"===this.state)return{session:this._session,type:"disconnect",version:2};var e={connecting:"connect",syncing:"sync"}[this.state],t={name:this._name,participant:this._localParticipant.getState(),peer_connections:this._peerConnectionManager.getStates(),type:e,version:2};return"connect"===t.type?(t.ice_servers=this._iceServersStatus,t.publisher={name:d,sdk_version:p,user_agent:this._userAgent},this._bandwidthProfile&&(t.bandwidth_profile=v(this._bandwidthProfile)),this._notifyWarnings&&(t.participant.media_warnings=_(this._notifyWarnings)),t.media_signaling=m(this._dominantSpeaker,this._networkQuality,this._trackPriority,this._trackSwitchOff,this._adaptiveSimulcast,this._renderHints),t.subscribe=y(this._automaticSubscription),t.format=f,t.token=this._accessToken):"sync"===t.type?(t.session=this._session,t.token=this._accessToken):"update"===t.type&&(t.session=this._session),t},t.prototype._createIceMessage=function(){return{edge:"roaming",token:this._accessToken,type:"ice",version:1}},t.prototype._sendConnectOrSyncOrDisconnectMessage=function(){var e=this._createConnectOrSyncOrDisconnectMessage();e&&this._twilioConnection.sendMessage(e)},t.prototype.disconnect=function(e){return"disconnected"!==this.state&&(this.preempt("disconnected",null,[e]),this._sendConnectOrSyncOrDisconnectMessage(),this._twilioConnection.close(),!0)},t.prototype.publish=function(e){switch(this.state){case"connected":return this._twilioConnection.sendMessage(Object.assign({session:this._session,type:"update",version:2},e)),!0;case"connecting":case"syncing":return this._updatesToSend.push(e),!0;default:return!1}},t.prototype.publishEvent=function(e,t,n,r){this._eventObserver.emit("event",{group:e,name:t,level:n,payload:r})},t.prototype.sync=function(){return"connected"===this.state&&(this.preempt("syncing"),this._sendConnectOrSyncOrDisconnectMessage(),!0)},t.prototype._setSession=function(e,t){this._session=e,this._sessionTimeoutMS=1e3*t},t.prototype._getReconnectTimer=function(){var e=this;return 0===this._sessionTimeoutMS?null:(this._sessionTimer||(this._sessionTimer=new u(function(){e._sessionTimer&&(e._sessionTimeoutMS=0)},this._sessionTimeoutMS)),new Promise(function(t){e._reconnectBackoff.backoff(t)}))},t.prototype._clearReconnectTimer=function(){this._reconnectBackoff.reset(),this._sessionTimer&&(this._sessionTimer.clear(),this._sessionTimer=null)},t}(o);function E(e){return Array.from(e.reduce(function(e,t){var n=e.get(t.id)||t;return!n.description&&t.description?n.description=t.description:n.description&&t.description&&t.description.revision>n.description.revision&&(n.description=t.description),!n.ice&&t.ice?n.ice=t.ice:n.ice&&t.ice&&t.ice.revision>n.ice.revision&&(n.ice=t.ice),e.set(n.id,n),e},new Map).values())}
1e.exports=P},13122:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(17187).EventEmitter,c=n(96971),u=function(e){function t(t,n){var r,i=e.call(this)||this,o=null,a=t;return Object.defineProperties(i,{_lock:{get:function(){return o},set:function(e){o=e}},_reachableStates:{value:Array.from((r=n=function(e){var t=new Map;for(var n in e)t.set(n,new Set(e[n]));return t}(n)).keys()).reduce(function(e,t){return e.set(t,function e(t,n,r){return r=r||new Set,t.get(n).forEach(function(n){r.has(n)||(r.add(n),e(t,n,r).forEach(r.add,r))}),r}(r,t))},new Map)},_state:{get:function(){return a}
1,set:function(e){a=e}},_states:{value:n},_whenDeferreds:{value:new Set},isLocked:{enumerable:!0,get:function(){return null!==o}},state:{enumerable:!0,get:function(){return a}}}),i.on("stateChanged",function(e){i._whenDeferreds.forEach(function(t){t.when(e,t.resolve,t.reject)})}),i}return i(t,e),t.prototype._whenPromise=function(e){var t=this;if("function"!=typeof e)return Promise.reject(Error("when() executor must be a function"));var n=c.defer();return n.when=e,this._whenDeferreds.add(n),n.promise.then(function(e){return t._whenDeferreds.delete(n),e},function(e){throw t._whenDeferreds.delete(n),e})},t.prototype.bracket=function(e,t){var n,r=this;function i(e){if(r.hasLock(n)&&r.releaseLockCompletely(n),e)throw e}return this.takeLock(e).then(function(e){return t(n=e)}).then(function(e){return i(),e},i)},t.prototype.hasLock=function(e){return this._lock===e},t.prototype.preempt=function(e,t,n){if(!l(this._states,this.state,e))throw Error('Cannot transition from "'+this.state+'" to "'+e+'"');this.isLocked&&(r=this._lock,this._lock=null);var r,i=null;t&&(i=this.takeLockSync(t));var o=i?null:this.takeLockSync("preemption");return this.transition(e,i||o,n),r&&r.resolve(),o&&this.releaseLock(o),i},t.prototype.releaseLock=function(e){if(this.isLocked){if(!this.hasLock(e))throw Error("Could not release the lock for "+e.name+" because "+this._lock.name+" has the lock")}else throw Error("Could not release the lock for "+e.name+" because the StateMachine is not locked");0===e.depth?(this._lock=null,e.resolve()):e.depth--},t.prototype.releaseLockCompletely=function(e){if(this.isLocked){if(!this.hasLock(e))throw Error("Could not release the lock for "+e.name+" because "+this._lock.name+" has the lock")}else throw Error("Could not release the lock for "+e.name+" because the StateMachine is not locked");e.depth=0,this._lock=null,e.resolve()},t.prototype.takeLock=function(e){var t=this;if("object"==typeof e)return new Promise(function(n){n(t.takeLockSync(e))});if(this.isLocked){var n=this.takeLock.bind(this,e);return this._lock.promise.then(n)}return Promise.resolve(this.takeLockSync(e))},t.prototype.takeLockSync=function(e){var t,n="string"==typeof e?null:e,r=n?n.name:e;if(n&&!this.hasLock(n)||!n&&this.isLocked)throw Error("Could not take the lock for "+r+" because the lock for "+this._lock.name+" was not released");if(n)return n.depth++,n;var i=((t=c.defer()).name=r,t.depth=0,t);return this._lock=i,i},t.prototype.transition=function(e,t,n){if(n=n||[],this.isLocked){if(t){if(!this.hasLock(t))throw Error("Could not transition using the key for "+t.name+" because "+this._lock.name+" has the lock")}else throw Error("You must provide the key in order to transition")}else if(t)throw Error("Key provided for "+t.name+", but the StateMachine was not locked (possibly due to preemption)");if(!l(this._states,this.state,e))throw Error('Cannot transition from "'+this.state+'" to "'+e+'"');this._state=e,this.emit.apply(this,a([],o(["stateChanged",e].concat(n))))},t.prototype.tryTransition=function(e,t,n){try{this.transition(e,t,n)}catch(e){return!1}return!0},t.prototype.when=function(e){var t=this;return this.state===e?Promise.resolve(this):l(this._reachableStates,this.state,e)?this._whenPromise(function(n,r,i){n===e?r(t):l(t._reachableStates,n,e)||i(d(n,e))}):Promise.reject(d(this.state,e))},t}(s);function l(e,t,n){return e.get(t).has(n)}function d(e,t){return Error('"'+t+'" cannot be reached from "'+e+'"')}e.exports=u},39462:function(e){"use strict";e.exports=function(e){return(e=e.filter(function(e){return"number"==typeof e})).length<1?void 0:e.reduce(function(e,t){return t+e})/e.length}},56054:function(e){"use strict";var t=function(){function e(e,t,n,r){Object.defineProperties(this,{availableSend:{enumerable:!0,value:n},recv:{enumerable:!0,value:t},rtt:{enumerable:!0,value:r},send:{enumerable:!0,value:e}})}return e.of=function(t,n){var r=(n.timestamp-t.timestamp)/1e3,i=n.bytesSent-t.bytesSent,o=n.bytesReceived-t.bytesReceived;return new e(r>0?i/r*8:0,r>0?o/r*8:0,n.availableOutgoingBitrate,n.currentRoundTripTime)},e}();e.exports=t},81409:function(e,t,n){"use strict";var r=n(56054),i=function(){function e(){Object.defineProperties(this,{lastReport:{enumerable:!0,value:new r(0,0),writable:!0},lastStats:{enumerable:!0,value:null,writable:!0}})}return e.prototype.next=function(e){var t=this.lastStats;if(this.lastStats=e,t){var n=t.id===e.id?r.of(t,e):new r(0,0);this.lastReport=n}return this.lastReport},e}();e.exports=i},40741:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return Object.defineProperties(i,{audioLevel:{value:"number"==typeof n.audioInputLevel?n.audioInputLevel:null,enumerable:!0},jitter:{value:"number"==typeof n.jitter?n.jitter:null,enumerable:!0}}),i}return i(t,e),t}(n(36643));e.exports=o},36643:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return Object.defineProperties(i,{bytesSent:{value:"number"==typeof n.bytesSent?n.bytesSent:r?0:null,enumerable:!0},packetsSent:{value:"number"==typeof n.packetsSent?n.packetsSent:r?0:null,enumerable:!0},roundTripTime:{value:"number"==typeof n.roundTripTime?n.roundTripTime:r?0:null,enumerable:!0}}),i}return i(t,e),t}(n(4941));e.exports=o},16872:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this,o=null;"number"==typeof n.frameWidthInput&&"number"==typeof n.frameHeightInput&&Object.defineProperties(o={},{width:{value:n.frameWidthInput,enumerable:!0},height:{value:n.frameHeightInput,enumerable:!0}});var a=null;return"number"==typeof n.frameWidthSent&&"number"==typeof n.frameHeightSent&&Object.defineProperties(a={},{width:{value:n.frameWidthSent,enumerable:!0},height:{value:n.frameHeightSent,enumerable:!0}}),Object.defineProperties(i,{captureDimensions:{value:o,enumerable:!0},dimensions:{value:a,enumerable:!0},captureFrameRate:{value:"number"==typeof n.frameRateInput?n.frameRateInput:null,enumerable:!0},frameRate:{value:"number"==typeof n.frameRateSent?n.frameRateSent:null,enumerable:!0}}),i}return i(t,e),t}(n(36643));e.exports=o},89521:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t}(n(18310));e.exports=o},6095:function(e){"use strict";e.exports=function(e){var t=e.actual,n=e.available,r=e.level;Object.defineProperties(this,{actual:{value:void 0===t?null:t,enumerable:!0},available:{value:void 0===n?null:n,enumerable:!0},level:{value:void 0===r?null:r,enumerable:!0}})}},19249:function(e){"use strict";e.exports=function(e){var t=e.fractionLost,n=e.level;Object.defineProperties(this,{fractionLost:{value:void 0===t?null:t,enumerable:!0},level:{value:void 0===n?null:n,enumerable:!0}})}},57689:function(e){"use strict";e.exports=function(e){var t=e.jitter,n=e.rtt,r=e.level;Object.defineProperties(this,{jitter:{value:void 0===t?null:t,enumerable:!0},rtt:{value:void 0===n?null:n,enumerable:!0},level:{value:void 0===r?null:r,enumerable:!0}})}},18310:function(e,t,n){"use strict";var r=n(62870),i=n(35047);e.exports=function(e){var t=e.send,n=e.recv,o=e.sendStats,a=void 0===o?null:o,s=e.recvStats,c=void 0===s?null:s;Object.defineProperties(this,{send:{value:t,enumerable:!0},recv:{value:n,enumerable:!0},sendStats:{value:a?new r(a):null,enumerable:!0},recvStats:{value:c?new i(c):null,enumerable:!0}})}},35047:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t}(n(69302));e.exports=o},69302:function(e,t,n){"use strict";var r=n(6095),i=n(19249),o=n(57689);e.exports=function(e){var t=e.bandwidth,n=void 0===t?null:t,a=e.fractionLost,s=void 0===a?null:a,c=e.latency,u=void 0===c?null:c;Object.defineProperties(this,{bandwidth:{value:n?new r(n):null,enumerable:!0},fractionLost:{value:s?new i(s):null,enumerable:!0},latency:{value:u?new o(u):null,enumerable:!0}})}},62870:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t}(n(69302));e.exports=o},7837:function(e,t,n){"use strict";var r=n(89521),i=n(62893);e.exports=function(e){var t=e.level,n=e.audio,o=e.video;Object.defineProperties(this,{level:{value:t,enumerable:!0},audio:{value:n?new r(n):null,enumerable:!0},video:{value:o?new i(o):null,enumerable:!0}})}},62893:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t){return e.call(this,t)||this}return i(t,e),t}(n(18310));e.exports=o},87559:function(e,t,n){"use strict";var r=n(334),i=n(11414),o=function(){function e(e,t,n){Object.defineProperties(this,{ice:{enumerable:!0,value:e},audio:{enumerable:!0,value:t},video:{enumerable:!0,value:n}})}return e.prototype.summarize=function(){var e=this.audio.send.concat(this.video.send),t=i.summarize(e),n=this.audio.recv.concat(this.video.recv),o=r.summarize(n);return{ice:this.ice,send:t,recv:o,audio:{send:i.summarize(this.audio.send),recv:r.summarize(this.audio.recv)},video:{send:i.summarize(this.video.send),recv:r.summarize(this.video.recv)}}},e}();e.exports=o},97396:function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=n(67476).guessBrowser,s=n(81409),c=n(87559),u=n(88454),l=n(59164),d=function(){function e(e){Object.defineProperties(this,{pc:{enumerable:!0,value:e},ice:{enumerable:!0,value:new s},audio:{enumerable:!0,value:{send:new Map,recv:new Map}},video:{enumerable:!0,value:{send:new Map,recv:new Map}},lastReport:{enumerable:!0,value:null,writable:!0}})}return e.prototype.next=function(){var e,t,n,o,s=this;return("firefox"===a()?(e=this,t=e.pc.getTransceivers().filter(function(e){return e.currentDirection&&e.currentDirection.match(/send/)&&e.sender.track}).map(function(e){return e.sender}),n=e.pc.getTransceivers().filter(function(e){return e.currentDirection&&e.currentDirection.match(/recv/)}).map(function(e){return e.receiver}),Promise.all([p(t),p(n),e.pc.getStats()]).then(function(t){var n=r(t,3),i=n[0],o=n[1],a=n[2],s=h(e),c=m(e);
1i.forEach(function(t,n){return y(e,t,c,n)}),b(s,c);var u=v(e),l=_(e);o.forEach(function(t,n){return g(e,t,l,n)}),b(u,l),k(e.ice,a)})):(o=this,o.pc.getStats().then(function(e){var t=h(o),n=m(o);y(o,e,n),b(t,n);var r=v(o),i=_(o);g(o,e,i),b(r,i),k(o.ice,e)}))).then(function(){var e=i([],r(s.audio.send.values())),t=i([],r(s.video.send.values())),n=i([],r(s.audio.recv.values())),o=i([],r(s.video.recv.values())),a=new c(s.ice.lastReport,{send:e.map(function(e){return e.lastReport}).filter(function(e){return e}),recv:n.map(function(e){return e.lastReport}).filter(function(e){return e})},{send:t.map(function(e){return e.lastReport}).filter(function(e){return e}),recv:o.map(function(e){return e.lastReport}).filter(function(e){return e})});return s.lastReport=a,a})},e}();function p(e){return Promise.all(e.map(function(e){var t=e.track.id;return e.getStats().then(function(e){var n,r;try{for(var i=o(e.values()),a=i.next();!a.done;a=i.next()){var s=a.value;"inbound-rtp"===s.type&&(s.id=t+"-"+s.id)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return[t,e]})})).then(function(e){return new Map(e)})}function f(e,t,n,r,i){var o=t[r.mediaType];if(!i){var a=n.get(r.trackId);a&&(i=a.trackIdentifier)}if(o&&i){if(o.has(r.id))return o.get(r.id);var s=new e(i,r);o.set(r.id,s)}return null}function h(e){return{audio:e.audio.send,video:e.video.send}}function v(e){return{audio:e.audio.recv,video:e.video.recv}}function m(e){return{audio:new Set(e.audio.send.keys()),video:new Set(e.video.send.keys())}}function _(e){return{audio:new Set(e.audio.recv.keys()),video:new Set(e.video.recv.keys())}}function y(e,t,n,r){var i,s;try{for(var c=o(t.values()),u=c.next();!u.done;u=c.next()){var d=u.value;if("outbound-rtp"===d.type&&!d.isRemote){if("firefox"!==a()&&!d.trackId)continue;var p=n[d.mediaType];p&&p.delete(d.id);var v=f(l,h(e),t,d,r);if(v){var m=t.get(d.remoteId);v.next(r||v.trackId,d,m)}}}}catch(e){i={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}}function g(e,t,n,r){var i,a;try{for(var s=o(t.values()),c=s.next();!c.done;c=s.next()){var l=c.value;if("inbound-rtp"===l.type&&!l.isRemote){var d=n[l.mediaType];d&&d.delete(l.id);var p=f(u,v(e),t,l,r);p&&p.next(r||p.trackId,l)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}}function b(e,t){for(var n in t)!function(n){var r=e[n];t[n].forEach(function(e){return r.delete(e)})}(n)}function k(e,t){try{for(var n,r,i,a,s,c=o(t.values()),u=c.next();!u.done;u=c.next()){var l=u.value;"transport"===l.type&&(s=t.get(l.selectedCandidatePairId))}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}if(s){e.next(s);return}try{for(var d=o(t.values()),p=d.next();!p.done;p=d.next()){var l=p.value;"candidate-pair"!==l.type||!l.nominated||"selected"in l&&!l.selected||e.next(l)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}}e.exports=d},334:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(39462),a=n(18044),s=n(95811),c=function(e){function t(t,n,r,i,o,a,s){var c=e.call(this,t,n,r)||this;return Object.defineProperties(c,{deltaPacketsLost:{enumerable:!0,value:i},deltaPacketsReceived:{enumerable:!0,value:o},fractionLost:{enumerable:!0,value:a},jitter:{enumerable:!0,value:s},phonyFractionLost:{enumerable:!0,value:o>0?i/o:0}}),c}return i(t,e),t.of=function(e,n,r){if(n.id!==r.id)throw Error("RTCStats IDs must match");var i=(r.timestamp-n.timestamp)/1e3,o=r.bytesReceived-n.bytesReceived,a=Math.max(r.packetsLost-n.packetsLost,0),s=r.packetsReceived-n.packetsReceived,c=r.fractionLost,u=r.jitter;return new t(n.id,e,i>0?o/i*8:0,a,s,c,u)},t.summarize=function(e){var t=e.map(function(e){return e.summarize()});return{bitrate:s(t.map(function(e){return e.bitrate})),fractionLost:o(t.map(function(e){return e.fractionLost})),jitter:o(t.map(function(e){return e.jitter}))}},t.prototype.summarize=function(){return{bitrate:this.bitrate,fractionLost:"number"==typeof this.fractionLost?this.fractionLost:this.phonyFractionLost,jitter:this.jitter}},t}(a);e.exports=c},88454:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(334),a=function(e){function t(t,n){var r=e.call(this,n.id,t,n)||this;return Object.defineProperties(r,{lastReport:{enumerable:!0,value:null,writable:!0}}),r}return i(t,e),t.prototype.next=function(e,t){var n=this.lastStats;this.lastStats=t,this.trackId=e;var r=o.of(e,n,t);return this.lastReport=r,r},t}(n(86035));e.exports=a},18633:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,n)||this;return Object.defineProperties(r,{audioLevel:{value:"number"==typeof n.audioOutputLevel?n.audioOutputLevel:null,enumerable:!0},jitter:{value:"number"==typeof n.jitter?n.jitter:null,enumerable:!0}}),r}return i(t,e),t}(n(34861));e.exports=o},34861:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,n)||this;return Object.defineProperties(r,{bytesReceived:{value:"number"==typeof n.bytesReceived?n.bytesReceived:null,enumerable:!0},packetsReceived:{value:"number"==typeof n.packetsReceived?n.packetsReceived:null,enumerable:!0}}),r}return i(t,e),t}(n(4941));e.exports=o},31675:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this,t,n)||this,i=null;return"number"==typeof n.frameWidthReceived&&"number"==typeof n.frameHeightReceived&&Object.defineProperties(i={},{width:{value:n.frameWidthReceived,enumerable:!0},height:{value:n.frameHeightReceived,enumerable:!0}}),Object.defineProperties(r,{dimensions:{value:i,enumerable:!0},frameRate:{value:"number"==typeof n.frameRateReceived?n.frameRateReceived:null,enumerable:!0}}),r}return i(t,e),t}(n(34861));e.exports=o},18044:function(e){"use strict";e.exports=function(e,t,n){Object.defineProperties(this,{id:{enumerable:!0,value:e},trackId:{enumerable:!0,value:t},bitrate:{enumerable:!0,value:n}})}},86035:function(e){"use strict";e.exports=function(e,t,n){Object.defineProperties(this,{id:{enumerable:!0,value:e,writable:!0},trackId:{enumerable:!0,value:t,writable:!0},lastStats:{enumerable:!0,value:n,writable:!0}})}},11414:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(39462),a=n(18044),s=n(95811),c=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r)||this;return Object.defineProperties(o,{rtt:{enumerable:!0,value:i}}),o}return i(t,e),t.of=function(e,n,r,i){if(n.id!==r.id)throw Error("RTCStats IDs must match");var o=(r.timestamp-n.timestamp)/1e3,a=r.bytesSent-n.bytesSent,s=i&&"number"==typeof i.roundTripTime?i.roundTripTime/1e3:void 0;return new t(n.id,e,o>0?a/o*8:0,s)},t.summarize=function(e){return{bitrate:s(e.map(function(e){return e.bitrate})),rtt:o(e.map(function(e){return e.rtt}))}},t}(a);e.exports=c},59164:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(86035),a=n(11414),s=function(e){function t(t,n){var r=e.call(this,n.id,t,n)||this;return Object.defineProperties(r,{lastReport:{enumerable:!0,value:null,writable:!0}}),r}return i(t,e),t.prototype.next=function(e,t,n){var r=this.lastStats;this.lastStats=t,this.trackId=e;var i=a.of(e,r,t,n);return this.lastReport=i,i},t}(o);e.exports=s},2340:function(e,t,n){"use strict";var r=n(40741),i=n(16872),o=n(18633),a=n(31675);e.exports=function(e,t,n){if("string"!=typeof e)throw Error("RTCPeerConnection id must be a string");Object.defineProperties(this,{peerConnectionId:{value:e,enumerable:!0},localAudioTrackStats:{value:t.localAudioTrackStats.map(function(e){return new r(e.trackId,e,n)}),enumerable:!0},localVideoTrackStats:{value:t.localVideoTrackStats.map(function(e){return new i(e.trackId,e,n)}),enumerable:!0},remoteAudioTrackStats:{value:t.remoteAudioTrackStats.map(function(e){return new o(e.trackId,e)}),enumerable:!0},remoteVideoTrackStats:{value:t.remoteVideoTrackStats.map(function(e){return new a(e.trackId,e)}),enumerable:!0}})}},95811:function(e){"use strict";e.exports=function(e){return e.reduce(function(e,t){return"number"==typeof t?t+e:e},0)}},4941:function(e){"use strict";e.exports=function(e,t){if("string"!=typeof e)throw Error("Track id must be a string");Object.defineProperties(this,{trackId:{value:e,enumerable:!0},trackSid:{value:t.trackSid,enumerable:!0},timestamp:{value:t.timestamp,enumerable:!0},ssrc:{value:t.ssrc,enumerable:!0},packetsLost:{value:"number"==typeof t.packetsLost?t.packetsLost:null,enumerable:!0},codec:{value:"string"==typeof t.codecName?t.codecName:null,enumerable:!0}})}},69430:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=function(e){function t(t,n){var r=e.call(this)||this;return Object.defineProperties(r,{id:{enumerable:!0,value:t},kind:{enumerable:!0,value:n}}),r}return i(t,e),t.prototype.stop=function(){this.emit("stopped")},t}(n(23172));e.exports=o},44670:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(13122),c=n(96971),u=c.buildLogLevels,l=c.makeUUID,d=n(36372),p=n(5481),f=n(75317),h=0,v={closed:[],connecting:["closed","open","waiting"],early:["closed","connecting"],open:["closed"],waiting:["closed","connecting","early","open"]},m={closed:"close",open:"open",waiting:"waiting"},_=globalThis,y=_.WebSocket?_.WebSocket:n(39990),g={BUSY:"busy",FAILED:"failed",LOCAL:"local",REMOTE:"remote",TIMEOUT:"timeout"},b=new Map([[3e3,g.TIMEOUT],[3001,g.TIMEOUT],[3002,g.FAILED],[3003,g.FAILED],[3004,g.TIMEOUT],[3006,g.BUSY],[3007,g.TIMEOUT]]),k=function(e){function t(t,n){var r=e.call(this,"early",v)||this,i=u((n=Object.assign({helloBody:null,maxConsecutiveFailedHellos:3,maxConsecutiveMissedHeartbeats:3,requestedHeartbeatTimeout:5e3,openTimeout:15e3,welcomeTimeout:5e3,Log:d,WebSocket:y},n)).logLevel),s=new n.Log("default",r,i,n.loggerName),c=n.networkMonitor?new p(function(){var e=c.type,t="Network changed"+(e?" to "+e:"");s.debug(t),r._close({code:3004,reason:t})}):null;Object.defineProperties(r,{_busyWaitTimeout:{value:null,writable:!0},_consecutiveHeartbeatsMissed:{value:0,writable:!0},_cookie:{value:null,writable:!0},_eventObserver:{value:n.eventObserver},_heartbeatTimeout:{value:null,writable:!0},_hellosLeft:{value:n.maxConsecutiveFailedHellos,writable:!0},_instanceId:{value:++h},_log:{value:s},_messageQueue:{value:[]},_networkMonitor:{value:c},_options:{value:n},_openTimeout:{value:null,writable:!0},_sendHeartbeatTimeout:{value:null,writable:!0},_serverUrl:{value:t},_welcomeTimeout:{value:null,writable:!0},_ws:{value:null,writable:!0}});var l={connecting:"info",early:"info",open:"info",waiting:"warning",closed:"info"};return r.on("stateChanged",function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e in m&&r.emit.apply(r,a([m[e]],o(t)));var i={name:e,group:"signaling",level:l[r.state]};if("closed"===e){var s=o(t,1)[0];i.payload={reason:s},i.level=s===g.LOCAL?"info":"error"}r._eventObserver.emit("event",i)}),r._eventObserver.emit("event",{name:r.state,group:"signaling",level:l[r.state]}),r._connect(),r}return i(t,e),t.prototype.toString=function(){return"[TwilioConnection #"+this._instanceId+": "+this._ws.url+"]"},t.prototype._close=function(e){var t=e.code,n=e.reason;if("closed"!==this.state){this._openTimeout&&this._openTimeout.clear(),this._welcomeTimeout&&this._welcomeTimeout.clear(),this._heartbeatTimeout&&this._heartbeatTimeout.clear(),this._sendHeartbeatTimeout&&this._sendHeartbeatTimeout.clear(),this._networkMonitor&&this._networkMonitor.stop(),this._busyWaitTimeout&&3005!==t&&this._busyWaitTimeout.clear(),this._messageQueue.splice(0);var r=this._log;1e3===t?(r.debug("Closed"),this.transition("closed",null,[g.LOCAL])):(r.warn("Closed: "+t+" - "+n),3005!==t&&this.transition("closed",null,[b.get(t)||g.REMOTE]));var i=this._ws.readyState,o=this._options.WebSocket;i!==o.CLOSING&&i!==o.CLOSED&&this._ws.close(t,n)}},t.prototype._connect=function(){var e=this,t=this._log;if("waiting"===this.state)this.transition("early");else if("early"!==this.state){t.warn('Unexpected state "'+this.state+'" for connecting to the TCMP server.');return}this._ws=new this._options.WebSocket(this._serverUrl);var n=this._ws;t.debug("Created a new WebSocket:",n),n.addEventListener("close",function(t){return e._close(t)});var r=this._options.openTimeout;this._openTimeout=new f(function(){e._close({code:3007,reason:"Failed to open in "+r+" ms"})},r),n.addEventListener("open",function(){t.debug("WebSocket opened:",n),e._openTimeout.clear(),e._startHandshake(),e._networkMonitor&&e._networkMonitor.start()}),n.addEventListener("message",function(n){t.debug("Incoming: "+n.data);try{n=JSON.parse(n.data)}catch(t){e.emit("error",t);return}switch(n.type){case"bad":e._handleBad(n);break;case"busy":e._handleBusy(n);break;case"bye":break;case"msg":e._handleMessage(n);case"heartbeat":e._handleHeartbeat();break;case"welcome":e._handleWelcome(n);break;default:e._log.debug("Unknown message type: "+n.type),e.emit("error",Error("Unknown message type: "+n.type))}})},t.prototype._handleBad=function(e){var t=e.reason,n=this._log;
1if(!["connecting","open"].includes(this.state)){n.warn('Unexpected state "'+this.state+'" for handling a "bad" message from the TCMP server.');return}if("connecting"===this.state){n.warn("Closing: 3002 - "+t),this._close({code:3002,reason:t});return}n.debug("Error: "+t),this.emit("error",Error(t))},t.prototype._handleBusy=function(e){var t=this,n=e.cookie,r=e.keepAlive,i=e.retryAfter,o=this._log;if(!["connecting","waiting"].includes(this.state)){o.warn('Unexpected state "'+this.state+'" for handling a "busy" message from the TCMP server.');return}this._busyWaitTimeout&&this._busyWaitTimeout.clear(),this._welcomeTimeout&&this._welcomeTimeout.clear();var a=i<0?'Received terminal "busy" message':'Received "busy" message, retrying after '+i+" ms";if(i<0){o.warn("Closing: 3006 - "+a),this._close({code:3006,reason:a});return}var s=this._options.maxConsecutiveFailedHellos;this._hellosLeft=s,this._cookie=n||null,r?(o.warn(a),this._busyWaitTimeout=new f(function(){return t._startHandshake()},i)):(o.warn("Closing: 3005 - "+a),this._close({code:3005,reason:a}),this._busyWaitTimeout=new f(function(){return t._connect()},i)),this.transition("waiting",null,[r,i])},t.prototype._handleHeartbeat=function(){if("open"!==this.state){this._log.warn('Unexpected state "'+this.state+'" for handling a "heartbeat" message from the TCMP server.');return}this._heartbeatTimeout.reset()},t.prototype._handleHeartbeatTimeout=function(){if("open"===this.state){var e=this._log,t=this._options.maxConsecutiveMissedHeartbeats;e.debug("Consecutive heartbeats missed: "+t);var n="Missed "+t+' "heartbeat" messages';e.warn("Closing: 3001 - "+n),this._close({code:3001,reason:n})}},t.prototype._handleMessage=function(e){var t=e.body;if("open"!==this.state){this._log.warn('Unexpected state "'+this.state+'" for handling a "msg" message from the TCMP server.');return}this.emit("message",t)},t.prototype._handleWelcome=function(e){var t=this,n=e.negotiatedTimeout,r=this._log;if(!["connecting","waiting"].includes(this.state)){r.warn('Unexpected state "'+this.state+'" for handling a "welcome" message from the TCMP server.');return}"waiting"===this.state&&(r.debug('Received "welcome" message, no need to retry connection.'),this._busyWaitTimeout.clear());var i=this._options.maxConsecutiveMissedHeartbeats;this._welcomeTimeout.clear(),this._heartbeatTimeout=new f(function(){return t._handleHeartbeatTimeout()},n*i),this._messageQueue.splice(0).forEach(function(e){return t._send(e)}),this._sendHeartbeatTimeout=new f(function(){return t._sendHeartbeat()},n-200),this.transition("open")},t.prototype._handleWelcomeTimeout=function(){if("connecting"===this.state){var e=this._log;if(this._hellosLeft<=0){var t="All handshake attempts failed";e.warn("Closing: 3000 - "+t),this._close({code:3e3,reason:t});return}var n=this._options.maxConsecutiveFailedHellos;e.warn("Handshake attempt "+(n-this._hellosLeft)+" failed"),this._startHandshake()}},t.prototype._send=function(e){if(this._ws.readyState===this._options.WebSocket.OPEN){var t=JSON.stringify(e);this._log.debug("Outgoing: "+t);try{this._ws.send(t),this._sendHeartbeatTimeout&&this._sendHeartbeatTimeout.reset()}catch(e){var n="Failed to send message";this._log.warn("Closing: 3003 - "+n),this._close({code:3003,reason:n})}}},t.prototype._sendHeartbeat=function(){"closed"!==this.state&&this._send({type:"heartbeat"})},t.prototype._sendHello=function(){var e=this._options,t=e.helloBody,n=e.requestedHeartbeatTimeout,r={id:l(),timeout:n,type:"hello",version:2};this._cookie&&(r.cookie=this._cookie),t&&(r.body=t),this._send(r)},t.prototype._sendOrEnqueue=function(e){var t=this;"closed"!==this.state&&("open"===this.state?function(e){return t._send(e)}:function(e){return t._messageQueue.push(e)})(e)},t.prototype._startHandshake=function(){var e=this;if(["early","waiting"].includes(this.state)&&this.transition("connecting"),"connecting"===this.state){this._hellosLeft--,this._sendHello();var t=this._options.welcomeTimeout;this._welcomeTimeout=new f(function(){return e._handleWelcomeTimeout()},t)}},t.prototype.close=function(){"closed"!==this.state&&(this._sendOrEnqueue({type:"bye"}),this._close({code:1e3,reason:"Normal"}))},t.prototype.sendMessage=function(e){this._sendOrEnqueue({body:e,type:"msg"})},t}(s);k.CloseReason=g,e.exports=k},7206:function(e,t,n){"use strict";var r=n(96971).defer,i=function(){function e(){Object.defineProperties(this,{_deferreds:{value:[]},_hasValue:{value:!1,writable:!0},_value:{value:null,writable:!0}})}return e.prototype.put=function(e){this._hasValue=!0,this._value=e;var t=this._deferreds.shift();return t&&t.resolve(e),this},e.prototype.take=function(){var e=this;if(this._hasValue&&!this._deferreds.length)return this._hasValue=!1,Promise.resolve(this._value);var t=r();return this._deferreds.push(t),t.promise.then(function(t){return e._hasValue=!1,t})},e}();e.exports=i},51822:function(e){var t=function(){function e(e){Object.defineProperties(this,{_min:{value:e.min||100},_max:{value:e.max||1e4},_jitter:{value:e.jitter>0&&e.jitter<=1?e.jitter:0},_factor:{value:e.factor||2},_attempts:{value:0,writable:!0},_duration:{enumerable:!1,get:function(){var e=this._min*Math.pow(this._factor,this._attempts);if(this._jitter){var t=Math.random(),n=Math.floor(t*this._jitter*e);e=(1&Math.floor(10*t))==0?e-n:e+n}return 0|Math.min(e,this._max)}},_timeoutID:{value:null,writable:!0}})}return e.prototype.backoff=function(e){var t=this,n=this._duration;this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null),this._timeoutID=setTimeout(function(){t._attempts++,e()},n)},e.prototype.reset=function(){this._attempts=0,this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null)},e}();e.exports=t},49943:function(e){"use strict";var t=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a};function n(){return!!(navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2)}function r(){return n()&&window.screen.width>=744&&(/Macintosh/i.test(navigator.userAgent)||/iPad/.test(navigator.userAgent)||/iPad/.test(navigator.platform))}function i(){return n()&&window.screen.width<=476&&(/Macintosh/i.test(navigator.userAgent)||/iPhone/.test(navigator.userAgent)||/iPhone/.test(navigator.platform))}e.exports={isAndroid:function(){return/Android/.test(navigator.userAgent)},isIOS:function(){return r()||i()},isIpad:r,isIphone:i,isMobile:function(){return/Mobi/.test(navigator.userAgent)},isNonChromiumEdge:function(e){return"chrome"===e&&/Edge/.test(navigator.userAgent)&&("undefined"==typeof chrome||void 0===chrome.runtime)},mobileWebKitBrowser:function(e){return"safari"!==e?null:"brave"in navigator?"brave":["edge","edg"].find(function(e){return navigator.userAgent.toLowerCase().includes(e)})||null},rebrandedChromeBrowser:function(e){return"chrome"!==e?null:"brave"in navigator?"brave":t(((function(e){for(var t=[],n=[],r=0;r<e.length;r++)if("("===e[r])t.push(r);else if(")"===e[r]&&t.length>0){var i=t.pop();0===t.length&&n.push(e.substring(i,r+1))}return n})(navigator.userAgent).reduce(function(e,t){return e.replace(t,"")},navigator.userAgent).match(/[^\s]+/g)||[]).map(function(e){return e.split("/")[0].toLowerCase()})).slice(2).find(function(e){return!["chrome","mobile","safari"].includes(e)})||null}}},17422:function(e){"use strict";var t=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},n=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},r=function(){function e(e,t){var n=this;Object.defineProperties(this,{_isCancelable:{writable:!0,value:!0},_isCanceled:{writable:!0,value:!1},_onCancel:{value:t}}),Object.defineProperty(this,"_promise",{value:new Promise(function(t,r){e(function(e){n._isCancelable=!1,t(e)},function(e){n._isCancelable=!1,r(e)},function(){return n._isCanceled})})})}
1return e.reject=function(t){return new e(function(e,n){n(t)},function(){})},e.resolve=function(t){return new e(function(e){e(t)},function(){})},e.prototype.cancel=function(){return this._isCancelable&&(this._isCanceled=!0,this._onCancel()),this},e.prototype.catch=function(){var r=[].slice.call(arguments),i=this._promise;return new e(function(e,o){i.catch.apply(i,n([],t(r))).then(e,o)},this._onCancel)},e.prototype.then=function(){var r=[].slice.call(arguments),i=this._promise;return new e(function(e,o){i.then.apply(i,n([],t(r))).then(e,o)},this._onCancel)},e.prototype.finally=function(){var r=[].slice.call(arguments),i=this._promise;return new e(function(e,o){i.finally.apply(i,n([],t(r))).then(e,o)},this._onCancel)},e}();e.exports=r},62097:function(e,t,n){"use strict";var r=n(1730);e.exports.SDK_NAME=r.name+".js",e.exports.SDK_VERSION=r.version,e.exports.SDP_FORMAT="unified",e.exports.hardwareDevicePublisheriPad={hwDeviceManufacturer:"Apple",hwDeviceModel:"iPad",hwDeviceType:"tablet",platformName:"iOS"},e.exports.hardwareDevicePublisheriPhone={hwDeviceManufacturer:"Apple",hwDeviceModel:"iPhone",hwDeviceType:"mobile",platformName:"iOS"},e.exports.DEFAULT_ENVIRONMENT="prod",e.exports.DEFAULT_REALM="us1",e.exports.DEFAULT_REGION="gll",e.exports.DEFAULT_LOG_LEVEL="warn",e.exports.DEFAULT_LOGGER_NAME="twilio-video",e.exports.WS_SERVER=function(e,t){return t="gll"===t?"global":encodeURIComponent(t),"prod"===e?"wss://"+t+".vss.twilio.com/signaling":"wss://"+t+".vss."+e+".twilio.com/signaling"},e.exports.PUBLISH_MAX_ATTEMPTS=5,e.exports.PUBLISH_BACKOFF_JITTER=10,e.exports.PUBLISH_BACKOFF_MS=20,e.exports.typeErrors={ILLEGAL_INVOKE:function(e,t){return TypeError("Illegal call to "+e+": "+t)},INVALID_TYPE:function(e,t){return TypeError(e+" must be "+(["a","e","i","o","u"].includes(t.toLowerCase()[0])?"an":"a")+" "+t)},INVALID_VALUE:function(e,t){return RangeError(e+" must be one of "+t.join(", "))},REQUIRED_ARGUMENT:function(e){return TypeError(e+" must be specified")}},e.exports.DEFAULT_FRAME_RATE=24,e.exports.DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS=1e4,e.exports.DEFAULT_ICE_GATHERING_TIMEOUT_MS=15e3,e.exports.DEFAULT_SESSION_TIMEOUT_SEC=30,e.exports.DEFAULT_NQ_LEVEL_LOCAL=1,e.exports.DEFAULT_NQ_LEVEL_REMOTE=0,e.exports.MAX_NQ_LEVEL=3,e.exports.ICE_ACTIVITY_CHECK_PERIOD_MS=1e3,e.exports.ICE_INACTIVITY_THRESHOLD_MS=3e3,e.exports.iceRestartBackoffConfig={factor:1.1,min:1,max:1e3*e.exports.DEFAULT_SESSION_TIMEOUT_SEC,jitter:1},e.exports.reconnectBackoffConfig={factor:1.5,min:80,jitter:1},e.exports.subscriptionMode={MODE_COLLABORATION:"collaboration",MODE_GRID:"grid",MODE_PRESENTATION:"presentation"},e.exports.trackSwitchOffMode={MODE_DISABLED:"disabled",MODE_DETECTED:"detected",MODE_PREDICTED:"predicted"},e.exports.trackPriority={PRIORITY_HIGH:"high",PRIORITY_LOW:"low",PRIORITY_STANDARD:"standard"},e.exports.clientTrackSwitchOffControl={MODE_AUTO:"auto",MODE_MANUAL:"manual"},e.exports.videoContentPreferencesMode={MODE_AUTO:"auto",MODE_MANUAL:"manual"}},48685:function(e,t,n){"use strict";var r=n(40905);e.exports=function(e){var t=n(23585),i={},o=t.getOrCreate(i),a=3;return(function t(){return a--,r(o,e.srcObject,250).then(function(e){return!!e&&(!(a>0)||t())}).catch(function(){return!0})})().finally(function(){t.release(i)})}},38815:function(e){"use strict";var t=null;e.exports=function(e){return t=t||document.createElement("canvas"),new Promise(function(n){var r=3;setTimeout(function i(){return(r--,!function(e){try{var n=t.getContext("2d");n.drawImage(e,0,0,50,50);var r=n.getImageData(0,0,50,50).data.filter(function(e,t){return(t+1)%4}),i=Math.max.apply(Math,r);return 0===i}catch(e){return console.log("Error checking silence: ",e),!1}}(e))?n(!1):r>0?setTimeout(i,250):n(!0)},250)})}},68379:function(e){"use strict";var t=function(){function e(e){var t=this;void 0===e&&(e=1),Object.defineProperties(this,{_listeners:{value:[]},_onVisibilityChange:{value:function(){t._emitVisible("visible"===document.visibilityState)}}});for(var n=0;n<e;n++)this._listeners.push([])}return e.prototype.clear=function(){for(var e=this._listeners.length,t=0;t<e;t++)this._listeners[t]=[]},e.prototype._listenerCount=function(){return this._listeners.reduce(function(e,t){return e+t.length},0)},e.prototype._emitVisible=function(e){for(var t=this,n=Promise.resolve(),r=function(r){n=n.then(function(){return t._emitVisiblePhase(r,e)})},i=1;i<=this._listeners.length;i++)r(i);return n},e.prototype._emitVisiblePhase=function(e,t){return Promise.all(this._listeners[e-1].map(function(e){var n=e(t);return n instanceof Promise?n:Promise.resolve(n)}))},e.prototype._start=function(){document.addEventListener("visibilitychange",this._onVisibilityChange)},e.prototype._stop=function(){document.removeEventListener("visibilitychange",this._onVisibilityChange)},e.prototype.onVisibilityChange=function(e,t){if("number"!=typeof e||e<=0||e>this._listeners.length)throw Error("invalid phase: ",e);return this._listeners[e-1].push(t),1===this._listenerCount()&&this._start(),this},e.prototype.offVisibilityChange=function(e,t){if("number"!=typeof e||e<=0||e>this._listeners.length)throw Error("invalid phase: ",e);var n=this._listeners[e-1],r=n.indexOf(t);return -1!==r&&(n.splice(r,1),0===this._listenerCount()&&this._stop()),this},e}();e.exports=new t(2)},53974:function(e){"use strict";var t,n,r;e.exports=[n=(t=globalThis).location,r=t.URL].some(function(e){return!e})?function(e){return Promise.reject(Error("Failed to import: "+e+": dynamicImport is not supported"))}:(t.__twilioVideoImportedModules={},function(e){return e in t.__twilioVideoImportedModules?Promise.resolve(t.__twilioVideoImportedModules[e]):Function("scope","return import('"+new r(e,n)+"').then(m => scope.__twilioVideoImportedModules['"+e+"'] = m);")(t)})},13451:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(17187).EventEmitter,a=["signaling","room","media","quality","video-processor","preflight"],s=["debug","error","info","warning"],c=function(e){function t(t,n,r,i){void 0===i&&(i=null);var o=e.call(this)||this;return o.on("event",function(e){var o=e.name,c=e.group,u=e.level,l=e.payload;if("string"!=typeof o)throw r.error("Unexpected name: ",o),Error("Unexpected name: ",o);if(!a.includes(c))throw r.error("Unexpected group: ",c),Error("Unexpected group: ",c);if(!s.includes(u))throw r.error("Unexpected level: ",u),Error("Unexpected level: ",u);var d=Date.now(),p=d-n,f=Object.assign({elapsedTime:p,level:u},l||{});t.publish(c,o,f);var h=Object.assign({elapsedTime:p,group:c,level:u,name:o,timestamp:d},l?{payload:l}:{});r[({debug:"debug",error:"error",info:"info",warning:"warn"})[u]]("event",h),i&&"signaling"===c&&i.emit("event",h)}),o}return i(t,e),t}(o);e.exports=c},95115:function(e){"use strict";var t=function(){function e(e){Object.defineProperties(this,{_getKey:{value:(e=Object.assign({getKey:function(e){return e},getValue:function(e){return e},isLessThanOrEqualTo:function(e,t){return e<=t}},e)).getKey},_getValue:{value:e.getValue},_isLessThanOrEqualTo:{value:e.isLessThanOrEqualTo},_map:{value:new Map}})}return e.prototype.toMap=function(){return new Map(this._map)},e.prototype.updateAndFilter=function(e){return e.filter(this.update,this)},e.prototype.update=function(e){var t=this._getKey(e),n=this._getValue(e);return!(this._map.has(t)&&this._isLessThanOrEqualTo(n,this._map.get(t)))&&(this._map.set(t,n),!0)},e}();e.exports=t},96971:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(62097),c=s.typeErrors,u=s.trackPriority,l=n(67476),d=n(97480).sessionSID,p=n(22665);function f(){return"undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:"Unknown"}function h(e){return"object"==typeof e&&!Array.isArray(e)}function v(e){Object.getOwnPropertyNames(e).forEach(function(t){t.startsWith("_")&&m(e,t)})}function m(e,t){var n=Object.getOwnPropertyDescriptor(e,t);n.enumerable=!1,Object.defineProperty(e,t,n)}function _(e){return b(e,[{prop:"dominantSpeakerPriority",type:"string",payloadProp:"active_speaker_priority"},{prop:"maxSubscriptionBitrate",type:"number",payloadProp:"max_subscription_bandwidth"},{prop:"maxTracks",type:"number",payloadProp:"max_tracks"},{prop:"mode",type:"string"},{prop:"renderDimensions",type:"object",payloadProp:"render_dimensions",transform:g},{prop:"trackSwitchOffMode",type:"string",payloadProp:"track_switch_off"}])}function y(e){return b(e,[{prop:"height",type:"number"},{prop:"width",type:"number"}])}function g(e){return b(e,[{prop:u.PRIORITY_HIGH,type:"object",transform:y},{prop:u.PRIORITY_LOW,type:"object",transform:y},{prop:u.PRIORITY_STANDARD,type:"object",transform:y}])}function b(e,t){return t.reduce(function(t,n){var r,i=n.prop,o=n.type,a=n.payloadProp,s=n.transform;return typeof e[i]===o?Object.assign(((r={})[void 0===a?i:a]=(void 0===s?function(e){return e}:s)(e[i]),r),t):t},{})}t.constants=s,t.createBandwidthProfilePayload=function(e){return b(e,[{prop:"video",type:"object",transform:_}])},t.createMediaSignalingPayload=function(e,t,n,r,i,o){var a={transports:[{type:"data-channel"}]};return Object.assign(e?{active_speaker:a}:{},t?{network_quality:a}:{},o?{render_hints:a}:{},i?{publisher_hints:a}:{},n?{track_priority:a}:{},r?{track_switch_off:a}:{})},t.createMediaWarningsPayload=function(e){var t,n=((t={})[p.recordingMediaLost]="recordings",t);return e.map(function(e){return n[e]}).filter(function(e){return!!e})},t.createRoomConnectEventPayload=function(e){function t(e){return e?"true":"false"}var n={sessionSID:d,iceServers:(e.iceServers||[]).length,audioTracks:(e.tracks||[]).filter(function(e){return"audio"===e.kind}).length,videoTracks:(e.tracks||[]).filter(function(e){return"video"===e.kind}).length,dataTracks:(e.tracks||[]).filter(function(e){return"data"===e.kind}).length};if([["audio"],["automaticSubscription"],["enableDscp"],["eventListener"],["preflight"],["video"],["dominantSpeaker","enableDominantSpeaker"]].forEac
1h(function(r){var i=o(r,2),a=i[0],s=i[1];n[s=s||a]=t(!!e[a])}),[["maxVideoBitrate"],["maxAudioBitrate"]].forEach(function(t){var r=o(t,2),i=r[0],a=r[1];a=a||i,"number"==typeof e[i]?n[a]=e[i]:isNaN(Number(e[i]))||(n[a]=Number(e[i]))}),[["iceTransportPolicy"],["region"],["name","roomName"]].forEach(function(t){var r=o(t,2),i=r[0],a=r[1];a=a||i,"string"==typeof e[i]?n[a]=e[i]:"number"==typeof e[i]&&"name"===i&&(n[a]=e[i].toString())}),["preferredAudioCodecs","preferredVideoCodecs"].forEach(function(t){t in e&&(n[t]=JSON.stringify(e[t]))}),"networkQuality"in e&&(n.networkQualityConfiguration={},h(e.networkQuality)?["local","remote"].forEach(function(t){"number"==typeof e.networkQuality[t]&&(n.networkQualityConfiguration[t]=e.networkQuality[t])}):(n.networkQualityConfiguration.remote=0,n.networkQualityConfiguration.local=e.networkQuality?1:0)),e.bandwidthProfile&&e.bandwidthProfile.video){var r=e.bandwidthProfile.video||{};n.bandwidthProfileOptions={},["mode","maxTracks","trackSwitchOffMode","dominantSpeakerPriority","maxSubscriptionBitrate","renderDimensions","contentPreferencesMode","clientTrackSwitchOffControl"].forEach(function(e){"number"==typeof r[e]||"string"==typeof r[e]?n.bandwidthProfileOptions[e]=r[e]:"boolean"==typeof r[e]?n.bandwidthProfileOptions[e]=t(r[e]):"object"==typeof r[e]&&(n.bandwidthProfileOptions[e]=JSON.stringify(r[e]))})}return{group:"room",name:"connect",level:"info",payload:n}},t.createSubscribePayload=function(e){return{rules:[{type:e?"include":"exclude",all:!0}],revision:1}},t.asLocalTrack=function(e,t){if(e instanceof t.LocalAudioTrack||e instanceof t.LocalVideoTrack||e instanceof t.LocalDataTrack)return e;if(e instanceof t.MediaStreamTrack)return"audio"===e.kind?new t.LocalAudioTrack(e,t):new t.LocalVideoTrack(e,t);throw c.INVALID_TYPE("track","LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack")},t.asLocalTrackPublication=function(e,t,n,r){return new({audio:r.LocalAudioTrackPublication,video:r.LocalVideoTrackPublication,data:r.LocalDataTrackPublication})[e.kind](t,e,n,r)},t.capitalize=function(e){return e[0].toUpperCase()+e.slice(1)},t.deprecateEvents=function(e,t,n,r){var i=new Set;t.on("newListener",function o(a){n.has(a)&&!i.has(a)&&(r.deprecated(e+"#"+a+" has been deprecated and scheduled for removal in [email protected]."+(n.get(a)?" Use "+e+"#"+n.get(a)+" instead.":"")),i.add(a)),i.size>=n.size&&t.removeListener("newListener",o)})},t.difference=function(e,t){e=new Set(Array.isArray(e)?e:e.values()),t=new Set(Array.isArray(t)?t:t.values());var n=new Set;return e.forEach(function(e){t.has(e)||n.add(e)}),n},t.filterObject=function(e,t){return Object.keys(e).reduce(function(n,r){return e[r]!==t&&(n[r]=e[r]),n},{})},t.flatMap=function(e,t){var n=e instanceof Map||e instanceof Set?Array.from(e.values()):e;return t=t||function(e){return e},n.reduce(function(e,n){var r=t(n);return e.concat(r)},[])},t.getPlatform=function(){var e=o(f().match(/\(([^)]+)\)/)||[],2)[1];return o((void 0===e?"unknown":e).split(";").map(function(e){return e.trim()}),1)[0].toLowerCase()},t.getUserAgent=f,t.hidePrivateProperties=v,t.hidePrivateAndCertainPublicPropertiesInClass=function(e,t){return function(e){function n(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var s=e.apply(this,a([],o(r)))||this;
1return v(s),void 0===(n=t)&&(n=[]),n.forEach(function(e){s.hasOwnProperty(e)&&m(s,e)}),s}return i(n,e),n}(e)},t.isDeepEqual=function e(t,n){if(t===n)return!0;if(typeof t!=typeof n)return!1;if(null===t)return null===n;if(null===n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every(function(t,r){return e(t,n[r])});if("object"==typeof t){var r=Object.keys(t).sort(),i=Object.keys(n).sort();return!Array.isArray(n)&&e(r,i)&&r.every(function(r){return e(t[r],n[r])})}return!1},t.isNonArrayObject=h,t.inRange=function(e,t,n){return t<=e&&e<=n},t.makeUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t.oncePerTick=function(e){var t=null;function n(){t=null,e()}return function(){t&&clearTimeout(t),t=setTimeout(n)}},t.promiseFromEvents=function(e,t,n,r){return new Promise(function(i,s){function c(){var e=[].slice.call(arguments);r&&t.removeListener(r,u),i.apply(void 0,a([],o(e)))}function u(){var e=[].slice.call(arguments);t.removeListener(n,c),s.apply(void 0,a([],o(e)))}
1t.once(n,c),r&&t.once(r,u),e()})},t.getOrNull=function(e,t){return t.split(".").reduce(function(e,t){return e?e[t]:null},e)},t.defer=function(){var e={};return e.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),e},t.delegateMethods=function(e,t,n){for(var r in e)!function(e,t,n,r){var i;if(!(r in t||r.match(/^on[a-z]+$/))){try{i=typeof e[r]}catch(e){}"function"===i&&(t[r]=function(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return(e=this[n])[r].apply(e,a([],o(t)))})}}(e,t,n,r)},t.proxyProperties=function(e,t,n){Object.getOwnPropertyNames(e).forEach(function(e){(function(e,t,n,r){if(!(r in t)){if(r.match(/^on[a-z]+$/)){Object.defineProperty(t,r,{value:null,writable:!0}),n.addEventListener(r.slice(2),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.dispatchEvent.apply(t,a([],o(e)))});return}Object.defineProperty(t,r,{enumerable:!0,get:function(){return n[r]}})}})(0,t,n,e)})},t.legacyPromise=function(e,t,n){return t?e.then(function(e){t(e)},function(e){n(e)}):e},t.buildLogLevels=function(e){return"string"==typeof e?{default:e,media:e,signaling:e,webrtc:e}:e},t.trackClass=function(e,t){return(t=t?"Local":"")+(e.kind||"").replace(/\w{1}/,function(e){return e.toUpperCase()})+"Track"},t.trackPublicationClass=function(e,t){return(t=t?"Local":"")+(e.kind||"").replace(/\w{1}/,function(e){return e.toUpperCase()})+"TrackPublication"},t.valueToJSON=function e(t){return Array.isArray(t)?t.map(e):t instanceof Set?a([],o(t)).map(e):t instanceof Map?a([],o(t.entries())).reduce(function(t,n){var r,i=o(n,2),a=i[0],s=i[1];return Object.assign(((r={})[a]=e(s),r),t)},{}):t&&"object"==typeof t?Object.entries(t).reduce(function(t,n){var r,i=o(n,2),a=i[0],s=i[1];return Object.assign(((r={})[a]=e(s),r),t)},{}):t},t.withJitter=function(e,t){return e-t+Math.floor(2*t*Math.random()+.5)},t.isChromeScreenShareTrack=function(e){return"chrome"===l.guessBrowser()&&"video"===e.kind&&"displaySurface"in e.getSettings()},t.waitForSometime=function(e){return void 0===e&&(e=10),new Promise(function(t){return setTimeout(t,e)})},t.waitForEvent=function(e,t){return new Promise(function(n){e.addEventListener(t,function r(i){e.removeEventListener(t,r),n(i)})})}},99849:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=n(17187).EventEmitter,s=n(96971).getUserAgent,c=globalThis,u=c.WebSocket?c.WebSocket:n(39990),l=n(62097),d=l.hardwareDevicePublisheriPad,p=l.hardwareDevicePublisheriPhone,f=n(96971),h=n(49943),v=function(e){function t(t,n,r,i,o,a){var c=e.call(this)||this;return a=Object.assign({gateway:("prod"===i?"wss://sdkgw."+o+".twilio.com":"wss://sdkgw."+i+"-"+o+".twilio.com")+"/v1/VideoEvents",maxReconnectAttempts:5,reconnectIntervalMs:50,userAgent:s(),WebSocket:u},a),Object.defineProperties(c,{_connectTimestamp:{value:0,writable:!0},_eventQueue:{value:[]},_readyToConnect:{value:f.defer()},_reconnectAttemptsLeft:{value:a.maxReconnectAttempts,writable:!0},_ws:{value:null,writable:!0},_WebSocket:{value:a.WebSocket}}),c._readyToConnect.promise.then(function(e){var i=e.roomSid,o=e.participantSid;c.on("disconnected",function e(s){if(c._session=null,s&&c._reconnectAttemptsLeft>0){c.emit("reconnecting"),function(e,t,n,r,i,o,a){var s=Date.now()-e._connectTimestamp,c=a.reconnectIntervalMs-s;if(c>0){setTimeout(function(){m(e,t,n,r,i,o,a)},c);return}m(e,t,n,r,i,o,a)}(c,t,n,r,i,o,a);return}c.removeListener("disconnected",e)}),m(c,t,n,r,i,o,a)}).catch(function(){}),c}return i(t,e),t.prototype.connect=function(e,t){this._readyToConnect.resolve({roomSid:e,participantSid:t})},t.prototype._publish=function(e){e.session=this._session,this._ws.send(JSON.stringify(e))},t.prototype.disconnect=function(){if(null===this._ws||this._ws.readyState===this._WebSocket.CLOSING||this._ws.readyState===this._WebSocket.CLOSED)return!1;try{this._ws.close()}catch(e){}
1return this.emit("disconnected"),!0},t.prototype.publish=function(e,t,n){return(null===this._ws||this._ws.readyState!==this._WebSocket.CLOSING&&this._ws.readyState!==this._WebSocket.CLOSED)&&(("string"==typeof this._session?this._publish.bind(this):this._eventQueue.push.bind(this._eventQueue))({group:e,name:t,payload:n,timestamp:Date.now(),type:"event",version:1}),!0)},t}(a);function m(e,t,n,r,i,a,s){e._connectTimestamp=Date.now(),e._reconnectAttemptsLeft--,e._ws=new s.WebSocket(s.gateway);var c=e._ws;c.addEventListener("close",function(t){if(1e3===t.code){e.emit("disconnected");return}e.emit("disconnected",Error("WebSocket Error "+t.code+": "+t.reason))}),c.addEventListener("message",function(t){(function(e,t,n){switch(t.type){case"connected":e._session=t.session,e._reconnectAttemptsLeft=n.maxReconnectAttempts,e._eventQueue.splice(0).forEach(e._publish,e),e.emit("connected");break;case"error":e._ws.close(),e.emit("disconnected",Error(t.message))}})(e,JSON.parse(t.data),s)}),c.addEventListener("open",function(){var e={type:"connect",token:t,version:1};e.publisher={name:n,sdkVersion:r,userAgent:s.userAgent,participantSid:a,roomSid:i},h.isIpad()?e.publisher=o(o({},e.publisher),d):h.isIphone()&&(e.publisher=o(o({},e.publisher),p)),c.send(JSON.stringify(e))})}e.exports=v},58363:function(e){"use strict";var t=function(){function e(){Object.defineProperties(this,{_connected:{writable:!0,value:!0}})}return e.prototype.connect=function(){},e.prototype.disconnect=function(){return!!this._connected&&(this._connected=!1,!0)},e.prototype.publish=function(){return this._connected},e}();e.exports=t},74919:function(e,t,n){"use strict";var r=n(96971).defer,i=function(){function e(){Object.defineProperties(this,{_audio:{value:r(),writable:!0},_video:{value:r(),writable:!0}}),this._audio.resolve(),this._video.resolve()}return e.prototype.resolveDeferred=function(e){"audio"===e?this._audio.resolve():this._video.resolve()},e.prototype.startDeferred=function(e){"audio"===e?this._audio=r():this._video=r()},e.prototype.whenResolved=function(e){return"audio"===e?this._audio.promise:this._video.promise},e}();e.exports=new i},36372:function(e,t,n){"use strict";var r,i=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},a=n(85021).getLogger,s=n(62097),c=s.DEFAULT_LOG_LEVEL,u=s.DEFAULT_LOGGER_NAME,l=n(62097).typeErrors,d=function(){function e(t,n,r,i,o){if("string"!=typeof t)throw l.INVALID_TYPE("moduleName","string");if(!n)throw l.REQUIRED_ARGUMENT("component");"object"!=typeof r&&(r={}),o=o||a,m(r),Object.defineProperties(this,{_component:{value:n},_logLevels:{value:r},_warnings:{value:new Set},_loggerName:{get:function(){var e=i&&"string"==typeof i?i:u;return this._logLevelsEqual||(e=e+"-"+t),e}},_logger:{get:function(){var e=o(this._loggerName),n=this._logLevels[t]||c;return n="off"===n?"silent":n,e.setDefaultLevel(n),e}},_logLevelsEqual:{get:function(){return 1===new Set(Object.values(this._logLevels)).size}},logLevel:{get:function(){return e.getLevelByName(r[t]||c)}},name:{get:n.toString.bind(n)}})}return e.getLevelByName=function(t){return isNaN(t)?(v(t=t.toUpperCase()),e[t]):parseInt(t,10)},e.prototype.createLog=function(t,n){var r=this._loggerName;return this._logLevelsEqual||(r=r.substring(0,r.lastIndexOf("-"))),new e(t,n,this._logLevels,r)},e.prototype.setLevels=function(e){return m(e),Object.assign(this._logLevels,e),this},e.prototype.log=function(t,n){var r=e._levels[t];if(!r)throw l.INVALID_VALUE("logLevel",f);r=r.toLowerCase();var a=[new Date().toISOString(),r,this.name];return(this._logger[r]||function(){}).apply(void 0,o([],i(a.concat(n)))),this},e.prototype.debug=function(){return this.log(e.DEBUG,[].slice.call(arguments))},e.prototype.deprecated=function(e){var t=function(e){if((r=r||new Map).has(e))return r.get(e);var t=new Set;return r.set(e,t),t}(this._component.constructor);return t.has(e)?this:(t.add(e),this.warn(e))},e.prototype.info=function(){return this.log(e.INFO,[].slice.call(arguments))},e.prototype.warn=function(){return this.log(e.WARN,[].slice.call(arguments))},e.prototype.warnOnce=function(e){return this._warnings.has(e)?this:(this._warnings.add(e),this.warn(e))},e.prototype.error=function(){return this.log(e.ERROR,[].slice.call(arguments))},e.prototype.throw=function(t,n){throw t.clone&&(t=t.clone(n)),this.log(e.ERROR,t),t},e}();Object.defineProperties(d,{DEBUG:{value:0},INFO:{value:1},WARN:{value:2},ERROR:{value:3},OFF:{value:4},_levels:{value:["DEBUG","INFO","WARN","ERROR","OFF"]}});var p={},f=[],h=d._levels.map(function(e,t){return p[e]=!0,f.push(t),e});function v(e){if(!(e in p))throw l.INVALID_VALUE("level",h)}function m(e){Object.keys(e).forEach(function(t){v(e[t].toUpperCase())})}
1e.exports=d},99576:function(e){"use strict";var t=function(){function e(){Object.defineProperties(this,{_samples:{value:[{denominator:0,numerator:0},{denominator:0,numerator:0}]}})}return e.prototype.get=function(){var e=this._samples,t=e[1].denominator-e[0].denominator||1/0;return(e[1].numerator-e[0].numerator)/t},e.prototype.putSample=function(e,t){var n=this._samples;n.shift(),n.push({denominator:t,numerator:e})},e}();e.exports=t},5481:function(e){"use strict";var t=function(){function e(e,t){var n=this,r=(t=Object.assign({navigator:navigator,window:window},t)).navigator,i=r.connection||{type:null},o=i.type,a=i.type?{_events:{value:["change","typechange"]},_listener:{value:function(){var t=o!==n.type&&n.isOnline;o=n.type,t&&e()}},_target:{value:i}}:{_events:{value:["online"]},_listener:{value:e},_target:{value:t.window}},s=a._events;Object.defineProperties(this,{isOnline:{enumerable:!0,get:function(){return"boolean"!=typeof r.onLine||r.onLine}},type:{enumerable:!0,get:function(){return i.type||null}},_listener:a._listener,_events:s,_target:a._target})}return e.prototype.start=function(){var e=this;this._events.forEach(function(t){e._target.addEventListener(t,e._listener)})},e.prototype.stop=function(){var e=this;this._events.forEach(function(t){e._target.removeEventListener(t,e._listener)})},e}();e.exports=t},18537:function(e){"use strict";var t,n=this&&this.__extends||(t=function(e,n){return(t=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),r=function(){function e(e){Object.defineProperties(this,{_callback:{value:e}})}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.makeVisible=function(e){var t=this._makeFakeEntry(e,!0);this._callback([t])},e.prototype.makeInvisible=function(e){var t=this._makeFakeEntry(e,!1);this._callback([t])},e.prototype._makeFakeEntry=function(e,t){return{target:e,isIntersecting:t}},e}(),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(r),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.resize=function(e){var t=this._makeFakeEntry(e,!0);this._callback([t])},t}(r);e.exports={NullIntersectionObserver:i,NullResizeObserver:o,NullObserver:r}},51062:function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=n(96971),o=i.difference,a=i.flatMap,s=n(75524),c={0:"PCMU",8:"PCMA"};function u(e){return Array.from(d(e)).reduce(function(e,t){var n=t[0],r=t[1],i=e.get(r)||[];return e.set(r,i.concat(n))},new Map)}function l(e){return h(e).reduce(function(e,t){var n=f(t);return n?e.set(n,t):e},new Map)}function d(e){return v(e).reduce(function(t,n){var r=RegExp("a=rtpmap:"+n+" ([^/]+)"),i=e.match(r),o=i?i[1].toLowerCase():c[n]?c[n].toLowerCase():"";return t.set(n,o)},new Map)}function p(e,t){var n=RegExp("^a=fmtp:"+e+" (.+)$","m"),i=t.match(n);return i&&i[1].split(";").reduce(function(e,t){var n=r(t.split("="),2),i=n[0],o=n[1];return e[i]=isNaN(o)?o:parseInt(o,10),e},{})}function f(e){var t=e.match(/^a=mid:(.+)$/m);return t&&t[1]}function h(e,t,n){return e.replace(/\r\n\r\n$/,"\r\n").split("\r\nm=").slice(1).map(function(e){return"m="+e}).filter(function(e){var r=RegExp("m="+(t||".*"),"gm"),i=RegExp("a="+(n||".*"),"gm");return r.test(e)&&i.test(e)})}function v(e){var t=e.split("\r\n")[0].match(/([0-9]+)/g);return t?t.slice(1).map(function(e){return parseInt(e,10)}):[]}function m(e,t){var n=t.split("\r\n"),r=n[0],i=n.slice(1);return[r=r.replace(/([0-9]+\s?)+$/,e.join(" "))].concat(i).join("\r\n")}function _(e,t){var n=h(e);return[e.split("\r\nm=")[0]].concat(n.map(function(e){if(!/^m=(audio|video)/.test(e))return e;var n=f(e);if(!n)return e;var i=t.get(n);if(!i)return e;var o=(e.match(/^a=msid:(.+)$/m)||[])[1];if(!o)return e;var a=r(o.split(" "),2),s=a[0],c=a[1],u=RegExp("msid:"+s+(c?" "+c:"")+"$","gm");return e.replace(u,"msid:"+s+" "+i)})).join("\r\n")}function y(e,t){return"a=fmtp:"+e+" "+Object.entries(t).map(function(e){var t=r(e,2);return t[0]+"="+t[1]}).join(";")}t.addOrRewriteNewTrackIds=function(e,t,n){var i=Array.from(n).reduce(function(n,i){var o=r(i,2),a=o[0],s=o[1];return h(e,a,"send(only|recv)").map(f).filter(function(e){return!t.has(e)}
1).forEach(function(e,t){return n.set(e,s[t])}),n},new Map);return _(e,i)},t.addOrRewriteTrackIds=_,t.createCodecMapForMediaSection=u,t.createPtToCodecName=d,t.disableRtx=function(e){var t=h(e);return[e.split("\r\nm=")[0]].concat(t.map(function(e){if(!/^m=video/.test(e))return e;var t=u(e).get("rtx");if(!t)return e;var n=new Set(v(e));t.forEach(function(e){return n.delete(e)});var r=e.match(/a=ssrc-group:FID [0-9]+ ([0-9]+)/),i=r&&r[1],o=[/^a=fmtp:.+ apt=.+$/,/^a=rtpmap:.+ rtx\/.+$/,/^a=ssrc-group:.+$/].concat(i?[RegExp("^a=ssrc:"+i+" .+$")]:[]);return e=e.split("\r\n").filter(function(e){return o.every(function(t){return!t.test(e)})}).join("\r\n"),m(Array.from(n),e)})).join("\r\n")},t.enableDtxForOpus=function(e,t){var n=h(e),r=e.split("\r\nm=")[0];return t=t||n.filter(function(e){return/^m=audio/.test(e)}).map(f),[r].concat(n.map(function(e){if(!/^m=audio/.test(e))return e;var n=u(e).get("opus");if(!n)return e;var r=p(n,e);if(!r)return e;var i=new RegExp(y(n,r)),o=f(e);t.includes(o)?r.usedtx=1:delete r.usedtx;var a=y(n,r);return e.replace(i,a)})).join("\r\n")},t.filterLocalCodecs=function(e,t){var n=h(e),i=e.split("\r\nm=")[0],o=l(t);return[i].concat(n.map(function(e){return function(e,t,n){if(!/^m=(audio|video)/.test(e))return e;var i=f(e),o=i&&t.get(i);if(!o)return e;var s=d(o),c=u(e),l=a(Array.from(s),function(t){var i=r(t,2),a=i[0],s=i[1];return"rtx"===s||n.includes(s)?[]:function(e,t,n,r,i){var o=n.get(e)||[];if(o.length<=1)return o;var a=p(t,i);if(!a)return o;var s=o.find(function(e){var t=p(e,r);return t&&Object.keys(a).every(function(e){return a[e]===t[e]})});return"number"==typeof s?[s]:o}(s,a,c,e,o)}),h=c.get("rtx")||[];l=l.concat(h.filter(function(t){var n=p(t,e);return n&&l.includes(n.apt)}));var _=e.split("\r\n").filter(function(e){var t=e.match(/^a=(rtpmap|fmtp|rtcp-fb):(.+) .+$/),n=t&&t[2];return!t||n&&l.includes(parseInt(n,10))});return m(v(e).filter(function(e){return l.includes(e)}),_.join("\r\n"))}(e,o,[])})).join("\r\n")},t.getMediaSections=h,t.removeSSRCAttributes=function(e,t){return e.split("\r\n").filter(function(e){return!t.find(function(t){return RegExp("a=ssrc:.*"+t+":","g").test(e)})}).join("\r\n")},t.revertSimulcast=function(e,t,n,r){void 0===r&&(r=!1);var i=l(n),o=l(t),a=h(e);return[e.split("\r\nm=")[0]].concat(a.map(function(e){if(e=e.replace(/\r\n$/,""),!/^m=video/.test(e))return e;var t=e.match(/^a=mid:(.+)$/m),n=t&&t[1];if(!n)return e;var a=i.get(n),s=d(a),c=v(a),u=c.length&&"vp8"===s.get(c[0]);return r||!u?o.get(n).replace(/\r\n$/,""):e})).concat("").join("\r\n")},t.setCodecPreferences=function(e,t,n){var r=h(e);return[e.split("\r\nm=")[0]].concat(r.map(function(e){if(!/^m=(audio|video)/.test(e))return e;var r,i,s,c=e.match(/^m=(audio|video)/)[1],l=u(e),d=(i=a(r=(r="audio"===c?t:n).map(function(e){return e.codec.toLowerCase()}),function(e){return l.get(e)||[]}),s=a(o(Array.from(l.keys()),r),function(e){return l.get(e)}),i.concat(s)),p=m(d,e),f=l.get("pcma")||[],h=l.get("pcmu")||[];return("audio"===c?new Set(f.concat(h)):new Set).has(d[0])?p.replace(/\r\nb=(AS|TIAS):([0-9]+)/g,""):p})).join("\r\n")},t.setSimulcast=function(e,t){var n=h(e);return[e.split("\r\nm=")[0]].concat(n.map(function(e){if(e=e.replace(/\r\n$/,""),!/^m=video/.test(e))return e;var n=u(e),r=v(e),i=new Set(n.get("vp8")||[]);return r.some(function(e){return i.has(e)})?s(e,t):e})).concat("").join("\r\n")}},14799:function(e,t,n){"use strict";var r=n(39778).RTCSessionDescription,i=n(51062),o=i.createPtToCodecName,a=i.getMediaSections;function s(e){var t,n,r,i=o(e);t=e,e=Array.from(i.keys()).reduce(function(e,t){var n=RegExp("^a=rtpmap:"+t+" rtx.+$","gm");return(e.match(n)||[]).slice("rtx"===i.get(t)?1:0).reduce(function(e,n){var r=RegExp("\r\n"+n),i=RegExp("\r\na=fmtp:"+t+" apt=[0-9]+");return e.replace(r,"").replace(i,"")},e)},t);var a=(n=new Map,i.forEach(function(e,t){var r=n.get(e)||new Set;return n.set(e,r.add(t))}),n),s=a.get("rtx")||new Set,u=new Set,l=(r=e,Array.from(Array.from(Array.from(s).reduce(function(e,t){var n=RegExp("a=fmtp:"+t+" apt=(\\d+)"),o=r.match(n);if(!o)return u.add(t),e;var a=Number.parseInt(o[1]);return i.has(a)&&"rtx"!==i.get(a)?e.set(t,a):(u.add(t),e)},new Map)).reduce(function(e,t){var n=t[0],r=t[1],i=e.get(r)||new Set;return e.set(r,i.add(n))},new Map)).reduce(function(e,t){var n=t[0],r=Array.from(t[1]);return r.length>1?(r.forEach(function(e){u.add(e)}),e):e.set(n,r[0])},new Map)),d=Array.from(u);return["h264","vp8","vp9"].reduce(function(e,t){return Array.from(a.get(t)||new Set).reduce(function(e,t){return l.has(t)?e:e.add(t)},e)},new Set).forEach(function(t){if(d.length){var n,r=d.shift();e=(n=e=c(e,r)).endsWith("\r\n")?n+"a=fmtp:"+r+" apt="+t+"\r\n":n+"\r\na=fmtp:"+r+" apt="+t}}),d.forEach(function(t){var n,r;n=e=c(e,t),r=RegExp("a=rtpmap:"+t+".*\r\n","gm"),e=n.replace(r,"")}),e}function c(e,t){var n=RegExp("a=fmtp:"+t+".*\r\n","gm");return e.replace(n,"")}e.exports=function(e){var t,n,i={type:e.type};return"rollback"!==e.type&&(i.sdp=(n=a(t=e.sdp),[t.split("\r\nm=")[0]].concat(n.map(s)).join("\r\n"))),new r(i)}},75524:function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=n(96971),o=i.difference,a=i.flatMap;function s(){return String(Math.floor(4294967295*Math.random()))}var c=function(){function e(e,t,n){Object.defineProperties(this,{cName:{enumerable:!0,value:n},isSimulcastEnabled:{enumerable:!0,value:!1,writable:!0},primarySSRCs:{enumerable:!0,value:new Set},rtxPairs:{enumerable:!0,value:new Map},streamId:{enumerable:!0,value:t},trackId:{enumerable:!0,value:e}})}return e.prototype.addSimulcastSSRCs=function(){if(!this.isSimulcastEnabled){var e=[s(),s()];e.forEach(function(e){this.primarySSRCs.add(e)},this),this.rtxPairs.size&&e.forEach(function(e){this.rtxPairs.set(s(),e)},this)}},e.prototype.addSSRC=function(e,t,n){t?this.rtxPairs.set(e,t):this.primarySSRCs.add(e),this.isSimulcastEnabled=this.isSimulcastEnabled||n},e.prototype.toSdpLines=function(e){var t=this,n=e?[]:Array.from(this.rtxPairs.entries()).map(function(e){return e.reverse()}),r=Array.from(this.primarySSRCs.values()),i=n.length?a(n):r,o=a(i,function(e){return["a=ssrc:"+e+" cname:"+t.cName,"a=ssrc:"+e+" msid:"+t.streamId+" "+t.trackId]}),s=n.map(function(e){return"a=ssrc-group:FID "+e.join(" ")}),c=["a=ssrc-group:SIM "+r.join(" ")];return s.concat(o).concat(c)},e}();function u(e,t){return(e.match(RegExp(t,"gm"))||[]).map(function(e){return(e.match(new RegExp(t))||[]).slice(1)})}
1e.exports=function(e,t){var n,i,s,l,d,p,f=(d=new Set(a(u(n=e,"^a=ssrc-group:SIM ([0-9]+) ([0-9]+) ([0-9]+)$"))),p=new Map(u(n,"^a=ssrc-group:FID ([0-9]+) ([0-9]+)$").map(function(e){return e.reverse()})),(s=(i=r(a(u(n,"^a=msid:(.+) (.+)$")),2))[0],l=i[1],a(u(n,"^a=ssrc:(.+) cname:.+$")).map(function(e){return[e,s,l]})).reduce(function(e,t){var r=t[0],i=t[1],o=t[2],a=e.get(o)||new c(o,i,n.match(RegExp("a=ssrc:"+r+" cname:(.+)"))[1]),s=p.get(r)||null;return a.addSSRC(r,s,d.has(r)),e.set(o,a)},new Map)),h=Array.from(f.keys()),v=Array.from(t.keys()),m=o(h,v),_=o(v,h);a(m,function(e){return f.get(e)}).forEach(function(e){e.addSimulcastSSRCs(),t.set(e.trackId,e)});var y=a(o(v=Array.from(t.keys()),_),function(e){return t.get(e)}),g=!e.match(/a=rtpmap:[0-9]+ rtx/),b=a(y,function(e){return e.toSdpLines(g)}),k=a(new Set(e.split("\r\n").concat(b))),w="a=x-google-flag:conference";return e.match(w)||k.push(w),k.join("\r\n")}},65179:function(e,t,n){"use strict";var r=n(51062).getMediaSections,i=function(){function e(){Object.defineProperties(this,{_midsToTrackIds:{value:new Map,writable:!0}})}return e.prototype.match=function(e){return this._midsToTrackIds.get(e.transceiver.mid)||null},e.prototype.update=function(e){var t=r(e,"(audio|video)");this._midsToTrackIds=t.reduce(function(e,t){var n=t.match(/^a=mid:(.+)$/m)||[],r=t.match(/^a=msid:.+ (.+)$/m)||[],i=n[1],o=r[1];return i&&o?e.set(i,o):e},this._midsToTrackIds)},e}();e.exports=i},97480:function(e,t){var n="1234567890abcdef";function r(e){for(var t="",r=0;r<32;r++)t+=n.charAt(Math.floor(Math.random()*n.length));return""+e+t}t.sessionSID=r("SS"),t.createSID=r},21746:function(e,t,n){"use strict";var r=n(67476),i=r.guessBrowser,o=r.support,a=n(72728).getSdpFormat,s=n(49943),c=s.isAndroid,u=s.isMobile,l=s.isNonChromiumEdge,d=s.rebrandedChromeBrowser,p=s.mobileWebKitBrowser,f=["crios","edg","edge","electron","headlesschrome"],h=["chrome","firefox"],v=["chrome","safari"],m=[];e.exports=function(){var e=i();if(!e)return!1;var t=d(e),n=p(e),r=c()?h:v;return!!e&&o()&&"unified"===a()&&(!t||f.includes(t))&&!l(e)&&(!n||m.includes(n))&&(!u()||r.includes(e))}},75317:function(e){"use strict";var t=function(){function e(e,t,n){void 0===n&&(n=!0),Object.defineProperties(this,{_delay:{value:t,writable:!0},_fn:{value:e},_timeout:{value:null,writable:!0}}),n&&this.start()}return Object.defineProperty(e.prototype,"delay",{get:function(){return this._delay},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSet",{get:function(){return!!this._timeout},enumerable:!1,configurable:!0}),e.prototype.setDelay=function(e){this._delay=e},e.prototype.start=function(){var e=this;this.isSet||(this._timeout=setTimeout(function(){var t=e._fn;e.clear(),t()},this._delay))},e.prototype.clear=function(){clearTimeout(this._timeout),this._timeout=null},e.prototype.reset=function(){this.clear(),this.start()},e}();e.exports=t},78144:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=n(36196),a={};t.createTwilioError=function(e,t){return t="string"==typeof t&&t?t:"Unknown error",a[e="number"==typeof e?e:0]?new a[e]:new o(e,t)};var s=function(e){function t(){var n=e.call(this,20101,"Invalid Access Token")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.AccessTokenInvalidError=s,Object.defineProperty(a,20101,{value:s});var c=function(e){function t(){var n=e.call(this,20102,"Invalid Access Token header")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.AccessTokenHeaderInvalidError=c,Object.defineProperty(a,20102,{value:c});var u=function(e){function t(){var n=e.call(this,20103,"Invalid Access Token issuer/subject")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.AccessTokenIssuerInvalidError=u,Object.defineProperty(a,20103,{value:u});var l=function(e){function t(){var n=e.call(this,20104,"Access Token expired or expiration date invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.AccessTokenExpiredError=l,Object.defineProperty(a,20104,{value:l});var d=function(e){function t(){var n=e.call(this,20105,"Access Token not yet valid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.AccessTokenNotYetValidError=d,Object.defineProperty(a,20105,{value:d});var p=function(e){function t(){var n=e.call(this,20106,"Invalid Access Token grants")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);
1t.AccessTokenGrantsInvalidError=p,Object.defineProperty(a,20106,{value:p});var f=function(e){function t(){var n=e.call(this,20107,"Invalid Access Token signature")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.AccessTokenSignatureInvalidError=f,Object.defineProperty(a,20107,{value:f});var h=function(e){function t(){var n=e.call(this,53e3,"Signaling connection error")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.SignalingConnectionError=h,Object.defineProperty(a,53e3,{value:h});var v=function(e){function t(){var n=e.call(this,53001,"Signaling connection disconnected")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.SignalingConnectionDisconnectedError=v,Object.defineProperty(a,53001,{value:v});var m=function(e){function t(){var n=e.call(this,53002,"Signaling connection timed out")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.SignalingConnectionTimeoutError=m,Object.defineProperty(a,53002,{value:m});var _=function(e){function t(){var n=e.call(this,53003,"Client received an invalid signaling message")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.SignalingIncomingMessageInvalidError=_,Object.defineProperty(a,53003,{value:_});var y=function(e){function t(){var n=e.call(this,53004,"Client sent an invalid signaling message")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.SignalingOutgoingMessageInvalidError=y,Object.defineProperty(a,53004,{value:y});var g=function(e){function t(){var n=e.call(this,53006,"Video server is busy")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.SignalingServerBusyError=g,Object.defineProperty(a,53006,{value:g});var b=function(e){function t(){var n=e.call(this,53100,"Room name is invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomNameInvalidError=b,Object.defineProperty(a,53100,{value:b});var k=function(e){function t(){var n=e.call(this,53101,"Room name is too long")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomNameTooLongError=k,Object.defineProperty(a,53101,{value:k});var w=function(e){function t(){var n=e.call(this,53102,"Room name contains invalid characters")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomNameCharsInvalidError=w,Object.defineProperty(a,53102,{value:w});var S=function(e){function t(){var n=e.call(this,53103,"Unable to create Room")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomCreateFailedError=S,Object.defineProperty(a,53103,{value:S});var T=function(e){function t(){var n=e.call(this,53104,"Unable to connect to Room")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomConnectFailedError=T,Object.defineProperty(a,53104,{value:T});var C=function(e){function t(){var n=e.call(this,53105,"Room contains too many Participants")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomMaxParticipantsExceededError=C,Object.defineProperty(a,53105,{value:C});var O=function(e){function t(){var n=e.call(this,53106,"Room not found")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomNotFoundError=O,Object.defineProperty(a,53106,{value:O});var P=function(e){function t(){var n=e.call(this,53107,"MaxParticipants is out of range")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomMaxParticipantsOutOfRangeError=P,Object.defineProperty(a,53107,{value:P});var E=function(e){function t(){var n=e.call(this,53108,"RoomType is not valid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomTypeInvalidError=E,Object.defineProperty(a,53108,{value:E});var R=function(e){function t(){var n=e.call(this,53109,"Timeout is out of range")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomTimeoutOutOfRangeError=R,Object.defineProperty(a,53109,{value:R});var L=function(e){function t(){var n=e.call(this,53110,"StatusCallbackMethod is invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomStatusCallbackMethodInvalidError=L,Object.defineProperty(a,53110,{value:L});var j=function(e){function t(){var n=e.call(this,53111,"StatusCallback is invali
1d")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomStatusCallbackInvalidError=j,Object.defineProperty(a,53111,{value:j});var M=function(e){function t(){var n=e.call(this,53112,"Status is invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomStatusInvalidError=M,Object.defineProperty(a,53112,{value:M});var x=function(e){function t(){var n=e.call(this,53113,"Room exists")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomRoomExistsError=x,Object.defineProperty(a,53113,{value:x});var A=function(e){function t(){var n=e.call(this,53114,"Room creation parameter(s) incompatible with the Room type")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomInvalidParametersError=A,Object.defineProperty(a,53114,{value:A});var D=function(e){function t(){var n=e.call(this,53115,"MediaRegion is invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomMediaRegionInvalidError=D,Object.defineProperty(a,53115,{value:D});var I=function(e){function t(){var n=e.call(this,53116,"There are no media servers available in the MediaRegion")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomMediaRegionUnavailableError=I,Object.defineProperty(a,53116,{value:I});var N=function(e){function t(){var n=e.call(this,53117,"The subscription operation requested is not supported for the Room type")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomSubscriptionOperationNotSupportedError=N,Object.defineProperty(a,53117,{value:N});var V=function(e){function t(){var n=e.call(this,53118,"Room completed")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomCompletedError=V,Object.defineProperty(a,53118,{value:V});var F=function(e){function t(){var n=e.call(this,53124,"The AudioOnly flag is not supported for the Room type")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomAudioOnlyFlagNotSupportedError=F,Object.defineProperty(a,53124,{value:F});var B=function(e){function t(){var n=e.call(this,53125,"The track kind is not supported by the Room")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.RoomTrackKindNotSupportedError=B,Object.defineProperty(a,53125,{value:B});var U=function(e){function t(){var n=e.call(this,53200,"Participant identity is invali
1d")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ParticipantIdentityInvalidError=U,Object.defineProperty(a,53200,{value:U});var H=function(e){function t(){var n=e.call(this,53201,"Participant identity is too long")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ParticipantIdentityTooLongError=H,Object.defineProperty(a,53201,{value:H});var W=function(e){function t(){var n=e.call(this,53202,"Participant identity contains invalid characters")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ParticipantIdentityCharsInvalidError=W,Object.defineProperty(a,53202,{value:W});var Q=function(e){function t(){var n=e.call(this,53203,"The maximum number of published tracks allowed in the Room at the same time has been reached")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ParticipantMaxTracksExceededError=Q,Object.defineProperty(a,53203,{value:Q});var G=function(e){function t(){var n=e.call(this,53204,"Participant not found")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ParticipantNotFoundError=G,Object.defineProperty(a,53204,{value:G});var q=function(e){function t(){var n=e.call(this,53205,"Participant disconnected because of duplicate identity")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ParticipantDuplicateIdentityError=q,Object.defineProperty(a,53205,{value:q});var K=function(e){function t(){var n=e.call(this,53300,"Track is invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.TrackInvalidError=K,Object.defineProperty(a,53300,{value:K});var z=function(e){function t(){var n=e.call(this,53301,"Track name is invalid")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.TrackNameInvalidError=z,Object.defineProperty(a,53301,{value:z});var $=function(e){function t(){var n=e.call(this,53302,"Track name is too long")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.TrackNameTooLongError=$,Object.defineProperty(a,53302,{value:$});var J=function(e){function t(){var n=e.call(this,53303,"Track name contains invalid characters")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.TrackNameCharsInvalidError=J,Object.defineProperty(a,53303,{value:J});var Y=function(e){function t(){var n=e.call(this,53304,"Track name is duplicated")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.TrackNameIsDuplicatedError=Y,Object.defineProperty(a,53304,{value:Y});var X=function(e){function t(){var n=e.call(this,53305,"The server has reached capacity and cannot fulfill this request")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.TrackServerTrackCapacityReachedError=X,Object.defineProperty(a,53305,{value:X});var Z=function(e){function t(){var n=e.call(this,53400,"Client is unable to create or apply a local media description")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaClientLocalDescFailedError=Z,Object.defineProperty(a,53400,{value:Z});var ee=function(e){function t(){var n=e.call(this,53401,"Server is unable to create or apply a local media description")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaServerLocalDescFailedError=ee,Object.defineProperty(a,53401,{value:ee});var et=function(e){function t(){var n=e.call(this,53402,"Client is unable to apply a remote media description")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaClientRemoteDescFailedError=et,Object.defineProperty(a,53402,{value:et});var en=function(e){function t(){var n=e.call(this,53403,"Server is unable to apply a remote media description")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaServerRemoteDescFailedError=en,Object.defineProperty(a,53403,{value:en});var er=function(e){function t(){var n=e.call(this,53404,"No supported codec")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaNoSupportedCodecError=er,Object.defineProperty(a,53404,{value:er});var ei=function(e){function t(){var n=e.call(this,53405,"Media connection failed or Media activity ceased")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaConnectionError=ei,Object.defineProperty(a,53405,{value:ei});var eo=function(e){function t(){var n=e.call(this,53407,"Media connection failed due to DTLS handshake failure")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.MediaDTLSTransportFailedError=eo,Object.defineProperty(a,53407,{value:eo});var ea=function(e){function t(){var n=e.call(this,53500,"Unable to acquire configuration")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ConfigurationAcquireFailedError=ea,Object.defineProperty(a,53500,{value:ea});var es=function(e){function t(){var n=e.call(this,53501,"Unable to acquire TURN credentials")||this;return Object.setPrototypeOf(n,t.prototype),n}return i(t,e),t}(o);t.ConfigurationAcquireTurnFailedError=es,Object.defineProperty(a,53501,{value:es})},36196:function(e){"use strict";var t,n=this&&this.__extends||(t=function(e,n){return(t=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,n)},function(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},o=function(e){function t(n){var o=this,a=[].slice.call(arguments,1);Object.setPrototypeOf(o=e.apply(this,i([],r(a)))||this,t.prototype);var s=Error.apply(o,a);return s.name="TwilioError",Object.defineProperty(o,"code",{value:n,enumerable:!0}),Object.getOwnPropertyNames(s).forEach(function(e){Object.defineProperty(this,e,{value:s[e],enumerable:!0})},o),o}return n(t,e),t.prototype.toString=function(){var e=this.message?": "+this.message:"";return this.name+" "+this.code+e},t}(Error);e.exports=o},22665:function(e){"use strict";e.exports={recordingMediaLost:"recording-media-lost"}},324:function(e,t,n){"use strict";var r=n(96971).isNonArrayObject,i=n(62097),o=i.typeErrors,a=i.clientTrackSwitchOffControl,s=i.videoContentPreferencesMode,c=i.subscriptionMode,u=i.trackPriority,l=i.trackSwitchOffMode;function d(e,t,n){return(void 0===n&&(n=[]),void 0===e)?null:null!==e&&r(e)?n.reduce(function(n,r){var i=r.prop,a=r.type,s=r.values;if(n||!(i in e))return n;var c=e[i];return a&&typeof c!==a||"number"===a&&isNaN(c)?o.INVALID_TYPE(t+"."+i,a):Array.isArray(s)&&!s.includes(c)?o.INVALID_VALUE(t+"."+i,s):n},null):o.INVALID_TYPE(t,"object")}t.kG=function(e){var t,n,r,i=d(e,"options.bandwidthProfile");return!e||i||(i=d(e.video,"options.bandwidthProfile.video",[{prop:"contentPreferencesMode",values:Object.values(s)},{prop:"dominantSpeakerPriority",values:Object.values(u)},{prop:"maxSubscriptionBitrate",type:"number"},{prop:"maxTracks",type:"number"},{prop:"mode",values:Object.values(c)},{prop:"clientTrackSwitchOffControl",values:Object.values(a)},{prop:"trackSwitchOffMode",values:Object.values(l)}]))?i:e.video?"maxTracks"in e.video&&"clientTrackSwitchOffControl"in e.video?TypeError("options.bandwidthProfile.video.maxTracks is deprecated. Use options.bandwidthProfile.video.clientTrackSwitchOffControl instead."):"renderDimensions"in e.video&&"contentPreferencesMode"in e.video?TypeError("options.bandwidthProfile.video.renderDimensions is deprecated. Use options.bandwidthProfile.video.contentPreferencesMode instead."):(r=d(t=e.video.renderDimensions,n="options.bandwidthProfile.video.renderDimensions"),t?r||Object.values(u).reduce(function(e,r){return e||d(t[r],n+"."+r,[{prop:"height",type:"number"},{prop:"width",type:"number"}])},null):r):null},t.Wv=function(e,t){if(!(e instanceof t.LocalAudioTrack||e instanceof t.LocalDataTrack||e instanceof t.LocalVideoTrack||e instanceof t.MediaStreamTrack))throw o.INVALID_TYPE("track","LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack")}},14526:function(e){e.exports=function(e,t){if(e&&t){if(e.super_=t,"function"==typeof Object.create)e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}});else{var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}},85021:function(e){var t=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"];function o(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(e,n){for(var r=0;r<i.length;r++){var o=i[r];this[o]=r<e?t:this.methodFactory(o,e,n)}this.log=this.debug}function c(e,t,r){return function(){typeof console!==n&&(s.call(this,t,r),this[e].apply(this,arguments))}}function u(e,i,s){var u;return"debug"===(u=e)&&(u="log"),typeof console!==n&&("trace"===u&&r?a:void 0!==console[u]?o(console,u):void 0!==console.log?o(console,"log"):t)||c.apply(this,arguments)}function l(e,t,r){var o,a=this,c="loglevel";function l(){var e;if(typeof window!==n&&c){try{e=window.localStorage[c]}catch(e){}if(typeof e===n)try{var t=window.document.cookie,r=t.indexOf(encodeURIComponent(c)+"=");-1!==r&&(e=/^([^;]+)/.exec(t.slice(r))[1])}catch(e){}return void 0===a.levels[e]&&(e=void 0),e}}"string"==typeof e?c+=":"+e:"symbol"==typeof e&&(c=void 0),a.name=e,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=r||u,a.getLevel=function(){return o},a.setLevel=function(t,r){if("string"==typeof t&&void 0!==a.levels[t.toUpperCase()]&&(t=a.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=a.levels.SILENT){if(o=t,!1!==r&&function(e){var t=(i[e]||"silent").toUpperCase();if(typeof window!==n&&c){try{window.localStorage[c]=t;return}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+t+";"}catch(e){}}}(t),s.call(a,t,e),typeof console===n&&t<a.levels.SILENT)return"No console available for logging"}
1else throw"log.setLevel() called with invalid level: "+t},a.setDefaultLevel=function(e){l()||a.setLevel(e,!1)},a.enableAll=function(e){a.setLevel(a.levels.TRACE,e)},a.disableAll=function(e){a.setLevel(a.levels.SILENT,e)};var d=l();null==d&&(d=null==t?"WARN":t),a.setLevel(d,!1)}var d=new l,p={};d.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw TypeError("You must supply a name when creating a logger.");var t=p[e];return t||(t=p[e]=new l(e,d.getLevel(),d.methodFactory)),t};var f=typeof window!==n?window.log:void 0;d.noConflict=function(){return typeof window!==n&&window.log===d&&(window.log=f),d},d.getLoggers=function(){return p},d.default=d,e.exports=d},23585:function(e){"use strict";var t="undefined"!=typeof AudioContext?AudioContext:"undefined"!=typeof webkitAudioContext?webkitAudioContext:null,n=function(){function e(n){Object.defineProperties(this,{_AudioContext:{value:(n=Object.assign({AudioContext:t},n)).AudioContext},_audioContext:{value:null,writable:!0},_holders:{value:new Set},AudioContextFactory:{enumerable:!0,value:e}})}return e.prototype.getOrCreate=function(e){if(!this._holders.has(e)&&(this._holders.add(e),this._AudioContext&&!this._audioContext))try{this._audioContext=new this._AudioContext}catch(e){}return this._audioContext},e.prototype.release=function(e){this._holders.has(e)&&(this._holders.delete(e),!this._holders.size&&this._audioContext&&(this._audioContext.close(),this._audioContext=null))},e}();e.exports=new n},40905:function(e){"use strict";e.exports=function(e,t,n){n="number"==typeof n?n:250;var r=e.createMediaStreamSource(t),i=e.createAnalyser();i.fftSize=2048,r.connect(i);var o=new Uint8Array(i.fftSize),a=!1;return setTimeout(function(){a=!0},n),(function e(){var t;return a?Promise.resolve(!0):(i.getByteTimeDomainData(o),o.some(function(e){return 128!==e&&0!==e})?Promise.resolve(!1):(t="number"==typeof t?t:0,new Promise(function(e){return setTimeout(e,t)})).then(e))})().then(function(e){return r.disconnect(),e},function(e){throw r.disconnect(),e})}},26245:function(e,t,n){"use strict";var r=n(40905);e.exports=function(e,t,i,o,a){o="number"==typeof o?o:3;var s=0,c=n(23585),u={},l=c.getOrCreate(u);return(function n(){return t(i).then(function(t){return(i.audio?r(l,t,a).catch(function(t){return e.warn("Encountered an error while detecting silence",t),!0}):Promise.resolve(!1)).then(function(r){return r?o<=0?(e.warn("Got a silent audio MediaStreamTrack. Normally we would try to get a new one, but we've run out of retries; returning it anyway."),t):(e.warn("Got a silent audio MediaStreamTrack. Stopping all MediaStreamTracks and calling getUserMedia again. This is retry #"+ ++s+"."),t.getTracks().forEach(function(e){return e.stop()}),o--,n()):(e.info("Got a non-silent audio MediaStreamTrack; returning it."),t)})})})().then(function(e){return c.release(u),e},function(e){throw c.release(u),e})}},14709:function(e,t,n){"use strict";var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},i=n(67476),o=i.flatMap,a=i.guessBrowser,s=i.guessBrowserVersion,c=n(72728).getSdpFormat,u=a(),l=s(),d="chrome"===u,p="firefox"===u,f="safari"===u,h=d?l.major:null;function v(e){var t=Array.from(e.values()).find(function(e){var t=e.nominated;return"candidate-pair"===e.type&&t});if(!t)return null;var n=e.get(t.localCandidateId),r=e.get(t.remoteCandidateId),i=[{key:"candidateType",type:"string"},{key:"ip",type:"string"},{key:"port",type:"number"},{key:"priority",type:"number"},{key:"protocol",type:"string"},{key:"url",type:"string"}],o=i.concat([{key:"deleted",type:"boolean"},{key:"relayProtocol",type:"string"}]);return[{key:"availableIncomingBitrate",type:"number"},{key:"availableOutgoingBitrate",type:"number"},{key:"bytesReceived",type:"number"},{key:"bytesSent",type:"number"},{key:"consentRequestsSent",type:"number"},{key:"currentRoundTripTime",type:"number"},{key:"lastPacketReceivedTimestamp",type:"number"},{key:"lastPacketSentTimestamp",type:"number"},{key:"nominated",type:"boolean"},{key:"priority",type:"number"},{key:"readable",type:"boolean"},{key:"requestsReceived",type:"number"},{key:"requestsSent",type:"number"},{key:"responsesReceived",type:"number"},{key:"responsesSent",type:"number"},{key:"retransmissionsReceived",type:"number"},{key:"retransmissionsSent",type:"number"},{key:"state",type:"string",fixup:function(e){return"inprogress"===e?"in-
1progress":e}},{key:"totalRoundTripTime",type:"number"},{key:"transportId",type:"string"},{key:"writable",type:"boolean"}].reduce(function(e,n){var r=n.key,i=n.type,o=n.fixup;return e[r]=typeof t[r]===i?o?o(t[r]):t[r]:null,e},{localCandidate:n?o.reduce(function(e,t){var r=t.key,i=t.type;return e[r]=typeof n[r]===i?n[r]:"deleted"!==r&&null,e},{}):null,remoteCandidate:r?i.reduce(function(e,t){var n=t.key,i=t.type;return e[n]=typeof r[n]===i?r[n]:null,e},{}):null})}function m(e){var t=Array.from(e.values()).find(function(e){var t=e.nominated;return"candidate-pair"===e.type&&t});if(!t)return null;var n=e.get(t.localCandidateId),r=e.get(t.remoteCandidateId),i=[{key:"candidateType",type:"string"},{key:"ip",ffKeys:["address","ipAddress"],type:"string"},{key:"port",ffKeys:["portNumber"],type:"number"},{key:"priority",type:"number"},{key:"protocol",ffKeys:["transport"],type:"string"},{key:"url",type:"string"}],o=i.concat([{key:"deleted",type:"boolean"},{key:"relayProtocol",type:"string"}]),a={host:"host",peerreflexive:"prflx",relayed:"relay",serverreflexive:"srflx"};return[{key:"availableIncomingBitrate",type:"number"},{key:"availableOutgoingBitrate",type:"number"},{key:"bytesReceived",type:"number"},{key:"bytesSent",type:"number"},{key:"consentRequestsSent",type:"number"},{key:"currentRoundTripTime",type:"number"},{key:"lastPacketReceivedTimestamp",type:"number"},{key:"lastPacketSentTimestamp",type:"number"},{key:"nominated",type:"boolean"},{key:"priority",type:"number"},{key:"readable",type:"boolean"},{key:"requestsReceived",type:"number"},{key:"requestsSent",type:"number"},{key:"responsesReceived",type:"number"},{key:"responsesSent",type:"number"},{key:"retransmissionsReceived",type:"number"},{key:"retransmissionsSent",type:"number"},{key:"state",type:"string"},{key:"totalRoundTripTime",type:"number"},{key:"transportId",type:"string"},{key:"writable",type:"boolean"}].reduce(function(e,n){var r=n.key,i=n.type;return e[r]=typeof t[r]===i?t[r]:null,e},{localCandidate:n?o.reduce(function(e,t){var r=t.ffKeys,i=t.key,o=t.type,s=r&&r.find(function(e){return e in n})||i;return e[i]=typeof n[s]===o?"candidateType"===s&&a[n[s]]||n[s]:"deleted"!==s&&null,e},{}):null,remoteCandidate:r?i.reduce(function(e,t){var n=t.ffKeys,i=t.key,o=t.type,s=n&&n.find(function(e){return e in r})||i;return e[i]=typeof r[s]===o?"candidateType"===s&&a[r[s]]||r[s]:null,e},{}):null})}function _(e,t,n){var r="local"===n?"getSenders":"getReceivers";if(e[r])return e[r]().map(function(e){return e.track}).filter(function(e){return e&&e.kind===t});var i="audio"===t?"getAudioTracks":"getVideoTracks";return o(e["local"===n?"getLocalStreams":"getRemoteStreams"](),function(e){return e[i]()})}function y(e,t,n){return h&&h<67?new Promise(function(n,r){e.getStats(function(e){var r,i;n([(r=e.result().find(function(e){return"ssrc"===e.type&&e.stat("googTrackId")===t.id}),i={},r&&(i.timestamp=Math.round(Number(r.timestamp)),i=r.names().reduce(function(e,t){switch(t){case"googCodecName":e.codecName=r.stat(t);break;case"googRtt":e.roundTripTime=Number(r.stat(t));break;case"googJitterReceived":e.jitter=Number(r.stat(t));break;case"googFrameWidthInput":e.frameWidthInput=Number(r.stat(t));break;case"googFrameHeightInput":e.frameHeightInput=Number(r.stat(t));break;case"googFrameWidthSent":e.frameWidthSent=Number(r.stat(t));break;case"googFrameHeightSent":e.frameHeightSent=Number(r.stat(t));break;case"googFrameWidthReceived":e.frameWidthReceived=Number(r.stat(t));break;case"googFrameHeightReceived":e.frameHeightReceived=Number(r.stat(t));break;case"googFrameRateInput":e.frameRateInput=Number(r.stat(t));break;case"googFrameRateSent":e.frameRateSent=Number(r.stat(t));break;case"googFrameRateReceived":e.frameRateReceived=Number(r.stat(t));break;case"ssrc":e[t]=r.stat(t);break;case"bytesReceived":case"bytesSent":case"packetsLost":case"packetsReceived":case"packetsSent":case"audioInputLevel":case"audioOutputLevel":e[t]=Number(r.stat(t))}return e},i)),i)])},null,r)}):e.getStats(t).then(function(e){return function(e,t){var n=t.simulateExceptionWhileStandardizingStats;if(void 0!==n&&n)throw Error("Error while gathering stats");var r=null,i=[],o=null,a=null,s=null,c=null,u=null;
1e.forEach(function(e){switch(e.type){case"inbound-rtp":r=e;break;case"outbound-rtp":i.push(e);break;case"media-source":u=e;break;case"track":s=e;break;case"codec":c=e;break;case"remote-inbound-rtp":o=e;break;case"remote-outbound-rtp":a=e}});var l=s?s.remoteSource:!u,d=l?[r]:i,p=[],f=l?a:o;return d.forEach(function(e){var t={},n=[e,u,s,c,f&&f.ssrc===e.ssrc?f:null];function r(e){var t=n.find(function(t){return t&&void 0!==t[e]})||null;return t?t[e]:null}var i=r("ssrc");"number"==typeof i&&(t.ssrc=String(i));var o=r("timestamp");t.timestamp=Math.round(o);var a=r("mimeType");"string"==typeof a&&(a=a.split("/"),t.codecName=a[a.length-1]);var d=r("roundTripTime");"number"==typeof d&&(t.roundTripTime=Math.round(1e3*d));var h=r("jitter");"number"==typeof h&&(t.jitter=Math.round(1e3*h));var v=r("frameWidth");"number"==typeof v&&(l?t.frameWidthReceived=v:(t.frameWidthSent=v,t.frameWidthInput=s?s.frameWidth:u.width));var m=r("frameHeight");"number"==typeof m&&(l?t.frameHeightReceived=m:(t.frameHeightSent=m,t.frameHeightInput=s?s.frameHeight:u.height));var _=r("framesPerSecond");"number"==typeof _&&(t[l?"frameRateReceived":"frameRateSent"]=_);var y=r("bytesReceived");"number"==typeof y&&(t.bytesReceived=y);var g=r("bytesSent");"number"==typeof g&&(t.bytesSent=g);var b=r("packetsLost");"number"==typeof b&&(t.packetsLost=b);var k=r("packetsReceived");"number"==typeof k&&(t.packetsReceived=k);var w=r("packetsSent");"number"==typeof w&&(t.packetsSent=w);var S=r("audioLevel");"number"==typeof S&&(S=Math.round(32767*S),l?t.audioOutputLevel=S:t.audioInputLevel=S);var T=r("totalPacketSendDelay");"number"==typeof T&&(t.totalPacketSendDelay=T);var C=r("totalEncodeTime");"number"==typeof C&&(t.totalEncodeTime=C);var O=r("framesEncoded");"number"==typeof O&&(t.framesEncoded=O);var P=r("estimatedPlayoutTimestamp");"number"==typeof P&&(t.estimatedPlayoutTimestamp=P);var E=r("totalDecodeTime");"number"==typeof E&&(t.totalDecodeTime=E);var R=r("framesDecoded");"number"==typeof R&&(t.framesDecoded=R);var L=r("jitterBufferDelay");"number"==typeof L&&(t.jitterBufferDelay=L);var j=r("jitterBufferEmittedCount");"number"==typeof j&&(t.jitterBufferEmittedCount=j),p.push(t)}),p}(e,n)})}e.exports=function(e,t){var n,i,a,s,u;return e&&"function"==typeof e.getStats?(n=_(e,"audio","local"),i=_(e,"video","local"),a=_(e,"audio"),s=_(e,"video"),u={activeIceCandidatePair:null,localAudioTrackStats:[],localVideoTrackStats:[],remoteAudioTrackStats:[],remoteVideoTrackStats:[]},Promise.all(o([[n,"localAudioTrackStats",!1],[i,"localVideoTrackStats",!1],[a,"remoteAudioTrackStats",!0],[s,"remoteVideoTrackStats",!0]],function(n){var i=r(n,3),o=i[0],a=i[1],s=i[2];return o.map(function(n){return(function(e,t,n){if(void 0===n&&(n={}),void 0!==n.testForChrome||d)return y(e,t,n);if(void 0!==n.testForFirefox||p){var r;return r=n,e.getStats(t).then(function(e){return[function(e,t){void 0===e&&(e=new Map);var n=t.isRemote,r=t.simulateExceptionWhileStandardizingStats;if(void 0!==r&&r)throw Error("Error while gathering stats");var i=null,o=null;e.forEach(function(t){var n=t.isRemote,r=t.remoteId,a=t.type;if(!n)switch(a){case"inbound-rtp":i=t,o=e.get(r);break;case"outbound-rtp":o=t,i=e.get(r)}});var a=n?i:o,s=n?o:i;function c(e){return a&&void 0!==a[e]?a[e]:s&&void 0!==s[e]?s[e]:null}var u={},l=c("timestamp");u.timestamp=Math.round(l);var d=c("ssrc");"number"==typeof d&&(u.ssrc=String(d));var p=c("bytesSent");"number"==typeof p&&(u.bytesSent=p);var f=c("packetsLost");"number"==typeof f&&(u.packetsLost=f);var h=c("packetsSent");"number"==typeof h&&(u.packetsSent=h);var v=c("roundTripTime");"number"==typeof v&&(u.roundTripTime=Math.round(1e3*v));var m=c("jitter");"number"==typeof m&&(u.jitter=Math.round(1e3*m));var _=c("framerateMean");"number"==typeof _&&(u.frameRateSent=Math.round(_));var y=c("bytesReceived");"number"==typeof y&&(u.bytesReceived=y);var g=c("packetsReceived");"number"==typeof g&&(u.packetsReceived=g);var b=c("framerateMean");"number"==typeof b&&(u.frameRateReceived=Math.round(b));var k=c("totalPacketSendDelay");"number"==typeof k&&(u.totalPacketSendDelay=k);var w=c("totalEncodeTime");"number"==typeof w&&(u.totalEncodeTime=w);var S=c("framesEncoded");"number"==typeof S&&(u.framesEncoded=S);var T=c("estimatedPlayoutTimestamp");"number"==typeof T&&(u.estimatedPlayoutTimestamp=T);var C=c("totalDecodeTime");"number"==typeof C&&(u.totalDecodeTime=C);var O=c("framesDecoded");"number"==typeof O&&(u.framesDecoded=O);var P=c("jitterBufferDelay");"number"==typeof P&&(u.jitterBufferDelay=P);var E=c("jitterBufferEmittedCount");return"number"==typeof E&&(u.jitterBufferEmittedCount=E),u}(e,r)]})}return void 0!==n.testForSafari||f?void 0!==n.testForSafari||"unified"===c()?y(e,t,n):Promise.reject(Error("getStats() is not supported on this version of Safari due to this bug: https://bugs.webkit.org/show_bug.cgi?id=192601")):Promise.reject(Error("RTCPeerConnection#get
1Stats() not supported"))})(e,n,Object.assign({isRemote:s},t)).then(function(e){e.forEach(function(e){e.trackId=n.id,u[a].push(e)})})})})).then(function(){var n;return(void 0===(n=t)&&(n={}),void 0!==n.testForChrome||d||void 0!==n.testForSafari||f)?e.getStats().then(v):void 0!==n.testForFirefox||p?e.getStats().then(m):Promise.reject(Error("RTCPeerConnection#getStats() not supported"))}).then(function(e){return u.activeIceCandidatePair=e,u})):Promise.reject(Error("Given PeerConnection does not support getStats"))}},23163:function(e){"use strict";e.exports=function(e){return(void 0===e&&(e={audio:!0,video:!0}),"object"==typeof navigator&&"object"==typeof navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getUserMedia)?navigator.mediaDevices.getUserMedia(e):Promise.reject(Error("getUserMedia is not supported"))}},39778:function(e,t,n){"use strict";var r={};Object.defineProperties(r,{getStats:{enumerable:!0,value:n(14709)},getUserMedia:{enumerable:!0,value:n(23163)},MediaStream:{enumerable:!0,value:n(73401)},MediaStreamTrack:{enumerable:!0,value:n(56299)},RTCIceCandidate:{enumerable:!0,value:n(35320)},RTCPeerConnection:{enumerable:!0,value:n(39125)},RTCSessionDescription:{enumerable:!0,value:n(1716)}}),e.exports=r},73401:function(e){"use strict";"function"==typeof MediaStream?e.exports=MediaStream:e.exports=function(){throw Error("MediaStream is not supported")}},56299:function(e){"use strict";"function"==typeof MediaStreamTrack?e.exports=MediaStreamTrack:e.exports=function(){throw Error("MediaStreamTrack is not supported")}},35320:function(e){"use strict";"function"==typeof RTCIceCandidate?e.exports=RTCIceCandidate:e.exports=function(){throw Error("RTCIceCandidate is not supported")}},6737:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(39732),c=n(87255),u=n(26518),l=n(73401),d=n(75594),p=n(72728),f=p.getSdpFormat,h=p.updatePlanBTrackIdsToSSRCs,v=p.updateUnifiedPlanTrackIdsToSSRCs,m=n(67476),_=m.delegateMethods,y=m.interceptEvent,g=m.isIOSChrome,b=m.legacyPromise,k=m.proxyProperties,w="unified"===f(),S=function(e){function t(t,n){void 0===t&&(t={});var r=e.call(this)||this,i=Object.assign(t.iceTransportPolicy?{iceTransports:t.iceTransportPolicy}:{},t);y(r,"datachannel"),y(r,"signalingstatechange");var s=f(i.sdpSemantics),c=new RTCPeerConnection(i,n);return Object.defineProperties(r,{_appliedTracksToSSRCs:{value:new Map,writable:!0},_localStream:{value:new l},_peerConnection:{value:c},_pendingLocalOffer:{value:null,writable:!0},_pendingRemoteOffer:{value:null,writable:!0},_rolledBackTracksToSSRCs:{value:new Map,writable:!0},_sdpFormat:{value:s},_senders:{value:new Map},_signalingStateLatch:{value:new u},_tracksToSSRCs:{value:new Map,writable:!0}}),c.addEventListener("datachannel",function(e){E(e.channel),r.dispatchEvent(e)}),c.addEventListener("signalingstatechange",function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"stable"===c.signalingState&&(r._appliedTracksToSSRCs=new Map(r._tracksToSSRCs)),r._pendingLocalOffer||r._pendingRemoteOffer||r.dispatchEvent.apply(r,a([],o(e)))}),c.ontrack=function(){},"function"!=typeof c.addTrack&&c.addStream(r._localStream),k(RTCPeerConnection.prototype,r,c),r}return i(t,e),Object.defineProperty(t.prototype,"localDescription",{get:function(){return this._pendingLocalOffer?this._pendingLocalOffer:this._peerConnection.localDescription}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteDescription",{get:function(){return this._pendingRemoteOffer?this._pendingRemoteOffer:this._peerConnection.remoteDescription},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"signalingState",{get:function(){return this._pendingLocalOffer?"have-local-offer":this._pendingRemoteOffer?"have-remote-offer":this._peerConnection.signalingState},enumerable:!1,configurable:!0}),t.prototype.addTrack=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if("function"==typeof this._peerConnection.addTrack)return(t=this._peerConnection).addTrack.apply(t,a([e],o(n)));if("closed"===this._peerConnection.signalingState)throw Error("Cannot add MediaStreamTrack ["+e.id+", \n        "+e.kind+"]: RTCPeerConnection is closed");var i=this._senders.get(e);if(i&&i.track)throw Error("Cannot add MediaStreamTrack ['"+e.id+", \n        "+e.kind+"]: RTCPeerConnection already has it");return this._peerConnection.removeStream(this._localStream),this._localStream.addTrack(e),this._peerConnection.addStream(this._localStream),i=new d(e),this._senders.set(e,i),i},t.prototype.removeTrack=function(e){if("closed"===this._peerConnection.signalingState)throw Error("Cannot remove MediaStreamTrack: RTCPeerConnection is closed");if("function"==typeof this._peerConnection.addTrack)try{return this._peerConnection.removeTrack(e)}catch(e){}else{var t=e.track;if(!t)return;(e=this._senders.get(t))&&e.track&&(e.track=null,this._peerConnection.removeStream(this._localStream),this._localStream.removeTrack(t),this._peerConnection.addStream(this._localStream))}},t.prototype.getSenders=function(){return"function"==typeof this._peerConnection.addTrack?this._peerConnection.getSenders():Array.from(this._senders.values())},t.prototype.addIceCandidate=function(e){for(var t,n=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return t="have-remote-offer"===this.signalingState?this._signalingStateLatch.when("low").then(function(){return n._peerConnection.addIceCandidate(e)}):this._peerConnection.addIceCandidate(e),r.length>0?b.apply(void 0,a([t],o(r))):t},t.prototype.close=function(){"closed"!==this.signalingState&&(this._pendingLocalOffer=null,this._pendingRemoteOffer=null,this._peerConnection.close())},t.prototype.createAnswer=function(){for(var e,t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e=this._pendingRemoteOffer?this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function(){return t._signalingStateLatch.lower(),t._peerConnection.createAnswer()}).then(function(e){return t._pendingRemoteOffer=null,t._rolledBackTracksToSSRCs.clear(),new s({type:"answer",sdp:R(t._sdpFormat,t._tracksToSSRCs,e.sdp)})},function(e){throw t._pendingRemoteOffer=null,e}):this._peerConnection.createAnswer().then(function(e){return t._rolledBackTracksToSSRCs.clear(),new s({type:"answer",sdp:R(t._sdpFormat,t._tracksToSSRCs,e.sdp)})}),n.length>1?b.apply(void 0,a([e],o(n))):e},t.prototype.createOffer=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=o(t,3),i=r[0],a=r[1],c=r[2]||i||{};if(g()){if(c.offerToReceiveVideo&&!this._audioTransceiver&&!(w&&C(this,"audio"))){delete c.offerToReceiveAudio;try{this._audioTransceiver=w?this.addTransceiver("audio",{direction:"recvonly"}):this.addTransceiver("audio")}catch(e){return Promise.reject(e)}}if(c.offerToReceiveVideo&&!this._videoTransceiver&&!(w&&C(this,"video"))){delete c.offerToReceiveVideo;try{this._videoTransceiver=w?this.addTransceiver("video",{direction:"recvonly"}):this.addTransceiver("video")}catch(e){return Promise.reject(e)}}}var u=this._peerConnection.createOffer(c).then(function(t){return e._rolledBackTracksToSSRCs.clear(),new s({type:t.type,sdp:R(e._sdpFormat,e._tracksToSSRCs,t.sdp)})});return t.length>1?b(u,i,a):u},t.prototype.createDataChannel=function(e,t){n=Object.assign({},n=t),P()&&"maxPacketLifeTime"in n&&(n.maxRetransmitTime=n.maxPacketLifeTime),t=n;var n,r=this._peerConnection.createDataChannel(e,t);return E(r),r},t.prototype.setLocalDescription=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o(e,3),r=n[0],i=n[1],a=n[2];this._rolledBackTracksToSSRCs.size>0&&(this._tracksToSSRCs=new Map(this._rolledBackTracksToSSRCs),this._rolledBackTracksToSSRCs.clear());var s=T(this,!0,r);return e.length>1?b(s,i,a):s},t.prototype.setRemoteDescription=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o(e,3),r=n[0],i=n[1],a=n[2];this._rolledBackTracksToSSRCs.clear();var s=T(this,!1,r);return e.length>1?b(s,i,a):s},t}(c);function T(e,t,n){var r,i=t?e._pendingLocalOffer:e._pendingRemoteOffer,o=t?e._pendingRemoteOffer:e._pendingLocalOffer,a=t?"have-local-offer":"have-remote-offer";if(!t&&o&&"answer"===n.type)s=e._pendingLocalOffer,r=e._peerConnection.setLocalDescription(s).then(function(){return e._pendingLocalOffer=null,e.setRemoteDescription(n)}).then(function(){e._signalingStateLatch.lower()});else if("offer"===n.type){if(e.signalingState!==a&&"stable"!==e.signalingState)return Promise.reject(Error("Cannot set "+(t?"local":"remote")+" offer in state "+e.signalingState));i||"low"!==e._signalingStateLatch.state||e._signalingStateLatch.raise();var s,c,u=e.signalingState;c=O(n),t?e._pendingLocalOffer=c:e._pendingRemoteOffer=c,r=Promise.resolve(),e.signalingState!==u&&r.then(function(){return e.dispatchEvent(new Event("signalingstatechange"))})}else"rollback"===n.type&&(e.signalingState!==a?r=Promise.reject(Error("Cannot rollback "+(t?"local":"remote")+" description in "+e.signalingState)):(t?e._pendingLocalOffer=null:e._pendingRemoteOffer=null,e._rolledBackTracksToSSRCs=new Map(e._tracksToSSRCs),e._tracksToSSRCs=new Map(e._appliedTracksToSSRCs),(r=Promise.resolve()).then(function(){return e.dispatchEvent(new Event("signalingstatechange"))})));return r||e._peerConnection[t?"setLocalDescription":"setRemoteDescription"](O(n))}function C(e,t){return!!e.getTransceivers().find(function(e){var n=e.receiver,r=(void 0===n?{}:n).track;return(void 0===r?{}:r).kind===t})}function O(e){return e instanceof s&&e._description?e._description:new RTCSessionDescription(e)}function P(){return"maxRetransmitTime"in RTCDataChannel.prototype&&!("maxPacketLifeTime"in RTCDataChannel.prototype)}function E(e){return Object.defineProperty(e,"maxRetransmits",{value:65535===e.maxRetransmits?null:e.maxRetransmits}),P()&&Object.defineProperty(e,"maxPacketLifeTime",{value:65535===e.maxRetransmitTime?null:e.maxRetransmitTime}),e}function R(e,t,n){return"unified"===e?v(t,n):h(t,n)}_(RTCPeerConnection.prototype,S.prototype,"_peerConnection"),e.exports=S},76376:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(87255),c=n(99169),u=n(72728).updateUnifiedPlanTrackIdsToSSRCs,l=n(67476),d=l.delegateMethods,p=l.interceptEvent,f=l.legacyPromise,h=l.proxyProperties,v=function(e){function t(t){var n,r=e.call(this)||this;p(r,"signalingstatechange");var i=new RTCPeerConnection(t);return Object.defineProperties(r,{_initiallyNegotiatedDtlsRole:{value:null,writable:!0},_isClosed:{value:!1,writable:!0},_peerConnection:{value:i},_rollingBack:{value:!1,writable:!0},_tracksToSSRCs:{value:new Map},peerIdentity:{enumerable:!0,value:Promise.resolve({idp:"",name:""})}}),i.addEventListener("signalingstatechange",function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r._rollingBack||r.signalingState===n||(n=r.signalingState,r._isClosed?setTimeout(function(){return r.dispatchEvent.apply(r,a([],o(e)))}):r.dispatchEvent.apply(r,a([],o(e))))}),h(RTCPeerConnection.prototype,r,i),r}return i(t,e),Object.defineProperty(t.prototype,"iceGatheringState",{get:function(){return this._isClosed?"complete":this._peerConnection.iceGatheringState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localDescription",{get:function(){return y(this._peerConnection.localDescription,this._initiallyNegotiatedDtlsRole)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"signalingState",{get:function(){return this._isClosed?"closed":this._peerConnection.signalingState},enumerable:!1,configurable:!0}),t.prototype.createAnswer=function(){for(var e,t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e=this._peerConnection.createAnswer().then(function(e){return _(t,e),y(e,t._initiallyNegotiatedDtlsRole)}),"function"==typeof n[0]?f.apply(void 0,a([e],o(n))):e},t.prototype.createOffer=function(){for(var e,t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=o(n,3),a=i[0],s=i[1],l=i[2]||a||{};return e=(e="have-local-offer"===this.signalingState||"have-remote-offer"===this.signalingState?m(this,"have-local-offer"===this.signalingState,function(){return t.createOffer(l)}):this._peerConnection.createOffer(l)).then(function(e){return new c({type:e.type,sdp:u(t._tracksToSSRCs,e.sdp)})}),n.length>1?f(e,a,s):e},t.prototype.setLocalDescription=function(){for(var e,t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=o(n),s=i[0],c=i.slice(1);return(s&&"answer"===s.type&&"have-local-offer"===this.signalingState&&(t=Promise.reject(Error("Cannot set local answer in state have-local-offer"))),t)?n.length>1?f.apply(void 0,a([t],o(c))):t:(e=this._peerConnection).setLocalDescription.apply(e,a([],o(n)))},t.prototype.setRemoteDescription=function(){for(var e,t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=o(n),s=i[0],c=i.slice(1);return s&&"have-remote-offer"===this.signalingState&&("answer"===s.type?e=Promise.reject(Error("Cannot set remote answer in state have-remote-offer")):"offer"===s.type&&(e=m(this,!1,function(){return t._peerConnection.setRemoteDescription(s)}))),e||(e=this._peerConnection.setRemoteDescription(s)),e=e.then(function(){return _(t,s,!0)}),n.length>1?f.apply(void 0,a([e],o(c))):e},t.prototype.close=function(){"closed"!==this.signalingState&&(this._isClosed=!0,this._peerConnection.close())},t}(s);function m(e,t,n){return e._rollingBack=!0,e._peerConnection[t?"setLocalDescription":"setRemoteDescription"](new c({type:"rollback"})).then(n).then(function(t){return e._rollingBack=!1,t},function(t){throw e._rollingBack=!1,t})}function _(e,t,n){if(!e._initiallyNegotiatedDtlsRole&&"offer"!==t.type){var r=t.sdp.match(/a=setup:([a-z]+)/);if(r){var i=r[1];e._initiallyNegotiatedDtlsRole=n?({active:"passive",passive:"active"})[i]:i}}}function y(e,t){return e&&"answer"===e.type&&t?new c({type:e.type,sdp:e.sdp.replace(/a=setup:[a-z]+/g,"a=setup:"+t)}):e}d(RTCPeerConnection.prototype,v.prototype,"_peerConnection"),e.exports=v},39125:function(e,t,n){"use strict";if("function"==typeof RTCPeerConnection)switch((0,n(67476).guessBrowser)()){case"chrome":e.exports=n(6737);break;case"firefox":e.exports=n(76376);break;case"safari":e.exports=n(73768);break;default:e.exports=RTCPeerConnection}else e.exports=function(){throw Error("RTCPeerConnection is not supported")}},73768:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e},s=n(87255),c=n(26518),u=n(72728),l=u.getSdpFormat,d=u.updatePlanBTrackIdsToSSRCs,p=u.updateUnifiedPlanTrackIdsToSSRCs,f=n(67476),h=f.delegateMethods,v=f.interceptEvent,m=f.proxyProperties,_="unified"===l(),y=_?p:d,g=function(e){function t(t){var n=e.call(this)||this;v(n,"datachannel"),v(n,"iceconnectionstatechange"),v(n,"signalingstatechange"),v(n,"track");var r=new RTCPeerConnection(t);return Object.defineProperties(n,{_appliedTracksToSSRCs:{value:new Map,writable:!0},_audioTransceiver:{value:null,writable:!0},_isClosed:{value:!1,writable:!0},_peerConnection:{value:r},_pendingLocalOffer:{value:null,writable:!0},_pendingRemoteOffer:{value:null,writable:!0},_rolledBackTracksToSSRCs:{value:new Map,writable:!0},_signalingStateLatch:{value:new c},_tracksToSSRCs:{value:new Map,writable:!0},_videoTransceiver:{value:null,writable:!0}}),r.addEventListener("datachannel",function(e){w(e.channel),n.dispatchEvent(e)}),r.addEventListener("iceconnectionstatechange",function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];n._isClosed||n.dispatchEvent.apply(n,a([],o(e)))}),r.addEventListener("signalingstatechange",function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!n._isClosed&&("stable"===r.signalingState&&(n._appliedTracksToSSRCs=new Map(n._tracksToSSRCs)),n._pendingLocalOffer||n._pendingRemoteOffer||n.dispatchEvent.apply(n,a([],o(e))))}),r.addEventListener("track",function(e){n._pendingRemoteOffer=null,n.dispatchEvent(e)}),m(RTCPeerConnection.prototype,n,r),n}return i(t,e),Object.defineProperty(t.prototype,"localDescription",{get:function(){return this._pendingLocalOffer||this._peerConnection.localDescription},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iceConnectionState",{get:function(){return this._isClosed?"closed":this._peerConnection.iceConnectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iceGatheringState",{get:function(){return this._isClosed?"complete":this._peerConnection.iceGatheringState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteDescription",{get:function(){return this._pendingRemoteOffer||this._peerConnection.remoteDescription},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"signalingState",{get:function(){return this._isClosed?"closed":this._pe
1ndingLocalOffer?"have-local-offer":this._pendingRemoteOffer?"have-remote-offer":this._peerConnection.signalingState},enumerable:!1,configurable:!0}),t.prototype.addIceCandidate=function(e){var t=this;return"have-remote-offer"===this.signalingState?this._signalingStateLatch.when("low").then(function(){return t._peerConnection.addIceCandidate(e)}):this._peerConnection.addIceCandidate(e)},t.prototype.createOffer=function(e){var t=this;if((e=Object.assign({},e)).offerToReceiveVideo&&!this._audioTransceiver&&!(_&&k(this,"audio"))){delete e.offerToReceiveAudio;try{this._audioTransceiver=_?this.addTransceiver("audio",{direction:"recvonly"}):this.addTransceiver("audio")}catch(e){return Promise.reject(e)}}if(e.offerToReceiveVideo&&!this._videoTransceiver&&!(_&&k(this,"video"))){delete e.offerToReceiveVideo;try{this._videoTransceiver=_?this.addTransceiver("video",{direction:"recvonly"}):this.addTransceiver("video")}catch(e){return Promise.reject(e)}}return this._peerConnection.createOffer(e).then(function(e){return t._rolledBackTracksToSSRCs.clear(),new RTCSessionDescription({type:e.type,sdp:y(t._tracksToSSRCs,e.sdp)})})},t.prototype.createAnswer=function(e){var t=this;return this._pendingRemoteOffer?this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function(){return t._signalingStateLatch.lower(),t._peerConnection.createAnswer()}).then(function(e){return t._pendingRemoteOffer=null,t._rolledBackTracksToSSRCs.clear(),_?new RTCSessionDescription({type:e.type,sdp:y(t._tracksToSSRCs,e.sdp)}):e},function(e){throw t._pendingRemoteOffer=null,e}):this._peerConnection.createAnswer(e).then(function(e){return t._rolledBackTracksToSSRCs.clear(),_?new RTCSessionDescription({type:e.type,sdp:y(t._tracksToSSRCs,e.sdp)}):e})},t.prototype.createDataChannel=function(e,t){var n=this._peerConnection.createDataChannel(e,t);return w(n),n},t.prototype.removeTrack=function(e){e.replaceTrack(null),this._peerConnection.removeTrack(e)},t.prototype.setLocalDescription=function(e){return this._rolledBackTracksToSSRCs.size>0&&(this._tracksToSSRCs=new Map(this._rolledBackTracksToSSRCs),this._rolledBackTracksToSSRCs.clear()),b(this,!0,e)},t.prototype.setRemoteDescription=function(e){return this._rolledBackTracksToSSRCs.clear(),b(this,!1,e)},t.prototype.close=function(){var e=this;this._isClosed||(this._isClosed=!0,this._peerConnection.close(),setTimeout(function(){e.dispatchEvent(new Event("iceconnectionstatechange")),e.dispatchEvent(new Event("signalingstatechange"))}))},t}(s);function b(e,t,n){var r,i=t?e._pendingLocalOffer:e._pendingRemoteOffer,o=t?e._pendingRemoteOffer:e._pendingLocalOffer,a=t?"have-local-offer":"have-remote-offer";if(!t&&o&&"answer"===n.type)return r=e._pendingLocalOffer,e._peerConnection.setLocalDescription(r).then(function(){return e._pendingLocalOffer=null,e.setRemoteDescription(n)}).then(function(){return e._signalingStateLatch.lower()});if("offer"===n.type){if(e.signalingState!==a&&"stable"!==e.signalingState)return Promise.reject(Error("Cannot set "+(t?"local":"remote")+"\n        offer in state "+e.signalingState));i||"low"!==e._signalingStateLatch.state||e._signalingStateLatch.raise();var s=e.signalingState;return(t?e._pendingLocalOffer=n:e._pendingRemoteOffer=n,e.signalingState!==s)?Promise.resolve().then(function(){return e.dispatchEvent(new Event("signalingstatechange"))}):Promise.resolve()}return"rollback"===n.type?e.signalingState!==a?Promise.reject(Error("Cannot rollback \n        "+(t?"local":"remote")+" description in "+e.signalingState)):(t?e._pendingLocalOffer=null:e._pendingRemoteOffer=null,e._rolledBackTracksToSSRCs=new Map(e._tracksToSSRCs),e._tracksToSSRCs=new Map(e._appliedTracksToSSRCs),Promise.resolve().then(function(){return e.dispatchEvent(new Event("signalingstatechange"))})):e._peerConnection[t?"setLocalDescription":"setRemoteDescription"](n)}function k(e,t){return!!e.getTransceivers().find(function(e){var n=e.receiver,r=(void 0===n?{}:n).track;return(void 0===r?{}:r).kind===t})}function w(e){return Object.defineProperties(e,{maxPacketLifeTime:{value:65535===e.maxPacketLifeTime?null:e.maxPacketLifeTime},maxRetransmits:{value:65535===e.maxRetransmits?null:e.maxRetransmits}})}h(RTCPeerConnection.prototype,g.prototype,"_peerConnection"),e.exports=g},75594:function(e){"use strict";e.exports=function(e){Object.defineProperties(this,{track:{enumerable:!0,value:e,writable:!0}})}},39732:function(e){"use strict";var t=function(){function e(e){this.descriptionInitDict=e;var t=e&&"rollback"===e.type?null:new RTCSessionDescription(e);Object.defineProperties(this,{_description:{get:function(){return t}}})}return Object.defineProperty(e.prototype,"sdp",{get:function(){return this._description?this._description.sdp:this.descriptionInitDict.sdp}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._description?this._description.type:this.descriptionInitDict.type},enumerable:!1,configurable:!0}),e}();e.exports=t},99169:function(e){"use strict";e.exports=RTCSessionDescription},1716:function(e,t,n){"use strict";if("function"==typeof RTCSessionDescription)switch((0,n(67476).guessBrowser)()){case"chrome":e.exports=n(39732);break;case"firefox":e.exports=n(99169);break;default:e.exports=RTCSessionDescription}else e.exports=function(){throw Error("RTCSessionDescription is not supported")}},67476:function(e,t){"use strict";var n=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a},r=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};function i(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:null}function o(e){return(void 0===e&&(e=i()),/Chrome|CriOS/.test(e))?"chrome":/Firefox|FxiOS/.test(e)?"firefox":/Safari|iPhone|iPad|iPod/.test(e)?"safari":null}var a=new Map;t.clearCachedSupportedCodecs=function(){a.clear()},t.defer=function(){var e={};return e.promise=new Promise(function(t,n){e.resolve=t,e.reject=n}),e},t.delegateMethods=function(e,t,n){for(var r in e)!function(e,t,n,r){if(!(r in t||r.match(/^on[a-z]+$/))){var i,o=!1;try{var a=Object.getOwnPropertyDescriptor(e,r);o=a&&!!a.get}catch(e){}if(!o){try{i=typeof e[r]}catch(e){}"function"===i&&(t[r]=function(){return this[n][r].apply(this[n],arguments)})}}}(e,t,n,r)},t.difference=function(e,t){e=new Set(Array.isArray(e)?e:e.values()),t=new Set(Array.isArray(t)?t:t.values());var n=new Set;return e.forEach(function(e){t.has(e)||n.add(e)}),n},t.flatMap=function(e,t){return(e instanceof Map||e instanceof Set?Array.from(e.values()):e).reduce(function(e,n){return e.concat(t(n))},[])},t.guessBrowser=o,t.guessBrowserVersion=function(e){void 0===e&&(e=i());var t={chrome:"Chrome|CriOS",firefox:"Firefox|FxiOS",safari:"Version"}[o(e)];if(!t)return null;var r=RegExp("("+t+")/([^\\s]+)"),a=n(e.match(r)||[],3)[2];if(!a)return null;var s=a.split(".").map(Number);return{major:isNaN(s[0])?null:s[0],minor:isNaN(s[1])?null:s[1]}},t.isCodecSupported=function(e,t){var n=a.get(t);return n?Promise.resolve(n.has(e.toLowerCase())):(function(e){if("undefined"!=typeof RTCRtpSender&&"function"==typeof RTCRtpSender.getCapabilities)return Promise.resolve(new Set(RTCRtpSender.getCapabilities(e).codecs.map(function(e){return e.mimeType.split("/")[1].toLowerCase()})));if("undefined"==typeof RTCPeerConnection||void 0===RTCPeerConnection.prototype||"function"!=typeof RTCPeerConnection.prototype.addTransceiver||"function"!=typeof RTCPeerConnection.prototype.close||"function"!=typeof RTCPeerConnection.prototype.createOffer)return Promise.resolve(new Set);var t=new RTCPeerConnection;return t.addTransceiver(e),t.createOffer().then(function(e){var n=e.sdp;return t.close(),new Set((n.match(/^a=rtpmap:.+$/gm)||[]).map(function(e){return e.match(/^a=rtpmap:.+ ([^/]+)/)[1].toLowerCase()}))},function(){return t.close(),new Set})})(t).then(function(n){return a.set(t,n),n.has(e.toLowerCase())})},t.isIOSChrome=function(e){return void 0===e&&(e=i()),/Mobi/.test(e)&&"chrome"===o()&&/iPad|iPhone|iPod/.test(e)},t.interceptEvent=function(e,t){var n=null;Object.defineProperty(e,"on"+t,{get:function(){return n},set:function(e){n&&this.removeEventListener(t,n),"function"==typeof e?(n=e,this.addEventListener(t,n)):n=null}})},t.legacyPromise=function(e,t,n){return t?e.then(t,n):e},t.makeUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t.proxyProperties=function(e,t,i){Object.getOwnPropertyNames(e).forEach(function(e){(function(e,t,i,o){if(!(o in t)){if(o.match(/^on[a-z]+$/)){Object.defineProperty(t,o,{value:null,writable:!0}),i.addEventListener(o.slice(2),function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.dispatchEvent.apply(t,r([],n(e)))});return}Object.defineProperty(t,o,{enumerable:!0,get:function(){return i[o]}})}})(0,t,i,e)})},t.support=function(){return"object"==typeof navigator&&"object"==typeof navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getUserMedia&&"function"==typeof RTCPeerConnection}},26518:function(e,t,n){"use strict";var r=n(67476).defer,i={high:new Set(["low"]),low:new Set(["high"])},o=function(){function e(e){void 0===e&&(e="low");var t=e;Object.defineProperties(this,{_state:{set:function(e){var n=this;if(t!==e){t=e;var r=this._whenDeferreds.get(t);r.forEach(function(e){return e.resolve(n)}),r.clear()}},get:function(){return t}},_whenDeferreds:{value:new Map([["high",new Set],["low",new Set]])}})}return Object.defineProperty(e.prototype,"state",{get:function(){return this._state}
1,enumerable:!1,configurable:!0}),e.prototype.lower=function(){return this.transition("low")},e.prototype.raise=function(){return this.transition("high")},e.prototype.transition=function(e){if(!i[this.state].has(e))throw a(this.state,e);return this._state=e,this},e.prototype.when=function(e){if(this.state===e)return Promise.resolve(this);if(!i[this.state].has(e))return Promise.reject(a(this.state,e));var t=r();return this._whenDeferreds.get(e).add(t),t.promise},e}();function a(e,t){return Error('Cannot transition from "'+e+'" to "'+t+'"')}e.exports=o},72728:function(e,t,n){"use strict";var r=n(67476),i=r.flatMap,o=r.guessBrowser,a=null,s=null;function c(e,t){return(t.match(RegExp(e,"gm"))||[]).reduce(function(t,n){var r=n.match(new RegExp(e));return r?t.add(r[1]):t},new Set)}function u(e){return c("^a=ssrc:[0-9]+ +msid:.+ +(.+) *$",e)}function l(e){return c("^a=msid:.+ +(.+) *$",e)}function d(e,t){return c("^a=ssrc:([0-9]+) +msid:[^ ]+ +"+t+" *$",e)}function p(e,t,n){return void 0===t&&(t=".*"),void 0===n&&(n=".*"),e.split("\r\nm=").slice(1).map(function(e){return"m="+e}).filter(function(e){var r=RegExp("m="+t,"gm"),i=RegExp("a="+n,"gm");return r.test(e)&&i.test(e)})}function f(e){return Array.from(c("^a=ssrc:([0-9]+) +.*$",e))}function h(e,t){var n=p(e),r=RegExp("^a=msid:[^ ]+ +"+t+" *$","gm");return new Set(i(n.filter(function(e){return e.match(r)}),f))}function v(e,t,n){return new Map(Array.from(e(n)).map(function(e){return[e,t(n,e)]}))}function m(e){return v(u,d,e)}function _(e){return v(l,h,e)}function y(e,t,n){var r=e(n),i=new Map;r.forEach(function(e,r){if(!t.has(r)){t.set(r,e);return}var o=Array.from(t.get(r)),a=Array.from(e);o.forEach(function(e,t){var r=a[t];i.set(r,e);var o="^a=ssrc:"+r+" (.*)$";n=n.replace(RegExp(o,"gm"),"a=ssrc:"+e+" $1")})});var o="^(a=ssrc-group:[^ ]+ +)(.*)$";return(n.match(RegExp(o,"gm"))||[]).forEach(function(e){var t=e.match(new RegExp(o));if(t){var r=t[1],a=t[2].split(" ").map(function(e){return i.get(e)||e}).join(" ");n=n.replace(t[0],r+a)}}),n}t.clearChromeCachedSdpFormat=function(){s=null},t.getSdpFormat=function(e){return({chrome:e&&function(){if("boolean"==typeof a)return a;if("undefined"==typeof RTCPeerConnection)return a=!1;try{new RTCPeerConnection({sdpSemantics:"foo"}),a=!1}catch(e){a=!0}return a}()?({"plan-b":"planb","unified-plan":"unified"})[e]:function(){if(!s){if("undefined"!=typeof RTCPeerConnection&&"addTransceiver"in RTCPeerConnection.prototype){var e=new RTCPeerConnection;try{e.addTransceiver("audio"),s="unified"}catch(e){s="planb"}e.close()}else s="planb"}return s}(),firefox:"unified",safari:"undefined"!=typeof RTCRtpTransceiver&&"currentDirection"in RTCRtpTransceiver.prototype?"unified":"planb"})[o()]||null},t.getMediaSections=p,t.getPlanBTrackIds=u,t.getUnifiedPlanTrackIds=l,t.getPlanBSSRCs=d,t.getUnifiedPlanSSRCs=h,t.updatePlanBTrackIdsToSSRCs=function(e,t){return y(m,e,t)},t.updateUnifiedPlanTrackIdsToSSRCs=function(e,t){return y(_,e,t)}},39990:function(e){e.exports=WebSocket},61202:function(e,t,n){"use strict";n.d(t,{o:function(){return i}});class r extends Error{}function i(e,t){let n;if("string"!=typeof e)throw new r("Invalid token specified: must be a string");t||(t={});let i=!0===t.header?0:1,o=e.split(".")[i];if("string"!=typeof o)throw new r(`Invalid token specified: missing part #${i+1}`);try{n=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var n;return n=t,decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}catch(e){return atob(t)}}(o)}catch(e){throw new r(`Invalid token specified: invalid base64 for part #${i+1} (${e.message})`)}try{return JSON.parse(n)}catch(e){throw new r(`Invalid token specified: invalid json for part #${i+1} (${e.message})`)}}r.prototype.name="InvalidTokenError"},1730:function(e){"use strict";e.exports=JSON.parse('{"name":"twilio-video","title":"Twilio Video","description":"Twilio Video JavaScript Library","version":"2.28.1","homepage":"https://twilio.com","author":"Mark Andrus Roberts <[email protected]>","contributors":["Ryan Rowland <[email protected]>","Manjesh Malavalli <[email protected]>","Makarand Patwardhan <[email protected]>"],"keywords":["twilio","webrtc","library","javascript","video","rooms"],"repository":{"type":"git","url":"https://github.com/twilio/twilio-video.js.git"},"devDependencies":{"@babel/core":"^7.14.2","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-proposal-object-rest-spread":"^7.20.7","@babel/preset-env":"^7.14.2","@babel/preset-typescript":"^7.13.0","@types/express":"^4.11.0","@types/node":"^8.5.1","@types/selenium-webdriver":"^3.0.8","@types/ws":"^3.2.1","@typescript-eslint/eslint-plugin":"^4.13.0","@typescript-eslint/parser":"^4.0.0","babel-cli":"^6.26.0","babel-preset-es2015":"^6.24.1","browserify":"^17.0.0","cheerio":"^0.22.0","cors":"^2.8.5","electron":"^17.2.0","envify":"^4.0.0","eslint":"^6.2.1","eslint-config-standard":"^14.0.0","eslint-plugin-import":"^2.18.2","eslint-plugin-node":"^9.1.0","eslint-plugin-
1promise":"^4.2.1","eslint-plugin-standard":"^4.0.1","express":"^4.16.2","glob":"^7.1.7","ink-docstrap":"^1.3.2","inquirer":"^7.0.0","is-docker":"^2.0.0","jsdoc":"^3.5.5","jsdoc-babel":"^0.5.0","json-loader":"^0.5.7","karma":"6.4.1","karma-browserify":"^8.0.0","karma-chrome-launcher":"^2.0.0","karma-edgium-launcher":"^4.0.0-0","karma-electron":"^6.1.0","karma-firefox-launcher":"^1.3.0","karma-htmlfile-reporter":"^0.3.8","karma-junit-reporter":"^1.2.0","karma-mocha":"^1.3.0","karma-safari-launcher":"^1.0.0","karma-spec-reporter":"0.0.32","karma-typescript":"^5.5.1","karma-typescript-es6-transform":"^5.5.1","mocha":"^3.2.0","mock-require":"^3.0.3","ncp":"^2.0.0","node-http-server":"^8.1.2","npm-run-all":"^4.0.2","nyc":"^15.1.0","requirejs":"^2.3.3","rimraf":"^2.6.1","simple-git":"^1.126.0","sinon":"^4.0.1","ts-node":"4.0.1","tslint":"5.8.0","twilio":"^3.49.0","twilio-release-tool":"^1.0.2","typescript":"4.2.2","uglify-js":"^2.8.22","vinyl-fs":"^2.4.4","vinyl-source-stream":"^1.1.0","watchify":"^3.11.1","webrtc-adapter":"^7.7.1"},"engines":{"node":">=0.12"},"license":"BSD-3-Clause","main":"./es5/index.js","types":"./tsdef/index.d.ts","scripts":{"lint:js":"eslint ./lib ./test/*.js ./docker/**/*.js ./test/framework/*.js ./test/lib/*.js ./test/integration/** ./test/unit/** ","lint:ts":"eslint ./tsdef/*.ts ./lib/**/*.ts","lint":"npm-run-all lint:js lint:ts","printVersion":"node --version && npm --version","test:unit":"npm-run-all printVersion build:es5 && nyc --report-dir=./coverage --include=lib/**/* --reporter=html --reporter=lcov --reporter=text mocha -r ts-node/register ./test/unit/*","test:unit:quick":"nyc --report-dir=./coverage --include=lib/**/* --reporter=html --reporter=lcov mocha -r ts-node/register","test:serversiderender":"mocha ./test/serversiderender/index.js","test:integration:adapter":"node ./scripts/karma.js karma/integration.adapter.conf.js","test:integration":"npm run build:es5 && node ./scripts/karma.js karma/integration.conf.js","test:umd:install":"npm install [email protected]","test:umd":"mocha ./test/umd/index.js","test:crossbrowser:build:clean":"rimraf ./test/crossbrowser/lib ./test/crossbrowser/src/browser/index.js","test:crossbrowser:build:lint":"cd ./test/crossbrowser && tslint --project tsconfig.json","test:crossbrowser:build:tsc":"cd ./test/crossbrowser && tsc","test:crossbrowser:build:browser":"cd ./test/crossbrowser && browserify lib/crossbrowser/src/browser/index.js > src/browser/index.js","test:crossbrowser:build":"npm-run-all test:crossbrowser:build:*","test:crossbrowser:test":"cd ./test/crossbrowser && mocha --compilers ts:ts-node/register test/integration/spec/**/*.ts","test:crossbrowser":"npm-run-all test:crossbrowser:*","test:sdkdriver:build:clean":"rimraf ./test/lib/sdkdriver/lib ./test/lib/sdkdriver/test/integration/browser/index.js","test:sdkdriver:build:lint":"cd ./test/lib/sdkdriver && tslint --project tsconfig.json","test:sdkdriver:build:tsc":"cd ./test/lib/sdkdriver && tsc --rootDir src","test:sdkdriver:build":"npm-run-all test:sdkdriver:build:*","test:sdkdriver:test:unit":"cd ./test/lib/sdkdriver && mocha --compilers ts:ts-node/register test/unit/spec/**/*.ts","test:sdkdriver:test:integration:browser":"cd ./test/lib/sdkdriver/test/integration && browserify browser/browser.js > browser/index.js","test:sdkdriver:test:integration:run":"cd ./test/lib/sdkdriver && mocha --compilers ts:ts-node/register test/integration/spec/**/*.ts","test:sdkdriver:test:integration":"npm-run-all test:sdkdriver:test:integration:*","test:sdkdriver:test":"npm-run-all test:sdkdriver:test:*","test:sdkdriver":"npm-run-all test:sdkdriver:*","test:framework:angular:install":"cd ./test/framework/twilio-video-angular && rimraf ./node_modules package-lock.json && npm install","test:framework:angular:run":"mocha ./test/framework/twilio-video-angular.js","test:framework:angular":"npm-run-all test:framework:angular:*","test:framework:no-framework:run":"mocha ./test/framework/twilio-video-no-framework.js","test:framework:no-framework":"npm-run-all test:framework:no-framework:*","test:framework:react:install":"cd ./test/framework/twilio-video-react && rimraf ./node_modules package-lock.json && npm install","test:framework:react:test":"node ./scripts/framework.js twilio-video-react","test:framework:react:build":"cd ./test/framework/twilio-video-react && npm run build","test:framework:react:run":"mocha ./test/framework/twilio-video-react.js","test:framework:react":"npm-run-all test:framework:react:*","test:framework:install":"npm install chromedriver && npm install selenium-webdriver && npm install geckodriver && npm install puppeteer","test:framework":"npm-run-all test:framework:install test:framework:no-framework test:framework:react","test":"npm-run-all test:unit test:integration","build:es5":"rimraf ./es5 && mkdir -p es5 && tsc tsdef/twil
1io-video-tests.ts --noEmit --lib es2018,dom && tsc","build:js":"node ./scripts/build.js ./src/twilio-video.js ./LICENSE.md ./dist/twilio-video.js","build:min.js":"uglifyjs ./dist/twilio-video.js -o ./dist/twilio-video.min.js --comments \\"/^! twilio-video.js/\\" -b beautify=false,ascii_only=true","build":"npm-run-all clean lint docs test:unit test:integration build:es5 build:js build:min.js test:umd","build:quick":"npm-run-all clean lint docs build:es5 build:js build:min.js","docs":"node ./scripts/docs.js ./dist/docs","watch":"tsc -w","clean":"rimraf ./coverage ./es5 ./dist"},"dependencies":{"events":"^3.3.0","util":"^0.12.4","ws":"^7.4.6","xmlhttprequest":"^1.8.0"},"browser":{"ws":"./src/ws.js","xmlhttprequest":"./src/xmlhttprequest.js"}}')}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.