vendor: 4,696 bytes, line 1
1(self.webpackChunkprovider=self.webpackChunkprovider||[]).push([[46021],{59069:O=>{var g,P="object"==typeof Reflect?Reflect:null,u=P&&"function"==typeof P.apply?P.apply:function(S,m,b){return Function.prototype.apply.call(S,m,b)};g=P&&"function"==typeof P.ownKeys?P.ownKeys:Object.getOwnPropertySymbols?function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:function(S){return Object.getOwnPropertyNames(S)};var v=Number.isNaN||function(S){return S!=S};function c(){c.init.call(this)}O.exports=c,O.exports.once=function p(E,S){return new Promise(function(m,b){function d(w){E.removeListener(S,_),b(w)}function _(){"function"==typeof E.removeListener&&E.removeListener("error",d),m([].slice.call(arguments))}T(E,S,_,{once:!0}),"error"!==S&&function k(E,S,m){"function"==typeof E.on&&T(E,"error",S,m)}(E,d,{once:!0})})},c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var i=10;function t(E){if("function"!=typeof E)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof E)}function e(E){return void 0===E._maxListeners?c.defaultMaxListeners:E._maxListeners}function r(E,S,m,b){var d,_,w;if(t(m),void 0===(_=E._events)?(_=E._events=Object.create(null),E._eventsCount=0):(void 0!==_.newListener&&(E.emit("newListener",S,m.listener?m.listener:m),_=E._events),w=_[S]),void 0===w)w=_[S]=m,++E._eventsCount;else if("function"==typeof w?w=_[S]=b?[m,w]:[w,m]:b?w.unshift(m):w.push(m),(d=e(E))>0&&w.length>d&&!w.warned){w.warned=!0;var R=new Error("Possible EventEmitter memory leak detected. "+w.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");R.name="MaxListenersExceededWarning",R.emitter=E,R.type=S,R.count=w.length,function y(E){console&&console.warn&&console.warn(E)}(R)}return E}function n(){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 o(E,S,m){var b={fired:!1,wrapFn:void 0,target:E,type:S,listener:m},d=n.bind(b);return d.listener=m,b.wrapFn=d,d}function a(E,S,m){var b=E._events;if(void 0===b)return[];var d=b[S];return void 0===d?[]:"function"==typeof d?m?[d.listener||d]:[d]:m?function l(E){for(var S=new Array(E.length),m=0;m<S.length;++m)S[m]=E[m].listener||E[m];return S}(d):h(d,d.length)}function s(E){var S=this._events;if(void 0!==S){var m=S[E];if("function"==typeof m)return 1;if(void 0!==m)return m.length}return 0}function h(E,S){for(var m=new Array(S),b=0;b<S;++b)m[b]=E[b];return m}function T(E,S,m,b){if("function"==typeof E.on)b.once?E.once(S,m):E.on(S,m);else{if("function"!=typeof E.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof E);E.addEventListener(S,function d(_){b.once&&E.removeEventListener(S,d),m(_)})}}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(E){if("number"!=typeof E||E<0||v(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");i=E}}),c.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},c.prototype.setMaxListeners=function(S){if("number"!=typeof S||S<0||v(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this},c.prototype.getMaxListeners=function(){return e(this)},c.prototype.emit=function(S){for(var m=[],b=1;b<arguments.length;b++)m.push(arguments[b]);var d="error"===S,_=this._events;if(void 0!==_)d=d&&void 0===_.error;else if(!d)return!1;if(d){var w;if(m.length>0&&(w=m[0]),w instanceof Error)throw w;var R=new Error("Unhandled error."+(w?" ("+w.message+")":""));throw R.context=w,R}var j=_[S];if(void 0===j)return!1;if("function"==typeof j)u(j,this,m);else{var V=j.length,N=h(j,V);for(b=0;b<V;++b)u(N[b],this,m)}return!0},c.prototype.on=c.prototype.addListener=function(S,m){return r(this,S,m,!1)},c.prototype.prependListener=function(S,m){return r(this,S,m,!0)},c.prototype.once=function(S,m){return t(m),this.on(S,o(this,S,m)),this},c.prototype.prependOnceListener=function(S,m){return t(m),this.prependListener(S,o(this,S,m)),this},c.prototype.off=c.prototype.removeListener=function(S,m){var b,d,_,w,R;if(t(m),void 0===(d=this._events))return this;if(void 0===(b=d[S]))return this;if(b===m||b.listener===m)0==--this._eventsCount?this._events=Object.create(null):(delete d[S],d.removeListener&&this.emit
1("removeListener",S,b.listener||m));else if("function"!=typeof b){for(_=-1,w=b.length-1;w>=0;w--)if(b[w]===m||b[w].listener===m){R=b[w].listener,_=w;break}if(_<0)return this;0===_?b.shift():function f(E,S){for(;S+1<E.length;S++)E[S]=E[S+1];E.pop()}(b,_),1===b.length&&(d[S]=b[0]),void 0!==d.removeListener&&this.emit("removeListener",S,R||m)}return this},c.prototype.removeAllListeners=function(S){var m,b,d;if(void 0===(b=this._events))return this;if(void 0===b.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==b[S]&&(0==--this._eventsCount?this._events=Object.create(null):delete b[S]),this;if(0===arguments.length){var w,_=Object.keys(b);for(d=0;d<_.length;++d)"removeListener"!==(w=_[d])&&this.removeAllListeners(w);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(m=b[S]))this.removeListener(S,m);else if(void 0!==m)for(d=m.length-1;d>=0;d--)this.removeListener(S,m[d]);return this},c.prototype.listeners=function(S){return a(this,S,!0)},c.prototype.rawListeners=function(S){return a(this,S,!1)},c.listenerCount=function(E,S){return"function"==typeof E.listenerCount?E.listenerCount(S):s.call(E,S)},c.prototype.listenerCount=s,c.prototype.eventNames=function(){return this._eventsCount>0?g(this._events):[]}},80302:(O,P,u)=>{var g=u(88126);O.exports=function y(v,c,i,t){var e,r=new Error("Canceled");return new g(function(o,a,s){var h;v(function(l){return s()?g.reject(r):(h=c(l),i(h).then(function(k){if(s())throw r;return e=k()}))}).then(function(l){if(s())throw l.disconnect(),r;o(t(h,l))}).catch(function(l){a(l)})},function(){e&&e.cancel()})}},55769:(O,P,u)=>{var g=u(41647).MediaStreamTrack,y=u(77627),v=y.guessBrowser,c=y.guessBrowserVersion,i=y.isCodecSupported,t=u(80302),e=u(28130),r=u(63383),n=u(43744),o=u(74920),a=u(17379),s=a.LocalAudioTrack,h=a.LocalDataTrack,f=a.LocalVideoTrack,l=u(24621),p=u(7406),k=u(20448),T=u(79739),E=T.asLocalTrack,S=T.buildLogLevels,m=T.filterObject,b=T.isNonArrayObject,d=u(28701),_=d.DEFAULT_ENVIRONMENT,w=d.DEFAULT_LOG_LEVEL,R=d.DEFAULT_LOGGER_NAME,j=d.DEFAULT_REALM,V=d.DEFAULT_REGION,N=d.WS_SERVER,x=d.SDK_NAME,M=d.SDK_VERSION,C=d.typeErrors,B=u(88126),Q=u(88606),Y=u(61458),W=u(81501).kG,K="safari"===v()&&c(),D=0,L=!1,I=!1;if(K){var G=K.major;I=G<12||12===G&&K.minor<1}var Z=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"}]),$=new Set([{didWarn:!1,shouldDelete:!1,name:"maxTracks",newName:"bandwidthProfile.video.clientTrackSwitchOffControl"},{didWarn:!1,shouldDelete:!1,name:"renderDimensions",newName:"bandwidthProfile.video.contentPreferencesMode"}]);function z(ce,ne,ge){ge.forEach(function(we){var pe=we.didWarn,Oe=we.name,Ie=we.newName,Pe=we.shouldDelete;Oe in ce&&typeof ce[Oe]<"u"&&(Ie&&Pe&&(ce[Ie]=ce[Oe]),Pe&&delete ce[Oe],!pe&&!["error","off"].includes(ne.level)&&(ne.warn('The ConnectOptions "'+Oe+'" is '+(Ie?'deprecated and scheduled for removal. Please use "'+Ie+'" instead.':"no longer applicable and will be ignored.")),we.didWarn=!0))})}function q(ce,ne,ge,we,pe,Oe){var Ie=ce.createLocalParticipantSignaling(ge,we);return ne.debug("Creating a new LocalParticipant:",Ie),new pe.LocalParticipant(Ie,Oe,pe)}function F(ce,ne,ge){var we=new p(ne,ge,ce),pe=ce.log;return pe.debug("Creating a new Room:",we),ge.on("stateChanged",function Oe(Ie){"disconnected"===Ie&&(pe.info("Disconnected from Room:",we.toString()),ge.removeListener("stateChanged",Oe))}),we}function A(ce,ne,ge,we,pe,Oe){return ne.log.debug("Creating a new RoomSignaling"),ge.connect(Oe._signaling,ce,we,pe,ne)}function H(ce,ne){var ge=ce.log;return ce.shouldStopLocalTracks=!ce.tracks,ce.shouldStopLocalTracks?ge.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"):(ge.info("Getting LocalTracks"),ge.debug("Options:",ce)),ce.createLocalTracks(ce).then(function(pe){var Oe=ne(pe);return Oe.catch(function(){ce.shouldStopLocalTracks&&(ge.info("The automatically acquired LocalTracks will now be stopped"),pe.forEach(function(Pe){Pe.stop()}))}),Oe})}function oe(ce){var ne="string"==typeof ce?{codec:ce}:ce;switch(ne.codec.toLowerCase()){case"opus":return Object.assign({dtx:!0}
1,ne);case"vp8":return Object.assign({simulcast:!1},ne);default:return ne}}O.exports=function ee(ce,ne){if(typeof ne>"u"&&(ne={}),!b(ne))return B.reject(C.INVALID_TYPE("options","object"));var Pe,ge=ne.Log||Y,we=ne.loggerName||R,pe=ne.logLevel||w,Oe=S(pe),Ie="[connect #"+ ++D+"]";try{Pe=new ge("default",Ie,Oe,we)}catch(Se){return B.reject(Se)}z(ne,Pe,Z);var ue="auto"===ne.preferredVideoCodecs;if(ue&&(ne.preferredVideoCodecs=[{codec:"VP8",simulcast:!0,adaptiveSimulcast:!0}]),ne.maxVideoBitrate&&ue)return Pe.error('ConnectOptions "maxVideoBitrate" is not compatible with "preferredVideoCodecs=auto"'),B.reject(C.ILLEGAL_INVOKE("connect",'ConnectOptions "maxVideoBitrate" is not compatible with "preferredVideoCodecs=auto"'));var ie={};"string"==typeof(ne=Object.assign({automaticSubscription:!0,dominantSpeaker:!1,enableDscp:!1,receiveTranscriptions:!1,environment:_,eventListener:null,insights:!0,LocalAudioTrack:s,LocalDataTrack:h,LocalParticipant:r,LocalVideoTrack:f,Log:ge,MediaStreamTrack:g,loggerName:we,logLevel:pe,maxAudioBitrate:null,maxVideoBitrate:null,name:null,networkMonitor:!0,networkQuality:!1,preferredAudioCodecs:[],preferredVideoCodecs:[],realm:j,region:V,signaling:k},m(ne))).wsServerInsights&&(ie.gateway=ne.wsServerInsights);var J=new(ne.insights?n:o)(ce,x,M,ne.environment,ne.realm,ie),te=N(ne.environment,ne.region),re=new Q(J,Date.now(),Pe,ne.eventListener);if((ne=Object.assign({eventObserver:re,wsServer:te},ne)).log=Pe,I&&!L&&"error"!==Pe.logLevel&&"off"!==Pe.logLevel&&(L=!0,Pe.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"].join(" "))),"string"!=typeof ce)return B.reject(C.INVALID_TYPE("token","string"));var ae=Object.assign({},ne);if(delete ae.name,"tracks"in ne){if(!Array.isArray(ne.tracks))return B.reject(C.INVALID_TYPE("options.tracks","Array of LocalAudioTrack, LocalVideoTrack or MediaStreamTrack"));try{ne.tracks=ne.tracks.map(function(Se){return E(Se,ae)})}catch(Se){return B.reject(Se)}}var be=W(ne.bandwidthProfile);if(be)return B.reject(be);ne.clientTrackSwitchOffControl="disabled",ne.contentPreferencesMode="disabled",ne.bandwidthProfile&&(ne.clientTrackSwitchOffControl="auto",ne.contentPreferencesMode="auto",ne.bandwidthProfile.video&&(z(ne.bandwidthProfile.video,Pe,$),ne.clientTrackSwitchOffControl="maxTracks"in ne.bandwidthProfile.video?"disabled":"manual"===ne.bandwidthProfile.video.clientTrackSwitchOffControl?"manual":"auto",ne.contentPreferencesMode="renderDimensions"in ne.bandwidthProfile.video?"disabled":"manual"===ne.bandwidthProfile.video.contentPreferencesMode?"manual":"auto"));var xe=new(0,ne.signaling)(ne.wsServer,ne);Pe.info("Connecting to a Room"),Pe.debug("Options:",ne);var Le=new e({maxAudioBitrate:ne.maxAudioBitrate,maxVideoBitrate:ne.maxVideoBitrate},ue),Ce={audio:ne.preferredAudioCodecs.map(oe),video:ne.preferredVideoCodecs.map(oe)},Re=new l(b(ne.networkQuality)?ne.networkQuality:{});["audio","video"].forEach(function(Se){return Ce[Se].forEach(function(je){var Ne=je.codec;return i(Ne,Se).then(function(Ye){return!Ye&&Pe.warn("The preferred "+Se+' codec "'+Ne+'" will be ignored as it is not supported by the browser.')})})});var Te=t(H.bind(null,ne),q.bind(null,xe,Pe,Le,Re,ne),A.bind(null,ce,ne,xe,Le,Ce),F.bind(null,ne));return Te.then(function(Se){return J.connect(Se.sid,Se.localParticipant.sid),Pe.info("Connected to Room:",Se.toString()),Pe.info("Room name:",Se.name),Pe.debug("Room:",Se),Se.once("disconnected",function(){return J.disconnect()}),Se},function(Se){J.disconnect(),Te._isCanceled?Pe.info("Attempt to connect to a Room was canceled"):Pe.info("Error while connecting to a Room:",Se)}),Te}},58765:(O,P,u)=>{var g=u(28701),y=g.DEFAULT_LOG_LEVEL,v=g.DEFAULT_LOGGER_NAME;function c(r,n){n=Object.assign({loggerName:v,logLevel:y},n);var o={};o.loggerName=n.loggerName,o.logLevel=n.logLevel,delete n.loggerName,delete n.logLevel,["getUserMedia","enumerateDevices","MediaStream","mapMediaElement","disposeMediaElement"].forEach(function(h){h in n&&(o[h]=n[h],delete n[h])});var s=n.createLocalTracks;return delete n.createLocalTracks,o[r]=!(Object.keys(n).length>0)||n,s(o).then(function(h){return h[0]})}O.exports={audio:function i(r){return c("audio",r)},video:function t(r){return c("video",r)}}},87124:function(O,P,u){var g=this&&this.__assign||function(){return g=Object.assign||function(d){for(var _,w=1,R=arguments.length;w<R;w++)for(var j in _=arguments[w])Object.prototype.hasOwnProperty.call(_,j)&&(d[j]=_[j]);return d},g.apply(this,arguments)},y=this&&this.__awaiter||function(d,_,w,R){return new(w||(w=Prom
1ise))(function(V,N){function x(B){try{C(R.next(B))}catch(Q){N(Q)}}function M(B){try{C(R.throw(B))}catch(Q){N(Q)}}function C(B){B.done?V(B.value):function j(V){return V instanceof w?V:new w(function(N){N(V)})}(B.value).then(x,M)}C((R=R.apply(d,_||[])).next())})},v=this&&this.__generator||function(d,_){var R,j,V,N,w={label:0,sent:function(){if(1&V[0])throw V[1];return V[1]},trys:[],ops:[]};return N={next:x(0),throw:x(1),return:x(2)},"function"==typeof Symbol&&(N[Symbol.iterator]=function(){return this}),N;function x(C){return function(B){return function M(C){if(R)throw new TypeError("Generator is already executing.");for(;w;)try{if(R=1,j&&(V=2&C[0]?j.return:C[0]?j.throw||((V=j.return)&&V.call(j),0):j.next)&&!(V=V.call(j,C[1])).done)return V;switch(j=0,V&&(C=[2&C[0],V.value]),C[0]){case 0:case 1:V=C;break;case 4:return w.label++,{value:C[1],done:!1};case 5:w.label++,j=C[1],C=[0];continue;case 7:C=w.ops.pop(),w.trys.pop();continue;default:if(!(V=(V=w.trys).length>0&&V[V.length-1])&&(6===C[0]||2===C[0])){w=0;continue}if(3===C[0]&&(!V||C[1]>V[0]&&C[1]<V[3])){w.label=C[1];break}if(6===C[0]&&w.label<V[1]){w.label=V[1],V=C;break}if(V&&w.label<V[2]){w.label=V[2],w.ops.push(C);break}V[2]&&w.ops.pop(),w.trys.pop();continue}C=_.call(d,w)}catch(B){C=[6,B],j=0}finally{R=V=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([C,B])}}},c=this&&this.__read||function(d,_){var w="function"==typeof Symbol&&d[Symbol.iterator];if(!w)return d;var j,N,R=w.call(d),V=[];try{for(;(void 0===_||_-- >0)&&!(j=R.next()).done;)V.push(j.value)}catch(x){N={error:x}}finally{try{j&&!j.done&&(w=R.return)&&w.call(R)}finally{if(N)throw N.error}}return V},i=this&&this.__spreadArray||function(d,_){for(var w=0,R=_.length,j=d.length;w<R;w++,j++)d[j]=_[w];return d};Object.defineProperty(P,"__esModule",{value:!0}),P.createLocalTracks=void 0;var t=u(27155),e=u(79739).buildLogLevels,r=u(41647),n=r.getUserMedia,o=r.MediaStreamTrack,a=u(17379),s=a.LocalAudioTrack,h=a.LocalDataTrack,f=a.LocalVideoTrack,l=u(61458),p=u(28701),k=p.DEFAULT_LOG_LEVEL,T=p.DEFAULT_LOGGER_NAME,E=p.typeErrors.INVALID_VALUE,S=u(43830),m=0;P.createLocalTracks=function b(d){return y(this,void 0,void 0,function(){var _,w,R,j,V,N,x,M,C,B,Q,Y,W,K=this;return v(this,function(D){switch(D.label){case 0:if(w=g({audio:_=!(d&&("audio"in d||"video"in d)),getUserMedia:n,loggerName:T,logLevel:k,LocalAudioTrack:s,LocalDataTrack:h,LocalVideoTrack:f,MediaStreamTrack:o,Log:l,video:_},d),R="[createLocalTracks #"+ ++m+"]",j=e(w.logLevel),V=new w.Log("default",R,j,w.loggerName),delete(N=Object.assign({log:V},w)).name,!1===w.audio&&!1===w.video)return V.info("Neither audio nor video requested, so returning empty LocalTracks"),[2,[]];if(w.tracks)return V.info("Adding user-provided LocalTracks"),V.debug("LocalTracks:",w.tracks),[2,w.tracks];if((x={audio:"object"==typeof w.audio&&w.audio.name?{name:w.audio.name}:{defaultDeviceCaptureMode:"auto"},video:"object"==typeof w.video&&w.video.name?{name:w.video.name}:{}}).audio.isCreatedByCreateLocalTracks=!0,x.video.isCreatedByCreateLocalTracks=!0,"object"==typeof w.audio)if("boolean"==typeof w.audio.workaroundWebKitBug1208516&&(x.audio.workaroundWebKitBug1208516=w.audio.workaroundWebKitBug1208516),"noiseCancellationOptions"in w.audio&&(M=w.audio.noiseCancellationOptions,delete w.audio.noiseCancellationOptions),"defaultDeviceCaptureMode"in w.audio){if(["auto","manual"].every(function(L){return L!==w.audio.defaultDeviceCaptureMode}))throw E("CreateLocalAudioTrackOptions.defaultDeviceCaptureMode",["auto","manual"]);x.audio.defaultDeviceCaptureMode=w.audio.defaultDeviceCaptureMode}else x.audio.defaultDeviceCaptureMode="auto";"object"==typeof w.video&&"boolean"==typeof w.video.workaroundWebKitBug1208516&&(x.video.workaroundWebKitBug1208516=w.video.workaroundWebKitBug1208516),"object"==typeof w.audio&&delete w.audio.name,"object"==typeof w.video&&delete w.video.name,C={audio:w.audio,video:w.video},B="object"==typeof w.audio&&w.audio.workaroundWebKitBug180748,D.label=1;case 1:return D.trys.push([1,4,,5]),[4,B?S(V,w.getUserMedia,C):w.getUserMedia(C)];case 2:return Q=D.sent(),Y=i(i([],c(Q.getAudioTracks())),c(Q.getVideoTracks())),V.info("Call to getUserMedia successful; got tracks:",Y),[4,Promise.all(Y.map(function(L){return y(K,void 0,void 0,function(){var I,X;return v(this,function(Z){switch(Z.label){case 0:return"audio"===L.kind&&M?[4,t.applyNoiseCancellation(L,M,V)]:[3,2];
1case 1:return I=Z.sent(),X=I.noiseCancellation,[2,new N.LocalAudioTrack(I.cleanTrack,g(g(g({},x.audio),N),{noiseCancellation:X}))];case 2:if("audio"===L.kind)return[2,new N.LocalAudioTrack(L,g(g({},x.audio),N))];Z.label=3;case 3:return[2,new N.LocalVideoTrack(L,g(g({},x.video),N))]}})})}))];case 3:return[2,D.sent()];case 4:throw W=D.sent(),V.warn("Call to getUserMedia failed:",W),W;case 5:return[2]}})})}},42498:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(75295),v=u(59020),c=function(i){function t(e){var r=i.call(this,e.label,e.maxPacketLifeTime,e.maxRetransmits,e.ordered)||this;return Object.defineProperties(r,{_dataChannel:{value:e}}),e.binaryType="arraybuffer",e.addEventListener("message",function(n){r.emit("message",n.data)}),e.addEventListener("close",function(){r.emit("close")}),r}return g(t,i),t.prototype.stop=function(){this._dataChannel.close(),i.prototype.stop.call(this)},t.prototype.toDataTransport=function(){return new v(this._dataChannel)},t}(y);O.exports=c},91866:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(75295),v=u(79739).makeUUID,c=function(i){function t(e,r,n){var o=i.call(this,v(),e,r,n)||this;return Object.defineProperties(o,{_clones:{value:new Set},_dataChannels:{value:new Set}}),o}return g(t,i),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,r=new t(this.maxPacketLifeTime,this.maxRetransmits,this.ordered);return this._addClone(r),r.once("stopped",function(){return e.removeClone(r)}),r},t.prototype.removeDataChannel=function(e){return this._dataChannels.delete(e),this},t.prototype.send=function(e){return this._dataChannels.forEach(function(r){try{r.send(e)}catch{}}),this._clones.forEach(function(r){try{r.send(e)}catch{}}),this},t.prototype.stop=function(){this._dataChannels.forEach(function(e){return e.close()}),this._clones.forEach(function(e){return e.stop()}),i.prototype.stop.call(this)},t}(y);O.exports=c},75295:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r,n){var o=c.call(this,t,"data")||this;return Object.defineProperties(o,{maxPacketLifeTime:{enumerable:!0,value:e},maxRetransmits:{enumerable:!0,value:r},ordered:{enumerable:!0,value:n}}),o}return g(i,c),i}(u(54605));O.exports=v},59020:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t){var e=c.call(this)||this;return Object.defineProperties(e,{_dataChannel:{value:t},_messageQueue:{value:[]}}),t.addEventListener("open",function(){e._messageQueue.splice(0).forEac
1h(function(r){return e._publish(r)})}),t.addEventListener("message",function(r){var n=r.data;try{var o=JSON.parse(n);e.emit("message",o)}catch{}}),e.publish({type:"ready"}),e}return g(i,c),i.prototype._publish=function(t){var e=JSON.stringify(t);try{this._dataChannel.send(e)}catch{}},i.prototype.publish=function(t){var e=this._dataChannel;return"closing"!==e.readyState&&"closed"!==e.readyState&&("connecting"===e.readyState?(this._messageQueue.push(t),!0):(this._publish(t),!0))},i}(u(59069).EventEmitter);O.exports=v},28130:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this)||this;return t=Object.assign({maxAudioBitrate:null,maxVideoBitrate:null},t),Object.defineProperties(r,{maxAudioBitrate:{value:t.maxAudioBitrate,writable:!0},maxVideoBitrate:{value:t.maxVideoBitrate,writable:!0},adaptiveSimulcast:{value:e}}),r}return g(i,c),i.prototype.toJSON=function(){return{maxAudioBitrate:this.maxAudioBitrate,maxVideoBitrate:this.maxVideoBitrate}},i.prototype.update=function(t){var e=this;t=Object.assign({maxAudioBitrate:this.maxAudioBitrate,maxVideoBitrate:this.maxVideoBitrate},t),["maxAudioBitrate","maxVideoBitrate"].reduce(function(n,o){return e[o]!==t[o]&&(e[o]=t[o],n=!0),n},!1)&&this.emit("changed")},i}(u(59069).EventEmitter);O.exports=v},50133:(O,P,u)=>{var g=u(59069).EventEmitter,y=u(79739).hidePrivateAndCertainPublicPropertiesInClass;O.exports=y(g,["domain"])},70870:function(O,P,u){var g=this&&this.__read||function(i,t){var e="function"==typeof Symbol&&i[Symbol.iterator];if(!e)return i;var n,a,r=e.call(i),o=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(a)throw a.error}}return o},y=this&&this.__spreadArray||function(i,t){for(var e=0,r=t.length,n=i.length;e<r;e++,n++)i[n]=t[e];return i},v=u(59069).EventEmitter,c=function(){function i(){Object.defineProperties(this,{_eventEmitter:{value:new v}})}return i.prototype.dispatchEvent=function(t){return this._eventEmitter.emit(t.type,t)},i.prototype.addEventListener=function(){var t;return(t=this._eventEmitter).addListener.apply(t,y([],g(arguments)))},i.prototype.removeEventListener=function(){var t;return(t=this._eventEmitter).removeListener.apply(t,y([],g(arguments)))},i}();O.exports=c},46021:function(O,P,u){var g=this&&this.__assign||function(){return g=Object.assign||function(f){for(var l,p=1,k=arguments.length;p<k;p++)for(var T in l=arguments[p])Object.prototype.hasOwnProperty.call(l,T)&&(f[T]=l[T]);return f},g.apply(this,arguments)};Object.defineProperty(P,"__esModule",{value:!0});var y=u(87124),v=u(98682),c={connect:u(55769),createLocalAudioTrack:u(58765).audio,createLocalVideoTrack:u(58765).video,isSupported:u(35341)(),version:u(1730).version,Logger:u(7846),LocalAudioTrack:u(17379).LocalAudioTrack,LocalDataTrack:u(17379).LocalDataTrack,LocalVideoTrack:u(17379).LocalVideoTrack};O.exports={connect:function i(f,l){var p=g({createLocalTracks:y.createLocalTracks},l);return c.connect(f,p)},createLocalAudioTrack:function t(f){var l=g({createLocalTracks:y.createLocalTracks},f);return c.createLocalAudioTrack(l)},createLocalVideoTrack:function e(f){var l=g({createLocalTracks:y.createLocalTracks},f);return c.createLocalVideoTrack(l)},createLocalTracks:y.createLocalTracks,runPreflight:v.runPreflight,isSupported:c.isSupported,version:c.version,Logger:c.Logger,LocalAudioTrack:c.LocalAudioTrack,LocalVideoTrack:c.LocalVideoTrack,LocalDataTrack:c.LocalDataTrack}},63383:function(O,P,u){var m,g=this&&this.__extends||(m=function(b,d){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,w){_.__proto__=w}||function(_,w){for(var R in w)Object.prototype.hasOwnProperty.call(w,R)&&(_[R]=w[R]
1)})(b,d)},function(b,d){if("function"!=typeof d&&null!==d)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function _(){this.constructor=b}m(b,d),b.prototype=null===d?Object.create(d):(_.prototype=d.prototype,new _)}),y=u(41647).MediaStreamTrack,v=u(79739),c=v.asLocalTrack,i=v.asLocalTrackPublication,t=v.trackClass,e=u(28701),r=e.typeErrors,n=e.trackPriority,o=u(81501).Wv,a=u(17379),s=a.LocalAudioTrack,h=a.LocalDataTrack,f=a.LocalVideoTrack,l=u(63925),p=u(15229),k=u(39565),E=function(m){function b(d,_,w){var R=this,j=(w=Object.assign({LocalAudioTrack:s,LocalVideoTrack:f,LocalDataTrack:h,MediaStreamTrack:y,LocalAudioTrackPublication:l,LocalVideoTrackPublication:k,LocalDataTrackPublication:p,shouldStopLocalTracks:!1,tracks:_},w)).shouldStopLocalTracks?new Set(_.filter(function(V){return"data"!==V.kind})):new Set;return R=m.call(this,d,w)||this,Object.defineProperties(R,{_eventObserver:{value:w.eventObserver},_LocalAudioTrack:{value:w.LocalAudioTrack},_LocalDataTrack:{value:w.LocalDataTrack},_LocalVideoTrack:{value:w.LocalVideoTrack},_MediaStreamTrack:{value:w.MediaStreamTrack},_LocalAudioTrackPublication:{value:w.LocalAudioTrackPublication},_LocalDataTrackPublication:{value:w.LocalDataTrackPublication},_LocalVideoTrackPublication:{value:w.LocalVideoTrackPublication},_tracksToStop:{value:j},signalingRegion:{enumerable:!0,get:function(){return d.signalingRegion}}}),R._handleTrackSignalingEvents(),R}return g(b,m),b.prototype._addTrack=function(d,_,w){var R=m.prototype._addTrack.call(this,d,_);return R&&"disconnected"!==this.state&&this._addLocalTrack(d,w),R},b.prototype._addLocalTrack=function(d,_){var w,R=null===(w=d.noiseCancellation)||void 0===w?void 0:w.vendor;this._signaling.addTrack(d._trackSender,d.name,_,R),this._log.info("Added a new "+t(d,!0)+":",d.id),this._log.debug(t(d,!0)+":",d)},b.prototype._removeTrack=function(d,_){var w=m.prototype._removeTrack.call(this,d,_);return w&&"disconnected"!==this.state&&(this._signaling.removeTrack(d._trackSender),this._log.info("Removed a "+t(d,!0)+":",d.id),this._log.debug(t(d,!0)+":",d)),w},b.prototype._getTrackEvents=function(){return m.prototype._getTrackEvents.call(this).concat([["disabled","trackDisabled"],["enabled","trackEnabled"],["stopped","trackStopped"]])},b.prototype.toString=function(){return"[LocalParticipant #"+this._instanceId+(this.sid?": "+this.sid:"")+"]"},b.prototype._handleTrackSignalingEvents=function(){var d=this,_=this._log;if("disconnected"!==this.state){var w=function(N){var x=d._signaling.getPublication(N._trackSender);x&&(x.disable(),_.debug("Disabled the "+t(N,!0)+":",N.id))},R=function(N){var x=d._signaling.getPublication(N._trackSender);x&&(x.enable(),_.debug("Enabled the "+t(N,!0)+":",N.id))},j=function(N){var x=d._signaling.getPublication(N._trackSender);return x&&x.stop(),x},V=function(N){_.debug("Transitioned to state:",N),"disconnected"===N?(_.debug("Removing LocalTrack event listeners"),d._signaling.removeListener("stateChanged",V),d.removeListener("trackDisabled",w),d.removeListener("trackEnabled",R),d.removeListener("trackStopped",j),d._tracks.forEach(function(x){var M=j(x);M&&x._trackSender.removeClone(M._trackTransceiver)}),_.info("LocalParticipant disconnected. Stopping "+d._tracksToStop.size+" automatically-acquired LocalTracks"),d._tracksToStop.forEach(function(x){x.stop()})):"connected"===N&&(_.info("reconnected"),setTimeout(function(){return d.emit("reconnected")},0))};this.on("trackDisabled",w),this.on("trackEnabled",R),this.on("trackStopped",j),this._signaling.on("stateChanged",V),this._tracks.forEach(function(N){d._addLocalTrack(N,n.PRIORITY_STANDARD),d._getOrCreateLocalTrackPublication(N).catch(function(x){_.warn("Failed to get or create LocalTrackPublication for "+N+":",x)})})}},b.prototype._getOrCreateLocalTrackPublication=function(d){var _=S(this.tracks,d);if(_)return Promise.resolve(_);var w=this._log,R=this,j=this._signaling.getPublication(d._trackSender);return j?new Promise(function(V,N){j.on("updated",function x(){var M=j.error;if(M)return j.removeListener("updated",x),w.warn("Failed to publish the "+t(d,!0)+": "+M.message),R._removeTrack(d,d.id),setTimeout(function(){R.emit
1("trackPublicationFailed",M,d)}),void N(M);if(!R._tracks.has(d.id))return j.removeListener("updated",x),void N(new Error("The "+d+" was unpublished"));if(j.sid){j.removeListener("updated",x);var B={log:w,LocalAudioTrackPublication:R._LocalAudioTrackPublication,LocalDataTrackPublication:R._LocalDataTrackPublication,LocalVideoTrackPublication:R._LocalVideoTrackPublication};_=S(R.tracks,d);var Q=function(D){return R.emit("trackWarning",D,_)},Y=function(){return R.emit("trackWarningsCleared",_)};_||(_=i(d,j,function(D){_.removeListener("trackWarning",Q),_.removeListener("trackWarningsCleared",Y),R.unpublishTrack(D.track)},B),R._addTrackPublication(_)),_.on("warning",Q),_.on("warningsCleared",Y);var K=R._signaling.state;("connected"===K||"connecting"===K)&&(d._processorEventObserver&&d._processorEventObserver.on("event",function(D){R._eventObserver.emit("event",{name:D.name,payload:D.data,group:"video-processor",level:"info"})}),d.processedTrack&&(d._captureFrames(),d._setSenderMediaStreamTrack(!0))),"connected"===K&&setTimeout(function(){R.emit("trackPublished",_)}),V(_)}})}):Promise.reject(new Error("Unexpected error: The "+d+" cannot be published"))},b.prototype.publishTrack=function(d,_){var R,w=S(this.tracks,d);if(w)return Promise.resolve(w);_=Object.assign({log:this._log,priority:n.PRIORITY_STANDARD,LocalAudioTrack:this._LocalAudioTrack,LocalDataTrack:this._LocalDataTrack,LocalVideoTrack:this._LocalVideoTrack,MediaStreamTrack:this._MediaStreamTrack},_);try{R=c(d,_)}catch(M){return Promise.reject(M)}var j=R.noiseCancellation;j&&!this._signaling.audioProcessors.includes(j.vendor)&&(this._log.warn(j.vendor+" is not supported in this room. disabling it permanently"),j.disablePermanently());var N=Object.values(n);if(!N.includes(_.priority))return Promise.reject(r.INVALID_VALUE("LocalTrackPublishOptions.priority",N));var x=this._addTrack(R,R.id,_.priority)||this._tracks.get(R.id);return this._getOrCreateLocalTrackPublication(x)},b.prototype.publishTracks=function(d){if(!Array.isArray(d))throw r.INVALID_TYPE("tracks","Array of LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack");return Promise.all(d.map(this.publishTrack,this))},b.prototype.setBandwidthProfile=function(){this._log.warn("setBandwidthProfile is not implemented yet and may be available in future versions of twilio-video.js")},b.prototype.setNetworkQualityConfiguration=function(d){if("object"!=typeof d||null===d)throw r.INVALID_TYPE("networkQualityConfiguration","NetworkQualityConfiguration");return["local","remote"].forEach(function(_){if(_ in d&&("number"!=typeof d[_]||isNaN(d[_])))throw r.INVALID_TYPE("networkQualityConfiguration."+_,"number")}),this._signaling.setNetworkQualityConfiguration(d),this},b.prototype.setParameters=function(d){if(typeof d<"u"&&"object"!=typeof d)throw r.INVALID_TYPE("encodingParameters","EncodingParameters, null or undefined");if(d){if(this._signaling.getParameters().adaptiveSimulcast&&d.maxVideoBitrate)throw r.INVALID_TYPE("encodingParameters",'encodingParameters.maxVideoBitrate is not compatible with "preferredVideoCodecs=auto"');["maxAudioBitrate","maxVideoBitrate"].forEach(function(_){if(typeof d[_]<"u"&&"number"!=typeof d[_]&&null!==d[_])throw r.INVALID_TYPE("encodingParameters."+_,"number, null or undefined")})}else null===d&&(d={maxAudioBitrate:null,maxVideoBitrate:null});return this._signaling.setParameters(d),this},b.prototype.unpublishTrack=function(d){o(d,{LocalAudioTrack:this._LocalAudioTrack,LocalDataTrack:this._LocalDataTrack,LocalVideoTrack:this._LocalVideoTrack,MediaStreamTrack:this._MediaStreamTrack});var _=this._tracks.get(d.id);if(!_)return null;if(this._signaling.getPublication(_._trackSender).publishFailed(new Error("The "+_+" was unpublished")),!(_=this._removeTrack(_,_.id)))return null;var R=S(this.tracks,_);return R&&this._removeTrackPublication(R),R},b.prototype.unpublishTracks=function(d){var _=this;if(!Array.isArray(d))throw r.INVALID_TYPE("tracks","Array of LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack");return d.reduce(function(w,R){var j=_.unpublishTrack(R);return j?w.concat(j):w},[])},b}(u(69218));function S(m,b){return Array.from(m.values()).find(function(d){return d.track===b||d.track.mediaStreamTrack===b})||null}O.exports=E},61534:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){return c.call(this,t,e)||this}return g(i,c),i.prototype.attach=function(){return c.prototype.attach.apply(this,arguments)},i.prototype.detach=function(){return c.prototype.detach.apply(this,arguments)},i}(u(35366));O.exports=v},57017:function(O,P,u){var g=this&&this.__read||function(i,t){var e="function"==typeof Symbol&&i[Symbol.iterator];if(!e)return i;var n,a,r=e.call(i),o=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(a)throw a.error}}return o},y=u(28701).DEFAULT_FRAME_RATE;O.exports="function"==typeof MediaStreamTrackGenerator&&"function"==typeof MediaStreamTrackProcessor?function c(i,t,e){var r=g(i.srcObject.getVideoTracks(),1),o=new MediaStreamTrackProcessor({track:r[0]}).readable,a=new MediaStreamTrackGenerator({kind:"video"}),s=!1,h=new TransformStream({transform:function(f,l){return("videoframe"===e?t(f):Promise.resolve(f.close()).then(t)).finally(function(){s&&l.terminate()})}});return o.pipeThrough(h).pipeTo(a.writable).then(function(){}),function(){s=!0}}:function v(i,t){var a,n=g(i.srcObject.getVideoTracks(),1)[0].getSettings().frameRate,o=void 0===n?y:n,s=new ReadableStream({start:function(f){a=setInterval(function(){return f.enqueue()},1e3/o)}}),h=new TransformStream({transform:function(){return t()}});return s.pipeThrough(h).pipeTo(new WritableStream).then(function(){}),function(){clearInterval(a)}}},17379:(O,P,u)=>{O.exports={LocalAudioTrack:u(2954),LocalVideoTrack:u(90001),LocalDataTrack:u(31560)}},2954:(O,P,u)=>{var g=u(41905),y=u(26213);function v(c,i){var t=new y(c,i);return Object.setPrototypeOf(t,v.prototype),t}g(v,y),O.exports=v},31560:(O,P,u)=>{var g=u(41905),y=u(10212);function v(c){var i=new y(c);return Object.setPrototypeOf(i,v.prototype),i}g(v,y),O.exports=v},90001:(O,P,u)=>{var g=u(41905),y=u(44847);function v(c,i){var t=new y(c,i);return Object.setPrototypeOf(t,v.prototype),t}g(v,y),O.exports=v},81703:function(O,P,u){var o,g=this&&this.__extends||(o=function(a,s){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(h[l]=f[l])})(a,s)},function(a,s){if("function"!=typeof s&&null!==s)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function h(){this.constructor=a}o(a,s),a.prototype=null===s?Object.create(s):(h.prototype=s.prototype,new h)}),y=u(50133),v=u(79739),c=v.buildLogLevels,i=v.valueToJSON,t=u(28701).DEFAULT_LOG_LEVEL,e=u(61458),r=0,n=function(o){function a(s,h,f){var l;f=Object.assign({name:s,log:null,logLevel:t},f),l=o.call(this)||this;var p=String(f.name),k=c(f.logLevel),T=f.log?f.log.createLog("media",l):new e("media",l,k,f.loggerName);return Object.defineProperties(l,{_instanceId:{value:++r},_log:{value:T},kind:{enumerable:!0,value:h},name:{enumerable:!0,value:p}}),l}return g(a,o),a.prototype.toJSON=function(){return i(this)},a}(y);O.exports=n},26213:function(O,P,u){var n,g=this&&this.__extends||(n=function(o,a){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,h){s.__proto__=h}||function(s,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(s[f]=h[f])})(o,a)},function(o,a){if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function s(){this.constructor=o}n(o,a),o.prototype=null===a?Object.create(a):(s.prototype=a.prototype,new s)}),y=u(23948).isIOS,v=u(19059),c=u(77627).isIOSChrome,i=u(61534),r=function(n){function o(a,s){var h=this,f=s?.noiseCancellation||null,l=(h=n.call(this,a,s)||this)._log,p=a.label,k=void 0===p?"":p,T=a.getSettings(),E=T.deviceId,m=T.groupId;return Object.defineProperties(h,{_currentDefaultDeviceInfo:{value:{deviceId:void 0===E?"":E,groupId:void 0===m?"":m,label:k},writable:!0},_enumerateDevices:{value:"function"==typeof s?.enumerateDevices?s.enumerateDevices:navigator.mediaDevices.enumerateDevices},_defaultDeviceCaptureMode:{value:y()&&!f||!h._isCreatedByCreateLocalTracks||"object"!=typeof navigator||"object"!=typeof navigator.mediaDevices||"function"!=typeof navigator.mediaDevices.addEventListener||"function"!=typeof s?.enumerateDevices&&"function"!=typeof navigator.mediaDevices.enumerateDevices?"manual":s?.defaultDeviceCaptureMode||"auto"},_onDeviceChange:{value:function(){h._enumerateDevices().then(function(d){var _=d.find(function(w){return"audioinput"===w.kind&&"default"!==w.deviceId});_&&["deviceId","groupId"].some(function(w){return _[w]!==h._currentDefaultDeviceInfo[w]})&&(l.info("Default device changed, restarting the LocalAudioTrack"),l.debug('Old default device: "'+h._currentDefaultDeviceInfo.deviceId+'" => "'+h._currentDefaultDeviceInfo.label+'"'),l.debug('New default device: "'+_.deviceId+'" => "'+_.label+'"'),h._currentDefaultDeviceInfo=_,h._restartDefaultDevice().catch(function(w){return l.warn("Failed to restart: "+w.message)}))},function(d){l.warn("Failed to run enumerateDevices(): "+d.message)})}},_restartOnDefaultDeviceChangeCleanup:{value:null,writable:!0},noiseCancellation:{enumerable:!0,value:f,writable:!1}}),l.debug("defaultDeviceCaptureMode:",h._defaultDeviceCaptureMode),h._maybeRestartOnDefaultDeviceChange(),h}return g(o,n),o.prototype.toString=function(){return"[LocalAudioTrack #"+this._instanceId+": "+this.id+"]"},o.prototype.attach=function(a){return(a=n.prototype.attach.call(this,a)).muted=!0,a},o.prototype._end=function(){return n.prototype._end.apply(this,arguments)},o.prototype._maybeRestartOnDefaultDeviceChange=function(){var a=this,s=this,h=s._constraints,f=s._defaultDeviceCaptureMode,l=s._log,k=(this.noiseCancellation?this.noiseCancellation.sourceTrack:this.mediaStreamTrack).getSettings().deviceId,T=function(S){return S!==k||"default"===S},E=function S(m){return void 0===m&&(m={}),"string"==typeof m?T(m):Array.isArray(m)?m.every(T):m.exact?S(m.exact):!m.ideal||S(m.ideal)}(h.deviceId);"auto"===f&&E?this._restartOnDefaultDeviceChangeCleanup||(l.info("LocalAudioTrack will be restarted if the default device changes"),navigator.mediaDevices.addEventListener("devicechange",this._onDeviceChange),this._restartOnDefaultDeviceChangeCleanup=function(){l.info("Cleaning up the listener to restart the LocalAudioTrack if the default device changes"),navigator.mediaDevices.removeEventListener("devicechange",a._onDeviceChange),a._restartOnDefaultDeviceChangeCleanup=null}):(l.info("LocalAudioTrack will NOT be restarted if the default device changes"),this._restartOnDefaultDeviceChangeCleanup&&this._restartOnDefaultDeviceChangeCleanup())},o.prototype._reacquireTrack=function(a){var s=this;return this._log.debug("_reacquireTrack: ",a),this.noiseCancellation?this.noiseCancellation.reacquireTrack(function(){return n.prototype._reacquireTrack.call(s,a)}):n.prototype._reacquireTrack.call(this,a)},o.prototype._restartDefaultDevice=function(){var a=this,s=Object.assign({},this._constraints),h=Object.assign({},s,{deviceId:this._currentDefaultDeviceInfo.deviceId});return this.restart(h).then(function(){a._constraints=s,a._maybeRestartOnDefaultDeviceChange()})},o.prototype._setMediaStreamTrack=function(a){var s=this,f=this._log,l=this.noiseCancellation,p=n.prototype._setMediaStreamTrack.call(this,a);return c()&&l&&(f.debug("iOS Chrome detected, checking if the restarted Krisp audio is silent"),p=p.then(function(){return v(s._dummyEl)}).then(function(k){return f.debug("Krisp audio is "+(k?"silent, using source audio":"not silent")),k&&l.disablePermanently().then(function(){return n.prototype._setMediaStreamTrack.call(s,l.sourceTrack)})})),p},o.prototype.disable=function(){return n.prototype.disable.apply(this,arguments)},o.prototype.enable=function(){return n.prototype.enable.apply(this,arguments)},o.prototype.restart=function(){return n.prototype.restart.apply(this,arguments)},o.prototype.stop=function(){return this.noiseCancellation&&this.noiseCancellation.stop(),this._restartOnDefaultDeviceChangeCleanup&&this._restartOnDefaultDeviceChangeCleanup(),n.prototype.stop.apply(this,arguments)},o}(u(68275)(i));O.exports=r},63925:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r,n){return c.call(this,t,e,r,n)||this}return g(i,c),i.prototype.toString=function(){return"[LocalAudioTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i}(u(93335));O.exports=v},10212:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(81703),v=u(91866),c=function(i){function t(e){var r,o=new(0,(e=Object.assign({DataTrackSender:v,maxPacketLifeTime:null,maxRetransmits:null,ordered:!0}
1,e)).DataTrackSender)(e.maxPacketLifeTime,e.maxRetransmits,e.ordered);return r=i.call(this,o.id,"data",e)||this,Object.defineProperties(r,{_trackSender:{value:o},id:{enumerable:!0,value:o.id},maxPacketLifeTime:{enumerable:!0,value:e.maxPacketLifeTime},maxRetransmits:{enumerable:!0,value:e.maxRetransmits},ordered:{enumerable:!0,value:e.ordered},reliable:{enumerable:!0,value:null===e.maxPacketLifeTime&&null===e.maxRetransmits}}),r}return g(t,i),t.prototype.send=function(e){this._trackSender.send(e)},t}(y);O.exports=c},15229:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r,n){return c.call(this,t,e,r,n)||this}return g(i,c),i.prototype.toString=function(){return"[LocalDataTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i}(u(93335));O.exports=v},68275:function(O,P,u){var T,g=this&&this.__extends||(T=function(E,S){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,b){m.__proto__=b}||function(m,b){for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&(m[d]=b[d])})(E,S)},function(E,S){if("function"!=typeof S&&null!==S)throw new TypeError("Class extends value "+String(S)+" is not a constructor or null");function m(){this.constructor=E}T(E,S),E.prototype=null===S?Object.create(S):(m.prototype=S.prototype,new m)}),y=u(41647).getUserMedia,v=u(23948).isIOS,c=u(79739),i=c.capitalize,t=c.defer,e=c.waitForSometime,r=c.waitForEvent,n=u(28701).typeErrors.ILLEGAL_INVOKE,o=u(19059),a=u(51741),s=u(82181),h=u(16396),f=u(43830),l=u(60808);function k(T){var E=T._log,S=T.kind,m=T._noiseCancellation,b={audio:o,video:a}[S],d=function(){return m?m.sourceTrack:T.mediaStreamTrack},_=T._dummyEl,w=d(),R=null;function N(){return Promise.race([r(w,"unmute"),e(50)]).then(function(){return function V(){var W=T.isStopped&&!!T._workaroundWebKitBug1208516Cleanup,K=d().muted;return Promise.resolve().then(function(){return"visible"===document.visibilityState&&!R&&(K||W||function j(){return _.play().then(function(){return b(_)}).then(function(Q){return Q?E.warn("Silence detected"):E.info("Non-silence detected"),Q}).catch(function(Q){E.warn("Failed to detect silence:",Q)}).finally(function(){T.processedTrack||_.pause()})}())})}()}).then(function(Q){return Q&&!R&&(R=t(),T._restart().finally(function(){_=T._dummyEl,C(),w=d(),M(),R.resolve(),R=null}).catch(function(W){E.error("failed to restart track: ",W)})),(R&&R.promise||Promise.resolve()).finally(function(){return h.resolveDeferred(S)})}).catch(function(Q){E.error("error in maybeRestart: "+Q.message)})}function x(){var Q=T._log,Y=T.kind;Q.info("Muted"),Q.debug("LocalMediaTrack:",T),h.startDeferred(Y)}function M(){w.addEventListener?(w.addEventListener("ended",N),w.addEventListener("mute",x),w.addEventListener("unmute",N)):(w.onended=N,w.onmute=x,w.onunmute=N)}function C(){w.removeEventListener?(w.removeEventListener("ended",N),w.removeEventListener("mute",x),w.removeEventListener("unmute",N)):(w.onended=null,w.onmute=null,w.onunmute=null)}var B=function(Q){return!!Q&&N()};return s.onVisibilityChange(1,B),M(),function(){s.offVisibilityChange(1,B),C()}}O.exports=function p(T){return function(E){function S(m,b){var d=this,_=v()&&"object"==typeof document&&"function"==typeof document.addEventListener&&"string"==typeof document.visibilityState;b=Object.assign({getUserMedia:y,isCreatedByCreateLocalTracks:!1,workaroundWebKitBug1208516:_,gUMSilentTrackWorkaround:f},b);var w=new l(m),R=w.kind;return d=E.call(this,w,b)||this,Object.defineProperties(d,{_constraints:{value:"object"==typeof b[R]?b[R]:{},writable:!0},_getUserMedia:{value:b.getUserMedia},_gUMSilentTrackWorkaround:{value:b.gUMSilentTrackWorkaround},_eventsToReemitters:{value:new Map([["muted",function(){return d.emit("muted",d)}],["unmuted",function(){return d.emit("unmuted",d)}]])},_workaroundWebKitBug1208516:{value:b.workaroundWebKitBug1208516},_workaroundWebKitBug1208516Cleanup:{value:null,writable:!0},_didCallEnd:{value:!1,writable:!0},_isCreatedByCreateLocalTracks:{value:b.isCreatedByCreateLocalTracks},_noiseCancellation:{value:b.noiseCancellation||null},_trackSender:{value:w},id:{enumerable:!0,value:w.id},isEnabled:{enumerable:!0,get:function(){return w.enabled}},isMuted:{enumerable:!0,get:function(){return w.muted}},isStopped:{enumerable:!0,get:function(){return"ended"===w.readyState}}}),d._workaroundWebKitBug1208516&&(d._workaroundWebKitBug1208516Cleanup=k(d)),d._reemitTrackSenderEvents(),d}return g(S,E),S.prototype._end=function(){var m=this;this._didCallEnd||(E.prototype._end.call(this),this._didCallEnd=!0,this._eventsToReemitters.forEac
1h(function(b,d){return m._trackSender.removeListener(d,b)}),this.emit("stopped",this))},S.prototype._initialize=function(){this._didCallEnd&&(this._didCallEnd=!1),this._eventsToReemitters&&this._reemitTrackSenderEvents(),E.prototype._initialize.call(this)},S.prototype._reacquireTrack=function(m){var b,d=this,_=d._getUserMedia,w=d._gUMSilentTrackWorkaround,R=d._log,j=d.mediaStreamTrack.kind;R.info("Re-acquiring the MediaStreamTrack"),R.debug("Constraints:",m);var V=Object.assign({audio:!1,video:!1},((b={})[j]=m,b));return(this._workaroundWebKitBug1208516Cleanup?w(R,_,V):_(V)).then(function(x){return x.getTracks()[0]})},S.prototype._reemitTrackSenderEvents=function(){var m=this;this._eventsToReemitters.forEach(function(b,d){return m._trackSender.on(d,b)}),this._trackSender.dequeue("muted"),this._trackSender.dequeue("unmuted")},S.prototype._restart=function(m){var b=this,d=this._log;return m=m||this._constraints,this._stop(),this._reacquireTrack(m).catch(function(_){throw d.error("Failed to re-acquire the MediaStreamTrack:",{error:_,constraints:m}),_}).then(function(_){return d.info("Re-acquired the MediaStreamTrack"),d.debug("MediaStreamTrack:",_),b._constraints=Object.assign({},m),b._setMediaStreamTrack(_)})},S.prototype._setMediaStreamTrack=function(m){var b=this;return m.enabled=this.mediaStreamTrack.enabled,this._stop(),(this._unprocessedTrack?Promise.resolve().then(function(){b._unprocessedTrack=m}):this._trackSender.setMediaStreamTrack(m).catch(function(d){b._log.warn("setMediaStreamTrack failed:",{error:d,mediaStreamTrack:m})})).then(function(){b._initialize(),b._getAllAttachedElements().forEach(function(d){return b._attach(d)})})},S.prototype._stop=function(){return this.mediaStreamTrack.stop(),this._end(),this},S.prototype.enable=function(m){return(m="boolean"!=typeof m||m)!==this.mediaStreamTrack.enabled&&(this._log.info((m?"En":"Dis")+"abling"),this.mediaStreamTrack.enabled=m,this.emit(m?"enabled":"disabled",this)),this},S.prototype.disable=function(){return this.enable(!1)},S.prototype.restart=function(m){var b=this,d=this.kind;if(!this._isCreatedByCreateLocalTracks)return Promise.reject(n("restart","can only be called on a Local"+i(d)+"Track that is created using createLocalTracks or createLocal"+i(d)+"Track."));this._workaroundWebKitBug1208516Cleanup&&(this._workaroundWebKitBug1208516Cleanup(),this._workaroundWebKitBug1208516Cleanup=null);var _=this._restart(m);return this._workaroundWebKitBug1208516&&(_=_.finally(function(){b._workaroundWebKitBug1208516Cleanup=k(b)})),_},S.prototype.stop=function(){return this._log.info("Stopping"),this._workaroundWebKitBug1208516Cleanup&&(this._workaroundWebKitBug1208516Cleanup(),this._workaroundWebKitBug1208516Cleanup=null),this._stop()},S}(T)}},93335:function(O,P,u){var n,g=this&&this.__extends||(n=function(o,a){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,h){s.__proto__=h}||function(s,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(s[f]=h[f])})(o,a)},function(o,a){if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function s(){this.constructor=o}n(o,a),o.prototype=null===a?Object.create(a):(s.prototype=a.prototype,new s)}),y=this&&this.__read||function(n,o){var a="function"==typeof Symbol&&n[Symbol.iterator];if(!a)return n;var h,l,s=a.call(n),f=[];try{for(;(void 0===o||o-- >0)&&!(h=s.next()).done;)f.push(h.value)}catch(p){l={error:p}}finally{try{h&&!h.done&&(a=s.return)&&a.call(s)}finally{if(l)throw l.error}}return f},v=this&&this.__spreadArray||function(n,o){for(var a=0,s=o.length,h=n.length;a<s;a++,h++)n[h]=o[a];return n},c=u(29222),i=u(28701),t=i.typeErrors,e=i.trackPriority,r=function(n){function o(a,s,h,f){var l=n.call(this,s.name,a.sid,f)||this;return Object.defineProperties(l,{_reemitSignalingEvent:{value:function(){for(var p=[],k=0;k<arguments.length;k++)p[k]=arguments[k];return l.emit.apply(l,v([p&&p.length?"warning":"warningsCleared"],y(p)))}},_reemitTrackEvent:{value:function(){return l.emit(l.isTrackEnabled?"trackEnabled":"trackDisabled")}},_signaling:{value:a},_unpublish:{value:h},isTrackEnabled:{enumerable:!0,get:function(){return"data"===this.track.kind||this.track.isEnabled}},kind:{enumerable:!0,value:s.kind},priority:{enumerable:!0,get:function(){return a.updatedPriority}},track:{enumerable:!0,value:s}}),["disabled","enabled"].forEach(function(p){return s.on(p,l._reemitTrackEvent)}),["warning","warningsCleared"].forEach(function(p){return a.on(p,l._reemitSignalingEvent)}),l}return g(o,n),o.prototype.toString=function(){return"[LocalTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},o.prototype.setPriority=function(a){var s=Object.values(e);if(!s.includes(a))throw t.INVALID_VALUE("priority",s);return this._signaling.setPriority(a),this},o.prototype.unpublish=function(){var a=this;return["disabled","enabled"].forEach(function(s){return a.track.removeListener(s,a._reemitTrackEvent)}),["warning","warningsCleared"].forEach(function(s){return a._signaling.removeListener(s,a._reemitSignalingEvent)}),this._unpublish(this),this},o}(c);
1O.exports=r},44847:function(O,P,u){var n,g=this&&this.__extends||(n=function(o,a){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,h){s.__proto__=h}||function(s,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(s[f]=h[f])})(o,a)},function(o,a){if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function s(){this.constructor=o}n(o,a),o.prototype=null===a?Object.create(a):(s.prototype=a.prototype,new s)}),y=u(23948).isIOS,v=u(51741),e=function(n){function o(a,s){var h=this;return s=Object.assign({workaroundSilentLocalVideo:y()&&typeof document<"u"&&"function"==typeof document.createElement},s),h=n.call(this,a,s)||this,Object.defineProperties(h,{_workaroundSilentLocalVideo:{value:s.workaroundSilentLocalVideo?r:null},_workaroundSilentLocalVideoCleanup:{value:null,writable:!0}}),h._workaroundSilentLocalVideo&&(h._workaroundSilentLocalVideoCleanup=h._workaroundSilentLocalVideo(h,document)),h}return g(o,n),o.prototype.toString=function(){return"[LocalVideoTrack #"+this._instanceId+": "+this.id+"]"},o.prototype._checkIfCanCaptureFrames=function(){return n.prototype._checkIfCanCaptureFrames.call(this,this._trackSender.isPublishing)},o.prototype._end=function(){return n.prototype._end.apply(this,arguments)},o.prototype._setSenderMediaStreamTrack=function(a){var s=this,h=this.mediaStreamTrack,f=a?this.processedTrack:h;return this._trackSender.setMediaStreamTrack(f).catch(function(l){return s._log.warn("setMediaStreamTrack failed on LocalVideoTrack RTCRtpSender",{error:l,mediaStreamTrack:f})}).then(function(){s._unprocessedTrack=a?h:null})},o.prototype.addProcessor=function(){this._log.debug("Adding VideoProcessor to the LocalVideoTrack");var a=n.prototype.addProcessor.apply(this,arguments);return this.processedTrack?(this._log.debug("Updating LocalVideoTrack's MediaStreamTrack with the processed MediaStreamTrack",this.processedTrack),this._setSenderMediaStreamTrack(!0),a):this._log.warn("Unable to add a VideoProcessor to the LocalVideoTrack")},o.prototype.removeProcessor=function(){var a=this;this._log.debug("Removing VideoProcessor from the LocalVideoTrack");var s=n.prototype.removeProcessor.apply(this,arguments);return this._log.debug("Updating LocalVideoTrack's MediaStreamTrack with the original MediaStreamTrack"),this._setSenderMediaStreamTrack().then(function(){return a._updateElementsMediaStreamTrack()}),s},o.prototype.disable=function(){var a=n.prototype.disable.apply(this,arguments);return this.processedTrack&&(this.processedTrack.enabled=!1),a},o.prototype.enable=function(a){void 0===a&&(a=!0);var s=n.prototype.enable.apply(this,arguments);return this.processedTrack&&(this.processedTrack.enabled=a,a&&(this._captureFrames(),this._log.debug("Updating LocalVideoTrack's MediaStreamTrack with the processed MediaStreamTrack",this.processedTrack),this._setSenderMediaStreamTrack(!0))),s},o.prototype.restart=function(){var a=this;this._workaroundSilentLocalVideoCleanup&&(this._workaroundSilentLocalVideoCleanup(),this._workaroundSilentLocalVideoCleanup=null);var s=n.prototype.restart.apply(this,arguments);return this.processor&&s.then(function(){a._restartProcessor()}),this._workaroundSilentLocalVideo&&s.finally(function(){a._workaroundSilentLocalVideoCleanup=a._workaroundSilentLocalVideo(a,document)}),s},o.prototype.stop=function(){return this._workaroundSilentLocalVideoCleanup&&(this._workaroundSilentLocalVideoCleanup(),this._workaroundSilentLocalVideoCleanup=null),n.prototype.stop.apply(this,arguments)},o}(u(68275)(u(54332)));function r(n,o){var a=n._log,s=n._dummyEl,h=n.mediaStreamTrack;function f(){n.isEnabled&&(a.info("Unmuted, checking silence"),s.play().then(function(){return v(s,o)}).then(function(l){if(l)return a.warn("Silence detected, restarting"),n._stop(),n._restart();a.info("Non-silent frames detected, so no need to restart")}).catch(function(l){a.warn("Failed to detect silence and restart:",l)}).finally(function(){(s=n._dummyEl)&&!s.paused&&!n.processedTrack&&s.pause(),h.removeEventListener("unmute",f),(h=n.mediaStreamTrack).addEventListener?h.addEventListener("unmute",f):h.onunmute=f}))}return h.addEventListener?h.addEventListener("unmute",f):h.onunmute=f,function(){h.removeEventListener?h.removeEventListener("unmute",f):h.onunmute=null}}O.exports=e},39565:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r,n){return c.call(this,t,e,r,n)||this}return g(i,c),i.prototype.toString=function(){return"[LocalVideoTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i}(u(93335));O.exports=v},35366:function(O,P,u){var s,g=this&&this.__extends||(s=function(h,f){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,p){l.__proto__=p}||function(l,p){for(var k in p)Object.prototype.hasOwnProperty.call(p,k)&&(l[k]=p[k])})(h,f)},function(h,f){if("function"!=typeof f&&null!==f)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");function l(){this.constructor=h}s(h,f),h.prototype=null===f?Object.create(f):(l.prototype=f.prototype,new l)}),y=u(23948).isIOS,v=u(41647).MediaStream,c=u(79739),i=c.waitForEvent,t=c.waitForSometime,e=u(16396),n=function(s){function h(f,l){var p=this;l=Object.assign({playPausedElementsIfNotBackgrounded:y()&&"object"==typeof document&&"function"==typeof document.addEventListener&&"string"==typeof document.visibilityState},l),p=s.call(this,f.id,f.kind,l)||this;var k=!1;if("function"!=typeof(l=Object.assign({MediaStream:v},l)).MediaStream)throw new Error("MediaTrack received an invalid MediaStream constructor: "+l.MediaStream);return Object.defineProperties(p,{_attachments:{value:new Set},_dummyEl:{value:null,writable:!0},_elShims:{value:new WeakMap},_isStarted:{get:function(){return k},set:function(T){k=T}},_playPausedElementsIfNotBackgrounded:{value:l.playPausedElementsIfNotBackgrounded},_shouldShimAttachedElements:{value:l.workaroundWebKitBug212780||l.playPausedElementsIfNotBackgrounded},_unprocessedTrack:{value:null,writable:!0},_MediaStream:{value:l.MediaStream},_mapMediaElement:{value:l.mapMediaElement},_disposeMediaElement:{value:l.disposeMediaElement},isStarted:{enumerable:!0,get:function(){return k}},mediaStreamTrack:{enumerable:!0,get:function(){return this._unprocessedTrack||f.track}},processedTrack:{enumerable:!0,value:null,writable:!0}}),p._initialize(),p}return g(h,s),h.prototype._start=function(){this._log.debug("Started"),this._isStarted=!0,this._dummyEl&&(this._dummyEl.oncanplay=null),this.emit("started",this)},h.prototype._initialize=function(){var f=this;this._log.debug("Initializing"),this._dummyEl=this._createElement(),this.mediaStreamTrack&&this.mediaStreamTrack.addEventListener?this.mediaStreamTrack.addEventListener("ended",function l(){f._end(),f.mediaStreamTrack.removeEventListener("ended",l)}):this.mediaStreamTrack&&(this.mediaStreamTrack.onended=function(){f._end(),f.mediaStreamTrack.onended=null}),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))},h.prototype._end=function(){this._log.debug("Ended"),this._dummyEl&&(this._dummyEl.remove(),this._disposeMediaElement?this._disposeMediaElement(this._dummyEl):this._dummyEl.srcObject=null,this._dummyEl.oncanplay=null,this._dummyEl=null)},h.prototype.attach=function(f){var l=this;if("string"==typeof f?f=this._selectElement(f):f||(f=this._createElement()),this._log.debug("Attempting to attach to element:",f),f=this._attach(f),this._shouldShimAttachedElements&&!this._elShims.has(f)){var p=this._playPausedElementsIfNotBackgrounded?function(){return function o(s,h){var f=s.tagName.toLowerCase();h.warn("Unintentionally paused:",s),Promise.race([i(document,"visibilitychange"),t(1e3)]).then(function(){"visible"===document.visibilityState&&e.whenResolved("audio").then(function(){return h.info("Playing unintentionally paused <"+f+"> element"),h.debug("Element:",s),s.play()}).then(function(){h.info("Successfully played unintentionally paused <"+f+"> element"),h.debug("Element:",s)}).catch(function(l){h.warn("Error while playing unintentionally paused <"+f+"> element:",{error:l,el:s})})})}(f,l._log)}:null;this._elShims.set(f,function a(s,h){void 0===h&&(h=null);var f=s.pause,l=s.play,p=!1;s.pause=function(){return p=!0,f.call(s)},s.play=function(){return p=!1,l.call(s)};var k=h?function(){p||h()}:null;return k&&s.addEventListener("pause",k),{pausedIntentionally:function(){return p},unShim:function(){s.pause=f,s.play=l,k&&s.removeEventListener("pause",k)}}}(f,p))}return f},h.prototype._attach=function(f,l){void 0===l&&(l=this.processedTrack||this.mediaStreamTrack);var p=f.srcObject;
1return p instanceof this._MediaStream||(p=new this._MediaStream),p["audio"===l.kind?"getAudioTracks":"getVideoTracks"]().forEach(function(T){p.removeTrack(T)}),p.addTrack(l),this._mapMediaElement&&(this._log.debug("Mapping element using mapMediaElement before attaching media to element"),this._mapMediaElement(f)),f.srcObject=p,f.autoplay=!0,f.playsInline=!0,this._attachments.has(f)||this._attachments.add(f),f},h.prototype._selectElement=function(f){var l=document.querySelector(f);if(!l)throw new Error("Selector matched no element: "+f);return l},h.prototype._updateElementsMediaStreamTrack=function(){var f=this;this._log.debug("Reattaching all elements to update mediaStreamTrack"),this._getAllAttachedElements().forEach(function(l){return f._attach(l)})},h.prototype._createElement=function(){return typeof document<"u"?document.createElement(this.kind):null},h.prototype.detach=function(f){var l;return l="string"==typeof f?[this._selectElement(f)]:f?[f]:this._getAllAttachedElements(),this._log.debug("Attempting to detach from elements:",l),this._detachElements(l),f?l[0]:l},h.prototype._detachElements=function(f){return f.map(this._detachElement.bind(this))},h.prototype._detachElement=function(f){if(!this._attachments.has(f))return f;var l=f.srcObject;return l instanceof this._MediaStream&&l.removeTrack(this.processedTrack||this.mediaStreamTrack),this._disposeMediaElement&&(this._log.debug("Disposing element using disposeMediaElement after removing media from element"),this._disposeMediaElement(f)),this._attachments.delete(f),this._shouldShimAttachedElements&&this._elShims.has(f)&&(this._elShims.get(f).unShim(),this._elShims.delete(f)),f},h.prototype._getAllAttachedElements=function(){var f=[];return this._attachments.forEach(function(l){f.push(l)}),f},h}(u(81703));O.exports=n},27155:function(O,P,u){var g=this&&this.__awaiter||function(e,r,n,o){return new(n||(n=Promise))(function(s,h){function f(k){try{p(o.next(k))}catch(T){h(T)}}function l(k){try{p(o.throw(k))}catch(T){h(T)}}function p(k){k.done?s(k.value):function a(s){return s instanceof n?s:new n(function(h){h(s)})}(k.value).then(f,l)}p((o=o.apply(e,r||[])).next())})},y=this&&this.__generator||function(e,r){var o,a,s,h,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return h={next:f(0),throw:f(1),return:f(2)},"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function f(p){return function(k){return function l(p){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(s=2&p[0]?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[2&p[0],s.value]),p[0]){case 0:case 1:s=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,a=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(!(s=(s=n.trys).length>0&&s[s.length-1])&&(6===p[0]||2===p[0])){n=0;continue}if(3===p[0]&&(!s||p[1]>s[0]&&p[1]<s[3])){n.label=p[1];break}if(6===p[0]&&n.label<s[1]){n.label=s[1],s=p;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(p);break}s[2]&&n.ops.pop(),n.trys.pop();continue}p=r.call(e,n)}catch(k){p=[6,k],a=0}finally{o=s=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([p,k])}}};Object.defineProperty(P,"__esModule",{value:!0}),P.applyNoiseCancellation=P.NoiseCancellationImpl=void 0;var v=u(89788),i=(u(61458),function(){function e(r,n){this._processor=r,this._sourceTrack=n,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 new 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(r){return g(this,void 0,void 0,function(){var n,o,a;return y(this,function(s){switch(s.label){case 0:return n=this._processor.isEnabled(),this._processor.disconnect(),[4,r()];case 1:return o=s.sent(),this._sourceTrack=o,[4,this._processor.connect(o)];case 2:return a=s.sent(),n?this._processor.enable():this._processor.disable(),[2,a]}})})},e.prototype.disablePermanently=function(){return this._disabledPermanent=!0,this.disable()},e.prototype.stop=function(){this._processor.disconnect(),this._sourceTrack.stop()},e}());P.NoiseCancellationImpl=i,P.applyNoiseCancellation=function t(e,r,n){return g(this,void 0,void 0,function(){var o,a,s,h;return y(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,v.createNoiseCancellationAudioProcessor(r,n)];case 1:return o=f.sent(),a=o.connect(e),s=new i(o,e),[2,{cleanTrack:a,noiseCancellation:s}];case 2:return h=f.sent(),n.warn("Failed to create noise cancellation. Returning normal audio track: "+h),[2,{cleanTrack:e}];case 3:return[2]}})})}},33501:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){return c.call(this,t,e)||this}return g(i,c),i}(u(11639));O.exports=v},58797:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=u(61534),i=function(t){function e(r,n,o,a,s,h,f){return t.call(this,r,n,o,a,s,h,f)||this}return g(e,t),e.prototype.toString=function(){return"[RemoteAudioTrack #"+this._instanceId+": "+this.sid+"]"},e.prototype._start=function(){t.prototype._start.call(this),this._dummyEl&&(this._disposeMediaElement?this._disposeMediaElement(this._dummyEl):this._dummyEl.srcObject=null,this._dummyEl=null)},e.prototype.setPriority=function(r){return t.prototype.setPriority.call(this,r)},e}(u(61628)(y));O.exports=i},98661:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){return c.call(this,t,e)||this}return g(i,c),i.prototype.toString=function(){return"[RemoteAudioTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i}(u(41521));O.exports=v},15606:function(O,P,u){var n,g=this&&this.__extends||(n=function(o,a){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,h){s.__proto__=h}||function(s,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(s[f]=h[f])})(o,a)},function(o,a){if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function s(){this.constructor=o}n(o,a),o.prototype=null===a?Object.create(a):(s.prototype=a.prototype,new s)}),y=this&&this.__read||function(n,o){var a="function"==typeof Symbol&&n[Symbol.iterator];if(!a)return n;var h,l,s=a.call(n),f=[];try{for(;(void 0===o||o-- >0)&&!(h=s.next()).done;)f.push(h.value)}catch(p){l={error:p}}finally{try{h&&!h.done&&(a=s.return)&&a.call(s)}finally{if(l)throw l.error}}return f},v=this&&this.__spreadArray||function(n,o){for(var a=0,s=o.length,h=n.length;a<s;a++,h++)n[h]=o[a];return n},c=u(81703),i=u(28701),t=i.typeErrors,e=i.trackPriority,r=function(n){function o(a,s,h){var f=n.call(this,s.id,"data",h)||this;return Object.defineProperties(f,{_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:s.maxPacketLifeTime},maxRetransmits:{enumerable:!0,value:s.maxRetransmits},ordered:{enumerable:!0,value:s.ordered},priority:{enumerable:!0,get:function(){return this._priority}},reliable:{enumerable:!0,value:null===s.maxPacketLifeTime&&null===s.maxRetransmits},sid:{enumerable:!0,value:a}}),s.on("message",function(l){f.emit("message",l,f)}),f}return g(o,n),o.prototype.setPriority=function(a){var s=v([null],y(Object.values(e)));if(!s.includes(a))throw t.INVALID_VALUE("priority",s);return this._priority=a,this},o.prototype._setEnabled=function(){},o.prototype._setSwitchedOff=function(a){this._isSwitchedOff!==a&&(this._isSwitchedOff=a,this.emit
1(a?"switchedOff":"switchedOn",this))},o}(c);O.exports=r},58459:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){return c.call(this,t,e)||this}return g(i,c),i.prototype.toString=function(){return"[RemoteDataTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i}(u(41521));O.exports=v},61628:function(O,P,u){var a,g=this&&this.__extends||(a=function(s,h){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,l){f.__proto__=l}||function(f,l){for(var p in l)Object.prototype.hasOwnProperty.call(l,p)&&(f[p]=l[p])})(s,h)},function(s,h){if("function"!=typeof h&&null!==h)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function f(){this.constructor=s}a(s,h),s.prototype=null===h?Object.create(h):(f.prototype=h.prototype,new f)}),y=this&&this.__read||function(a,s){var h="function"==typeof Symbol&&a[Symbol.iterator];if(!h)return a;var l,k,f=h.call(a),p=[];try{for(;(void 0===s||s-- >0)&&!(l=f.next()).done;)p.push(l.value)}catch(T){k={error:T}}finally{try{l&&!l.done&&(h=f.return)&&h.call(f)}finally{if(k)throw k.error}}return p},v=this&&this.__spreadArray||function(a,s){for(var h=0,f=s.length,l=a.length;h<f;h++,l++)a[l]=s[h];return a},c=u(28701),i=c.typeErrors,t=c.trackPriority,e=u(23948).isIOS,r=u(82181);O.exports=function n(a){return function(s){function h(f,l,p,k,T,E,S){var m=this;return S=Object.assign({workaroundWebKitBug212780:e()&&"object"==typeof document&&"function"==typeof document.addEventListener&&"string"==typeof document.visibilityState},S),m=s.call(this,l,S)||this,Object.defineProperties(m,{_isEnabled:{value:p,writable:!0},_isSwitchedOff:{value:k,writable:!0},_priority:{value:null,writable:!0},_setPriority:{value:T},_setRenderHint:{value:function(b){m._log.debug("updating render hint:",b),E(b)}},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:f},_workaroundWebKitBug212780:{value:S.workaroundWebKitBug212780},_workaroundWebKitBug212780Cleanup:{value:null,writable:!0}}),m}return g(h,s),h.prototype.setPriority=function(f){var l=v([null],y(Object.values(t)));if(!l.includes(f))throw i.INVALID_VALUE("priority",l);return this._priority!==f&&(this._priority=f,this._setPriority(f)),this},h.prototype._setEnabled=function(f){this._isEnabled!==f&&(this._isEnabled=f,this.emit(this._isEnabled?"enabled":"disabled",this))},h.prototype._setSwitchedOff=function(f){this._isSwitchedOff!==f&&(this._isSwitchedOff=f,this.emit(f?"switchedOff":"switchedOn",this))},h.prototype.attach=function(f){var l=s.prototype.attach.call(this,f);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 o(a){var s=a._log,h=a.kind;function f(l){l&&a._attachments.forEach(function(p){var k=a._elShims.get(p);p.paused&&k&&!k.pausedIntentionally()&&(s.info("Playing inadvertently paused <"+h+"> element"),s.debug("Element:",p),s.debug("RemoteMediaTrack:",a),p.play().then(function(){s.info("Successfully played inadvertently paused <"+h+"> element"),s.debug("Element:",p),s.debug("RemoteMediaTrack:",a)}).catch(function(E){s.warn("Error while playing inadvertently paused <"+h+"> element:",{err:E,el:p,remoteMediaTrack:a})}))})}return r.onVisibilityChange(2,f),function(){r.offVisibilityChange(2,f)}}(this)),l},h.prototype.detach=function(f){var l=s.prototype.detach.call(this,f);return 0===this._attachments.size&&(this.mediaStreamTrack.enabled=!1,this.processedTrack&&(this.processedTrack.enabled=!1),this._workaroundWebKitBug212780Cleanup&&(this._workaroundWebKitBug212780Cleanup(),this._workaroundWebKitBug212780Cleanup=null)),l},h}(a)}},41521:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t.name,t.sid,e)||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 n=t.error,o=t.isEnabled,a=t.isSwitchedOff,s=t.priority;return t.on("updated",function(){if(n!==t.error)return n=t.error,void r.emit("subscriptionFailed",t.error);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&&r.emit("publishPriorityChanged",s=t.priority)}),r}return g(i,c),i.prototype.toString=function(){return"[RemoteTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i.prototype._subscribed=function(t){!this._track&&t&&(this._track=t,this.emit("subscribed",t))},i.prototype._unsubscribe=function(){if(this._track){var t=this._track;this._track=null,this.emit("unsubscribed",t)}},i}(u(29222));O.exports=v},51629:function(O,P,u){var l,g=this&&this.__extends||(l=function(p,k){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,E){T.__proto__=E}||function(T,E){for(var S in E)Object.prototype.hasOwnProperty.call(E,S)&&(T[S]=E[S])})(p,k)},function(p,k){if("function"!=typeof k&&null!==k)throw new TypeError("Class extends value "+String(k)+" is not a constructor or null");function T(){this.constructor=p}l(p,k),p.prototype=null===k?Object.create(k):(T.prototype=k.prototype,new T)}),y=this&&this.__read||function(l,p){var k="function"==typeof Symbol&&l[Symbol.iterator];if(!k)return l;var E,m,T=k.call(l),S=[];try{for(;(void 0===p||p-- >0)&&!(E=T.next()).done;)S.push(E.value)}catch(b){m={error:b}}finally{try{E&&!E.done&&(k=T.return)&&k.call(T)}finally{if(m)throw m.error}}return S},v=u(61628),c=u(54332),i=u(82181),t=u(35318).NullObserver,e=u(66543),r=v(c),n=50,o=function(l){function p(k,T,E,S,m,b,d){var _=this;return d=Object.assign({clientTrackSwitchOffControl:"auto",contentPreferencesMode:"auto",enableDocumentVisibilityTurnOff:!0},d),d=Object.assign({IntersectionObserver:typeof IntersectionObserver>"u"||"auto"!==d.clientTrackSwitchOffControl?t:IntersectionObserver,ResizeObserver:typeof ResizeObserver>"u"||"auto"!==d.contentPreferencesMode?t:ResizeObserver},d),_=l.call(this,k,T,E,S,m,b,d)||this,Object.defineProperties(_,{_enableDocumentVisibilityTurnOff:{value:!0===d.enableDocumentVisibilityTurnOff&&"auto"===d.clientTrackSwitchOffControl},_documentVisibilityTurnOffCleanup:{value:null,writable:!0},_clientTrackSwitchOffControl:{value:d.clientTrackSwitchOffControl},_contentPreferencesMode:{value:d.contentPreferencesMode},_invisibleElements:{value:new WeakSet},_elToPipCallbacks:{value:new WeakMap},_elToPipWindows:{value:new WeakMap},_turnOffTimer:{value:new e(function(){_._setRenderHint({enabled:!1})},n,!1)},_resizeObserver:{value:new d.ResizeObserver(function(w){w.find(function(j){return!_._invisibleElements.has(j.target)})&&h(_)})},_intersectionObserver:{value:new d.IntersectionObserver(function(w){var R=!1;w.forEach(function(j){!_._invisibleElements.has(j.target)!==j.isIntersecting&&(j.isIntersecting?(_._log.debug("intersectionObserver detected: Off => On"),_._invisibleElements.delete(j.target)):(_._log.debug("intersectionObserver detected: On => Off"),_._invisibleElements.add(j.target)),R=!0)}),R&&(s(_),h(_))},{threshold:.25}
1)}}),_}return g(p,l),p.prototype._start=function(k){var T=l.prototype._start.call(this,k);return s(this),T},p.prototype.switchOn=function(){if("manual"!==this._clientTrackSwitchOffControl)throw new Error('Invalid state. You can call switchOn only when bandwidthProfile.video.clientTrackSwitchOffControl is set to "manual"');return this._setRenderHint({enabled:!0}),this},p.prototype.switchOff=function(){if("manual"!==this._clientTrackSwitchOffControl)throw new Error('Invalid state. You can call switchOff only when bandwidthProfile.video.clientTrackSwitchOffControl is set to "manual"');return this._setRenderHint({enabled:!1}),this},p.prototype.setContentPreferences=function(k){if("manual"!==this._contentPreferencesMode)throw new Error('Invalid state. You can call switchOn only when bandwidthProfile.video.contentPreferencesMode is set to "manual"');return k.renderDimensions&&this._setRenderHint({renderDimensions:k.renderDimensions}),this},p.prototype._unObservePip=function(k){var T=this._elToPipCallbacks.get(k);T&&(k.removeEventListener("enterpictureinpicture",T.onEnterPip),k.removeEventListener("leavepictureinpicture",T.onLeavePip),this._elToPipCallbacks.delete(k))},p.prototype._observePip=function(k){var T=this;if(!this._elToPipCallbacks.get(k)){var S=function(d){return T._onEnterPip(d,k)},m=function(d){return T._onLeavePip(d,k)};k.addEventListener("enterpictureinpicture",S),k.addEventListener("leavepictureinpicture",m),this._elToPipCallbacks.set(k,{onEnterPip:S,onLeavePip:m,onResizePip:function(d){return T._onResizePip(d,k)}})}},p.prototype._onEnterPip=function(k,T){this._log.debug("onEnterPip");var E=k.pictureInPictureWindow;this._elToPipWindows.set(T,E);var S=this._elToPipCallbacks.get(T).onResizePip;E.addEventListener("resize",S),s(this)},p.prototype._onLeavePip=function(k,T){this._log.debug("onLeavePip"),this._elToPipWindows.delete(T);var E=this._elToPipCallbacks.get(T).onResizePip;k.pictureInPictureWindow.removeEventListener("resize",E),s(this)},p.prototype._onResizePip=function(){h(this)},p.prototype.attach=function(k){var T=l.prototype.attach.call(this,k);return"auto"===this._clientTrackSwitchOffControl&&this._invisibleElements.add(T),this._intersectionObserver.observe(T),this._resizeObserver.observe(T),this._enableDocumentVisibilityTurnOff&&(this._documentVisibilityTurnOffCleanup=this._documentVisibilityTurnOffCleanup||function f(l){function p(){s(l)}return i.onVisibilityChange(1,p),function(){i.offVisibilityChange(1,p)}}(this)),this._observePip(T),T},p.prototype.detach=function(k){var T=this,E=l.prototype.detach.call(this,k);return(Array.isArray(E)?E:[E]).forEach(function(m){T._intersectionObserver.unobserve(m),T._resizeObserver.unobserve(m),T._invisibleElements.delete(m),T._unObservePip(m)}),0===this._attachments.size&&this._documentVisibilityTurnOffCleanup&&(this._documentVisibilityTurnOffCleanup(),this._documentVisibilityTurnOffCleanup=null),s(this),h(this),E},p.prototype.addProcessor=function(){return l.prototype.addProcessor.apply(this,arguments)},p.prototype.removeProcessor=function(){return l.prototype.removeProcessor.apply(this,arguments)},p.prototype.toString=function(){return"[RemoteVideoTrack #"+this._instanceId+": "+this.sid+"]"},p.prototype.setPriority=function(k){return l.prototype.setPriority.call(this,k)},p}(r);function s(l){if("auto"===l._clientTrackSwitchOffControl){var p=l._getAllAttachedElements().filter(function(E){return!l._invisibleElements.has(E)}),T=l._getAllAttachedElements().filter(function(E){return l._elToPipWindows.has(E)}).length>0||function a(l){if(!("documentPictureInPicture"in globalThis))return!1;var p=globalThis.documentPictureInPicture.window;if(!p)return!1;var k=new WeakSet(p.document.querySelectorAll("video"));return l._getAllAttachedElements().some(function(T){return k.has(T)})}(l)||"visible"===document.visibilityState&&p.length>0;!0===T?(l._turnOffTimer.clear(),l._setRenderHint({enabled:!0})):l._turnOffTimer.isSet||l._turnOffTimer.start()}}function h(l){if("auto"===l._contentPreferencesMode){var p=l._getAllAttachedElements().filter(function(_){return!l._invisibleElements.has(_)}),k=l._getAllAttachedElements().map(function(_){var w=l._elToPipWindows.get(_);return w?{clientHeight:w.height,clientWidth:w.width}:{clientHeight:0,clientWidth:0}}),T=p.concat(k);if(T.length>0){var S=y(T.sort(function(_,w){return w.clientHeight+w.clientWidth-_.clientHeight-_.clientWidth-1}),1)[0];l._setRenderHint({renderDimensions:{height:S.clientHeight,width:S.clientWidth}})}}}O.exports=o},91768:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){return c.call(this,t,e)||this}return g(i,c),i.prototype.toString=function(){return"[RemoteVideoTrackPublication #"+this._instanceId+": "+this.trackSid+"]"},i}(u(41521));O.exports=v},60808:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=this&&this.__read||function(i,t){var e="function"==typeof Symbol&&i[Symbol.iterator];if(!e)return i;var n,a,r=e.call(i),o=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(a)throw a.error}}return o},c=function(i){function t(e){var r=i.call(this,e.id,e)||this;return Object.defineProperties(r,{_clones:{value:new Set},_eventsToReemitters:{value:new Map([["mute",function(){return r.queue("muted")}],["unmute",function(){return r.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}}}),r._reemitMediaStreamTrackEvents(),r}return g(t,i),t.prototype._reemitMediaStreamTrackEvents=function(e){void 0===e&&(e=this._track);var n=this._eventsToReemitters,o=this._track;n.forEach(e.addEventListener?function(s,h){return e.addEventListener(h,s)}:function(s,h){e["on"+h]=s}),o!==e&&(n.forEach(function(s,h){return o.removeEventListener(h,s)}),o.muted!==e.muted)&&n.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 r=this,n=Array.from(this._clones),o=Array.from(this._senders);return Promise.all(n.map(function(a){return a.setMediaStreamTrack(e.clone())}).concat(o.map(function(a){return r._replaceTrack(a,e)}))).finally(function(){r._reemitMediaStreamTrackEvents(e),r._track=e})},t.prototype.addSender=function(e,r){return this._senders.add(e),r&&this._senderToPublisherHintCallbacks.set(e,r),this},t.prototype.removeSender=function(e){return this._senders.delete(e),this._senderToPublisherHintCallbacks.delete(e),this},t.prototype.setPublisherHint=function(e){var n=y(Array.from(this._senderToPublisherHintCallbacks.values()),1)[0];return n?n(e):Promise.resolve("COULD_NOT_APPLY_HINT")},t.prototype._replaceTrack=function(e,r){var n=this;return e.replaceTrack(r).then(function(o){return n.setPublisherHint(null).catch(function(){}),n.emit("replaced"),o})},t}(u(11639));O.exports=c},29222:function(O,P,u){var o,g=this&&this.__extends||(o=function(a,s){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(h[l]=f[l])})(a,s)},function(a,s){if("function"!=typeof s&&null!==s)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function h(){this.constructor=a}o(a,s),a.prototype=null===s?Object.create(s):(h.prototype=s.prototype,new h)}),y=u(50133),v=u(79739),c=v.buildLogLevels,i=v.valueToJSON,t=u(28701).DEFAULT_LOG_LEVEL,e=u(61458),r=0,n=function(o){function a(s,h,f){var l=o.call(this)||this;f=Object.assign({logLevel:t},f);var p=c(f.logLevel);return Object.defineProperties(l,{_instanceId:{value:r++},_log:{value:f.log?f.log.createLog("default",l):new e("default",l,p,f.loggerName)}
1,trackName:{enumerable:!0,value:s},trackSid:{enumerable:!0,value:h}}),l}return g(a,o),a.prototype.toJSON=function(){return i(this)},a.prototype.toString=function(){return"[TrackPublication #"+this._instanceId+": "+this.trackSid+"]"},a}(y);O.exports=n},11639:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,e.kind)||this;return Object.defineProperties(r,{_track:{value:e,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 g(i,c),i.prototype.stop=function(){this.track.stop(),c.prototype.stop.call(this)},i}(u(54605));O.exports=v},79062:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(59069).EventEmitter,v=u(28701).DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS,c=function(i){function t(e){var r=i.call(this)||this;return Object.defineProperties(r,{_lastStatsSaveTime:{value:null,writable:!0},_lastStatsPublishTime:{value:null,writable:!0},_log:{value:e},_processorInfo:{value:null,writable:!0},_stats:{value:null,writable:!0}}),r.on("add",function(n){r._lastStatsSaveTime=Date.now(),r._lastStatsPublishTime=Date.now(),r._processorInfo=n,r._stats=[],r._reemitEvent("add",r._getEventData())}),r.on("remove",function(){var n=r._getEventData();r._lastStatsSaveTime=null,r._lastStatsPublishTime=null,r._processorInfo=null,r._stats=null,r._reemitEvent("remove",n)}),r.on("start",function(){r._reemitEvent("start",r._getEventData())}),r.on("stop",function(n){r._reemitEvent("stop",Object.assign({message:n},r._getEventData()))}),r.on("stats",function(){return r._maybeEmitStats()}),r}return g(t,i),t.prototype._getEventData=function(){if(!this._processorInfo)return{};var e=this._processorInfo,r=e.processor,l={captureHeight:e.captureHeight,captureWidth:e.captureWidth,inputFrameRate:e.inputFrameRate,isRemoteVideoTrack:e.isRemoteVideoTrack,inputFrameBufferType:e.inputFrameBufferType,outputFrameBufferContextType:e.outputFrameBufferContextType};return l.name=r._name||"VideoProcessor",["assetsPath","blurFilterRadius","debounce","fitType","isSimdEnabled","maskBlurRadius","pipeline","version"].forEach(function(p){var k=r["_"+p];typeof k<"u"&&(l[p]=k)}),Object.keys(l).forEach(function(p){var k=l[p];"boolean"==typeof k&&(l[p]=k?"true":"false")}),l},t.prototype._maybeEmitStats=function(){if(this._stats&&this._processorInfo){var e=this._processorInfo.processor._benchmark;if(e){var r=Date.now();if(!(r-this._lastStatsSaveTime<1e3)){var n={outputFrameRate:e.getRate("totalProcessingDelay")};if(["captureFrameDelay","imageCompositionDelay","inputImageResizeDelay","processFrameDelay","segmentationDelay"].forEach(function(s){n[s]=e.getAverageDelay(s)}),this._lastStatsSaveTime=r,this._stats.push(n),!(r-this._lastStatsPublishTime<v)){this._lastStatsPublishTime=r;var a=this._stats.splice(0).reduce(function(s,h,f){return Object.keys(n).forEach(function(l){s[l]||(s[l]=0),s[l]=(s[l]*f+h[l])/(f+1)}),s},{});Object.keys(a).forEach(function(s){a[s]=parseFloat(a[s].toFixed(2))}),this._reemitEvent("stats",Object.assign({},a,this._getEventData()))}}}}},t.prototype._reemitEvent=function(e,r){this._log.debug("VideoProcessor:"+e,r),this.emit
1("event",{name:e,data:r})},t}(y);O.exports=c},54332:function(O,P,u){var n,g=this&&this.__extends||(n=function(o,a){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,h){s.__proto__=h}||function(s,h){for(var f in h)Object.prototype.hasOwnProperty.call(h,f)&&(s[f]=h[f])})(o,a)},function(o,a){if("function"!=typeof a&&null!==a)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function s(){this.constructor=o}n(o,a),o.prototype=null===a?Object.create(a):(s.prototype=a.prototype,new s)}),y=u(35366),v=u(57017),c=u(79062),t=(u(77627),u(28701).DEFAULT_FRAME_RATE),e=function(n){function o(a,s){var h=n.call(this,a,s)||this;return Object.defineProperties(h,{_isCapturing:{value:!1,writable:!0},_inputFrame:{value:null,writable:!0},_outputFrame:{value:null,writable:!0},_processorEventObserver:{value:null,writable:!0},_processorOptions:{value:{},writable:!0},_stopCapture:{value:function(){},writable:!0},_unmuteHandler:{value:null,writable:!0},dimensions:{enumerable:!0,value:{width:null,height:null}},processor:{enumerable:!0,value:null,writable:!0}}),h._processorEventObserver=new(s.VideoProcessorEventObserver||c)(h._log),h}return g(o,n),o.prototype._checkIfCanCaptureFrames=function(a){void 0===a&&(a=!1);var s=!0,h="",f=this.mediaStreamTrack;return f.enabled||(s=!1,h="MediaStreamTrack is disabled"),"ended"===f.readyState&&(s=!1,h="MediaStreamTrack is ended"),this.processor||(s=!1,h="VideoProcessor not detected."),!this._attachments.size&&!a&&(s=!1,h="VideoTrack is not publishing and there is no attached element."),h&&this._log.debug(h),{canCaptureFrames:s,message:h}},o.prototype._captureFrames=function(){var a=this;if(this._isCapturing)this._log.debug("Ignoring captureFrames call. Capture is already in progress");else{if(!this._checkIfCanCaptureFrames().canCaptureFrames)return this._isCapturing=!1,void this._log.debug("Cannot capture frames. Ignoring captureFrames call.");this._isCapturing=!0,this._processorEventObserver.emit("start"),this._log.debug("Start capturing frames");var s=this._processorOptions.inputFrameBufferType;this._dummyEl.play().then(function(){a._stopCapture=v(a._dummyEl,function(f){var l=a._checkIfCanCaptureFrames();if(!l.canCaptureFrames)return f&&f.close(),a._isCapturing=!1,a._stopCapture(),a._processorEventObserver.emit("stop",l.message),a._log.debug("Cannot capture frames. Stopping capturing frames."),Promise.resolve();var p=a.mediaStreamTrack.getSettings(),k=p.width,T=void 0===k?0:k,E=p.height,S=void 0===E?0:E;a._outputFrame&&a._outputFrame.width!==T&&(a._outputFrame.width=T,a._outputFrame.height=S),a._inputFrame&&(a._inputFrame.width!==T&&(a._inputFrame.width=T,a._inputFrame.height=S),a._inputFrame.getContext("2d").drawImage(a._dummyEl,0,0,T,S));var m=f||(["video","videoframe"].includes(s)?a._dummyEl:a._inputFrame),b=null;try{b=a.processor.processFrame(m,a._outputFrame)}catch(d){a._log.debug("Exception detected after calling processFrame.",d)}return(b instanceof Promise?b:Promise.resolve(b)).then(function(){a._outputFrame&&("function"==typeof a.processedTrack.requestFrame&&a.processedTrack.requestFrame(),a._processorEventObserver.emit("stats"))})},s)}).catch(function(h){return a._log.error("Video element cannot be played",{error:h,track:a})})}},o.prototype._initialize=function(){var a=this;n.prototype._initialize.call(this),this._dummyEl&&(this._dummyEl.onloadedmetadata=function(){r(a,a._dummyEl)&&(a.dimensions.width=a._dummyEl.videoWidth,a.dimensions.height=a._dummyEl.videoHeight)},this._dummyEl.onresize=function(){r(a,a._dummyEl)&&(a.dimensions.width=a._dummyEl.videoWidth,a.dimensions.height=a._dummyEl.videoHeight,a.isStarted&&(a._log.debug("Dimensions changed:",a.dimensions),a.emit(o.DIMENSIONS_CHANGED,a)))})},o.prototype._restartProcessor=function(){var a=this.processor;if(a){var s=Object.assign({},this._processorOptions);this.removeProcessor(a),this.addProcessor(a,s)}},o.prototype._start=function(a){return this.dimensions.width=a.videoWidth,this.dimensions.height=a.videoHeight,this._log.debug("Dimensions:",this.dimensions),this.emit(o.DIMENSIONS_CHANGED,this),n.prototype._start.call(this,a)},o.prototype.addProcessor=function(a,s){var h=this;if(!a||"function"!=typeof a.processFrame)throw new Error("Received an invali
1d VideoProcessor from addProcessor.");if(this.processor)throw new Error("A VideoProcessor has already been added.");if(!this._dummyEl)throw new Error("VideoTrack has not been initialized.");this._log.debug("Adding VideoProcessor to the VideoTrack",a),this._unmuteHandler||(this._unmuteHandler=function(){h._log.debug("mediaStreamTrack unmuted"),h.processedTrack.muted&&(h._log.debug("mediaStreamTrack is unmuted but processedTrack is muted. Restarting processor."),h._restartProcessor())},this.mediaStreamTrack.addEventListener?this.mediaStreamTrack.addEventListener("unmute",this._unmuteHandler):this.mediaStreamTrack.onunmute=this._unmuteHandler.bind(this)),this._processorOptions=s||{};var f=this._processorOptions,l=f.inputFrameBufferType,p=f.outputFrameBufferContextType;if(typeof OffscreenCanvas>"u"&&"offscreencanvas"===l)throw new Error("OffscreenCanvas is not supported by this browser.");if(l&&"videoframe"!==l&&"video"!==l&&"canvas"!==l&&"offscreencanvas"!==l)throw new Error("Invalid inputFrameBufferType of "+l);l||(l=typeof OffscreenCanvas>"u"?"canvas":"offscreencanvas");var k=this.mediaStreamTrack.getSettings(),T=k.width,E=void 0===T?0:T,S=k.height,m=void 0===S?0:S,b=k.frameRate,d=void 0===b?t:b;if("offscreencanvas"===l&&(this._inputFrame=new OffscreenCanvas(E,m)),"canvas"===l&&(this._inputFrame=document.createElement("canvas")),this._inputFrame&&(this._inputFrame.width=E,this._inputFrame.height=m),this._outputFrame=document.createElement("canvas"),this._outputFrame.width=E,this._outputFrame.height=m,!this._outputFrame.getContext(p=p||"2d"))throw new Error("Cannot get outputFrameBufferContextType: "+p+".");var w=typeof CanvasCaptureMediaStreamTrack<"u"&&CanvasCaptureMediaStreamTrack.prototype&&"function"==typeof CanvasCaptureMediaStreamTrack.prototype.requestFrame?0:void 0;return this.processedTrack=this._outputFrame.captureStream(w).getTracks()[0],this.processedTrack.enabled=this.mediaStreamTrack.enabled,this.processor=a,this._processorEventObserver.emit("add",{processor:a,captureHeight:m,captureWidth:E,inputFrameRate:d,isRemoteVideoTrack:this.toString().includes("RemoteVideoTrack"),inputFrameBufferType:l,outputFrameBufferContextType:p}),this._updateElementsMediaStreamTrack(),this._captureFrames(),this},o.prototype.attach=function(){var a=n.prototype.attach.apply(this,arguments);return this.processor&&this._captureFrames(),a},o.prototype.detach=function(){return n.prototype.detach.apply(this,arguments)},o.prototype.removeProcessor=function(a){if(!a)throw new Error("Received an invalid VideoProcessor from removeProcessor.");if(!this.processor)throw new Error("No existing VideoProcessor detected.");if(a!==this.processor)throw new Error("The provided VideoProcessor is different than the existing one.");return this._processorEventObserver.emit("remove"),this._log.debug("Removing VideoProcessor from the VideoTrack",a),this._stopCapture(),this._stopCapture=function(){},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},o}(y);function r(n,o){return n.dimensions.width!==o.videoWidth||n.dimensions.height!==o.videoHeight}e.DIMENSIONS_CHANGED="dimensionsChanged",O.exports=e},24621:function(O,P,u){var o,g=this&&this.__extends||(o=function(a,s){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(h[l]=f[l])})(a,s)},function(a,s){if("function"!=typeof s&&null!==s)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function h(){this.constructor=a}o(a,s),a.prototype=null===s?Object.create(s):(h.prototype=s.prototype,new h)}),y=this&&this.__read||function(o,a){var s="function"==typeof Symbol&&o[Symbol.iterator];if(!s)return o;var f,p,h=s.call(o),l=[];try{for(;(void 0===a||a-- >0)&&!(f=h.next()).done;)l.push(f.value)}catch(k){p={error:k}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(p)throw p.error}}return l},v=u(59069).EventEmitter,c=u(28701),i=c.DEFAULT_NQ_LEVEL_LOCAL,t=c.DEFAULT_NQ_LEVEL_REMOTE,e=c.MAX_NQ_LEVEL,r=u(79739).inRange,n=function(o){function a(s){var h=o.call(this)||this;return s=Object.assign({local:i,remote:t},s),Object.defineProperties(h,{local:{value:r(s.local,i,e)?s.local:i,writable:!0},remote:{value:r(s.remote,t,e)?s.remote:t,writable:!0}}),h}return g(a,o),a.prototype.update=function(s){var h=this;s=Object.assign({local:this.local,remote:this.remote}
1,s),[["local",i,3],["remote",t,3]].forEach(function(f){var l=y(f,3),p=l[0],k=l[1];h[p]="number"==typeof s[p]&&r(s[p],k,l[2])?s[p]:k})},a}(v);O.exports=n},89788:function(O,P,u){var g=this&&this.__awaiter||function(n,o,a,s){return new(a||(a=Promise))(function(f,l){function p(E){try{T(s.next(E))}catch(S){l(S)}}function k(E){try{T(s.throw(E))}catch(S){l(S)}}function T(E){E.done?f(E.value):function h(f){return f instanceof a?f:new a(function(l){l(f)})}(E.value).then(p,k)}T((s=s.apply(n,o||[])).next())})},y=this&&this.__generator||function(n,o){var s,h,f,l,a={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return l={next:p(0),throw:p(1),return:p(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function p(T){return function(E){return function k(T){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,h&&(f=2&T[0]?h.return:T[0]?h.throw||((f=h.return)&&f.call(h),0):h.next)&&!(f=f.call(h,T[1])).done)return f;switch(h=0,f&&(T=[2&T[0],f.value]),T[0]){case 0:case 1:f=T;break;case 4:return a.label++,{value:T[1],done:!1};case 5:a.label++,h=T[1],T=[0];continue;case 7:T=a.ops.pop(),a.trys.pop();continue;default:if(!(f=(f=a.trys).length>0&&f[f.length-1])&&(6===T[0]||2===T[0])){a=0;continue}if(3===T[0]&&(!f||T[1]>f[0]&&T[1]<f[3])){a.label=T[1];break}if(6===T[0]&&a.label<f[1]){a.label=f[1],f=T;break}if(f&&a.label<f[2]){a.label=f[2],a.ops.push(T);break}f[2]&&a.ops.pop(),a.trys.pop();continue}T=o.call(n,a)}catch(E){T=[6,E],h=0}finally{s=f=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([T,E])}}};Object.defineProperty(P,"__esModule",{value:!0}),P.createNoiseCancellationAudioProcessor=void 0;var v=u(69121),i=(u(61458),{krisp:{supportedVersion:"1.0.0",pluginFile:"krispsdk.mjs"},rnnoise:{supportedVersion:"0.6.0",pluginFile:"rnnoise_sdk.mjs"}}),e=new Map;P.createNoiseCancellationAudioProcessor=function r(n,o){return g(this,void 0,void 0,function(){var a,s,h,l,p,k,T,E;return y(this,function(S){switch(S.label){case 0:if(a=e.get(n.vendor))return[3,6];if(!(s=i[n.vendor]))throw new Error("Unsupported NoiseCancellationOptions.vendor: "+n.vendor);h=s.supportedVersion,p=(l=n.sdkAssetsPath)+"/"+s.pluginFile,S.label=1;case 1:return S.trys.push([1,5,,6]),o.debug("loading noise cancellation sdk: ",p),[4,v(p)];case 2:return k=S.sent(),o.debug("Loaded noise cancellation sdk:",k),function(n){var o=n.supportedVersion,a=n.plugin,s=n.log;if(!a.getVersion||!a.isSupported)throw new Error("Plugin does not export getVersion/isSupported api. Are you using old version of the plugin ?");var h=a.getVersion();s.debug("Plugin Version = "+h);var f=o.split(".").map(function(T){return Number(T)}),l=h.split(".").map(function(T){return Number(T)});if(3!==f.length||3!==l.length)throw new Error("Unsupported Plugin version format: "+o+", "+h);if(f[0]!==l[0])throw new Error("Major version mismatch: [Plugin version "+h+"], [Supported Version "+o+"]");if(l[1]<f[1])throw new Error("Minor version mismatch: [Plugin version "+h+"] < [Supported Version "+o+"]");var p=new AudioContext,k=a.isSupported(p);if(p.close(),!k)throw new Error("Noise Cancellation plugin is not supported on your browser")}({supportedVersion:h,plugin:T=k.default,log:o}),T.isInitialized()?[3,4]:(o.debug("initializing noise cancellation sdk: ",l),[4,T.init({rootDir:l})]);case 3:S.sent(),o.debug("noise cancellation sdk initialized!"),S.label=4;case 4:return e.set(n.vendor,a={vendor:n.vendor,isInitialized:function(){return T.isInitialized()},isConnected:function(){return T.isConnected()},isEnabled:function(){return T.isEnabled()},disconnect:function(){return T.disconnect()},enable:function(){return T.enable()},disable:function(){return T.disable()},destroy:function(){return T.destroy()},setLogging:function(m){return T.setLogging(m)},connect:function(m){o.debug("connect: ",m.id),T.isConnected()&&T.disconnect();var b=T.connect(new MediaStream([m]));if(!b)throw new Error("Error connecting with noise cancellation sdk");var d=b.getAudioTracks()[0];if(!d)throw new Error("Error getting clean track from noise cancellation sdk");return T.enable(),d}}),[3,6];case 5:throw E=S.sent(),o.error("Error loading noise cancellation sdk:"+p,E),E;case 6:return[2,a]}})})}}
1,69218:function(O,P,u){var T,g=this&&this.__extends||(T=function(E,S){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,b){m.__proto__=b}||function(m,b){for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&(m[d]=b[d])})(E,S)},function(E,S){if("function"!=typeof S&&null!==S)throw new TypeError("Class extends value "+String(S)+" is not a constructor or null");function m(){this.constructor=E}T(E,S),E.prototype=null===S?Object.create(S):(m.prototype=S.prototype,new m)}),y=this&&this.__read||function(T,E){var S="function"==typeof Symbol&&T[Symbol.iterator];if(!S)return T;var b,_,m=S.call(T),d=[];try{for(;(void 0===E||E-- >0)&&!(b=m.next()).done;)d.push(b.value)}catch(w){_={error:w}}finally{try{b&&!b.done&&(S=m.return)&&S.call(m)}finally{if(_)throw _.error}}return d},v=this&&this.__spreadArray||function(T,E){for(var S=0,m=E.length,b=T.length;S<m;S++,b++)T[b]=E[S];return T},c=u(50133),i=u(58797),t=u(98661),e=u(15606),r=u(58459),n=u(51629),o=u(91768),a=u(79739),s=0,h=function(T){function E(S,m){var b=T.call(this)||this,d=function f(T){var E=T.map(function(d){return[d.id,d]}),S=E.filter(function(d){return"audio"===d[1].kind}),m=E.filter(function(d){return"video"===d[1].kind}),b=E.filter(function(d){return"data"===d[1].kind});return{audioTracks:S,dataTracks:b,tracks:E,videoTracks:m}}((m=Object.assign({RemoteAudioTrack:i,RemoteAudioTrackPublication:t,RemoteDataTrack:e,RemoteDataTrackPublication:r,RemoteVideoTrack:n,RemoteVideoTrackPublication:o,tracks:[]},m)).tracks),_=m.log.createLog("default",b),w=new Map(d.audioTracks),R=new Map(d.dataTracks),j=new Map(d.tracks),V=new Map(d.videoTracks);return Object.defineProperties(b,{_RemoteAudioTrack:{value:m.RemoteAudioTrack},_RemoteAudioTrackPublication:{value:m.RemoteAudioTrackPublication},_RemoteDataTrack:{value:m.RemoteDataTrack},_RemoteDataTrackPublication:{value:m.RemoteDataTrackPublication},_RemoteVideoTrack:{value:m.RemoteVideoTrack},_RemoteVideoTrackPublication:{value:m.RemoteVideoTrackPublication},_audioTracks:{value:w},_dataTracks:{value:R},_instanceId:{value:++s},_clientTrackSwitchOffControl:{value:m.clientTrackSwitchOffControl},_contentPreferencesMode:{value:m.contentPreferencesMode},_log:{value:_},_signaling:{value:S},_tracks:{value:j},_trackEventReemitters:{value:new Map},_trackPublicationEventReemitters:{value:new Map},_trackSignalingUpdatedEventCallbacks:{value:new Map},_videoTracks:{value:V},audioTracks:{enumerable:!0,value:new Map},dataTracks:{enumerable:!0,value:new Map},identity:{enumerable:!0,get:function(){return S.identity}},networkQualityLevel:{enumerable:!0,get:function(){return S.networkQualityLevel}},networkQualityStats:{enumerable:!0,get:function(){return S.networkQualityStats}},sid:{enumerable:!0,get:function(){return S.sid}},state:{enumerable:!0,get:function(){return S.state}},tracks:{enumerable:!0,value:new Map},videoTracks:{enumerable:!0,value:new Map},_MediaStream:{value:m.MediaStream},_mapMediaElement:{value:m.mapMediaElement},_disposeMediaElement:{value:m.disposeMediaElement}}),b._tracks.forEach(p.bind(null,b)),S.on("networkQualityLevelChanged",function(){return b.emit("networkQualityLevelChanged",b.networkQualityLevel,b.networkQualityStats&&(b.networkQualityStats.audio||b.networkQualityStats.video)?b.networkQualityStats:null)}),function l(T,E){var S=T._log;"disconnected"!==T.state&&E.on("stateChanged",function m(b){S.debug("Transitioned to state:",b),T.emit(b,T),"disconnected"===b&&(S.debug("Removing Track event reemitters"),E.removeListener("stateChanged",m),T._tracks.forEach(function(d){var _=T._trackEventReemitters.get(d.id);d&&_&&_.forEach(function(w,R){d.removeListener(R,w)})}),E.tracks.forEach(function(d){var _=T._tracks.get(d.id),w=T._trackEventReemitters.get(d.id);_&&w&&w.forEach(function(R,j){_.removeListener(j,R)})}),T._trackEventReemitters.clear(),T.tracks.forEach(function(d){T._trackPublicationEventReemitters.get(d.trackSid).forEach(function(_,w){d.removeListener(w,_)})}),T._trackPublicationEventReemitters.clear())})}(b,S),_.info("Created a new Participant"+(b.identity?": "+b.identity:"")),b}return g(E,T),E.prototype._getTrackEvents=function(){return[["dimensionsChanged","trackDimensionsChanged"],["message","trackMessage"],["started","trackStarted"]]},E.prototype._getTrackPublicationEvents=function(){return[]},E.prototype.toString=function(){return"[Participant #"+this._instanceId+": "+this.sid+"]"},E.prototype._addTrack=function(S,m){var b=this._log;return this._tracks.has(m)?null:(this._tracks.set(m,S),{audio:this._audioTracks,video:this._videoTracks,data:this._dataTracks}[S.kind].set(m,S),p(this,S,m),b.info("Added a new "+a.trackClass(S)+":",m),b.debug(a.trackClass(S)+":",S),S)},E.prototype._addTrackPublication=function(S){var m=this._log;return this.tracks.has(S.trackSid)?null:(this.tracks.set(S.trackSid,S),{audio:this.audioTracks,data:this.dataTracks,video:this.videoTracks}[S.kind].set(S.trackSid,S),function k(T,E){var S=new Map;"disconnected"!==T.state&&(T._getTrackPublicationEvents().forEac
1h(function(m){var b=y(m,2),d=b[0],_=b[1];S.set(d,function(){for(var w=[],R=0;R<arguments.length;R++)w[R]=arguments[R];T.emit.apply(T,v(v([_],y(w)),[E]))}),E.on(d,S.get(d))}),T._trackPublicationEventReemitters.set(E.trackSid,S))}(this,S),m.info("Added a new "+a.trackPublicationClass(S)+":",S.trackSid),m.debug(a.trackPublicationClass(S)+":",S),S)},E.prototype._handleTrackSignalingEvents=function(){var S=this,m=S._log,b=S._clientTrackSwitchOffControl,d=S._contentPreferencesMode,_=S._MediaStream,w=S._mapMediaElement,R=S._disposeMediaElement,j=this;if("disconnected"!==this.state){var V=this._RemoteAudioTrack,N=this._RemoteAudioTrackPublication,x=this._RemoteVideoTrack,M=this._RemoteVideoTrackPublication,C=this._RemoteDataTrack,B=this._RemoteDataTrackPublication,Q=this._signaling;Q.on("trackAdded",Y),Q.on("trackRemoved",W),Q.tracks.forEach(Y),Q.on("stateChanged",function L(I){"disconnected"===I?(m.debug("Removing event listeners"),Q.removeListener("stateChanged",L),Q.removeListener("trackAdded",Y),Q.removeListener("trackRemoved",W)):"connected"===I&&(m.info("reconnected"),setTimeout(function(){return j.emit("reconnected")},0))})}function Y(L){var G=new(0,{audio:N,data:B,video:M}[L.kind])(L,{log:m});j._addTrackPublication(G);var X=L.isSubscribed;X&&K(L),j._trackSignalingUpdatedEventCallbacks.set(L.sid,function(){if(X!==L.isSubscribed){if(X=L.isSubscribed)return void K(L);!function D(L){var I=y(Array.from(j._tracks.entries()).find(function($){return y($,2)[1].sid===L.sid}),2),G=I[0],X=I[1],Z=j.tracks.get(L.sid);X&&j._removeTrack(X,Z,G)}(L)}}),L.on("updated",j._trackSignalingUpdatedEventCallbacks.get(L.sid))}function W(L){L.isSubscribed&&L.setTrackTransceiver(null);var I=j._trackSignalingUpdatedEventCallbacks.get(L.sid);I&&(L.removeListener("updated",I),j._trackSignalingUpdatedEventCallbacks.delete(L.sid));var G=j.tracks.get(L.sid);G&&j._removeTrackPublication(G)}function K(L){var I=L.isEnabled,G=L.name,X=L.kind,Z=L.sid,$=L.trackTransceiver,ee=L.isSwitchedOff,se={audio:V,video:x,data:C}[X],fe=j.tracks.get(Z);if(se&&X===$.kind){var le={log:m,name:G,clientTrackSwitchOffControl:b,contentPreferencesMode:d,mapMediaElement:w,disposeMediaElement:R};_&&(le.MediaStream=_);var ve="data"===X?new se(Z,$,le):new se(Z,$,I,ee,function(he){return Q.updateSubscriberTrackPriority(Z,he)},function(he){L.isSubscribed&&Q.updateTrackRenderHint(Z,he)},le);j._addTrack(ve,fe,$.id)}}},E.prototype._removeTrack=function(S,m){if(!this._tracks.has(m))return null;this._tracks.delete(m),{audio:this._audioTracks,video:this._videoTracks,data:this._dataTracks}[S.kind].delete(m),(this._trackEventReemitters.get(m)||new Map).forEach(function(w,R){S.removeListener(R,w)});var _=this._log;return _.info("Removed a "+a.trackClass(S)+":",m),_.debug(a.trackClass(S)+":",S),S},E.prototype._removeTrackPublication=function(S){if(!(S=this.tracks.get(S.trackSid)))return null;this.tracks.delete(S.trackSid),{audio:this.audioTracks,data:this.dataTracks,video:this.videoTracks}[S.kind].delete(S.trackSid),(this._trackPublicationEventReemitters.get(S.trackSid)||new Map).forEach(function(_,w){S.removeListener(w,_)});var d=this._log;return d.info("Removed a "+a.trackPublicationClass(S)+":",S.trackSid),d.debug(a.trackPublicationClass(S)+":",S),S},E.prototype.toJSON=function(){return a.valueToJSON(this)},E}(c);function p(T,E,S){var m=new Map;"disconnected"!==T.state&&(T._getTrackEvents().forEach(function(b){var d=b[0],_=b[1];m.set(d,function(){var w=[_].concat([].slice.call(arguments));return T.emit.apply(T,v([],y(w)))}),E.on(d,m.get(d))}),T._trackEventReemitters.set(S,m))}O.exports=h},99305:function(O,P){var u=this&&this.__awaiter||function(e,r,n,o){return new(n||(n=Promise))(function(s,h){function f(k){try{p(o.next(k))}catch(T){h(T)}}function l(k){try{p(o.throw(k))}catch(T){h(T)}}function p(k){k.done?s(k.value):function a(s){return s instanceof n?s:new n(function(h){h(s)})}(k.value).then(f,l)}p((o=o.apply(e,r||[])).next())})},g=this&&this.__generator||function(e,r){var o,a,s,h,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return h={next:f(0),throw:f(1),return:f(2)},"function"==typeof Symbol&&(h[Symbol.iterator]=function(){return this}),h;function f(p){return function(k){return function l(p){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(s=2&p[0]?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[2&p[0],s.value]),p[0]){case 0:case 1:s=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,a=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(!(s=(s=n.trys).length>0&&s[s.length-1])&&(6===p[0]||2===p[0])){n=0;continue}if(3===p[0]&&(!s||p[1]>s[0]&&p[1]<s[3])){n.label=p[1];break}if(6===p[0]&&n.label<s[1]){n.label=s[1],s=p;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(p);break}s[2]&&n.ops.pop(),n.trys.pop();continue}p=r.call(e,n)}catch(k){p=[6,k],a=0}finally{o=s=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([p,k])}}},y=this&&this.__read||function(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,h,o=n.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(f){h={error:f}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(h)throw h.error}}return s};function v(e,r,n,o){var a=[];return e.forEach(function(s){(0===o.length||o.includes(s.type))&&(0===n.length||n.includes(s.kind))&&"number"==typeof s[r]&&a.push(s[r])}),a}function i(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(n,o){var a=[o.key];o.altKeys&&(a=a.concat(o.altKeys));var s=a.find(function(h){return h in e});return s&&typeof e[s]===o.type&&(n[o.key]=e[s]),n},{})}
1Object.defineProperty(P,"__esModule",{value:!0}),P.getCombinedConnectionStats=void 0,P.getCombinedConnectionStats=function c(e){var r=e.publisher,n=e.subscriber;return u(this,void 0,void 0,function(){var o,a,s,h,f,l,p,k,T,E,S,m,b,d,_;return g(this,function(w){switch(w.label){case 0:return[4,Promise.all([r,n].map(function(R){return R.getStats()}))];case 1:return o=y.apply(void 0,[w.sent(),2]),a=o[0],h=v(s=o[1],"timestamp",["audio"],["inbound-rtp"]),f=h.length>0?h[0]:0,l=v(s,"jitter",["audio"],["inbound-rtp"]).reduce(function(R,j){return Math.max(R,j)},0),p=v(s,"packetsReceived",["audio","video"],["inbound-rtp"]).reduce(function(R,j){return R+j},0),k=v(s,"packetsLost",["audio","video"],["inbound-rtp"]).reduce(function(R,j){return R+j},0),T=v(a,"roundTripTime",["audio","video"],["remote-inbound-rtp"]).reduce(function(R,j){return Math.max(R,j)},0),E=v(s,"currentRoundTripTime",[],["candidate-pair"]).reduce(function(R,j){return Math.max(R,j)},0),S=1e3*(E||T),m=v(a,"bytesSent",[],["candidate-pair"]).reduce(function(R,j){return R+j},0),b=v(s,"bytesReceived",[],["candidate-pair"]).reduce(function(R,j){return R+j},0),d=function t(e){var r=null,n=[];e.forEach(function(f){"transport"===f.type&&f.selectedCandidatePairId?r=f.selectedCandidatePairId:"candidate-pair"===f.type&&n.push(f)});var o=n.find(function(f){return f.selected||r&&f.id===r});if(!o)return null;var a=o,s=e.get(a.localCandidateId),h=e.get(a.remoteCandidateId);return s&&h?{localCandidate:i(s),remoteCandidate:i(h)}:null}(s),_=[],s.forEach(function(R){("local-candidate"===R.type||"remote-candidate"===R.type)&&_.push(i(R))}),[2,{timestamp:f,jitter:l,packets:p,packetsLost:k,roundTripTime:S,bytesSent:m,bytesReceived:b,selectedIceCandidatePairStats:d,iceCandidateStats:_}]}})})}},72449:(O,P,u)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.getTurnCredentials=void 0;var g=u(5330),y=u(28701).ICE_VERSION,v=u(8380),c=v.createTwilioError,i=v.SignalingConnectionError,t=u(59069);P.getTurnCredentials=function e(r,n){return new Promise(function(o,a){var s=new t.EventEmitter,f=new g(n,{networkMonitor:null,eventObserver:s,helloBody:{edge:"roaming",preflight:!0,token:r,type:"ice",version:y}}),l=!1;f.once("close",function(){l||(l=!0,a(new i))}),f.on("message",function(p){var k=p.code,T=p.message,S=p.type;("iced"===S||"error"===S)&&!l&&(l=!0,"iced"===S?o(p.ice_servers):a(c(k,T)),f.close())})})}},75359:function(O,P){var u=this&&this.__read||function(v,c){var i="function"==typeof Symbol&&v[Symbol.iterator];if(!i)return v;var e,n,t=i.call(v),r=[];try{for(;(void 0===c||c-- >0)&&!(e=t.next()).done;)r.push(e.value)}catch(o){n={error:o}}finally{try{e&&!e.done&&(i=t.return)&&i.call(t)}finally{if(n)throw n.error}}return r},g=this&&this.__spreadArray||function(v,c){for(var i=0,t=c.length,e=v.length;i<t;i++,e++)v[e]=c[i];return v};Object.defineProperty(P,"__esModule",{value:!0}),P.makeStat=void 0,P.makeStat=function y(v){return v&&v.length?{min:Math.min.apply(Math,g([],u(v))),max:Math.max.apply(Math,g([],u(v))),average:v.reduce(function(e,r){return e+r},0)/v.length}:null}},22436:(O,P)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.mosToScore=P.calculateMOS=void 0;var u=94.768;P.calculateMOS=function g(v,c,i){var t=v+2*c+10,e=0;switch(!0){case t<160:e=u-t/40;break;case t<1e3:e=u-(t-120)/10}return 1+.035*(e=1==i<=e/2.5?Math.max(e-2.5*i,6.52):0)+7e-6*e*(e-60)*(100-e)},P.mosToScore=function y(v){return v?v>4.2?5:v>4?4:v>3.6?3:v>3?2:1:0}},98682:function(O,P,u){var Q,g=this&&this.__extends||(Q=function(Y,W){return(Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(K,D){K.__proto__=D}||function(K,D){for(var L in D)Object.prototype.hasOwnProperty.call(D,L)&&(K[L]=D[L])})(Y,W)},function(Y,W){if("function"!=typeof W&&null!==W)throw new TypeError("Class extends value "+String(W)+" is not a constructor or null");function K(){this.constructor=Y}Q(Y,W),Y.prototype=null===W?Object.create(W):(K.prototype=W.prototype,new K)}),y=this&&this.__assign||function(){return y=Object.assign||function(Q){for(var Y,W=1,K=arguments.length;W<K;W++)for(var D in Y=arguments[W])Object.prototype.hasOwnProperty.call(Y,D)&&(Q[D]=Y[D]);return Q},y.apply(this,arguments)},v=this&&this.__awaiter||function(Q,Y,W,K){return new(W||(W=Promise))(function(L,I){function G($){try{Z(K.next($))}catch(ee){I(ee)}}function X($){try{Z(K.throw($))}catch(ee){I(ee)}}function Z($){$.done?L($.value):function D(L){return L instanceof W?L:new W(function(I){I(L)})}($.value).then(G,X)}Z((K=K.apply(Q,Y||[])).next())})},c=this&&this.__generator||function(Q,Y){var K,D,L,I,W={label:0,sent:function(){if(1&L[0])throw L[1];return L[1]},trys:[],ops:[]};return I={next:G(0),throw:G(1),return:G(2)},"function"==typeof Symbol&&(I[Symbol.iterator]=function(){return this}),I;function G(Z){return function($){return function X(Z){if(K)throw new TypeError("Generator is already executing.");for(;W;)try{if(K=1,D&&(L=2&Z[0]?D.return:Z[0]?D.throw||((L=D.return)&&L.call(D),0):D.next)&&!(L=L.call(D,Z[1])).done)return L;switch(D=0,L&&(Z=[2&Z[0],L.value]),Z[0]){case 0:case 1:L=Z;break;case 4:return W.label++,{value:Z[1],done:!1};case 5:W.label++,D=Z[1],Z=[0];continue;case 7:Z=W.ops.pop(),W.trys.pop();continue;default:if(!(L=(L=W.trys).length>0&&L[L.length-1])&&(6===Z[0]||2===Z[0])){W=0;continue}
1if(3===Z[0]&&(!L||Z[1]>L[0]&&Z[1]<L[3])){W.label=Z[1];break}if(6===Z[0]&&W.label<L[1]){W.label=L[1],L=Z;break}if(L&&W.label<L[2]){W.label=L[2],W.ops.push(Z);break}L[2]&&W.ops.pop(),W.trys.pop();continue}Z=Y.call(Q,W)}catch($){Z=[6,$],D=0}finally{K=L=0}if(5&Z[0])throw Z[1];return{value:Z[0]?Z[1]:void 0,done:!0}}([Z,$])}}};Object.defineProperty(P,"__esModule",{value:!0}),P.runPreflight=P.PreflightTest=void 0;var i=u(28701),t=u(81567),e=u(22436),r=u(99305),n=u(72449),o=u(75359),a=u(25237),s=u(43519),h=u(79739),f=u(28701).WS_SERVER,l=u(61458),p=u(50133),k=u(78218),T=u(88606),E=u(43744),S=u(48066),m=S.createSID,b=S.sessionSID,d=u(8380),_=d.SignalingConnectionTimeoutError,w=d.MediaConnectionError,j=1e4;function N(Q){return null!==Q&&typeof Q<"u"}var x=0,M=function(Q){function Y(W,K){var D=Q.call(this)||this;D._testTiming=new t.Timer,D._dtlsTiming=new t.Timer,D._iceTiming=new t.Timer,D._peerConnectionTiming=new t.Timer,D._mediaTiming=new t.Timer,D._connectTiming=new t.Timer,D._sentBytesMovingAverage=new k,D._packetLossMovingAverage=new k,D._progressEvents=[],D._receivedBytesMovingAverage=new k;var I=K.environment,G=void 0===I?"prod":I,X=K.region,$=K.duration,ee=void 0===$?j:$,se=K.wsServer||f(G,void 0===X?"gll":X);return D._log=new l("default",D,i.DEFAULT_LOG_LEVEL,i.DEFAULT_LOGGER_NAME),D._testDuration=ee,D._instanceId=x++,D._testTiming.start(),D._runPreflightTest(W,G,se),D}return g(Y,Q),Y.prototype.toString=function(){return"[Preflight #"+this._instanceId+"]"},Y.prototype.stop=function(){this._stopped=!0},Y.prototype._generatePreflightReport=function(W){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:o.makeStat(W?.jitter),rtt:o.makeStat(W?.rtt),packetLoss:o.makeStat(W?.packetLoss)},selectedIceCandidatePairStats:W?W.selectedIceCandidatePairStats:null,iceCandidateStats:W?W.iceCandidateStats:[],progressEvents:this._progressEvents,mos:o.makeStat(W?.mos)}},Y.prototype._executePreflightStep=function(W,K,D){return v(this,void 0,void 0,function(){var L,I,G,X;return c(this,function($){switch($.label){case 0:if(this._log.debug("Executing step: ",W),L=this._testDuration+1e4,this._stopped)throw new Error("stopped");I=Promise.resolve().then(K),G=null,X=new Promise(function(ee,se){G=setTimeout(function(){se(D||new Error(W+" timeout."))},L)}),$.label=1;case 1:return $.trys.push([1,,3,4]),[4,Promise.race([X,I])];case 2:return[2,$.sent()];case 3:return null!==G&&clearTimeout(G),[7];case 4:return[2]}})})},Y.prototype._collectNetworkTimings=function(W){var K=this;return new Promise(function(D){var L;W.addEventListener("iceconnectionstatechange",function(){"checking"===W.iceConnectionState&&K._iceTiming.start(),"connected"===W.iceConnectionState&&(K._iceTiming.stop(),K._updateProgress("iceConnected"),(!L||L&&"connected"===L.state)&&D())}),W.addEventListener("connectionstatechange",function(){"connecting"===W.connectionState&&K._peerConnectionTiming.start(),"connected"===W.connectionState&&(K._peerConnectionTiming.stop(),K._updateProgress("peerConnectionConnected"))});var G=W.getSenders().map(function(X){return X.transport}).find(N);typeof G<"u"&&(L=G).addEventListener("statechange",function(){"connecting"===L.state&&K._dtlsTiming.start(),"connected"===L.state&&(K._dtlsTiming.stop(),K._updateProgress("dtlsConnected"),"connected"===W.iceConnectionState&&D())})})},Y.prototype._setupInsights=function(W){var D=W.environment,I=W.realm,Z=new E(W.token,i.SDK_NAME,i.SDK_VERSION,void 0===D?i.DEFAULT_ENVIRONMENT:D,void 0===I?i.DEFAULT_REALM:I,{});Z.connect("PREFLIGHT_ROOM_SID","PREFLIGHT_PARTICIPANT");var $=new T(Z,Date.now(),this._log),ee=void 0;return{reportToInsights:function(se){var fe,le,de=se.report,me=de.stats.jitter||ee,ve=de.stats.rtt||ee,he=de.stats.packetLoss||ee,_e=de.mos||ee,Ee=new Map;
1de.iceCandidateStats.forEach(function(z){if(z.candidateType&&z.protocol){var q=Ee.get(z.candidateType)||[];q.indexOf(z.protocol)<0&&q.push(z.protocol),Ee.set(z.candidateType,q)}});var ye=JSON.stringify(Object.fromEntries(Ee)),Me={name:"report",group:"preflight",level:de.error?"error":"info",payload:{sessionSID:b,preflightSID:m("PF"),progressEvents:JSON.stringify(de.progressEvents),testTiming:de.testTiming,dtlsTiming:de.networkTiming.dtls,iceTiming:de.networkTiming.ice,peerConnectionTiming:de.networkTiming.peerConnection,connectTiming:de.networkTiming.connect,mediaTiming:de.networkTiming.media,selectedLocalCandidate:null===(fe=de.selectedIceCandidatePairStats)||void 0===fe?void 0:fe.localCandidate,selectedRemoteCandidate:null===(le=de.selectedIceCandidatePairStats)||void 0===le?void 0:le.remoteCandidate,iceCandidateStats:ye,jitterStats:me,rttStats:ve,packetLossStats:he,mosStats:_e,error:de.error}};$.emit("event",Me),setTimeout(function(){return Z.disconnect()},2e3)}}},Y.prototype._runPreflightTest=function(W,K,D){return v(this,void 0,void 0,function(){var L,I,G,X,Z,$,ee,se,fe,le,de,me,ve=this;return c(this,function(he){switch(he.label){case 0:L=[],I=[],G=this._setupInsights({token:W,environment:K}).reportToInsights,he.label=1;case 1:return he.trys.push([1,8,9,10]),X=[],[4,this._executePreflightStep("Acquire media",function(){return[a.syntheticAudio(),s.syntheticVideo({width:640,height:480})]})];case 2:return L=he.sent(),this._updateProgress("mediaAcquired"),this.emit("debug",{localTracks:L}),this._connectTiming.start(),[4,this._executePreflightStep("Get turn credentials",function(){return n.getTurnCredentials(W,D)},new _)];case 3:return Z=he.sent(),this._connectTiming.stop(),this._updateProgress("connected"),$=new RTCPeerConnection({iceServers:Z,iceTransportPolicy:"relay",bundlePolicy:"max-bundle"}),ee=new RTCPeerConnection({iceServers:Z,bundlePolicy:"max-bundle"}),I.push($),I.push(ee),this._mediaTiming.start(),[4,this._executePreflightStep("Setup Peer Connections",function(){return v(ve,void 0,void 0,function(){var _e,Ee,ye,Me;return c(this,function(z){switch(z.label){case 0:return $.addEventListener("icecandidate",function(q){return q.candidate&&ee.addIceCandidate(q.candidate)}),ee.addEventListener("icecandidate",function(q){return q.candidate&&$.addIceCandidate(q.candidate)}),L.forEach(function(q){return $.addTrack(q)}),_e=new Promise(function(q){var F=[];ee.addEventListener("track",function(A){F.push(A.track),F.length===L.length&&q(F)})}),[4,$.createOffer()];case 1:return Ee=z.sent(),[4,$.setLocalDescription(ye=Ee)];case 2:return z.sent(),[4,ee.setRemoteDescription(ye)];case 3:return z.sent(),[4,ee.createAnswer()];case 4:return Me=z.sent(),[4,ee.setLocalDescription(Me)];case 5:return z.sent(),[4,$.setRemoteDescription(Me)];case 6:return z.sent(),[4,this._collectNetworkTimings($)];case 7:return z.sent(),[2,_e]}})})},new w)];case 4:return se=he.sent(),this.emit("debug",{remoteTracks:se}),se.forEach(function(_e){_e.addEventListener("ended",function(){return ve._log.warn(_e.kind+":ended")}),_e.addEventListener("mute",function(){return ve._log.warn(_e.kind+":muted")}),_e.addEventListener("unmute",function(){return ve._log.warn(_e.kind+":unmuted")})}),this._updateProgress("mediaSubscribed"),[4,this._executePreflightStep("Wait for tracks to start",function(){return new Promise(function(_e){var Ee=document.createElement("video");Ee.autoplay=!0,Ee.playsInline=!0,Ee.muted=!0,Ee.srcObject=new MediaStream(se),X.push(Ee),ve.emit("debugElement",Ee),Ee.oncanplay=_e})},new w)];case 5:return he.sent(),this._mediaTiming.stop(),this._updateProgress("mediaStarted"),[4,this._executePreflightStep("Collect stats for duration",function(){return ve._collectRTCStatsForDuration(ve._testDuration,{mos:[],jitter:[],rtt:[],outgoingBitrate:[],incomingBitrate:[],packetLoss:[],selectedIceCandidatePairStats:null,iceCandidateStats:[]},$,ee)})];case 6:return fe=he.sent(),[4,this._executePreflightStep("Generate report",function(){return ve._generatePreflightReport(fe)})];case 7:return le=he.sent(),G({report:le}),this.emit("completed",le),[3,10];case 8:return de=he.sent(),me=this._generatePreflightReport(),G({report:y(y({},me),{error:de?.toString()})}
1),this.emit("failed",de,me),[3,10];case 9:return I.forEach(function(_e){return _e.close()}),L.forEach(function(_e){return _e.stop()}),[7];case 10:return[2]}})})},Y.prototype._collectRTCStats=function(W,K,D){return v(this,void 0,void 0,function(){var L,I,G,X,Z,$,ee,se,fe,le,de,me,ve,he;return c(this,function(_e){switch(_e.label){case 0:return[4,r.getCombinedConnectionStats({publisher:K,subscriber:D})];case 1:return L=_e.sent(),I=L.timestamp,G=L.bytesSent,X=L.bytesReceived,Z=L.packets,$=L.packetsLost,ee=L.roundTripTime,fe=L.selectedIceCandidatePairStats,le=L.iceCandidateStats,de=W.jitter.length>0,W.jitter.push(se=L.jitter),W.rtt.push(ee),this._sentBytesMovingAverage.putSample(G,I),this._receivedBytesMovingAverage.putSample(X,I),this._packetLossMovingAverage.putSample($,Z),de&&(W.outgoingBitrate.push(1e3*this._sentBytesMovingAverage.get()*8),W.incomingBitrate.push(1e3*this._receivedBytesMovingAverage.get()*8),me=this._packetLossMovingAverage.get(),ve=Math.min(100,100*me),W.packetLoss.push(ve),he=e.calculateMOS(ee,se,me),W.mos.push(he)),W.selectedIceCandidatePairStats||(W.selectedIceCandidatePairStats=fe),0===W.iceCandidateStats.length&&(W.iceCandidateStats=le),[2]}})})},Y.prototype._collectRTCStatsForDuration=function(W,K,D,L){return v(this,void 0,void 0,function(){var I,G,X;return c(this,function(Z){switch(Z.label){case 0:return I=Date.now(),G=Math.min(1e3,W),[4,h.waitForSometime(G)];case 1:return Z.sent(),[4,this._collectRTCStats(K,D,L)];case 2:return Z.sent(),(X=W-(Date.now()-I))>0?[4,this._collectRTCStatsForDuration(X,K,D,L)]:[3,4];case 3:K=Z.sent(),Z.label=4;case 4:return[2,K]}})})},Y.prototype._updateProgress=function(W){var K=Date.now()-this._testTiming.getTimeMeasurement().start;this._progressEvents.push({duration:K,name:W}),this.emit("progress",W)},Y}(p);P.PreflightTest=M,P.runPreflight=function B(Q,Y){return void 0===Y&&(Y={}),new M(Q,Y)}},25237:(O,P,u)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.syntheticAudio=void 0,P.syntheticAudio=function g(){var y=u(37708),v={},c=y.getOrCreate(v),i=c.createOscillator(),t=i.connect(c.createMediaStreamDestination());i.start();var e=t.stream.getAudioTracks()[0],r=e.stop;return e.stop=function(){r.call(e),y.release(v)},e}},43519:(O,P)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.syntheticVideo=void 0,P.syntheticVideo=function u(g){var y=void 0===g?{}:g,v=y.width,c=void 0===v?640:v,i=y.height,t=void 0===i?480:i,e=Object.assign(document.createElement("canvas"),{width:c,height:t}),r=e.getContext("2d");r.fillStyle="green",r.fillRect(0,0,e.width,e.height);var n=!1;requestAnimationFrame(function h(){if(!n){var f=Math.round(255*Math.random()),l=Math.round(255*Math.random()),p=Math.round(255*Math.random()),k=Math.round(255*Math.random());r.fillStyle="rgba("+f+", "+l+", "+p+", "+k+")",r.fillRect(Math.random()*c,Math.random()*t,50,50),requestAnimationFrame(h)}});var a=e.captureStream(30).getTracks()[0],s=a.stop;return a.stop=function(){n=!0,s.call(a)},a}},81567:(O,P)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.Timer=void 0;var u=function(){function g(){this._end=void 0,this.start()}return g.prototype.start=function(){return this._start=Date.now(),this},g.prototype.stop=function(){return this._end=Date.now(),this},g.prototype.getTimeMeasurement=function(){return{start:this._start,end:this._end,duration:void 0===this._end?void 0:this._end-this._start}},g}();P.Timer=u},47772:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,s,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(h){s={error:h}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return a},v=this&&this.__spreadArray||function(t,e){for(var r=0,n=e.length,o=t.length;r<n;r++,o++)t[o]=e[r];return t},i=function(t){function e(){var r=t.call(this)||this;return Object.defineProperties(r,{_queuedEvents:{value:new Map}}),r}return g(e,t),e.prototype.dequeue=function(r){var n=this,o=!0;
1if(!r)return this._queuedEvents.forEach(function(s,h){o=this.dequeue(h)&&o},this),o;var a=this._queuedEvents.get(r)||[];return this._queuedEvents.delete(r),a.reduce(function(s,h){return n.emit.apply(n,v([],y([r].concat(h))))&&s},o)},e.prototype.queue=function(){var r=[].slice.call(arguments);if(this.emit.apply(this,v([],y(r))))return!0;var n=r[0];return this._queuedEvents.has(n)||this._queuedEvents.set(n,[]),this._queuedEvents.get(n).push(r.slice(1)),!1},e}(u(59069).EventEmitter);O.exports=i},33609:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,s,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(h){s={error:h}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return a},v=this&&this.__spreadArray||function(t,e){for(var r=0,n=e.length,o=t.length;r<n;r++,o++)t[o]=e[r];return t},i=function(t){function e(r,n){var o=t.call(this,r,n)||this;return o._handleTrackSignalingEvents(),o.once("disconnected",o._unsubscribeTracks.bind(o)),o}return g(e,t),e.prototype.toString=function(){return"[RemoteParticipant #"+this._instanceId+(this.sid?": "+this.sid:"")+"]"},e.prototype._addTrack=function(r,n,o){return t.prototype._addTrack.call(this,r,o)?(n._subscribed(r),this.emit("trackSubscribed",r,n),r):null},e.prototype._addTrackPublication=function(r){var n=t.prototype._addTrackPublication.call(this,r);return n?(this.emit("trackPublished",n),n):null},e.prototype._getTrackPublicationEvents=function(){return v(v([],y(t.prototype._getTrackPublicationEvents.call(this))),[["subscriptionFailed","trackSubscriptionFailed"],["trackDisabled","trackDisabled"],["trackEnabled","trackEnabled"],["publishPriorityChanged","trackPublishPriorityChanged"],["trackSwitchedOff","trackSwitchedOff"],["trackSwitchedOn","trackSwitchedOn"]])},e.prototype._unsubscribeTracks=function(){var r=this;this.tracks.forEach(function(n){if(n.isSubscribed){var o=n.track;n._unsubscribe(),r.emit("trackUnsubscribed",o,n)}})},e.prototype._removeTrack=function(r,n,o){var a=this._tracks.get(o);return a?(t.prototype._removeTrack.call(this,a,o),n._unsubscribe(),this.emit("trackUnsubscribed",a,n),a):null},e.prototype._removeTrackPublication=function(r){this._signaling.clearTrackHint(r.trackSid);var n=t.prototype._removeTrackPublication.call(this,r);return n?(this.emit("trackUnpublished",n),n):null},e}(u(69218));O.exports=i},7406:function(O,P,u){var T,g=this&&this.__extends||(T=function(E,S){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,b){m.__proto__=b}||function(m,b){for(var d in b)Object.prototype.hasOwnProperty.call(b,d)&&(m[d]=b[d])})(E,S)},function(E,S){if("function"!=typeof S&&null!==S)throw new TypeError("Class extends value "+String(S)+" is not a constructor or null");function m(){this.constructor=E}T(E,S),E.prototype=null===S?Object.create(S):(m.prototype=S.prototype,new m)}),y=this&&this.__read||function(T,E){var S="function"==typeof Symbol&&T[Symbol.iterator];if(!S)return T;var b,_,m=S.call(T),d=[];try{for(;(void 0===E||E-- >0)&&!(b=m.next()).done;)d.push(b.value)}catch(w){_={error:w}}finally{try{b&&!b.done&&(S=m.return)&&S.call(m)}finally{if(_)throw _.error}}return d},v=this&&this.__spreadArray||function(T,E){for(var S=0,m=E.length,b=T.length;S<m;S++,b++)T[b]=E[S];return T},c=u(50133),i=u(33609),t=u(97805),e=u(79739),r=e.flatMap,n=e.valueToJSON,o=0,a=function(T){function E(S,m,b){var d=T.call(this)||this,_=b.log.createLog("default",d),w=new Map;return Object.defineProperties(d,{_log:{value:_},_clientTrackSwitchOffControl:{value:b.clientTrackSwitchOffControl||"disabled"}
1,_contentPreferencesMode:{value:b.contentPreferencesMode||"disabled"},_instanceId:{value:++o},_options:{value:b},_participants:{value:w},_signaling:{value:m},dominantSpeaker:{enumerable:!0,get:function(){return this.participants.get(m.dominantSpeakerSid)||null}},isRecording:{enumerable:!0,get:function(){return m.recording.isEnabled||!1}},localParticipant:{enumerable:!0,value:S},name:{enumerable:!0,value:m.name},participants:{enumerable:!0,value:w},sid:{enumerable:!0,value:m.sid},state:{enumerable:!0,get:function(){return m.state}},mediaRegion:{enumerable:!0,value:m.mediaRegion}}),function l(T,E){var S=["trackWarning","trackWarningsCleared"].map(function(m){return{eventName:m,handler:function(){for(var b=[],d=0;d<arguments.length;d++)b[d]=arguments[d];return T.emit.apply(T,v([m],y(v(v([],y(b)),[E]))))}}});S.forEach(function(m){return E.on(m.eventName,m.handler)}),T.once("disconnected",function(){return S.forEach(function(m){return E.removeListener(m.eventName,m.handler)})})}(d,S),function p(T,E){E.on("updated",function(){var m=E.isEnabled;T._log.info("Recording "+(m?"started":"stopped")),T.emit("recording"+(m?"Started":"Stopped"))})}(d,m.recording),function k(T,E){var S=T._log;S.debug("Creating a new RemoteParticipant for each ParticipantSignaling in the RoomSignaling"),E.participants.forEac
1h(f.bind(null,T)),S.debug("Setting up RemoteParticipant creation for all subsequent ParticipantSignalings that connect to the RoomSignaling"),E.on("participantConnected",f.bind(null,T)),E.on("dominantSpeakerChanged",function(){return T.emit("dominantSpeakerChanged",T.dominantSpeaker)}),E.on("transcription",function(m){return T.emit("transcription",m)}),E.on("stateChanged",function m(b,d){switch(S.info("Transitioned to state:",b),b){case"disconnected":T.participants.forEach(function(_){_._unsubscribeTracks()}),T.emit(b,T,d),T.localParticipant.tracks.forEach(function(_){_.unpublish()}),E.removeListener("stateChanged",m);break;case"reconnecting":setTimeout(function(){return T.emit("reconnecting",d)},0);break;default:setTimeout(function(){return T.emit("reconnected")},0)}})}(d,m),function s(T){var E=T.localParticipant._signaling.audioProcessors;T.localParticipant.audioTracks.forEach(function(S){var b=S.track.noiseCancellation;b&&!E.includes(b.vendor)&&(T._log.warn(b.vendor+" is not supported in this room. disabling it permanently"),b.disablePermanently())})}(d),_.info("Created a new Room:",d.name),_.debug("Initial RemoteParticipants:",Array.from(d._participants.values())),d}return g(E,T),E.prototype.toString=function(){return"[Room #"+this._instanceId+": "+this.sid+"]"},E.prototype.disconnect=function(){return this._log.info("Disconnecting"),this._signaling.disconnect(),this},E.prototype.getStats=function(){var S=this;return this._signaling.getStats().then(function(m){return Array.from(m).map(function(b){var d=y(b,2),w=d[1];return new t(d[0],Object.assign({},w,{localAudioTrackStats:h(S,w.localAudioTrackStats),localVideoTrackStats:h(S,w.localVideoTrackStats)}))})})},E.prototype.refreshInactiveMedia=function(){var m=Array.from(this.localParticipant.tracks.values()).filter(function(R){return"data"!==R.track.kind}).map(function(R){return R.track}),b=r(this.participants,function(R){return Array.from(R.tracks.values())}).filter(function(R){var j=R.track;return j&&"data"!==j.kind}).map(function(R){return R.track}),d=m.concat(b),_=new Event("unmute");m.forEach(function(R){R.isMuted&&R.mediaStreamTrack.dispatchEvent(_)});var w=new Event("pause");return d.forEach(function(R){var V=R._elShims;return R._attachments.forEach(function(N){var x=V.get(N);N.paused&&x&&!x.pausedIntentionally()&&N.dispatchEvent(w)})}),this},E.prototype.toJSON=function(){return n(this)},E}(c);function h(T,E){var S=T.localParticipant._signaling;return E.reduce(function(m,b){var d=S.tracks.get(b.trackId),_=S.getSender(d);return _?[Object.assign({},b,{trackId:_.id})].concat(m):m},[])}function f(T,E){var S=T._log,d=T._options,j=new i(E,{log:S,clientTrackSwitchOffControl:T._clientTrackSwitchOffControl,contentPreferencesMode:T._contentPreferencesMode,MediaStream:d.MediaStream,mapMediaElement:d.mapMediaElement,disposeMediaElement:d.disposeMediaElement});S.info("A new RemoteParticipant connected:",j),T._participants.set(j.sid,j),T.emit("participantConnected",j);var V=[["reconnected","participantReconnected"],["reconnecting","participantReconnecting"],"trackDimensionsChanged","trackDisabled","trackEnabled","trackMessage","trackPublished","trackPublishPriorityChanged","trackStarted","trackSubscribed","trackSubscriptionFailed","trackSwitchedOff","trackSwitchedOn","trackUnpublished","trackUnsubscribed"].map(function(N){var x=y(Array.isArray(N)?N:[N,N],2),M=x[0],C=x[1];function B(){var Q=[].slice.call(arguments);Q.unshift(C),Q.push(j),T.emit.apply(T,v([],y(Q)))}return j.on(M,B),[M,B]});j.once("disconnected",function(){var x=T.dominantSpeaker;S.info("RemoteParticipant disconnected:",j),T._participants.delete(j.sid),V.forEach(function(M){j.removeListener(M[0],M[1])}),T.emit("participantDisconnected",j),j===x&&T.emit("dominantSpeakerChanged",T.dominantSpeaker)})}O.exports=a},48043:function(O,P,u){var e,g=this&&this.__extends||(e=function(r,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(o[s]=a[s])})(r,n)},function(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=r}e(r,n),r.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}),y=u(9285),v=u(18343),c=u(28675),i={closed:["opening"],opening:["closed","open"],open:["closed","closing"],closing:["closed","open"]},t=function(e){function r(){return e.call(this,"closed",i)||this}return g(r,e),r.prototype._close=function(n){return this.transition("closing",n),this.transition("closed",n),Promise.resolve(this)},r.prototype._connect=function(n,o,a,s,h){n.connect("PA00000000000000000000000000000000","test");var l=Promise.resolve(new v(n,"RM00000000000000000000000000000000",h));return l.cancel=function(){},l},r.prototype._open=function(n){return this.transition("opening",n),this.transition("open",n),Promise.resolve(this)},r.prototype.close=function(){var n=this;return this.bracket("close",function(o){switch(n.state){case"closed":return n;case"open":return n._close(o);default:throw new Error('Unexpected Signaling state "'+n.state+'"')}})},r.prototype.connect=function(n,o,a,s,h){var f=this;return this.bracket("connect",function l(p){switch(f.state){case"closed":return f._open(p).then(l.bind(null,p));case"open":return f.releaseLockCompletely(p),f._connect(n,o,a,s,h);default:throw new Error('Unexpected Signaling state "'+f.state+'"')}})},r.prototype.createLocalParticipantSignaling=function(){return new y},r.prototype.open=function(){var n=this;return this.bracket("open",function(o){switch(n.state){case"closed":return n._open(o);case"open":return n;default:throw new Error('Unexpected Signaling state "'+n.state+'"')}})},r}(c);
1O.exports=t},75677:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(){var t=c.call(this)||this;return Object.defineProperties(t,{_publicationsToTrackSenders:{value:new Map},_trackSendersToPublications:{value:new Map}}),t}return g(i,c),i.prototype.addTrack=function(t,e,r,n){void 0===n&&(n=null);var o=this._createLocalTrackPublicationSignaling(t,e,r,n);return this._trackSendersToPublications.set(t,o),this._publicationsToTrackSenders.set(o,t),c.prototype.addTrack.call(this,o),this},i.prototype.getPublication=function(t){return this._trackSendersToPublications.get(t)||null},i.prototype.getSender=function(t){return this._publicationsToTrackSenders.get(t)||null},i.prototype.removeTrack=function(t){var e=this._trackSendersToPublications.get(t);return e?(this._trackSendersToPublications.delete(t),this._publicationsToTrackSenders.delete(e),c.prototype.removeTrack.call(this,e)&&e.stop(),e):null},i}(u(9285));O.exports=v},43157:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),v=function(i){function t(e,r,n){var o=this,a=e.clone();return"data"!==e.kind&&(a.track.enabled=e.track.enabled),(o=i.call(this,r,(e=a).kind,"data"===e.kind||e.track.enabled,n)||this).setTrackTransceiver(e),Object.defineProperties(o,{_updatedPriority:{value:n,writable:!0},id:{enumerable:!0,value:e.id}}),o}return g(t,i),Object.defineProperty(t.prototype,"updatedPriority",{get:function(){return this._updatedPriority},enumerable:!1,configurable:!0}),t.prototype.enable=function(e){return this.trackTransceiver.track.enabled=e="boolean"!=typeof e||e,i.prototype.enable.call(this,e)},t.prototype.publishFailed=function(e){return function c(i,t){return null===i._sid&&!i._error&&(i._error=t,!0)}(this,e)&&this.emit("updated"),this},t.prototype.setPriority=function(e){return this._updatedPriority!==e&&(this._updatedPriority=e,this.emit("updated")),this},t.prototype.setSid=function(e){return this._error?this:i.prototype.setSid.call(this,e)},t.prototype.stop=function(){this.trackTransceiver.stop()},t}(u(58194));O.exports=v},9285:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=u(28675),v=u(90669),c={connecting:["connected"],connected:["disconnected","reconnecting"],reconnecting:["connected","disconnected"],disconnected:[]},i=function(t){function e(){var r=t.call(this,"connecting",c)||this;return Object.defineProperties(r,{_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}}),r}return g(e,t),Object.defineProperty(e.prototype,"networkQualityLevel",{get:function(){return this._networkQualityLevel}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"networkQualityStats",{get:function(){return this._networkQualityStats},enumerable:!1,configurable:!0}),e.prototype.addTrack=function(r){return this.tracks.set(r.id||r.sid,r),this.emit("trackAdded",r),this},e.prototype.disconnect=function(){return"disconnected"!==this.state&&(this.preempt("disconnected"),!0)},e.prototype.removeTrack=function(r){var n=this.tracks.get(r.id||r.sid);return this.tracks.delete(r.id||r.sid),n&&this.emit("trackRemoved",r),n||null},e.prototype.setNetworkQualityLevel=function(r,n){this._networkQualityLevel!==r&&(this._networkQualityLevel=r,this._networkQualityStats=n&&(n.audio||n.video)?new v(n):null,this.emit("networkQualityLevelChanged"))},e.prototype.connect=function(r,n){return("connecting"===this.state||"reconnecting"===this.state)&&(this._sid||(this._sid=r),this._identity||(this._identity=n),this.preempt("connected"),!0)},e.prototype.reconnecting=function(){return("connecting"===this.state||"connected"===this.state)&&(this.preempt("reconnecting"),!0)},e}(y);O.exports=i},29987:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(){var t=c.call(this)||this;return Object.defineProperties(t,{_isEnabled:{value:null,writable:!0},isEnabled:{enumerable:!0,get:function(){return this._isEnabled}}}),t}return g(i,c),i.prototype.disable=function(){return this.enable(!1)},i.prototype.enable=function(t){return this.isEnabled!==(t="boolean"!=typeof t||t)&&(this._isEnabled=t,this.emit("updated")),this},i}(u(59069).EventEmitter);O.exports=v},22184:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this)||this;return r.connect(t,e),r}return g(i,c),i}(u(9285));O.exports=v},78956:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r,n,o,a){var s=c.call(this,e,r,n,o)||this;return Object.defineProperties(s,{_isSwitchedOff:{value:a,writable:!0}}),s.setSid(t),s}return g(i,c),Object.defineProperty(i.prototype,"isSubscribed",{get:function(){return!!this.trackTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isSwitchedOff",{get:function(){return this._isSwitchedOff},enumerable:!1,configurable:!0}),i.prototype.subscribeFailed=function(t){return this.error||(this._error=t,this.emit("updated")),this},i.prototype.setPriority=function(t){return this._priority!==t&&(this._priority=t,this.emit("updated")),this},i.prototype.setSwitchedOff=function(t){return this._isSwitchedOff!==t&&(this._isSwitchedOff=t,this.emit("updated")),this},i}(u(58194));O.exports=v},18343:function(O,P,u){var p,g=this&&this.__extends||(p=function(k,T){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var m in S)Object.prototype.hasOwnProperty.call(S,m)&&(E[m]=S[m])})(k,T)},function(k,T){if("function"!=typeof T&&null!==T)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");function E(){this.constructor=k}p(k,T),k.prototype=null===T?Object.create(T):(E.prototype=T.prototype,new E)}),y=u(29987),v=u(28675),c=u(66543),i=u(79739).buildLogLevels,t=u(28701).DEFAULT_LOG_LEVEL,e=u(61458),r=u(8380),n=r.MediaConnectionError,o=r.MediaDTLSTransportFailedError,a=r.SignalingConnectionDisconnectedError,s=0,h={connected:["reconnecting","disconnected"],reconnecting:["connected","disconnected"],disconnected:[]},f=function(p){function k(T,E,S,m){var b=this;m=Object.assign({logLevel:t,RecordingSignaling:y,Timeout:c},m);var d=i(m.logLevel);b=p.call(this,"connected",h)||this;var _=m.RecordingSignaling,w=new m.Timeout(function(){b._disconnect(b._reconnectingError)},m.sessionTimeout,!1);return Object.defineProperties(b,{_instanceId:{value:s++},_log:{value:m.log?m.log.createLog("default",b):new e("default",b,d,m.loggerName)}
1,_mediaConnectionIsReconnecting:{writable:!0,value:!1},_options:{value:m},_reconnectingError:{value:null,writable:!0},_sessionTimeout:{value:w},dominantSpeakerSid:{enumerable:!0,value:null,writable:!0},localParticipant:{enumerable:!0,value:T},name:{enumerable:!0,value:S},participants:{enumerable:!0,value:new Map},recording:{enumerable:!0,value:new _},sid:{enumerable:!0,value:E}}),b.on("connectionStateChanged",function(){"failed"===b.connectionState&&!["disconnected","failed"].includes(b.iceConnectionState)&&b._disconnect(new o)}),b.on("iceConnectionStateChanged",function(){return l(b)}),b.on("signalingConnectionStateChanged",function(){return l(b)}),setTimeout(function(){return l(b)}),b}return g(k,p),k.prototype._disconnect=function(T){return"disconnected"!==this.state&&(this.preempt("disconnected",null,[T]),!0)},k.prototype.toString=function(){return"[RoomSignaling #"+this._instanceId+": "+(this.localParticipant?this.localParticipant.sid:"null")+"]"},k.prototype.connectParticipant=function(T){var E=this;return"disconnected"!==T.state&&!this.participants.has(T.sid)&&(this.participants.set(T.sid,T),T.on("stateChanged",function S(m){"disconnected"===m&&(T.removeListener("stateChanged",S),E.participants.delete(T.sid),E.emit("participantDisconnected",T))}),this.emit("participantConnected",T),!0)},k.prototype.disconnect=function(){return this._disconnect()},k.prototype.setDominantSpeaker=function(T){this.dominantSpeakerSid=T,this.emit("dominantSpeakerChanged")},k}(v);function l(p){var k;"disconnected"!==p.state&&"disconnected"!==p.signalingConnectionState?("reconnecting"===p.signalingConnectionState?k=p.signalingConnectionState:"failed"===p.iceConnectionState?(p._mediaConnectionIsReconnecting=!0,k="reconnecting"):"new"===p.iceConnectionState||"checking"===p.iceConnectionState?k=p._mediaConnectionIsReconnecting?"reconnecting":"connected":(p._mediaConnectionIsReconnecting=!1,p._reconnectingError=null,p._sessionTimeout.clear(),k="connected"),k!==p.state&&("reconnecting"===k?(p._reconnectingError="reconnecting"===p.signalingConnectionState?new a:new n,p._sessionTimeout.start(),p.preempt(k,null,[p._reconnectingError])):p.preempt(k))):p._sessionTimeout.clear()}O.exports=f},58194:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r,n){var o=c.call(this)||this,a=null;return Object.defineProperties(o,{_error:{value:null,writable:!0},_isEnabled:{value:r,writable:!0},_priority:{value:n,writable:!0},_trackTransceiver:{value:null,writable:!0},_sid:{get:function(){return a}
1,set:function(s){null===a&&(a=s)}},kind:{enumerable:!0,value:e},name:{enumerable:!0,value:t}}),o}return g(i,c),Object.defineProperty(i.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isEnabled",{get:function(){return this._isEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return this._priority},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sid",{get:function(){return this._sid},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"trackTransceiver",{get:function(){return this._trackTransceiver},enumerable:!1,configurable:!0}),i.prototype.disable=function(){return this.enable(!1)},i.prototype.enable=function(t){return this.isEnabled!==(t="boolean"!=typeof t||t)&&(this._isEnabled=t,this.emit("updated")),this},i.prototype.setTrackTransceiver=function(t){return this.trackTransceiver!==(t=t||null)&&(this._trackTransceiver=t,this.emit("updated")),this},i.prototype.setSid=function(t){return null===this.sid&&(this._sid=t,this.emit("updated")),this},i}(u(59069).EventEmitter);O.exports=v},7697:(O,P,u)=>{var g=u(88126),y=u(16603),v=u(62112),c=u(84892),i=u(8380),t=i.SignalingConnectionDisconnectedError,e=i.SignalingIncomingMessageInvalidError,r=u(79739),n=r.flatMap,o=r.createRoomConnectEventPayload;O.exports=function a(s,h,f,l,p,k){k=Object.assign({PeerConnectionManager:y,RoomV2:v,Transport:c},k);var T=p.video[0]&&!0===p.video[0].adaptiveSimulcast,S=k.RoomV2,m=k.Transport,b=k.iceServers,d=k.log,_=new(0,k.PeerConnectionManager)(l,p,k),w=n(f.tracks,function(N){return[N.trackTransceiver]});_.setTrackSenders(w);var j,R=new Error("Canceled"),V=new g(function(N,x,M){var Q=k.bandwidthProfile,D=k.eventObserver,G=k.name,me=Object.assign({adaptiveSimulcast:T,automaticSubscription:k.automaticSubscription,dominantSpeaker:k.dominantSpeaker,receiveTranscriptions:k.receiveTranscriptions,environment:k.environment,eventObserver:D,loggerName:k.loggerName,logLevel:k.logLevel,networkMonitor:k.networkMonitor,networkQuality:k.networkQuality,notifyWarnings:k.notifyWarnings,iceServers:b,onIced:function(he){return M()?(x(R),Promise.reject(R)):(d.debug("Got ICE servers:",he),k.iceServers=he,_.setConfiguration(k),_.createAndOffer().then(function(){if(M())throw x(R),R;d.debug("createAndOffer() succeeded."),_.dequeue("description")}).catch(function(_e){throw d.error("createAndOffer() failed:",_e),x(_e),_e}))},realm:k.realm,renderHints:!!Q&&("disabled"!==k.clientTrackSwitchOffControl||"disabled"!==k.contentPreferencesMode),sdpSemantics:k.sdpSemantics,trackPriority:!!Q,trackSwitchOff:!!Q},Q?{bandwidthProfile:Q}:{});j=new m(G,s,f,_,h,me);var ve=o(k);D.emit("event",ve),j.once("connected",function(he){d.debug("Transport connected:",he),M()?x(R):he.participant?N(new S(f,he,j,_,k)):x(new e)}),j.once("stateChanged",function(he,_e){"disconnected"===he?(j=null,x(_e||new t)):d.debug("Transport state changed:",he)})},function(){j&&(j.disconnect(),j=null)});return V.catch(function(){j&&(j.disconnect(),j=null),_.close()}),V}},61768:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,"active_speaker",e)||this;return Object.defineProperties(r,{_loudestParticipantSid:{value:null,writable:!0}}),r.on("ready",function(n){n.on("message",function(o){"active_speaker"===o.type&&r._setLoudestParticipantSid(o.participant)})}),r}return g(i,c),Object.defineProperty(i.prototype,"loudestParticipantSid",{get:function(){return this._loudestParticipantSid},enumerable:!1,configurable:!0}),i.prototype._setLoudestParticipantSid=function(t){this.loudestParticipantSid!==t&&(this._loudestParticipantSid=t,this.emit
1("updated"))},i}(u(94071));O.exports=v},90380:(O,P,u)=>{var g=u(33826),y=function(){function v(){Object.defineProperties(this,{_filter:{value:new g({getKey:function(i){return i.ufrag},isLessThanOrEqualTo:function(i,t){return i.revision<=t.revision}})},_ufrag:{writable:!0,value:null},ufrag:{enumerable:!0,get:function(){return this._ufrag}}})}return v.prototype.setUfrag=function(c){this._ufrag=c;var i=this._filter.toMap().get(c);return i?i.candidates:[]},v.prototype.update=function(c){c.candidates=c.candidates||[];var i=this._filter.toMap().get(c.ufrag),t=i?i.candidates:[];return this._filter.update(c)&&this._ufrag===c.ufrag?c.candidates.slice(t.length):[]},v}();O.exports=y},32282:(O,P,u)=>{var g=u(28701),y=g.ICE_ACTIVITY_CHECK_PERIOD_MS,v=g.ICE_INACTIVITY_THRESHOLD_MS,c=function(){function i(t,e){e=Object.assign({activityCheckPeriodMs:y,inactivityThresholdMs:v},e),Object.defineProperties(this,{_activityCheckPeriodMs:{value:e.activityCheckPeriodMs},_inactivityThresholdMs:{value:e.inactivityThresholdMs},_lastActivity:{value:null,writable:!0},_peerConnection:{value:t},_timer:{value:null,writable:!0},_onIceConnectionStateChanged:{value:null,writable:!0}})}return i.prototype._getActivePairStat=function(t){return Array.from(t.values()).find(function(n){return"candidate-pair"===n.type&&n.nominated})||{bytesReceived:0,timestamp:Math.round((new Date).getTime())}},i.prototype._getIceConnectionStats=function(){var t=this;return this._peerConnection.getStats().then(function(e){return t._getActivePairStat(e)}).catch(function(){return null})},i.prototype._scheduleInactivityCallback=function(t){var e=this;t&&null===this._onIceConnectionStateChanged?(this._onIceConnectionStateChanged=function(){"disconnected"===e._peerConnection.iceConnectionState&&t()},this._peerConnection.addEventListener?this._peerConnection.addEventListener("iceconnectionstatechange",this._onIceConnectionStateChanged):this._peerConnection.oniceconnectionstatechange=this._onIceConnectionStateChanged):!t&&this._onIceConnectionStateChanged&&(this._peerConnection.removeEventListener?this._peerConnection.removeEventListener("iceconnectionstatechange",this._onIceConnectionStateChanged):this._peerConnection.oniceconnectionstatechange=null,this._onIceConnectionStateChanged=null)},i.prototype.start=function(t){var e=this;this.stop(),this._timer=setInterval(function(){e._getIceConnectionStats().then(function(r){r&&((!e._lastActivity||e._lastActivity.bytesReceived!==r.bytesReceived)&&(e._lastActivity=r,e._scheduleInactivityCallback(null)),r.timestamp-e._lastActivity.timestamp>=e._inactivityThresholdMs&&("disconnected"===e._peerConnection.iceConnectionState?t():null===e._onIceConnectionStateChanged&&e._scheduleInactivityCallback(t)))})},this._activityCheckPeriodMs)},i.prototype.stop=function(){this._scheduleInactivityCallback(null),null!==this._timer&&(clearInterval(this._timer),this._timer=null,this._lastActivity=null)},i}();O.exports=c},20448:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=u(7697),v=u(60523),i=function(t){function e(r,n){var o;return n=Object.assign({createCancelableRoomSignalingPromise:y},n),o=t.call(this)||this,Object.defineProperties(o,{_createCancelableRoomSignalingPromise:{value:n.createCancelableRoomSignalingPromise},_options:{value:n},_wsServer:{value:r}}),o}return g(e,t),e.prototype._connect=function(r,n,o,a,s){return s=Object.assign({},this._options,s),this._createCancelableRoomSignalingPromise.bind(null,n,this._wsServer,r,o,a,s)},e.prototype.createLocalParticipantSignaling=function(r,n){return new v(r,n)},e}(u(48043));O.exports=i},60523:function(O,P,u){var o,g=this&&this.__extends||(o=function(a,s){return(o=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(h[l]=f[l])})(a,s)},function(a,s){if("function"!=typeof s&&null!==s)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function h(){this.constructor=a}o(a,s),a.prototype=null===s?Object.create(s):(h.prototype=s.prototype,new h)}),y=u(75677),v=u(35771),c=u(28701).DEFAULT_LOG_LEVEL,i=u(61458),t=u(79739),e=t.buildLogLevels,r=t.isDeepEqual,n=function(o){function a(s,h,f){var l;f=Object.assign({logLevel:c,LocalTrackPublicationV2:v},f),l=o.call(this)||this;var p=e(f.logLevel);return Object.defineProperties(l,{_bandwidthProfile:{value:null,writable:!0},_bandwidthProfileRevision:{value:0,writable:!0},_encodingParameters:{value:s},_removeListeners:{value:new Map},_LocalTrackPublicationV2:{value:f.LocalTrackPublicationV2},_log:{value:f.log?f.log.createLog("default",l):new i("default",l,p,f.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:h},revision:{enumerable:!0,get:function(){return this._revision}},signalingRegion:{enumerable:!0,get:function(){return this._signalingRegion}}}),l}return g(a,o),a.prototype.toString=function(){return"[LocalParticipantSignaling: "+this.sid+"]"},a.prototype.setSignalingRegion=function(s){this._signalingRegion||(this._signalingRegion=s)},a.prototype.setBandwidthProfile=function(s){r(this._bandwidthProfile,s)||(this._bandwidthProfile=JSON.parse(JSON.stringify(s)),this._bandwidthProfileRevision++,this.didUpdate())},a.prototype.setAudioProcessors=function(s){this.audioProcessors=s},a.prototype.getParameters=function(){return this._encodingParameters},a.prototype.setParameters=function(s){return this._encodingParameters.update(s),this},a.prototype.update=function(s){return this._publishedRevision>=s.revision||(this._publishedRevision=s.revision,s.tracks.forEach(function(h){var f=this.tracks.get(h.id);f&&f.update(h)},this)),this},a.prototype.updateMediaStates=function(s){return s&&s.tracks?(Array.from(this.tracks.values()).forEach(function(h){var f=s.tracks[h.sid];f&&h.updateMediaStates(f)}),this):this},a.prototype._createLocalTrackPublicationSignaling=function(s,h,f,l){return new this._LocalTrackPublicationV2(s,h,f,l,{log:this._log})},a.prototype.addTrack=function(s,h,f,l){var p=this;o.prototype.addTrack.call(this,s,h,f,l);var k=this.getPublication(s),T=k.isEnabled,E=k.updatedPriority,S=function(){(T!==k.isEnabled||E!==k.updatedPriority)&&(p.didUpdate(),T=k.isEnabled,E=k.updatedPriority)};return k.on("updated",S),this._removeListener(k),this._removeListeners.set(k,function(){return k.removeListener("updated",S)}),this.didUpdate(),this},a.prototype._removeListener=function(s){var h=this._removeListeners.get(s);h&&h()},a.prototype.getState=function(){return{revision:this.revision,tracks:Array.from(this.tracks.values()).map(function(s){return s.getState()})}},a.prototype.didUpdate=function(){this._revision++,this.emit("updated")},a.prototype.removeTrack=function(s){var h=o.prototype.removeTrack.call(this,s);return h&&(s.removeClone(h.trackTransceiver),this._removeListener(h),this.didUpdate()),h},a.prototype.setNetworkQualityConfiguration=function(s){this.networkQualityConfiguration.update(s)},a.prototype.setPublisherHint=function(s,h){var f=Array.from(this.tracks.values()).find(function(l){return l.sid===s});return f?f.trackTransceiver.setPublisherHint(h):(this._log.warn("track:"+s+" not found"),Promise.resolve("UNKNOWN_TRACK"))},a}(y);O.exports=n},35771:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}
1),y=u(43157),v=u(62585),c=u(8380).createTwilioError,i=function(t){function e(r,n,o,a,s){var h=t.call(this,r,n,o)||this;return Object.defineProperties(h,{_log:{value:s.log.createLog("default",h)},_mediaStates:{value:{recordings:null},writable:!0},_noiseCancellationVendor:{value:a}}),h}return g(e,t),e.prototype.getState=function(){var r={enabled:this.isEnabled,id:this.id,kind:this.kind,name:this.name,priority:this.updatedPriority};return this._noiseCancellationVendor&&(r.audio_processor=this._noiseCancellationVendor),r},e.prototype.toString=function(){return"[LocalTrackPublicationV2: "+this.sid+"]"},e.prototype.update=function(r){switch(r.state){case"ready":this.setSid(r.sid);break;case"failed":var n=r.error;this.publishFailed(c(n.code,n.message))}return this},e.prototype.updateMediaStates=function(r){if(!r||!r.recordings||this._mediaStates.recordings===r.recordings)return this;switch(this._mediaStates.recordings=r.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",v.recordingMediaLost);break;default:this._log.warn("Unknown media state detected: "+this._mediaStates.recordings)}return this},e}(y);O.exports=i},94071:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(59069),v=0,c=function(i){function t(e,r,n){var o=i.call(this)||this;return Object.defineProperties(o,{_instanceId:{value:v++},channel:{value:r},_log:{value:n.log.createLog("default",o)},_getReceiver:{value:e},_receiverPromise:{value:null,writable:!0},_transport:{value:null,writable:!0}}),o}return g(t,i),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 r=this;this._teardown(),this._log.info("setting up msp transport for id:",e);var n=this._getReceiver(e).then(function(o){if("data"!==o.kind&&r._log.error("Expected a DataTrackReceiver"),r._receiverPromise===n){try{r._transport=o.toDataTransport(),r.emit("ready",r._transport)}catch(a){r._log.error("Failed to toDataTransport: "+a.message)}o.once("close",function(){return r._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}(y);O.exports=c},9056:function(O,P,u){var e,g=this&&this.__extends||(e=function(r,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(o[s]=a[s])})(r,n)},function(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=r}e(r,n),r.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}),y=this&&this.__read||function(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,h,o=n.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(f){h={error:f}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(h)throw h.error}}return s},v=u(59069),c=u(8753),i=function(e){function r(n,o){var a=e.call(this)||this;return Object.defineProperties(a,{_factories:{value:new WeakMap},_manager:{value:n},_signaling:{value:o}}),o.on("updated",function(){return a.emit("updated")}),a}return g(r,e),Object.defineProperty(r.prototype,"level",{get:function(){return this._signaling.level},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"levels",{get:function(){return this._signaling.levels}
1,enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"remoteLevels",{get:function(){return this._signaling.remoteLevels},enumerable:!1,configurable:!0}),r.prototype.start=function(){var n=this;this.stop();var o=setTimeout(function(){n._timeout===o&&function t(e){var a=(e._manager._peerConnections?Array.from(e._manager._peerConnections.values()):[]).map(function(s){return s._peerConnection}).filter(function(s){return"closed"!==s.signalingState}).map(function(s){if(e._factories.has(s))return e._factories.get(s);var h=new c(s);return e._factories.set(s,h),h}).map(function(s){return s.next().catch(function(){return null})});return Promise.all(a).then(function(s){return s.filter(function(h){return h}).map(function(h){return h.summarize()})})}(n).then(function(a){if(n._timeout===o){if(a.length){var s=y(a,1);n._signaling.put(s[0])}n.start()}})},200);this._timeout=o},r.prototype.stop=function(){clearTimeout(this._timeout),this._timeout=null},r}(v);O.exports=i},25775:function(O,P,u){var r,g=this&&this.__extends||(r=function(n,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,s){a.__proto__=s}||function(a,s){for(var h in s)Object.prototype.hasOwnProperty.call(s,h)&&(a[h]=s[h])})(n,o)},function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function a(){this.constructor=n}r(n,o),n.prototype=null===o?Object.create(o):(a.prototype=o.prototype,new a)}),y=u(94071),v=u(6412),c=u(66543),i=5e3,t=function(r){function n(o,a,s){var h=r.call(this,o,"network_quality",s)||this;return Object.defineProperties(h,{_level:{value:null,writable:!0},_levels:{value:null,writable:!0},_remoteLevels:{value:new Map,writable:!0},_networkQualityInputs:{value:new v},_resendTimer:{value:new c(function(){h._resendTimer.setDelay(1.5*h._resendTimer.delay),h._sendNetworkQualityInputs()},i,!1)},_networkQualityReportLevels:{get:function(){return{reportLevel:a.local,remoteReportLevel:a.remote}}}}),h.on("ready",function(f){f.on("message",function(l){"network_quality"===(h._log.debug("Incoming: ",l),l.type)&&h._handleNetworkQualityMessage(l)})}),h._sendNetworkQualityInputs(),h}return g(n,r),Object.defineProperty(n.prototype,"level",{get:function(){return this._level},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"levels",{get:function(){return this._levels},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"remoteLevels",{get:function(){return this._remoteLevels},enumerable:!1,configurable:!0}),n.prototype._handleNetworkQualityMessage=function(o){var a=this,s=!1,h=null,f=o?o.local:null;"number"==typeof f?(h=f,this._levels=null):"object"==typeof f&&f&&(this._levels=f,h="number"==typeof f.level?f.level:Math.min(f.audio.send,f.audio.recv,f.video.send,f.video.recv)),null!==h&&this.level!==h&&(this._level=h,s=!0),this._remoteLevels=o&&o.remotes?o.remotes.reduce(function(l,p){return(a._remoteLevels.get(p.sid)||{}).level!==p.level&&(s=!0),l.set(p.sid,p)},new Map):this._remoteLevels,s&&this.emit("updated"),this._resendTimer.setDelay(i),this._resendTimer.isSet&&setTimeout(function(){return a._sendNetworkQualityInputs()},1e3)},n.prototype._sendNetworkQualityInputs=function(){var o=this;return this._resendTimer.clear(),this._networkQualityInputs.take().then(function(a){o._transport&&o._transport.publish(function e(r,n){return Object.assign({type:"network_quality"},r,n)}(a,o._networkQualityReportLevels))}).finally(function(){o._resendTimer.start()})},n.prototype.put=function(o){this._networkQualityInputs.put(o)},n}(y);O.exports=t},11058:function(O,P,u){var ue,g=this&&this.__extends||(ue=function(ie,U){return(ue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(J,te){J.__proto__=te}||function(J,te){for(var re in te)Object.prototype.hasOwnProperty.call(te,re)&&(J[re]=te[re])})(ie,U)},function(ie,U){if("function"!=typeof U&&null!==U)throw new TypeError("Class extends value "+String(U)+" is not a constructor or null");function J(){this.constructor=ie}ue(ie,U),ie.prototype=null===U?Object.create(U):(J.prototype=U.prototype,new J)}),y=this&&this.__read||function(ue,ie){var U="function"==typeof Symbol&&ue[Symbol.iterator];if(!U)return ue;var te,ae,J=U.call(ue),re=[];try{for(;(void 0===ie||ie-- >0)&&!(te=J.next()).done;)re.push(te.value)}catch(be){ae={error:be}}finally{try{te&&!te.done&&(U=J.return)&&U.call(J)}finally{if(ae)throw ae.error}}return re},v=this&&this.__spreadArray||function(ue,ie){for(var U=0,J=ie.length,te=ue.length;U<J;U++,te++)ue[te]=ie[U];return ue},c=u(2606),i=u(41647),t=i.RTCIceCandidate,e=i.RTCPeerConnection,r=i.RTCSessionDescription,n=i.getStats,o=u(77627),a=u(28701),s=a.DEFAULT_ICE_GATHERING_TIMEOUT_MS,h=a.DEFAULT_LOG_LEVEL,f=a.DEFAULT_SESSION_TIMEOUT_SEC,l=a.iceRe
1startBackoffConfig,p=u(13898),k=p.addOrRewriteNewTrackIds,T=p.addOrRewriteTrackIds,E=p.createCodecMapForMediaSection,S=p.disableRtx,m=p.enableDtxForOpus,b=p.filterLocalCodecs,d=p.getMediaSections,_=p.removeSSRCAttributes,w=p.revertSimulcast,R=p.setCodecPreferences,j=p.setSimulcast,V=u(66543),N=u(8380),x=N.MediaClientLocalDescFailedError,M=N.MediaClientRemoteDescFailedError,C=u(79739),B=C.buildLogLevels,Q=C.getPlatform,Y=C.isChromeScreenShareTrack,W=C.oncePerTick,K=C.defer,D=u(90380),L=u(32282),I=u(42498),G=u(33501),X=u(28675),Z=u(61458),$=u(41057),ee=u(33073),se=o.guessBrowser(),fe=Q(),le=/android/.test(fe),de="chrome"===se,me="firefox"===se,ve="safari"===se,he=0,_e={open:["closed","updating"],updating:["closed","open"],closed:[]},Ee=function(ue){function ie(U,J,te,re){var ae=ue.call(this,"open",_e)||this;re=Object.assign({enableDscp:!1,dummyAudioMediaStreamTrack:null,isChromeScreenShareTrack:Y,iceServers:[],logLevel:h,offerOptions:{},revertSimulcast:w,sessionTimeout:1e3*f,setCodecPreferences:R,setSimulcast:j,Backoff:c,IceConnectionMonitor:L,RTCIceCandidate:t,RTCPeerConnection:e,RTCSessionDescription:r,Timeout:V},re);var be=F(Object.assign({},re,re.rtcConfiguration)),ke=B(re.logLevel),xe=re.RTCPeerConnection;!0===re.enableDscp&&(re.chromeSpecificConstraints=re.chromeSpecificConstraints||{},re.chromeSpecificConstraints.optional=re.chromeSpecificConstraints.optional||[],re.chromeSpecificConstraints.optional.push({googDscp:!0}));var Le=re.log?re.log.createLog("webrtc",ae):new Z("webrtc",ae,ke,re.loggerName),Ce=new xe(be,re.chromeSpecificConstraints);re.dummyAudioMediaStreamTrack&&Ce.addTrack(re.dummyAudioMediaStreamTrack),Object.defineProperties(ae,{_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:re.enableDscp},_encodingParameters:{value:J},_isChromeScreenShareTrack:{value:re.isChromeScreenShareTrack},_iceGatheringFailed:{value:!1,writable:!0},_iceGatheringTimeout:{value:new re.Timeout(function(){return ae._handleIceGatheringTimeout()},s,!1)},_iceRestartBackoff:{value:new re.Backoff(l)},_instanceId:{value:++he},_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:Le},_eventObserver:{value:re.eventObserver},_remoteCodecMaps:{value:new Map},_rtpSenders:{value:new Map},_rtpNewSenders:{value:new Set},_iceConnectionMonitor:{value:new re.IceConnectionMonitor(Ce)},_mediaTrackReceivers:{value:new Set},_needsAnswer:{writable:!0,value:!1},_negotiationRole:{writable:!0,value:null},_offerOptions:{writable:!0,value:re.offerOptions},_onEncodingParametersChanged:{value:W(function(){ae._needsAnswer||Oe(ae)})},_peerConnection:{value:Ce},_preferredAudioCodecs:{value:te.audio},_preferredVideoCodecs:{value:te.video},_shouldApplyDtx:{value:te.audio.every(function(Te){return"opus"!==Te.codec})||te.audio.some(function(Te){return"opus"===Te.codec&&Te.dtx})},_queuedDescription:{writable:!0,value:null},_iceReconnectTimeout:{value:new re.Timeout(function(){Le.debug("ICE reconnect timed out"),ae.close()},re.sessionTimeout,!1)},_recycledTransceivers:{value:{audio:[],video:[]}},_replaceTrackPromises:{value:new Map},_remoteCandidates:{writable:!0,value:new D},_setCodecPreferences:{value:me&&le&&te.video[0]&&"h264"!==te.video[0].codec.toLowerCase()?function(Te){return Te}:re.setCodecPreferences},_setSimulcast:{value:re.setSimulcast},_revertSimulcast:{value:re.revertSimulcast},_RTCIceCandidate:{value:re.RTCIceCandidate},_RTCPeerConnection:{value:re.RTCPeerConnection},_RTCSessionDescription:{value:re.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:U}}),J.on("changed",ae._onEncodingParametersChanged),Ce.addEventListener("connectionstatechange",ae._handleConnectionStateChange.bind(ae)),Ce.addEventListener("datachannel",ae._handleDataChannelEvent.bind(ae)),Ce.addEventListener("icecandidate",ae._handleIceCandidateEvent.bind(ae)),Ce.addEventListener("iceconnectionstatechange",ae._handleIceConnectionStateChange.bind(ae)),Ce.addEventListener("icegatheringstatechange",ae._handleIceGatheringStateChange.bind(ae)),Ce.addEventListener("signalingstatechange",ae._handleSignalingStateChange.bind(ae)),Ce.addEventListener("track",ae._handleTrackEvent.bind(ae));var Re=ae;return ae.on("stateChanged",function Te(Se){"closed"===Se&&(Re.removeListener("stateChanged",Te),Re._dataChannels.forEac
1h(function(je,Ne){Re.removeDataTrackSender(Ne)}))}),ae}return g(ie,ue),ie.prototype.toString=function(){return"[PeerConnectionV2 #"+this._instanceId+": "+this.id+"]"},ie.prototype.setEffectiveAdaptiveSimulcast=function(U){this._log.debug("Setting setEffectiveAdaptiveSimulcast: ",U),this._preferredVideoCodecs.forEach(function(J){"adaptiveSimulcast"in J&&(J.adaptiveSimulcast=U)})},Object.defineProperty(ie.prototype,"_shouldApplySimulcast",{get:function(){return!(!de&&!ve)&&this._preferredVideoCodecs.some(function(J){return"vp8"===J.codec.toLowerCase()&&J.simulcast&&!1!==J.adaptiveSimulcast})},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"connectionState",{get:function(){return"failed"===this.iceConnectionState?"failed":this._peerConnection.connectionState||this.iceConnectionState},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"iceConnectionState",{get:function(){return this._isIceConnectionInactive&&"disconnected"===this._peerConnection.iceConnectionState||this._iceGatheringFailed?"failed":this._peerConnection.iceConnectionState},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"isApplicationSectionNegotiated",{get:function(){return"closed"===this._peerConnection.signalingState||!!this._peerConnection.localDescription&&d(this._peerConnection.localDescription.sdp,"application").length>0},enumerable:!1,configurable:!0}),Object.defineProperty(ie.prototype,"_isAdaptiveSimulcastEnabled",{get:function(){var U=this._preferredVideoCodecs.find(function(J){return"adaptiveSimulcast"in J});return U&&!0===U.adaptiveSimulcast},enumerable:!1,configurable:!0}),ie.prototype._maybeUpdateEncodings=function(U,J,te){if(void 0===te&&(te=!1),"video"!==U.kind||"ended"===U.readyState)return!1;var re=U.getSettings();if("number"!=typeof re.height||"number"!=typeof re.width)return!1;var ke=o.guessBrowser();return!!("safari"===ke||"chrome"===ke&&this._isAdaptiveSimulcastEnabled)&&(this._updateEncodings(U,J,te),!0)},ie.prototype._updateEncodings=function(U,J,te){if(this._isChromeScreenShareTrack(U)){var re=[{scaleResolutionDownBy:1},{scaleResolutionDownBy:1}];J.forEach(function(Te,Se){var je=re[Se];je?(Te.scaleResolutionDownBy=je.scaleResolutionDownBy,te&&delete Te.active):(Te.active=!1,delete Te.scaleResolutionDownBy)})}else{var ae=U.getSettings(),Le=ae.width*ae.height,Ce=[{pixels:518400,maxActiveLayers:3},{pixels:129600,maxActiveLayers:2},{pixels:0,maxActiveLayers:1}].find(function(Te){return Le>=Te.pixels}),Re=Math.min(J.length,Ce.maxActiveLayers);J.forEach(function(Te,Se){Se<Re?(Te.scaleResolutionDownBy=1<<Re-Se-1,te&&(Te.active=!0)):(Te.active=!1,delete Te.scaleResolutionDownBy)})}this._log.debug("_updateEncodings:",J.map(function(Te,Se){return"["+Se+": "+Te.active+", "+(Te.scaleResolutionDownBy||0)+"]"}).join(", "))},ie.prototype._addIceCandidate=function(U){var J=this;return Promise.resolve().then(function(){return U=new J._RTCIceCandidate(U),J._peerConnection.addIceCandidate(U)}).catch(function(te){J._log.warn("Failed to add RTCIceCandidate "+(U?'"'+U.candidate+'"':"null")+": "+te.message)})},ie.prototype._addIceCandidates=function(U){return Promise.all(U.map(this._addIceCandidate,this)).then(function(){})},ie.prototype._addOrUpdateTransceiver=function(U){var J=this,te=function ce(ue,ie){var U={audio:ue._preferredAudioCodecs.map(function(ae){return ae.codec.toLowerCase()}),video:ue._preferredVideoCodecs.map(function(ae){return ae.codec.toLowerCase()})}[ie],J=ue._recycledTransceivers[ie],te=U.find(function(ae){return ue._localCodecs.has(ae)});if(!te)return J.shift();var re=J.find(function(ae){var be=ue._remoteCodecMaps.get(ae.mid);return be&&be.has(te)});return re&&J.splice(J.indexOf(re),1),re}(this,U.kind);if(te&&te.sender){var re=te.sender.track?te.sender.track.id:null;return re&&this._log.warn("Reusing transceiver: "+te.mid+"] "+re+" => "+U.id),this._replaceTrackPromises.set(te,te.sender.replaceTrack(U).then(function(){te.direction="sendrecv"},function(){}).finally(function(){J._replaceTrackPromises.delete(te)})),te}return this._peerConnection.addTransceiver(U,{})},ie.prototype._checkIceBox=function(U){var J=q(U);if(!J)return Promise.resolve();var te=this._remoteCandidates.setUfrag(J);return this._addIceCandidates(te)},ie.prototype._answer=function(U){var J=this;return Promise.resolve().then(function(){return J._negotiationRole||(J._negotiationRole="answerer"),J._setRemoteDescription(U)}).catch(function(){throw new M}).then(function(){return J._peerConnection.createAnswer()}).then(function(te){te=me?new J._RTCSessionDescription({sdp:S(te.sdp),type:te.type}):ee(te);
1var re=_(te.sdp,["mslabel","label"]);if(J._shouldApplySimulcast){var ae=re;re=J._setSimulcast(ae,J._trackIdsToAttributes),re=J._revertSimulcast(re,ae,U.sdp)}return re=re.replace(/42e015/g,"42e01f"),J._setLocalDescription({type:te.type,sdp:re})}).then(function(){return J._checkIceBox(U)}).then(function(){return J._queuedDescription&&J._updateDescription(J._queuedDescription)}).then(function(){return J._queuedDescription=null,J._maybeReoffer(J._peerConnection.localDescription)}).catch(function(te){var re=te instanceof M?te:new x;throw J._publishMediaWarning({message:"Failed to _answer",code:re.code,error:te}),re})},ie.prototype._close=function(){return this._iceConnectionMonitor.stop(),"closed"!==this._peerConnection.signalingState&&(this._peerConnection.close(),this.preempt("closed"),this._encodingParameters.removeListener("changed",this._onEncodingParametersChanged),!0)},ie.prototype._handleConnectionStateChange=function(){this.emit("connectionStateChanged")},ie.prototype._handleDataChannelEvent=function(U){var J=this,te=U.channel,re=new I(te);this._dataTrackReceivers.add(re),te.addEventListener("close",function(){J._dataTrackReceivers.delete(re)}),this.emit("trackAdded",re)},ie.prototype._handleGlare=function(U){var J=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 J._trackIdsToAttributes=new Map(J._appliedTrackIdsToAttributes),J._setLocalDescription({type:"rollback"})}).then(function(){return J._needsAnswer=!1,J._answer(U)}).then(function(te){return te?Promise.resolve():J._offer()})},ie.prototype._publishMediaWarning=function(U){this._eventObserver.emit("event",{level:"warning",name:"error",group:"media",payload:{message:U.message,code:U.code,context:JSON.stringify({error:U.error.message,sdp:U.sdp})}})},ie.prototype._handleIceCandidateEvent=function(U){U.candidate&&(this._log.debug("Clearing ICE gathering timeout"),this._didGenerateLocalCandidates=!0,this._iceGatheringTimeout.clear(),this._localCandidates.push(U.candidate));var J={ice:{candidates:this._isIceLite?[]:this._localCandidates.slice(),ufrag:this._localUfrag},id:this.id};U.candidate||(J.ice.complete=!0),this._isIceLite&&U.candidate||(J.ice.revision=this._localCandidatesRevision++,this.emit("candidates",J))},ie.prototype._handleIceConnectionStateChange=function(){var U=this,J=this._peerConnection.iceConnectionState,te=["connected","completed"].includes(J),re=this._log;re.debug('ICE connection state is "'+J+'"'),te&&(this._iceReconnectTimeout.clear(),this._iceRestartBackoff.reset()),"failed"===this._lastIceConnectionState||"failed"!==J||this._shouldRestartIce||this._isRestartingIce?["disconnected","failed"].includes(this._lastIceConnectionState)&&te&&re.debug("ICE reconnected"):(re.warn("ICE failed"),this._initiateIceRestartBackoff()),"connected"===J?(this._isIceConnectionInactive=!1,this._iceConnectionMonitor.start(function(){U._iceConnectionMonitor.stop(),!U._shouldRestartIce&&!U._isRestartingIce&&(re.warn("ICE Connection Monitor detected inactivity"),U._isIceConnectionInactive=!0,U._initiateIceRestartBackoff(),U.emit("iceConnectionStateChanged"),U.emit("connectionStateChanged"))})):["disconnected","completed"].includes(J)||(this._iceConnectionMonitor.stop(),this._isIceConnectionInactive=!1),this._lastIceConnectionState=J,this.emit("iceConnectionStateChanged")},ie.prototype._handleIceGatheringTimeout=function(){this._log.warn("ICE failed to gather any local candidates"),this._iceGatheringFailed=!0,this._initiateIceRestartBackoff(),this.emit("iceConnectionStateChanged"),this.emit("connectionStateChanged")},ie.prototype._handleIceGatheringStateChange=function(){var U=this._peerConnection.iceGatheringState,J=this._log;J.debug('ICE gathering state is "'+U+'"');var te=this._iceGatheringTimeout;"gathering"===U&&!this._didGenerateLocalCandidates&&!te.isSet&&(J.debug("Starting ICE gathering timeout: "+te.delay),this._iceGatheringFailed=!1,this._iceGatheringTimeout.start())},ie.prototype._handleSignalingStateChange=function(){"stable"===this._peerConnection.signalingState&&(this._appliedTrackIdsToAttributes=new Map(this._trackIdsToAttributes))},ie.prototype._handleTrackEvent=function(U){var J=this,te=this._peerConnection.remoteDescription?this._peerConnection.remoteDescription.sdp:null;this._trackMatcher=this._trackMatcher||new $,this._trackMatcher.update(te);var re=U.track,ae=this._trackMatcher.match(U)||re.id,be=new G(ae,re);
1this._mediaTrackReceivers.forEach(function(ke){ke.track.id===be.track.id&&J._mediaTrackReceivers.delete(ke)}),this._mediaTrackReceivers.add(be),re.addEventListener?re.addEventListener("ended",function(){return J._mediaTrackReceivers.delete(be)}):re.onended=function(){return J._mediaTrackReceivers.delete(be)},this.emit("trackAdded",be)},ie.prototype._initiateIceRestart=function(){if("closed"!==this._peerConnection.signalingState){var U=this._log;U.warn("Attempting to restart ICE"),this._didGenerateLocalCandidates=!1,this._isIceRestartBackoffInProgress=!1,this._shouldRestartIce=!0;var J=this._iceReconnectTimeout;J.isSet||(U.debug("Starting ICE reconnect timeout: "+J.delay),this._iceReconnectTimeout.start()),this.offer().catch(function(ae){U.error("offer failed in _initiateIceRestart with: "+ae.message)})}},ie.prototype._initiateIceRestartBackoff=function(){var U=this;"closed"===this._peerConnection.signalingState||this._isIceRestartBackoffInProgress||(this._log.warn("An ICE restart has been scheduled"),this._isIceRestartBackoffInProgress=!0,this._iceRestartBackoff.backoff(function(){return U._initiateIceRestart()}))},ie.prototype._maybeReoffer=function(U){var J=this._shouldOffer;if(U&&U.sdp){var te=this._peerConnection.getSenders().filter(function(xe){return xe.track});J=["audio","video"].reduce(function(xe,Le){var Ce=d(U.sdp,Le,"(sendrecv|sendonly)"),Re=te.filter(A.bind(null,Le));return xe||Ce.length<Re.length},J);var re=this._dataChannels.size>0,ae=d(U.sdp,"application").length>0;J=J||re&&!ae}return(J?this._offer():Promise.resolve()).then(function(){return J})},ie.prototype._offer=function(){var U=this,J=Object.assign({},this._offerOptions);return this._needsAnswer=!0,this._shouldRestartIce&&(this._shouldRestartIce=!1,this._isRestartingIce=!0,J.iceRestart=!0),Promise.all(this._replaceTrackPromises.values()).then(function(){return U._peerConnection.createOffer(J)}).catch(function(te){var re=new x;throw U._publishMediaWarning({message:"Failed to create offer",code:re.code,error:te}),re}).then(function(te){te=me?new U._RTCSessionDescription({sdp:S(te.sdp),type:te.type}):ee(te);var re=_(te.sdp,["mslabel","label"]);re=U._peerConnection.remoteDescription?b(re,U._peerConnection.remoteDescription.sdp):re;var ae=U._setCodecPreferences(re,U._preferredAudioCodecs,U._preferredVideoCodecs);return U._shouldOffer=!1,U._negotiationRole||(U._negotiationRole="offerer"),U._shouldApplySimulcast&&(U._localDescriptionWithoutSimulcast={type:"offer",sdp:ae},ae=U._setSimulcast(ae,U._trackIdsToAttributes)),U._setLocalDescription({type:"offer",sdp:ae})})},ie.prototype._getMediaTrackSenderId=function(U){var J=Array.from(this._rtpSenders.keys()).find(function(te){return te.track.id===U});return J?J.id:U},ie.prototype._addOrRewriteLocalTrackIds=function(U){var J=this,re=this._peerConnection.getTransceivers().filter(function(Re){var Te=Re.sender;return!Re.stopped&&Te&&Te.track}),ae=re.filter(function(Re){return Re.mid}),be=new Map(ae.map(function(Re){return[Re.mid,J._getMediaTrackSenderId(Re.sender.track.id)]})),ke=T(U.sdp,be),xe=re.filter(function(Re){return!Re.mid}),Le=new Map(["audio","video"].map(function(Re){return[Re,xe.filter(function(Te){return Te.sender.track.kind===Re}).map(function(Te){return J._getMediaTrackSenderId(Te.sender.track.id)})]})),Ce=k(ke,be,Le);return new this._RTCSessionDescription({sdp:Ce,type:U.type})},ie.prototype._rollbackAndApplyOffer=function(U){var J=this;return this._setLocalDescription({type:"rollback"}).then(function(){return J._setLocalDescription(U)})},ie.prototype._setLocalDescription=function(U){var J=this;return"rollback"!==U.type&&this._shouldApplyDtx&&(U=new this._RTCSessionDescription({sdp:m(U.sdp),type:U.type})),this._peerConnection.setLocalDescription(U).catch(function(te){J._log.warn('Calling setLocalDescription with an RTCSessionDescription of type "'+U.type+'" failed with the error "'+te.message+'".',te);var re=new x,ae={message:'Calling setLocalDescription with an RTCSessionDescription of type "'+U.type+'" failed',code:re.code,error:te};throw U.sdp&&(J._log.warn("The SDP was "+U.sdp),ae.sdp=U.sdp),J._publishMediaWarning(ae),re}).then(function(){"rollback"!==U.type&&(J._localDescription=J._addOrRewriteLocalTrackIds(U),J._shouldApplyDtx&&(J._localDescription=new J._RTCSessionDescription({sdp:m(J._localDescription.sdp,[]),type:J._localDescription.type})),J._localCandidates=[],"offer"===U.type?J._descriptionRevision++:"answer"===U.type&&(J._lastStableDescriptionRevision=J._descriptionRevision,pe(J)),J._localUfrag=q(U),J.emit("description",J.getState()))})},ie.prototype._setRemoteDescription=function(U){var J=this;return U.sdp&&(U.sdp=this._setCodecPreferences(U.sdp,this._preferredAudioCodecs,this._preferredVideoCodecs),U.sdp=this._shouldApplyDtx?m(U.sdp):m(U.sdp,[]),me&&(U.sdp=function H(ue){return ue.replace(/a=msid:[^ ]+ /g,"a=msid:- ")}(U.sdp)),this._peerConnection.remoteDescription||(this._isIceLite=/a=ice-lite/.test(U.sdp))),U=new this._RTCSessionDescription(U),Promise.resolve().then(function(){if("answer"===U.type&&J._localDescriptionWithoutSimulcast){var te=J._preferredVideoCodecs.find(function(be){return"adaptiveSimulcast"in be}),ae=J._revertSimulcast(J._localDescription.sdp,J._localDescriptionWithoutSimulcast.sdp,U.sdp,!!te&&!1===te.adaptiveSimulcast);if(J._localDescriptionWithoutSimulcast=null,ae!==J._localDescription.sdp)return J._rollbackAndApplyOffer({type:J._localDescription.type,sdp:ae})}}).then(function(){return J._peerConnection.setRemoteDescription(U)}).then(function(){"answer"===U.type&&(J._isRestartingIce&&(J._log.debug("An ICE restart was in-progress and is now completed"),J._isRestartingIce=!1),pe(J))},function(te){throw J._log.warn('Calling setRemoteDescription with an RTCSessionDescription of type "'+U.type+'" failed with the error "'+te.message+'".',te),U.sdp&&J._log.warn("The SDP was "+U.sdp),te})},ie.prototype._updateDescription=function(U){var J=this;switch(U.type){case"answer":case"pranswer":if(U.revision!==this._descriptionRevision||"have-local-offer"!==this._peerConnection.signalingState)return Promise.resolve();this._descriptionRevision=U.revision;break;
1case"close":return this._close();case"create-offer":return U.revision<=this._lastStableDescriptionRevision?Promise.resolve():this._needsAnswer?(this._queuedDescription=U,Promise.resolve()):(this._descriptionRevision=U.revision,this._offer());case"offer":return U.revision<=this._lastStableDescriptionRevision||"closed"===this._peerConnection.signalingState?Promise.resolve():"have-local-offer"===this._peerConnection.signalingState?this._needsAnswer&&0===this._lastStableDescriptionRevision?(this._queuedDescription=U,Promise.resolve()):(this._descriptionRevision=U.revision,this._handleGlare(U)):(this._descriptionRevision=U.revision,this._answer(U).then(function(){}))}var te=U.revision;return Promise.resolve().then(function(){return J._setRemoteDescription(U)}).catch(function(re){var ae=new M;throw J._publishMediaWarning({message:'Calling setRemoteDescription with an RTCSessionDescription of type "'+U.type+'" failed',code:ae.code,error:re,sdp:U.sdp}),ae}).then(function(){return J._lastStableDescriptionRevision=te,J._needsAnswer=!1,J._checkIceBox(U)}).then(function(){return J._queuedDescription&&J._updateDescription(J._queuedDescription)}).then(function(){return J._queuedDescription=null,J._maybeReoffer(J._peerConnection.localDescription).then(function(){})})},ie.prototype._updateIce=function(U){var J=this._remoteCandidates.update(U);return this._addIceCandidates(J)},ie.prototype.addDataTrackSender=function(U){if(!this._dataChannels.has(U))try{var J={ordered:U.ordered};null!==U.maxPacketLifeTime&&(J.maxPacketLifeTime=U.maxPacketLifeTime),null!==U.maxRetransmits&&(J.maxRetransmits=U.maxRetransmits);var te=this._peerConnection.createDataChannel(U.id,J);U.addDataChannel(te),this._dataChannels.set(U,te)}catch(re){this._log.warn('Error creating an RTCDataChannel for DataTrack "'+U.id+'": '+re.message)}},ie.prototype._handleQueuedPublisherHints=function(){var U=this;"stable"===this._peerConnection.signalingState&&this._mediaTrackSenderToPublisherHints.forEach(function(J,te){var re=J.deferred,ae=J.encodings;U._mediaTrackSenderToPublisherHints.delete(te),U._setPublisherHint(te,ae).then(function(be){return re.resolve(be)}).catch(function(be){return re.reject(be)})})},ie.prototype._setPublisherHint=function(U,J){var te=this;if(me)return Promise.resolve("COULD_NOT_APPLY_HINT");this._mediaTrackSenderToPublisherHints.has(U)&&(this._mediaTrackSenderToPublisherHints.get(U).deferred.resolve("REQUEST_SKIPPED"),this._mediaTrackSenderToPublisherHints.delete(U));var ae=this._rtpSenders.get(U);if(!ae)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 be=K();return this._mediaTrackSenderToPublisherHints.set(U,{deferred:be,encodings:J}),be.promise}var ke=ae.getParameters();return null!==J&&J.forEach(function(xe){var Le=xe.enabled,Ce=xe.layer_index;ke.encodings.length>Ce?(te._log.debug("layer:"+Ce+", active:"+ke.encodings[Ce].active+" => "+Le),ke.encodings[Ce].active=Le):te._log.warn("invalid layer:"+Ce+", active:"+Le)}),this._maybeUpdateEncodings(ae.track,ke.encodings,null===J),ae.setParameters(ke).then(function(){return"OK"}).catch(function(xe){return te._log.error("Failed to apply publisher hints:",xe),"COULD_NOT_APPLY_HINT"})},ie.prototype.addMediaTrackSender=function(U){var J=this;if("closed"!==this._peerConnection.signalingState&&!this._rtpSenders.has(U)){var re=this._addOrUpdateTransceiver(U.track).sender;U.addSender(re,function(ae){return J._setPublisherHint(U,ae)}
1),this._rtpNewSenders.add(re),this._rtpSenders.set(U,re)}},ie.prototype.close=function(){this._close()&&(this._descriptionRevision++,this._localDescription={type:"close"},this.emit("description",this.getState()))},ie.prototype.getTrackReceivers=function(){return Array.from(this._dataTrackReceivers).concat(Array.from(this._mediaTrackReceivers))},ie.prototype.getState=function(){if(!this._localDescription)return null;var J={type:this._localDescription.type,revision:"answer"===this._localDescription.type?this._lastStableDescriptionRevision:this._descriptionRevision};return this._localDescription.sdp&&(J.sdp=this._localDescription.sdp),{description:J,id:this.id}},ie.prototype.offer=function(){var U=this;return this._needsAnswer||this._isRestartingIce?(this._shouldOffer=!0,Promise.resolve()):this.bracket("offering",function(J){return U.transition("updating",J),(U._needsAnswer||U._isRestartingIce?Promise.resolve():U._offer()).then(function(){U.tryTransition("open",J)},function(re){throw U.tryTransition("open",J),re})})},ie.prototype.removeDataTrackSender=function(U){var J=this._dataChannels.get(U);J&&(U.removeDataChannel(J),this._dataChannels.delete(U),J.close())},ie.prototype.removeMediaTrackSender=function(U){var J=this._rtpSenders.get(U);J&&("closed"!==this._peerConnection.signalingState&&this._peerConnection.removeTrack(J),U.removeSender(J),this._mediaTrackSenderToPublisherHints.has(U)&&(this._mediaTrackSenderToPublisherHints.get(U).deferred.resolve("UNKNOWN_TRACK"),this._mediaTrackSenderToPublisherHints.delete(U)),this._rtpNewSenders.delete(J),this._rtpSe
1nders.delete(U))},ie.prototype.setConfiguration=function(U){"function"==typeof this._peerConnection.setConfiguration&&this._peerConnection.setConfiguration(F(U))},ie.prototype.setIceReconnectTimeout=function(U){return this._iceReconnectTimeout.setDelay(U),this._log.debug("Updated ICE reconnection timeout period:",this._iceReconnectTimeout.delay),this},ie.prototype.update=function(U){var J=this;return this.bracket("updating",function(te){if("closed"===J.state)return Promise.resolve();J.transition("updating",te);var re=[];return U.ice&&re.push(J._updateIce(U.ice)),U.description&&re.push(J._updateDescription(U.description)),Promise.all(re).then(function(){J.tryTransition("open",te)},function(ae){throw J.tryTransition("open",te),ae})})},ie.prototype.getStats=function(){var U=this;return n(this._peerConnection,{log:this._log}).then(function(J){return function z(ue,ie){return Object.assign(ie,{remoteAudioTrackStats:ie.remoteAudioTrackStats.map(function(U){return Me(ue,U)}),remoteVideoTrackStats:ie.remoteVideoTrackStats.map(function(U){return Me(ue,U)}),localAudioTrackStats:ie.localAudioTrackStats.map(function(U){return ye(ue,U)}),localVideoTrackStats:ie.localVideoTrackStats.map(function(U){return ye(ue,U)})})}(U,J)})},ie}(X);function ye(ue,ie){var U=ue._getMediaTrackSenderId(ie.trackId);return Object.assign(ie,{trackId:U})}function Me(ue,ie){var U=v([],y(ue._mediaTrackReceivers)).find(function(te){return te.track.id===ie.trackId});return Object.assign(ie,{trackId:U?U.id:null})}function q(ue){if(ue.sdp){var ie=ue.sdp.match(/^a=ice-ufrag:([a-zA-Z0-9+/]+)/m);if(ie)return ie[1]}return null}function F(ue){return void 0===ue&&(ue={}),Object.assign({bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},ue)}function A(ue,ie){var U=ie.track;return U&&U.kind===ue&&"ended"!==U.readyState}function pe(ue){(function we(ue){ue._recycledTransceivers.audio=[],ue._recycledTransceivers.video=[],ue._peerConnection.getTransceivers().forEach(function(ie){(function oe(ue,ie){return!ue.stopped&&!ie._replaceTrackPromises.has(ue)&&["inactive","recvonly"].includes(ue.direction)})(ie,ue)&&ue._recycledTransceivers[ie.receiver.track.kind].push(ie)})})(ue),function ne(ue){var ie=ue._peerConnection.localDescription;
1!ie||!ie.sdp||d(ie.sdp).forEach(function(U){E(U).forEach(function(te,re){return ue._localCodecs.add(re)})})}(ue),function ge(ue){var ie=ue._peerConnection.remoteDescription;!ie||!ie.sdp||d(ie.sdp).forEach(function(U){var J=U.match(/^a=mid:(.+)$/m);if(J&&J[1]){var te=J[1],re=E(U);ue._remoteCodecMaps.set(te,re)}})}(ue),Oe(ue).then(function(){ue._handleQueuedPublisherHints()})}function Oe(ue){var ie=ue._encodingParameters,te=new Map([["audio",ie.maxAudioBitrate],["video",ie.maxVideoBitrate]]),re=[];return ue._peerConnection.getSenders().filter(function(ae){return ae.track}).forEach(function(ae){var be=te.get(ae.track.kind),ke=ae.getParameters();null===be||0===be?function Ie(ue){Array.isArray(ue.encodings)&&ue.encodings.forEach(function(ie){return delete ie.maxBitrate})}(ke):ue._isChromeScreenShareTrack(ae.track)?ue._log.warn("Not setting maxBitrate for "+ae.track.kind+" Track "+ae.track.id+" because it appears to be screen share track: "+ae.track.label):function Pe(ue,ie){me?ue.encodings=[{maxBitrate:ie}]:ue.encodings.forEac
1h(function(U){U.maxBitrate=ie})}(ke,be),!me&&ke.encodings.length>0&&("audio"===ae.track.kind?ke.encodings[0].priority="high":ue._isChromeScreenShareTrack(ae.track)&&(ke.encodings[0].priority="medium"),ue._enableDscp&&(ke.encodings[0].networkPriority="high"));var xe=ue._rtpNewSenders.has(ae);ue._maybeUpdateEncodings(ae.track,ke.encodings,xe),ue._rtpNewSenders.delete(ae);var Le=ae.setParameters(ke).catch(function(Ce){ue._log.warn("Error while setting encodings parameters for "+ae.track.kind+" Track "+ae.track.id+": "+(Ce.message||Ce.name))});re.push(Le)}),Promise.all(re)}O.exports=Ee},16603:function(O,P,u){var d,g=this&&this.__extends||(d=function(_,w){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,j){R.__proto__=j}||function(R,j){for(var V in j)Object.prototype.hasOwnProperty.call(j,V)&&(R[V]=j[V])})(_,w)},function(_,w){if("function"!=typeof w&&null!==w)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");function R(){this.constructor=_}d(_,w),_.prototype=null===w?Object.create(w):(R.prototype=w.prototype,new R)}),y=this&&this.__read||function(d,_){var w="function"==typeof Symbol&&d[Symbol.iterator];if(!w)return d;var j,N,R=w.call(d),V=[];try{for(;(void 0===_||_-- >0)&&!(j=R.next()).done;)V.push(j.value)}catch(x){N={error:x}}finally{try{j&&!j.done&&(w=R.return)&&w.call(R)}finally{if(N)throw N.error}}return V},v=this&&this.__spreadArray||function(d,_){for(var w=0,R=_.length,j=d.length;w<R;w++,j++)d[j]=_[w];return d},c=u(77627).guessBrowser,i=u(11058),t=u(60808),e=u(47772),r=u(79739),n=u(8380).MediaConnectionError,o="firefox"===c(),a=function(d){function _(w,R,j){var V=d.call(this)||this,N=(j=Object.assign({audioContextFactory:o?u(37708):null,PeerConnectionV2:i},j)).audioContextFactory?j.audioContextFactory.getOrCreate(V):null,x=N?{offerToReceiveVideo:!0}:{offerToReceiveAudio:!0,offerToReceiveVideo:!0};return Object.defineProperties(V,{_audioContextFactory:{value:j.audioContextFactory},_closedPeerConnectionIds:{value:new Set},_configuration:{writable:!0,value:null},_configurationDeferred:{writable:!0,value:r.defer()},_connectionState:{value:"new",writable:!0},_dummyAudioTrackSender:{value:N?new t(s(N)):null},_encodingParameters:{value:w},_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:x},_peerConnections:{value:new Map},_preferredCodecs:{value:R},_sessionTimeout:{value:null,writable:!0},_PeerConnectionV2:{value:j.PeerConnectionV2}}),V}return g(_,d),_.prototype.setEffectiveAdaptiveSimulcast=function(w){this._peerConnections.forEach(function(R){return R.setEffectiveAdaptiveSimulcast(w)}),this._preferredCodecs.video.forEach(function(R){"adaptiveSimulcast"in R&&(R.adaptiveSimulcast=w)})},Object.defineProperty(_.prototype,"connectionState",{get:function(){return this._connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"iceConnectionState",{get:function(){return this._iceConnectionState},enumerable:!1,configurable:!0}),_.prototype._closeAbsentPeerConnections=function(w){var R=new Set(w.map(function(j){return j.id}));return this._peerConnections.forEach(function(j){R.has(j.id)||j._close()}),this},_.prototype._getConfiguration=function(){return this._configurationDeferred.promise},_.prototype._getOrCreate=function(w,R){var j=this,V=this,N=this._peerConnections.get(w);if(!N){var x=this._PeerConnectionV2,M=Object.assign({dummyAudioMediaStreamTrack:this._dummyAudioTrackSender?this._dummyAudioTrackSender.track:null,offerOptions:this._offerOptions},this._sessionTimeout?{sessionTimeout:this._sessionTimeout}:{},R);try{N=new x(w,this._encodingParameters,this._preferredCodecs,M)}catch{throw new n}this._peerConnections.set(N.id,N),N.on("candidates",this.queue.bind(this,"candidates")),N.on("description",this.queue.bind(this,"description")),N.on("trackAdded",this.queue.bind(this,"trackAdded")),N.on("stateChanged",function C(B){"closed"===B&&(N.removeListener("stateChanged",C),V._dataTrackSenders.forEac
1h(function(Q){return N.removeDataTrackSender(Q)}),V._mediaTrackSenders.forEach(function(Q){return N.removeMediaTrackSender(Q)}),V._peerConnections.delete(N.id),V._closedPeerConnectionIds.add(N.id),b(V),m(V))}),N.on("connectionStateChanged",function(){return b(j)}),N.on("iceConnectionStateChanged",function(){return m(j)}),this._dataTrackSenders.forEach(N.addDataTrackSender,N),this._mediaTrackSenders.forEach(N.addMediaTrackSender,N),m(this)}return N},_.prototype.close=function(){return this._peerConnections.forEach(function(w){w.close()}),this._dummyAudioTrackSender&&this._dummyAudioTrackSender.stop(),this._audioContextFactory&&this._audioContextFactory.release(this),m(this),this},_.prototype.createAndOffer=function(){var w=this;return this._getConfiguration().then(function(R){var j;do{j=r.makeUUID()}while(w._peerConnections.has(j));return w._getOrCreate(j,R)}).then(function(R){return R.offer()}).then(function(){return w})},_.prototype.getTrackReceivers=function(){return r.flatMap(this._peerConnections,function(w){return w.getTrackReceivers()})},_.prototype.getStates=function(){var w=[];return this._peerConnections.forEach(function(R){var j=R.getState();j&&w.push(j)}),w},_.prototype.setConfiguration=function(w){return this._configuration&&(this._configurationDeferred=r.defer(),this._peerConnections.forEach(function(R){R.setConfiguration(w)})),this._configuration=w,this._configurationDeferred.resolve(w),this},_.prototype.setIceReconnectTimeout=function(w){return null===this._sessionTimeout&&(this._peerConnections.forEach(function(R){R.setIceReconnectTimeout(w)}),this._sessionTimeout=w),this},_.prototype.setTrackSenders=function(w){var R=new Set(w.filter(function(N){return"data"===N.kind})),j=new Set(w.filter(function(N){return N&&("audio"===N.kind||"video"===N.kind)})),V=function l(d,_,w){return{data:f(d,_),media:p(d,w)}}(this,R,j);return this._dataTrackSenders=R,this._mediaTrackSenders=j,function h(d,_){(_.data.add.size||_.data.remove.size||_.media.add.size||_.media.remove.size)&&d._peerConnections.forEach(function(w){_.data.remove.forEach(w.removeDataTrackSender,w),_.media.remove.forEach(w.removeMediaTrackSender,w),_.data.add.forEach(w.addDataTrackSender,w),_.media.add.forEach(w.addMediaTrackSender,w),(_.media.add.size||_.media.remove.size||_.data.add.size&&!w.isApplicationSectionNegotiated)&&w.offer()})}(this,V),this},_.prototype.update=function(w,R){var j=this;return void 0===R&&(R=!1),R&&this._closeAbsentPeerConnections(w),this._getConfiguration().then(function(V){return Promise.all(w.map(function(N){return j._closedPeerConnectionIds.has(N.id)?null:j._getOrCreate(N.id,V).update(N)}))}).then(function(){return j})},_.prototype.getStats=function(){var w=Array.from(this._peerConnections.values());return Promise.all(w.map(function(R){return R.getStats().then(function(j){return[R.id,j]})})).then(function(R){return new Map(R)})},_}(e);function s(d){return d.createMediaStreamDestination().stream.getAudioTracks()[0]}function f(d,_){return{add:r.difference(_,d._dataTrackSenders),remove:r.difference(d._dataTrackSenders,_)}}function p(d,_){return{add:r.difference(_,d._mediaTrackSenders),remove:r.difference(d._mediaTrackSenders,_)}}var T,k={new:0,checking:1,connecting:2,connected:3,completed:4,disconnected:-1,failed:-2,closed:-3};function S(d){return d.length?(T=T||function E(){return Object.keys(k).reduce(function(d,_){var w;return Object.assign(d,((w={})[k[_]]=_,w))},{})}(),d.reduce(function(_,w){return T[Math.max(k[_],k[w])]})):"new"}function m(d){d._lastIceConnectionState=d.iceConnectionState,d._iceConnectionState=S(v([],y(d._peerConnections.values())).map(function(_){return _.iceConnectionState})),d.iceConnectionState!==d._lastIceConnectionState&&d.emit("iceConnectionStateChanged")}function b(d){d._lastConnectionState=d.connectionState,d._connectionState=S(v([],y(d._peerConnections.values())).map(function(_){return _.connectionState})),d.connectionState!==d._lastConnectionState&&d.emit("connectionStateChanged")}O.exports=a},68069:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(94071),v=1,c=function(i){function t(e,r){var n=i.call(this,e,"publisher_hints",r)||this;return n.on("ready",function(o){n._log.debug("publisher_hints transport ready:",o),o.on("message",function(a){"publisher_hints"===(n._log.debug("Incoming: ",a),a.type)?a.publisher&&a.publisher.hints&&a.publisher.id&&n._processPublisherHints(a.publisher.hints,a.publisher.id):n._log.warn("Unknown message type: ",a.type)})}),n}
1return g(t,i),t.prototype.sendTrackReplaced=function(e){if(this._transport){var n={type:"client_reset",track:e.trackSid,id:v++};this._log.debug("Outgoing: ",n),this._transport.publish(n)}},t.prototype.sendHintResponse=function(e){if(this._transport){var o={type:"publisher_hints",id:e.id,hints:e.hints};this._log.debug("Outgoing: ",o),this._transport.publish(o)}},t.prototype._processPublisherHints=function(e,r){try{this.emit("updated",e,r)}catch(n){this._log.error("error processing hints:",n)}},t}(y);O.exports=c},38930:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(){var t=c.call(this)||this;return Object.defineProperties(t,{_revision:{value:1,writable:!0}}),t}return g(i,c),i.prototype.update=function(t){return t.revision<this._revision?this:(this._revision=t.revision,this.enable(t.is_recording))},i}(u(29987));O.exports=v},41118:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(22184),v=u(30467),c=function(i){function t(e,r,n,o,a,s){var h=i.call(this,e.sid,e.identity)||this;return s=Object.assign({RemoteTrackPublicationV2:v},s),Object.defineProperties(h,{_revision:{writable:!0,value:null},_RemoteTrackPublicationV2:{value:s.RemoteTrackPublicationV2},_getInitialTrackSwitchOffState:{value:r},updateSubscriberTrackPriority:{value:function(f,l){return n(f,l)}},updateTrackRenderHint:{value:function(f,l){return o(f,l)}},clearTrackHint:{value:function(f){return a(f)}},revision:{enumerable:!0,get:function(){return this._revision}}}),h.update(e)}return g(t,i),t.prototype._getOrCreateTrack=function(e){var r=this._RemoteTrackPublicationV2,n=this.tracks.get(e.sid);return n||(n=new r(e,this._getInitialTrackSwitchOffState(e.sid)),this.addTrack(n)),n},t.prototype.update=function(e){var r=this;if(null!==this.revision&&e.revision<=this.revision)return this;this._revision=e.revision;var n=new Set;switch(e.tracks.forEach(function(o){var a=r._getOrCreateTrack(o);a.update(o),n.add(a)}),this.tracks.forEach(function(o){n.has(o)||r.removeTrack(o)}),e.state){case"disconnected":this.disconnect();break;case"reconnecting":this.reconnecting();break;case"connected":this.connect(this.sid,this.identity)}return this},t}(y);O.exports=c},30467:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){return c.call(this,t.sid,t.name,t.kind,t.enabled,t.priority,e)||this}return g(i,c),i.prototype.update=function(t){return this.enable(t.enabled),this.setPriority(t.priority),this},i}(u(78956));O.exports=v},7818:function(O,P,u){var r,g=this&&this.__extends||(r=function(n,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,s){a.__proto__=s}||function(a,s){for(var h in s)Object.prototype.hasOwnProperty.call(s,h)&&(a[h]=s[h])})(n,o)},function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function a(){this.constructor=n}r(n,o),n.prototype=null===o?Object.create(o):(a.prototype=o.prototype,new a)}),y=u(94071),v=u(66543),c=u(79739).isDeepEqual,i=2e3,t=1,e=function(r){function n(o,a){var s=r.call(this,o,"render_hints",a)||this;return Object.defineProperties(s,{_trackSidsToRenderHints:{value:new Map},_responseTimer:{value:new v(function(){s._sendAllHints(),s._responseTimer.setDelay(2*s._responseTimer.delay)},i,!1)}}),s.on("ready",function(h){h.on("message",function(f){"render_hints"===(s._log.debug("Incoming: ",f),f.type)?s._processHintResults(f&&f.subscriber&&f.subscriber.hints||[]):s._log.warn("Unknown message type: ",f.type)}),s._sendAllHints()}),s}return g(n,r),n.prototype._sendAllHints=function(){var o=this;
1Array.from(this._trackSidsToRenderHints.keys()).forEach(function(a){var s=o._trackSidsToRenderHints.get(a);s.renderDimensions&&(s.isDimensionDirty=!0),"enabled"in s&&(s.isEnabledDirty=!0)}),this._sendHints()},n.prototype._processHintResults=function(o){var a=this;this._responseTimer.clear(),this._responseTimer.setDelay(i),o.forEach(function(s){"OK"!==s.result&&a._log.debug("Server error processing hint:",s)}),this._sendHints()},n.prototype._sendHints=function(){var o=this;if(this._transport&&!this._responseTimer.isSet){var a=[];if(Array.from(this._trackSidsToRenderHints.keys()).forEach(function(h){var f=o._trackSidsToRenderHints.get(h);if(f.isEnabledDirty||f.isDimensionDirty){var l={track:h};f.isEnabledDirty&&(l.enabled=f.enabled,f.isEnabledDirty=!1),f.isDimensionDirty&&(l.render_dimensions=f.renderDimensions,f.isDimensionDirty=!1),a.push(l)}}),a.length>0){var s={type:"render_hints",subscriber:{id:t++,hints:a}};this._log.debug("Outgoing: ",s),this._transport.publish(s),this._responseTimer.start()}}},n.prototype.setTrackHint=function(o,a){var s=this._trackSidsToRenderHints.get(o)||{isEnabledDirty:!1,isDimensionDirty:!1};"enabled"in a&&s.enabled!==a.enabled&&(s.enabled=!!a.enabled,s.isEnabledDirty=!0),a.renderDimensions&&!c(a.renderDimensions,s.renderDimensions)&&(s.renderDimensions=a.renderDimensions,s.isDimensionDirty=!0),this._trackSidsToRenderHints.set(o,s),this._sendHints()},n.prototype.clearTrackHint=function(o){this._trackSidsToRenderHints.delete(o)},n}(y);O.exports=e},62112:function(O,P,u){var D,g=this&&this.__extends||(D=function(L,I){return(D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(G,X){G.__proto__=X}||function(G,X){for(var Z in X)Object.prototype.hasOwnProperty.call(X,Z)&&(G[Z]=X[Z])})(L,I)},function(L,I){if("function"!=typeof I&&null!==I)throw new TypeError("Class extends value "+String(I)+" is not a constructor or null");function G(){this.constructor=L}D(L,I),L.prototype=null===I?Object.create(I):(G.prototype=I.prototype,new G)}),y=this&&this.__read||function(D,L){var I="function"==typeof Symbol&&D[Symbol.iterator];if(!I)return D;var X,$,G=I.call(D),Z=[];try{for(;(void 0===L||L-- >0)&&!(X=G.next()).done;)Z.push(X.value)}catch(ee){$={error:ee}}finally{try{X&&!X.done&&(I=G.return)&&I.call(G)}finally{if($)throw $.error}}return Z},v=u(61768),c=u(92743),i=u(9056),t=u(25775),e=u(38930),r=u(18343),n=u(41118),o=u(97805),a=u(38004),s=u(45210),h=u(7818),f=u(68069),l=u(79739),p=l.constants.DEFAULT_SESSION_TIMEOUT_SEC,k=l.createBandwidthProfilePayload,T=l.defer,E=l.difference,S=l.filterObject,m=l.flatMap,b=l.oncePerTick,d=u(78218),_=u(8380).createTwilioError,w=1e4,R=function(D){function L(I,G,X,Z,$){var ee=this;G.options=Object.assign({session_timeout:p},G.options),$=Object.assign({DominantSpeakerSignaling:v,TranscriptionSignaling:c,NetworkQualityMonitor:i,NetworkQualitySignaling:t,RecordingSignaling:e,RemoteParticipantV2:n,TrackPrioritySignaling:a,TrackSwitchOffSignaling:s,bandwidthProfile:null,sessionTimeout:1e3*G.options.session_timeout,statsPublishIntervalMs:w},$),I.setBandwidthProfile($.bandwidthProfile);var se=G.options,le=se.audio_processors,de=void 0===le?[]:le;I.setSignalingRegion(se.signaling_region),de.includes("krisp")&&de.push("rnnoise"),I.setAudioProcessors(de),Z.setIceReconnectTimeout($.sessionTimeout);var me=function(he){return ee._getTrackReceiver(he)},ve=(ee=D.call(this,I,G.sid,G.name,$)||this)._log;return Object.defineProperties(ee,{_disconnectedParticipantRevisions:{value:new Map},_NetworkQualityMonitor:{value:$.NetworkQualityMonitor},_lastBandwidthProfileRevision:{value:I.bandwidthProfileRevision,writable:!0},_mediaStatesWarningsRevision:{value:0,writable:!0},_networkQualityMonitor:{value:null,writable:!0},_networkQualityConfiguration:{value:I.networkQualityConfiguration},_peerConnectionManager:{value:Z},_published:{value:new Map},_publishedRevision:{value:0,writable:!0},_RemoteParticipantV2:{value:$.RemoteParticipantV2},_subscribed:{value:new Map},_subscribedRevision:{value:0,writable:!0},_subscriptionFailures:{value:new Map},_dominantSpeakerSignaling:{value:new $.DominantSpeakerSignaling(me,{log:ve})},_transcriptionSignaling:{value:new $.TranscriptionSignaling(me,{log:ve})},_networkQualitySignaling:{value:new $.NetworkQualitySignaling(me,I.networkQualityConfiguration,{log:ve})},_renderHintsSignaling:{value:new h(me,{log:ve})},_publisherHintsSignaling:{value:new f(me,{log:ve})},_trackPrioritySignaling:{value:new $.TrackPrioritySignaling(me,{log:ve})},_trackSwitchOffSignaling:{value:new $.TrackSwitchOffSignaling(me,{log:ve})},_pendingSwitchOffStates:{value:new Map},_transport:{value:X},_trackReceiverDeferreds:{value:new Map},mediaRegion:{enumerable:!0,value:G.options.media_region||null}}),ee._initTrackSwitchOffSignaling(),ee._initDominantSpeakerSignaling(),ee._initTranscriptionSignaling(),ee._initNetworkQualityMonitorSignaling(),ee._initPublisherHintSignaling(),function x(D,L){var I=b(function(){D._publishNe
1wLocalParticipantState()}),G=b(function(){var X=m(L.tracks,function(Z){return Z.trackTransceiver});D._peerConnectionManager.setTrackSenders(X)});L.on("trackAdded",G),L.on("trackRemoved",G),L.on("updated",I),D.on("stateChanged",function X(Z){"disconnected"===Z&&(L.removeListener("trackAdded",G),L.removeListener("trackRemoved",G),L.removeListener("updated",I),D.removeListener("stateChanged",X),L.disconnect())}),D.on("signalingConnectionStateChanged",function(){var X=D.localParticipant,$=X.identity,ee=X.sid;switch(D.signalingConnectionState){case"connected":X.connect(ee,$);break;case"reconnecting":X.reconnecting()}})}(ee,I),function M(D,L){L.on("description",function(G){D._publishPeerConnectionState(G)}),L.dequeue("description"),L.on("candidates",function(G){D._publishPeerConnectionState(G)}),L.dequeue("candidates"),L.on("trackAdded",D._addTrackReceiver.bind(D)),L.dequeue("trackAdded"),L.getTrackReceivers().forEach(D._addTrackReceiver,D),L.on("connectionStateChanged",function(){D.emit("connectionStateChanged")}),L.on("iceConnectionStateChanged",function(){D.emit("iceConnectionStateChanged"),"failed"===D.iceConnectionState&&(null!==D.localParticipant.networkQualityLevel&&D.localParticipant.setNetworkQualityLevel(0),D.participants.forEac
1h(function(I){null!==I.networkQualityLevel&&I.setNetworkQualityLevel(0)}))})}(ee,Z),function C(D,L){L.on("message",D._update.bind(D)),L.on("stateChanged",function I(G,X){"disconnected"===G&&("disconnected"!==D.state&&D._disconnect(X),L.removeListener("stateChanged",I)),D.emit("signalingConnectionStateChanged")})}(ee,X),function B(D,L,I){var G=new Map,X=!1,Z=setInterval(function(){D.getStats().then(function($){X=!X,$.forEach(function(ee,se){var fe=new o(se,ee,!0);L.publishEvent("quality","stats-report","info",{audioTrackStats:fe.remoteAudioTrackStats.map(function(ve,he){return W(ve,ee.remoteAudioTrackStats[he],G)}),localAudioTrackStats:fe.localAudioTrackStats.map(function(ve,he){return Y(ve,ee.localAudioTrackStats[he],G)}),localVideoTrackStats:fe.localVideoTrackStats.map(function(ve,he){return Y(ve,ee.localVideoTrackStats[he],G)}),peerConnectionId:fe.peerConnectionId,videoTrackStats:fe.remoteVideoTrackStats.map(function(ve,he){return W(ve,ee.remoteVideoTrackStats[he],G)})});var le=m(["localAudioTrackStats","localVideoTrackStats","remoteAudioTrackStats","remoteVideoTrackStats"],function(ve){return fe[ve].map(function(he){return he.trackSid+"+"+he.ssrc})});if(E(Array.from(G.keys()),le).forEach(function(ve){return G.delete(ve)}),X){var me=function K(D,L){return(D=Object.assign({availableIncomingBitrate:0,availableOutgoingBitrate:0,bytesReceived:0,bytesSent:0,consentRequestsSent:0,currentRoundTripTime:0,lastPacketReceivedTimestamp:0,lastPacketSentTimestamp:0,nominated:!1,peerConnectionId:L,priority:0,readable:!1,requestsReceived:0,requestsSent:0,responsesReceived:0,responsesSent:0,retransmissionsReceived:0,retransmissionsSent:0,state:"failed",totalRoundTripTime:0,transportId:"",writable:!1},S(D||{},null))).localCandidate=Object.assign({candidateType:"host",deleted:!1,ip:"",port:0,priority:0,protocol:"udp",url:""},S(D.localCandidate||{},null)),D.remoteCandidate=Object.assign({candidateType:"host",ip:"",port:0,priority:0,protocol:"udp",url:""},S(D.remoteCandidate||{},null)),D}(ee.activeIceCandidatePair,fe.peerConnectionId);L.publishEvent("quality","active-ice-candidate-pair","info",me)}})},function(){})},I);D.on("stateChanged",function $(ee){"disconnected"===ee&&(clearInterval(Z),D.removeListener("stateChanged",$))})}(ee,X,$.statsPublishIntervalMs),ee._update(G),ee._peerConnectionManager.setEffectiveAdaptiveSimulcast(ee._publisherHintsSignaling.isSetup),ee}return g(L,D),Object.defineProperty(L.prototype,"connectionState",{get:function(){return this._peerConnectionManager.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"signalingConnectionState",{get:function(){return"syncing"===this._transport.state?"reconnecting":this._transport.state},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"iceConnectionState",{get:function(){return this._peerConnectionManager.iceConnectionState},enumerable:!1,configurable:!0}),L.prototype._deleteTrackReceiverDeferred=function(I){return this._trackReceiverDeferreds.delete(I)},L.prototype._getOrCreateTrackReceiverDeferred=function(I){var G=this._trackReceiverDeferreds.get(I)||T(),Z=this._peerConnectionManager.getTrackReceivers().find(function($){return $.id===I&&"ended"!==$.readyState});return Z?G.resolve(Z):this._trackReceiverDeferreds.set(I,G),G},L.prototype._addTrackReceiver=function(I){return this._getOrCreateTrackReceiverDeferred(I.id).resolve(I),this},L.prototype._disconnect=function(I){var G=D.prototype._disconnect.call(this,I);return G&&(this._teardownNetworkQualityMonitor(),this._transport.disconnect(),this._peerConnectionManager.close()),this.localParticipant.tracks.forEach(function(X){X.publishFailed(I||new Error("LocalParticipant disconnected"))}),G},L.prototype._getTrackReceiver=function(I){var G=this;return this._getOrCreateTrackReceiverDeferred(I).promise.then(function(X){return G._deleteTrackReceiverDeferred(I),X})},L.prototype._getInitialTrackSwitchOffState=function(I){var G=this._pendingSwitchOffStates.get(I)||!1;return this._pendingSwitchOffStates.delete(I),G&&this._log.warn("["+I+"] was initially switched off! "),G},L.prototype._getTrackSidsToTrackSignalings=function(){var I=m(this.participants,function(G){return Array.from(G.tracks)});return new Map(I)},L.prototype._getOrCreateRemoteParticipant=function(I){var G=this,X=this._RemoteParticipantV2,Z=this.participants.get(I.sid),$=this;return Z||((Z=new X(I,function(ee){return G._getInitialTrackSwitchOffState(ee)},function(ee,se){return G._trackPrioritySignaling.sendTrackPriorityUpdate(ee,"subscribe",se)},function(ee,se){return G._renderHintsSignaling.setTrackHint(ee,se)},function(ee){return G._renderHintsSignaling.clearTrackHint(ee)})).on("stateChanged",function ee(se){"disconnected"===se&&(Z.removeListener("stateChanged",ee),$.participants.delete(Z.sid),$._disconnectedParticipantRevisions.set(Z.sid,Z.revision))}),this.connectParticipant(Z)),Z},L.prototype._getState=function(){return{participant:this.localParticipant.getState()}},L.prototype._maybeAddBandwidthProfile=function(I){var G=this.localParticipant,X=G.bandwidthProfile,Z=G.bandwidthProfileRevision;return X&&this._lastBandwidthProfileRevision<Z?(this._lastBandwidthProfileRevision=Z,Object.assign({bandwidth_profile:k(X)},I)):I}
1,L.prototype._publishNewLocalParticipantState=function(){this._transport.publish(this._maybeAddBandwidthProfile(this._getState()))},L.prototype._publishPeerConnectionState=function(I){this._transport.publish(Object.assign({peer_connections:[I]},this._getState()))},L.prototype._update=function(I){var G=this;if(I.subscribed&&I.subscribed.revision>this._subscribedRevision){this._subscribedRevision=I.subscribed.revision,I.subscribed.tracks.forEach(function($){$.id?(G._subscriptionFailures.delete($.sid),G._subscribed.set($.sid,$.id)):$.error&&!G._subscriptionFailures.has($.sid)&&G._subscriptionFailures.set($.sid,$.error)});var X=new Set(I.subscribed.tracks.filter(function($){return!!$.id}).map(function($){return $.sid}));this._subscribed.forEach(function($,ee){X.has(ee)||G._subscribed.delete(ee)})}var Z=new Set;return(I.participants||[]).forEach(function($){if($.sid!==G.localParticipant.sid){var ee=G._disconnectedParticipantRevisions.get($.sid);if(!(ee&&$.revision<=ee)){ee&&G._disconnectedParticipantRevisions.delete($.sid);var se=G._getOrCreateRemoteParticipant($);se.update($),Z.add(se)}}}
1),"synced"===I.type&&this.participants.forEach(function($){Z.has($)||$.disconnect()}),function Q(D){var L=D._getTrackSidsToTrackSignalings();D._subscriptionFailures.forEach(function(I,G){var X=L.get(G);X&&(D._subscriptionFailures.delete(G),X.subscribeFailed(_(I.code,I.message)))}),L.forEach(function(I){var G=D._subscribed.get(I.sid);(!G||I.isSubscribed&&I.trackTransceiver.id!==G)&&I.setTrackTransceiver(null),G&&D._getTrackReceiver(G).then(function(X){return I.setTrackTransceiver(X)})})}(this),I.peer_connections&&this._peerConnectionManager.update(I.peer_connections,"synced"===I.type),I.recording&&this.recording.update(I.recording),I.published&&I.published.revision>this._publishedRevision&&(this._publishedRevision=I.published.revision,I.published.tracks.forEach(function($){$.sid&&G._published.set($.id,$.sid)}),this.localParticipant.update(I.published)),I.participant&&this.localParticipant.connect(I.participant.sid,I.participant.identity),[this._dominantSpeakerSignaling,this._transcriptionSignaling,this._networkQualitySignaling,this._trackPrioritySignaling,this._trackSwitchOffSignaling,this._renderHintsSignaling,this._publisherHintsSignaling].forEach(function($){var ee=$.channel;!$.isSetup&&I.media_signaling&&I.media_signaling[ee]&&I.media_signaling[ee].transport&&"data-channel"===I.media_signaling[ee].transport.type&&$.setup(I.media_signaling[ee].transport.label)}
1),"warning"===I.type&&I.states&&I.states.revision>this._mediaStatesWarningsRevision&&(this._mediaStatesWarningsRevision=I.states.revision,this.localParticipant.updateMediaStates(I.states)),this},L.prototype._initPublisherHintSignaling=function(){var I=this;this._publisherHintsSignaling.on("updated",function(X,Z){Promise.all(X.map(function($){return I.localParticipant.setPublisherHint($.track,$.encodings).then(function(ee){return{track:$.track,result:ee}})})).then(function($){I._publisherHintsSignaling.sendHintResponse({id:Z,hints:$})})});var G=function(X){"video"===X.kind&&X.trackTransceiver.on("replaced",function(){I._publisherHintsSignaling.sendTrackReplaced({trackSid:X.sid})})};Array.from(this.localParticipant.tracks.values()).forEach(function(X){return G(X)}),this.localParticipant.on("trackAdded",function(X){return G(X)})},L.prototype._initTrackSwitchOffSignaling=function(){var I=this;this._trackSwitchOffSignaling.on("updated",function(G,X){try{I._log.debug("received trackSwitch: ",{tracksOn:X,tracksOff:G});var Z=new Map;X.forEach(function($){return Z.set($,!0)}),G.forEach(function($){Z.get($)&&I._log.warn($+" is DUPLICATED in both tracksOff and tracksOn list"),Z.set($,!1)}
1),I.participants.forEach(function($){$.tracks.forEach(function(ee){var se=Z.get(ee.sid);typeof se<"u"&&(ee.setSwitchedOff(!se),Z.delete(ee.sid))})}),Z.forEach(function($,ee){return I._pendingSwitchOffStates.set(ee,!$)})}catch($){I._log.error("error processing track switch off:",$)}})},L.prototype._initDominantSpeakerSignaling=function(){var I=this;this._dominantSpeakerSignaling.on("updated",function(){return I.setDominantSpeaker(I._dominantSpeakerSignaling.loudestParticipantSid)})},L.prototype._initTranscriptionSignaling=function(){var I=this;this._transcriptionSignaling.on("transcription",function(G){I.emit("transcription",G)})},L.prototype._initNetworkQualityMonitorSignaling=function(){var I=this;this._networkQualitySignaling.on("ready",function(){var G=new I._NetworkQualityMonitor(I._peerConnectionManager,I._networkQualitySignaling);I._networkQualityMonitor=G,G.on("updated",function(){"failed"!==I.iceConnectionState&&(I.localParticipant.setNetworkQualityLevel(G.level,G.levels),I.participants.forEach(function(X){var Z=G.remoteLevels.get(X.sid);Z&&X.setNetworkQualityLevel(Z.level,Z)}))}),G.start()}),this._networkQualitySignaling.on("teardown",function(){return I._teardownNetworkQualityMonitor()})},L.prototype._teardownNetworkQualityMonitor=function(){this._networkQualityMonitor&&(this._networkQualityMonitor.stop(),this._networkQualityMonitor=null)},L.prototype.getStats=function(){var I=this;return this._peerConnectionManager.getStats().then(function(G){return new Map(Array.from(G).map(function(X){var Z=y(X,2),ee=Z[1];return[Z[0],Object.assign({},ee,{localAudioTrackStats:V(I,ee.localAudioTrackStats),localVideoTrackStats:V(I,ee.localVideoTrackStats),remoteAudioTrackStats:N(I,ee.remoteAudioTrackStats),remoteVideoTrackStats:N(I,ee.remoteVideoTrackStats)})]}))})},L}(r);function j(D,L){return L.reduce(function(I,G){var X=D.get(G.trackId);return X?[Object.assign({},G,{trackSid:X})].concat(I):I},[])}function V(D,L){return j(D._published,L)}function N(D,L){return j(new Map(Array.from(D._subscribed.entries()).map(function(G){var X=y(G,2);return[X[1],X[0]]})),L)}function Y(D,L,I){var G=L.framesEncoded,X=L.packetsSent,Z=L.totalEncodeTime,$=L.totalPacketSendDelay,ee=Object.assign({},D),se=D.trackSid+"+"+D.ssrc,fe=I.get(se)||new Map;if("number"==typeof Z&&"number"==typeof G){var le=fe.get("avgEncodeDelay")||new d;le.putSample(1e3*Z,G),ee.avgEncodeDelay=Math.round(le.get()),fe.set("avgEncodeDelay",le)}if("number"==typeof $&&"number"==typeof X){var de=fe.get("avgPacketSendDelay")||new d;de.putSample(1e3*$,X),ee.avgPacketSendDelay=Math.round(de.get()),fe.set("avgPacketSendDelay",de)}return I.set(se,fe),ee}function W(D,L,I){var G=L.estimatedPlayoutTimestamp,X=L.framesDecoded,Z=L.jitterBufferDelay,$=L.jitterBufferEmittedCount,ee=L.totalDecodeTime,se=Object.assign({},D),fe=D.trackSid+"+"+D.ssrc,le=I.get(fe)||new Map;if("number"==typeof G&&(se.estimatedPlayoutTimestamp=G),"number"==typeof X&&"number"==typeof ee){var de=le.get("avgDecodeDelay")||new d;de.putSample(1e3*ee,X),se.avgDecodeDelay=Math.round(de.get()),le.set("avgDecodeDelay",de)}if("number"==typeof Z&&"number"==typeof $){var me=le.get("avgJitterBufferDelay")||new d;me.putSample(1e3*Z,$),se.avgJitterBufferDelay=Math.round(me.get()),le.set("avgJitterBufferDelay",me)}return I.set(fe,le),se}O.exports=R},38004:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,"track_priority",e)||this;return Object.defineProperties(r,{_enqueuedPriorityUpdates:{value:new Map}}),r.on("ready",function(n){Array.from(r._enqueuedPriorityUpdates.keys()).forEach(function(o){n.publish({type:"track_priority",track:o,subscribe:r._enqueuedPriorityUpdates.get(o)})})}),r}return g(i,c),i.prototype.sendTrackPriorityUpdate=function(t,e,r){if("subscribe"!==e)throw new Error("only subscribe priorities are supported, found: "+e);this._enqueuedPriorityUpdates.set(t,r),this._transport&&this._transport.publish({type:"track_priority",track:t,subscribe:r})},i}(u(94071));O.exports=v},45210:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,"track_switch_off",e)||this;return r.on("ready",function(n){n.on("message",function(o){"track_switch_off"===o.type&&r._setTrackSwitchOffUpdates(o.off||[],o.on||[])})}),r}return g(i,c),i.prototype._setTrackSwitchOffUpdates=function(t,e){this.emit("updated",t,e)},i}(u(94071));O.exports=v},92743:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,"extension_transcriptions",e)||this;return r.on("ready",function(n){n.on("message",function(o){"extension_transcriptions"===o.type&&r.emit("transcription",o)})}),r}return g(i,c),i}(u(94071));O.exports=v},84892:function(O,P,u){var x,g=this&&this.__extends||(x=function(M,C){return(x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,Q){B.__proto__=Q}||function(B,Q){for(var Y in Q)Object.prototype.hasOwnProperty.call(Q,Y)&&(B[Y]=Q[Y])})(M,C)},function(M,C){if("function"!=typeof C&&null!==C)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");function B(){this.constructor=M}x(M,C),M.prototype=null===C?Object.create(C):(B.prototype=C.prototype,new B)}),y=u(28675),v=u(5330),c=u(2606),i=u(28701).reconnectBackoffConfig,t=u(66543),e=u(28701),r=e.SDK_NAME,n=e.SDK_VERSION,o=e.SDP_FORMAT,a=u(79739),s=a.createBandwidthProfilePayload,h=a.createMediaSignalingPayload,f=a.createMediaWarningsPayload,l=a.createSubscribePayload,p=a.getUserAgent,k=a.isNonArrayObject,T=u(8380),E=T.createTwilioError,S=T.RoomCompletedError,m=T.SignalingConnectionError,b=T.SignalingServerBusyError,w={connecting:["connected","disconnected"],connected:["disconnected","syncing"],syncing:["connected","disconnected"],disconnected:[]},R=function(x){function M(C,B,Q,Y,W,K){var D;return K=Object.assign({Backoff:c,TwilioConnection:v,iceServers:null,trackPriority:!0,trackSwitchOff:!0,renderHints:!0,userAgent:p()},K),D=x.call(this,"connecting",w)||this,Object.defineProperties(D,{_accessToken:{value:B},_adaptiveSimulcast:{value:K.adaptiveSimulcast},_automaticSubscription:{value:K.automaticSubscription},_bandwidthProfile:{value:K.bandwidthProfile},_dominantSpeaker:{value:K.dominantSpeaker},_receiveTranscriptions:{value:K.receiveTranscriptions},_eventObserver:{value:K.eventObserver,writable:!1},_renderHints:{value:K.renderHints},_iceServersStatus:{value:Array.isArray(K.iceServers)?"overrode":"acquire"},_localParticipant:{value:Q},_name:{value:C},_networkQuality:{value:k(K.networkQuality)||K.networkQuality},_notifyWarnings:{value:K.notifyWarnings},_options:{value:K},_peerConnectionManager:{value:Y},_sessionTimer:{value:null,writable:!0},_sessionTimeoutMS:{value:0,writable:!0},_reconnectBackoff:{value:new K.Backoff(i)},_session:{value:null,writable:!0},_trackPriority:{value:K.trackPriority},_trackSwitchOff:{value:K.trackSwitchOff},_twilioConnection:{value:null,writable:!0},_updatesReceived:{value:[]},_updatesToSend:{value:[]},_userAgent:{value:K.userAgent},_wsServer:{value:W}}),function N(x){function M(){if("disconnected"!==x.state){x._twilioConnection&&x._twilioConnection.removeListener("message",B);var L=x._options,X=L.TwilioConnection,Z=new X(x._wsServer,Object.assign({helloBody:"connecting"===x.state&&"acquire"===x._iceServersStatus?x._createIceMessage():x._createConnectOrSyncOrDisconnectMessage()}
1,L));Z.once("close",function($){$===X.CloseReason.LOCAL?C():C(new Error($))}),Z.on("message",B),x._twilioConnection=Z}}function C(D){if("disconnected"!==x.state){if(!D)return void x.disconnect();var L=x._getReconnectTimer();if(!L){var I=D.message===v.CloseReason.BUSY?new b:new m;return void x.disconnect(I)}"connected"===x.state&&x.preempt("syncing"),L.then(M)}}function B(D){if("disconnected"!==x.state){if("error"===D.type)return void x.disconnect(E(D.code,D.message));switch(x.state){case"connected":switch(D.type){case"connected":case"synced":case"update":case"warning":return void x.emit("message",D);case"disconnected":return void x.disconnect("completed"===D.status?new S:null);default:return}case"connecting":switch(D.type){case"iced":return void x._options.onIced(D.ice_servers).then(function(){x._sendConnectOrSyncOrDisconnectMessage()});case"connected":return x._setSession(D.session,D.options.session_timeout),x.emit("connected",D),void x.preempt("connected");case"synced":case"update":return void x._updatesReceived.push(D);case"disconnected":return void x.disconnect("completed"===D.status?new S:null);default:return}case"syncing":switch(D.type){case"connected":case"update":return void x._updatesReceived.push(D);case"synced":return x._clearReconnectTimer(),x.emit("message",D),void x.preempt("connected");case"disconnected":return void x.disconnect("completed"===D.status?new S:null);default:return}default:return}}}x.on("stateChanged",function D(L){switch(L){case"connected":var I=x._updatesToSend.splice(0);return I.length&&x.publish(function V(x){return x.reduce(function(M,C){return(!M.participant&&C.participant||M.participant&&C.participant&&C.participant.revision>M.participant.revision)&&(M.participant=C.participant),!M.peer_connections&&C.peer_connections?M.peer_connections=j(C.peer_connections):M.peer_connections&&C.peer_connections&&(M.peer_connections=j(M.peer_connections.concat(C.peer_connections))),M},{})}(I)),void x._updatesReceived.splice(0).forEach(function(G){return x.emit("message",G)});case"disconnected":return x._twilioConnection.removeListener("message",B),void x.removeListener("stateChanged",D);default:return}});var Q=x._options;"overrode"===x._iceServersStatus?(0,Q.onIced)(Q.iceServers).then(M):M()}(D),D}return g(M,x),M.prototype._createConnectOrSyncOrDisconnectMessage=function(){if("connected"===this.state)return null;if("disconnected"===this.state)return{session:this._session,type:"disconnect",version:2};var C={connecting:"connect",syncing:"sync"}[this.state],B={name:this._name,participant:this._localParticipant.getState(),peer_connections:this._peerConnectionManager.getStates(),type:C,version:2};return"connect"===B.type?(B.ice_servers=this._iceServersStatus,B.publisher={name:r,sdk_version:n,user_agent:this._userAgent},this._bandwidthProfile&&(B.bandwidth_profile=s(this._bandwidthProfile)),this._notifyWarnings&&(B.participant.media_warnings=f(this._notifyWarnings)),B.media_signaling=h(this._dominantSpeaker,this._networkQuality,this._trackPriority,this._trackSwitchOff,this._adaptiveSimulcast,this._renderHints,this._receiveTranscriptions),B.subscribe=l(this._automaticSubscription),B.format=o,B.token=this._accessToken):"sync"===B.type?(B.session=this._session,B.token=this._accessToken):"update"===B.type&&(B.session=this._session),B},M.prototype._createIceMessage=function(){return{edge:"roaming",token:this._accessToken,type:"ice",version:1}},M.prototype._sendConnectOrSyncOrDisconnectMessage=function(){var C=this._createConnectOrSyncOrDisconnectMessage();C&&this._twilioConnection.sendMessage(C)},M.prototype.disconnect=function(C){return"disconnected"!==this.state&&(this.preempt("disconnected",null,[C]),this._sendConnectOrSyncOrDisconnectMessage(),this._twilioConnection.close(),!0)},M.prototype.publish=function(C){switch(this.state){case"connected":return this._twilioConnection.sendMessage(Object.assign({session:this._session,type:"update",version:2},C)),!0;case"connecting":case"syncing":return this._updatesToSend.push(C),!0;default:return!1}},M.prototype.publishEvent=function(C,B,Q,Y){this._eventObserver.emit("event",{group:C,name:B,level:Q,payload:Y})},M.prototype.sync=function(){return"connected"===this.state&&(this.preempt("syncing"),this._sendConnectOrSyncOrDisconnectMessage(),!0)},M.prototype._setSession=function(C,B){this._session=C,this._sessionTimeoutMS=1e3*B},M.prototype._getReconnectTimer=function(){var C=this;return 0===this._sessionTimeoutMS?null:(this._sessionTimer||(this._sessionTimer=new t(function(){C._sessionTimer&&(C._sessionTimeoutMS=0)},this._sessionTimeoutMS)),new Promise(function(B){C._reconnectBackoff.backoff(B)}
1))},M.prototype._clearReconnectTimer=function(){this._reconnectBackoff.reset(),this._sessionTimer&&(this._sessionTimer.clear(),this._sessionTimer=null)},M}(y);function j(x){return Array.from(x.reduce(function(M,C){var B=M.get(C.id)||C;return(!B.description&&C.description||B.description&&C.description&&C.description.revision>B.description.revision)&&(B.description=C.description),(!B.ice&&C.ice||B.ice&&C.ice&&C.ice.revision>B.ice.revision)&&(B.ice=C.ice),M.set(B.id,B),M},new Map).values())}O.exports=R},28675:function(O,P,u){var h,g=this&&this.__extends||(h=function(f,l){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,k){p.__proto__=k}||function(p,k){for(var T in k)Object.prototype.hasOwnProperty.call(k,T)&&(p[T]=k[T])})(f,l)},function(f,l){if("function"!=typeof l&&null!==l)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function p(){this.constructor=f}h(f,l),f.prototype=null===l?Object.create(l):(p.prototype=l.prototype,new p)}),y=this&&this.__read||function(h,f){var l="function"==typeof Symbol&&h[Symbol.iterator];if(!l)return h;var k,E,p=l.call(h),T=[];try{for(;(void 0===f||f-- >0)&&!(k=p.next()).done;)T.push(k.value)}catch(S){E={error:S}}finally{try{k&&!k.done&&(l=p.return)&&l.call(p)}finally{if(E)throw E.error}}return T},v=this&&this.__spreadArray||function(h,f){for(var l=0,p=f.length,k=h.length;l<p;l++,k++)h[k]=f[l];return h},c=u(59069).EventEmitter,i=u(79739),t=function(h){function f(l,p){var k=h.call(this)||this,T=null,E=l;return p=function a(h){var f=new Map;for(var l in h)f.set(l,new Set(h[l]));return f}(p),Object.defineProperties(k,{_lock:{get:function(){return T},set:function(S){T=S}},_reachableStates:{value:n(p)},_state:{get:function(){return E},set:function(S){E=S}},_states:{value:p},_whenDeferreds:{value:new Set},isLocked:{enumerable:!0,get:function(){return null!==T}},state:{enumerable:!0,get:function(){return E}}}),k.on("stateChanged",function(S){k._whenDeferreds.forEach(function(m){m.when(S,m.resolve,m.reject)})}),k}return g(f,h),f.prototype._whenPromise=function(l){var p=this;if("function"!=typeof l)return Promise.reject(new Error("when() executor must be a function"));var k=i.defer();return k.when=l,this._whenDeferreds.add(k),k.promise.then(function(T){return p._whenDeferreds.delete(k),T},function(T){throw p._whenDeferreds.delete(k),T})},f.prototype.bracket=function(l,p){var k,T=this;function E(S){if(T.hasLock(k)&&T.releaseLockCompletely(k),S)throw S}return this.takeLock(l).then(function(m){return p(k=m)}).then(function(m){return E(),m},E)},f.prototype.hasLock=function(l){return this._lock===l},f.prototype.preempt=function(l,p,k){if(!e(this._states,this.state,l))throw new Error('Cannot transition from "'+this.state+'" to "'+l+'"');var T;this.isLocked&&(T=this._lock,this._lock=null);var E=null;p&&(E=this.takeLockSync(p));var S=E?null:this.takeLockSync("preemption");return this.transition(l,E||S,k),T&&T.resolve(),S&&this.releaseLock(S),E},f.prototype.releaseLock=function(l){if(!this.isLocked)throw new Error("Could not release the lock for "+l.name+" because the StateMachine is not locked");if(!this.hasLock(l))throw new Error("Could not release the lock for "+l.name+" because "+this._lock.name+" has the lock");0===l.depth?(this._lock=null,l.resolve()):l.depth--},f.prototype.releaseLockCompletely=function(l){if(!this.isLocked)throw new Error("Could not release the lock for "+l.name+" because the StateMachine is not locked");if(!this.hasLock(l))throw new Error("Could not release the lock for "+l.name+" because "+this._lock.name+" has the lock");l.depth=0,this._lock=null,l.resolve()},f.prototype.takeLock=function(l){var p=this;if("object"==typeof l){var k=l;return new Promise(function(S){S(p.takeLockSync(k))})}var T=l;if(this.isLocked){var E=this.takeLock.bind(this,T);return this._lock.promise.then(E)}return Promise.resolve(this.takeLockSync(T))},f.prototype.takeLockSync=function(l){var p="string"==typeof l?null:l,k=p?p.name:l;if(p&&!this.hasLock(p)||!p&&this.isLocked)throw new Error("Could not take the lock for "+k+" because the lock for "+this._lock.name+" was not released");if(p)return p.depth++,p;var T=function r(h){var f=i.defer();return f.name=h,f.depth=0,f}(k);return this._lock=T,T},f.prototype.transition=function(l,p,k){if(k=k||[],this.isLocked){if(!p)throw new Error("You must provide the key in order to transition");if(!this.hasLock(p))throw new Error("Could not transition using the key for "+p.name+" because "+this._lock.name+" has the lock")}
1else if(p)throw new Error("Key provided for "+p.name+", but the StateMachine was not locked (possibly due to preemption)");if(!e(this._states,this.state,l))throw new Error('Cannot transition from "'+this.state+'" to "'+l+'"');this._state=l,this.emit.apply(this,v([],y(["stateChanged",l].concat(k))))},f.prototype.tryTransition=function(l,p,k){try{this.transition(l,p,k)}catch{return!1}return!0},f.prototype.when=function(l){var p=this;return this.state===l?Promise.resolve(this):e(this._reachableStates,this.state,l)?this._whenPromise(function(k,T,E){k===l?T(p):e(p._reachableStates,k,l)||E(s(k,l))}):Promise.reject(s(this.state,l))},f}(c);function e(h,f,l){return h.get(f).has(l)}function n(h){return Array.from(h.keys()).reduce(function(f,l){return f.set(l,o(h,l))},new Map)}function o(h,f,l){return l=l||new Set,h.get(f).forEach(function(p){l.has(p)||(l.add(p),o(h,p,l).forEach(l.add,l))}),l}function s(h,f){return new Error('"'+f+'" cannot be reached from "'+h+'"')}O.exports=t},77704:O=>{O.exports=function P(u){return(u=u.filter(function(g){return"number"==typeof g})).length<1?void 0:u.reduce(function(g,y){return y+g})/u.length}},54239:O=>{var P=function(){function u(g,y,v,c){Object.defineProperties(this,{availableSend:{enumerable:!0,value:v},recv:{enumerable:!0,value:y},rtt:{enumerable:!0,value:c},send:{enumerable:!0,value:g}})}return u.of=function(g,y){var v=(y.timestamp-g.timestamp)/1e3;return new u(v>0?(y.bytesSent-g.bytesSent)/v*8:0,v>0?(y.bytesReceived-g.bytesReceived)/v*8:0,y.availableOutgoingBitrate,y.currentRoundTripTime)},u}();O.exports=P},2483:(O,P,u)=>{var g=u(54239),y=function(){function v(){Object.defineProperties(this,{lastReport:{enumerable:!0,value:new g(0,0),writable:!0},lastStats:{enumerable:!0,value:null,writable:!0}})}return v.prototype.next=function(c){var i=this.lastStats;if(this.lastStats=c,i){var t=i.id===c.id?g.of(i,c):new g(0,0);this.lastReport=t}return this.lastReport},v}();O.exports=y},26719:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r){var n=c.call(this,t,e,r)||this;return Object.defineProperties(n,{audioLevel:{value:"number"==typeof e.audioInputLevel?e.audioInputLevel:null,enumerable:!0},jitter:{value:"number"==typeof e.jitter?e.jitter:null,enumerable:!0}}),n}return g(i,c),i}(u(83840));O.exports=v},83840:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r){var n=c.call(this,t,e)||this;return Object.defineProperties(n,{bytesSent:{value:"number"==typeof e.bytesSent?e.bytesSent:r?0:null,enumerable:!0},packetsSent:{value:"number"==typeof e.packetsSent?e.packetsSent:r?0:null,enumerable:!0},roundTripTime:{value:"number"==typeof e.roundTripTime?e.roundTripTime:r?0:null,enumerable:!0}}),n}return g(i,c),i}(u(89620));O.exports=v},21371:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e,r){var n=c.call(this,t,e,r)||this,o=null;"number"==typeof e.frameWidthInput&&"number"==typeof e.frameHeightInput&&(o={},Object.defineProperties(o,{width:{value:e.frameWidthInput,enumerable:!0},height:{value:e.frameHeightInput,enumerable:!0}}));var a=null;return"number"==typeof e.frameWidthSent&&"number"==typeof e.frameHeightSent&&(a={},Object.defineProperties(a,{width:{value:e.frameWidthSent,enumerable:!0},height:{value:e.frameHeightSent,enumerable:!0}})),Object.defineProperties(n,{captureDimensions:{value:o,enumerable:!0},dimensions:{value:a,enumerable:!0},captureFrameRate:{value:"number"==typeof e.frameRateInput?e.frameRateInput:null,enumerable:!0},frameRate:{value:"number"==typeof e.frameRateSent?e.frameRateSent:null,enumerable:!0}}),n}return g(i,c),i}
1(u(83840));O.exports=v},31908:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t){return c.call(this,t)||this}return g(i,c),i}(u(24976));O.exports=v},64661:O=>{O.exports=function u(g){var y=g.actual,c=g.available,t=g.level;Object.defineProperties(this,{actual:{value:void 0===y?null:y,enumerable:!0},available:{value:void 0===c?null:c,enumerable:!0},level:{value:void 0===t?null:t,enumerable:!0}})}},22165:O=>{O.exports=function u(g){var y=g.fractionLost,c=g.level;Object.defineProperties(this,{fractionLost:{value:void 0===y?null:y,enumerable:!0},level:{value:void 0===c?null:c,enumerable:!0}})}},50327:O=>{O.exports=function u(g){var y=g.jitter,c=g.rtt,t=g.level;Object.defineProperties(this,{jitter:{value:void 0===y?null:y,enumerable:!0},rtt:{value:void 0===c?null:c,enumerable:!0},level:{value:void 0===t?null:t,enumerable:!0}})}},24976:(O,P,u)=>{var g=u(70220),y=u(45206);O.exports=function c(i){var r=i.sendStats,n=void 0===r?null:r,o=i.recvStats,a=void 0===o?null:o;Object.defineProperties(this,{send:{value:i.send,enumerable:!0},recv:{value:i.recv,enumerable:!0},sendStats:{value:n?new g(n):null,enumerable:!0},recvStats:{value:a?new y(a):null,enumerable:!0}})}},45206:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t){return c.call(this,t)||this}return g(i,c),i}(u(24236));O.exports=v},24236:(O,P,u)=>{var g=u(64661),y=u(22165),v=u(50327);O.exports=function i(t){var e=t.bandwidth,r=void 0===e?null:e,n=t.fractionLost,o=void 0===n?null:n,a=t.latency,s=void 0===a?null:a;Object.defineProperties(this,{bandwidth:{value:r?new g(r):null,enumerable:!0},fractionLost:{value:o?new y(o):null,enumerable:!0},latency:{value:s?new v(s):null,enumerable:!0}})}},70220:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t){return c.call(this,t)||this}return g(i,c),i}(u(24236));O.exports=v},90669:(O,P,u)=>{var g=u(31908),y=u(22003);O.exports=function c(i){var e=i.audio,r=i.video;Object.defineProperties(this,{level:{value:i.level,enumerable:!0},audio:{value:e?new g(e):null,enumerable:!0},video:{value:r?new y(r):null,enumerable:!0}})}},22003:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t){return c.call(this,t)||this}return g(i,c),i}(u(24976));O.exports=v},65055:(O,P,u)=>{var g=u(58020),y=u(30775),v=function(){function c(i,t,e){Object.defineProperties(this,{ice:{enumerable:!0,value:i},audio:{enumerable:!0,value:t},video:{enumerable:!0,value:e}})}return c.prototype.summarize=function(){var i=this.audio.send.concat(this.video.send),t=y.summarize(i),e=this.audio.recv.concat(this.video.recv),r=g.summarize(e);return{ice:this.ice,send:t,recv:r,audio:{send:y.summarize(this.audio.send),recv:g.summarize(this.audio.recv)},video:{send:y.summarize(this.video.send),recv:g.summarize(this.video.recv)}}},c}();
1O.exports=v},8753:function(O,P,u){var g=this&&this.__read||function(_,w){var R="function"==typeof Symbol&&_[Symbol.iterator];if(!R)return _;var V,x,j=R.call(_),N=[];try{for(;(void 0===w||w-- >0)&&!(V=j.next()).done;)N.push(V.value)}catch(M){x={error:M}}finally{try{V&&!V.done&&(R=j.return)&&R.call(j)}finally{if(x)throw x.error}}return N},y=this&&this.__spreadArray||function(_,w){for(var R=0,j=w.length,V=_.length;R<j;R++,V++)_[V]=w[R];return _},v=this&&this.__values||function(_){var w="function"==typeof Symbol&&Symbol.iterator,R=w&&_[w],j=0;if(R)return R.call(_);if(_&&"number"==typeof _.length)return{next:function(){return _&&j>=_.length&&(_=void 0),{value:_&&_[j++],done:!_}}};throw new TypeError(w?"Object is not iterable.":"Symbol.iterator is not defined.")},c=u(77627).guessBrowser,i=u(2483),t=u(65055),e=u(11013),r=u(71031),n=function(){function _(w){Object.defineProperties(this,{pc:{enumerable:!0,value:w},ice:{enumerable:!0,value:new i},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 _.prototype.next=function(){var w=this,R="firefox"===c()?function b(_){var w=_.pc.getTransceivers().filter(function(j){return j.currentDirection&&j.currentDirection.match(/send/)&&j.sender.track}).map(function(j){return j.sender}),R=_.pc.getTransceivers().filter(function(j){return j.currentDirection&&j.currentDirection.match(/recv/)}).map(function(j){return j.receiver});return Promise.all([o(w),o(R),_.pc.getStats()]).then(function(j){var V=g(j,3),N=V[0],x=V[1],M=V[2],C=s(_),B=p(_);N.forEach(function(W,K){return T(_,W,B,K)}),S(C,B);var Q=h(_),Y=k(_);x.forEach(function(W,K){return E(_,W,Y,K)}),S(Q,Y),m(_.ice,M)})}(this):function d(_){return _.pc.getStats().then(function(w){var R=s(_),j=p(_);T(_,w,j),S(R,j);var V=h(_),N=k(_);E(_,w,N),S(V,N),m(_.ice,w)})}(this);return R.then(function(){var j=y([],g(w.audio.send.values())),V=y([],g(w.video.send.values())),N=y([],g(w.audio.recv.values())),x=y([],g(w.video.recv.values())),M=new t(w.ice.lastReport,{send:j.map(function(C){return C.lastReport}).filter(function(C){return C}),recv:N.map(function(C){return C.lastReport}).filter(function(C){return C})},{send:V.map(function(C){return C.lastReport}).filter(function(C){return C}),recv:x.map(function(C){return C.lastReport}).filter(function(C){return C})});return w.lastReport=M,M})},_}();function o(_){return Promise.all(_.map(function(w){var R=w.track.id;return w.getStats().then(function(j){var V,N;try{for(var x=v(j.values()),M=x.next();!M.done;M=x.next()){var C=M.value;"inbound-rtp"===C.type&&(C.id=R+"-"+C.id)}}catch(B){V={error:B}}finally{try{M&&!M.done&&(N=x.return)&&N.call(x)}finally{if(V)throw V.error}}return[R,j]})})).then(function(w){return new Map(w)})}function a(_,w,R,j,V){var N=w[j.mediaType];if(!V){var x=R.get(j.trackId);x&&(V=x.trackIdentifier)}if(N&&V){if(N.has(j.id))return N.get(j.id);var M=new _(V,j);N.set(j.id,M)}return null}function s(_){return{audio:_.audio.send,video:_.video.send}}function h(_){return{audio:_.audio.recv,video:_.video.recv}}function f(_,w,R,j){return a(r,s(_),w,R,j)}function l(_,w,R,j){return a(e,h(_),w,R,j)}function p(_){return{audio:new Set(_.audio.send.keys()),video:new Set(_.video.send.keys())}}function k(_){return{audio:new Set(_.audio.recv.keys()),video:new Set(_.video.recv.keys())}}function T(_,w,R,j){var V,N;try{for(var x=v(w.values()),M=x.next();!M.done;M=x.next()){var C=M.value;if("outbound-rtp"===C.type&&!C.isRemote){if("firefox"!==c()&&!C.trackId)continue;var B=R[C.mediaType];B&&B.delete(C.id);var Q=f(_,w,C,j);if(Q){var Y=w.get(C.remoteId);Q.next(j||Q.trackId,C,Y)}}}}catch(W){V={error:W}}finally{try{M&&!M.done&&(N=x.return)&&N.call(x)}finally{if(V)throw V.error}}}function E(_,w,R,j){var V,N;try{for(var x=v(w.values()),M=x.next();!M.done;M=x.next()){var C=M.value;if("inbound-rtp"===C.type&&!C.isRemote){var B=R[C.mediaType];B&&B.delete(C.id);var Q=l(_,w,C,j);Q&&Q.next(j||Q.trackId,C)}}}catch(Y){V={error:Y}}finally{try{M&&!M.done&&(N=x.return)&&N.call(x)}finally{if(V)throw V.error}}}function S(_,w){var R=function(V){var N=_[V];
1w[V].forEach(function(M){return N.delete(M)})};for(var j in w)R(j)}function m(_,w){var R,j,V,N,x;try{for(var M=v(w.values()),C=M.next();!C.done;C=M.next())"transport"===(B=C.value).type&&(x=w.get(B.selectedCandidatePairId))}catch(W){R={error:W}}finally{try{C&&!C.done&&(j=M.return)&&j.call(M)}finally{if(R)throw R.error}}if(x)_.next(x);else try{for(var Q=v(w.values()),Y=Q.next();!Y.done;Y=Q.next()){var B;"candidate-pair"===(B=Y.value).type&&B.nominated&&(!("selected"in B)||B.selected)&&_.next(B)}}catch(W){V={error:W}}finally{try{Y&&!Y.done&&(N=Q.return)&&N.call(Q)}finally{if(V)throw V.error}}}O.exports=n},58020:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=u(77704),v=u(57176),c=u(37483),i=function(t){function e(r,n,o,a,s,h,f){var l=t.call(this,r,n,o)||this;return Object.defineProperties(l,{deltaPacketsLost:{enumerable:!0,value:a},deltaPacketsReceived:{enumerable:!0,value:s},fractionLost:{enumerable:!0,value:h},jitter:{enumerable:!0,value:f},phonyFractionLost:{enumerable:!0,value:s>0?a/s:0}}),l}return g(e,t),e.of=function(r,n,o){if(n.id!==o.id)throw new Error("RTCStats IDs must match");var a=(o.timestamp-n.timestamp)/1e3,h=a>0?(o.bytesReceived-n.bytesReceived)/a*8:0,f=Math.max(o.packetsLost-n.packetsLost,0);return new e(n.id,r,h,f,o.packetsReceived-n.packetsReceived,o.fractionLost,o.jitter)},e.summarize=function(r){var n=r.map(function(h){return h.summarize()});return{bitrate:c(n.map(function(h){return h.bitrate})),fractionLost:y(n.map(function(h){return h.fractionLost})),jitter:y(n.map(function(h){return h.jitter}))}},e.prototype.summarize=function(){return{bitrate:this.bitrate,fractionLost:"number"==typeof this.fractionLost?this.fractionLost:this.phonyFractionLost,jitter:this.jitter}},e}(v);O.exports=i},11013:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(58020),c=function(i){function t(e,r){var n=i.call(this,r.id,e,r)||this;return Object.defineProperties(n,{lastReport:{enumerable:!0,value:null,writable:!0}}),n}return g(t,i),t.prototype.next=function(e,r){var n=this.lastStats;this.lastStats=r,this.trackId=e;var o=y.of(e,n,r);return this.lastReport=o,o},t}(u(6986));O.exports=c},45180:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,e)||this;return Object.defineProperties(r,{audioLevel:{value:"number"==typeof e.audioOutputLevel?e.audioOutputLevel:null,enumerable:!0},jitter:{value:"number"==typeof e.jitter?e.jitter:null,enumerable:!0}}),r}return g(i,c),i}(u(52613));
1O.exports=v},52613:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,e)||this;return Object.defineProperties(r,{bytesReceived:{value:"number"==typeof e.bytesReceived?e.bytesReceived:null,enumerable:!0},packetsReceived:{value:"number"==typeof e.packetsReceived?e.packetsReceived:null,enumerable:!0}}),r}return g(i,c),i}(u(89620));O.exports=v},993:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this,t,e)||this,n=null;return"number"==typeof e.frameWidthReceived&&"number"==typeof e.frameHeightReceived&&(n={},Object.defineProperties(n,{width:{value:e.frameWidthReceived,enumerable:!0},height:{value:e.frameHeightReceived,enumerable:!0}})),Object.defineProperties(r,{dimensions:{value:n,enumerable:!0},frameRate:{value:"number"==typeof e.frameRateReceived?e.frameRateReceived:null,enumerable:!0}}),r}return g(i,c),i}(u(52613));
1O.exports=v},57176:O=>{O.exports=function u(g,y,v){Object.defineProperties(this,{id:{enumerable:!0,value:g},trackId:{enumerable:!0,value:y},bitrate:{enumerable:!0,value:v}})}},6986:O=>{O.exports=function u(g,y,v){Object.defineProperties(this,{id:{enumerable:!0,value:g,writable:!0},trackId:{enumerable:!0,value:y,writable:!0},lastStats:{enumerable:!0,value:v,writable:!0}})}},30775:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=u(77704),v=u(57176),c=u(37483),i=function(t){function e(r,n,o,a){var s=t.call(this,r,n,o)||this;return Object.defineProperties(s,{rtt:{enumerable:!0,value:a}}),s}return g(e,t),e.of=function(r,n,o,a){if(n.id!==o.id)throw new Error("RTCStats IDs must match");var s=(o.timestamp-n.timestamp)/1e3;return new e(n.id,r,s>0?(o.bytesSent-n.bytesSent)/s*8:0,a&&"number"==typeof a.roundTripTime?a.roundTripTime/1e3:void 0)},e.summarize=function(r){return{bitrate:c(r.map(function(a){return a.bitrate})),rtt:y(r.map(function(a){return a.rtt}))}},e}(v);O.exports=i},71031:function(O,P,u){var i,g=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),y=u(6986),v=u(30775),c=function(i){function t(e,r){var n=i.call(this,r.id,e,r)||this;return Object.defineProperties(n,{lastReport:{enumerable:!0,value:null,writable:!0}}),n}return g(t,i),t.prototype.next=function(e,r,n){var o=this.lastStats;this.lastStats=r,this.trackId=e;var a=v.of(e,o,r,n);return this.lastReport=a,a},t}(y);O.exports=c},97805:(O,P,u)=>{var g=u(26719),y=u(21371),v=u(45180),c=u(993);O.exports=function t(e,r,n){if("string"!=typeof e)throw new Error("RTCPeerConnection id must be a string");Object.defineProperties(this,{peerConnectionId:{value:e,enumerable:!0},localAudioTrackStats:{value:r.localAudioTrackStats.map(function(o){return new g(o.trackId,o,n)}),enumerable:!0},localVideoTrackStats:{value:r.localVideoTrackStats.map(function(o){return new y(o.trackId,o,n)}),enumerable:!0},remoteAudioTrackStats:{value:r.remoteAudioTrackStats.map(function(o){return new v(o.trackId,o)}),enumerable:!0},remoteVideoTrackStats:{value:r.remoteVideoTrackStats.map(function(o){return new c(o.trackId,o)}),enumerable:!0}})}},37483:O=>{O.exports=function P(u){return u.reduce(function(g,y){return"number"==typeof y?y+g:g},0)}},89620:O=>{O.exports=function u(g,y){if("string"!=typeof g)throw new Error("Track id must be a string");Object.defineProperties(this,{trackId:{value:g,enumerable:!0},trackSid:{value:y.trackSid,enumerable:!0},timestamp:{value:y.timestamp,enumerable:!0},ssrc:{value:y.ssrc,enumerable:!0},packetsLost:{value:"number"==typeof y.packetsLost?y.packetsLost:null,enumerable:!0},codec:{value:"string"==typeof y.codecName?y.codecName:null,enumerable:!0}})}},54605:function(O,P,u){var c,g=this&&this.__extends||(c=function(i,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(i,t)},function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}c(i,t),i.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),v=function(c){function i(t,e){var r=c.call(this)||this;return Object.defineProperties(r,{id:{enumerable:!0,value:t},kind:{enumerable:!0,value:e}}),r}
1return g(i,c),i.prototype.stop=function(){this.emit("stopped")},i}(u(47772));O.exports=v},5330:function(O,P,u){var Y,g=this&&this.__extends||(Y=function(W,K){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,L){D.__proto__=L}||function(D,L){for(var I in L)Object.prototype.hasOwnProperty.call(L,I)&&(D[I]=L[I])})(W,K)},function(W,K){if("function"!=typeof K&&null!==K)throw new TypeError("Class extends value "+String(K)+" is not a constructor or null");function D(){this.constructor=W}Y(W,K),W.prototype=null===K?Object.create(K):(D.prototype=K.prototype,new D)}),y=this&&this.__read||function(Y,W){var K="function"==typeof Symbol&&Y[Symbol.iterator];if(!K)return Y;var L,G,D=K.call(Y),I=[];try{for(;(void 0===W||W-- >0)&&!(L=D.next()).done;)I.push(L.value)}catch(X){G={error:X}}finally{try{L&&!L.done&&(K=D.return)&&K.call(D)}finally{if(G)throw G.error}}return I},v=this&&this.__spreadArray||function(Y,W){for(var K=0,D=W.length,L=Y.length;K<D;K++,L++)Y[L]=W[K];return Y},c=u(28675),i=u(79739),t=i.buildLogLevels,e=i.makeUUID,r=u(61458),n=u(12643),o=u(66543),a=0,s={closed:[],connecting:["closed","open","waiting"],early:["closed","connecting"],open:["closed"],waiting:["closed","connecting","early","open"]},h={closed:"close",open:"open",waiting:"waiting"},l=3,p=3,k=5e3,T=15e3,E=5e3,R=3004,j=3005,x=globalThis,M=x.WebSocket?x.WebSocket:u(23332),C={BUSY:"busy",FAILED:"failed",LOCAL:"local",REMOTE:"remote",TIMEOUT:"timeout"},B=new Map([[3e3,C.TIMEOUT],[3001,C.TIMEOUT],[3002,C.FAILED],[3003,C.FAILED],[R,C.TIMEOUT],[3006,C.BUSY],[3007,C.TIMEOUT]]),Q=function(Y){function W(K,D){var L=Y.call(this,"early",s)||this;D=Object.assign({helloBody:null,maxConsecutiveFailedHellos:p,maxConsecutiveMissedHeartbeats:l,requestedHeartbeatTimeout:k,openTimeout:T,welcomeTimeout:E,Log:r,WebSocket:M},D);var I=t(D.logLevel),G=new D.Log("default",L,I,D.loggerName),X=D.networkMonitor?new n(function(){var $=X.type,ee="Network changed"+($?" to "+$:"");G.debug(ee),L._close({code:R,reason:ee})}):null;Object.defineProperties(L,{_busyWaitTimeout:{value:null,writable:!0},_consecutiveHeartbeatsMissed:{value:0,writable:!0},_cookie:{value:null,writable:!0},_eventObserver:{value:D.eventObserver},_heartbeatTimeout:{value:null,writable:!0},_hellosLeft:{value:D.maxConsecutiveFailedHellos,writable:!0},_instanceId:{value:++a},_log:{value:G},_messageQueue:{value:[]},_networkMonitor:{value:X},_options:{value:D},_openTimeout:{value:null,writable:!0},_sendHeartbeatTimeout:{value:null,writable:!0},_serverUrl:{value:K},_welcomeTimeout:{value:null,writable:!0},_ws:{value:null,writable:!0}});var Z={connecting:"info",early:"info",open:"info",waiting:"warning",closed:"info"};return L.on("stateChanged",function($){for(var ee=[],se=1;se<arguments.length;se++)ee[se-1]=arguments[se];$ in h&&L.emit.apply(L,v([h[$]],y(ee)));var fe={name:$,group:"signaling",level:Z[L.state]};if("closed"===$){var de=y(ee,1)[0];fe.payload={reason:de},fe.level=de===C.LOCAL?"info":"error"}L._eventObserver.emit("event",fe)}),L._eventObserver.emit("event",{name:L.state,group:"signaling",level:Z[L.state]}),L._connect(),L}return g(W,Y),W.prototype.toString=function(){return"[TwilioConnection #"+this._instanceId+": "+this._ws.url+"]"},W.prototype._close=function(K){var D=K.code,L=K.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&&D!==j&&this._busyWaitTimeout.clear(),this._messageQueue.splice(0);var I=this._log;1e3===D?(I.debug("Closed"),this.transition("closed",null,[C.LOCAL])):(I.warn("Closed: "+D+" - "+L),D!==j&&this.transition("closed",null,[B.get(D)||C.REMOTE]));var G=this._ws.readyState,X=this._options.WebSocket;G!==X.CLOSING&&G!==X.CLOSED&&this._ws.close(D,L)}},W.prototype._connect=function(){var K=this,D=this._log;if("waiting"===this.state)this.transition("early");else if("early"!==this.state)return void D.warn('Unexpected state "'+this.state+'" for connecting to the TCMP server.');this._ws=new this._options.WebSocket(this._serverUrl);var L=this._ws;D.debug("Created a new WebSocket:",L),L.addEventListener("close",function(G){return K._close(G)});var I=this._options.openTimeout;this._openTimeout=new o(function(){K._close({code:3007,reason:"Failed to open in "+I+" ms"})},I),L.addEventListener("open",function(){D.debug("WebSocket opened:",L),K._openTimeout.clear(),K._startHandshake(),K._networkMonitor&&K._networkMonitor.start()}),L.addEventListener("message",function(G){D.debug("Incoming: "+G.data);try{G=JSON.parse(G.data)}catch(X){return void K.emit("error",X)}switch(G.type){case"bad":K._handleBad(G);break;case"busy":K._handleBusy(G);break;case"bye":break;case"msg":K._handleMessage(G);case"heartbeat":K._handleHeartbeat();break;case"welcome":K._handleWelcome(G);break;default:K._log.debug("Unknown message type: "+G.type),K.emit("error",new Error("Unknown message type: "+G.type))}})},W.prototype._handleBad=function(K){var D=K.reason,L=this._log;
1if(["connecting","open"].includes(this.state))return"connecting"===this.state?(L.warn("Closing: 3002 - "+D),void this._close({code:3002,reason:D})):(L.debug("Error: "+D),void this.emit("error",new Error(D)));L.warn('Unexpected state "'+this.state+'" for handling a "bad" message from the TCMP server.')},W.prototype._handleBusy=function(K){var D=this,L=K.cookie,I=K.keepAlive,G=K.retryAfter,X=this._log;if(["connecting","waiting"].includes(this.state)){this._busyWaitTimeout&&this._busyWaitTimeout.clear(),this._welcomeTimeout&&this._welcomeTimeout.clear();var Z=G<0?'Received terminal "busy" message':'Received "busy" message, retrying after '+G+" ms";if(G<0)return X.warn("Closing: 3006 - "+Z),void this._close({code:3006,reason:Z});this._hellosLeft=this._options.maxConsecutiveFailedHellos,this._cookie=L||null,I?(X.warn(Z),this._busyWaitTimeout=new o(function(){return D._startHandshake()},G)):(X.warn("Closing: 3005 - "+Z),this._close({code:j,reason:Z}),this._busyWaitTimeout=new o(function(){return D._connect()},G)),this.transition("waiting",null,[I,G])}else X.warn('Unexpected state "'+this.state+'" for handling a "busy" message from the TCMP server.')},W.prototype._handleHeartbeat=function(){"open"===this.state?this._heartbeatTimeout.reset():this._log.warn('Unexpected state "'+this.state+'" for handling a "heartbeat" message from the TCMP server.')},W.prototype._handleHeartbeatTimeout=function(){if("open"===this.state){var K=this._log,D=this._options.maxConsecutiveMissedHeartbeats;K.debug("Consecutive heartbeats missed: "+D);var L="Missed "+D+' "heartbeat" messages';K.warn("Closing: 3001 - "+L),this._close({code:3001,reason:L})}},W.prototype._handleMessage=function(K){"open"===this.state?this.emit("message",K.body):this._log.warn('Unexpected state "'+this.state+'" for handling a "msg" message from the TCMP server.')},W.prototype._handleWelcome=function(K){var D=this,L=K.negotiatedTimeout,I=this._log;if(["connecting","waiting"].includes(this.state)){"waiting"===this.state&&(I.debug('Received "welcome" message, no need to retry connection.'),this._busyWaitTimeout.clear());var X=L*this._options.maxConsecutiveMissedHeartbeats,Z=L-200;this._welcomeTimeout.clear(),this._heartbeatTimeout=new o(function(){return D._handleHeartbeatTimeout()},X),this._messageQueue.splice(0).forEach(function($){return D._send($)}),this._sendHeartbeatTimeout=new o(function(){return D._sendHeartbeat()},Z),this.transition("open")}else I.warn('Unexpected state "'+this.state+'" for handling a "welcome" message from the TCMP server.')},W.prototype._handleWelcomeTimeout=function(){if("connecting"===this.state){var K=this._log;if(this._hellosLeft<=0){var D="All handshake attempts failed";return K.warn("Closing: 3000 - "+D),void this._close({code:3e3,reason:D})}K.warn("Handshake attempt "+(this._options.maxConsecutiveFailedHellos-this._hellosLeft)+" failed"),this._startHandshake()}},W.prototype._send=function(K){if(this._ws.readyState===this._options.WebSocket.OPEN){var I=JSON.stringify(K);this._log.debug("Outgoing: "+I);try{this._ws.send(I),this._sendHeartbeatTimeout&&this._sendHeartbeatTimeout.reset()}catch{var G="Failed to send message";this._log.warn("Closing: 3003 - "+G),this._close({code:3003,reason:G})}}},W.prototype._sendHeartbeat=function(){"closed"!==this.state&&this._send({type:"heartbeat"})},W.prototype._sendHello=function(){var K=this._options,D=K.helloBody,L=K.requestedHeartbeatTimeout,I={id:e(),timeout:L,type:"hello",version:2};this._cookie&&(I.cookie=this._cookie),D&&(I.body=D),this._send(I)},W.prototype._sendOrEnqueue=function(K){var D=this;"closed"!==this.state&&("open"===this.state?function(I){return D._send(I)}:function(I){return D._messageQueue.push(I)})(K)},W.prototype._startHandshake=function(){var K=this;["early","waiting"].includes(this.state)&&this.transition("connecting"),"connecting"===this.state&&(this._hellosLeft--,this._sendHello(),this._welcomeTimeout=new o(function(){return K._handleWelcomeTimeout()},this._options.welcomeTimeout))},W.prototype.close=function(){"closed"!==this.state&&(this._sendOrEnqueue({type:"bye"}),this._close({code:1e3,reason:"Normal"}))},W.prototype.sendMessage=function(K){this._sendOrEnqueue({body:K,type:"msg"})},W}(c);Q.CloseReason=C,O.exports=Q},6412:(O,P,u)=>{var g=u(79739).defer,y=function(){function v(){Object.defineProperties(this,{_deferreds:{value:[]},_hasValue:{value:!1,writable:!0},_value:{value:null,writable:!0}})}return v.prototype.put=function(c){this._hasValue=!0,this._value=c;var i=this._deferreds.shift();return i&&i.resolve(c),this},v.prototype.take=function(){var c=this;if(this._hasValue&&!this._deferreds.length)return this._hasValue=!1,Promise.resolve(this._value);var i=g();return this._deferreds.push(i),i.promise.then(function(t){return c._hasValue=!1,t})},v}();
1O.exports=y},2606:O=>{var P=function(){function u(g){Object.defineProperties(this,{_min:{value:g.min||100},_max:{value:g.max||1e4},_jitter:{value:g.jitter>0&&g.jitter<=1?g.jitter:0},_factor:{value:g.factor||2},_attempts:{value:0,writable:!0},_duration:{enumerable:!1,get:function(){var y=this._min*Math.pow(this._factor,this._attempts);if(this._jitter){var v=Math.random(),c=Math.floor(v*this._jitter*y);y=1&Math.floor(10*v)?y+c:y-c}return 0|Math.min(y,this._max)}},_timeoutID:{value:null,writable:!0}})}return u.prototype.backoff=function(g){var y=this,v=this._duration;this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null),this._timeoutID=setTimeout(function(){y._attempts++,g()},v)},u.prototype.reset=function(){this._attempts=0,this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=null)},u}();O.exports=P},23948:function(O){var P=this&&this.__read||function(o,a){var s="function"==typeof Symbol&&o[Symbol.iterator];if(!s)return o;var f,p,h=s.call(o),l=[];try{for(;(void 0===a||a-- >0)&&!(f=h.next()).done;)l.push(f.value)}catch(k){p={error:k}}finally{try{f&&!f.done&&(s=h.return)&&s.call(h)}finally{if(p)throw p.error}}return l};function g(){return!!(navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2)}function y(){return g()&&window.screen.width>=744&&(/Macintosh/i.test(navigator.userAgent)||/iPad/.test(navigator.userAgent)||/iPad/.test(navigator.platform))}function v(){return g()&&window.screen.width<=476&&(/Macintosh/i.test(navigator.userAgent)||/iPhone/.test(navigator.userAgent)||/iPhone/.test(navigator.platform))}O.exports={isAndroid:function u(){return/Android/.test(navigator.userAgent)},isIOS:function c(){return y()||v()},isIpad:y,isIphone:v,isMobile:function i(){return/Mobi/.test(navigator.userAgent)},isNonChromiumEdge:function t(o){return"chrome"===o&&/Edge/.test(navigator.userAgent)&&(typeof chrome>"u"||typeof chrome.runtime>"u")},mobileWebKitBrowser:function r(o){return"safari"!==o?null:"brave"in navigator?"brave":["edge","edg"].find(function(a){return navigator.userAgent.toLowerCase().includes(a)})||null},rebrandedChromeBrowser:function e(o){if("chrome"!==o)return null;if("brave"in navigator)return"brave";var h=function n(o){for(var a=[],s=[],h=0;h<o.length;h++)if("("===o[h])a.push(h);else if(")"===o[h]&&a.length>0){var f=a.pop();0===a.length&&s.push(o.substring(f,h+1))}return s}(navigator.userAgent).reduce(function(p,k){return p.replace(k,"")},navigator.userAgent).match(/[^\s]+/g)||[];return P(h.map(function(p){return p.split("/")[0].toLowerCase()})).slice(2).find(function(p){return!["chrome","mobile","safari"].includes(p)})||null}}},88126:function(O){var P=this&&this.__read||function(y,v){var c="function"==typeof Symbol&&y[Symbol.iterator];if(!c)return y;var t,r,i=c.call(y),e=[];try{for(;(void 0===v||v-- >0)&&!(t=i.next()).done;)e.push(t.value)}catch(n){r={error:n}}finally{try{t&&!t.done&&(c=i.return)&&c.call(i)}finally{if(r)throw r.error}}return e},u=this&&this.__spreadArray||function(y,v){for(var c=0,i=v.length,t=y.length;c<i;c++,t++)y[t]=v[c];return y},g=function(){function y(v,c){var i=this;Object.defineProperties(this,{_isCancelable:{writable:!0,value:!0},_isCanceled:{writable:!0,value:!1},_onCancel:{value:c}}),Object.defineProperty(this,"_promise",{value:new Promise(function(t,e){v(function(r){i._isCancelable=!1,t(r)},function(r){i._isCancelable=!1,e(r)},function(){return i._isCanceled})})})}return y.reject=function(v){return new y(function(i,t){t(v)},function(){})},y.resolve=function(v){return new y(function(i){i(v)},function(){})},y.prototype.cancel=function(){return this._isCancelable&&(this._isCanceled=!0,this._onCancel()),this},y.prototype.catch=function(){var v=[].slice.call(arguments),c=this._promise;return new y(function(t,e){c.catch.apply(c,u([],P(v))).then(t,e)},this._onCancel)},y.prototype.then=function(){var v=[].slice.call(arguments),c=this._promise;return new y(function(t,e){c.then.apply(c,u([],P(v))).then(t,e)},this._onCancel)},y.prototype.finally=function(){var v=[].slice.call(arguments),c=this._promise;return new y(function(t,e){c.finally.apply(c,u([],P(v))).then(t,e)},this._onCancel)},y}();
1O.exports=g},28701:(O,P,u)=>{var g=u(1730);O.exports.SDK_NAME=g.name+".js",O.exports.SDK_VERSION=g.version,O.exports.SDP_FORMAT="unified",O.exports.hardwareDevicePublisheriPad={hwDeviceManufacturer:"Apple",hwDeviceModel:"iPad",hwDeviceType:"tablet",platformName:"iOS"},O.exports.hardwareDevicePublisheriPhone={hwDeviceManufacturer:"Apple",hwDeviceModel:"iPhone",hwDeviceType:"mobile",platformName:"iOS"},O.exports.DEFAULT_ENVIRONMENT="prod",O.exports.DEFAULT_REALM="us1",O.exports.DEFAULT_REGION="gll",O.exports.DEFAULT_LOG_LEVEL="warn",O.exports.DEFAULT_LOGGER_NAME="twilio-video",O.exports.WS_SERVER=function(v,c){return c="gll"===c?"global":encodeURIComponent(c),"prod"===v?"wss://"+c+".vss.twilio.com/signaling":"wss://"+c+".vss."+v+".twilio.com/signaling"},O.exports.PUBLISH_MAX_ATTEMPTS=5,O.exports.PUBLISH_BACKOFF_JITTER=10,O.exports.PUBLISH_BACKOFF_MS=20,O.exports.typeErrors={ILLEGAL_INVOKE:function(v,c){return new TypeError("Illegal call to "+v+": "+c)},INVALID_TYPE:function(v,c){return new TypeError(v+" must be "+function y(v){return["a","e","i","o","u"].includes(v.toLowerCase()[0])?"an":"a"}(c)+" "+c)},INVALID_VALUE:function(v,c){return new RangeError(v+" must be one of "+c.join(", "))},REQUIRED_ARGUMENT:function(v){return new TypeError(v+" must be specified")}},O.exports.DEFAULT_FRAME_RATE=24,O.exports.DEFAULT_VIDEO_PROCESSOR_STATS_INTERVAL_MS=1e4,O.exports.DEFAULT_ICE_GATHERING_TIMEOUT_MS=15e3,O.exports.DEFAULT_SESSION_TIMEOUT_SEC=30,O.exports.DEFAULT_NQ_LEVEL_LOCAL=1,O.exports.DEFAULT_NQ_LEVEL_REMOTE=0,O.exports.MAX_NQ_LEVEL=3,O.exports.ICE_ACTIVITY_CHECK_PERIOD_MS=1e3,O.exports.ICE_INACTIVITY_THRESHOLD_MS=3e3,O.exports.iceRestartBackoffConfig={factor:1.1,min:1,max:1e3*O.exports.DEFAULT_SESSION_TIMEOUT_SEC,jitter:1},O.exports.reconnectBackoffConfig={factor:1.5,min:80,jitter:1},O.exports.subscriptionMode={MODE_COLLABORATION:"collaboration",MODE_GRID:"grid",MODE_PRESENTATION:"presentation"},O.exports.trackSwitchOffMode={MODE_DISABLED:"disabled",MODE_DETECTED:"detected",MODE_PREDICTED:"predicted"},O.exports.trackPriority={PRIORITY_HIGH:"high",PRIORITY_LOW:"low",PRIORITY_STANDARD:"standard"},O.exports.clientTrackSwitchOffControl={MODE_AUTO:"auto",MODE_MANUAL:"manual"},O.exports.videoContentPreferencesMode={MODE_AUTO:"auto",MODE_MANUAL:"manual"}},19059:(O,P,u)=>{var g=u(24687);O.exports=function c(i){var t=u(37708),e={},r=t.getOrCreate(e),n=3;return function o(){return n--,g(r,i.srcObject,250).then(function(a){return!!a&&(!(n>0)||o())}).catch(function(){return!0})}().finally(function(){t.release(e)})}},51741:O=>{var P=null;O.exports=function i(t){return P=P||document.createElement("canvas"),new Promise(function(e){var r=3;setTimeout(function n(){return r--,function c(t){try{var e=P.getContext("2d");e.drawImage(t,0,0,50,50);var n=e.getImageData(0,0,50,50).data.filter(function(a,s){return(s+1)%4});return 0===Math.max.apply(Math,n)}catch(a){return console.log("Error checking silence: ",a),!1}}(t)?r>0?setTimeout(n,250):e(!0):e(!1)},250)})}},82181:O=>{var P=function(){function u(g){var y=this;void 0===g&&(g=1),Object.defineProperties(this,{_listeners:{value:[]},_onVisibilityChange:{value:function(){y._emitVisible("visible"===document.visibilityState)}}});for(var v=0;v<g;v++)this._listeners.push([])}return u.prototype.clear=function(){for(var g=this._listeners.length,y=0;y<g;y++)this._listeners[y]=[]},u.prototype._listenerCount=function(){return this._listeners.reduce(function(g,y){return g+y.length},0)},u.prototype._emitVisible=function(g){for(var y=this,v=Promise.resolve(),c=function(t){v=v.then(function(){return y._emitVisiblePhase(t,g)})},i=1;i<=this._listeners.length;i++)c(i);return v},u.prototype._emitVisiblePhase=function(g,y){return Promise.all(this._listeners[g-1].map(function(c){var i=c(y);return i instanceof Promise?i:Promise.resolve(i)}))},u.prototype._start=function(){document.addEventListener("visibilitychange",this._onVisibilityChange)},u.prototype._stop=function(){document.removeEventListener("visibilitychange",this._onVisibilityChange)},u.prototype.onVisibilityChange=function(g,y){if("number"!=typeof g||g<=0||g>this._listeners.length)throw new Error("invalid phase: ",g);return this._listeners[g-1].push(y),1===this._listenerCount()&&this._start(),this},u.prototype.offVisibilityChange=function(g,y){if("number"!=typeof g||g<=0||g>this._listeners.length)throw new Error("invalid phase: ",g);var v=this._listeners[g-1],c=v.indexOf(y);return-1!==c&&(v.splice(c,1),0===this._listenerCount()&&this._stop()),this},u}();
1O.exports=new P(2)},69121:O=>{var P,u,g;O.exports=(P=globalThis,[u=P.location,g=P.URL].some(function(y){return!y})?function(v){return Promise.reject(new Error("Failed to import: "+v+": dynamicImport is not supported"))}:(P.__twilioVideoImportedModules={},function(v){return v in P.__twilioVideoImportedModules?Promise.resolve(P.__twilioVideoImportedModules[v]):new Function("scope","return import('"+new g(v,u)+"').then(m => scope.__twilioVideoImportedModules['"+v+"'] = m);")(P)}))},88606:function(O,P,u){var t,g=this&&this.__extends||(t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(n[a]=o[a])})(e,r)},function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),y=u(59069).EventEmitter,v=["signaling","room","media","quality","video-processor","preflight"],c=["debug","error","info","warning"],i=function(t){function e(r,n,o,a){void 0===a&&(a=null);var s=t.call(this)||this;return s.on("event",function(h){var f=h.name,l=h.group,p=h.level,k=h.payload;if("string"!=typeof f)throw o.error("Unexpected name: ",f),new Error("Unexpected name: ",f);if(!v.includes(l))throw o.error("Unexpected group: ",l),new Error("Unexpected group: ",l);if(!c.includes(p))throw o.error("Unexpected level: ",p),new Error("Unexpected level: ",p);var T=Date.now(),E=T-n,S=Object.assign({elapsedTime:E,level:p},k||{});r.publish(l,f,S);var m=Object.assign({elapsedTime:E,group:l,level:p,name:f,timestamp:T},k?{payload:k}:{});o[{debug:"debug",error:"error",info:"info",warning:"warn"}[p]]("event",m),a&&"signaling"===l&&a.emit("event",m)}),s}return g(e,t),e}(y);O.exports=i},33826:O=>{var P=function(){function u(g){g=Object.assign({getKey:function(v){return v},getValue:function(v){return v},isLessThanOrEqualTo:function(v,c){return v<=c}},g),Object.defineProperties(this,{_getKey:{value:g.getKey},_getValue:{value:g.getValue},_isLessThanOrEqualTo:{value:g.isLessThanOrEqualTo},_map:{value:new Map}})}return u.prototype.toMap=function(){return new Map(this._map)},u.prototype.updateAndFilter=function(g){return g.filter(this.update,this)},u.prototype.update=function(g){var y=this._getKey(g),v=this._getValue(g);return!(this._map.has(y)&&this._isLessThanOrEqualTo(v,this._map.get(y))||(this._map.set(y,v),0))},u}();O.exports=P},79739:function(O,P,u){var z,g=this&&this.__extends||(z=function(q,F){return(z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,H){A.__proto__=H}||function(A,H){for(var oe in H)Object.prototype.hasOwnProperty.call(H,oe)&&(A[oe]=H[oe])})(q,F)},function(q,F){if("function"!=typeof F&&null!==F)throw new TypeError("Class extends value "+String(F)+" is not a constructor or null");function A(){this.constructor=q}z(q,F),q.prototype=null===F?Object.create(F):(A.prototype=F.prototype,new A)}),y=this&&this.__read||function(z,q){var F="function"==typeof Symbol&&z[Symbol.iterator];if(!F)return z;var H,ce,A=F.call(z),oe=[];try{for(;(void 0===q||q-- >0)&&!(H=A.next()).done;)oe.push(H.value)}catch(ne){ce={error:ne}}finally{try{H&&!H.done&&(F=A.return)&&F.call(A)}finally{if(ce)throw ce.error}}return oe},v=this&&this.__spreadArray||function(z,q){for(var F=0,A=q.length,H=z.length;F<A;F++,H++)z[H]=q[F];return z},c=u(28701),i=c.typeErrors,t=c.trackPriority,e=u(77627),r=u(48066).sessionSID,n=u(62585);function k(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"Unknown"}function _(z,q,F,A){if(!(A in q)&&!A.match(/^on[a-z]+$/)){var H;try{H=typeof z[A]}catch{}"function"===H&&(q[A]=function(){for(var oe,ce=[],ne=0;ne<arguments.length;ne++)ce[ne]=arguments[ne];return(oe=this[F])[A].apply(oe,v([],y(ce)))})}}function j(z){return"object"==typeof z&&!Array.isArray(z)}function Q(z){Object.getOwnPropertyNames(z).forEach(function(q){q.startsWith("_")&&W(z,q)})}function W(z,q){var F=Object.getOwnPropertyDescriptor(z,q);F.enumerable=!1,Object.defineProperty(z,q,F)}function D(z){return z.map(X)}function X(z){return Array.isArray(z)?D(z):z instanceof Set?function L(z){return D(v([],y(z)))}(z):z instanceof Map?function I(z){return v([],y(z.entries())).reduce(function(q,F){var A,H=y(F,2);return Object.assign(((A={})[H[0]]=X(H[1]),A),q)},{})}(z):z&&"object"==typeof z?function G(z){return Object.entries(z).reduce(function(q,F){var A,H=y(F,2);return Object.assign(((A={})[H[0]]=X(H[1]),A),q)},{})}(z):z}function ee(z){return de(z,[{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:le},{prop:"trackSwitchOffMode",type:"string",payloadProp:"track_switch_off"}
1])}function fe(z){return de(z,[{prop:"height",type:"number"},{prop:"width",type:"number"}])}function le(z){return de(z,[{prop:t.PRIORITY_HIGH,type:"object",transform:fe},{prop:t.PRIORITY_LOW,type:"object",transform:fe},{prop:t.PRIORITY_STANDARD,type:"object",transform:fe}])}function de(z,q){return q.reduce(function(F,A){var H,oe=A.prop,ne=A.payloadProp,we=A.transform;return typeof z[oe]===A.type?Object.assign(((H={})[void 0===ne?oe:ne]=(void 0===we?function(Oe){return Oe}:we)(z[oe]),H),F):F},{})}P.constants=c,P.createBandwidthProfilePayload=function $(z){return de(z,[{prop:"video",type:"object",transform:ee}])},P.createMediaSignalingPayload=function se(z,q,F,A,H,oe,ce){var ne={transports:[{type:"data-channel"}]};return Object.assign(z?{active_speaker:ne}:{},q?{network_quality:ne}:{},oe?{render_hints:ne}:{},H?{publisher_hints:ne}:{},F?{track_priority:ne}:{},A?{track_switch_off:ne}:{},ce?{extension_transcriptions:ne}:{})},P.createMediaWarningsPayload=function ve(z){var q,F=((q={})[n.recordingMediaLost]="recordings",q);return z.map(function(A){return F[A]}).filter(function(A){return!!A})},P.createRoomConnectEventPayload=function Z(z){function q(oe){return oe?"true":"false"}var F={sessionSID:r,iceServers:(z.iceServers||[]).length,audioTracks:(z.tracks||[]).filter(function(oe){return"audio"===oe.kind}).length,videoTracks:(z.tracks||[]).filter(function(oe){return"video"===oe.kind}).length,dataTracks:(z.tracks||[]).filter(function(oe){return"data"===oe.kind}).length};if([["audio"],["automaticSubscription"],["enableDscp"],["eventListener"],["preflight"],["video"],["dominantSpeaker","enableDominantSpeaker"]].forEach(function(oe){var ce=y(oe,2),ne=ce[0],ge=ce[1];F[ge=ge||ne]=q(!!z[ne])}),[["maxVideoBitrate"],["maxAudioBitrate"]].forEach(function(oe){var ce=y(oe,2),ne=ce[0],ge=ce[1];ge=ge||ne,"number"==typeof z[ne]?F[ge]=z[ne]:isNaN(Number(z[ne]))||(F[ge]=Number(z[ne]))}),[["iceTransportPolicy"],["region"],["name","roomName"]].forEach(function(oe){var ce=y(oe,2),ne=ce[0],ge=ce[1];ge=ge||ne,"string"==typeof z[ne]?F[ge]=z[ne]:"number"==typeof z[ne]&&"name"===ne&&(F[ge]=z[ne].toString())}),["preferredAudioCodecs","preferredVideoCodecs"].forEach(function(oe){oe in z&&(F[oe]=JSON.stringify(z[oe]))}),"networkQuality"in z&&(F.networkQualityConfiguration={},j(z.networkQuality)?["local","remote"].forEach(function(oe){"number"==typeof z.networkQuality[oe]&&(F.networkQualityConfiguration[oe]=z.networkQuality[oe])}):(F.networkQualityConfiguration.remote=0,F.networkQualityConfiguration.local=z.networkQuality?1:0)),z.bandwidthProfile&&z.bandwidthProfile.video){var A=z.bandwidthProfile.video||{};F.bandwidthProfileOptions={},["mode","maxTracks","trackSwitchOffMode","dominantSpeakerPriority","maxSubscriptionBitrate","renderDimensions","contentPreferencesMode","clientTrackSwitchOffControl"].forEach(function(oe){"number"==typeof A[oe]||"string"==typeof A[oe]?F.bandwidthProfileOptions[oe]=A[oe]:"boolean"==typeof A[oe]?F.bandwidthProfileOptions[oe]=q(A[oe]):"object"==typeof A[oe]&&(F.bandwidthProfileOptions[oe]=JSON.stringify(A[oe]))})}return Object.entries({RTCPeerConnection:"customRTCPeerConnectionImpl",MediaStream:"customMediaStreamImpl",getUserMedia:"customGetUserMediaImpl",enumerateDevices:"customEnumerateDevicesImpl"}).forEach(function(oe){var ce=y(oe,2);F[ce[1]]=q(typeof z[ce[0]]<"u")}),{group:"room",name:"connect",level:"info",payload:F}},P.createSubscribePayload=function me(z){return{rules:[{type:z?"include":"exclude",all:!0}],revision:1}},P.asLocalTrack=function o(z,q){if(z instanceof q.LocalAudioTrack||z instanceof q.LocalVideoTrack||z instanceof q.LocalDataTrack)return z;if(z instanceof q.MediaStreamTrack)return"audio"===z.kind?new q.LocalAudioTrack(z,q):new q.LocalVideoTrack(z,q);throw i.INVALID_TYPE("track","LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack")},P.asLocalTrackPublication=function a(z,q,F,A){return new(0,{audio:A.LocalAudioTrackPublication,video:A.LocalVideoTrackPublication,data:A.LocalDataTrackPublication}[z.kind])(q,z,F,A)},P.capitalize=function s(z){return z[0].toUpperCase()+z.slice(1)},P.deprecateEvents=function h(z,q,F,A){var H=new Set;q.on("newListener",function oe(ce){F.has(ce)&&!H.has(ce)&&(A.deprecated(z+"#"+ce+" has been deprecated and scheduled for removal in [email protected]."+(F.get(ce)?" Use "+z+"#"+F.get(ce)+" instead.":"")),H.add(ce)),H.size>=F.size&&q.removeListener("newListener",oe)})},P.difference=function f(z,q){z=Array.isArray(z)?new Set(z):new Set(z.values()),q=Array.isArray(q)?new Set(q):new Set(q.values());var F=new Set;return z.forEach(function(A){q.has(A)||F.add(A)}),F},P.filterObject=function l(z,q){return Object.keys(z).reduce(function(F,A){return z[A]!==q&&(F[A]=z[A]),F},{})},P.flatMap=function p(z,q){var F=z instanceof Map||z instanceof Set?Array.from(z.values()):z;return q=q||function(H){return H},F.reduce(function(A,H){var oe=q(H);return A.concat(oe)},[])},P.getPlatform=function T(){var z=k(),F=y(z.match(/\(([^)]+)\)/)||[],2)[1];return y((void 0===F?"unknown":F).split(";").map(function(ce){return ce.trim()}),1)[0].toLowerCase()},P.getUserAgent=k,P.hidePrivateProperties=Q,P.hidePrivateAndCertainPublicPropertiesInClass=function Y(z,q){return function(F){function A(){for(var H=[],oe=0;oe<arguments.length;oe++)H[oe]=arguments[oe];var ce=F.apply(this,v([],y(H)))||this;return Q(ce),function K(z,q){void 0===q&&(q=[]),q.forEach(function(F){z.hasOwnProperty(F)&&W(z,F)})}(ce,q),ce}return g(A,F),A}(z)},P.isDeepEqual=function R(z,q){if(z===q)return!0;
1if(typeof z!=typeof q)return!1;if(null===z)return null===q;if(null===q)return!1;if(Array.isArray(z))return Array.isArray(q)&&z.length===q.length&&z.every(function(H,oe){return R(H,q[oe])});if("object"==typeof z){var F=Object.keys(z).sort(),A=Object.keys(q).sort();return!Array.isArray(q)&&R(F,A)&&F.every(function(H){return R(z[H],q[H])})}return!1},P.isNonArrayObject=j,P.inRange=function _e(z,q,F){return q<=z&&z<=F},P.makeUUID=function E(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(z){var q=16*Math.random()|0;return("x"===z?q:3&q|8).toString(16)})},P.oncePerTick=function S(z){var q=null;function F(){q=null,z()}return function(){q&&clearTimeout(q),q=setTimeout(F)}},P.promiseFromEvents=function m(z,q,F,A){return new Promise(function(H,oe){function ce(){var ge=[].slice.call(arguments);A&&q.removeListener(A,ne),H.apply(void 0,v([],y(ge)))}function ne(){var ge=[].slice.call(arguments);q.removeListener(F,ce),oe.apply(void 0,v([],y(ge)))}q.once(F,ce),A&&q.once(A,ne),z()})},P.getOrNull=function b(z,q){return q.split(".").reduce(function(F,A){return F?F[A]:null},z)},P.defer=function d(){var z={};return z.promise=new Promise(function(q,F){z.resolve=q,z.reject=F}),z},P.delegateMethods=function w(z,q,F){for(var A in z)_(z,q,F,A)},P.proxyProperties=function V(z,q,F){Object.getOwnPropertyNames(z).forEach(function(A){!function N(z,q,F,A){if(!(A in q)){if(A.match(/^on[a-z]+$/))return Object.defineProperty(q,A,{value:null,writable:!0}),void F.addEventListener(A.slice(2),function(){for(var H=[],oe=0;oe<arguments.length;oe++)H[oe]=arguments[oe];q.dispatchEvent.apply(q,v([],y(H)))});Object.defineProperty(q,A,{enumerable:!0,get:function(){return F[A]}})}}(0,q,F,A)})},P.legacyPromise=function x(z,q,F){return q?z.then(function(A){q(A)},function(A){F(A)}):z},P.buildLogLevels=function M(z){return"string"==typeof z?{default:z,media:z,signaling:z,webrtc:z}:z},P.trackClass=function C(z,q){return(q=q?"Local":"")+(z.kind||"").replace(/\w{1}/,function(F){return F.toUpperCase()})+"Track"},P.trackPublicationClass=function B(z,q){return(q=q?"Local":"")+(z.kind||"").replace(/\w{1}/,function(F){return F.toUpperCase()})+"TrackPublication"},P.valueToJSON=X,P.withJitter=function he(z,q){var F=Math.random();return z-q+Math.floor(2*q*F+.5)},P.isChromeScreenShareTrack=function Ee(z){return"chrome"===e.guessBrowser()&&"video"===z.kind&&"displaySurface"in z.getSettings()},P.waitForSometime=function ye(z){return void 0===z&&(z=10),new Promise(function(q){return setTimeout(q,z)})},P.waitForEvent=function Me(z,q){return new Promise(function(F){z.addEventListener(q,function A(H){z.removeEventListener(q,A),F(H)})})}},43744:function(O,P,u){var S,g=this&&this.__extends||(S=function(m,b){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,_){d.__proto__=_}||function(d,_){for(var w in _)Object.prototype.hasOwnProperty.call(_,w)&&(d[w]=_[w])})(m,b)},function(m,b){if("function"!=typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function d(){this.constructor=m}S(m,b),m.prototype=null===b?Object.create(b):(d.prototype=b.prototype,new d)}),y=this&&this.__assign||function(){return y=Object.assign||function(S){for(var m,b=1,d=arguments.length;b<d;b++)for(var _ in m=arguments[b])Object.prototype.hasOwnProperty.call(m,_)&&(S[_]=m[_]);return S},y.apply(this,arguments)},v=u(59069).EventEmitter,c=u(79739).getUserAgent,i=5,t=50,e=1e3,r=globalThis,n=r.WebSocket?r.WebSocket:u(23332),o=u(28701),a=o.hardwareDevicePublisheriPad,s=o.hardwareDevicePublisheriPhone,h=u(79739),f=u(23948),l=function(S){function m(b,d,_,w,R,j){var V=S.call(this)||this;return j=Object.assign({gateway:k(w,R)+"/v1/VideoEvents",maxReconnectAttempts:i,reconnectIntervalMs:t,userAgent:c(),WebSocket:n},j),Object.defineProperties(V,{_connectTimestamp:{value:0,writable:!0},_eventQueue:{value:[]},_readyToConnect:{value:h.defer()},_reconnectAttemptsLeft:{value:j.maxReconnectAttempts,writable:!0},_ws:{value:null,writable:!0},_WebSocket:{value:j.WebSocket}}),V._readyToConnect.promise.then(function(N){var x=N.roomSid,M=N.participantSid,C=V;V.on("disconnected",function B(Q){if(C._session=null,Q&&C._reconnectAttemptsLeft>0)return C.emit("reconnecting"),void function E(S,m,b,d,_,w,R){var j=Date.now()-S._connectTimestamp,V=R.reconnectIntervalMs-j;V>0?setTimeout(function(){p(S,m,b,d,_,w,R)},V):p(S,m,b,d,_,w,R)}(C,b,d,_,x,M,j);C.removeListener("disconnected",B)}),p(V,b,d,_,x,M,j)}).catch(function(){}),V}
1return g(m,S),m.prototype.connect=function(b,d){this._readyToConnect.resolve({roomSid:b,participantSid:d})},m.prototype._publish=function(b){b.session=this._session,this._ws.send(JSON.stringify(b))},m.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{}return this.emit("disconnected"),!0},m.prototype.publish=function(b,d,_){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:b,name:d,payload:_,timestamp:Date.now(),type:"event",version:1}),!0)},m}(v);function p(S,m,b,d,_,w,R){S._connectTimestamp=Date.now(),S._reconnectAttemptsLeft--,S._ws=new R.WebSocket(R.gateway);var j=S._ws;j.addEventListener("close",function(V){V.code!==e?S.emit("disconnected",new Error("WebSocket Error "+V.code+": "+V.reason)):S.emit("disconnected")}),j.addEventListener("message",function(V){!function T(S,m,b){switch(m.type){case"connected":S._session=m.session,S._reconnectAttemptsLeft=b.maxReconnectAttempts,S._eventQueue.splice(0).forEach(S._publish,S),S.emit("connected");break;case"error":S._ws.close(),S.emit("disconnected",new Error(m.message))}}(S,JSON.parse(V.data),R)}),j.addEventListener("open",function(){var V={type:"connect",token:m,version:1};V.publisher={name:b,sdkVersion:d,userAgent:R.userAgent,participantSid:w,roomSid:_},f.isIpad()?V.publisher=y(y({},V.publisher),a):f.isIphone()&&(V.publisher=y(y({},V.publisher),s)),j.send(JSON.stringify(V))})}function k(S,m){return"prod"===S?"wss://sdkgw."+m+".twilio.com":"wss://sdkgw."+S+"-"+m+".twilio.com"}O.exports=l},74920:O=>{var P=function(){function u(){Object.defineProperties(this,{_connected:{writable:!0,value:!0}})}return u.prototype.connect=function(){},u.prototype.disconnect=function(){return!!this._connected&&(this._connected=!1,!0)},u.prototype.publish=function(){return this._connected},u}();O.exports=P},16396:(O,P,u)=>{var g=u(79739).defer,y=function(){function v(){Object.defineProperties(this,{_audio:{value:g(),writable:!0},_video:{value:g(),writable:!0}}),this._audio.resolve(),this._video.resolve()}return v.prototype.resolveDeferred=function(c){"audio"===c?this._audio.resolve():this._video.resolve()},v.prototype.startDeferred=function(c){"audio"===c?this._audio=g():this._video=g()},v.prototype.whenResolved=function(c){return"audio"===c?this._audio.promise:this._video.promise},v}();O.exports=new y},61458:function(O,P,u){var r,g=this&&this.__read||function(p,k){var T="function"==typeof Symbol&&p[Symbol.iterator];if(!T)return p;var S,b,E=T.call(p),m=[];try{for(;(void 0===k||k-- >0)&&!(S=E.next()).done;)m.push(S.value)}catch(d){b={error:d}}finally{try{S&&!S.done&&(T=E.return)&&T.call(E)}finally{if(b)throw b.error}}return m},y=this&&this.__spreadArray||function(p,k){for(var T=0,E=k.length,S=p.length;T<E;T++,S++)p[S]=k[T];return p},v=u(7846).getLogger,c=u(28701),i=c.DEFAULT_LOG_LEVEL,t=c.DEFAULT_LOGGER_NAME,e=u(28701).typeErrors,o=function(){function p(k,T,E,S,m){if("string"!=typeof k)throw e.INVALID_TYPE("moduleName","string");if(!T)throw e.REQUIRED_ARGUMENT("component");"object"!=typeof E&&(E={}),m=m||v,l(E),Object.defineProperties(this,{_component:{value:T},_logLevels:{value:E},_warnings:{value:new Set},_loggerName:{get:function(){var d=S&&"string"==typeof S?S:t;return this._logLevelsEqual||(d=d+"-"+k),d}},_logger:{get:function(){var d=m(this._loggerName),_=this._logLevels[k]||i;return d.setDefaultLevel(_="off"===_?"silent":_),d}},_logLevelsEqual:{get:function(){return 1===new Set(Object.values(this._logLevels)).size}},logLevel:{get:function(){return p.getLevelByName(E[k]||i)}},name:{get:T.toString.bind(T)}})}return p.getLevelByName=function(k){return isNaN(k)?(f(k=k.toUpperCase()),p[k]):parseInt(k,10)},p.prototype.createLog=function(k,T){var E=this._loggerName;return this._logLevelsEqual||(E=E.substring(0,E.lastIndexOf("-"))),new p(k,T,this._logLevels,E)},p.prototype.setLevels=function(k){return l(k),Object.assign(this._logLevels,k),this},p.prototype.log=function(k,T){var E=p._levels[k];if(!E)throw e.INVALID_VALUE("logLevel",s);E=E.toLowerCase();var S=[(new Date).toISOString(),E,this.name];return(this._logger[E]||function(){}).apply(void 0,y([],g(S.concat(T)))),this},p.prototype.debug=function(){return this.log(p.DEBUG,[].slice.call(arguments))},p.prototype.deprecated=function(k){var T=function n(p){if((r=r||new Map).has(p))return r.get(p);var k=new Set;return r.set(p,k),k}(this._component.constructor);return T.has(k)?this:(T.add(k),this.warn(k))},p.prototype.info=function(){return this.log(p.INFO,[].slice.call(arguments))},p.prototype.warn=function(){return this.log(p.WARN,[].slice.call(arguments))},p.prototype.warnOnce=function(k){return this._warnings.has(k)?this:(this._warnings.add(k),this.warn(k))},p.prototype.error=function(){return this.log(p.ERROR,[].slice.call(arguments))},p.prototype.throw=function(k,T){throw k.clone&&(k=k.clone(T)),this.log(p.ERROR,k),k},p}();Object.defineProperties(o,{DEBUG:{value:0},INFO:{value:1},WARN:{value:2},ERROR:{value:3},OFF:{value:4},_levels:{value:["DEBUG","INFO","WARN","ERROR","OFF"]}});var a={},s=[],h=o._levels.map(function(p,k){return a[p]=!0,s.push(k),p});function f(p){if(!(p in a))throw e.INVALID_VALUE("level",h)}
1function l(p){Object.keys(p).forEach(function(k){f(p[k].toUpperCase())})}O.exports=o},78218:O=>{var P=function(){function u(){Object.defineProperties(this,{_samples:{value:[{denominator:0,numerator:0},{denominator:0,numerator:0}]}})}return u.prototype.get=function(){var g=this._samples;return(g[1].numerator-g[0].numerator)/(g[1].denominator-g[0].denominator||1/0)},u.prototype.putSample=function(g,y){var v=this._samples;v.shift(),v.push({denominator:y,numerator:g})},u}();O.exports=P},12643:O=>{var P=function(){function u(g,y){var v=this,c=(y=Object.assign({navigator,window},y)).navigator,i=c.connection||{type:null},t=i.type,e=i.type?{_events:{value:["change","typechange"]},_listener:{value:function(){var a=t!==v.type&&v.isOnline;t=v.type,a&&g()}},_target:{value:i}}:{_events:{value:["online"]},_listener:{value:g},_target:{value:y.window}};Object.defineProperties(this,{isOnline:{enumerable:!0,get:function(){return"boolean"!=typeof c.onLine||c.onLine}},type:{enumerable:!0,get:function(){return i.type||null}},_listener:e._listener,_events:e._events,_target:e._target})}return u.prototype.start=function(){var g=this;this._events.forEach(function(y){g._target.addEventListener(y,g._listener)})},u.prototype.stop=function(){var g=this;this._events.forEach(function(y){g._target.removeEventListener(y,g._listener)})},u}();O.exports=P},35318:function(O){var v,P=this&&this.__extends||(v=function(c,i){return(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(c,i)},function(c,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=c}v(c,i),c.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t)}),u=function(){function v(c){Object.defineProperties(this,{_callback:{value:c}})}return v.prototype.observe=function(){},v.prototype.unobserve=function(){},v.prototype.makeVisible=function(c){var i=this._makeFakeEntry(c,!0);this._callback([i])},v.prototype.makeInvisible=function(c){var i=this._makeFakeEntry(c,!1);this._callback([i])},v.prototype._makeFakeEntry=function(c,i){return{target:c,isIntersecting:i}},v}(),g=function(v){function c(){return null!==v&&v.apply(this,arguments)||this}return P(c,v),c}(u),y=function(v){function c(){return null!==v&&v.apply(this,arguments)||this}return P(c,v),c.prototype.resize=function(i){var t=this._makeFakeEntry(i,!0);this._callback([t])},c}(u);O.exports={NullIntersectionObserver:g,NullResizeObserver:y,NullObserver:u}},13898:function(O,P,u){var g=this&&this.__read||function(V,N){var x="function"==typeof Symbol&&V[Symbol.iterator];if(!x)return V;var C,Q,M=x.call(V),B=[];try{for(;(void 0===N||N-- >0)&&!(C=M.next()).done;)B.push(C.value)}catch(Y){Q={error:Y}}finally{try{C&&!C.done&&(x=M.return)&&x.call(M)}finally{if(Q)throw Q.error}}return B},y=u(79739),v=y.difference,c=y.flatMap,i=u(50570),t={0:"PCMU",8:"PCMA"};function e(V){return Array.from(n(V)).reduce(function(N,x){var M=x[0],C=x[1],B=N.get(C)||[];return N.set(C,B.concat(M))},new Map)}function r(V){return s(V).reduce(function(N,x){var M=a(x);return M?N.set(M,x):N},new Map)}function n(V){return h(V).reduce(function(N,x){var M=new RegExp("a=rtpmap:"+x+" ([^/]+)"),C=V.match(M),B=C?C[1].toLowerCase():t[x]?t[x].toLowerCase():"";return N.set(x,B)},new Map)}function o(V,N){var x=new RegExp("^a=fmtp:"+V+" (.+)$","m"),M=N.match(x);return M&&M[1].split(";").reduce(function(C,B){var Q=g(B.split("="),2),W=Q[1];return C[Q[0]]=isNaN(W)?W:parseInt(W,10),C},{})}function a(V){var N=V.match(/^a=mid:(.+)$/m);return N&&N[1]}function s(V,N,x){return V.replace(/\r\n\r\n$/,"\r\n").split("\r\nm=").slice(1).map(function(M){return"m="+M}).filter(function(M){var C=new RegExp("m="+(N||".*"),"gm"),B=new RegExp("a="+(x||".*"),"gm");return C.test(M)&&B.test(M)})}function h(V){var x=V.split("\r\n")[0].match(/([0-9]+)/g);return x?x.slice(1).map(function(M){return parseInt(M,10)}):[]}function l(V,N){var x=N.split("\r\n"),M=x[0],C=x.slice(1);return[M=M.replace(/([0-9]+\s?)+$/,V.join(" "))].concat(C).join("\r\n")}function d(V,N){var x=s(V);return[V.split("\r\nm=")[0]].concat(x.map(function(C){if(!/^m=(audio|video)/.test(C))return C;var B=a(C);if(!B)return C;var Q=N.get(B);if(!Q)return C;var Y=(C.match(/^a=msid:(.+)$/m)||[])[1];if(!Y)return C;var W=g(Y.split(" "),2),K=W[0],D=W[1],L=new RegExp("msid:"+K+(D?" "+D:"")+"$","gm");return C.replace(L,"msid:"+K+" "+Q)})).join("\r\n")}function R(V,N){return"a=fmtp:"+V+" "+Object.entries(N).map(function(M){var C=g(M,2);return C[0]+"="+C[1]}).join(";")}P.addOrRewriteNewTrackIds=function b(V,N,x){var M=Array.from(x).reduce(function(C,B){var Q=g(B,2),W=Q[1];return s(V,Q[0],"send(only|recv)").map(a).filter(function(L){return!N.has(L)}
1).forEach(function(L,I){return C.set(L,W[I])}),C},new Map);return d(V,M)},P.addOrRewriteTrackIds=d,P.createCodecMapForMediaSection=e,P.createPtToCodecName=n,P.disableRtx=function w(V){var N=s(V);return[V.split("\r\nm=")[0]].concat(N.map(function(M){if(!/^m=video/.test(M))return M;var B=e(M).get("rtx");if(!B)return M;var Q=new Set(h(M));B.forEach(function(D){return Q.delete(D)});var Y=M.match(/a=ssrc-group:FID [0-9]+ ([0-9]+)/),W=Y&&Y[1],K=[/^a=fmtp:.+ apt=.+$/,/^a=rtpmap:.+ rtx\/.+$/,/^a=ssrc-group:.+$/].concat(W?[new RegExp("^a=ssrc:"+W+" .+$")]:[]);return M=M.split("\r\n").filter(function(D){return K.every(function(L){return!L.test(D)})}).join("\r\n"),l(Array.from(Q),M)})).join("\r\n")},P.enableDtxForOpus=function j(V,N){var x=s(V),M=V.split("\r\nm=")[0];return N=N||x.filter(function(C){return/^m=audio/.test(C)}).map(a),[M].concat(x.map(function(C){if(!/^m=audio/.test(C))return C;var Q=e(C).get("opus");if(!Q)return C;var Y=o(Q,C);if(!Y)return C;var W=R(Q,Y),K=new RegExp(W),D=a(C);N.includes(D)?Y.usedtx=1:delete Y.usedtx;var L=R(Q,Y);return C.replace(K,L)})).join("\r\n")},P.filterLocalCodecs=function S(V,N){var x=s(V),M=V.split("\r\nm=")[0],C=r(N);return[M].concat(x.map(function(B){return function E(V,N,x){if(!/^m=(audio|video)/.test(V))return V;var M=a(V),C=M&&N.get(M);if(!C)return V;var B=n(C),Q=e(V),Y=c(Array.from(B),function(L){var I=g(L,2),G=I[0],X=I[1];return"rtx"===X||x.includes(X)?[]:function T(V,N,x,M,C){var B=x.get(V)||[];if(B.length<=1)return B;var Q=o(N,C);if(!Q)return B;var Y=B.find(function(W){var K=o(W,M);return K&&Object.keys(Q).every(function(D){return Q[D]===K[D]})});return"number"==typeof Y?[Y]:B}(X,G,Q,V,C)}),W=Q.get("rtx")||[];Y=Y.concat(W.filter(function(L){var I=o(L,V);return I&&Y.includes(I.apt)}));var K=V.split("\r\n").filter(function(L){var I=L.match(/^a=(rtpmap|fmtp|rtcp-fb):(.+) .+$/),G=I&&I[2];return!I||G&&Y.includes(parseInt(G,10))});return l(h(V).filter(function(L){return Y.includes(L)}),K.join("\r\n"))}(B,C,[])})).join("\r\n")},P.getMediaSections=s,P.removeSSRCAttributes=function _(V,N){return V.split("\r\n").filter(function(x){return!N.find(function(M){return new RegExp("a=ssrc:.*"+M+":","g").test(x)})}).join("\r\n")},P.revertSimulcast=function m(V,N,x,M){void 0===M&&(M=!1);var C=r(x),B=r(N),Q=s(V);return[V.split("\r\nm=")[0]].concat(Q.map(function(W){if(W=W.replace(/\r\n$/,""),!/^m=video/.test(W))return W;var K=W.match(/^a=mid:(.+)$/m),D=K&&K[1];if(!D)return W;var L=C.get(D),I=n(L),G=h(L),X=G.length&&"vp8"===I.get(G[0]);return M||!X?B.get(D).replace(/\r\n$/,""):W})).concat("").join("\r\n")},P.setCodecPreferences=function p(V,N,x){var M=s(V);return[V.split("\r\nm=")[0]].concat(M.map(function(B){if(!/^m=(audio|video)/.test(B))return B;var Q=B.match(/^m=(audio|video)/)[1],Y=e(B),K=function f(V,N){N=N.map(function(B){return B.codec.toLowerCase()});var x=c(N,function(B){return V.get(B)||[]}),M=v(Array.from(V.keys()),N),C=c(M,function(B){return V.get(B)});return x.concat(C)}(Y,"audio"===Q?N:x),D=l(K,B),L=Y.get("pcma")||[],I=Y.get("pcmu")||[];return("audio"===Q?new Set(L.concat(I)):new Set).has(K[0])?D.replace(/\r\nb=(AS|TIAS):([0-9]+)/g,""):D})).join("\r\n")},P.setSimulcast=function k(V,N){var x=s(V);return[V.split("\r\nm=")[0]].concat(x.map(function(C){if(C=C.replace(/\r\n$/,""),!/^m=video/.test(C))return C;var B=e(C),Q=h(C),Y=new Set(B.get("vp8")||[]);return Q.some(function(K){return Y.has(K)})?i(C,N):C})).concat("").join("\r\n")}},33073:(O,P,u)=>{var g=u(41647).RTCSessionDescription,y=u(13898),v=y.createPtToCodecName,c=y.getMediaSections;function e(l){var p=v(l);l=function r(l,p){return Array.from(p.keys()).reduce(function(k,T){var E=new RegExp("^a=rtpmap:"+T+" rtx.+$","gm");return(k.match(E)||[]).slice("rtx"===p.get(T)?1:0).reduce(function(S,m){var b=new RegExp("\r\n"+m),d=new RegExp("\r\na=fmtp:"+T+" apt=[0-9]+");return S.replace(b,"").replace(d,"")},k)},l)}(l,p);var k=function n(l){var p=new Map;return l.forEach(function(k,T){var E=p.get(k)||new Set;return p.set(k,E.add(T))}),p}(p),T=k.get("rtx")||new Set,E=new Set,S=function o(l,p,k,T){return Array.from(k).reduce(function(E,S){var m=new RegExp("a=fmtp:"+S+" apt=(\\d+)"),b=l.match(m);if(!b)return T.add(S),E;var d=Number.parseInt(b[1]);return p.has(d)?"rtx"===p.get(d)?(T.add(S),E):E.set(S,d):(T.add(S),E)},new Map)}(l,p,T,E),m=function a(l,p){var k=Array.from(l).reduce(function(T,E){var S=E[0],m=E[1],b=T.get(m)||new Set;
1return T.set(m,b.add(S))},new Map);return Array.from(k).reduce(function(T,E){var S=E[0],m=Array.from(E[1]);return m.length>1?(m.forEach(function(b){p.add(b)}),T):T.set(S,m[0])},new Map)}(S,E),b=Array.from(E);return["h264","vp8","vp9"].reduce(function(w,R){var j=k.get(R)||new Set;return Array.from(j).reduce(function(V,N){return m.has(N)?V:V.add(N)},w)},new Set).forEach(function(w){if(b.length){var R=b.shift();l=function f(l,p,k){return l.endsWith("\r\n")?l+"a=fmtp:"+p+" apt="+k+"\r\n":l+"\r\na=fmtp:"+p+" apt="+k}(l=s(l,R),R,w)}}),b.forEach(function(w){l=function h(l,p){var k=new RegExp("a=rtpmap:"+p+".*\r\n","gm");return l.replace(k,"")}(l=s(l,w),w)}),l}function s(l,p){var k=new RegExp("a=fmtp:"+p+".*\r\n","gm");return l.replace(k,"")}O.exports=function i(l){var p={type:l.type};return"rollback"!==l.type&&(p.sdp=function t(l){var p=c(l);return[l.split("\r\nm=")[0]].concat(p.map(e)).join("\r\n")}(l.sdp)),new g(p)}},50570:function(O,P,u){var g=this&&this.__read||function(f,l){var p="function"==typeof Symbol&&f[Symbol.iterator];if(!p)return f;var T,S,k=p.call(f),E=[];try{for(;(void 0===l||l-- >0)&&!(T=k.next()).done;)E.push(T.value)}catch(m){S={error:m}}finally{try{T&&!T.done&&(p=k.return)&&p.call(k)}finally{if(S)throw S.error}}return E},y=u(79739),v=y.difference,c=y.flatMap;function i(){return String(Math.floor(4294967295*Math.random()))}var t=function(){function f(l,p,k){Object.defineProperties(this,{cName:{enumerable:!0,value:k},isSimulcastEnabled:{enumerable:!0,value:!1,writable:!0},primarySSRCs:{enumerable:!0,value:new Set},rtxPairs:{enumerable:!0,value:new Map},streamId:{enumerable:!0,value:p},trackId:{enumerable:!0,value:l}})}return f.prototype.addSimulcastSSRCs=function(){if(!this.isSimulcastEnabled){var l=[i(),i()];l.forEach(function(p){this.primarySSRCs.add(p)},this),this.rtxPairs.size&&l.forEach(function(p){this.rtxPairs.set(i(),p)},this)}},f.prototype.addSSRC=function(l,p,k){p?this.rtxPairs.set(l,p):this.primarySSRCs.add(l),this.isSimulcastEnabled=this.isSimulcastEnabled||k},f.prototype.toSdpLines=function(l){var p=this,k=l?[]:Array.from(this.rtxPairs.entries()).map(function(d){return d.reverse()}),T=Array.from(this.primarySSRCs.values()),E=k.length?c(k):T,S=c(E,function(d){return["a=ssrc:"+d+" cname:"+p.cName,"a=ssrc:"+d+" msid:"+p.streamId+" "+p.trackId]}),m=k.map(function(d){return"a=ssrc-group:FID "+d.join(" ")}),b=["a=ssrc-group:SIM "+T.join(" ")];return m.concat(S).concat(b)},f}();function e(f,l){return(f.match(new RegExp(l,"gm"))||[]).map(function(k){return(k.match(new RegExp(l))||[]).slice(1)})}O.exports=function h(f,l){var p=function s(f){var l=function r(f){return new Set(c(e(f,"^a=ssrc-group:SIM ([0-9]+) ([0-9]+) ([0-9]+)$")))}(f),p=function o(f){return new Map(e(f,"^a=ssrc-group:FID ([0-9]+) ([0-9]+)$").map(function(p){return p.reverse()}))}(f),k=function a(f){var l=g(c(e(f,"^a=msid:(.+) (.+)$")),2),p=l[0],k=l[1];return c(e(f,"^a=ssrc:(.+) cname:.+$")).map(function(E){return[E,p,k]})}(f);return k.reduce(function(T,E){var S=E[0],m=E[1],b=E[2],d=T.get(b)||new t(b,m,function n(f,l,p){return f.match(new RegExp("a=ssrc:"+l+" "+p+":(.+)"))[1]}(f,S,"cname")),_=p.get(S)||null;return d.addSSRC(S,_,l.has(S)),T.set(b,d)},new Map)}(f),k=Array.from(p.keys()),T=Array.from(l.keys()),E=v(k,T),S=v(T,k);c(E,function(V){return p.get(V)}).forEach(function(V){V.addSimulcastSSRCs(),l.set(V.trackId,V)}),T=Array.from(l.keys());var b=v(T,S),d=c(b,function(V){return l.get(V)}),_=!f.match(/a=rtpmap:[0-9]+ rtx/),w=c(d,function(V){return V.toSdpLines(_)}),R=c(new Set(f.split("\r\n").concat(w))),j="a=x-google-flag:conference";return f.match(j)||R.push(j),R.join("\r\n")}},41057:(O,P,u)=>{var g=u(13898).getMediaSections,y=function(){function v(){Object.defineProperties(this,{_midsToTrackIds:{value:new Map,writable:!0}})}return v.prototype.match=function(c){return this._midsToTrackIds.get(c.transceiver.mid)||null},v.prototype.update=function(c){var i=g(c,"(audio|video)");this._midsToTrackIds=i.reduce(function(t,e){var r=e.match(/^a=mid:(.+)$/m)||[],n=e.match(/^a=msid:.+ (.+)$/m)||[],o=r[1],a=n[1];return o&&a?t.set(o,a):t},this._midsToTrackIds)},v}();
1O.exports=y},48066:(O,P)=>{var u="1234567890abcdef",g=32;function y(v){for(var c="",i=0;i<g;i++)c+=u.charAt(Math.floor(Math.random()*u.length));return""+v+c}P.sessionSID=y("SS"),P.createSID=y},35341:(O,P,u)=>{var g=u(77627),y=g.guessBrowser,v=g.support,c=u(13236).getSdpFormat,i=u(23948),t=i.isAndroid,e=i.isMobile,r=i.isNonChromiumEdge,n=i.rebrandedChromeBrowser,o=i.mobileWebKitBrowser,a=["crios","edg","edge","electron","headlesschrome"],s=["chrome","firefox"],h=["chrome","safari"],f=[];O.exports=function l(){var p=y();if(!p)return!1;var k=n(p),T=o(p),E=t()?s:h;return!!p&&v()&&"unified"===c()&&(!k||a.includes(k))&&!r(p)&&(!T||f.includes(T))&&(!e()||E.includes(p))}},66543:O=>{var P=function(){function u(g,y,v){void 0===v&&(v=!0),Object.defineProperties(this,{_delay:{value:y,writable:!0},_fn:{value:g},_timeout:{value:null,writable:!0}}),v&&this.start()}return Object.defineProperty(u.prototype,"delay",{get:function(){return this._delay},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isSet",{get:function(){return!!this._timeout},enumerable:!1,configurable:!0}),u.prototype.setDelay=function(g){this._delay=g},u.prototype.start=function(){var g=this;this.isSet||(this._timeout=setTimeout(function(){var y=g._fn;g.clear(),y()},this._delay))},u.prototype.clear=function(){clearTimeout(this._timeout),this._timeout=null},u.prototype.reset=function(){this.clear(),this.start()},u}();O.exports=P},8380:function(O,P,u){var F,g=this&&this.__extends||(F=function(A,H){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(oe,ce){oe.__proto__=ce}||function(oe,ce){for(var ne in ce)Object.prototype.hasOwnProperty.call(ce,ne)&&(oe[ne]=ce[ne])})(A,H)},function(A,H){if("function"!=typeof H&&null!==H)throw new TypeError("Class extends value "+String(H)+" is not a constructor or null");function oe(){this.constructor=A}F(A,H),A.prototype=null===H?Object.create(H):(oe.prototype=H.prototype,new oe)}),y=u(19318),v={};P.createTwilioError=function(A,H){return H="string"==typeof H&&H?H:"Unknown error",v[A="number"==typeof A?A:0]?new v[A]:new y(A,H)};var c=function(F){function A(){var H=F.call(this,20101,"Invalid Access Token")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenInvalidError=c,Object.defineProperty(v,20101,{value:c});var i=function(F){function A(){var H=F.call(this,20102,"Invalid Access Token header")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenHeaderInvalidError=i,Object.defineProperty(v,20102,{value:i});var t=function(F){function A(){var H=F.call(this,20103,"Invalid Access Token issuer/subject")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenIssuerInvalidError=t,Object.defineProperty(v,20103,{value:t});var e=function(F){function A(){var H=F.call(this,20104,"Access Token expired or expiration date invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenExpiredError=e,Object.defineProperty(v,20104,{value:e});var r=function(F){function A(){var H=F.call(this,20105,"Access Token not yet valid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenNotYetValidError=r,Object.defineProperty(v,20105,{value:r});var n=function(F){function A(){var H=F.call(this,20106,"Invalid Access Token grants")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenGrantsInvalidError=n,Object.defineProperty(v,20106,{value:n});var o=function(F){function A(){var H=F.call(this,20107,"Invalid Access Token signature")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.AccessTokenSignatureInvalidError=o,Object.defineProperty(v,20107,{value:o});var a=function(F){function A(){var H=F.call(this,53e3,"Signaling connection error")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.SignalingConnectionError=a,Object.defineProperty(v,53e3,{value:a});var s=function(F){function A(){var H=F.call(this,53001,"Signaling connection disconnected")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.SignalingConnectionDisconnectedError=s,Object.defineProperty(v,53001,{value:s});var h=function(F){function A(){var H=F.call(this,53002,"Signaling connection timed out")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.SignalingConnectionTimeoutError=h,Object.defineProperty(v,53002,{value:h});var f=function(F){function A(){var H=F.call(this,53003,"Client received an invali
1d signaling message")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.SignalingIncomingMessageInvalidError=f,Object.defineProperty(v,53003,{value:f});var l=function(F){function A(){var H=F.call(this,53004,"Client sent an invalid signaling message")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.SignalingOutgoingMessageInvalidError=l,Object.defineProperty(v,53004,{value:l});var p=function(F){function A(){var H=F.call(this,53006,"Video server is busy")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.SignalingServerBusyError=p,Object.defineProperty(v,53006,{value:p});var k=function(F){function A(){var H=F.call(this,53100,"Room name is invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomNameInvalidError=k,Object.defineProperty(v,53100,{value:k});var T=function(F){function A(){var H=F.call(this,53101,"Room name is too long")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomNameTooLongError=T,Object.defineProperty(v,53101,{value:T});var E=function(F){function A(){var H=F.call(this,53102,"Room name contains invalid characters")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomNameCharsInvalidError=E,Object.defineProperty(v,53102,{value:E});var S=function(F){function A(){var H=F.call(this,53103,"Unable to create Room")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomCreateFailedError=S,Object.defineProperty(v,53103,{value:S});var m=function(F){function A(){var H=F.call(this,53104,"Unable to connect to Room")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomConnectFailedError=m,Object.defineProperty(v,53104,{value:m});var b=function(F){function A(){var H=F.call(this,53105,"Room contains too many Participants")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomMaxParticipantsExceededError=b,Object.defineProperty(v,53105,{value:b});var d=function(F){function A(){var H=F.call(this,53106,"Room not found")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomNotFoundError=d,Object.defineProperty(v,53106,{value:d});var _=function(F){function A(){var H=F.call(this,53107,"MaxParticipants is out of range")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomMaxParticipantsOutOfRangeError=_,Object.defineProperty(v,53107,{value:_});var w=function(F){function A(){var H=F.call(this,53108,"RoomType is not valid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomTypeInvalidError=w,Object.defineProperty(v,53108,{value:w});var R=function(F){function A(){var H=F.call(this,53109,"Timeout is out of range")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomTimeoutOutOfRangeError=R,Object.defineProperty(v,53109,{value:R});var j=function(F){function A(){var H=F.call(this,53110,"StatusCallbackMethod is invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomStatusCallbackMethodInvalidError=j,Object.defineProperty(v,53110,{value:j});var V=function(F){function A(){var H=F.call(this,53111,"StatusCallback is invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomStatusCallbackInvalidError=V,Object.defineProperty(v,53111,{value:V});var N=function(F){function A(){var H=F.call(this,53112,"Status is invali
1d")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomStatusInvalidError=N,Object.defineProperty(v,53112,{value:N});var x=function(F){function A(){var H=F.call(this,53113,"Room exists")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomRoomExistsError=x,Object.defineProperty(v,53113,{value:x});var M=function(F){function A(){var H=F.call(this,53114,"Room creation parameter(s) incompatible with the Room type")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomInvalidParametersError=M,Object.defineProperty(v,53114,{value:M});var C=function(F){function A(){var H=F.call(this,53115,"MediaRegion is invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomMediaRegionInvalidError=C,Object.defineProperty(v,53115,{value:C});var B=function(F){function A(){var H=F.call(this,53116,"There are no media servers available in the MediaRegion")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomMediaRegionUnavailableError=B,Object.defineProperty(v,53116,{value:B});var Q=function(F){function A(){var H=F.call(this,53117,"The subscription operation requested is not supported for the Room type")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomSubscriptionOperationNotSupportedError=Q,Object.defineProperty(v,53117,{value:Q});var Y=function(F){function A(){var H=F.call(this,53118,"Room completed")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomCompletedError=Y,Object.defineProperty(v,53118,{value:Y});var W=function(F){function A(){var H=F.call(this,53124,"The AudioOnly flag is not supported for the Room type")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomAudioOnlyFlagNotSupportedError=W,Object.defineProperty(v,53124,{value:W});var K=function(F){function A(){var H=F.call(this,53125,"The track kind is not supported by the Room")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.RoomTrackKindNotSupportedError=K,Object.defineProperty(v,53125,{value:K});var D=function(F){function A(){var H=F.call(this,53200,"Participant identity is invali
1d")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ParticipantIdentityInvalidError=D,Object.defineProperty(v,53200,{value:D});var L=function(F){function A(){var H=F.call(this,53201,"Participant identity is too long")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ParticipantIdentityTooLongError=L,Object.defineProperty(v,53201,{value:L});var I=function(F){function A(){var H=F.call(this,53202,"Participant identity contains invalid characters")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ParticipantIdentityCharsInvalidError=I,Object.defineProperty(v,53202,{value:I});var G=function(F){function A(){var H=F.call(this,53203,"The maximum number of published tracks allowed in the Room at the same time has been reached")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ParticipantMaxTracksExceededError=G,Object.defineProperty(v,53203,{value:G});var X=function(F){function A(){var H=F.call(this,53204,"Participant not found")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ParticipantNotFoundError=X,Object.defineProperty(v,53204,{value:X});var Z=function(F){function A(){var H=F.call(this,53205,"Participant disconnected because of duplicate identity")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ParticipantDuplicateIdentityError=Z,Object.defineProperty(v,53205,{value:Z});var $=function(F){function A(){var H=F.call(this,53300,"Track is invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.TrackInvalidError=$,Object.defineProperty(v,53300,{value:$});var ee=function(F){function A(){var H=F.call(this,53301,"Track name is invalid")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.TrackNameInvalidError=ee,Object.defineProperty(v,53301,{value:ee});var se=function(F){function A(){var H=F.call(this,53302,"Track name is too long")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.TrackNameTooLongError=se,Object.defineProperty(v,53302,{value:se});var fe=function(F){function A(){var H=F.call(this,53303,"Track name contains invalid characters")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.TrackNameCharsInvalidError=fe,Object.defineProperty(v,53303,{value:fe});var le=function(F){function A(){var H=F.call(this,53304,"Track name is duplicated")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.TrackNameIsDuplicatedError=le,Object.defineProperty(v,53304,{value:le});var de=function(F){function A(){var H=F.call(this,53305,"The server has reached capacity and cannot fulfill this request")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.TrackServerTrackCapacityReachedError=de,Object.defineProperty(v,53305,{value:de});var me=function(F){function A(){var H=F.call(this,53400,"Client is unable to create or apply a local media description")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaClientLocalDescFailedError=me,Object.defineProperty(v,53400,{value:me});var ve=function(F){function A(){var H=F.call(this,53401,"Server is unable to create or apply a local media description")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaServerLocalDescFailedError=ve,Object.defineProperty(v,53401,{value:ve});var he=function(F){function A(){var H=F.call(this,53402,"Client is unable to apply a remote media description")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaClientRemoteDescFailedError=he,Object.defineProperty(v,53402,{value:he});var _e=function(F){function A(){var H=F.call(this,53403,"Server is unable to apply a remote media description")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaServerRemoteDescFailedError=_e,Object.defineProperty(v,53403,{value:_e});var Ee=function(F){function A(){var H=F.call(this,53404,"No supported codec")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaNoSupportedCodecError=Ee,Object.defineProperty(v,53404,{value:Ee});var ye=function(F){function A(){var H=F.call(this,53405,"Media connection failed or Media activity ceased")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaConnectionError=ye,Object.defineProperty(v,53405,{value:ye});var Me=function(F){function A(){var H=F.call(this,53407,"Media connection failed due to DTLS handshake failure")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.MediaDTLSTransportFailedError=Me,Object.defineProperty(v,53407,{value:Me});var z=function(F){function A(){var H=F.call(this,53500,"Unable to acquire configuration")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ConfigurationAcquireFailedError=z,Object.defineProperty(v,53500,{value:z});var q=function(F){function A(){var H=F.call(this,53501,"Unable to acquire TURN credentials")||this;return Object.setPrototypeOf(H,A.prototype),H}return g(A,F),A}(y);P.ConfigurationAcquireTurnFailedError=q,Object.defineProperty(v,53501,{value:q})},19318:function(O){var v,P=this&&this.__extends||(v=function(c,i){return(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(c,i)},function(c,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=c}v(c,i),c.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t)}),u=this&&this.__read||function(v,c){var i="function"==typeof Symbol&&v[Symbol.iterator];if(!i)return v;var e,n,t=i.call(v),r=[];try{for(;(void 0===c||c-- >
10)&&!(e=t.next()).done;)r.push(e.value)}catch(o){n={error:o}}finally{try{e&&!e.done&&(i=t.return)&&i.call(t)}finally{if(n)throw n.error}}return r},g=this&&this.__spreadArray||function(v,c){for(var i=0,t=c.length,e=v.length;i<t;i++,e++)v[e]=c[i];return v},y=function(v){function c(i){var t,e=[].slice.call(arguments,1);t=v.apply(this,g([],u(e)))||this,Object.setPrototypeOf(t,c.prototype);var r=Error.apply(t,e);return r.name="TwilioError",Object.defineProperty(t,"code",{value:i,enumerable:!0}),Object.getOwnPropertyNames(r).forEach(function(n){Object.defineProperty(this,n,{value:r[n],enumerable:!0})},t),t}return P(c,v),c.prototype.toString=function(){return this.name+" "+this.code+(this.message?": "+this.message:"")},c}(Error);O.exports=y},62585:O=>{O.exports={recordingMediaLost:"recording-media-lost"}},81501:(O,P,u)=>{var y=u(79739).isNonArrayObject,v=u(28701),c=v.typeErrors,i=v.clientTrackSwitchOffControl,t=v.videoContentPreferencesMode,e=v.subscriptionMode,r=v.trackPriority,n=v.trackSwitchOffMode;function s(f,l,p){return void 0===p&&(p=[]),typeof f>"u"?null:null!==f&&y(f)?p.reduce(function(k,T){var E=T.prop,S=T.type,m=T.values;if(k||!(E in f))return k;var b=f[E];return S&&typeof b!==S||"number"===S&&isNaN(b)?c.INVALID_TYPE(l+"."+E,S):Array.isArray(m)&&!m.includes(b)?c.INVALID_VALUE(l+"."+E,m):k},null):c.INVALID_TYPE(l,"object")}P.kG=function o(f){var l=s(f,"options.bandwidthProfile");return!f||l||(l=s(f.video,"options.bandwidthProfile.video",[{prop:"contentPreferencesMode",values:Object.values(t)},{prop:"dominantSpeakerPriority",values:Object.values(r)},{prop:"maxSubscriptionBitrate",type:"number"},{prop:"maxTracks",type:"number"},{prop:"mode",values:Object.values(e)},{prop:"clientTrackSwitchOffControl",values:Object.values(i)},{prop:"trackSwitchOffMode",values:Object.values(n)}]))?l:f.video?"maxTracks"in f.video&&"clientTrackSwitchOffControl"in f.video?new TypeError("options.bandwidthProfile.video.maxTracks is deprecated. Use options.bandwidthProfile.video.clientTrackSwitchOffControl instead."):"renderDimensions"in f.video&&"contentPreferencesMode"in f.video?new TypeError("options.bandwidthProfile.video.renderDimensions is deprecated. Use options.bandwidthProfile.video.contentPreferencesMode instead."):function h(f){var l="options.bandwidthProfile.video.renderDimensions",p=s(f,l);return f?p||Object.values(r).reduce(function(k,T){return k||s(f[T],l+"."+T,[{prop:"height",type:"number"},{prop:"width",type:"number"}])},null):p}(f.video.renderDimensions):null},P.Wv=function a(f,l){if(!(f instanceof l.LocalAudioTrack||f instanceof l.LocalDataTrack||f instanceof l.LocalVideoTrack||f instanceof l.MediaStreamTrack))throw c.INVALID_TYPE("track","LocalAudioTrack, LocalVideoTrack, LocalDataTrack, or MediaStreamTrack")}},41905:O=>{O.exports=function(u,g){if(u&&g)if(u.super_=g,"function"==typeof Object.create)u.prototype=Object.create(g.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}});else{var y=function v(){};y.prototype=g.prototype,u.prototype=new y,u.prototype.constructor=u}}},7846:O=>{var P=function(){},u="undefined",g=typeof window!==u&&typeof window.navigator!==u&&/Trident\/|MSIE /.test(window.navigator.userAgent),y=["trace","debug","info","warn","error"];function v(h,f){var l=h[f];if("function"==typeof l.bind)return l.bind(h);try{return Function.prototype.bind.call(l,h)}catch{return function(){return Function.prototype.apply.apply(l,[h,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function t(h,f){for(var l=0;l<y.length;l++){var p=y[l];this[p]=l<h?P:this.methodFactory(p,h,f)}this.log=this.debug}function e(h,f,l){return function(){typeof console!==u&&(t.call(this,f,l),this[h].apply(this,arguments))}}function r(h,f,l){return function i(h){return"debug"===h&&(h="log"),typeof console!==u&&("trace"===h&&g?c:void 0!==console[h]?v(console,h):void 0!==console.log?v(console,"log"):P)}(h)||e.apply(this,arguments)}function n(h,f,l){var k,p=this,T="loglevel";function S(){var b;if(typeof window!==u&&T){try{b=window.localStorage[T]}catch{}if(typeof b===u)try{var d=window.document.cookie,_=d.indexOf(encodeURIComponent(T)+"=");-1!==_&&(b=/^([^;]+)/.exec(d.slice(_))[1])}catch{}return void 0===p.levels[b]&&(b=void 0),b}}"string"==typeof h?T+=":"+h:"symbol"==typeof h&&(T=void 0),p.name=h,p.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},p.methodFactory=l||r,p.getLevel=function(){return k},p.setLevel=function(b,d){if("string"==typeof b&&void 0!==p.levels[b.toUpperCase()]&&(b=p.levels[b.toUpperCase()]),!("number"==typeof b&&b>
1=0&&b<=p.levels.SILENT))throw"log.setLevel() called with invalid level: "+b;if(k=b,!1!==d&&function E(b){var d=(y[b]||"silent").toUpperCase();if(typeof window!==u&&T){try{return void(window.localStorage[T]=d)}catch{}try{window.document.cookie=encodeURIComponent(T)+"="+d+";"}catch{}}}(b),t.call(p,b,h),typeof console===u&&b<p.levels.SILENT)return"No console available for logging"},p.setDefaultLevel=function(b){S()||p.setLevel(b,!1)},p.enableAll=function(b){p.setLevel(p.levels.TRACE,b)},p.disableAll=function(b){p.setLevel(p.levels.SILENT,b)};var m=S();null==m&&(m=f??"WARN"),p.setLevel(m,!1)}var o=new n,a={};o.getLogger=function(f){if("symbol"!=typeof f&&"string"!=typeof f||""===f)throw new TypeError("You must supply a name when creating a logger.");var l=a[f];return l||(l=a[f]=new n(f,o.getLevel(),o.methodFactory)),l};var s=typeof window!==u?window.log:void 0;o.noConflict=function(){return typeof window!==u&&window.log===o&&(window.log=s),o},o.getLoggers=function(){return a},o.default=o,O.exports=o},37708:O=>{var P=typeof AudioContext<"u"?AudioContext:typeof webkitAudioContext<"u"?webkitAudioContext:null,u=function(){function g(y){y=Object.assign({AudioContext:P},y),Object.defineProperties(this,{_AudioContext:{value:y.AudioContext},_audioContext:{value:null,writable:!0},_holders:{value:new Set},AudioContextFactory:{enumerable:!0,value:g}})}return g.prototype.getOrCreate=function(y){if(!this._holders.has(y)&&(this._holders.add(y),this._AudioContext&&!this._audioContext))try{this._audioContext=new this._AudioContext}catch{}return this._audioContext},g.prototype.release=function(y){this._holders.has(y)&&(this._holders.delete(y),!this._holders.size&&this._audioContext&&(this._audioContext.close(),this._audioContext=null))},g}();O.exports=new u},24687:O=>{O.exports=function u(g,y,v){v="number"==typeof v?v:250;var c=g.createMediaStreamSource(y),i=g.createAnalyser();i.fftSize=2048,c.connect(i);var t=new Uint8Array(i.fftSize),e=!1;return setTimeout(function(){e=!0},v),function r(){return e?Promise.resolve(!0):(i.getByteTimeDomainData(t),t.some(function(n){return 128!==n&&0!==n})?Promise.resolve(!1):function P(g){return g="number"==typeof g?g:0,new Promise(function(y){return setTimeout(y,g)})}().then(r))}().then(function(n){return c.disconnect(),n},function(n){throw c.disconnect(),n})}},43830:(O,P,u)=>{var g=u(24687);O.exports=function y(v,c,i,t,e){t="number"==typeof t?t:3;var r=0,n=u(37708),o={},a=n.getOrCreate(o);return function s(){return c(i).then(function(h){return(i.audio?g(a,h,e).catch(function(l){return v.warn("Encountered an error while detecting silence",l),!0}):Promise.resolve(!1)).then(function(l){return l?t<=0?(v.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."),h):(v.warn("Got a silent audio MediaStreamTrack. Stopping all MediaStreamTracks and calling getUserMedia again. This is retry #"+ ++r+"."),h.getTracks().forEach(function(p){return p.stop()}),t--,s()):(v.info("Got a non-silent audio MediaStreamTrack; returning it."),h)})})}().then(function(h){return n.release(o),h},function(h){throw n.release(o),h})}},19611:function(O,P,u){var g=this&&this.__values||function(x){var M="function"==typeof Symbol&&Symbol.iterator,C=M&&x[M],B=0;if(C)return C.call(x);if(x&&"number"==typeof x.length)return{next:function(){return x&&B>=x.length&&(x=void 0),{value:x&&x[B++],done:!x}}};throw new TypeError(M?"Object is not iterable.":"Symbol.iterator is not defined.")},y=this&&this.__read||function(x,M){var C="function"==typeof Symbol&&x[Symbol.iterator];if(!C)return x;var Q,W,B=C.call(x),Y=[];try{for(;(void 0===M||M-- >0)&&!(Q=B.next()).done;)Y.push(Q.value)}catch(K){W={error:K}}finally{try{Q&&!Q.done&&(C=B.return)&&C.call(B)}finally{if(W)throw W.error}}return Y},v=u(77627),c=v.flatMap,i=v.guessBrowser,t=v.guessBrowserVersion,e=u(13236).getSdpFormat,r=i(),n=t(),o="chrome"===r,a="firefox"===r,s="safari"===r,h=o?n.major:null,f=32767;function l(x,M){return"function"==typeof x.get?x.get(M):x.find(function(C){return C.id===M})}function S(x){var M=Array.from(x.values()).find(function(D){return"candidate-pair"===D.type&&D.nominated});if(!M)return null;var C=l(x,M.localCandidateId),B=l(x,M.remoteCandidateId),Q=[{key:"candidateType",type:"string"},{key:"ip",type:"string"},{key:"port",type:"number"},{key:"priority",type:"number"},{key:"protocol",type:"string"},{key:"url",type:"string"}],Y=Q.concat([{key:"deleted",type:"boolean"},{key:"relayProtocol",type:"string"}]),W=C?Y.reduce(function(D,L){var I=L.key;return D[I]=typeof C[I]===L.type?C[I]:"deleted"!==I&&null,D},{}):null,K=B?Q.reduce(function(D,L){var I=L.key;return D[I]=typeof B[I]===L.type?B[I]:null,D},{}):null;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(D){return"inprogress"===D?"in-progress":D}},{key:"totalRoundTripTime",type:"number"},{key:"transportId",type:"string"},{key:"writable",type:"boolean"}].reduce(function(D,L){var I=L.key,X=L.fixup;return D[I]=typeof M[I]===L.type?X?X(M[I]):M[I]:null,D},{localCandidate:W,remoteCandidate:K})}function m(x){var M=Array.from(x.values()).find(function(L){return"candidate-pair"===L.type&&L.nominated});if(!M)return null;var C=l(x,M.localCandidateId),B=l(x,M.remoteCandidateId),Q=[{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"}],Y=Q.concat([{key:"deleted",type:"boolean"},{key:"relayProtocol",type:"string"}]),W={host:"host",peerreflexive:"prflx",relayed:"relay",serverreflexive:"srflx"},K=C?Y.reduce(function(L,I){var G=I.ffKeys,X=I.key,Z=I.type,$=G&&G.find(function(ee){return ee in C})||X;
1return L[X]=typeof C[$]===Z?"candidateType"===$&&W[C[$]]||C[$]:"deleted"!==$&&null,L},{}):null,D=B?Q.reduce(function(L,I){var G=I.ffKeys,X=I.key,Z=I.type,$=G&&G.find(function(ee){return ee in B})||X;return L[X]=typeof B[$]===Z?"candidateType"===$&&W[B[$]]||B[$]:null,L},{}):null;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(L,I){var G=I.key;return L[G]=typeof M[G]===I.type?M[G]:null,L},{localCandidate:K,remoteCandidate:D})}function b(x,M,C){var B="local"===C?"getSenders":"getReceivers";if(x[B])return x[B]().map(function(W){return W.track}).filter(function(W){return W&&W.kind===M});var Y="audio"===M?"getAudioTracks":"getVideoTracks";return c(x["local"===C?"getLocalStreams":"getRemoteStreams"](),function(W){return W[Y]()})}function w(x,M,C){var B=C.log;return h&&h<67?new Promise(function(Q,Y){x.getStats(function(W){Q([j(W,M)])},null,Y)}):x.getStats(M).then(function(Q){return B.info("getStats by track successful"),V(Q,C)}).catch(function(){return B.warn("getStats by track failed. Getting default stats"),x.getStats().then(function(Q){B.info("getStats by default successful");var Y=function d(x,M){var C,B,Q,Y,W,K;if(!x||!M)return!1;if(x.getReceivers){var D=x.getReceivers();try{for(var L=g(D),I=L.next();!I.done;I=L.next()){var G=I.value;if(G.track&&G.track.id===M.id)return!0}}catch(me){C={error:me}}finally{try{I&&!I.done&&(B=L.return)&&B.call(L)}finally{if(C)throw C.error}}}if(x.getRemoteStreams){var X=x.getRemoteStreams();try{for(var Z=g(X),$=Z.next();!$.done;$=Z.next()){var se=$.value.getTracks();try{for(var fe=(W=void 0,g(se)),le=fe.next();!le.done;le=fe.next())if(le.value.id===M.id)return!0}catch(me){W={error:me}}finally{try{le&&!le.done&&(K=fe.return)&&K.call(fe)}finally{if(W)throw W.error}}}}catch(me){Q={error:me}}finally{try{$&&!$.done&&(Y=Z.return)&&Y.call(Z)}finally{if(Q)throw Q.error}}}return!1}(x,M);B.info("Starting filtering stats for "+(Y?"remote":"local")+" track");var W=function p(x,M,C){var B,Q,Y,W,K,D,L,I,G,X,Z,$,ee,se,fe,le,de,me,ve,he,_e,Ee,ye;if(void 0===C&&(C=!1),Array.isArray(x))ye=new Map(x.map(function(Ae){return[Ae.id||String(Math.random()),Ae]}));else if(x instanceof Map)ye=x;else{if("object"!=typeof x||null===x)return new Map;var Me=new Map;Object.keys(x).forEach(function(Ae){Me.set(Ae,x[Ae])}),ye=Me}if(!ye||!M)return new Map;var z=new Map,q=M.id,F=M.kind,A=null,H=null,oe=null;try{for(var ce=g(ye),ne=ce.next();!ne.done;ne=ce.next()){var ge=y(ne.value,2),we=ge[0],pe=ge[1];if(C&&"inbound-rtp"===pe.type&&pe.trackIdentifier===q){A=pe,H=we,oe=pe.ssrc;break}if(!C&&"media-source"===pe.type&&pe.trackIdentifier===q){A=pe,H=we;break}"track"===pe.type&&pe.trackIdentifier===q&&(A||(A=pe,H=we))}}catch(Ae){B={error:Ae}}finally{try{ne&&!ne.done&&(Q=ce.return)&&Q.call(ce)}finally{if(B)throw B.error}}if(!A)if(C){var Oe=[];try{for(var Ie=g(ye),Pe=Ie.next();!Pe.done;Pe=Ie.next()){var ue=y(Pe.value,2);we=ue[0],"inbound-rtp"===(pe=ue[1]).type&&(pe.kind===F||pe.mediaType===F)&&Oe.push({id:we,stat:pe})}}catch(Ae){Y={error:Ae}}finally{try{Pe&&!Pe.done&&(W=Ie.return)&&W.call(Ie)}finally{if(Y)throw Y.error}}(1===Oe.length||Oe.length>1)&&(H=Oe[0].id,oe=(A=Oe[0].stat).ssrc)}else try{for(var ie=g(ye),U=ie.next();!U.done;U=ie.next()){var J=y(U.value,2);if(we=J[0],"media-source"===(pe=J[1]).type&&pe.kind===F){A=pe,H=we;break}}}catch(Ae){K={error:Ae}}finally{try{U&&!U.done&&(D=ie.return)&&D.call(ie)}finally{if(K)throw K.error}}if(!A)return z;z.set(H,A);var te=new Set;if(C){if(A.codecId&&te.add(A.codecId),A.transportId&&te.add(A.transportId),A.remoteId&&te.add(A.remoteId),oe)try{for(var re=g(ye),ae=re.next();!ae.done;ae=re.next()){var be=y(ae.value,2);we=be[0],"remote-outbound-rtp"===(pe=be[1]).type&&pe.ssrc===oe&&te.add(we)}}catch(Ae){L={error:Ae}}finally{try{ae&&!ae.done&&(I=re.return)&&I.call(re)}finally{if(L)throw L.error}}try{for(var ke=g(te),xe=ke.next();!xe.done;xe=ke.next())ye.has(Le=xe.value)&&z.set(Le,ye.get(Le))}catch(Ae){G={error:Ae}}finally{try{xe&&!xe.done&&(X=ke.return)&&X.call(ke)}finally{if(G)throw G.error}}try{for(var Ce=g(ye),Re=Ce.next();!Re.done;Re=Ce.next()){var Te=y(Re.value,2);we=Te[0],"track"===(pe=Te[1]).type&&pe.trackIdentifier===q&&z.set(we,pe)}}catch(Ae){Z={error:Ae}}finally{try{Re&&!Re.done&&($=Ce.return)&&$.call(Ce)}finally{if(Z)throw Z.error}}}else{try{for(var Se=g(ye),je=Se.next();!je.done;je=Se.next()){var Ne=y(je.value,2);if(we=Ne[0],"outbound-rtp"===(pe=Ne[1]).type&&pe.mediaSourceId===H){z.set(we,pe),pe.codecId&&te.add(pe.codecId),pe.transportId&&te.add(pe.transportId);var Ye=we;try{for(var Qe=(fe=void 0,g(ye)),Fe=Qe.next();!Fe.done;Fe=Qe.next()){var Xe=y(Fe.value,2),Je=Xe[1];"remote-inbound-rtp"===Je.type&&Je.localId===Ye&&z.set(Xe[0],Je)}}catch(et){fe={error:et}}finally{try{Fe&&!Fe.done&&(le=Qe.return)&&le.call(Qe)}finally{if(fe)throw fe.error}}}}}catch(Ae){ee={error:Ae}}finally{try{je&&!je.done&&(se=Se.return)&&se.call(Se)}finally{if(ee)throw ee.error}}try{for(var Ge=g(te),Be=Ge.next();!Be.done;Be=Ge.next()){var Le;ye.has(Le=Be.value)&&z.set(Le,ye.get(Le))}}catch(Ae){de={error:Ae}}finally{try{Be&&!Be.done&&(me=Ge.return)&&me.call(Ge)}finally{if(de)throw de.error}}}var Ue=null,Ze=new Set;try{for(var Ke=g(z.values()),We=Ke.next();!We.done;We=Ke.next())(pe=We.value).transportId&&Ze.add(pe.transportId)}catch(Ae){ve={error:Ae}}finally{try{We&&!We.done&&(he=Ke.return)&&he.call(Ke)}finally{if(ve)throw ve.error}}try{for(var ze=g(Ze),He=ze.next();!He.done;He=ze.next()){var $e=He.value;if(ye.has($e)){var De=ye.get($e);z.set($e,De),De.selectedCandidatePairId&&(Ue=De.selectedCandidatePairId),De.localCertificateId&&ye.has(De.localCertificateId)&&z.set(De.localCertificateId,ye.get(De.localCertificateId)),De.remoteCertificateId&&ye.has(De.remoteCertificateId)&&z.set(De.remoteCertificateId,ye.get(De.remoteCertificateId))}}}catch(Ae){_e={error:Ae}}finally{try{He&&!He.done&&(Ee=ze.return)&&Ee.call(ze)}finally{if(_e)throw _e.error}}if(Ue&&ye.has(Ue)){var Ve=ye.get(Ue);z.set(Ue,Ve),Ve.localCandidateId&&ye.has(Ve.localCandidateId)&&z.set(Ve.localCandidateId,ye.get(Ve.localCandidateId)),Ve.remoteCandidateId&&ye.has(Ve.remoteCandidateId)&&z.set(Ve.remoteCandidateId,ye.get(Ve.remoteCandidateId))}return z}(Q,M,Y);return B.info("Completed filtering stats for "+(Y?"remote":"local")+" track"),V(W,C)})})}function j(x,M){var C=x.result().find(function(Q){return"ssrc"===Q.type&&Q.stat("googTrackId")===M.id}),B={};return C&&(B.timestamp=Math.round(Number(C.timestamp)),B=C.names().reduce(function(Q,Y){switch(Y){case"googCodecName":Q.codecName=C.stat(Y);break;case"googRtt":Q.roundTripTime=Number(C.stat(Y));break;case"googJitterReceived":Q.jitter=Number(C.stat(Y));break;case"googFrameWidthInput":Q.frameWidthInput=Number(C.stat(Y));break;case"googFrameHeightInput":Q.frameHeightInput=Number(C.stat(Y));break;case"googFrameWidthSent":Q.frameWidthSent=Number(C.stat(Y));break;case"googFrameHeightSent":Q.frameHeightSent=Number(C.stat(Y));break;case"googFrameWidthReceived":Q.frameWidthReceived=Number(C.stat(Y));break;case"googFrameHeightReceived":Q.frameHeightReceived=Number(C.stat(Y));break;case"googFrameRateInput":Q.frameRateInput=Number(C.stat(Y));break;case"googFrameRateSent":Q.frameRateSent=Number(C.stat(Y));break;case"googFrameRateReceived":Q.frameRateReceived=Number(C.stat(Y));break;case"ssrc":Q[Y]=C.stat(Y);break;case"bytesReceived":case"bytesSent":case"packetsLost":case"packetsReceived":case"packetsSent":case"audioInput
1Level":case"audioOutputLevel":Q[Y]=Number(C.stat(Y))}return Q},B)),B}function V(x,M){var C=M.simulateExceptionWhileStandardizingStats;if(void 0!==C&&C)throw new Error("Error while gathering stats");var Q=null,Y=[],W=null,K=null,D=null,L=null,I=null;x.forEach(function(ee){switch(ee.type){case"inbound-rtp":Q=ee;break;case"outbound-rtp":Y.push(ee);break;case"media-source":I=ee;break;case"track":D=ee;break;case"codec":L=ee;break;case"remote-inbound-rtp":W=ee;break;case"remote-outbound-rtp":K=ee}});var G=D?D.remoteSource:!I,Z=[],$=G?K:W;return(G?[Q]:Y).forEach(function(ee){var se={},fe=[ee,I,D,L,$&&$.ssrc===ee.ssrc?$:null];function le(ue){var ie=fe.find(function(U){return U&&typeof U[ue]<"u"})||null;return ie?ie[ue]:null}var de=le("ssrc");"number"==typeof de&&(se.ssrc=String(de));var me=le("timestamp");se.timestamp=Math.round(me);var ve=le("mimeType");"string"==typeof ve&&(ve=ve.split("/"),se.codecName=ve[ve.length-1]);var he=le("roundTripTime");"number"==typeof he&&(se.roundTripTime=Math.round(1e3*he));var _e=le("jitter");"number"==typeof _e&&(se.jitter=Math.round(1e3*_e));var Ee=le("frameWidth");"number"==typeof Ee&&(G?se.frameWidthReceived=Ee:(se.frameWidthSent=Ee,se.frameWidthInput=D?D.frameWidth:I.width));var ye=le("frameHeight");"number"==typeof ye&&(G?se.frameHeightReceived=ye:(se.frameHeightSent=ye,se.frameHeightInput=D?D.frameHeight:I.height));var Me=le("framesPerSecond");"number"==typeof Me&&(se[G?"frameRateReceived":"frameRateSent"]=Me);var z=le("bytesReceived");"number"==typeof z&&(se.bytesReceived=z);var q=le("bytesSent");"number"==typeof q&&(se.bytesSent=q);var F=le("packetsLost");"number"==typeof F&&(se.packetsLost=F);var A=le("packetsReceived");"number"==typeof A&&(se.packetsReceived=A);var H=le("packetsSent");"number"==typeof H&&(se.packetsSent=H);var oe=le("audioLevel");"number"==typeof oe&&(oe=Math.round(oe*f),G?se.audioOutputLevel=oe:se.audioInputLevel=oe);var ce=le("totalPacketSendDelay");"number"==typeof ce&&(se.totalPacketSendDelay=ce);var ne=le("totalEncodeTime");"number"==typeof ne&&(se.totalEncodeTime=ne);var ge=le("framesEncoded");"number"==typeof ge&&(se.framesEncoded=ge);var we=le("estimatedPlayoutTimestamp");"number"==typeof we&&(se.estimatedPlayoutTimestamp=we);var pe=le("totalDecodeTime");"number"==typeof pe&&(se.totalDecodeTime=pe);var Oe=le("framesDecoded");"number"==typeof Oe&&(se.framesDecoded=Oe);var Ie=le("jitterBufferDelay");"number"==typeof Ie&&(se.jitterBufferDelay=Ie);var Pe=le("jitterBufferEmittedCount");"number"==typeof Pe&&(se.jitterBufferEmittedCount=Pe),Z.push(se)}),Z}function N(x,M){void 0===x&&(x=new Map);var C=M.isRemote,B=M.simulateExceptionWhileStandardizingStats;if(void 0!==B&&B)throw new Error("Error while gathering stats");var Y=null,W=null;x.forEach(function(A){var oe=A.remoteId;
1if(!A.isRemote)switch(A.type){case"inbound-rtp":Y=A,W=l(x,oe);break;case"outbound-rtp":W=A,Y=l(x,oe)}});var K=C?Y:W,D=C?W:Y;function L(A){return K&&typeof K[A]<"u"?K[A]:D&&typeof D[A]<"u"?D[A]:null}var I={},G=L("timestamp");I.timestamp=Math.round(G);var X=L("ssrc");"number"==typeof X&&(I.ssrc=String(X));var Z=L("bytesSent");"number"==typeof Z&&(I.bytesSent=Z);var $=L("packetsLost");"number"==typeof $&&(I.packetsLost=$);var ee=L("packetsSent");"number"==typeof ee&&(I.packetsSent=ee);var se=L("roundTripTime");"number"==typeof se&&(I.roundTripTime=Math.round(1e3*se));var fe=L("jitter");"number"==typeof fe&&(I.jitter=Math.round(1e3*fe));var le=L("framerateMean");"number"==typeof le&&(I.frameRateSent=Math.round(le));var de=L("bytesReceived");"number"==typeof de&&(I.bytesReceived=de);var me=L("packetsReceived");"number"==typeof me&&(I.packetsReceived=me);var ve=L("framerateMean");"number"==typeof ve&&(I.frameRateReceived=Math.round(ve));var he=L("totalPacketSendDelay");"number"==typeof he&&(I.totalPacketSendDelay=he);var _e=L("totalEncodeTime");"number"==typeof _e&&(I.totalEncodeTime=_e);var Ee=L("framesEncoded");"number"==typeof Ee&&(I.framesEncoded=Ee);var ye=L("estimatedPlayoutTimestamp");"number"==typeof ye&&(I.estimatedPlayoutTimestamp=ye);var Me=L("totalDecodeTime");"number"==typeof Me&&(I.totalDecodeTime=Me);var z=L("framesDecoded");"number"==typeof z&&(I.framesDecoded=z);var q=L("jitterBufferDelay");"number"==typeof q&&(I.jitterBufferDelay=q);var F=L("jitterBufferEmittedCount");return"number"==typeof F&&(I.jitterBufferEmittedCount=F),I}O.exports=function k(x,M){return x&&"function"==typeof x.getStats?function T(x,M){var C=b(x,"audio","local"),B=b(x,"video","local"),Q=b(x,"audio"),Y=b(x,"video"),W={activeIceCandidatePair:null,localAudioTrackStats:[],localVideoTrackStats:[],remoteAudioTrackStats:[],remoteVideoTrackStats:[]},K=c([[C,"localAudioTrackStats",!1],[B,"localVideoTrackStats",!1],[Q,"remoteAudioTrackStats",!0],[Y,"remoteVideoTrackStats",!0]],function(D){var L=y(D,3),G=L[1],X=L[2];return L[0].map(function(Z){return function _(x,M,C){return void 0===C&&(C={}),typeof C.testForChrome<"u"||o?w(x,M,C):typeof C.testForFirefox<"u"||a?function R(x,M,C){return x.getStats(M).then(function(B){return[N(B,C)]})}(x,M,C):typeof C.testForSafari<"u"||s?typeof C.testForSafari<"u"||"unified"===e()?w(x,M,C):Promise.reject(new Error(["getStats() is not supported on this version of Safari","due to this bug: https://bugs.webkit.org/show_bug.cgi?id=192601"].join(" "))):Promise.reject(new Error("RTCPeerConnection#getStats() not supported"))}(x,Z,Object.assign({isRemote:X},M)).then(function($){$.forEach(function(ee){ee.trackId=Z.id,W[G].push(ee)})})})});return Promise.all(K).then(function(){return function E(x,M){return void 0===M&&(M={}),typeof M.testForChrome<"u"||o||typeof M.testForSafari<"u"||s?x.getStats().then(S):typeof M.testForFirefox<"u"||a?x.getStats().then(m):Promise.reject(new Error("RTCPeerConnection#getStats() not supported"))}(x,M)}).then(function(D){return W.activeIceCandidatePair=D,W})}(x,M):Promise.reject(new Error("Given PeerConnection does not support getStats"))}},77370:O=>{O.exports=function P(u){return void 0===u&&(u={audio:!0,video:!0}),"object"==typeof navigator&&"object"==typeof navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(u):Promise.reject(new Error("getUserMedia is not supported"))}},41647:(O,P,u)=>{var g={};Object.defineProperties(g,{getStats:{enumerable:!0,value:u(19611)},getUserMedia:{enumerable:!0,value:u(77370)},MediaStream:{enumerable:!0,value:u(84946)},MediaStreamTrack:{enumerable:!0,value:u(16240)},RTCIceCandidate:{enumerable:!0,value:u(55219)},RTCPeerConnection:{enumerable:!0,value:u(27061)},RTCSessionDescription:{enumerable:!0,value:u(15481)}}),O.exports=g},84946:O=>{O.exports="function"==typeof MediaStream?MediaStream:function(){throw new Error("MediaStream is not supported")}},16240:O=>{O.exports="function"==typeof MediaStreamTrack?MediaStreamTrack:function(){throw new Error("MediaStreamTrack is not supported")}},55219:O=>{O.exports="function"==typeof RTCIceCandidate?RTCIceCandidate:function(){throw new Error("RTCIceCandidate is not supported")}},45431:function(O,P,u){var N,g=this&&this.__extends||(N=function(x,M){return(N=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,B){C.__proto__=B}||function(C,B){for(var Q in B)Object.prototype.hasOwnProperty.call(B,Q)&&(C[Q]=B[Q])})(x,M)},function(x,M){if("function"!=typeof M&&null!==M)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");function C(){this.constructor=x}N(x,M),x.prototype=null===M?Object.create(M):(C.prototype=M.prototype,new C)}),y=this&&this.__read||function(N,x){var M="function"==typeof Symbol&&N[Symbol.iterator];if(!M)return N;var B,Y,C=M.call(N),Q=[];try{for(;(void 0===x||x-- >0)&&!(B=C.next()).done;)Q.push(B.value)}catch(W){Y={error:W}}finally{try{B&&!B.done&&(M=C.return)&&M.call(C)}finally{if(Y)throw Y.error}}return Q},v=this&&this.__spreadArray||function(N,x){for(var M=0,C=x.length,B=N.length;M<C;M++,B++)N[B]=x[M];return N},c=u(54326),i=u(70870),t=u(13688),e=u(84946),r=u(67121),n=u(13236),o=n.getSdpFormat,a=n.updatePlanBTrackIdsToSSRCs,s=n.updateUnifiedPlanTrackIdsToSSRCs,h=u(77627),f=h.delegateMethods,l=h.interceptEvent,p=h.isIOSChrome,k=h.legacyPromise,T=h.proxyProperties,E="unified"===o(),S=function(N){function x(M,C){void 0===M&&(M={});var B=N.call(this)||this,Q=Object.assign(M.iceTransportPolicy?{iceTransports:M.iceTransportPolicy}:{},M);l(B,"datachannel"),l(B,"signalingstatechange");var Y=o(Q.sdpSemantics),W=new RTCPeerConnection(Q,C);return Object.defineProperties(B,{_appliedTracksToSSRCs:{value:new Map,writable:!0},_localStream:{value:new e},_peerConnection:{value:W},_pendingLocalOffer:{value:null,writable:!0},_pendingRemoteOffer:{value:null,writable:!0},_rolledBackTracksToSSRCs:{value:new Map,writable:!0},_sdpFormat:{value:Y},_senders:{value:new Map},_signalingStateLatch:{value:new t},_tracksToSSRCs:{value:new Map,writable:!0}}),W.addEventListener("datachannel",function(K){j(K.channel),B.dispatchEvent(K)}),W.addEventListener("signalingstatechange",function(){for(var K=[],D=0;D<arguments.length;D++)K[D]=arguments[D];"stable"===W.signalingState&&(B._appliedTracksToSSRCs=new Map(B._tracksToSSRCs)),!B._pendingLocalOffer&&!B._pendingRemoteOffer&&B.dispatchEvent.apply(B,v([],y(K)))}),W.ontrack=function(){},"function"!=typeof W.addTrack&&W.addStream(B._localStream),T(RTCPeerConnection.prototype,B,W),B}return g(x,N),Object.defineProperty(x.prototype,"localDescription",{get:function(){return this._pendingLocalOffer?this._pendingLocalOffer:this._peerConnection.localDescription},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"remoteDescription",{get:function(){return this._pendingRemoteOffer?this._pendingRemoteOffer:this._peerConnection.remoteDescription},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"signalingState",{get:function(){return this._pendingLocalOffer?"have-local-offer":this._pendingRemoteOffer?"have-remote-offer":this._peerConnection.signalingState},enumerable:!1,configurable:!0}),x.prototype.addTrack=function(M){for(var C,B=[],Q=1;Q<arguments.length;Q++)B[Q-1]=arguments[Q];if("function"==typeof this._peerConnection.addTrack)return(C=this._peerConnection).addTrack.apply(C,v([M],y(B)));if("closed"===this._peerConnection.signalingState)throw new Error("Cannot add MediaStreamTrack ["+M.id+", \n "+M.kind+"]: RTCPeerConnection is closed");var Y=this._senders.get(M);if(Y&&Y.track)throw new Error("Cannot add MediaStreamTrack ['"+M.id+", \n "+M.kind+"]: RTCPeerConnection already has it");return this._peerConnection.removeStream(this._localStream),this._localStream.addTrack(M),this._peerConnection.addStream(this._localStream),Y=new r(M),this._senders.set(M,Y),Y},x.prototype.removeTrack=function(M){if("closed"===this._peerConnection.signalingState)throw new Error("Cannot remove MediaStreamTrack: RTCPeerConnection is closed");if("function"==typeof this._peerConnection.addTrack)try{return this._peerConnection.removeTrack(M)}catch{}else{var C=M.track;if(!C)return;(M=this._senders.get(C))&&M.track&&(M.track=null,this._peerConnection.removeStream(this._localStream),this._localStream.removeTrack(C),this._peerConnection.addStream(this._localStream))}},x.prototype.getSenders=function(){return"function"==typeof this._peerConnection.addTrack?this._peerConnection.getSenders():Array.from(this._senders.values())},x.prototype.addIceCandidate=function(M){for(var C=this,B=[],Q=1;Q<arguments.length;Q++)B[Q-1]=arguments[Q];var Y;return Y="have-remote-offer"===this.signalingState?this._signalingStateLatch.when("low").then(function(){return C._peerConnection.addIceCandidate(M)}):this._peerConnection.addIceCandidate(M),B.length>0?k.apply(void 0,v([Y],y(B))):Y},x.prototype.close=function(){"closed"!==this.signalingState&&(this._pe
1ndingLocalOffer=null,this._pendingRemoteOffer=null,this._peerConnection.close())},x.prototype.createAnswer=function(){for(var M=this,C=[],B=0;B<arguments.length;B++)C[B]=arguments[B];var Q;return Q=this._pendingRemoteOffer?this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function(){return M._signalingStateLatch.lower(),M._peerConnection.createAnswer()}).then(function(Y){return M._pendingRemoteOffer=null,M._rolledBackTracksToSSRCs.clear(),new c({type:"answer",sdp:V(M._sdpFormat,M._tracksToSSRCs,Y.sdp)})},function(Y){throw M._pendingRemoteOffer=null,Y}):this._peerConnection.createAnswer().then(function(Y){return M._rolledBackTracksToSSRCs.clear(),new c({type:"answer",sdp:V(M._sdpFormat,M._tracksToSSRCs,Y.sdp)})}),C.length>1?k.apply(void 0,v([Q],y(C))):Q},x.prototype.createOffer=function(){for(var M=this,C=[],B=0;B<arguments.length;B++)C[B]=arguments[B];var Q=y(C,3),Y=Q[0],W=Q[1],D=Q[2]||Y||{};if(p()){if(D.offerToReceiveVideo&&!this._audioTransceiver&&(!E||!d(this,"audio"))){delete D.offerToReceiveAudio;try{this._audioTransceiver=E?this.addTransceiver("audio",{direction:"recvonly"}):this.addTransceiver("audio")}catch(I){return Promise.reject(I)}}if(D.offerToReceiveVideo&&!this._videoTransceiver&&(!E||!d(this,"video"))){delete D.offerToReceiveVideo;try{this._videoTransceiver=E?this.addTransceiver("video",{direction:"recvonly"}):this.addTransceiver("video")}catch(I){return Promise.reject(I)}}}var L=this._peerConnection.createOffer(D).then(function(I){return M._rolledBackTracksToSSRCs.clear(),new c({type:I.type,sdp:V(M._sdpFormat,M._tracksToSSRCs,I.sdp)})});return C.length>1?k(L,Y,W):L},x.prototype.createDataChannel=function(M,C){C=function R(N){return N=Object.assign({},N),w()&&"maxPacketLifeTime"in N&&(N.maxRetransmitTime=N.maxPacketLifeTime),N}(C);var B=this._peerConnection.createDataChannel(M,C);return j(B),B},x.prototype.setLocalDescription=function(){for(var M=[],C=0;C<arguments.length;C++)M[C]=arguments[C];var B=y(M,3),Q=B[0],Y=B[1],W=B[2];this._rolledBackTracksToSSRCs.size>0&&(this._tracksToSSRCs=new Map(this._rolledBackTracksToSSRCs),this._rolledBackTracksToSSRCs.clear());var K=m(this,!0,Q);return M.length>1?k(K,Y,W):K},x.prototype.setRemoteDescription=function(){for(var M=[],C=0;C<arguments.length;C++)M[C]=arguments[C];var B=y(M,3),Q=B[0],Y=B[1],W=B[2];this._rolledBackTracksToSSRCs.clear();var K=m(this,!1,Q);return M.length>1?k(K,Y,W):K},x}(i);function m(N,x,M){var D,Q=x?N._pendingLocalOffer:N._pendingRemoteOffer,W=x?"have-local-offer":"have-remote-offer",K=x?"setLocalDescription":"setRemoteDescription";if(!x&&(x?N._pendingRemoteOffer:N._pendingLocalOffer)&&"answer"===M.type)D=function b(N,x){return N._peerConnection.setLocalDescription(N._pendingLocalOffer).then(function(){return N._pendingLocalOffer=null,N.setRemoteDescription(x)}).then(function(){N._signalingStateLatch.lower()})}(N,M);else if("offer"===M.type){if(N.signalingState!==W&&"stable"!==N.signalingState)return Promise.reject(new Error("Cannot set "+(x?"local":"remote")+" offer in state "+N.signalingState));!Q&&"low"===N._signalingStateLatch.state&&N._signalingStateLatch.raise();var L=N.signalingState;(function C(I){x?N._pendingLocalOffer=I:N._pendingRemoteOffer=I})(_(M)),D=Promise.resolve(),N.signalingState!==L&&D.then(function(){return N.dispatchEvent(new Event("signalingstatechange"))})}else"rollback"===M.type&&(N.signalingState!==W?D=Promise.reject(new Error("Cannot rollback "+(x?"local":"remote")+" description in "+N.signalingState)):(function B(){x?N._pendingLocalOffer=null:N._pendingRemoteOffer=null}(),N._rolledBackTracksToSSRCs=new Map(N._tracksToSSRCs),N._tracksToSSRCs=new Map(N._appliedTracksToSSRCs),(D=Promise.resolve()).then(function(){return N.dispatchEvent(new Event("signalingstatechange"))})));return D||N._peerConnection[K](_(M))}function d(N,x){return!!N.getTransceivers().find(function(M){var C=M.receiver,Q=(void 0===C?{}:C).track;return(void 0===Q?{}:Q).kind===x})}function _(N){return N instanceof c&&N._description?N._description:new RTCSessionDescription(N)}function w(){return"maxRetransmitTime"in RTCDataChannel.prototype&&!("maxPacketLifeTime"in RTCDataChannel.prototype)}function j(N){return Object.defineProperty(N,"maxRetransmits",{value:65535===N.maxRetransmits?null:N.maxRetransmits}),w()&&Object.defineProperty(N,"maxPacketLifeTime",{value:65535===N.maxRetransmitTime?null:N.maxRetransmitTime}),N}function V(N,x,M){return"unified"===N?s(x,M):a(x,M)}f(RTCPeerConnection.prototype,S.prototype,"_peerConnection"),O.exports=S},27111:function(O,P,u){var p,g=this&&this.__extends||(p=function(k,T){return(p=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var m in S)Object.prototype.hasOwnProperty.call(S,m)&&(E[m]=S[m])})(k,T)},function(k,T){if("function"!=typeof T&&null!==T)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");function E(){this.constructor=k}p(k,T),k.prototype=null===T?Object.create(T):(E.prototype=T.prototype,new E)}),y=this&&this.__read||function(p,k){var T="function"==typeof Symbol&&p[Symbol.iterator];if(!T)return p;var S,b,E=T.call(p),m=[];try{for(;(void 0===k||k-- >0)&&!(S=E.next()).done;)m.push(S.value)}catch(d){b={error:d}}finally{try{S&&!S.done&&(T=E.return)&&T.call(E)}finally{if(b)throw b.error}}return m},v=this&&this.__spreadArray||function(p,k){for(var T=0,E=k.length,S=p.length;T<E;T++,S++)p[S]=k[T];return p},c=u(70870),i=u(33657),t=u(13236).updateUnifiedPlanTrackIdsToSSRCs,e=u(77627),r=e.delegateMethods,n=e.interceptEvent,o=e.legacyPromise,a=e.proxyProperties,s=function(p){function k(T){var E=p.call(this)||this;n(E,"signalingstatechange");var m,S=new RTCPeerConnection(T);return Object.defineProperties(E,{_initiallyNegotiatedDtlsRole:{value:null,writable:!0},_isClosed:{value:!1,writable:!0},_peerConnection:{value:S},_rollingBack:{value:!1,writable:!0},_tracksToSSRCs:{value:new Map},peerIdentity:{enumerable:!0,value:Promise.resolve({idp:"",name:""})}}),S.addEventListener("signalingstatechange",function(){for(var b=[],d=0;d<arguments.length;d++)b[d]=arguments[d];!E._rollingBack&&E.signalingState!==m&&(m=E.signalingState,E._isClosed?setTimeout(function(){return E.dispatchEvent.apply(E,v([],y(b)))}):E.dispatchEvent.apply(E,v([],y(b))))}),a(RTCPeerConnection.prototype,E,S),E}return g(k,p),Object.defineProperty(k.prototype,"iceGatheringState",{get:function(){return this._isClosed?"complete":this._peerConnection.iceGatheringState},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"localDescription",{get:function(){return l(this._peerConnection.localDescription,this._initiallyNegotiatedDtlsRole)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"signalingState",{get:function(){return this._isClosed?"closed":this._peerConnection.signalingState},enumerable:!1,configurable:!0}),k.prototype.createAnswer=function(){for(var T=this,E=[],S=0;S<arguments.length;S++)E[S]=arguments[S];var m;return m=this._peerConnection.createAnswer().then(function(b){return f(T,b),l(b,T._initiallyNegotiatedDtlsRole)}),"function"==typeof E[0]?o.apply(void 0,v([m],y(E))):m},k.prototype.createOffer=function(){for(var T=this,E=[],S=0;S<arguments.length;S++)E[S]=arguments[S];var R,m=y(E,3),b=m[0],d=m[1],w=m[2]||b||{};return R=(R="have-local-offer"===this.signalingState||"have-remote-offer"===this.signalingState?h(this,"have-local-offer"===this.signalingState,function(){return T.createOffer(w)}):this._peerConnection.createOffer(w)).then(function(V){return new i({type:V.type,sdp:t(T._tracksToSSRCs,V.sdp)})}),E.length>1?o(R,b,d):R},k.prototype.setLocalDescription=function(){for(var T,E=[],S=0;S<arguments.length;S++)E[S]=arguments[S];var _,m=y(E),b=m[0],d=m.slice(1);return b&&"answer"===b.type&&"have-local-offer"===this.signalingState&&(_=Promise.reject(new Error("Cannot set local answer in state have-local-offer"))),_?E.length>1?o.apply(void 0,v([_],y(d))):_:(T=this._peerConnection).setLocalDescription.apply(T,v([],y(E)))},k.prototype.setRemoteDescription=function(){for(var T=this,E=[],S=0;S<arguments.length;S++)E[S]=arguments[S];var _,m=y(E),b=m[0],d=m.slice(1);return b&&"have-remote-offer"===this.signalingState&&("answer"===b.type?_=Promise.reject(new Error("Cannot set remote answer in state have-remote-offer")):"offer"===b.type&&(_=h(this,!1,function(){return T._peerConnection.setRemoteDescription(b)}))),_||(_=this._peerConnection.setRemoteDescription(b)),_=_.then(function(){return f(T,b,!0)}),E.length>1?o.apply(void 0,v([_],y(d))):_},k.prototype.close=function(){"closed"!==this.signalingState&&(this._isClosed=!0,this._peerConnection.close())},k}(c);function h(p,k,T){var E=k?"setLocalDescription":"setRemoteDescription";return p._rollingBack=!0,p._peerConnection[E](new i({type:"rollback"})).then(T).then(function(S){return p._rollingBack=!1,S},function(S){throw p._rollingBack=!1,S})}function f(p,k,T){if(!p._initiallyNegotiatedDtlsRole&&"offer"!==k.type){var E=k.sdp.match(/a=setup:([a-z]+)/);if(E){var S=E[1];p._initiallyNegotiatedDtlsRole=T?{active:"passive",passive:"active"}[S]:S}}}function l(p,k){return p&&"answer"===p.type&&k?new i({type:p.type,sdp:p.sdp.replace(/a=setup:[a-z]+/g,"a=setup:"+k)}):p}r(RTCPeerConnection.prototype,s.prototype,"_peerConnection"),O.exports=s},27061:(O,P,u)=>{if("function"==typeof RTCPeerConnection)switch((0,u(77627).guessBrowser)()){case"chrome":O.exports=u(45431);break;case"firefox":O.exports=u(27111);break;case"safari":O.exports=u(47548);break;default:O.exports=RTCPeerConnection}else O.exports=function(){throw new Error("RTCPeerConnection is not supported")}},47548:function(O,P,u){var m,g=this&&this.__extends||(m=function(b,d){return(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,w){_.__proto__=w}||function(_,w){for(var R in w)Object.prototype.hasOwnProperty.call(w,R)&&(_[R]=w[R]
1)})(b,d)},function(b,d){if("function"!=typeof d&&null!==d)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function _(){this.constructor=b}m(b,d),b.prototype=null===d?Object.create(d):(_.prototype=d.prototype,new _)}),y=this&&this.__read||function(m,b){var d="function"==typeof Symbol&&m[Symbol.iterator];if(!d)return m;var w,j,_=d.call(m),R=[];try{for(;(void 0===b||b-- >0)&&!(w=_.next()).done;)R.push(w.value)}catch(V){j={error:V}}finally{try{w&&!w.done&&(d=_.return)&&d.call(_)}finally{if(j)throw j.error}}return R},v=this&&this.__spreadArray||function(m,b){for(var d=0,_=b.length,w=m.length;d<_;d++,w++)m[w]=b[d];return m},c=u(70870),i=u(13688),t=u(13236),e=t.getSdpFormat,r=t.updatePlanBTrackIdsToSSRCs,n=t.updateUnifiedPlanTrackIdsToSSRCs,o=u(77627),a=o.delegateMethods,s=o.interceptEvent,h=o.proxyProperties,f="unified"===e(),l=f?n:r,p=function(m){function b(d){var _=m.call(this)||this;s(_,"datachannel"),s(_,"iceconnectionstatechange"),s(_,"signalingstatechange"),s(_,"track");var w=new RTCPeerConnection(d);return Object.defineProperties(_,{_appliedTracksToSSRCs:{value:new Map,writable:!0},_audioTransceiver:{value:null,writable:!0},_isClosed:{value:!1,writable:!0},_peerConnection:{value:w},_pendingLocalOffer:{value:null,writable:!0},_pendingRemoteOffer:{value:null,writable:!0},_rolledBackTracksToSSRCs:{value:new Map,writable:!0},_signalingStateLatch:{value:new i},_tracksToSSRCs:{value:new Map,writable:!0},_videoTransceiver:{value:null,writable:!0}}),w.addEventListener("datachannel",function(R){S(R.channel),_.dispatchEvent(R)}),w.addEventListener("iceconnectionstatechange",function(){for(var R=[],j=0;j<arguments.length;j++)R[j]=arguments[j];_._isClosed||_.dispatchEvent.apply(_,v([],y(R)))}),w.addEventListener("signalingstatechange",function(){for(var R=[],j=0;j<arguments.length;j++)R[j]=arguments[j];_._isClosed||("stable"===w.signalingState&&(_._appliedTracksToSSRCs=new Map(_._tracksToSSRCs)),!_._pendingLocalOffer&&!_._pendingRemoteOffer&&_.dispatchEvent.apply(_,v([],y(R))))}),w.addEventListener("track",function(R){_._pendingRemoteOffer=null,_.dispatchEvent(R)}),h(RTCPeerConnection.prototype,_,w),_}return g(b,m),Object.defineProperty(b.prototype,"localDescription",{get:function(){return this._pendingLocalOffer||this._peerConnection.localDescription},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"iceConnectionState",{get:function(){return this._isClosed?"closed":this._peerConnection.iceConnectionState},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"iceGatheringState",{get:function(){return this._isClosed?"complete":this._peerConnection.iceGatheringState},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"remoteDescription",{get:function(){return this._pendingRemoteOffer||this._peerConnection.remoteDescription},enumerable:!1,configurable:!0}),Object.defineProperty(b.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}),b.prototype.addIceCandidate=function(d){var _=this;return"have-remote-offer"===this.signalingState?this._signalingStateLatch.when("low").then(function(){return _._peerConnection.addIceCandidate(d)}):this._peerConnection.addIceCandidate(d)},b.prototype.createOffer=function(d){var _=this;if((d=Object.assign({},d)).offerToReceiveVideo&&!this._audioTransceiver&&(!f||!E(this,"audio"))){delete d.offerToReceiveAudio;try{this._audioTransceiver=f?this.addTransceiver("audio",{direction:"recvonly"}):this.addTransceiver("audio")}catch(w){return Promise.reject(w)}}if(d.offerToReceiveVideo&&!this._videoTransceiver&&(!f||!E(this,"video"))){delete d.offerToReceiveVideo;try{this._videoTransceiver=f?this.addTransceiver("video",{direction:"recvonly"}):this.addTransceiver("video")}catch(w){return Promise.reject(w)}}return this._peerConnection.createOffer(d).then(function(w){return _._rolledBackTracksToSSRCs.clear(),new RTCSessionDescription({type:w.type,sdp:l(_._tracksToSSRCs,w.sdp)})})},b.prototype.createAnswer=function(d){var _=this;return this._pendingRemoteOffer?this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function(){return _._signalingStateLatch.lower(),_._peerConnection.createAnswer()}).then(function(w){return _._pendingRemoteOffer=null,_._rolledBackTracksToSSRCs.clear(),f?new RTCSessionDescription({type:w.type,sdp:l(_._tracksToSSRCs,w.sdp)}):w},function(w){throw _._pendingRemoteOffer=null,w}):this._peerConnection.createAnswer(d).then(function(w){return _._rolledBackTracksToSSRCs.clear(),f?new RTCSessionDescription({type:w.type,sdp:l(_._tracksToSSRCs,w.sdp)}):w})},b.prototype.createDataChannel=function(d,_){var w=this._peerConnection.createDataChannel(d,_);return S(w),w},b.prototype.removeTrack=function(d){d.replaceTrack(null),this._peerConnection.removeTrack(d)},b.prototype.setLocalDescription=function(d){return this._rolledBackTracksToSSRCs.size>0&&(this._tracksToSSRCs=new Map(this._rolledBackTracksToSSRCs),this._rolledBackTracksToSSRCs.clear()),k(this,!0,d)},b.prototype.setRemoteDescription=function(d){return this._rolledBackTracksToSSRCs.clear(),k(this,!1,d)},b.prototype.close=function(){var d=this;this._isClosed||(this._isClosed=!0,this._peerConnection.close(),setTimeout(function(){d.dispatchEvent(new Event("iceconnectionstatechange")),d.dispatchEvent(new Event("signalingstatechange"))}))},b}(c);function k(m,b,d){var R=b?m._pendingLocalOffer:m._pendingRemoteOffer,V=b?"have-local-offer":"have-remote-offer",N=b?"setLocalDescription":"setRemoteDescription";if(!b&&(b?m._pendingRemoteOffer:m._pendingLocalOffer)&&"answer"===d.type)return function T(m,b){return m._peerConnection.setLocalDescription(m._pendingLocalOffer).then(function(){return m._pendingLocalOffer=null,m.setRemoteDescription(b)}).then(function(){return m._signalingStateLatch.lower()})}(m,d);if("offer"===d.type){if(m.signalingState!==V&&"stable"!==m.signalingState)return Promise.reject(new Error("Cannot set "+(b?"local":"remote")+"\n offer in state "+m.signalingState));!R&&"low"===m._signalingStateLatch.state&&m._signalingStateLatch.raise();var x=m.signalingState;return function _(M){b?m._pendingLocalOffer=M:m._pendingRemoteOffer=M}(d),m.signalingState!==x?Promise.resolve().then(function(){return m.dispatchEvent(new Event("signalingstatechange"))}):Promise.resolve()}return"rollback"===d.type?m.signalingState!==V?Promise.reject(new Error("Cannot rollback \n "+(b?"local":"remote")+" description in "+m.signalingState)):(function w(){b?m._pendingLocalOffer=null:m._pendingRemoteOffer=null}(),m._rolledBackTracksToSSRCs=new Map(m._tracksToSSRCs),m._tracksToSSRCs=new Map(m._appliedTracksToSSRCs),Promise.resolve().then(function(){return m.dispatchEvent(new Event("signalingstatechange"))})):m._peerConnection[N](d)}function E(m,b){return!!m.getTransceivers().find(function(d){var _=d.receiver,R=(void 0===_?{}:_).track;return(void 0===R?{}:R).kind===b})}function S(m){return Object.defineProperties(m,{maxPacketLifeTime:{value:65535===m.maxPacketLifeTime?null:m.maxPacketLifeTime},maxRetransmits:{value:65535===m.maxRetransmits?null:m.maxRetransmits}})}a(RTCPeerConnection.prototype,p.prototype,"_peerConnection"),O.exports=p},67121:O=>{O.exports=function u(g){Object.defineProperties(this,{track:{enumerable:!0,value:g,writable:!0}})}},54326:O=>{var P=function(){function u(g){this.descriptionInitDict=g;var y=g&&"rollback"===g.type?null:new RTCSessionDescription(g);Object.defineProperties(this,{_description:{get:function(){return y}}})}return Object.defineProperty(u.prototype,"sdp",{get:function(){return this._description?this._description.sdp:this.descriptionInitDict.sdp}
1,enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"type",{get:function(){return this._description?this._description.type:this.descriptionInitDict.type},enumerable:!1,configurable:!0}),u}();O.exports=P},33657:O=>{O.exports=RTCSessionDescription},15481:(O,P,u)=>{if("function"==typeof RTCSessionDescription)switch((0,u(77627).guessBrowser)()){case"chrome":O.exports=u(54326);break;case"firefox":O.exports=u(33657);break;default:O.exports=RTCSessionDescription}else O.exports=function(){throw new Error("RTCSessionDescription is not supported")}},77627:function(O,P){var u=this&&this.__read||function(m,b){var d="function"==typeof Symbol&&m[Symbol.iterator];if(!d)return m;var w,j,_=d.call(m),R=[];try{for(;(void 0===b||b-- >0)&&!(w=_.next()).done;)R.push(w.value)}catch(V){j={error:V}}finally{try{w&&!w.done&&(d=_.return)&&d.call(_)}finally{if(j)throw j.error}}return R},g=this&&this.__spreadArray||function(m,b){for(var d=0,_=b.length,w=m.length;d<_;d++,w++)m[w]=b[d];return m};function v(m,b,d,_){if(!(_ in b)&&!_.match(/^on[a-z]+$/)){var w=!1;try{var R=Object.getOwnPropertyDescriptor(m,_);w=R&&!!R.get}catch{}if(!w){var j;try{j=typeof m[_]}catch{}"function"===j&&(b[_]=function(){return this[d][_].apply(this[d],arguments)})}}}function e(){return typeof navigator<"u"&&"string"==typeof navigator.userAgent?navigator.userAgent:null}function r(m){return typeof m>"u"&&(m=e()),/Chrome|CriOS/.test(m)?"chrome":/Firefox|FxiOS/.test(m)?"firefox":/Safari|iPhone|iPad|iPod/.test(m)?"safari":null}var T=new Map;P.clearCachedSupportedCodecs=function S(){T.clear()},P.defer=function y(){var m={};return m.promise=new Promise(function(b,d){m.resolve=b,m.reject=d}),m},P.delegateMethods=function c(m,b,d){for(var _ in m)v(m,b,d,_)},P.difference=function i(m,b){m=Array.isArray(m)?new Set(m):new Set(m.values()),b=Array.isArray(b)?new Set(b):new Set(b.values());var d=new Set;return m.forEach(function(_){b.has(_)||d.add(_)}),d},P.flatMap=function t(m,b){return(m instanceof Map||m instanceof Set?Array.from(m.values()):m).reduce(function(_,w){return _.concat(b(w))},[])},P.guessBrowser=r,P.guessBrowserVersion=function n(m){typeof m>"u"&&(m=e());var b={chrome:"Chrome|CriOS",firefox:"Firefox|FxiOS",safari:"Version"}[r(m)];if(!b)return null;var d=new RegExp("("+b+")/([^\\s]+)"),w=u(m.match(d)||[],3)[2];if(!w)return null;var R=w.split(".").map(Number);return{major:isNaN(R[0])?null:R[0],minor:isNaN(R[1])?null:R[1]}},P.isCodecSupported=function E(m,b){var d=T.get(b);return d?Promise.resolve(d.has(m.toLowerCase())):function k(m){if(typeof RTCRtpSender<"u"&&"function"==typeof RTCRtpSender.getCapabilities)return Promise.resolve(new Set(RTCRtpSender.getCapabilities(m).codecs.map(function(d){return d.mimeType.split("/")[1].toLowerCase()})));if(typeof RTCPeerConnection>"u"||typeof RTCPeerConnection.prototype>"u"||"function"!=typeof RTCPeerConnection.prototype.addTransceiver||"function"!=typeof RTCPeerConnection.prototype.close||"function"!=typeof RTCPeerConnection.prototype.createOffer)return Promise.resolve(new Set);var b=new RTCPeerConnection;return b.addTransceiver(m),b.createOffer().then(function(d){var _=d.sdp;return b.close(),new Set((_.match(/^a=rtpmap:.+$/gm)||[]).map(function(w){return w.match(/^a=rtpmap:.+ ([^/]+)/)[1].toLowerCase()}))},function(){return b.close(),new Set})}(b).then(function(_){return T.set(b,_),_.has(m.toLowerCase())})},P.isIOSChrome=function o(m){return typeof m>"u"&&(m=e()),/Mobi/.test(m)&&"chrome"===r()&&/iPad|iPhone|iPod/.test(m)},P.interceptEvent=function a(m,b){var d=null;Object.defineProperty(m,"on"+b,{get:function(){return d},set:function(_){d&&this.removeEventListener(b,d),"function"==typeof _?this.addEventListener(b,d=_):d=null}})},P.legacyPromise=function s(m,b,d){return b?m.then(b,d):m},P.makeUUID=function h(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(m){var b=16*Math.random()|0;return("x"===m?b:3&b|8).toString(16)})},P.proxyProperties=function f(m,b,d){Object.getOwnPropertyNames(m).forEach(function(_){!function l(m,b,d,_){if(!(_ in b)){if(_.match(/^on[a-z]+$/))return Object.defineProperty(b,_,{value:null,writable:!0}),void d.addEventListener(_.slice(2),function(){for(var w=[],R=0;R<arguments.length;R++)w[R]=arguments[R];return b.dispatchEvent.apply(b,g([],u(w)))});Object.defineProperty(b,_,{enumerable:!0,get:function(){return d[_]}})}}(0,b,d,_)})},P.support=function p(){return"object"==typeof navigator&&"object"==typeof navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getUserMedia&&"function"==typeof RTCPeerConnection}},13688:(O,P,u)=>{var g=u(77627).defer,y={high:new Set(["low"]),low:new Set(["high"])},v=function(){function i(t){void 0===t&&(t="low");var e=t;Object.defineProperties(this,{_state:{set:function(r){var n=this;if(e!==r){var o=this._whenDeferreds.get(e=r);o.forEach(function(a){return a.resolve(n)}),o.clear()}},get:function(){return e}},_whenDeferreds:{value:new Map([["high",new Set],["low",new Set]])}})}return Object.defineProperty(i.prototype,"state",{get:function(){return this._state}
1,enumerable:!1,configurable:!0}),i.prototype.lower=function(){return this.transition("low")},i.prototype.raise=function(){return this.transition("high")},i.prototype.transition=function(t){if(!y[this.state].has(t))throw c(this.state,t);return this._state=t,this},i.prototype.when=function(t){if(this.state===t)return Promise.resolve(this);if(!y[this.state].has(t))return Promise.reject(c(this.state,t));var e=g();return this._whenDeferreds.get(t).add(e),e.promise},i}();function c(i,t){return new Error('Cannot transition from "'+i+'" to "'+t+'"')}O.exports=v},13236:(O,P,u)=>{var g=u(77627),y=g.flatMap,v=g.guessBrowser,c=null,t=null;function n(R){return R&&function i(){if("boolean"==typeof c)return c;if(typeof RTCPeerConnection>"u")return c=!1;try{new RTCPeerConnection({sdpSemantics:"foo"}),c=!1}catch{c=!0}return c}()?{"plan-b":"planb","unified-plan":"unified"}[R]:function r(){if(!t)if(typeof RTCPeerConnection<"u"&&"addTransceiver"in RTCPeerConnection.prototype){var R=new RTCPeerConnection;try{R.addTransceiver("audio"),t="unified"}catch{t="planb"}R.close()}else t="planb";return t}()}function s(R,j){return(j.match(new RegExp(R,"gm"))||[]).reduce(function(N,x){var M=x.match(new RegExp(R));return M?N.add(M[1]):N},new Set)}function h(R,j){return s(R,j)}function f(R){return h("^a=ssrc:[0-9]+ +msid:.+ +(.+) *$",R)}function l(R){return h("^a=msid:.+ +(.+) *$",R)}function p(R,j){return s("^a=ssrc:([0-9]+) +msid:[^ ]+ +"+j+" *$",R)}function k(R,j,V){return void 0===j&&(j=".*"),void 0===V&&(V=".*"),R.split("\r\nm=").slice(1).map(function(N){return"m="+N}).filter(function(N){var x=new RegExp("m="+j,"gm"),M=new RegExp("a="+V,"gm");return x.test(N)&&M.test(N)})}function T(R){return Array.from(s("^a=ssrc:([0-9]+) +.*$",R))}function E(R,j){var V=k(R),N=new RegExp("^a=msid:[^ ]+ +"+j+" *$","gm"),x=V.filter(function(M){return M.match(N)});return new Set(y(x,T))}function S(R,j,V){return new Map(Array.from(R(V)).map(function(N){return[N,j(V,N)]}))}function m(R){return S(f,p,R)}function b(R){return S(l,E,R)}function d(R,j,V){var N=R(V),x=new Map;N.forEach(function(B,Q){if(j.has(Q)){var Y=Array.from(j.get(Q)),W=Array.from(B);Y.forEach(function(K,D){var L=W[D];x.set(L,K);var G="a=ssrc:"+K+" $1";V=V.replace(new RegExp("^a=ssrc:"+L+" (.*)$","gm"),G)})}else j.set(Q,B)});var M="^(a=ssrc-group:[^ ]+ +)(.*)$";return(V.match(new RegExp(M,"gm"))||[]).forEach(function(B){var Q=B.match(new RegExp(M));if(Q){var Y=Q[1],K=Q[2].split(" ").map(function(D){return x.get(D)||D}).join(" ");V=V.replace(Q[0],Y+K)}}),V}P.clearChromeCachedSdpFormat=function e(){t=null},P.getSdpFormat=function a(R){return{chrome:n(R),firefox:"unified",safari:typeof RTCRtpTransceiver<"u"&&"currentDirection"in RTCRtpTransceiver.prototype?"unified":"planb"}[v()]||null},P.getMediaSections=k,P.getPlanBTrackIds=f,P.getUnifiedPlanTrackIds=l,P.getPlanBSSRCs=p,P.getUnifiedPlanSSRCs=E,P.updatePlanBTrackIdsToSSRCs=function _(R,j){return d(m,R,j)},P.updateUnifiedPlanTrackIdsToSSRCs=function w(R,j){return d(b,R,j)}},23332:O=>{O.exports=WebSocket},1730:O=>{O.exports=JSON.parse('{"name":"twilio-video","title":"Twilio Video","description":"Twilio Video JavaScript Library","version":"2.32.0","homepage":"https://twilio.com","author":"Mark Andrus Roberts <[email protected]>","contributors":["Ryan Rowland <[email protected]>","Manjesh Malavalli <[email protected]>","Makarand Patwardhan <[email protected]>","Luis Rivas <[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","regex-replace":"^2.3.1","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","patch-linkifyit-111":"regex-replace \\"readonly linkify: LinkifyIt.LinkifyIt;\\" \\"readonly linkify: typeof LinkifyIt;\\" \\"node_modules/@types/markdown-it/lib/index.d.ts\\" --filecontents","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 && npm run patch-linkifyit-111 && 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.