vendor: 9,496 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1414],{18539:function(p){/*! For license information please see amazon-ivs-web-broadcast.js.LICENSE.txt */self,p.exports=(()=>{var p={79(p,_,Z){var et=Z(3702),el=Z(80),eu=Z(4739),ed=Z(8655),eh=Z(1175);function c(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}c.prototype.clear=et,c.prototype.delete=el,c.prototype.get=eu,c.prototype.has=ed,c.prototype.set=eh,p.exports=c},80(p,_,Z){var et=Z(6025),el=Array.prototype.splice;p.exports=function(p){var _=this.__data__,Z=et(_,p);return!(Z<0)&&(Z==_.length-1?_.pop():el.call(_,Z,1),--this.size,!0)}},181(p){p.exports=function(p){var _=[];if(null!=p)for(var Z in Object(p))_.push(Z);return _}},228(p){"use strict";var _=Object.prototype.hasOwnProperty,Z="~";function r(){}function i(p,_,Z){this.fn=p,this.context=_,this.once=Z||!1}function o(p,_,et,el,eu){if("function"!=typeof et)throw TypeError("The listener must be a function");var ed=new i(et,el||p,eu),eh=Z?Z+_:_;return p._events[eh]?p._events[eh].fn?p._events[eh]=[p._events[eh],ed]:p._events[eh].push(ed):(p._events[eh]=ed,p._eventsCount++),p}function s(p,_){0==--p._eventsCount?p._events=new r:delete p._events[_]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(Z=!1)),a.prototype.eventNames=function(){var p,et,el=[];if(0===this._eventsCount)return el;for(et in p=this._events)_.call(p,et)&&el.push(Z?et.slice(1):et);return Object.getOwnPropertySymbols?el.concat(Object.getOwnPropertySymbols(p)):el},a.prototype.listeners=function(p){var _=Z?Z+p:p,et=this._events[_];if(!et)return[];if(et.fn)return[et.fn];for(var el=0,eu=et.length,ed=Array(eu);el<eu;el++)ed[el]=et[el].fn;return ed},a.prototype.listenerCount=function(p){var _=Z?Z+p:p,et=this._events[_];return et?et.fn?1:et.length:0},a.prototype.emit=function(p,_,et,el,eu,ed){var eh=Z?Z+p:p;if(!this._events[eh])return!1;var ep,ef,eg=this._events[eh],ev=arguments.length;if(eg.fn){switch(eg.once&&this.removeListener(p,eg.fn,void 0,!0),ev){case 1:return eg.fn.call(eg.context),!0;case 2:return eg.fn.call(eg.context,_),!0;case 3:return eg.fn.call(eg.context,_,et),!0;case 4:return eg.fn.call(eg.context,_,et,el),!0;case 5:return eg.fn.call(eg.context,_,et,el,eu),!0;case 6:return eg.fn.call(eg.context,_,et,el,eu,ed),!0}for(ef=1,ep=Array(ev-1);ef<ev;ef++)ep[ef-1]=arguments[ef];eg.fn.apply(eg.context,ep)}else{var em,eE=eg.length;for(ef=0;ef<eE;ef++)switch(eg[ef].once&&this.removeListener(p,eg[ef].fn,void 0,!0),ev){case 1:eg[ef].fn.call(eg[ef].context);break;case 2:eg[ef].fn.call(eg[ef].context,_);break;case 3:eg[ef].fn.call(eg[ef].context,_,et);break;case 4:eg[ef].fn.call(eg[ef].context,_,et,el);break;default:if(!ep)for(em=1,ep=Array(ev-1);em<ev;em++)ep[em-1]=arguments[em];eg[ef].fn.apply(eg[ef].context,ep)}}return!0},a.prototype.on=function(p,_,Z){return o(this,p,_,Z,!1)},a.prototype.once=function(p,_,Z){return o(this,p,_,Z,!0)},a.prototype.removeListener=function(p,_,et,el){var eu=Z?Z+p:p;if(!this._events[eu])return this;if(!_)return s(this,eu),this;var ed=this._events[eu];if(ed.fn)ed.fn!==_||el&&!ed.once||et&&ed.context!==et||s(this,eu);else{for(var eh=0,ep=[],ef=ed.length;eh<ef;eh++)(ed[eh].fn!==_||el&&!ed[eh].once||et&&ed[eh].context!==et)&&ep.push(ed[eh]);ep.length?this._events[eu]=1===ep.length?ep[0]:ep:s(this,eu)}return this},a.prototype.removeAllListeners=function(p){var _;return p?(_=Z?Z+p:p,this._events[_]&&s(this,_)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=Z,a.EventEmitter=a,p.exports=a},289(p,_,Z){var et=Z(2651);p.exports=function(p){return et(this,p).get(p)}},294(p){p.exports=function(p){return"number"==typeof p&&p>-1&&p%1==0&&p<=9007199254740991}},346(p){p.exports=function(p){return null!=p&&"object"==typeof p}},361(p){var _=/^(?:0|[1-9]\d*)$/;p.exports=function(p,Z){var et=typeof p;return!!(Z=null==Z?9007199254740991:Z)&&("number"==et||"symbol"!=et&&_.test(p))&&p>-1&&p%1==0&&p<Z}},392(p){p.exports=function(p,_){return null==p?void 0:p[_]}},659(p,_,Z){var et=Z(1873),el=Object.prototype,eu=el.hasOwnProperty,ed=el.toString,eh=et?et.toStringTag:void 0;p.exports=function(p){var _=eu.call(p,eh),Z=p[eh];try{p[eh]=void 0;var et=!0}catch(p){}var el=ed.call(p);return et&&(_?p[eh]=Z:delete p[eh]),el}},695(p,_,Z){var et=Z(8096),el=Z(2428),eu=Z(6449),ed=Z(3656),eh=Z(361),ep=Z(7167),ef=Object.prototype.hasOwnProperty;p.exports=function(p,_){var Z=eu(p),eg=!Z&&el(p),ev=!Z&&!eg&&ed(p),em=!Z&&!eg&&!ev&&ep(p),eE=Z||eg||ev||em,eS=eE?et(p.length,String):[],e_=eS.length;for(var ey in p)!_&&!ef.call(p,ey)||eE&&("length"==ey||ev&&("offset"==ey||"parent"==ey)||em&&("buffer"==ey||"byteLength"==ey||"byteOffset"==ey)||eh(ey,e_))||eS.push(ey);return eS}},938(p){p.exports=function(p){var _=this.__data__,Z=_.delete(p);return this.size=_.size,Z}},945(p,_,Z){var et=Z(79),el=Z(8223),eu=Z(3661);p.exports=function(p,_){var Z=this.__data__;if(Z instanceof et){var ed=Z.__data__;if(!el||ed.length<199)return ed.push([p,_]),this.size=++Z.size,this;Z=this.__data__=new eu(ed)}return Z.set(p,_),this.size=Z.size,this}},999(p,_,Z){var et=Z(9302),el=Z(6800);p.exports=function(p){return et(function(_,Z){var et=-1,eu=Z.length,ed=eu>1?Z[eu-1]:void 0,eh=eu>2?Z[2]:void 0;for(ed=p.length>3&&"function"==typeof ed?(eu--,ed):void 0,eh&&el(Z[0],Z[1],eh)&&(ed=eu<3?void 0:ed,eu=1),_=Object(_);++et<eu;){var ep=Z[et];ep&&p(_,ep,et,ed)}return _})}},1033(p){p.exports=function(p,_,Z){switch(Z.length){case 0:return p.call(_);case 1:return p.call(_,Z[0]);case 2:return p.call(_,Z[0],Z[1]);case 3:return p.call(_,Z[0],Z[1],Z[2])}return p.apply(_,Z)}},1042(p,_,Z){var et=Z(6110)(Object,"create");p.exports=et},1175(p,_,Z){var et=Z(6025);p.exports=function(p,_){var Z=this.__data__,el=et(Z,p);return el<0?(++this.size,Z.push([p,_])):Z[el][1]=_,this}},1331(p,_,Z){var et=Z(2552),el=Z(8879),eu=Z(346),ed=Object.prototype,eh=Function.prototype.toString,ep=ed.hasOwnProperty,ef=eh.call(Object);p.exports=function(p){if(!eu(p)||"[object Object]"!=et(p))return!1;var _=el(p);if(null===_)return!0;var Z=ep.call(_,"constructor")&&_.constructor;return"function"==typeof Z&&Z instanceof Z&&eh.call(Z)==ef}},1420(p,_,Z){var et=Z(79);p.exports=function(){this.__data__=new et,this.size=0}},1549(p,_,Z){var et=Z(2032),el=Z(3862),eu=Z(6721),ed=Z(2749),eh=Z(5749);function c(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}c.prototype.clear=et,c.prototype.delete=el,c.prototype.get=eu,c.prototype.has=ed,c.prototype.set=eh,p.exports=c},1791(p,_,Z){var et=Z(6547),el=Z(3360);p.exports=function(p,_,Z,eu){var ed=!Z;Z||(Z={});for(var eh=-1,ep=_.length;++eh<ep;){var ef=_[eh],eg=eu?eu(Z[ef],p[ef],ef,Z,p):void 0;void 0===eg&&(eg=p[ef]),ed?el(Z,ef,eg):et(Z,ef,eg)}return Z}},1811(p){var _=Date.now;p.exports=function(p){var Z=0,et=0;return function(){var el=_(),eu=16-(el-et);if(et=el,eu>0){if(++Z>=800)return arguments[0]}else Z=0;return p.apply(void 0,arguments)}}},1873(p,_,Z){var et=Z(9325).Symbol;p.exports=et},1882(p,_,Z){var et=Z(2552),el=Z(3805);p.exports=function(p){if(!el(p))return!1;var _=et(p);return"[object Function]"==_||"[object GeneratorFunction]"==_||"[object AsyncFunction]"==_||"[object Proxy]"==_}},1961(p,_,Z){var et=Z(9653);p.exports=function(p,_){var Z=_?et(p.buffer):p.buffer;return new p.constructor(Z,p.byteOffset,p.length)}},2032(p,_,Z){var et=Z(1042);p.exports=function(){this.__data__=et?et(null):{},this.size=0}},2428(p,_,Z){var et=Z(7534),el=Z(346),eu=Object.prototype,ed=eu.hasOwnProperty,eh=eu.propertyIsEnumerable,ep=et(function(){return arguments}())?et:function(p){return el(p)&&ed.call(p,"callee")&&!eh.call(p,"callee")};p.exports=ep},2543(p,_,Z){var et;p=Z.nmd(p),(function(){var el,eu="Expected a function",ed="__lodash_hash_undefined__",eh="__lodash_placeholder__",ep=1/0,ef=NaN,eg=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],ev="[object Arguments]",em="[object Array]",eE="[object Boolean]",eS="[object Date]",e_="[object Error]",ey="[object Function]",eb="[object GeneratorFunction]",eC="[object Map]",eT="[object Number]",eI="[object Object]",eR="[object Promise]",eO="[object RegExp]",eA="[object Set]",ek="[object String]",ew="[object Symbol]",eN="[object WeakMap]",eD="[object ArrayBuffer]",eP="[object DataView]",eM="[object Float32Array]",eL="[object Float64Array]",ex="[object Int8Array]",eU="[object Int16Array]",eB="[object Int32Array]",ej="[object Uint8Array]",eV="[object Uint8ClampedArray]",eF="[object Uint16Array]",eG="[object Uint32Array]",eH=/\b__p \+= '';/g,eW=/\b(__p \+=) '' \+/g,eq=/(__e\(.*?\)|\b__t\)) \+\n'';/g,e$=/&(?:amp|lt|gt|quot|#39);/g,eK=/[&<>"']/g,ez=RegExp(e$.source),eJ=RegExp(eK.source),eX=/<%-([\s\S]+?)%>/g,eY=/<%([\s\S]+?)%>/g,eQ=/<%=([\s\S]+?)%>/g,eZ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,e0=/^\w*$/,e1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e2=/[\\^$.*+?()[\]{}|]/g,e3=RegExp(e2.source),e4=/^\s+/,e5=/\s/,e9=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,e6=/\{\n\/\* \[wrapped with (.+)\] \*/,e8=/,? & /,e7=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tt=/[()=,{}\[\]\/\s]/,ti=/\\(\\)?/g,tl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tu=/\w*$/,td=/^[-+]0x[0-9a-f]+$/i,th=/^0b[01]+$/i,tp=/^\[object .+?Constructor\]$/,tf=/^0o[0-7]+$/i,tg=/^(?:0|[1-9]\d*)$/,tv=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 9,154 bytes, line 1
17f]/g,tm=/($^)/,tE=/['\n\r\u2028\u2029\\]/g,tS="\ud800-\udfff",t_="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ty="\\u2700-\\u27bf",tb="a-z\\xdf-\\xf6\\xf8-\\xff",tC="A-Z\\xc0-\\xd6\\xd8-\\xde",tT="\\ufe0e\\ufe0f",tI="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",tR="["+tI+"]",tO="["+t_+"]",tA="["+tb+"]",tk="[^"+tS+tI+"\\d+"+ty+tb+tC+"]",tw="\ud83c[\udffb-\udfff]",tN="[^"+tS+"]",tD="(?:\ud83c[\udde6-\uddff]){2}",tP="[\ud800-\udbff][\udc00-\udfff]",tM="["+tC+"]",tL="\\u200d",tx="(?:"+tA+"|"+tk+")",tU="(?:['â](?:d|ll|m|re|s|t|ve))?",tB="(?:['â](?:D|LL|M|RE|S|T|VE))?",tj="(?:"+tO+"|"+tw+")?",tV="["+tT+"]?",tF=tV+tj+("(?:"+tL+"(?:"+[tN,tD,tP].join("|"))+")"+tV+tj+")*",tG="(?:"+["["+ty+"]",tD,tP].join("|")+")"+tF,tH="(?:"+[tN+tO+"?",tO,tD,tP,"["+tS+"]"].join("|")+")",tW=RegExp("['â]","g"),tq=RegExp(tO,"g"),t$=RegExp(tw+"(?="+tw+")|"+tH+tF,"g"),tK=RegExp([tM+"?"+tA+"+"+tU+"(?="+[tR,tM,"$"].join("|")+")","(?:"+tM+"|"+tk+")+"+tB+"(?="+[tR,tM+tx,"$"].join("|")+")",tM+"?"+tx+"+"+tU,tM+"+"+tB,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",tG].join("|"),"g"),tz=RegExp("["+tL+tS+t_+tT+"]"),tJ=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tX=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],tY=-1,tQ={};tQ[eM]=tQ[eL]=tQ[ex]=tQ[eU]=tQ[eB]=tQ[ej]=tQ[eV]=tQ[eF]=tQ[eG]=!0,tQ[ev]=tQ[em]=tQ[eD]=tQ[eE]=tQ[eP]=tQ[eS]=tQ[e_]=tQ[ey]=tQ[eC]=tQ[eT]=tQ[eI]=tQ[eO]=tQ[eA]=tQ[ek]=tQ[eN]=!1;var tZ={};tZ[ev]=tZ[em]=tZ[eD]=tZ[eP]=tZ[eE]=tZ[eS]=tZ[eM]=tZ[eL]=tZ[ex]=tZ[eU]=tZ[eB]=tZ[eC]=tZ[eT]=tZ[eI]=tZ[eO]=tZ[eA]=tZ[ek]=tZ[ew]=tZ[ej]=tZ[eV]=tZ[eF]=tZ[eG]=!0,tZ[e_]=tZ[ey]=tZ[eN]=!1;var t0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},t1=parseFloat,t2=parseInt,t3="object"==typeof Z.g&&Z.g&&Z.g.Object===Object&&Z.g,t4="object"==typeof self&&self&&self.Object===Object&&self,t5=t3||t4||Function("return this")(),t9=_&&!_.nodeType&&_,t6=t9&&p&&!p.nodeType&&p,t8=t6&&t6.exports===t9,t7=t8&&t3.process,ri=function(){try{return t6&&t6.require&&t6.require("util").types||t7&&t7.binding&&t7.binding("util")}catch(p){}}(),rs=ri&&ri.isArrayBuffer,rc=ri&&ri.isDate,rl=ri&&ri.isMap,ru=ri&&ri.isRegExp,rd=ri&&ri.isSet,rh=ri&&ri.isTypedArray;function Ot(p,_,Z){switch(Z.length){case 0:return p.call(_);case 1:return p.call(_,Z[0]);case 2:return p.call(_,Z[0],Z[1]);case 3:return p.call(_,Z[0],Z[1],Z[2])}return p.apply(_,Z)}function wt(p,_,Z,et){for(var el=-1,eu=null==p?0:p.length;++el<eu;){var ed=p[el];_(et,ed,Z(ed),p)}return et}function At(p,_){for(var Z=-1,et=null==p?0:p.length;++Z<et&&!1!==_(p[Z],Z,p););return p}function Nt(p,_){for(var Z=-1,et=null==p?0:p.length;++Z<et;)if(!_(p[Z],Z,p))return!1;return!0}function Dt(p,_){for(var Z=-1,et=null==p?0:p.length,el=0,eu=[];++Z<et;){var ed=p[Z];_(ed,Z,p)&&(eu[el++]=ed)}return eu}function Pt(p,_){return!!(null==p?0:p.length)&&Ht(p,_,0)>-1}function Mt(p,_,Z){for(var et=-1,el=null==p?0:p.length;++et<el;)if(Z(_,p[et]))return!0;return!1}function Lt(p,_){for(var Z=-1,et=null==p?0:p.length,el=Array(et);++Z<et;)el[Z]=_(p[Z],Z,p);return el}function xt(p,_){for(var Z=-1,et=_.length,el=p.length;++Z<et;)p[el+Z]=_[Z];return p}function Ut(p,_,Z,et){var el=-1,eu=null==p?0:p.length;for(et&&eu&&(Z=p[++el]);++el<eu;)Z=_(Z,p[el],el,p);return Z}function Bt(p,_,Z,et){var el=null==p?0:p.length;for(et&&el&&(Z=p[--el]);el--;)Z=_(Z,p[el],el,p);return Z}function jt(p,_){for(var Z=-1,et=null==p?0:p.length;++Z<et;)if(_(p[Z],Z,p))return!0;return!1}var rp=Kt("length");function Vt(p,_,Z){var et;return Z(p,function(p,Z,el){if(_(p,Z,el))return et=Z,!1}),et}function Gt(p,_,Z,et){for(var el=p.length,eu=Z+(et?1:-1);et?eu--:++eu<el;)if(_(p[eu],eu,p))return eu;return -1}function Ht(p,_,Z){return _==_?function(p,_,Z){for(var et=Z-1,el=p.length;++et<el;)if(p[et]===_)return et;return -1}(p,_,Z):Gt(p,Wt,Z)}function qt(p,_,Z,et){for(var el=Z-1,eu=p.length;++el<eu;)if(et(p[el],_))return el;return -1}function Wt(p){return p!=p}function $t(p,_){var Z=null==p?0:p.length;return Z?Yt(p,_)/Z:ef}function Kt(p){return function(_){return null==_?el:_[p]}}function zt(p){return function(_){return null==p?el:p[_]}}function Jt(p,_,Z,et,el){return el(p,function(p,el,eu){Z=et?(et=!1,p):_(Z,p,el,eu)}),Z}function Yt(p,_){for(var Z,et=-1,eu=p.length;++et<eu;){var ed=_(p[et]);ed!==el&&(Z=Z===el?ed:Z+ed)}return Z}function Xt(p,_){for(var Z=-1,et=Array(p);++Z<p;)et[Z]=_(Z);return et}function Qt(p){return p?p.slice(0,vn(p)+1).replace(e4,""):p}function Zt(p){return function(_){return p(_)}}function en(p,_){return Lt(_,function(_){return p[_]})}function tn(p,_){return p.has(_)}function nn(p,_){for(var Z=-1,et=p.length;++Z<et&&Ht(_,p[Z],0)>-1;);return Z}function rn(p,_){for(var Z=p.length;Z--&&Ht(_,p[Z],0)>-1;);return Z}var rf=zt({Ã:"A",Ã:"A",Ã:"A",Ã:"A",Ã:"A",Ã
:"A",à :"a",á:"a",â:"a",ã:"a",ä:"a",Ã¥:"a",Ã:"C",ç:"c",Ã:"D",ð:"d",Ã:"E",Ã:"E",Ã:"E",Ã:"E",è:"e",é:"e",ê:"e",ë:"e",Ã:"I",Ã:"I",Ã:"I",Ã:"I",ì:"i",Ã:"i",î:"i",ï:"i",Ã:"N",ñ:"n",Ã:"O",Ã:"O",Ã:"O",Ã:"O",Ã:"O",Ã:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ã:"U",Ã:"U",Ã:"U",Ã:"U",ù:"u",ú:"u",û:"u",ü:"u",Ã:"Y",ý:"y",ÿ:"y",Ã:"Ae",æ:"ae",Ã:"Th",þ:"th",Ã:"ss",Ä:"A",Ä:"A",Ä:"A",Ä:"a",Ä:"a",Ä
:"a",Ä:"C",Ä:"C",Ä:"C",Ä:"C",Ä:"c",Ä:"c",Ä:"c",Ä:"c",Ä:"D",Ä:"D",Ä:"d",Ä:"d",Ä:"E",Ä:"E",Ä:"E",Ä:"E",Ä:"E",Ä:"e",Ä:"e",Ä:"e",Ä:"e",Ä:"e",Ä:"G",Ä:"G",Ä :"G",Ä¢:"G",Ä:"g",Ä:"g",Ä¡:"g",Ä£:"g",Ĥ:"H",Ħ:"H",Ä¥:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Ä®:"I",İ:"I",Ä©:"i",Ä«:"i",Ä:"i",į:"i",ı:"i",Ä´:"J",ĵ:"j",Ķ:"K",Ä·:"k",ĸ:"k",Ĺ:"L",Ä»:"L",Ľ:"L",Ä¿:"L",Å:"L",ĺ:"l",ļ:"l",ľ:"l",Å:"l",Å:"l",Å:"N",Å
:"N",Å:"N",Å:"N",Å:"n",Å:"n",Å:"n",Å:"n",Å:"O",Å:"O",Å:"O",Å:"o",Å:"o",Å:"o",Å:"R",Å:"R",Å:"R",Å:"r",Å:"r",Å:"r",Å:"S",Å:"S",Å:"S",Å :"S",Å:"s",Å:"s",Å:"s",Å¡:"s",Å¢:"T",Ť:"T",Ŧ:"T",Å£:"t",Å¥:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Å®:"U",Ű:"U",Ų:"U",Å©:"u",Å«:"u",Å:"u",ů:"u",ű:"u",ų:"u",Å´:"W",ŵ:"w",Ŷ:"Y",Å·:"y",Ÿ:"Y",Ź:"Z",Å»:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Å:"Oe",Å:"oe",Å:"'n",Å¿:"s"}),rg=zt({"&":"&","<":"<",">":">",'"':""","'":"'"});function an(p){return"\\"+t0[p]}function cn(p){return tz.test(p)}function un(p){var _=-1,Z=Array(p.size);return p.forEach(function(p,et){Z[++_]=[et,p]}),Z}function ln(p,_){return function(Z){return p(_(Z))}}function dn(p,_){for(var Z=-1,et=p.length,el=0,eu=[];++Z<et;){var ed=p[Z];ed!==_&&ed!==eh||(p[Z]=eh,eu[el++]=Z)}return eu}function hn(p){var _=-1,Z=Array(p.size);return p.forEach(function(p){Z[++_]=p}),Z}function fn(p){return cn(p)?function(p){for(var _=t$.lastIndex=0;t$.test(p);)++_;return _}(p):rp(p)}function gn(p){return cn(p)?p.match(t$)||[]:p.split("")}function vn(p){for(var _=p.length;_--&&e5.test(p.charAt(_)););return _}var rv=zt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rm=function e(p){var _,Z=(p=null==p?t5:rm.defaults(t5.Object(),p,rm.pick(t5,tX))).Array,et=p.Date,e5=p.Error,tS=p.Function,t_=p.Math,ty=p.Object,tb=p.RegExp,tC=p.String,tT=p.TypeError,tI=Z.prototype,tR=tS.prototype,tO=ty.prototype,tA=p["__core-js_shared__"],tk=tR.toString,tw=tO.hasOwnProperty,tN=0,tD=(_=/[^.]+$/.exec(tA&&tA.keys&&tA.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"",tP=tO.toString,tM=tk.call(ty),tL=t5._,tx=tb("^"+tk.call(tw).replace(e2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tU=t8?p.Buffer:el,tB=p.Symbol,tj=p.Uint8Array,tV=tU?tU.allocUnsafe:el,tF=ln(ty.getPrototypeOf,ty),tG=ty.create,tH=tO.propertyIsEnumerable,t$=tI.splice,tz=tB?tB.isConcatSpreadable:el,t0=tB?tB.iterator:el,t3=tB?tB.toStringTag:el,t4=function(){try{var p=po(ty,"defineProperty");return p({},"",{}),p}catch(p){}}(),t9=p.clearTimeout!==t5.clearTimeout&&p.clearTimeout,t6=et&&et.now!==t5.Date.now&&et.now,t7=p.setTimeout!==t5.setTimeout&&p.setTimeout,ri=t_.ceil,rp=t_.floor,rE=ty.getOwnPropertySymbols,rS=tU?tU.isBuffer:el,r_=p.isFinite,ry=tI.join,rb=ln(ty.keys,ty),rC=t_.max,rT=t_.min,rI=et.now,rR=p.parseInt,rO=t_.random,rA=tI.reverse,rk=po(p,"DataView"),rw=po(p,"Map"),rN=po(p,"Promise"),rD=po(p,"Set"),rP=po(p,"WeakMap"),rM=po(ty,"create"),rL=rP&&new rP,rx={},rU=jo(rk),rB=jo(rw),rj=jo(rN),rV=jo(rD),rF=jo(rP),rG=tB?tB.prototype:el,rH=rG?rG.valueOf:el,rW=rG?rG.toString:el;function Vn(p){if(na(p)&&!nH(p)&&!(p instanceof Wn)){if(p instanceof qn)return p;if(tw.call(p,"__wrapped__"))return Fo(p)}return new qn(p)}var rq=function(){function e(){}return function(p){if(!ta(p))return{};if(tG)return tG(p);e.prototype=p;var _=new e;return e.prototype=el,_}}();function Hn(){}function qn(p,_){this.__wrapped__=p,this.__actions__=[],this.__chain__=!!_,this.__index__=0,this.__values__=el}
vendor: 5,072 bytes, line 1
1function Wn(p){this.__wrapped__=p,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function $n(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}function Kn(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}function zn(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}function Jn(p){var _=-1,Z=null==p?0:p.length;for(this.__data__=new zn;++_<Z;)this.add(p[_])}function Yn(p){var _=this.__data__=new Kn(p);this.size=_.size}function Xn(p,_){var Z=nH(p),et=!Z&&nG(p),el=!Z&&!et&&nq(p),eu=!Z&&!et&&!el&&nX(p),ed=Z||et||el||eu,eh=ed?Xt(p.length,tC):[],ep=eh.length;for(var ef in p)!_&&!tw.call(p,ef)||ed&&("length"==ef||el&&("offset"==ef||"parent"==ef)||eu&&("buffer"==ef||"byteLength"==ef||"byteOffset"==ef)||_o(ef,ep))||eh.push(ef);return eh}function Qn(p){var _=p.length;return _?p[Jr(0,_-1)]:el}function tr(p,_,Z){(Z===el||Vs(p[_],Z))&&(Z!==el||_ in p)||sr(p,_,Z)}function nr(p,_,Z){var et=p[_];tw.call(p,_)&&Vs(et,Z)&&(Z!==el||_ in p)||sr(p,_,Z)}function rr(p,_){for(var Z=p.length;Z--;)if(Vs(p[Z][0],_))return Z;return -1}function ir(p,_,Z,et){return r$(p,function(p,el,eu){_(et,p,Z(p),eu)}),et}function or(p,_){return p&&Ni(_,Da(_),p)}function sr(p,_,Z){"__proto__"==_&&t4?t4(p,_,{configurable:!0,enumerable:!0,value:Z,writable:!0}):p[_]=Z}function ar(p,_){for(var et=-1,eu=_.length,ed=Z(eu),eh=null==p;++et<eu;)ed[et]=eh?el:Oa(p,_[et]);return ed}function cr(p,_,Z){return p==p&&(Z!==el&&(p=p<=Z?p:Z),_!==el&&(p=p>=_?p:_)),p}function ur(p,_,Z,et,eu,ed){var eh,ep=1&_,ef=2&_,eg=4&_;if(Z&&(eh=eu?Z(p,et,eu,ed):Z(p)),eh!==el)return eh;if(!ta(p))return p;var em=nH(p);if(em){if(e_=p.length,eR=new p.constructor(e_),e_&&"string"==typeof p[0]&&tw.call(p,"index")&&(eR.index=p.index,eR.input=p.input),eh=eR,!ep)return ki(p,eh)}else{var e_,eR,eN,eH,eW,eq=r3(p),e$=eq==ey||eq==eb;if(nq(p))return Ti(p,ep);if(eq==eI||eq==ev||e$&&!eu){if(eh=ef||e$?{}:Eo(p),!ep)return ef?(eH=(eN=eh)&&Ni(p,Pa(p),eN),Ni(p,r2(p),eH)):(eW=or(eh,p),Ni(p,r1(p),eW))}else{if(!tZ[eq])return eu?p:{};eh=function(p,_,Z){var et,el,eu=p.constructor;switch(_){case eD:return Ii(p);case eE:case eS:return new eu(+p);case eP:return et=Z?Ii(p.buffer):p.buffer,new p.constructor(et,p.byteOffset,p.byteLength);case eM:case eL:case ex:case eU:case eB:case ej:case eV:case eF:case eG:return Ri(p,Z);case eC:return new eu;case eT:case ek:return new eu(p);case eO:return(el=new p.constructor(p.source,tu.exec(p))).lastIndex=p.lastIndex,el;case eA:return new eu;case ew:return rH?ty(rH.call(p)):{}}}(p,eq,ep)}}ed||(ed=new Yn);var eK=ed.get(p);if(eK)return eK;ed.set(p,eh),nJ(p)?p.forEach(function(et){eh.add(ur(et,_,Z,et,p,ed))}):nK(p)&&p.forEach(function(et,el){eh.set(el,ur(et,_,Z,el,p,ed))});var ez=em?el:(eg?ef?function(p){return Ir(p,Pa,r2)}:function(p){return Ir(p,Da,r1)}:ef?Pa:Da)(p);return At(ez||p,function(et,el){ez&&(et=p[el=et]),nr(eh,el,ur(et,_,Z,el,p,ed))}),eh}function lr(p,_,Z){var et=Z.length;if(null==p)return!et;for(p=ty(p);et--;){var eu=Z[et],ed=_[eu],eh=p[eu];if(eh===el&&!(eu in p)||!ed(eh))return!1}return!0}function dr(p,_,Z){if("function"!=typeof p)throw new tT(eu);return r9(function(){p.apply(el,Z)},_)}function hr(p,_,Z,et){var el=-1,eu=Pt,ed=!0,eh=p.length,ep=[],ef=_.length;if(!eh)return ep;Z&&(_=Lt(_,Zt(Z))),et?(eu=Mt,ed=!1):_.length>=200&&(eu=tn,ed=!1,_=new Jn(_));e:for(;++el<eh;){var eg=p[el],ev=null==Z?eg:Z(eg);if(eg=et||0!==eg?eg:0,ed&&ev==ev){for(var em=ef;em--;)if(_[em]===ev)continue e;ep.push(eg)}else eu(_,ev,et)||ep.push(eg)}return ep}Vn.templateSettings={escape:eX,evaluate:eY,interpolate:eQ,variable:"",imports:{_:Vn}},Vn.prototype=Hn.prototype,Vn.prototype.constructor=Vn,qn.prototype=rq(Hn.prototype),qn.prototype.constructor=qn,Wn.prototype=rq(Hn.prototype),Wn.prototype.constructor=Wn,$n.prototype.clear=function(){this.__data__=rM?rM(null):{},this.size=0},$n.prototype.delete=function(p){var _=this.has(p)&&delete this.__data__[p];return this.size-=_?1:0,_},$n.prototype.get=function(p){var _=this.__data__;if(rM){var Z=_[p];return Z===ed?el:Z}return tw.call(_,p)?_[p]:el},$n.prototype.has=function(p){var _=this.__data__;return rM?_[p]!==el:tw.call(_,p)},$n.prototype.set=function(p,_){var Z=this.__data__;return this.size+=this.has(p)?0:1,Z[p]=rM&&_===el?ed:_,this},Kn.prototype.clear=function(){this.__data__=[],this.size=0},Kn.prototype.delete=function(p){var _=this.__data__,Z=rr(_,p);return!(Z<0)&&(Z==_.length-1?_.pop():t$.call(_,Z,1),--this.size,!0)},Kn.prototype.get=function(p){var _=this.__data__,Z=rr(_,p);return Z<0?el:_[Z][1]},Kn.prototype.has=function(p){return rr(this.__data__,p)>-1},Kn.prototype.set=function(p,_){var Z=this.__data__,et=rr(Z,p);return et<0?(++this.size,Z.push([p,_])):Z[et][1]=_,this},zn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(rw||Kn),string:new $n}},zn.prototype.delete=function(p){var _=lo(this,p).delete(p);return this.size-=_?1:0,_},zn.prototype.get=function(p){return lo(this,p).get(p)}
vendor: 3,587 bytes, line 1
1,zn.prototype.has=function(p){return lo(this,p).has(p)},zn.prototype.set=function(p,_){var Z=lo(this,p),et=Z.size;return Z.set(p,_),this.size+=Z.size==et?0:1,this},Jn.prototype.add=Jn.prototype.push=function(p){return this.__data__.set(p,ed),this},Jn.prototype.has=function(p){return this.__data__.has(p)},Yn.prototype.clear=function(){this.__data__=new Kn,this.size=0},Yn.prototype.delete=function(p){var _=this.__data__,Z=_.delete(p);return this.size=_.size,Z},Yn.prototype.get=function(p){return this.__data__.get(p)},Yn.prototype.has=function(p){return this.__data__.has(p)},Yn.prototype.set=function(p,_){var Z=this.__data__;if(Z instanceof Kn){var et=Z.__data__;if(!rw||et.length<199)return et.push([p,_]),this.size=++Z.size,this;Z=this.__data__=new zn(et)}return Z.set(p,_),this.size=Z.size,this};var r$=Mi(yr),rK=Mi(br,!0);function gr(p,_){var Z=!0;return r$(p,function(p,et,el){return Z=!!_(p,et,el)}),Z}function vr(p,_,Z){for(var et=-1,eu=p.length;++et<eu;){var ed=p[et],eh=_(ed);if(null!=eh&&(ep===el?eh==eh&&!ua(eh):Z(eh,ep)))var ep=eh,ef=ed}return ef}function mr(p,_){var Z=[];return r$(p,function(p,et,el){_(p,et,el)&&Z.push(p)}),Z}function Er(p,_,Z,et,el){var eu=-1,ed=p.length;for(Z||(Z=So),el||(el=[]);++eu<ed;){var eh=p[eu];_>0&&Z(eh)?_>1?Er(eh,_-1,Z,et,el):xt(el,eh):et||(el[el.length]=eh)}return el}var rz=Li(),rJ=Li(!0);function yr(p,_){return p&&rz(p,_,Da)}function br(p,_){return p&&rJ(p,_,Da)}function Cr(p,_){return Dt(_,function(_){return Qs(p[_])})}function Tr(p,_){for(var Z=0,et=(_=_i(_,p)).length;null!=p&&Z<et;)p=p[Bo(_[Z++])];return Z&&Z==et?p:el}function Ir(p,_,Z){var et=_(p);return nH(p)?et:xt(et,Z(p))}function Rr(p){return null==p?p===el?"[object Undefined]":"[object Null]":t3&&t3 in ty(p)?function(p){var _=tw.call(p,t3),Z=p[t3];try{p[t3]=el;var et=!0}catch(p){}var eu=tP.call(p);return et&&(_?p[t3]=Z:delete p[t3]),eu}(p):tP.call(p)}function Or(p,_){return p>_}function wr(p,_){return null!=p&&tw.call(p,_)}function Ar(p,_){return null!=p&&_ in ty(p)}function kr(p,_,et){for(var eu=et?Mt:Pt,ed=p[0].length,eh=p.length,ep=eh,ef=Z(eh),eg=1/0,ev=[];ep--;){var em=p[ep];ep&&_&&(em=Lt(em,Zt(_))),eg=rT(em.length,eg),ef[ep]=!et&&(_||ed>=120&&em.length>=120)?new Jn(ep&&em):el}em=p[0];var eE=-1,eS=ef[0];e:for(;++eE<ed&&ev.length<eg;){var e_=em[eE],ey=_?_(e_):e_;if(e_=et||0!==e_?e_:0,!(eS?tn(eS,ey):eu(ev,ey,et))){for(ep=eh;--ep;){var eb=ef[ep];if(!(eb?tn(eb,ey):eu(p[ep],ey,et)))continue e}eS&&eS.push(ey),ev.push(e_)}}return ev}function Nr(p,_,Z){var et=null==(p=Ao(p,_=_i(_,p)))?p:p[Bo(Xo(_))];return null==et?el:Ot(et,p,Z)}function Dr(p){return na(p)&&Rr(p)==ev}function Pr(p,_,Z,et,eu){return p===_||(null!=p&&null!=_&&(na(p)||na(_))?function(p,_,Z,et,eu,ed){var eh=nH(p),ep=nH(_),ef=eh?em:r3(p),eg=ep?em:r3(_),ey=(ef=ef==ev?eI:ef)==eI,eb=(eg=eg==ev?eI:eg)==eI,eR=ef==eg;if(eR&&nq(p)){if(!nq(_))return!1;eh=!0,ey=!1}if(eR&&!ey)return ed||(ed=new Yn),eh||nX(p)?no(p,_,Z,et,eu,ed):function(p,_,Z,et,el,eu,ed){switch(Z){case eP:if(p.byteLength!=_.byteLength||p.byteOffset!=_.byteOffset)break;p=p.buffer,_=_.buffer;case eD:return!(p.byteLength!=_.byteLength||!eu(new tj(p),new tj(_)));case eE:case eS:case eT:return Vs(+p,+_);case e_:return p.name==_.name&&p.message==_.message;case eO:case ek:return p==_+"";case eC:var eh=un;case eA:var ep=1&et;if(eh||(eh=hn),p.size!=_.size&&!ep)break;var ef=ed.get(p);if(ef)return ef==_;et|=2,ed.set(p,_);var eg=no(eh(p),eh(_),et,el,eu,ed);return ed.delete(p),eg;case ew:if(rH)return rH.call(p)==rH.call(_)}return!1}(p,_,ef,Z,et,eu,ed);if(!(1&Z)){var eN=ey&&tw.call(p,"__wrapped__"),eM=eb&&tw.call(_,"__wrapped__");
vendor: 5,203 bytes, line 1
1if(eN||eM){var eL=eN?p.value():p,ex=eM?_.value():_;return ed||(ed=new Yn),eu(eL,ex,Z,et,ed)}}return!!eR&&(ed||(ed=new Yn),function(p,_,Z,et,eu,ed){var eh=1&Z,ep=Ir(p,Da,r1),ef=ep.length;if(ef!=Ir(_,Da,r1).length&&!eh)return!1;for(var eg=ef;eg--;){var ev=ep[eg];if(!(eh?ev in _:tw.call(_,ev)))return!1}var em=ed.get(p),eE=ed.get(_);if(em&&eE)return em==_&&eE==p;var eS=!0;ed.set(p,_),ed.set(_,p);for(var e_=eh;++eg<ef;){var ey=p[ev=ep[eg]],eb=_[ev];if(et)var eC=eh?et(eb,ey,ev,_,p,ed):et(ey,eb,ev,p,_,ed);if(!(eC===el?ey===eb||eu(ey,eb,Z,et,ed):eC)){eS=!1;break}e_||(e_="constructor"==ev)}if(eS&&!e_){var eT=p.constructor,eI=_.constructor;eT==eI||!("constructor"in p)||!("constructor"in _)||"function"==typeof eT&&eT instanceof eT&&"function"==typeof eI&&eI instanceof eI||(eS=!1)}return ed.delete(p),ed.delete(_),eS}(p,_,Z,et,eu,ed))}(p,_,Z,et,Pr,eu):p!=p&&_!=_)}function Mr(p,_,Z,et){var eu=Z.length,ed=eu,eh=!et;if(null==p)return!ed;for(p=ty(p);eu--;){var ep=Z[eu];if(eh&&ep[2]?ep[1]!==p[ep[0]]:!(ep[0]in p))return!1}for(;++eu<ed;){var ef=(ep=Z[eu])[0],eg=p[ef],ev=ep[1];if(eh&&ep[2]){if(eg===el&&!(ef in p))return!1}else{var em=new Yn;if(et)var eE=et(eg,ev,ef,p,_,em);if(!(eE===el?Pr(ev,eg,3,et,em):eE))return!1}}return!0}function Lr(p){return!(!ta(p)||tD&&tD in p)&&(Qs(p)?tx:tp).test(jo(p))}function xr(p){return"function"==typeof p?p:null==p?ic:"object"==typeof p?nH(p)?Gr(p[0],p[1]):Vr(p):pc(p)}function Ur(p){if(!Io(p))return rb(p);var _=[];for(var Z in ty(p))tw.call(p,Z)&&"constructor"!=Z&&_.push(Z);return _}function jr(p,_){return p<_}function Fr(p,_){var et=-1,el=Ks(p)?Z(p.length):[];return r$(p,function(p,Z,eu){el[++et]=_(p,Z,eu)}),el}function Vr(p){var _=ho(p);return 1==_.length&&_[0][2]?Oo(_[0][0],_[0][1]):function(Z){return Z===p||Mr(Z,p,_)}}function Gr(p,_){var Z;return bo(p)&&(Z=_)==Z&&!ta(Z)?Oo(Bo(p),_):function(Z){var et=Oa(Z,p);return et===el&&et===_?wa(Z,p):Pr(_,et,3)}}function Hr(p,_,Z,et,eu){p!==_&&rz(_,function(ed,eh){if(eu||(eu=new Yn),ta(ed))!function(p,_,Z,et,eu,ed,eh){var ep=ko(p,Z),ef=ko(_,Z),eg=eh.get(ef);if(eg)return void tr(p,Z,eg);var ev=ed?ed(ep,ef,Z+"",p,_,eh):el,em=ev===el;if(em){var eE=nH(ef),eS=!eE&&nq(ef),e_=!eE&&!eS&&nX(ef);ev=ef,eE||eS||e_?nH(ep)?ev=ep:zs(ep)?ev=ki(ep):eS?(em=!1,ev=Ti(ef,!0)):e_?(em=!1,ev=Ri(ef,!0)):ev=[]:oa(ef)||nG(ef)?(ev=ep,nG(ep)?ev=Ea(ep):ta(ep)&&!Qs(ep)||(ev=Eo(ef))):em=!1}em&&(eh.set(ef,ev),eu(ev,ef,et,ed,eh),eh.delete(ef)),tr(p,Z,ev)}(p,_,eh,Z,Hr,et,eu);else{var ep=et?et(ko(p,eh),ed,eh+"",p,_,eu):el;ep===el&&(ep=ed),tr(p,eh,ep)}},Pa)}function qr(p,_){var Z=p.length;if(Z)return _o(_+=_<0?Z:0,Z)?p[_]:el}function Wr(p,_,Z){_=_.length?Lt(_,function(p){return nH(p)?function(_){return Tr(_,1===p.length?p[0]:p)}:p}):[ic];var et=-1;return _=Lt(_,Zt(uo())),function(p,_){var Z=p.length;for(p.sort(_);Z--;)p[Z]=p[Z].value;return p}(Fr(p,function(p,Z,el){return{criteria:Lt(_,function(_){return _(p)}),index:++et,value:p}}),function(p,_){return function(p,_,Z){for(var et=-1,el=p.criteria,eu=_.criteria,ed=el.length,eh=Z.length;++et<ed;){var ep=Oi(el[et],eu[et]);if(ep)return et>=eh?ep:ep*("desc"==Z[et]?-1:1)}return p.index-_.index}(p,_,Z)})}function $r(p,_,Z){for(var et=-1,el=_.length,eu={};++et<el;){var ed=_[et],eh=Tr(p,ed);Z(eh,ed)&&ei(eu,_i(ed,p),eh)}return eu}function Kr(p,_,Z,et){var el=et?qt:Ht,eu=-1,ed=_.length,eh=p;for(p===_&&(_=ki(_)),Z&&(eh=Lt(p,Zt(Z)));++eu<ed;)for(var ep=0,ef=_[eu],eg=Z?Z(ef):ef;(ep=el(eh,eg,ep,et))>-1;)eh!==p&&t$.call(eh,ep,1),t$.call(p,ep,1);return p}function zr(p,_){for(var Z=p?_.length:0,et=Z-1;Z--;){var el=_[Z];if(Z==et||el!==eu){var eu=el;_o(el)?t$.call(p,el,1):hi(p,el)}}return p}function Jr(p,_){return p+rp(rO()*(_-p+1))}function Yr(p,_){var Z="";if(!p||_<1||_>9007199254740991)return Z;do _%2&&(Z+=p),(_=rp(_/2))&&(p+=p);while(_);return Z}function Xr(p,_){return r6(wo(p,_,ic),p+"")}function ei(p,_,Z,et){if(!ta(p))return p;for(var eu=-1,ed=(_=_i(_,p)).length,eh=ed-1,ep=p;null!=ep&&++eu<ed;){var ef=Bo(_[eu]),eg=Z;if("__proto__"===ef||"constructor"===ef||"prototype"===ef)break;if(eu!=eh){var ev=ep[ef];(eg=et?et(ev,ef,ep):el)===el&&(eg=ta(ev)?ev:_o(_[eu+1])?[]:{})}nr(ep,ef,eg),ep=ep[ef]}return p}var rX=rL?function(p,_){return rL.set(p,_),p}:ic,rY=t4?function(p,_){return t4(p,"toString",{configurable:!0,enumerable:!1,value:tc(_),writable:!0})}:ic;function ii(p,_,et){var el=-1,eu=p.length;_<0&&(_=-_>eu?0:eu+_),(et=et>eu?eu:et)<0&&(et+=eu),eu=_>et?0:et-_>>>0,_>>>=0;for(var ed=Z(eu);++el<eu;)ed[el]=p[el+_];return ed}function oi(p,_){var Z;return r$(p,function(p,et,el){return!(Z=_(p,et,el))}),!!Z}function si(p,_,Z){var et=0,el=null==p?et:p.length;if("number"==typeof _&&_==_&&el<=2147483647){for(;et<el;){var eu=et+el>>>1,ed=p[eu];null!==ed&&!ua(ed)&&(Z?ed<=_:ed<_)?et=eu+1:el=eu}return el}return ai(p,_,ic,Z)}function ai(p,_,Z,et){var eu=0,ed=null==p?0:p.length;if(0===ed)return 0;for(var eh=(_=Z(_))!=_,ep=null===_,ef=ua(_),eg=_===el;eu<ed;){var ev=rp((eu+ed)/2),em=Z(p[ev]),eE=em!==el,eS=null===em,e_=em==em,ey=ua(em);if(eh)var eb=et||e_;else eb=eg?e_&&(et||eE):ep?e_&&eE&&(et||!eS):ef?e_&&eE&&!eS&&(et||!ey):!eS&&!ey&&(et?em<=_:em<_);eb?eu=ev+1:ed=ev}return rT(ed,4294967294)}function ci(p,_){for(var Z=-1,et=p.length,el=0,eu=[];++Z<et;){var ed=p[Z],eh=_?_(ed):ed;
vendor: 1,134 bytes, line 1
1if(!Z||!Vs(eh,ep)){var ep=eh;eu[el++]=0===ed?0:ed}}return eu}function ui(p){return"number"==typeof p?p:ua(p)?ef:+p}function li(p){if("string"==typeof p)return p;if(nH(p))return Lt(p,li)+"";if(ua(p))return rW?rW.call(p):"";var _=p+"";return"0"==_&&1/p==-1/0?"-0":_}function di(p,_,Z){var et=-1,el=Pt,eu=p.length,ed=!0,eh=[],ep=eh;if(Z)ed=!1,el=Mt;else if(eu>=200){var ef=_?null:rZ(p);if(ef)return hn(ef);ed=!1,el=tn,ep=new Jn}else ep=_?[]:eh;e:for(;++et<eu;){var eg=p[et],ev=_?_(eg):eg;if(eg=Z||0!==eg?eg:0,ed&&ev==ev){for(var em=ep.length;em--;)if(ep[em]===ev)continue e;_&&ep.push(ev),eh.push(eg)}else el(ep,ev,Z)||(ep!==eh&&ep.push(ev),eh.push(eg))}return eh}function hi(p,_){var Z=-1,et=(_=_i(_,p)).length;if(!et)return!0;for(;++Z<et;){var el=Bo(_[Z]);if("__proto__"===el&&!tw.call(p,"__proto__")||("constructor"===el||"prototype"===el)&&Z<et-1)return!1}var eu=Ao(p,_);return null==eu||delete eu[Bo(Xo(_))]}function pi(p,_,Z,et){return ei(p,_,Z(Tr(p,_)),et)}function fi(p,_,Z,et){for(var el=p.length,eu=et?el:-1;(et?eu--:++eu<el)&&_(p[eu],eu,p););return Z?ii(p,et?0:eu,et?eu+1:el):ii(p,et?eu+1:0,et?el:eu)}function gi(p,_){var Z=p;
vendor: 4,491 bytes, line 1
1return Z instanceof Wn&&(Z=Z.value()),Ut(_,function(p,_){return _.func.apply(_.thisArg,xt([p],_.args))},Z)}function vi(p,_,et){var el=p.length;if(el<2)return el?di(p[0]):[];for(var eu=-1,ed=Z(el);++eu<el;)for(var eh=p[eu],ep=-1;++ep<el;)ep!=eu&&(ed[eu]=hr(ed[eu]||eh,p[ep],_,et));return di(Er(ed,1),_,et)}function mi(p,_,Z){for(var et=-1,eu=p.length,ed=_.length,eh={};++et<eu;){var ep=et<ed?_[et]:el;Z(eh,p[et],ep)}return eh}function Ei(p){return zs(p)?p:[]}function Si(p){return"function"==typeof p?p:ic}function _i(p,_){return nH(p)?p:bo(p,_)?[p]:r8(Sa(p))}function bi(p,_,Z){var et=p.length;return Z=Z===el?et:Z,!_&&Z>=et?p:ii(p,_,Z)}var rQ=t9||function(p){return t5.clearTimeout(p)};function Ti(p,_){if(_)return p.slice();var Z=p.length,et=tV?tV(Z):new p.constructor(Z);return p.copy(et),et}function Ii(p){var _=new p.constructor(p.byteLength);return new tj(_).set(new tj(p)),_}function Ri(p,_){var Z=_?Ii(p.buffer):p.buffer;return new p.constructor(Z,p.byteOffset,p.length)}function Oi(p,_){if(p!==_){var Z=p!==el,et=null===p,eu=p==p,ed=ua(p),eh=_!==el,ep=null===_,ef=_==_,eg=ua(_);if(!ep&&!eg&&!ed&&p>_||ed&&eh&&ef&&!ep&&!eg||et&&eh&&ef||!Z&&ef||!eu)return 1;if(!et&&!ed&&!eg&&p<_||eg&&Z&&eu&&!et&&!ed||ep&&Z&&eu||!eh&&eu||!ef)return -1}return 0}function wi(p,_,et,el){for(var eu=-1,ed=p.length,eh=et.length,ep=-1,ef=_.length,eg=rC(ed-eh,0),ev=Z(ef+eg),em=!el;++ep<ef;)ev[ep]=_[ep];for(;++eu<eh;)(em||eu<ed)&&(ev[et[eu]]=p[eu]);for(;eg--;)ev[ep++]=p[eu++];return ev}function Ai(p,_,et,el){for(var eu=-1,ed=p.length,eh=-1,ep=et.length,ef=-1,eg=_.length,ev=rC(ed-ep,0),em=Z(ev+eg),eE=!el;++eu<ev;)em[eu]=p[eu];for(var eS=eu;++ef<eg;)em[eS+ef]=_[ef];for(;++eh<ep;)(eE||eu<ed)&&(em[eS+et[eh]]=p[eu++]);return em}function ki(p,_){var et=-1,el=p.length;for(_||(_=Z(el));++et<el;)_[et]=p[et];return _}function Ni(p,_,Z,et){var eu=!Z;Z||(Z={});for(var ed=-1,eh=_.length;++ed<eh;){var ep=_[ed],ef=et?et(Z[ep],p[ep],ep,Z,p):el;ef===el&&(ef=p[ep]),eu?sr(Z,ep,ef):nr(Z,ep,ef)}return Z}function Di(p,_){return function(Z,et){var el=nH(Z)?wt:ir,eu=_?_():{};return el(Z,p,uo(et,2),eu)}}function Pi(p){return Xr(function(_,Z){var et=-1,eu=Z.length,ed=eu>1?Z[eu-1]:el,eh=eu>2?Z[2]:el;for(ed=p.length>3&&"function"==typeof ed?(eu--,ed):el,eh&&yo(Z[0],Z[1],eh)&&(ed=eu<3?el:ed,eu=1),_=ty(_);++et<eu;){var ep=Z[et];ep&&p(_,ep,et,ed)}return _})}function Mi(p,_){return function(Z,et){if(null==Z)return Z;if(!Ks(Z))return p(Z,et);for(var el=Z.length,eu=_?el:-1,ed=ty(Z);(_?eu--:++eu<el)&&!1!==et(ed[eu],eu,ed););return Z}}function Li(p){return function(_,Z,et){for(var el=-1,eu=ty(_),ed=et(_),eh=ed.length;eh--;){var ep=ed[p?eh:++el];if(!1===Z(eu[ep],ep,eu))break}return _}}function xi(p){return function(_){var Z=cn(_=Sa(_))?gn(_):el,et=Z?Z[0]:_.charAt(0),eu=Z?bi(Z,1).join(""):_.slice(1);return et[p]()+eu}}function Ui(p){return function(_){return Ut(Qa(qa(_).replace(tW,"")),p,"")}}function Bi(p){return function(){var _=arguments;switch(_.length){case 0:return new p;case 1:return new p(_[0]);case 2:return new p(_[0],_[1]);case 3:return new p(_[0],_[1],_[2]);case 4:return new p(_[0],_[1],_[2],_[3]);case 5:return new p(_[0],_[1],_[2],_[3],_[4]);case 6:return new p(_[0],_[1],_[2],_[3],_[4],_[5]);case 7:return new p(_[0],_[1],_[2],_[3],_[4],_[5],_[6])}var Z=rq(p.prototype),et=p.apply(Z,_);return ta(et)?et:Z}}function ji(p){return function(_,Z,et){var eu=ty(_);if(!Ks(_)){var ed=uo(Z,3);_=Da(_),Z=function(p){return ed(eu[p],p,eu)}}var eh=p(_,Z,et);return eh>-1?eu[ed?_[eh]:eh]:el}}function Fi(p){return ro(function(_){var Z=_.length,et=Z,ed=qn.prototype.thru;for(p&&_.reverse();et--;){var eh=_[et];if("function"!=typeof eh)throw new tT(eu);if(ed&&!ep&&"wrapper"==ao(eh))var ep=new qn([],!0)}for(et=ep?et:Z;++et<Z;){var ef=ao(eh=_[et]),eg="wrapper"==ef?r0(eh):el;ep=eg&&Co(eg[0])&&424==eg[1]&&!eg[4].length&&1==eg[9]?ep[ao(eg[0])].apply(ep,eg[3]):1==eh.length&&Co(eh)?ep[ef]():ep.thru(eh)}return function(){var p=arguments,et=p[0];if(ep&&1==p.length&&nH(et))return ep.plant(et).value();for(var el=0,eu=Z?_[el].apply(this,p):et;++el<Z;)eu=_[el].call(this,eu);return eu}})}function Vi(p,_,et,eu,ed,eh,ep,ef,eg,ev){var em=128&_,eE=1&_,eS=2&_,e_=24&_,ey=512&_,eb=eS?el:Bi(p);return function d(){for(var eC=arguments.length,eT=Z(eC),eI=eC;eI--;)eT[eI]=arguments[eI];if(e_)var eR=co(d),eO=function(p,_){for(var Z=p.length,et=0;Z--;)p[Z]===_&&++et;return et}(eT,eR);if(eu&&(eT=wi(eT,eu,ed,e_)),eh&&(eT=Ai(eT,eh,ep,e_)),eC-=eO,e_&&eC<ev){var eA=dn(eT,eR);return zi(p,_,Vi,d.placeholder,et,eT,eA,ef,eg,ev-eC)}
vendor: 6,383 bytes, line 1
1var ek=eE?et:this,ew=eS?ek[p]:p;return eC=eT.length,ef?eT=function(p,_){for(var Z=p.length,et=rT(_.length,Z),eu=ki(p);et--;){var ed=_[et];p[et]=_o(ed,Z)?eu[ed]:el}return p}(eT,ef):ey&&eC>1&&eT.reverse(),em&&eg<eC&&(eT.length=eg),this&&this!==t5&&this instanceof d&&(ew=eb||Bi(ew)),ew.apply(ek,eT)}}function Gi(p,_){return function(Z,et){var el,eu;return el=_(et),eu={},yr(Z,function(_,Z,et){p(eu,el(_),Z,et)}),eu}}function Hi(p,_){return function(Z,et){var eu;if(Z===el&&et===el)return _;if(Z!==el&&(eu=Z),et!==el){if(eu===el)return et;"string"==typeof Z||"string"==typeof et?(Z=li(Z),et=li(et)):(Z=ui(Z),et=ui(et)),eu=p(Z,et)}return eu}}function qi(p){return ro(function(_){return _=Lt(_,Zt(uo())),Xr(function(Z){var et=this;return p(_,function(p){return Ot(p,et,Z)})})})}function Wi(p,_){var Z=(_=_===el?" ":li(_)).length;if(Z<2)return Z?Yr(_,p):_;var et=Yr(_,ri(p/fn(_)));return cn(_)?bi(gn(et),0,p).join(""):et.slice(0,p)}function $i(p){return function(_,et,eu){return eu&&"number"!=typeof eu&&yo(_,et,eu)&&(et=eu=el),_=fa(_),et===el?(et=_,_=0):et=fa(et),function(p,_,et,el){for(var eu=-1,ed=rC(ri((_-p)/(et||1)),0),eh=Z(ed);ed--;)eh[el?ed:++eu]=p,p+=et;return eh}(_,et,eu=eu===el?_<et?1:-1:fa(eu),p)}}function Ki(p){return function(_,Z){return"string"==typeof _&&"string"==typeof Z||(_=ma(_),Z=ma(Z)),p(_,Z)}}function zi(p,_,Z,et,eu,ed,eh,ep,ef,eg){var ev=8&_;_|=ev?32:64,4&(_&=~(ev?64:32))||(_&=-4);var em=[p,_,eu,ev?ed:el,ev?eh:el,ev?el:ed,ev?el:eh,ep,ef,eg],eE=Z.apply(el,em);return Co(p)&&r5(eE,em),eE.placeholder=et,Mo(eE,p,_)}function Ji(p){var _=t_[p];return function(p,Z){if(p=ma(p),(Z=null==Z?0:rT(ga(Z),292))&&r_(p)){var et=(Sa(p)+"e").split("e");return+((et=(Sa(_(et[0]+"e"+(+et[1]+Z)))+"e").split("e"))[0]+"e"+(+et[1]-Z))}return _(p)}}var rZ=rD&&1/hn(new rD([,-0]))[1]==ep?function(p){return new rD(p)}:uc;function Xi(p){return function(_){var Z,et,el=r3(_);return el==eC?un(_):el==eA?(Z=-1,et=Array(_.size),_.forEach(function(p){et[++Z]=[p,p]}),et):Lt(p(_),function(p){return[p,_[p]]})}}function Qi(p,_,et,ed,ep,ef,eg,ev){var em=2&_;if(!em&&"function"!=typeof p)throw new tT(eu);var eE=ed?ed.length:0;if(eE||(_&=-97,ed=ep=el),eg=eg===el?eg:rC(ga(eg),0),ev=ev===el?ev:ga(ev),eE-=ep?ep.length:0,64&_){var eS=ed,e_=ep;ed=ep=el}var ey=em?el:r0(p),eb=[p,_,et,ed,ep,eS,e_,ef,eg,ev];if(ey&&function(p,_){var Z=p[1],et=_[1],el=Z|et,eu=el<131,ed=128==et&&8==Z||128==et&&256==Z&&p[7].length<=_[8]||384==et&&_[7].length<=_[8]&&8==Z;if(eu||ed){1&et&&(p[2]=_[2],el|=1&Z?0:4);var ep=_[3];if(ep){var ef=p[3];p[3]=ef?wi(ef,ep,_[4]):ep,p[4]=ef?dn(p[3],eh):_[4]}(ep=_[5])&&(ef=p[5],p[5]=ef?Ai(ef,ep,_[6]):ep,p[6]=ef?dn(p[5],eh):_[6]),(ep=_[7])&&(p[7]=ep),128&et&&(p[8]=null==p[8]?_[8]:rT(p[8],_[8])),null==p[9]&&(p[9]=_[9]),p[0]=_[0],p[1]=el}}(eb,ey),p=eb[0],_=eb[1],et=eb[2],ed=eb[3],ep=eb[4],(ev=eb[9]=eb[9]===el?em?0:p.length:rC(eb[9]-eE,0))||!(24&_)||(_&=-25),_&&1!=_)eB=8==_||16==_?(eC=p,eT=_,eI=ev,eR=Bi(eC),function s(){for(var p=arguments.length,_=Z(p),et=p,eu=co(s);et--;)_[et]=arguments[et];var ed=p<3&&_[0]!==eu&&_[p-1]!==eu?[]:dn(_,eu);return(p-=ed.length)<eI?zi(eC,eT,Vi,s.placeholder,el,_,ed,el,el,eI-p):Ot(this&&this!==t5&&this instanceof s?eR:eC,this,_)}):32!=_&&33!=_||ep.length?Vi.apply(el,eb):(eO=p,eA=_,ek=et,ew=ed,eN=1&eA,eD=Bi(eO),function t(){for(var p=-1,_=arguments.length,et=-1,el=ew.length,eu=Z(el+_),ed=this&&this!==t5&&this instanceof t?eD:eO;++et<el;)eu[et]=ew[et];for(;_--;)eu[et++]=arguments[++p];return Ot(ed,eN?ek:this,eu)});else var eC,eT,eI,eR,eO,eA,ek,ew,eN,eD,eP,eM,eL,ex,eU,eB=(eP=p,eM=_,eL=et,ex=1&eM,eU=Bi(eP),function t(){return(this&&this!==t5&&this instanceof t?eU:eP).apply(ex?eL:this,arguments)});return Mo((ey?rX:r5)(eB,eb),p,_)}function Zi(p,_,Z,et){return p===el||Vs(p,tO[Z])&&!tw.call(et,Z)?_:p}function eo(p,_,Z,et,eu,ed){return ta(p)&&ta(_)&&(ed.set(_,p),Hr(p,_,el,eo,ed),ed.delete(_)),p}function to(p){return oa(p)?el:p}function no(p,_,Z,et,eu,ed){var eh=1&Z,ep=p.length,ef=_.length;if(ep!=ef&&!(eh&&ef>ep))return!1;var eg=ed.get(p),ev=ed.get(_);if(eg&&ev)return eg==_&&ev==p;var em=-1,eE=!0,eS=2&Z?new Jn:el;for(ed.set(p,_),ed.set(_,p);++em<ep;){var e_=p[em],ey=_[em];if(et)var eb=eh?et(ey,e_,em,_,p,ed):et(e_,ey,em,p,_,ed);if(eb!==el){if(eb)continue;eE=!1;break}if(eS){if(!jt(_,function(p,_){if(!tn(eS,_)&&(e_===p||eu(e_,p,Z,et,ed)))return eS.push(_)})){eE=!1;break}}else if(e_!==ey&&!eu(e_,ey,Z,et,ed)){eE=!1;break}}return ed.delete(p),ed.delete(_),eE}function ro(p){return r6(wo(p,el,$o),p+"")}var r0=rL?function(p){return rL.get(p)}:uc;function ao(p){for(var _=p.name+"",Z=rx[_],et=tw.call(rx,_)?Z.length:0;et--;){var el=Z[et],eu=el.func;if(null==eu||eu==p)return el.name}return _}function co(p){return(tw.call(Vn,"placeholder")?Vn:p).placeholder}function uo(){var p=Vn.iteratee||oc;return p=p===oc?xr:p,arguments.length?p(arguments[0],arguments[1]):p}function lo(p,_){var Z,et=p.__data__;return("string"==(Z=typeof _)||"number"==Z||"symbol"==Z||"boolean"==Z?"__proto__"!==_:null===_)?et["string"==typeof _?"string":"hash"]:et.map}function ho(p){for(var _=Da(p),Z=_.length;Z--;){var et=_[Z],el=p[et];_[Z]=[et,el,el==el&&!ta(el)]}return _}function po(p,_){var Z=null==p?el:p[_];return Lr(Z)?Z:el}var r1=rE?function(p){return null==p?[]:Dt(rE(p=ty(p)),function(_){return tH.call(p,_)})}:vc,r2=rE?function(p){for(var _=[];p;)xt(_,r1(p)),p=tF(p);return _}:vc,r3=Rr;function mo(p,_,Z){for(var et=-1,el=(_=_i(_,p)).length,eu=!1;++et<el;){var ed=Bo(_[et]);if(!(eu=null!=p&&Z(p,ed)))break;p=p[ed]}return eu||++et!=el?eu:!!(el=null==p?0:p.length)&&ea(el)&&_o(ed,el)&&(nH(p)||nG(p))}function Eo(p){return"function"!=typeof p.constructor||Io(p)?{}:rq(tF(p))}function So(p){return nH(p)||nG(p)||!!(tz&&p&&p[tz])}function _o(p,_){var Z=typeof p;return!!(_=null==_?9007199254740991:_)&&("number"==Z||"symbol"!=Z&&tg.test(p))&&p>-1&&p%1==0&&p<_}function yo(p,_,Z){if(!ta(Z))return!1;var et=typeof _;return!!("number"==et?Ks(Z)&&_o(_,Z.length):"string"==et&&_ in Z)&&Vs(Z[_],p)}function bo(p,_){if(nH(p))return!1;var Z=typeof p;return!("number"!=Z&&"symbol"!=Z&&"boolean"!=Z&&null!=p&&!ua(p))||e0.test(p)||!eZ.test(p)||null!=_&&p in ty(_)}function Co(p){var _=ao(p),Z=Vn[_];if("function"!=typeof Z||!(_ in Wn.prototype))return!1;if(p===Z)return!0;var et=r0(Z);return!!et&&p===et[0]}(rk&&r3(new rk(new ArrayBuffer(1)))!=eP||rw&&r3(new rw)!=eC||rN&&r3(rN.resolve())!=eR||rD&&r3(new rD)!=eA||rP&&r3(new rP)!=eN)&&(r3=function(p){var _=Rr(p),Z=_
vendor: 18,587 bytes, line 1
1==eI?p.constructor:el,et=Z?jo(Z):"";if(et)switch(et){case rU:return eP;case rB:return eC;case rj:return eR;case rV:return eA;case rF:return eN}return _});var r4=tA?Qs:mc;function Io(p){var _=p&&p.constructor;return p===("function"==typeof _&&_.prototype||tO)}function Oo(p,_){return function(Z){return null!=Z&&Z[p]===_&&(_!==el||p in ty(Z))}}function wo(p,_,et){return _=rC(_===el?p.length-1:_,0),function(){for(var el=arguments,eu=-1,ed=rC(el.length-_,0),eh=Z(ed);++eu<ed;)eh[eu]=el[_+eu];eu=-1;for(var ep=Z(_+1);++eu<_;)ep[eu]=el[eu];return ep[_]=et(eh),Ot(p,this,ep)}}function Ao(p,_){return _.length<2?p:Tr(p,ii(_,0,-1))}function ko(p,_){if(("constructor"!==_||"function"!=typeof p[_])&&"__proto__"!=_)return p[_]}var r5=Lo(rX),r9=t7||function(p,_){return t5.setTimeout(p,_)},r6=Lo(rY);function Mo(p,_,Z){var et,el,eu=_+"";return r6(p,function(p,_){var Z=_.length;if(!Z)return p;var et=Z-1;return _[et]=(Z>1?"& ":"")+_[et],_=_.join(Z>2?", ":" "),p.replace(e9,"{\n/* [wrapped with "+_+"] */\n")}(eu,(el=(et=eu.match(e6))?et[1].split(e8):[],At(eg,function(p){var _="_."+p[0];Z&p[1]&&!Pt(el,_)&&el.push(_)}),el.sort())))}function Lo(p){var _=0,Z=0;return function(){var et=rI(),eu=16-(et-Z);if(Z=et,eu>0){if(++_>=800)return arguments[0]}else _=0;return p.apply(el,arguments)}}function xo(p,_){var Z=-1,et=p.length,eu=et-1;for(_=_===el?et:_;++Z<_;){var ed=Jr(Z,eu),eh=p[ed];p[ed]=p[Z],p[Z]=eh}return p.length=_,p}var r8=(iM=(iP=Ls(function(p){var _=[];return 46===p.charCodeAt(0)&&_.push(""),p.replace(e1,function(p,Z,et,el){_.push(et?el.replace(ti,"$1"):Z||p)}),_},function(p){return 500===iM.size&&iM.clear(),p})).cache,iP);function Bo(p){if("string"==typeof p||ua(p))return p;var _=p+"";return"0"==_&&1/p==-1/0?"-0":_}function jo(p){if(null!=p){try{return tk.call(p)}catch(p){}try{return p+""}catch(p){}}return""}function Fo(p){if(p instanceof Wn)return p.clone();var _=new qn(p.__wrapped__,p.__chain__);return _.__actions__=ki(p.__actions__),_.__index__=p.__index__,_.__values__=p.__values__,_}var r7=Xr(function(p,_){return zs(p)?hr(p,Er(_,1,zs,!0)):[]}),nt=Xr(function(p,_){var Z=Xo(_);return zs(Z)&&(Z=el),zs(p)?hr(p,Er(_,1,zs,!0),uo(Z,2)):[]}),ni=Xr(function(p,_){var Z=Xo(_);return zs(Z)&&(Z=el),zs(p)?hr(p,Er(_,1,zs,!0),el,Z):[]});function qo(p,_,Z){var et=null==p?0:p.length;if(!et)return -1;var el=null==Z?0:ga(Z);return el<0&&(el=rC(et+el,0)),Gt(p,uo(_,3),el)}function Wo(p,_,Z){var et=null==p?0:p.length;if(!et)return -1;var eu=et-1;return Z!==el&&(eu=ga(Z),eu=Z<0?rC(et+eu,0):rT(eu,et-1)),Gt(p,uo(_,3),eu,!0)}function $o(p){return(null==p?0:p.length)?Er(p,1):[]}function Ko(p){return p&&p.length?p[0]:el}var nc=Xr(function(p){var _=Lt(p,Ei);return _.length&&_[0]===p[0]?kr(_):[]}),nl=Xr(function(p){var _=Xo(p),Z=Lt(p,Ei);return _===Xo(Z)?_=el:Z.pop(),Z.length&&Z[0]===p[0]?kr(Z,uo(_,2)):[]}),nu=Xr(function(p){var _=Xo(p),Z=Lt(p,Ei);return(_="function"==typeof _?_:el)&&Z.pop(),Z.length&&Z[0]===p[0]?kr(Z,el,_):[]});function Xo(p){var _=null==p?0:p.length;return _?p[_-1]:el}var nd=Xr(Zo);function Zo(p,_){return p&&p.length&&_&&_.length?Kr(p,_):p}var nh=ro(function(p,_){var Z=null==p?0:p.length,et=ar(p,_);return zr(p,Lt(_,function(p){return _o(p,Z)?+p:p}).sort(Oi)),et});function ts(p){return null==p?p:rA.call(p)}var np=Xr(function(p){return di(Er(p,1,zs,!0))}),nf=Xr(function(p){var _=Xo(p);return zs(_)&&(_=el),di(Er(p,1,zs,!0),uo(_,2))}),ng=Xr(function(p){var _=Xo(p);return _="function"==typeof _?_:el,di(Er(p,1,zs,!0),el,_)});function os(p){if(!p||!p.length)return[];var _=0;return p=Dt(p,function(p){if(zs(p))return _=rC(p.length,_),!0}),Xt(_,function(_){return Lt(p,Kt(_))})}function ss(p,_){if(!p||!p.length)return[];var Z=os(p);return null==_?Z:Lt(Z,function(p){return Ot(_,el,p)})}var nv=Xr(function(p,_){return zs(p)?hr(p,_):[]}),nm=Xr(function(p){return vi(Dt(p,zs))}),nE=Xr(function(p){var _=Xo(p);return zs(_)&&(_=el),vi(Dt(p,zs),uo(_,2))}),nS=Xr(function(p){var _=Xo(p);return _="function"==typeof _?_:el,vi(Dt(p,zs),el,_)}),n_=Xr(os),ny=Xr(function(p){var _=p.length,Z=_>1?p[_-1]:el;return Z="function"==typeof Z?(p.pop(),Z):el,ss(p,Z)});function ps(p){var _=Vn(p);return _.__chain__=!0,_}function fs(p,_){return _(p)}var nb=ro(function(p){var _=p.length,Z=_?p[0]:0,et=this.__wrapped__,o=function(_){return ar(_,p)};return!(_>1||this.__actions__.length)&&et instanceof Wn&&_o(Z)?((et=et.slice(Z,+Z+(_?1:0))).__actions__.push({func:fs,args:[o],thisArg:el}),new qn(et,this.__chain__).thru(function(p){return _&&!p.length&&p.push(el),p})):this.thru(o)}),nC=Di(function(p,_,Z){tw.call(p,Z)?++p[Z]:sr(p,Z,1)}),nT=ji(qo),nI=ji(Wo);function Ss(p,_){return(nH(p)?At:r$)(p,uo(_,3))}function _s(p,_){return(nH(p)?function(p,_){for(var Z=null==p?0:p.length;Z--&&!1!==_(p[Z],Z,p););return p}:rK)(p,uo(_,3))}var nR=Di(function(p,_,Z){tw.call(p,Z)?p[Z].push(_):sr(p,Z,[_])}),nO=Xr(function(p,_,et){var el=-1,eu="function"==typeof _,ed=Ks(p)?Z(p.length):[];return r$(p,function(p){ed[++el]=eu?Ot(_,p,et):Nr(p,_,et)}),ed}),nA=Di(function(p,_,Z){sr(p,Z,_)});function Ts(p,_){return(nH(p)?Lt:Fr)(p,uo(_,3))}var nk=Di(function(p,_,Z){p[Z?0:1].push(_)},function(){return[[],[]]}),nw=Xr(function(p,_){if(null==p)return[];var Z=_.length;return Z>1&&yo(p,_[0],_[1])?_=[]:Z>2&&yo(_[0],_[1],_[2])&&(_=[_[0]]),Wr(p,Er(_,1),[])}),nN=t6||function(){return t5.Date.now()};function ws(p,_,Z){return _=Z?el:_,_=p&&null==_?p.length:_,Qi(p,128,el,el,el,el,_)}function As(p,_){var Z;if("function"!=typeof _)throw new tT(eu);return p=ga(p),function(){return--p>0&&(Z=_.apply(this,arguments)),p<=1&&(_=el),Z}}var nD=Xr(function(p,_,Z){var et=1;if(Z.length){var el=dn(Z,co(nD));et|=32}return Qi(p,et,_,Z,el)}),nP=Xr(function(p,_,Z){var et=3;if(Z.length){var el=dn(Z,co(nP));et|=32}return Qi(_,et,p,Z,el)});function Ds(p,_,Z){var et,ed,eh,ep,ef,eg,ev=0,em=!1,eE=!1,eS=!0;if("function"!=typeof p)throw new tT(eu);function g(_){var Z=et,eu=ed;return et=ed=el,ev=_,ep=p.apply(eu,Z)}function v(p){var Z=p-eg;return eg===el||Z>=_||Z<0||eE&&p-ev>=eh}function m(){var p,Z=nN();if(v(Z))return E(Z);ef=r9(m,(p=_-(Z-eg),eE?rT(p,eh-(Z-ev)):p))}function E(p){return ef=el,eS&&et?g(p):(et=ed=el,ep)}function S(){var p,Z=nN(),eu=v(Z);if(et=arguments,ed=this,eg=Z,eu){if(ef===el)return ev=p=eg,ef=r9(m,_),em?g(p):ep;if(eE)return rQ(ef),ef=r9(m,_),g(eg)}return ef===el&&(ef=r9(m,_)),ep}return _=ma(_)||0,ta(Z)&&(em=!!Z.leading,eh=(eE="maxWait"in Z)?rC(ma(Z.maxWait)||0,_):eh,eS="trailing"in Z?!!Z.trailing:eS),S.cancel=function(){ef!==el&&rQ(ef),ev=0,et=eg=ed=ef=el},S.flush=function(){return ef===el?ep:E(nN())},S}var nM=Xr(function(p,_){return dr(p,1,_)}),nL=Xr(function(p,_,Z){return dr(p,ma(_)||0,Z)});function Ls(p,_){if("function"!=typeof p||null!=_&&"function"!=typeof _)throw new tT(eu);var n=function(){var Z=arguments,et=_?_.apply(this,Z):Z[0],el=n.cache;if(el.has(et))return el.get(et);var eu=p.apply(this,Z);return n.cache=el.set(et,eu)||el,eu};return n.cache=new(Ls.Cache||zn),n}function xs(p){if("function"!=typeof p)throw new tT(eu);return function(){var _=arguments;switch(_.length){case 0:return!p.call(this);case 1:return!p.call(this,_[0]);case 2:return!p.call(this,_[0],_[1]);case 3:return!p.call(this,_[0],_[1],_[2])}return!p.apply(this,_)}}Ls.Cache=zn;var nx=Xr(function(p,_){var Z=(_=1==_.length&&nH(_[0])?Lt(_[0],Zt(uo())):Lt(Er(_,1),Zt(uo()))).length;return Xr(function(et){for(var el=-1,eu=rT(et.length,Z);++el<eu;)et[el]=_[el].call(this,et[el]);return Ot(p,this,et)})}),nU=Xr(function(p,_){var Z=dn(_,co(nU));return Qi(p,32,el,_,Z)}),nB=Xr(function(p,_){var Z=dn(_,co(nB));return Qi(p,64,el,_,Z)}),nj=ro(function(p,_){return Qi(p,256,el,el,el,_)});function Vs(p,_){return p===_||p!=p&&_!=_}var nV=Ki(Or),nF=Ki(function(p,_){return p>=_}),nG=Dr(function(){return arguments}())?Dr:function(p){return na(p)&&tw.call(p,"callee")&&!tH.call(p,"callee")},nH=Z.isArray,nW=rs?Zt(rs):function(p){return na(p)&&Rr(p)==eD};function Ks(p){return null!=p&&ea(p.length)&&!Qs(p)}function zs(p){return na(p)&&Ks(p)}var nq=rS||mc,n$=rc?Zt(rc):function(p){return na(p)&&Rr(p)==eS};function Xs(p){if(!na(p))return!1;var _=Rr(p);return _==e_||"[object DOMException]"==_||"string"==typeof p.message&&"string"==typeof p.name&&!oa(p)}function Qs(p){if(!ta(p))return!1;var _=Rr(p);return _==ey||_==eb||"[object AsyncFunction]"==_||"[object Proxy]"==_}function Zs(p){return"number"==typeof p&&p==ga(p)}function ea(p){return"number"==typeof p&&p>-1&&p%1==0&&p<=9007199254740991}function ta(p){var _=typeof p;return null!=p&&("object"==_||"function"==_)}function na(p){return null!=p&&"object"==typeof p}var nK=rl?Zt(rl):function(p){return na(p)&&r3(p)==eC};function ia(p){return"number"==typeof p||na(p)&&Rr(p)==eT}function oa(p){if(!na(p)||Rr(p)!=eI)return!1;var _=tF(p);if(null===_)return!0;var Z=tw.call(_,"constructor")&&_.constructor;return"function"==typeof Z&&Z instanceof Z&&tk.call(Z)==tM}var nz=ru?Zt(ru):function(p){return na(p)&&Rr(p)==eO},nJ=rd?Zt(rd):function(p){return na(p)&&r3(p)==eA};function ca(p){return"string"==typeof p||!nH(p)&&na(p)&&Rr(p)==ek}function ua(p){return"symbol"==typeof p||na(p)&&Rr(p)==ew}var nX=rh?Zt(rh):function(p){return na(p)&&ea(p.length)&&!!tQ[Rr(p)]},nY=Ki(jr),nQ=Ki(function(p,_){return p<=_});function pa(p){if(!p)return[];if(Ks(p))return ca(p)?gn(p):ki(p);if(t0&&p[t0])return function(p){for(var _,Z=[];!(_=p.next()).done;)Z.push(_.value);return Z}(p[t0]());var _=r3(p);return(_==eC?un:_==eA?hn:Va)(p)}function fa(p){return p?(p=ma(p))===ep||p===-1/0?17976931348623157e292*(p<0?-1:1):p==p?p:0:0===p?p:0}function ga(p){var _=fa(p),Z=_%1;return _==_?Z?_-Z:_:0}function va(p){return p?cr(ga(p),0,4294967295):0}function ma(p){if("number"==typeof p)return p;if(ua(p))return ef;if(ta(p)){var _="function"==typeof p.valueOf?p.valueOf():p;p=ta(_)?_+"":_}if("string"!=typeof p)return 0===p?p:+p;p=Qt(p);var Z=th.test(p);return Z||tf.test(p)?t2(p.slice(2),Z?2:8):td.test(p)?ef:+p}function Ea(p){return Ni(p,Pa(p))}function Sa(p){return null==p?"":li(p)}var nZ=Pi(function(p,_){if(Io(_)||Ks(_))Ni(_,Da(_),p);else for(var Z in _)tw.call(_,Z)&&nr(p,Z,_[Z])}),n0=Pi(function(p,_){Ni(_,Pa(_),p)}),n1=Pi(function(p,_,Z,et){Ni(_,Pa(_),p,et)}),n2=Pi(function(p,_,Z,et){Ni(_,Da(_),p,et)}),n3=ro(ar),n4=Xr(function(p,_){p=ty(p);var Z=-1,et=_.length,eu=et>2?_[2]:el;for(eu&&yo(_[0],_[1],eu)&&(et=1);++Z<et;)for(var ed=_[Z],eh=Pa(ed),ep=-1,ef=eh.length;++ep<ef;){var eg=eh[ep],ev=p[eg];(ev===el||Vs(ev,tO[eg])&&!tw.call(p,eg))&&(p[eg]=ed[eg])}return p}),n5=Xr(function(p){return p.push(el,eo),Ot(is,el,p)});function Oa(p,_,Z){var et=null==p?el:Tr(p,_);return et===el?Z:et}function wa(p,_){return null!=p&&mo(p,_,Ar)}var n9=Gi(function(p,_,Z){null!=_&&"function"!=typeof _.toString&&(_=tP.call(_)),p[_]=Z},tc(ic)),n6=Gi(function(p,_,Z){null!=_&&"function"!=typeof _.toString&&(_=tP.call(_)),tw.call(p,_)?p[_].push(Z):p[_]=[Z]},uo),n8=Xr(Nr);function Da(p){return Ks(p)?Xn(p):Ur(p)}function Pa(p){return Ks(p)?Xn(p,!0):function(p){if(!ta(p))return function(p){var _=[];if(null!=p)for(var Z in ty(p))_.push(Z);return _}(p);var _=Io(p),Z=[];for(var et in p)("constructor"!=et||!_&&tw.call(p,et))&&Z.push(et);return Z}(p)}var n7=Pi(function(p,_,Z){Hr(p,_,Z)}),is=Pi(function(p,_,Z,et){Hr(p,_,Z,et)}),il=ro(function(p,_){var Z={};if(null==p)return Z;var et=!1;_=Lt(_,function(_){return _=_i(_,p),et||(et=_.length>1),_}),Ni(p,Ir(p,Pa,r2),Z),et&&(Z=ur(Z,7,to));for(var el=_.length;el--;)hi(Z,_[el]);return Z}),iu=ro(function(p,_){return null==p?{}:$r(p,_,function(_,Z){return wa(p,Z)})});function Ba(p,_){if(null==p)return{};var Z=Lt(Ir(p,Pa,r2),function(p){return[p]});return _=uo(_),$r(p,Z,function(p,Z){return _(p,Z[0])})}var id=Xi(Da),ih=Xi(Pa);function Va(p){return null==p?[]:en(p,Da(p))}var ip=Ui(function(p,_,Z){return _=_.toLowerCase(),p+(Z?Ha(_):_)});function Ha(p){return iy(Sa(p).toLowerCase())}function qa(p){return(p=Sa(p))&&p.replace(tv,rf).replace(tq,"")}var ig=Ui(function(p,_,Z){return p+(Z?"-":"")+_.toLowerCase()}),iv=Ui(function(p,_,Z){return p+(Z?" ":"")+_.toLowerCase()}),im=xi("toLowerCase"),iE=Ui(function(p,_,Z){return p+(Z?"_":"")+_.toLowerCase()}),iS=Ui(function(p,_,Z){return p+(Z?" ":"")+iy(_)}),i_=Ui(function(p,_,Z){return p+(Z?" ":"")+_.toUpperCase()}),iy=xi("toUpperCase");function Qa(p,_,Z){var et;return p=Sa(p),(_=Z?el:_)===el?(et=p,tJ.test(et))?p.match(tK)||[]:p.match(e7)||[]:p.match(_)||[]}var ib=Xr(function(p,_){try{return Ot(p,el,_)}catch(p){return Xs(p)?p:new e5(p)}}),iC=ro(function(p,_){return At(_,function(_){sr(p,_=Bo(_),nD(p[_],p))}),p});function tc(p){return function(){return p}}var iT=Fi(),iI=Fi(!0);function ic(p){return p}function oc(p){return xr("function"==typeof p?p:ur(p,1))}var iR=Xr(function(p,_){return function(Z){return Nr(Z,p,_)}}),iO=Xr(function(p,_){return function(Z){return Nr(p,Z,_)}});function cc(p,_,Z){var et=Da(_),el=Cr(_,et);null!=Z||ta(_)&&(el.length||!et.length)||(Z=_,_=p,p=this,el=Cr(_,Da(_)));var eu=!(ta(Z)&&"chain"in Z&&!Z.chain),ed=Qs(p);return At(el,function(Z){var et=_[Z];p[Z]=et,ed&&(p.prototype[Z]=function(){var _=this.__chain__;if(eu||_){var Z=p(this.__wrapped__);return(Z.__actions__=ki(this.__actions__)).push({func:et,args:arguments,thisArg:p}),Z.__chain__=_,Z}return et.apply(p,xt([this.value()],arguments))})}),p}function uc(){}var iA=qi(Lt),ik=qi(Nt),iw=qi(jt);function pc(p){return bo(p)?Kt(Bo(p)):function(_){return Tr(_,p)}}var iN=$i(),iD=$i(!0);function vc(){return[]}function mc(){return!1}var iP,iM,iL,ix=Hi(function(p,_){return p+_},0),iU=Ji("ceil"),iB=Hi(function(p,_){return p/_},1),ij=Ji("floor"),iV=Hi(function(p,_){return p*_},1),iF=Ji("round"),iG=Hi(function(p,_){return p-_},0);return Vn.after=function(p,_){if("function"!=typeof _)throw new tT(eu);return p=ga(p),function(){if(--p<1)return _.apply(this,arguments)}},Vn.ary=ws,Vn.assign=nZ,Vn.assignIn=n0,Vn.assignInWith=n1,Vn.assignWith=n2,Vn.at=n3,Vn.before=As,Vn.bind=nD,Vn.bindAll=iC,Vn.bindKey=nP,Vn.castArray=function(){if(!arguments.length)return[];var p=arguments[0];return nH(p)?p:[p]},Vn.chain=ps,Vn.chunk=function(p,_,et){_=(et?yo(p,_,et):_===el)?1:rC(ga(_),0);var eu=null==p?0:p.length;if(!eu||_<1)return[];for(var ed=0,eh=0,ep=Z(ri(eu/_));ed<eu;)ep[eh++]=ii(p,ed,ed+=_);return ep},Vn.compact=function(p){for(var _=-1,Z=null==p?0:p.length,et=0,el=[];++_<Z;){var eu=p[_];eu&&(el[et++]=eu)}return el},Vn.concat=function(){var p=arguments.length;if(!p)return[];for(var _=Z(p-1),et=arguments[0],el=p;el--;)_[el-1]=arguments[el];return xt(nH(et)?ki(et):[et],Er(_,1))},Vn.cond=function(p){var _=null==p?0:p.length,Z=uo();return p=_?Lt(p,function(p){if("function"!=typeof p[1])throw new tT(eu);return[Z(p[0]),p[1]]}):[],Xr(function(Z){for(var et=-1;++et<_;){var el=p[et];if(Ot(el[0],this,Z))return Ot(el[1],this,Z)}})},Vn.conforms=function(p){var _,Z;return Z=Da(_=ur(p,1)),function(p){return lr(p,_,Z)}},Vn.constant=tc,Vn.countBy=nC,Vn.create=function(p,_){var Z=rq(p);return null==_?Z:or(Z,_)},Vn.curry=function e(p,_,Z){var et=Qi(p,8,el,el,el,el,el,_=Z?el:_);return et.placeholder=e.placeholder,et},Vn.curryRight=function e(p,_,Z){var et=Qi(p,16,el,el,el,el,el,_=Z?el:_);return et.placeholder=e.placeholder,et},Vn.debounce=Ds,Vn.defaults=n4,Vn.defaultsDeep=n5,Vn.defer=nM,Vn.delay=nL,Vn.difference=r7,Vn.differenceBy=nt,Vn.differenceWith=ni,Vn.drop=function(p,_,Z){var et=null==p?0:p.length;return et?ii(p,(_=Z||_===el?1:ga(_))<0?0:_,et):[]},Vn.dropRight=function(p,_,Z){var et=null==p?0:p.length;return et?ii(p,0,(_=et-(_=Z||_===el?1:ga(_)))<0?0:_):[]},Vn.dropRightWhile=function(p,_){return p&&p.length?fi(p,uo(_,3),!0,!0):[]},Vn.dropWhile=function(p,_){return p&&p.length?fi(p,uo(_,3),!0):[]},Vn.fill=function(p,_,Z,et){var eu=null==p?0:p.length;return eu?(Z&&"number"!=typeof Z&&yo(p,_,Z)&&(Z=0,et=eu),function(p,_,Z,et){var eu=p.length;for((Z=ga(Z))<0&&(Z=-Z>eu?0:eu+Z),(et=et===el||et>eu?eu:ga(et))<0&&(et+=eu),et=Z>et?0:va(et);Z<et;)p[Z++]=_;return p}(p,_,Z,et)):[]},Vn.filter=function(p,_){return(nH(p)?Dt:mr)(p,uo(_,3))},Vn.flatMap=function(p,_){return Er(Ts(p,_),1)},Vn.flatMapDeep=function(p,_){return Er(Ts(p,_),ep)},Vn.flatMapDepth=function(p,_,Z){return Z=Z===el?1:ga(Z),Er(Ts(p,_),Z)},Vn.flatten=$o,Vn.flattenDeep=function(p){return(null==p?0:p.length)?Er(p,ep):[]},Vn.flattenDepth=function(p,_){return(null==p?0:p.length)?Er(p,_=_===el?1:ga(_)):[]},Vn.flip=function(p){return Qi(p,512)},Vn.flow=iT,Vn.flowRight=iI,Vn.fromPairs=function(p){for(var _=-1,Z=null==p?0:p.length,et={};++_<Z;){var el=p[_];sr(et,el[0],el[1])}return et},Vn.functions=function(p){return null==p?[]:Cr(p,Da(p))},Vn.functionsIn=function(p){return null==p?[]:Cr(p,Pa(p))},Vn.groupBy=nR,Vn.initial=function(p){return(null==p?0:p.length)?ii(p,0,-1):[]},Vn.intersection=nc,Vn.intersectionBy=nl,Vn.intersectionWith=nu,Vn.invert=n9,Vn.invertBy=n6,Vn.invokeMap=nO,Vn.iteratee=oc,Vn.keyBy=nA,Vn.keys=Da,Vn.keysIn=Pa,Vn.map=Ts,Vn.mapKeys=function(p,_){var Z={};return _=uo(_,3),yr(p,function(p,et,el){sr(Z,_(p,et,el),p)}),Z},Vn.mapValues=function(p,_){var Z={};return _=uo(_,3),yr(p,function(p,et,el){sr(Z,et,_(p,et,el))}),Z},Vn.matches=function(p){return Vr(ur(p,1))},Vn.matchesProperty=function(p,_){return Gr(p,ur(_,1))},Vn.memoize=Ls,Vn.merge=n7,Vn.mergeWith=is,Vn.method=iR,Vn.methodOf=iO,Vn.mixin=cc,Vn.negate=xs,Vn.nthArg=function(p){return p=ga(p),Xr(function(_){return qr(_,p)})},Vn.omit=il,Vn.omitBy=function(p,_){return Ba(p,xs(uo(_)))},Vn.once=function(p){return As(2,p)},Vn.orderBy=function(p,_,Z,et){return null==p?[]:(nH(_)||(_=null==_?[]:[_]),nH(Z=et?el:Z)||(Z=null==Z?[]:[Z]),Wr(p,_,Z))},Vn.over=iA,Vn.overArgs=nx,Vn.overEvery=ik,Vn.overSome=iw,Vn.partial=nU,Vn.partialRight=nB,Vn.partition=nk,Vn.pick=iu,Vn.pickBy=Ba,Vn.property=pc,Vn.propertyOf=function(p){return function(_){return null==p?el:Tr(p,_)}},Vn.pull=nd,Vn.pullAll=Zo,Vn.pullAllBy=function(p,_,Z){return p&&p.length&&_&&_.length?Kr(p,_,uo(Z,2)):p},Vn.pullAllWith=function(p,_,Z){return p&&p.length&&_&&_.length?Kr(p,_,el,Z):p},Vn.pullAt=nh,Vn.range=iN,Vn.rangeRight=iD,Vn.rearg=nj,Vn.reject=function(p,_){return(nH(p)?Dt:mr)(p,xs(uo(_,3)))},Vn.remove=function(p,_){var Z=[];if(!p||!p.length)return Z;var et=-1,el=[],eu=p.length;for(_=uo(_,3);++et<eu;){var ed=p[et];_(ed,et,p)&&(Z.push(ed),el.push(et))}return zr(p,el),Z},Vn.rest=function(p,_){if("function"!=typeof p)throw new tT(eu);return Xr(p,_=_===el?_:ga(_))},Vn.reverse=ts,Vn.sampleSize=function(p,_,Z){return _=(Z?yo(p,_,Z):_===el)?1:ga(_),(nH(p)?function(p,_){return xo(ki(p),cr(_,0,p.length))}:function(p,_){var Z=Va(p);return xo(Z,cr(_,0,Z.length))})(p,_)},Vn.set=function(p,_,Z){return null==p?p:ei(p,_,Z)},Vn.setWith=function(p,_,Z,et){return et="function"==typeof et?et:el,null==p?p:ei(p,_,Z,et)},Vn.shuffle=function(p){return(nH(p)?function(p){return xo(ki(p))}:function(p){return xo(Va(p))})(p)}
vendor: 10,563 bytes, line 1
1,Vn.slice=function(p,_,Z){var et=null==p?0:p.length;return et?(Z&&"number"!=typeof Z&&yo(p,_,Z)?(_=0,Z=et):(_=null==_?0:ga(_),Z=Z===el?et:ga(Z)),ii(p,_,Z)):[]},Vn.sortBy=nw,Vn.sortedUniq=function(p){return p&&p.length?ci(p):[]},Vn.sortedUniqBy=function(p,_){return p&&p.length?ci(p,uo(_,2)):[]},Vn.split=function(p,_,Z){return Z&&"number"!=typeof Z&&yo(p,_,Z)&&(_=Z=el),(Z=Z===el?4294967295:Z>>>0)?(p=Sa(p))&&("string"==typeof _||null!=_&&!nz(_))&&!(_=li(_))&&cn(p)?bi(gn(p),0,Z):p.split(_,Z):[]},Vn.spread=function(p,_){if("function"!=typeof p)throw new tT(eu);return _=null==_?0:rC(ga(_),0),Xr(function(Z){var et=Z[_],el=bi(Z,0,_);return et&&xt(el,et),Ot(p,this,el)})},Vn.tail=function(p){var _=null==p?0:p.length;return _?ii(p,1,_):[]},Vn.take=function(p,_,Z){return p&&p.length?ii(p,0,(_=Z||_===el?1:ga(_))<0?0:_):[]},Vn.takeRight=function(p,_,Z){var et=null==p?0:p.length;return et?ii(p,(_=et-(_=Z||_===el?1:ga(_)))<0?0:_,et):[]},Vn.takeRightWhile=function(p,_){return p&&p.length?fi(p,uo(_,3),!1,!0):[]},Vn.takeWhile=function(p,_){return p&&p.length?fi(p,uo(_,3)):[]},Vn.tap=function(p,_){return _(p),p},Vn.throttle=function(p,_,Z){var et=!0,el=!0;if("function"!=typeof p)throw new tT(eu);return ta(Z)&&(et="leading"in Z?!!Z.leading:et,el="trailing"in Z?!!Z.trailing:el),Ds(p,_,{leading:et,maxWait:_,trailing:el})},Vn.thru=fs,Vn.toArray=pa,Vn.toPairs=id,Vn.toPairsIn=ih,Vn.toPath=function(p){return nH(p)?Lt(p,Bo):ua(p)?[p]:ki(r8(Sa(p)))},Vn.toPlainObject=Ea,Vn.transform=function(p,_,Z){var et=nH(p),el=et||nq(p)||nX(p);if(_=uo(_,4),null==Z){var eu=p&&p.constructor;Z=el?et?new eu:[]:ta(p)&&Qs(eu)?rq(tF(p)):{}}return(el?At:yr)(p,function(p,et,el){return _(Z,p,et,el)}),Z},Vn.unary=function(p){return ws(p,1)},Vn.union=np,Vn.unionBy=nf,Vn.unionWith=ng,Vn.uniq=function(p){return p&&p.length?di(p):[]},Vn.uniqBy=function(p,_){return p&&p.length?di(p,uo(_,2)):[]},Vn.uniqWith=function(p,_){return _="function"==typeof _?_:el,p&&p.length?di(p,el,_):[]},Vn.unset=function(p,_){return null==p||hi(p,_)},Vn.unzip=os,Vn.unzipWith=ss,Vn.update=function(p,_,Z){return null==p?p:pi(p,_,Si(Z))},Vn.updateWith=function(p,_,Z,et){return et="function"==typeof et?et:el,null==p?p:pi(p,_,Si(Z),et)},Vn.values=Va,Vn.valuesIn=function(p){return null==p?[]:en(p,Pa(p))},Vn.without=nv,Vn.words=Qa,Vn.wrap=function(p,_){return nU(Si(_),p)},Vn.xor=nm,Vn.xorBy=nE,Vn.xorWith=nS,Vn.zip=n_,Vn.zipObject=function(p,_){return mi(p||[],_||[],nr)},Vn.zipObjectDeep=function(p,_){return mi(p||[],_||[],ei)},Vn.zipWith=ny,Vn.entries=id,Vn.entriesIn=ih,Vn.extend=n0,Vn.extendWith=n1,cc(Vn,Vn),Vn.add=ix,Vn.attempt=ib,Vn.camelCase=ip,Vn.capitalize=Ha,Vn.ceil=iU,Vn.clamp=function(p,_,Z){return Z===el&&(Z=_,_=el),Z!==el&&(Z=(Z=ma(Z))==Z?Z:0),_!==el&&(_=(_=ma(_))==_?_:0),cr(ma(p),_,Z)},Vn.clone=function(p){return ur(p,4)},Vn.cloneDeep=function(p){return ur(p,5)},Vn.cloneDeepWith=function(p,_){return ur(p,5,_="function"==typeof _?_:el)},Vn.cloneWith=function(p,_){return ur(p,4,_="function"==typeof _?_:el)},Vn.conformsTo=function(p,_){return null==_||lr(p,_,Da(_))},Vn.deburr=qa,Vn.defaultTo=function(p,_){return null==p||p!=p?_:p},Vn.divide=iB,Vn.endsWith=function(p,_,Z){p=Sa(p),_=li(_);var et=p.length,eu=Z=Z===el?et:cr(ga(Z),0,et);return(Z-=_.length)>=0&&p.slice(Z,eu)==_},Vn.eq=Vs,Vn.escape=function(p){return(p=Sa(p))&&eJ.test(p)?p.replace(eK,rg):p},Vn.escapeRegExp=function(p){return(p=Sa(p))&&e3.test(p)?p.replace(e2,"\\$&"):p},Vn.every=function(p,_,Z){var et=nH(p)?Nt:gr;return Z&&yo(p,_,Z)&&(_=el),et(p,uo(_,3))},Vn.find=nT,Vn.findIndex=qo,Vn.findKey=function(p,_){return Vt(p,uo(_,3),yr)},Vn.findLast=nI,Vn.findLastIndex=Wo,Vn.findLastKey=function(p,_){return Vt(p,uo(_,3),br)},Vn.floor=ij,Vn.forEach=Ss,Vn.forEachRight=_s,Vn.forIn=function(p,_){return null==p?p:rz(p,uo(_,3),Pa)},Vn.forInRight=function(p,_){return null==p?p:rJ(p,uo(_,3),Pa)},Vn.forOwn=function(p,_){return p&&yr(p,uo(_,3))},Vn.forOwnRight=function(p,_){return p&&br(p,uo(_,3))},Vn.get=Oa,Vn.gt=nV,Vn.gte=nF,Vn.has=function(p,_){return null!=p&&mo(p,_,wr)},Vn.hasIn=wa,Vn.head=Ko,Vn.identity=ic,Vn.includes=function(p,_,Z,et){p=Ks(p)?p:Va(p),Z=Z&&!et?ga(Z):0;var el=p.length;return Z<0&&(Z=rC(el+Z,0)),ca(p)?Z<=el&&p.indexOf(_,Z)>-1:!!el&&Ht(p,_,Z)>-1},Vn.indexOf=function(p,_,Z){var et=null==p?0:p.length;if(!et)return -1;var el=null==Z?0:ga(Z);return el<0&&(el=rC(et+el,0)),Ht(p,_,el)},Vn.inRange=function(p,_,Z){var et,eu,ed;return _=fa(_),Z===el?(Z=_,_=0):Z=fa(Z),(et=p=ma(p))>=rT(eu=_,ed=Z)&&et<rC(eu,ed)},Vn.invoke=n8,Vn.isArguments=nG,Vn.isArray=nH,Vn.isArrayBuffer=nW,Vn.isArrayLike=Ks,Vn.isArrayLikeObject=zs,Vn.isBoolean=function(p){return!0===p||!1===p||na(p)&&Rr(p)==eE},Vn.isBuffer=nq,Vn.isDate=n$,Vn.isElement=function(p){return na(p)&&1===p.nodeType&&!oa(p)},Vn.isEmpty=function(p){if(null==p)return!0;if(Ks(p)&&(nH(p)||"string"==typeof p||"function"==typeof p.splice||nq(p)||nX(p)||nG(p)))return!p.length;var _=r3(p);if(_==eC||_==eA)return!p.size;if(Io(p))return!Ur(p).length;for(var Z in p)if(tw.call(p,Z))return!1;return!0},Vn.isEqual=function(p,_){return Pr(p,_)},Vn.isEqualWith=function(p,_,Z){var et=(Z="function"==typeof Z?Z:el)?Z(p,_):el;return et===el?Pr(p,_,el,Z):!!et},Vn.isError=Xs,Vn.isFinite=function(p){return"number"==typeof p&&r_(p)},Vn.isFunction=Qs,Vn.isInteger=Zs,Vn.isLength=ea,Vn.isMap=nK,Vn.isMatch=function(p,_){return p===_||Mr(p,_,ho(_))},Vn.isMatchWith=function(p,_,Z){return Z="function"==typeof Z?Z:el,Mr(p,_,ho(_),Z)},Vn.isNaN=function(p){return ia(p)&&p!=+p},Vn.isNative=function(p){if(r4(p))throw new e5("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Lr(p)},Vn.isNil=function(p){return null==p},Vn.isNull=function(p){return null===p},Vn.isNumber=ia,Vn.isObject=ta,Vn.isObjectLike=na,Vn.isPlainObject=oa,Vn.isRegExp=nz,Vn.isSafeInteger=function(p){return Zs(p)&&p>=-9007199254740991&&p<=9007199254740991},Vn.isSet=nJ,Vn.isString=ca,Vn.isSymbol=ua,Vn.isTypedArray=nX,Vn.isUndefined=function(p){return p===el},Vn.isWeakMap=function(p){return na(p)&&r3(p)==eN},Vn.isWeakSet=function(p){return na(p)&&"[object WeakSet]"==Rr(p)},Vn.join=function(p,_){return null==p?"":ry.call(p,_)},Vn.kebabCase=ig,Vn.last=Xo,Vn.lastIndexOf=function(p,_,Z){var et=null==p?0:p.length;if(!et)return -1;var eu=et;return Z!==el&&(eu=(eu=ga(Z))<0?rC(et+eu,0):rT(eu,et-1)),_==_?function(p,_,Z){for(var et=Z+1;et--&&p[et]!==_;);return et}(p,_,eu):Gt(p,Wt,eu,!0)},Vn.lowerCase=iv,Vn.lowerFirst=im,Vn.lt=nY,Vn.lte=nQ,Vn.max=function(p){return p&&p.length?vr(p,ic,Or):el},Vn.maxBy=function(p,_){return p&&p.length?vr(p,uo(_,2),Or):el},Vn.mean=function(p){return $t(p,ic)},Vn.meanBy=function(p,_){return $t(p,uo(_,2))},Vn.min=function(p){return p&&p.length?vr(p,ic,jr):el},Vn.minBy=function(p,_){return p&&p.length?vr(p,uo(_,2),jr):el},Vn.stubArray=vc,Vn.stubFalse=mc,Vn.stubObject=function(){return{}},Vn.stubString=function(){return""},Vn.stubTrue=function(){return!0},Vn.multiply=iV,Vn.nth=function(p,_){return p&&p.length?qr(p,ga(_)):el},Vn.noConflict=function(){return t5._===this&&(t5._=tL),this},Vn.noop=uc,Vn.now=nN,Vn.pad=function(p,_,Z){p=Sa(p);var et=(_=ga(_))?fn(p):0;if(!_||et>=_)return p;var el=(_-et)/2;return Wi(rp(el),Z)+p+Wi(ri(el),Z)},Vn.padEnd=function(p,_,Z){p=Sa(p);var et=(_=ga(_))?fn(p):0;return _&&et<_?p+Wi(_-et,Z):p},Vn.padStart=function(p,_,Z){p=Sa(p);var et=(_=ga(_))?fn(p):0;return _&&et<_?Wi(_-et,Z)+p:p},Vn.parseInt=function(p,_,Z){return Z||null==_?_=0:_&&(_=+_),rR(Sa(p).replace(e4,""),_||0)},Vn.random=function(p,_,Z){if(Z&&"boolean"!=typeof Z&&yo(p,_,Z)&&(_=Z=el),Z===el&&("boolean"==typeof _?(Z=_,_=el):"boolean"==typeof p&&(Z=p,p=el)),p===el&&_===el?(p=0,_=1):(p=fa(p),_===el?(_=p,p=0):_=fa(_)),p>_){var et=p;p=_,_=et}if(Z||p%1||_%1){var eu=rO();return rT(p+eu*(_-p+t1("1e-"+((eu+"").length-1))),_)}return Jr(p,_)},Vn.reduce=function(p,_,Z){var et=nH(p)?Ut:Jt,el=arguments.length<3;return et(p,uo(_,4),Z,el,r$)},Vn.reduceRight=function(p,_,Z){var et=nH(p)?Bt:Jt,el=arguments.length<3;return et(p,uo(_,4),Z,el,rK)},Vn.repeat=function(p,_,Z){return _=(Z?yo(p,_,Z):_===el)?1:ga(_),Yr(Sa(p),_)},Vn.replace=function(){var p=arguments,_=Sa(p[0]);return p.length<3?_:_.replace(p[1],p[2])},Vn.result=function(p,_,Z){var et=-1,eu=(_=_i(_,p)).length;for(eu||(eu=1,p=el);++et<eu;){var ed=null==p?el:p[Bo(_[et])];ed===el&&(et=eu,ed=Z),p=Qs(ed)?ed.call(p):ed}return p},Vn.round=iF,Vn.runInContext=e,Vn.sample=function(p){return(nH(p)?Qn:function(p){return Qn(Va(p))})(p)},Vn.size=function(p){if(null==p)return 0;if(Ks(p))return ca(p)?fn(p):p.length;var _=r3(p);return _==eC||_==eA?p.size:Ur(p).length},Vn.snakeCase=iE,Vn.some=function(p,_,Z){var et=nH(p)?jt:oi;return Z&&yo(p,_,Z)&&(_=el),et(p,uo(_,3))},Vn.sortedIndex=function(p,_){return si(p,_)},Vn.sortedIndexBy=function(p,_,Z){return ai(p,_,uo(Z,2))},Vn.sortedIndexOf=function(p,_){var Z=null==p?0:p.length;if(Z){var et=si(p,_);if(et<Z&&Vs(p[et],_))return et}return -1},Vn.sortedLastIndex=function(p,_){return si(p,_,!0)},Vn.sortedLastIndexBy=function(p,_,Z){return ai(p,_,uo(Z,2),!0)},Vn.sortedLastIndexOf=function(p,_){if(null==p?0:p.length){var Z=si(p,_,!0)-1;if(Vs(p[Z],_))return Z}return -1},Vn.startCase=iS,Vn.startsWith=function(p,_,Z){return p=Sa(p),Z=null==Z?0:cr(ga(Z),0,p.length),_=li(_),p.slice(Z,Z+_.length)==_},Vn.subtract=iG,Vn.sum=function(p){return p&&p.length?Yt(p,ic):0},Vn.sumBy=function(p,_){return p&&p.length?Yt(p,uo(_,2)):0},Vn.template=function(p,_,Z){var et=Vn.templateSettings;Z&&yo(p,_,Z)&&(_=el),p=Sa(p),_=n2({},_,et,Zi);var eu=n2({},_.imports,et.imports,Zi),ed=Da(eu),eh=en(eu,ed);At(ed,function(p){if(tt.test(p))throw new e5("Invalid `imports` option passed into `_.template`")});var ep,ef,eg=0,ev=_.interpolate||tm,em="__p += '",eE=tb((_.escape||tm).source+"|"+ev.source+"|"+(ev===eQ?tl:tm).source+"|"+(_.evaluate||tm).source+"|$","g"),eS="//# sourceURL="+(tw.call(_,"sourceURL")?(_.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++tY+"]")+"\n";p.replace(eE,function(_,Z,et,el,eu,ed){return et||(et=el),em+=p.slice(eg,ed).replace(tE,an),Z&&(ep=!0,em+="' +\n__e("+Z+") +\n'"),eu&&(ef=!0,em+="';\n"+eu+";\n__p += '"),et&&(em+="' +\n((__t = ("+et+")) == null ? '' : __t) +\n'"),eg=ed+_.length,_}),em+="';\n";var e_=tw.call(_,"variable")&&_.variable;if(e_){if(tt.test(e_))throw new e5("Invalid `variable` option passed into `_.template`")}else em="with (obj) {\n"+em+"\n}\n";em=(ef?em.replace(eH,""):em).replace(eW,"$1").replace(eq,"$1;"),em="function("+(e_||"obj")+") {\n"+(e_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(ep?", __e = _.escape":"")+(ef?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";
1\n")+em+"return __p\n}";var ey=ib(function(){return tS(ed,eS+"return "+em).apply(el,eh)});if(ey.source=em,Xs(ey))throw ey;return ey},Vn.times=function(p,_){if((p=ga(p))<1||p>9007199254740991)return[];var Z=4294967295,et=rT(p,4294967295);_=uo(_),p-=4294967295;for(var el=Xt(et,_);++Z<p;)_(Z);return el},Vn.toFinite=fa,Vn.toInteger=ga,Vn.toLength=va,Vn.toLower=function(p){return Sa(p).toLowerCase()},Vn.toNumber=ma,Vn.toSafeInteger=function(p){return p?cr(ga(p),-9007199254740991,9007199254740991):0===p?p:0},Vn.toString=Sa,Vn.toUpper=function(p){return Sa(p).toUpperCase()},Vn.trim=function(p,_,Z){if((p=Sa(p))&&(Z||_===el))return Qt(p);if(!p||!(_=li(_)))return p;var et=gn(p),eu=gn(_);return bi(et,nn(et,eu),rn(et,eu)+1).join("")},Vn.trimEnd=function(p,_,Z){if((p=Sa(p))&&(Z||_===el))return p.slice(0,vn(p)+1);if(!p||!(_=li(_)))return p;var et=gn(p);return bi(et,0,rn(et,gn(_))+1).join("")},Vn.trimStart=function(p,_,Z){if((p=Sa(p))&&(Z||_===el))return p.replace(e4,"");if(!p||!(_=li(_)))return p;var et=gn(p);return bi(et,nn(et,gn(_))).join("")},Vn.truncate=function(p,_){var Z=30,et="...";if(ta(_)){var eu="separator"in _?_.separator:eu;Z="length"in _?ga(_.length):Z,et="omission"in _?li(_.omission):et}var ed=(p=Sa(p)).length;if(cn(p)){var eh=gn(p);ed=eh.length}if(Z>=ed)return p;var ep=Z-fn(et);if(ep<1)return et;var ef=eh?bi(eh,0,ep).join(""):p.slice(0,ep);if(eu===el)return ef+et;if(eh&&(ep+=ef.length-ep),nz(eu)){if(p.slice(ep).search(eu)){var eg,ev=ef;for(eu.global||(eu=tb(eu.source,Sa(tu.exec(eu))+"g")),eu.lastIndex=0;eg=eu.exec(ev);)var em=eg.index;ef=ef.slice(0,em===el?ep:em)}}else if(p.indexOf(li(eu),ep)!=ep){var eE=ef.lastIndexOf(eu);eE>-1&&(ef=ef.slice(0,eE))}return ef+et},Vn.unescape=function(p){return(p=Sa(p))&&ez.test(p)?p.replace(e$,rv):p},Vn.uniqueId=function(p){var _=++tN;return Sa(p)+_},Vn.upperCase=i_,Vn.upperFirst=iy,Vn.each=Ss,Vn.eachRight=_s,Vn.first=Ko,cc(Vn,(iL={},yr(Vn,function(p,_){tw.call(Vn.prototype,_)||(iL[_]=p)}),iL),{chain:!1}),Vn.VERSION="4.18.1",At(["bind","bindKey","curry","curryRight","partial","partialRight"],function(p){Vn[p].placeholder=Vn}),At(["drop","take"],function(p,_){Wn.prototype[p]=function(Z){Z=Z===el?1:rC(ga(Z),0);var et=this.__filtered__&&!_?new Wn(this):this.clone();return et.__filtered__?et.__takeCount__=rT(Z,et.__takeCount__):et.__views__.push({size:rT(Z,4294967295),type:p+(et.__dir__<0?"Right":"")}),et},Wn.prototype[p+"Right"]=function(_){return this.reverse()[p](_).reverse()}}),At(["filter","map","takeWhile"],function(p,_){var Z=_+1,et=1==Z||3==Z;Wn.prototype[p]=function(p){var _=this.clone();return _.__iteratees__.push({iteratee:uo(p,3),type:Z}),_.__filtered__=_.__filtered__||et,_}}),At(["head","last"],function(p,_){var Z="take"+(_?"Right":"");Wn.prototype[p]=function(){return this[Z](1).value()[0]}}),At(["initial","tail"],function(p,_){var Z="drop"+(_?"":"Right");Wn.prototype[p]=function(){return this.__filtered__?new Wn(this):this[Z](1)}}),Wn.prototype.compact=function(){return this.filter(ic)},Wn.prototype.find=function(p){return this.filter(p).head()},Wn.prototype.findLast=function(p){return this.reverse().find(p)},Wn.prototype.invokeMap=Xr(function(p,_){return"function"==typeof p?new Wn(this):this.map(function(Z){return Nr(Z,p,_)})}),Wn.prototype.reject=function(p){return this.filter(xs(uo(p)))},Wn.prototype.slice=function(p,_){p=ga(p);var Z=this;return Z.__filtered__&&(p>0||_<0)?new Wn(Z):(p<0?Z=Z.takeRight(-p):p&&(Z=Z.drop(p)),_!==el&&(Z=(_=ga(_))<0?Z.dropRight(-_):Z.take(_-p)),Z)},Wn.prototype.takeRightWhile=function(p){return this.reverse().takeWhile(p).reverse()},Wn.prototype.toArray=function(){return this.take(4294967295)},yr(Wn.prototype,function(p,_){var Z=/^(?:filter|find|map|reject)|While$/.test(_),et=/^(?:head|last)$/.test(_),eu=Vn[et?"take"+("last"==_?"Right":""):_],ed=et||/^find/.test(_);eu&&(Vn.prototype[_]=function(){var _=this.__wrapped__,eh=et?[1]:arguments,ep=_ instanceof Wn,ef=eh[0],eg=ep||nH(_),d=function(p){var _=eu.apply(Vn,xt([p],eh));return et&&ev?_[0]:_};eg&&Z&&"function"==typeof ef&&1!=ef.length&&(ep=eg=!1);var ev=this.__chain__,em=!!this.__actions__.length,eE=ed&&!ev,eS=ep&&!em;if(!ed&&eg){_=eS?_:new Wn(this);var e_=p.apply(_,eh);return e_.__actions__.push({func:fs,args:[d],thisArg:el}),new qn(e_,ev)}return eE&&eS?p.apply(this,eh):(e_=this.thru(d),eE?et?e_.value()[0]:e_.value():e_)})}),At(["pop","push","shift","sort","splice","unshift"],function(p){var _=tI[p],Z=/^(?:push|sort|unshift)$/.test(p)?"tap":"thru",et=/^(?:pop|shift)$/.test(p);Vn.prototype[p]=function(){var p=arguments;if(et&&!this.__chain__){var el=this.value();return _.apply(nH(el)?el:[],p)}return this[Z](function(Z){return _.apply(nH(Z)?Z:[],p)})}}),yr(Wn.prototype,function(p,_){var Z=Vn[_];if(Z){var et=Z.name+"";tw.call(rx,et)||(rx[et]=[]),rx[et].push({name:_,func:Z})}}),rx[Vi(el,2).name]=[{name:"wrapper",func:el}],Wn.prototype.clone=function(){var p=new Wn(this.__wrapped__);return p.__actions__=ki(this.__actions__),p.__dir__=this.__dir__,p.__filtered__=this.__filtered__,p.__iteratees__=ki(this.__iteratees__),p.__takeCount__=this.__takeCount__,p.__views__=ki(this.__views__),p},Wn.prototype.reverse=function(){if(this.__filtered__){var p=new Wn(this);p.__dir__=-1,p.__filtered__=!0}else(p=this.clone()).__dir__*=-1;return p},Wn.prototype.value=function(){var p=this.__wrapped__.value(),_=this.__dir__,Z=nH(p),et=_<0,el=Z?p.length:0,eu=function(p,_,Z){for(var et=-1,el=Z.length;++et<el;){var eu=Z[et],ed=eu.size;switch(eu.type){case"drop":p+=ed;break;case"dropRight":_-=ed;break;case"take":_=rT(_,p+ed);break;case"takeRight":p=rC(p,_-ed)}}return{start:p,end:_}}(0,el,this.__views__),ed=eu.start,eh=eu.end,ep=eh-ed,ef=et?eh:ed-1,eg=this.__iteratees__,ev=eg.length,em=0,eE=rT(ep,this.__takeCount__);if(!Z||!et&&el==ep&&eE==ep)return gi(p,this.__actions__);var eS=[];e:for(;ep--&&em<eE;){for(var e_=-1,ey=p[ef+=_];++e_<ev;){var eb=eg[e_],eC=eb.iteratee,eT=eb.type,eI=eC(ey);if(2==eT)ey=eI;else if(!eI){if(1==eT)continue e;break e}}eS[em++]=ey}return eS},Vn.prototype.at=nb,Vn.prototype.chain=function(){return ps(this)},Vn.prototype.commit=function(){return new qn(this.value(),this.__chain__)},Vn.prototype.next=function(){this.__values__===el&&(this.__values__=pa(this.value()));var p=this.__index__>=this.__values__.length;return{done:p,value:p?el:this.__values__[this.__index__++]}},Vn.prototype.plant=function(p){for(var _,Z=this;Z instanceof Hn;){var et=Fo(Z);et.__index__=0,et.__values__=el,_?eu.__wrapped__=et:_=et;var eu=et;Z=Z.__wrapped__}return eu.__wrapped__=p,_},Vn.prototype.reverse=function(){var p=this.__wrapped__;if(p instanceof Wn){var _=p;return this.__actions__.length&&(_=new Wn(this)),(_=_.reverse()).__actions__.push({func:fs,args:[ts],thisArg:el}),new qn(_,this.__chain__)}return this.thru(ts)},Vn.prototype.toJSON=Vn.prototype.valueOf=Vn.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},Vn.prototype.first=Vn.prototype.head,t0&&(Vn.prototype[t0]=function(){return this}),Vn}();
vendor: 10,920 bytes, line 1
1t5._=rm,(et=(function(){return rm}).call(_,Z,_,p))===el||(p.exports=et)}).call(this)},2552(p,_,Z){var et=Z(1873),el=Z(659),eu=Z(9350),ed=et?et.toStringTag:void 0;p.exports=function(p){return null==p?void 0===p?"[object Undefined]":"[object Null]":ed&&ed in Object(p)?el(p):eu(p)}},2651(p,_,Z){var et=Z(4218);p.exports=function(p,_){var Z=p.__data__;return et(_)?Z["string"==typeof _?"string":"hash"]:Z.map}},2749(p,_,Z){var et=Z(1042),el=Object.prototype.hasOwnProperty;p.exports=function(p){var _=this.__data__;return et?void 0!==_[p]:el.call(_,p)}},2824(p,_,Z){var et=Z(7805),el=Z(3290),eu=Z(1961),ed=Z(3007),eh=Z(5529),ep=Z(2428),ef=Z(6449),eg=Z(3693),ev=Z(3656),em=Z(1882),eE=Z(3805),eS=Z(1331),e_=Z(7167),ey=Z(4974),eb=Z(9884);p.exports=function(p,_,Z,eC,eT,eI,eR){var eO=ey(p,Z),eA=ey(_,Z),ek=eR.get(eA);if(ek)et(p,Z,ek);else{var ew=eI?eI(eO,eA,Z+"",p,_,eR):void 0,eN=void 0===ew;if(eN){var eD=ef(eA),eP=!eD&&ev(eA),eM=!eD&&!eP&&e_(eA);ew=eA,eD||eP||eM?ef(eO)?ew=eO:eg(eO)?ew=ed(eO):eP?(eN=!1,ew=el(eA,!0)):eM?(eN=!1,ew=eu(eA,!0)):ew=[]:eS(eA)||ep(eA)?(ew=eO,ep(eO)?ew=eb(eO):eE(eO)&&!em(eO)||(ew=eh(eA))):eN=!1}eN&&(eR.set(eA,ew),eT(ew,eA,eC,eI,eR),eR.delete(eA)),et(p,Z,ew)}}},2865(p,_,Z){var et=Z(9570),el=Z(1811)(et);p.exports=el},2903(p,_,Z){var et=Z(3805),el=Z(5527),eu=Z(181),ed=Object.prototype.hasOwnProperty;p.exports=function(p){if(!et(p))return eu(p);var _=el(p),Z=[];for(var eh in p)("constructor"!=eh||!_&&ed.call(p,eh))&&Z.push(eh);return Z}},2949(p,_,Z){var et=Z(2651);p.exports=function(p,_){var Z=et(this,p),el=Z.size;return Z.set(p,_),this.size+=Z.size==el?0:1,this}},3007(p){p.exports=function(p,_){var Z=-1,et=p.length;for(_||(_=Array(et));++Z<et;)_[Z]=p[Z];return _}},3040(p,_,Z){var et=Z(1549),el=Z(79),eu=Z(8223);p.exports=function(){this.size=0,this.__data__={hash:new et,map:new(eu||el),string:new et}}},3221(p){p.exports=function(p){return function(_,Z,et){for(var el=-1,eu=Object(_),ed=et(_),eh=ed.length;eh--;){var ep=ed[p?eh:++el];if(!1===Z(eu[ep],ep,eu))break}return _}}},3243(p,_,Z){var et=Z(6110),el=function(){try{var p=et(Object,"defineProperty");return p({},"",{}),p}catch(p){}}();p.exports=el},3290(p,_,Z){p=Z.nmd(p);var et=Z(9325),el=_&&!_.nodeType&&_,eu=el&&p&&!p.nodeType&&p,ed=eu&&eu.exports===el?et.Buffer:void 0,eh=ed?ed.allocUnsafe:void 0;p.exports=function(p,_){if(_)return p.slice();var Z=p.length,et=eh?eh(Z):new p.constructor(Z);return p.copy(et),et}},3360(p,_,Z){var et=Z(3243);p.exports=function(p,_,Z){"__proto__"==_&&et?et(p,_,{configurable:!0,enumerable:!0,value:Z,writable:!0}):p[_]=Z}},3488(p){p.exports=function(p){return p}},3605(p){p.exports=function(p){return this.__data__.get(p)}},3656(p,_,Z){p=Z.nmd(p);var et=Z(9325),el=Z(9935),eu=_&&!_.nodeType&&_,ed=eu&&p&&!p.nodeType&&p,eh=ed&&ed.exports===eu?et.Buffer:void 0,ep=(eh?eh.isBuffer:void 0)||el;p.exports=ep},3661(p,_,Z){var et=Z(3040),el=Z(7670),eu=Z(289),ed=Z(4509),eh=Z(2949);function c(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}c.prototype.clear=et,c.prototype.delete=el,c.prototype.get=eu,c.prototype.has=ed,c.prototype.set=eh,p.exports=c},3693(p,_,Z){var et=Z(4894),el=Z(346);p.exports=function(p){return el(p)&&et(p)}},3702(p){p.exports=function(){this.__data__=[],this.size=0}},3804(p,_,Z){var et=Z(5602),el=/%[sdv%]/g,o=function(p){var _=1,Z=arguments,et=Z.length;return p.replace(el,function(p){if(_>=et)return p;var el=Z[_];switch(_+=1,p){case"%%":return"%";case"%s":return String(el);case"%d":return Number(el);case"%v":return""}})},s=function(p,_,Z){var et=[p+"="+(_.format instanceof Function?_.format(_.push?Z:Z[_.name]):_.format)];if(_.names)for(var el=0;el<_.names.length;el+=1){var eu=_.names[el];_.name?et.push(Z[_.name][eu]):et.push(Z[_.names[el]])}else et.push(Z[_.name]);return o.apply(null,et)},eu=["v","o","s","i","u","e","p","c","b","t","r","z","a"],ed=["i","c","b","a"];p.exports=function(p,_){_=_||{},null==p.version&&(p.version=0),null==p.name&&(p.name=" "),p.media.forEach(function(p){null==p.payloads&&(p.payloads="")});var Z=_.outerOrder||eu,el=_.innerOrder||ed,eh=[];return Z.forEach(function(_){et[_].forEach(function(Z){Z.name in p&&null!=p[Z.name]?eh.push(s(_,Z,p)):Z.push in p&&null!=p[Z.push]&&p[Z.push].forEach(function(p){eh.push(s(_,Z,p))})})}),p.media.forEach(function(p){eh.push(s("m",et.m[0],p)),el.forEach(function(_){et[_].forEach(function(Z){Z.name in p&&null!=p[Z.name]?eh.push(s(_,Z,p)):Z.push in p&&null!=p[Z.push]&&p[Z.push].forEach(function(p){eh.push(s(_,Z,p))})})})}),eh.join("\r\n")+"\r\n"}},3805(p){p.exports=function(p){var _=typeof p;return null!=p&&("object"==_||"function"==_)}},3862(p){p.exports=function(p){var _=this.has(p)&&delete this.__data__[p];return this.size-=_?1:0,_}},4218(p){p.exports=function(p){var _=typeof p;return"string"==_||"number"==_||"symbol"==_||"boolean"==_?"__proto__"!==p:null===p}},4335(p){p.exports=function(p,_){return function(Z){return p(_(Z))}}},4509(p,_,Z){var et=Z(2651);p.exports=function(p){return et(this,p).has(p)}},4739(p,_,Z){var et=Z(6025);p.exports=function(p){var _=this.__data__,Z=et(_,p);return Z<0?void 0:_[Z][1]}},4840(p,_,Z){var et="object"==typeof Z.g&&Z.g&&Z.g.Object===Object&&Z.g;p.exports=et},4894(p,_,Z){var et=Z(1882),el=Z(294);p.exports=function(p){return null!=p&&el(p.length)&&!et(p)}},4901(p,_,Z){var et=Z(2552),el=Z(294),eu=Z(346),ed={};ed["[object Float32Array]"]=ed["[object Float64Array]"]=ed["[object Int8Array]"]=ed["[object Int16Array]"]=ed["[object Int32Array]"]=ed["[object Uint8Array]"]=ed["[object Uint8ClampedArray]"]=ed["[object Uint16Array]"]=ed["[object Uint32Array]"]=!0,ed["[object Arguments]"]=ed["[object Array]"]=ed["[object ArrayBuffer]"]=ed["[object Boolean]"]=ed["[object DataView]"]=ed["[object Date]"]=ed["[object Error]"]=ed["[object Function]"]=ed["[object Map]"]=ed["[object Number]"]=ed["[object Object]"]=ed["[object RegExp]"]=ed["[object Set]"]=ed["[object String]"]=ed["[object WeakMap]"]=!1,p.exports=function(p){return eu(p)&&el(p.length)&&!!ed[et(p)]}},4974(p){p.exports=function(p,_){if(("constructor"!==_||"function"!=typeof p[_])&&"__proto__"!=_)return p[_]}},5020(p,_,Z){var r=function(p){return String(Number(p))===p?Number(p):p},i=function(p,_,Z){var et=p.name&&p.names;p.push&&!_[p.push]?_[p.push]=[]:et&&!_[p.name]&&(_[p.name]={});var el=p.push?{}:et?_[p.name]:_;(function(p,_,Z,et){if(et&&!Z)_[et]=r(p[1]);else for(var el=0;el<Z.length;el+=1)null!=p[el+1]&&(_[Z[el]]=r(p[el+1]))})(Z.match(p.reg),el,p.names,p.name),p.push&&_[p.push].push(el)},et=Z(5602),el=RegExp.prototype.test.bind(/^([a-z])=(.*)/);_.parse=function(p){var _={},Z=[],eu=_;return p.split(/(\r\n|\r|\n)/).filter(el).forEach(function(p){var _=p[0],el=p.slice(2);"m"===_&&(Z.push({rtp:[],fmtp:[]}),eu=Z[Z.length-1]);for(var ed=0;ed<(et[_]||[]).length;ed+=1){var eh=et[_][ed];if(eh.reg.test(el))return i(eh,eu,el)}}),_.media=Z,_};var a=function(p,_){var Z=_.split(/=(.+)/,2);return 2===Z.length?p[Z[0]]=r(Z[1]):1===Z.length&&_.length>1&&(p[Z[0]]=void 0),p};_.parseParams=function(p){return p.split(/;\s?/).reduce(a,{})},_.parseFmtpConfig=_.parseParams,_.parsePayloads=function(p){return p.toString().split(" ").map(Number)},_.parseRemoteCandidates=function(p){for(var _=[],Z=p.split(" ").map(r),et=0;et<Z.length;et+=3)_.push({component:Z[et],ip:Z[et+1],port:Z[et+2]});return _},_.parseImageAttributes=function(p){return p.split(" ").map(function(p){return p.substring(1,p.length-1).split(",").reduce(a,{})})},_.parseSimulcastStreamList=function(p){return p.split(";").map(function(p){return p.split(",").map(function(p){var _,Z=!1;return"~"!==p[0]?_=r(p):(_=r(p.substring(1,p.length)),Z=!0),{scid:_,paused:Z}})})}},5083(p,_,Z){var et=Z(1882),el=Z(7296),eu=Z(3805),ed=Z(7473),eh=/^\[object .+?Constructor\]$/,ep=Object.prototype,ef=Function.prototype.toString,eg=ep.hasOwnProperty,ev=RegExp("^"+ef.call(eg).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");p.exports=function(p){return!(!eu(p)||el(p))&&(et(p)?ev:eh).test(ed(p))}},5250(p,_,Z){var et=Z(7217),el=Z(7805),eu=Z(6649),ed=Z(2824),eh=Z(3805),ep=Z(7241),ef=Z(4974);p.exports=function e(p,_,Z,eg,ev){p!==_&&eu(_,function(eu,ep){if(ev||(ev=new et),eh(eu))ed(p,_,ep,Z,e,eg,ev);else{var em=eg?eg(ef(p,ep),eu,ep+"",p,_,ev):void 0;void 0===em&&(em=eu),el(p,ep,em)}},ep)}},5288(p){p.exports=function(p,_){return p===_||p!=p&&_!=_}},5364(p,_,Z){var et=Z(5250),el=Z(999)(function(p,_,Z){et(p,_,Z)});p.exports=el},5481(p,_,Z){var et=Z(9325)["__core-js_shared__"];p.exports=et},5512(p){"use strict";p.exports=function(p,_,Z,et){var el=self||window;try{try{try{eu=new el.Blob([p])}catch(_){(eu=new(el.BlobBuilder||el.WebKitBlobBuilder||el.MozBlobBuilder||el.MSBlobBuilder)).append(p),eu=eu.getBlob()}var eu,ed=el.URL||el.webkitURL,eh=ed.createObjectURL(eu),ep=new el[_](eh,Z);return ed.revokeObjectURL(eh),ep}catch(et){return new el[_]("data:application/javascript,".concat(encodeURIComponent(p)),Z)}}catch(p){if(!et)throw Error("Inline worker is not supported");return new el[_](et,Z)}}},5527(p){var _=Object.prototype;p.exports=function(p){var Z=p&&p.constructor;return p===("function"==typeof Z&&Z.prototype||_)}},5529(p,_,Z){var et=Z(9344),el=Z(8879),eu=Z(5527);p.exports=function(p){return"function"!=typeof p.constructor||eu(p)?{}:et(el(p))}},5602(p){var _=p.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(p){return p.encoding?"rtpmap:%d %s/%s/%s":p.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(p){return null!=p.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(p){return null!=p.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S
1*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(p){return"extmap:%d"+(p.direction?"/%s":"%v")+(p["encrypt-uri"]?" %s":"%v")+" %s"+(p.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(p){return null!=p.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(p){var _="candidate:%s %d %s %d %s %d typ %s";return _+=(null!=p.raddr?" raddr %s rport %d":"%v%v")+(null!=p.tcptype?" tcptype %s":"%v"),null!=p.generation&&(_+=" generation %d"),_+=(null!=p["network-id"]?" network-id %d":"%v")+(null!=p["network-cost"]?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(p){var _="ssrc:%d";return null!=p.attribute&&(_+=" %s",null!=p.value&&(_+=":%s")),_}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(p){return null!=p.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(p){return p.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(p){return"imageattr:%s %s %s"+(p.dir2?" %s %s":"")}},{name:"simulcast",reg:RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(p){return"simulcast:%s %s"+(p.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"}
vendor: 4,433 bytes, line 1
1,{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(p){return"ts-refclk:%s"+(null!=p.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(p){return"mediaclk:"+(null!=p.id?"id=%s %s":"%v%s")+(null!=p.mediaClockValue?"=%s":"")+(null!=p.rateNumerator?" rate=%s":"")+(null!=p.rateDenominator?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(_).forEach(function(p){_[p].forEach(function(p){p.reg||(p.reg=/(.*)/),p.format||(p.format="%s")})})},5749(p,_,Z){var et=Z(1042);p.exports=function(p,_){var Z=this.__data__;return this.size+=this.has(p)?0:1,Z[p]=et&&void 0===_?"__lodash_hash_undefined__":_,this}},6009(p,_,Z){p=Z.nmd(p);var et=Z(4840),el=_&&!_.nodeType&&_,eu=el&&p&&!p.nodeType&&p,ed=eu&&eu.exports===el&&et.process,eh=function(){try{return eu&&eu.require&&eu.require("util").types||ed&&ed.binding&&ed.binding("util")}catch(p){}}();p.exports=eh},6025(p,_,Z){var et=Z(5288);p.exports=function(p,_){for(var Z=p.length;Z--;)if(et(p[Z][0],_))return Z;return -1}},6110(p,_,Z){var et=Z(5083),el=Z(392);p.exports=function(p,_){var Z=el(p,_);return et(Z)?Z:void 0}},6449(p){var _=Array.isArray;p.exports=_},6547(p,_,Z){var et=Z(3360),el=Z(5288),eu=Object.prototype.hasOwnProperty;p.exports=function(p,_,Z){var ed=p[_];eu.call(p,_)&&el(ed,Z)&&(void 0!==Z||_ in p)||et(p,_,Z)}},6649(p,_,Z){var et=Z(3221)();p.exports=et},6721(p,_,Z){var et=Z(1042),el=Object.prototype.hasOwnProperty;p.exports=function(p){var _=this.__data__;if(et){var Z=_[p];return"__lodash_hash_undefined__"===Z?void 0:Z}return el.call(_,p)?_[p]:void 0}},6757(p,_,Z){var et=Z(1033),el=Math.max;p.exports=function(p,_,Z){return _=el(void 0===_?p.length-1:_,0),function(){for(var eu=arguments,ed=-1,eh=el(eu.length-_,0),ep=Array(eh);++ed<eh;)ep[ed]=eu[_+ed];ed=-1;for(var ef=Array(_+1);++ed<_;)ef[ed]=eu[ed];return ef[_]=Z(ep),et(p,this,ef)}}},6800(p,_,Z){var et=Z(5288),el=Z(4894),eu=Z(361),ed=Z(3805);p.exports=function(p,_,Z){if(!ed(Z))return!1;var eh=typeof _;return!!("number"==eh?el(Z)&&eu(_,Z.length):"string"==eh&&_ in Z)&&et(Z[_],p)}},6880(p){p.exports=function(p){var _={};function n(Z){if(_[Z])return _[Z].exports;var et=_[Z]={i:Z,l:!1,exports:{}};return p[Z].call(et.exports,et,et.exports,n),et.l=!0,et.exports}return n.m=p,n.c=_,n.d=function(p,_,Z){n.o(p,_)||Object.defineProperty(p,_,{enumerable:!0,get:Z})},n.r=function(p){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},n.t=function(p,_){if(1&_&&(p=n(p)),8&_||4&_&&"object"==typeof p&&p&&p.__esModule)return p;var Z=Object.create(null);if(n.r(Z),Object.defineProperty(Z,"default",{enumerable:!0,value:p}),2&_&&"string"!=typeof p)for(var et in p)n.d(Z,et,(function(_){return p[_]}).bind(null,et));return Z},n.n=function(p){var _=p&&p.__esModule?function(){return p.default}:function(){return p};return n.d(_,"a",_),_},n.o=function(p,_){return Object.prototype.hasOwnProperty.call(p,_)},n.p="",n(n.s=90)}({17:function(p,_,Z){"use strict";_.__esModule=!0,_.default=void 0;var et=Z(18),el=function(){function e(){}return e.getFirstMatch=function(p,_){var Z=_.match(p);return Z&&Z.length>0&&Z[1]||""},e.getSecondMatch=function(p,_){var Z=_.match(p);return Z&&Z.length>1&&Z[2]||""},e.matchAndReturnConst=function(p,_,Z){if(p.test(_))return Z},e.getWindowsVersionName=function(p){switch(p){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(p){var _=p.split(".").splice(0,2).map(function(p){return parseInt(p,10)||0});if(_.push(0),10===_[0])switch(_[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";
vendor: 9,170 bytes, line 1
1case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(p){var _=p.split(".").splice(0,2).map(function(p){return parseInt(p,10)||0});if(_.push(0),!(1===_[0]&&_[1]<5))return 1===_[0]&&_[1]<6?"Cupcake":1===_[0]&&_[1]>=6?"Donut":2===_[0]&&_[1]<2?"Eclair":2===_[0]&&2===_[1]?"Froyo":2===_[0]&&_[1]>2?"Gingerbread":3===_[0]?"Honeycomb":4===_[0]&&_[1]<1?"Ice Cream Sandwich":4===_[0]&&_[1]<4?"Jelly Bean":4===_[0]&&_[1]>=4?"KitKat":5===_[0]?"Lollipop":6===_[0]?"Marshmallow":7===_[0]?"Nougat":8===_[0]?"Oreo":9===_[0]?"Pie":void 0},e.getVersionPrecision=function(p){return p.split(".").length},e.compareVersions=function(p,_,Z){void 0===Z&&(Z=!1);var et=e.getVersionPrecision(p),el=e.getVersionPrecision(_),eu=Math.max(et,el),ed=0,eh=e.map([p,_],function(p){var _=eu-e.getVersionPrecision(p),Z=p+Array(_+1).join(".0");return e.map(Z.split("."),function(p){return Array(20-p.length).join("0")+p}).reverse()});for(Z&&(ed=eu-Math.min(et,el)),eu-=1;eu>=ed;){if(eh[0][eu]>eh[1][eu])return 1;if(eh[0][eu]===eh[1][eu]){if(eu===ed)return 0;eu-=1}else if(eh[0][eu]<eh[1][eu])return -1}},e.map=function(p,_){var Z,et=[];if(Array.prototype.map)return Array.prototype.map.call(p,_);for(Z=0;Z<p.length;Z+=1)et.push(_(p[Z]));return et},e.find=function(p,_){var Z,et;if(Array.prototype.find)return Array.prototype.find.call(p,_);for(Z=0,et=p.length;Z<et;Z+=1){var el=p[Z];if(_(el,Z))return el}},e.assign=function(p){for(var _,Z,et=arguments.length,el=Array(et>1?et-1:0),eu=1;eu<et;eu++)el[eu-1]=arguments[eu];if(Object.assign)return Object.assign.apply(Object,[p].concat(el));for(_=0,Z=el.length;_<Z;_+=1)(function(){var Z=el[_];"object"==typeof Z&&null!==Z&&Object.keys(Z).forEach(function(_){p[_]=Z[_]})})();return p},e.getBrowserAlias=function(p){return et.BROWSER_ALIASES_MAP[p]},e.getBrowserTypeByAlias=function(p){return et.BROWSER_MAP[p]||""},e}();_.default=el,p.exports=_.default},18:function(p,_,Z){"use strict";_.__esModule=!0,_.ENGINE_MAP=_.OS_MAP=_.PLATFORMS_MAP=_.BROWSER_MAP=_.BROWSER_ALIASES_MAP=void 0,_.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},_.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},_.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},_.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},_.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(p,_,Z){"use strict";_.__esModule=!0,_.default=void 0;var et,el=(et=Z(91))&&et.__esModule?et:{default:et},eu=Z(18),ed=function(){function e(){}return e.getParser=function(p,_){if(void 0===_&&(_=!1),"string"!=typeof p)throw Error("UserAgent should be a string");return new el.default(p,_)},e.parse=function(p){return new el.default(p).getResult()},function(p,_){for(var Z=0;Z<_.length;Z++){var et=_[Z];et.enumerable=et.enumerable||!1,et.configurable=!0,"value"in et&&(et.writable=!0),Object.defineProperty(p,et.key,et)}}(e,[{key:"BROWSER_MAP",get:function(){return eu.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return eu.ENGINE_MAP}},{key:"OS_MAP",get:function(){return eu.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return eu.PLATFORMS_MAP}}]),e}();_.default=ed,p.exports=_.default},91:function(p,_,Z){"use strict";_.__esModule=!0,_.default=void 0;var et=c(Z(92)),el=c(Z(93)),eu=c(Z(94)),ed=c(Z(95)),eh=c(Z(17));function c(p){return p&&p.__esModule?p:{default:p}}var ep=function(){function e(p,_){if(void 0===_&&(_=!1),null==p||""===p)throw Error("UserAgent parameter can't be empty");this._ua=p,this.parsedResult={},!0!==_&&this.parse()}var p=e.prototype;return p.getUA=function(){return this._ua},p.test=function(p){return p.test(this._ua)},p.parseBrowser=function(){var p=this;this.parsedResult.browser={};var _=eh.default.find(et.default,function(_){if("function"==typeof _.test)return _.test(p);if(_.test instanceof Array)return _.test.some(function(_){return p.test(_)});throw Error("Browser's test function is not valid")});return _&&(this.parsedResult.browser=_.describe(this.getUA())),this.parsedResult.browser},p.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},p.getBrowserName=function(p){return p?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},p.getBrowserVersion=function(){return this.getBrowser().version},p.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},p.parseOS=function(){var p=this;this.parsedResult.os={};var _=eh.default.find(el.default,function(_){if("function"==typeof _.test)return _.test(p);if(_.test instanceof Array)return _.test.some(function(_){return p.test(_)});throw Error("Browser's test function is not valid")});return _&&(this.parsedResult.os=_.describe(this.getUA())),this.parsedResult.os},p.getOSName=function(p){var _=this.getOS().name;return p?String(_).toLowerCase()||"":_||""},p.getOSVersion=function(){return this.getOS().version},p.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},p.getPlatformType=function(p){void 0===p&&(p=!1);var _=this.getPlatform().type;return p?String(_).toLowerCase()||"":_||""},p.parsePlatform=function(){var p=this;this.parsedResult.platform={};var _=eh.default.find(eu.default,function(_){if("function"==typeof _.test)return _.test(p);if(_.test instanceof Array)return _.test.some(function(_){return p.test(_)});throw Error("Browser's test function is not valid")});return _&&(this.parsedResult.platform=_.describe(this.getUA())),this.parsedResult.platform},p.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},p.getEngineName=function(p){return p?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},p.parseEngine=function(){var p=this;this.parsedResult.engine={};var _=eh.default.find(ed.default,function(_){if("function"==typeof _.test)return _.test(p);if(_.test instanceof Array)return _.test.some(function(_){return p.test(_)});throw Error("Browser's test function is not valid")});return _&&(this.parsedResult.engine=_.describe(this.getUA())),this.parsedResult.engine},p.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},p.getResult=function(){return eh.default.assign({},this.parsedResult)},p.satisfies=function(p){var _=this,Z={},et=0,el={},eu=0;if(Object.keys(p).forEach(function(_){var ed=p[_];"string"==typeof ed?(el[_]=ed,eu+=1):"object"==typeof ed&&(Z[_]=ed,et+=1)}),et>0){var ed=Object.keys(Z),ep=eh.default.find(ed,function(p){return _.isOS(p)});if(ep){var ef=this.satisfies(Z[ep]);if(void 0!==ef)return ef}var eg=eh.default.find(ed,function(p){return _.isPlatform(p)});if(eg){var ev=this.satisfies(Z[eg]);if(void 0!==ev)return ev}}if(eu>0){var em=Object.keys(el),eE=eh.default.find(em,function(p){return _.isBrowser(p,!0)});if(void 0!==eE)return this.compareVersion(el[eE])}},p.isBrowser=function(p,_){void 0===_&&(_=!1);var Z=this.getBrowserName().toLowerCase(),et=p.toLowerCase(),el=eh.default.getBrowserTypeByAlias(et);return _&&el&&(et=el.toLowerCase()),et===Z},p.compareVersion=function(p){var _=[0],Z=p,et=!1,el=this.getBrowserVersion();if("string"==typeof el)return">"===p[0]||"<"===p[0]?(Z=p.substr(1),"="===p[1]?(et=!0,Z=p.substr(2)):_=[],">"===p[0]?_.push(1):_.push(-1)):"="===p[0]?Z=p.substr(1):"~"===p[
vendor: 8,541 bytes, line 1
10]&&(et=!0,Z=p.substr(1)),_.indexOf(eh.default.compareVersions(el,Z,et))>-1},p.isOS=function(p){return this.getOSName(!0)===String(p).toLowerCase()},p.isPlatform=function(p){return this.getPlatformType(!0)===String(p).toLowerCase()},p.isEngine=function(p){return this.getEngineName(!0)===String(p).toLowerCase()},p.is=function(p,_){return void 0===_&&(_=!1),this.isBrowser(p,_)||this.isOS(p)||this.isPlatform(p)},p.some=function(p){var _=this;return void 0===p&&(p=[]),p.some(function(p){return _.is(p)})},e}();_.default=ep,p.exports=_.default},92:function(p,_,Z){"use strict";_.__esModule=!0,_.default=void 0;var et,el=(et=Z(17))&&et.__esModule?et:{default:et},eu=/version\/(\d+(\.?_?\d+)+)/i,ed=[{test:[/googlebot/i],describe:function(p){var _={name:"Googlebot"},Z=el.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/opera/i],describe:function(p){var _={name:"Opera"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/opr\/|opios/i],describe:function(p){var _={name:"Opera"},Z=el.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/SamsungBrowser/i],describe:function(p){var _={name:"Samsung Internet for Android"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/Whale/i],describe:function(p){var _={name:"NAVER Whale Browser"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/MZBrowser/i],describe:function(p){var _={name:"MZ Browser"},Z=el.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/focus/i],describe:function(p){var _={name:"Focus"},Z=el.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/swing/i],describe:function(p){var _={name:"Swing"},Z=el.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/coast/i],describe:function(p){var _={name:"Opera Coast"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(p){var _={name:"Opera Touch"},Z=el.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/yabrowser/i],describe:function(p){var _={name:"Yandex Browser"},Z=el.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/ucbrowser/i],describe:function(p){var _={name:"UC Browser"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/Maxthon|mxios/i],describe:function(p){var _={name:"Maxthon"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/epiphany/i],describe:function(p){var _={name:"Epiphany"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/puffin/i],describe:function(p){var _={name:"Puffin"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/sleipnir/i],describe:function(p){var _={name:"Sleipnir"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/k-meleon/i],describe:function(p){var _={name:"K-Meleon"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/micromessenger/i],describe:function(p){var _={name:"WeChat"},Z=el.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/qqbrowser/i],describe:function(p){var _={name:/qqbrowserlite/i.test(p)?"QQ Browser Lite":"QQ Browser"},Z=el.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/msie|trident/i],describe:function(p){var _={name:"Internet Explorer"},Z=el.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/\sedg\//i],describe:function(p){var _={name:"Microsoft Edge"},Z=el.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/edg([ea]|ios)/i],describe:function(p){var _={name:"Microsoft Edge"},Z=el.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/vivaldi/i],describe:function(p){var _={name:"Vivaldi"},Z=el.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/seamonkey/i],describe:function(p){var _={name:"SeaMonkey"},Z=el.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/sailfish/i],describe:function(p){var _={name:"Sailfish"},Z=el.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,p);return Z&&(_.version=Z),_}},{test:[/silk/i],describe:function(p){var _={name:"Amazon Silk"},Z=el.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/phantom/i],describe:function(p){var _={name:"PhantomJS"},Z=el.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/slimerjs/i],describe:function(p){var _={name:"SlimerJS"},Z=el.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(p){var _={name:"BlackBerry"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/(web|hpw)[o0]s/i],describe:function(p){var _={name:"WebOS Browser"},Z=el.default.getFirstMatch(eu,p)||el.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/bada/i],describe:function(p){var _={name:"Bada"},Z=el.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/tizen/i],describe:function(p){var _={name:"Tizen"},Z=el.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/qupzilla/i],describe:function(p){var _={name:"QupZilla"},Z=el.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/firefox|iceweasel|fxios/i],describe:function(p){var _={name:"Firefox"},Z=el.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/electron/i],describe:function(p){var _={name:"Electron"},Z=el.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/MiuiBrowser/i],describe:function(p){var _={name:"Miui"},Z=el.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/chromium/i],describe:function(p){var _={name:"Chromium"},Z=el.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,p)||el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/chrome|crios|crmo/i],describe:function(p){var _={name:"Chrome"},Z=el.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/GSA/i],describe:function(p){var _={name:"Google Search"},Z=el.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:function(p){var _=!p.test(/like android/i),Z=p.test(/android/i);return _&&Z},describe:function(p){var _={name:"Android Browser"},Z=el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/playstation 4/i],describe:function(p){var _={name:"PlayStation 4"},Z=el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/safari|applewebkit/i],describe:function(p){var _={name:"Safari"},Z=el.default.getFirstMatch(eu,p);return Z&&(_.version=Z),_}},{test:[/.*/i],describe:function(p){var _=-1!==p.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:el.default.getFirstMatch(_,p),version:el.default.getSecondMatch(_,p)}}}];_.default=ed,p.exports=_.default},93:function(p,_,Z){"use strict";
vendor: 5,291 bytes, line 1
1_.__esModule=!0,_.default=void 0;var et,el=(et=Z(17))&&et.__esModule?et:{default:et},eu=Z(18),ed=[{test:[/Roku\/DVP/],describe:function(p){var _=el.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,p);return{name:eu.OS_MAP.Roku,version:_}}},{test:[/windows phone/i],describe:function(p){var _=el.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,p);return{name:eu.OS_MAP.WindowsPhone,version:_}}},{test:[/windows /i],describe:function(p){var _=el.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,p),Z=el.default.getWindowsVersionName(_);return{name:eu.OS_MAP.Windows,version:_,versionName:Z}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(p){var _={name:eu.OS_MAP.iOS},Z=el.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,p);return Z&&(_.version=Z),_}},{test:[/macintosh/i],describe:function(p){var _=el.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,p).replace(/[_\s]/g,"."),Z=el.default.getMacOSVersionName(_),et={name:eu.OS_MAP.MacOS,version:_};return Z&&(et.versionName=Z),et}},{test:[/(ipod|iphone|ipad)/i],describe:function(p){var _=el.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,p).replace(/[_\s]/g,".");return{name:eu.OS_MAP.iOS,version:_}}},{test:function(p){var _=!p.test(/like android/i),Z=p.test(/android/i);return _&&Z},describe:function(p){var _=el.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,p),Z=el.default.getAndroidVersionName(_),et={name:eu.OS_MAP.Android,version:_};return Z&&(et.versionName=Z),et}},{test:[/(web|hpw)[o0]s/i],describe:function(p){var _=el.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,p),Z={name:eu.OS_MAP.WebOS};return _&&_.length&&(Z.version=_),Z}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(p){var _=el.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,p)||el.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,p)||el.default.getFirstMatch(/\bbb(\d+)/i,p);return{name:eu.OS_MAP.BlackBerry,version:_}}},{test:[/bada/i],describe:function(p){var _=el.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,p);return{name:eu.OS_MAP.Bada,version:_}}},{test:[/tizen/i],describe:function(p){var _=el.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,p);return{name:eu.OS_MAP.Tizen,version:_}}},{test:[/linux/i],describe:function(){return{name:eu.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:eu.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(p){var _=el.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,p);return{name:eu.OS_MAP.PlayStation4,version:_}}}];_.default=ed,p.exports=_.default},94:function(p,_,Z){"use strict";_.__esModule=!0,_.default=void 0;var et,el=(et=Z(17))&&et.__esModule?et:{default:et},eu=Z(18),ed=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(p){var _=el.default.getFirstMatch(/(can-l01)/i,p)&&"Nova",Z={type:eu.PLATFORMS_MAP.mobile,vendor:"Huawei"};return _&&(Z.model=_),Z}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:eu.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:eu.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:eu.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:eu.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:eu.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:eu.PLATFORMS_MAP.tablet}}},{test:function(p){var _=p.test(/ipod|iphone/i),Z=p.test(/like (ipod|iphone)/i);return _&&!Z},describe:function(p){var _=el.default.getFirstMatch(/(ipod|iphone)/i,p);return{type:eu.PLATFORMS_MAP.mobile,vendor:"Apple",model:_}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:eu.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:eu.PLATFORMS_MAP.mobile}}},{test:function(p){return"blackberry"===p.getBrowserName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(p){return"bada"===p.getBrowserName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.mobile}}},{test:function(p){return"windows phone"===p.getBrowserName()},describe:function(){return{type:eu.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(p){var _=Number(String(p.getOSVersion()).split(".")[0]);return"android"===p.getOSName(!0)&&_>=3},describe:function(){return{type:eu.PLATFORMS_MAP.tablet}}},{test:function(p){return"android"===p.getOSName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.mobile}}},{test:function(p){return"macos"===p.getOSName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(p){return"windows"===p.getOSName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.desktop}}},{test:function(p){return"linux"===p.getOSName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.desktop}}},{test:function(p){return"playstation 4"===p.getOSName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.tv}}},{test:function(p){return"roku"===p.getOSName(!0)},describe:function(){return{type:eu.PLATFORMS_MAP.tv}}}];_.default=ed,p.exports=_.default},95:function(p,_,Z){"use strict";
vendor: 5,580 bytes, line 1
1_.__esModule=!0,_.default=void 0;var et,el=(et=Z(17))&&et.__esModule?et:{default:et},eu=Z(18),ed=[{test:function(p){return"microsoft edge"===p.getBrowserName(!0)},describe:function(p){if(/\sedg\//i.test(p))return{name:eu.ENGINE_MAP.Blink};var _=el.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,p);return{name:eu.ENGINE_MAP.EdgeHTML,version:_}}},{test:[/trident/i],describe:function(p){var _={name:eu.ENGINE_MAP.Trident},Z=el.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:function(p){return p.test(/presto/i)},describe:function(p){var _={name:eu.ENGINE_MAP.Presto},Z=el.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:function(p){var _=p.test(/gecko/i),Z=p.test(/like gecko/i);return _&&!Z},describe:function(p){var _={name:eu.ENGINE_MAP.Gecko},Z=el.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:eu.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(p){var _={name:eu.ENGINE_MAP.WebKit},Z=el.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,p);return Z&&(_.version=Z),_}}];_.default=ed,p.exports=_.default}})},7167(p,_,Z){var et=Z(4901),el=Z(7301),eu=Z(6009),ed=eu&&eu.isTypedArray,eh=ed?el(ed):et;p.exports=eh},7217(p,_,Z){var et=Z(79),el=Z(1420),eu=Z(938),ed=Z(3605),eh=Z(9817),ep=Z(945);function u(p){var _=this.__data__=new et(p);this.size=_.size}u.prototype.clear=el,u.prototype.delete=eu,u.prototype.get=ed,u.prototype.has=eh,u.prototype.set=ep,p.exports=u},7241(p,_,Z){var et=Z(695),el=Z(2903),eu=Z(4894);p.exports=function(p){return eu(p)?et(p,!0):el(p)}},7296(p,_,Z){var et,el=Z(5481),eu=(et=/[^.]+$/.exec(el&&el.keys&&el.keys.IE_PROTO||""))?"Symbol(src)_1."+et:"";p.exports=function(p){return!!eu&&eu in p}},7301(p){p.exports=function(p){return function(_){return p(_)}}},7334(p){p.exports=function(p){return function(){return p}}},7363(p,_,Z){var et=Z(5020),el=Z(3804);_.M9=el,_.qg=et.parse,_.Sl=et.parseParams,et.parseFmtpConfig,et.parsePayloads,et.parseRemoteCandidates,et.parseImageAttributes,et.parseSimulcastStreamList},7473(p){var _=Function.prototype.toString;p.exports=function(p){if(null!=p){try{return _.call(p)}catch(p){}try{return p+""}catch(p){}}return""}},7534(p,_,Z){var et=Z(2552),el=Z(346);p.exports=function(p){return el(p)&&"[object Arguments]"==et(p)}},7670(p,_,Z){var et=Z(2651);p.exports=function(p){var _=et(this,p).delete(p);return this.size-=_?1:0,_}},7805(p,_,Z){var et=Z(3360),el=Z(5288);p.exports=function(p,_,Z){(void 0===Z||el(p[_],Z))&&(void 0!==Z||_ in p)||et(p,_,Z)}},7828(p,_,Z){var et=Z(9325).Uint8Array;p.exports=et},7963(p){"use strict";let _={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};_.localCName=_.generateIdentifier(),_.splitLines=function(p){return p.trim().split("\n").map(p=>p.trim())},_.splitSections=function(p){return p.split("\nm=").map((p,_)=>(_>0?"m="+p:p).trim()+"\r\n")},_.getDescription=function(p){let Z=_.splitSections(p);return Z&&Z[0]},_.getMediaSections=function(p){let Z=_.splitSections(p);return Z.shift(),Z},_.matchPrefix=function(p,Z){return _.splitLines(p).filter(p=>0===p.indexOf(Z))},_.parseCandidate=function(p){let _;_=0===p.indexOf("a=candidate:")?p.substring(12).split(" "):p.substring(10).split(" ");let Z={foundation:_[0],component:{1:"rtp",2:"rtcp"}[_[1]]||_[1],protocol:_[2].toLowerCase(),priority:parseInt(_[3],10),ip:_[4],address:_[4],port:parseInt(_[5],10),type:_[7]};for(let p=8;p<_.length;p+=2)switch(_[p]){case"raddr":Z.relatedAddress=_[p+1];break;case"rport":Z.relatedPort=parseInt(_[p+1],10);break;case"tcptype":Z.tcpType=_[p+1];break;case"ufrag":Z.ufrag=_[p+1],Z.usernameFragment=_[p+1];break;default:void 0===Z[_[p]]&&(Z[_[p]]=_[p+1])}return Z},_.writeCandidate=function(p){let _=[];_.push(p.foundation);let Z=p.component;"rtp"===Z?_.push(1):"rtcp"===Z?_.push(2):_.push(Z),_.push(p.protocol.toUpperCase()),_.push(p.priority),_.push(p.address||p.ip),_.push(p.port);let et=p.type;return _.push("typ"),_.push(et),"host"!==et&&p.relatedAddress&&p.relatedPort&&(_.push("raddr"),_.push(p.relatedAddress),_.push("rport"),_.push(p.relatedPort)),p.tcpType&&"tcp"===p.protocol.toLowerCase()&&(_.push("tcptype"),_.push(p.tcpType)),(p.usernameFragment||p.ufrag)&&(_.push("ufrag"),_.push(p.usernameFragment||p.ufrag)),"candidate:"+_.join(" ")},_.parseIceOptions=function(p){return p.substring(14).split(" ")},_.parseRtpMap=function(p){let _=p.substring(9).split(" "),Z={payloadType:parseInt(_.shift(),10)};return _=_[0].split("/"),Z.name=_[0],Z.clockRate=parseInt(_[1],10),Z.channels=3===_.length?parseInt(_[2],10):1,Z.numChannels=Z.channels,Z},_.writeRtpMap=function(p){let _=p.payloadType;void 0!==p.preferredPayloadType&&(_=p.preferredPayloadType);let Z=p.channels||p.numChannels||1;return"a=rtpmap:"+_+" "+p.name+"/"+p.clockRate+(1!==Z?"/"+Z:"")+"\r\n"},_.parseExtmap=function(p){let _=p.substring(9).split(" ");return{id:parseInt(_[0],10),direction:_[0].indexOf("/")>0?_[0].split("/")[1]:"sendrecv",uri:_[1],attributes:_.slice(2).join(" ")}},_.writeExtmap=function(p){return"a=extmap:"+(p.id||p.preferredId)+(p.direction&&"sendrecv"!==p.direction?"/"+p.direction:"")+" "+p.uri+(p.attributes?" "+p.attributes:"")+"\r\n"},_.parseFmtp=function(p){let _;let Z={},et=p.substring(p.indexOf(" ")+1).split(";");for(let p=0;p<et.length;p++)Z[(_=et[p].trim().split("="))[0].trim()]=_[1];return Z},_.writeFmtp=function(p){let _="",Z=p.payloadType;if(void 0!==p.preferredPayloadType&&(Z=p.preferredPayloadType),p.parameters&&Object.keys(p.parameters).length){let et=[];
vendor: 7,843 bytes, line 1
1Object.keys(p.parameters).forEach(_=>{void 0!==p.parameters[_]?et.push(_+"="+p.parameters[_]):et.push(_)}),_+="a=fmtp:"+Z+" "+et.join(";")+"\r\n"}return _},_.parseRtcpFb=function(p){let _=p.substring(p.indexOf(" ")+1).split(" ");return{type:_.shift(),parameter:_.join(" ")}},_.writeRtcpFb=function(p){let _="",Z=p.payloadType;return void 0!==p.preferredPayloadType&&(Z=p.preferredPayloadType),p.rtcpFeedback&&p.rtcpFeedback.length&&p.rtcpFeedback.forEach(p=>{_+="a=rtcp-fb:"+Z+" "+p.type+(p.parameter&&p.parameter.length?" "+p.parameter:"")+"\r\n"}),_},_.parseSsrcMedia=function(p){let _=p.indexOf(" "),Z={ssrc:parseInt(p.substring(7,_),10)},et=p.indexOf(":",_);return et>-1?(Z.attribute=p.substring(_+1,et),Z.value=p.substring(et+1)):Z.attribute=p.substring(_+1),Z},_.parseSsrcGroup=function(p){let _=p.substring(13).split(" ");return{semantics:_.shift(),ssrcs:_.map(p=>parseInt(p,10))}},_.getMid=function(p){let Z=_.matchPrefix(p,"a=mid:")[0];if(Z)return Z.substring(6)},_.parseFingerprint=function(p){let _=p.substring(14).split(" ");return{algorithm:_[0].toLowerCase(),value:_[1].toUpperCase()}},_.getDtlsParameters=function(p,Z){return{role:"auto",fingerprints:_.matchPrefix(p+Z,"a=fingerprint:").map(_.parseFingerprint)}},_.writeDtlsParameters=function(p,_){let Z="a=setup:"+_+"\r\n";return p.fingerprints.forEach(p=>{Z+="a=fingerprint:"+p.algorithm+" "+p.value+"\r\n"}),Z},_.parseCryptoLine=function(p){let _=p.substring(9).split(" ");return{tag:parseInt(_[0],10),cryptoSuite:_[1],keyParams:_[2],sessionParams:_.slice(3)}},_.writeCryptoLine=function(p){return"a=crypto:"+p.tag+" "+p.cryptoSuite+" "+("object"==typeof p.keyParams?_.writeCryptoKeyParams(p.keyParams):p.keyParams)+(p.sessionParams?" "+p.sessionParams.join(" "):"")+"\r\n"},_.parseCryptoKeyParams=function(p){if(0!==p.indexOf("inline:"))return null;let _=p.substring(7).split("|");return{keyMethod:"inline",keySalt:_[0],lifeTime:_[1],mkiValue:_[2]?_[2].split(":")[0]:void 0,mkiLength:_[2]?_[2].split(":")[1]:void 0}},_.writeCryptoKeyParams=function(p){return p.keyMethod+":"+p.keySalt+(p.lifeTime?"|"+p.lifeTime:"")+(p.mkiValue&&p.mkiLength?"|"+p.mkiValue+":"+p.mkiLength:"")},_.getCryptoParameters=function(p,Z){return _.matchPrefix(p+Z,"a=crypto:").map(_.parseCryptoLine)},_.getIceParameters=function(p,Z){let et=_.matchPrefix(p+Z,"a=ice-ufrag:")[0],el=_.matchPrefix(p+Z,"a=ice-pwd:")[0];return et&&el?{usernameFragment:et.substring(12),password:el.substring(10)}:null},_.writeIceParameters=function(p){let _="a=ice-ufrag:"+p.usernameFragment+"\r\na=ice-pwd:"+p.password+"\r\n";return p.iceLite&&(_+="a=ice-lite\r\n"),_},_.parseRtpParameters=function(p){let Z={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},et=_.splitLines(p)[0].split(" ");Z.profile=et[2];for(let el=3;el<et.length;el++){let eu=et[el],ed=_.matchPrefix(p,"a=rtpmap:"+eu+" ")[0];if(ed){let et=_.parseRtpMap(ed),el=_.matchPrefix(p,"a=fmtp:"+eu+" ");switch(et.parameters=el.length?_.parseFmtp(el[0]):{},et.rtcpFeedback=_.matchPrefix(p,"a=rtcp-fb:"+eu+" ").map(_.parseRtcpFb),Z.codecs.push(et),et.name.toUpperCase()){case"RED":case"ULPFEC":Z.fecMechanisms.push(et.name.toUpperCase())}}}_.matchPrefix(p,"a=extmap:").forEach(p=>{Z.headerExtensions.push(_.parseExtmap(p))});let el=_.matchPrefix(p,"a=rtcp-fb:* ").map(_.parseRtcpFb);return Z.codecs.forEach(p=>{el.forEach(_=>{p.rtcpFeedback.find(p=>p.type===_.type&&p.parameter===_.parameter)||p.rtcpFeedback.push(_)})}),Z},_.writeRtpDescription=function(p,Z){let et="";et+="m="+p+" "+(Z.codecs.length>0?"9":"0")+" "+(Z.profile||"UDP/TLS/RTP/SAVPF")+" "+Z.codecs.map(p=>void 0!==p.preferredPayloadType?p.preferredPayloadType:p.payloadType).join(" ")+"\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\n",Z.codecs.forEach(p=>{et+=_.writeRtpMap(p)+_.writeFmtp(p)+_.writeRtcpFb(p)});let el=0;return Z.codecs.forEach(p=>{p.maxptime>el&&(el=p.maxptime)}),el>0&&(et+="a=maxptime:"+el+"\r\n"),Z.headerExtensions&&Z.headerExtensions.forEach(p=>{et+=_.writeExtmap(p)}),et},_.parseRtpEncodingParameters=function(p){let Z;let et=[],el=_.parseRtpParameters(p),eu=-1!==el.fecMechanisms.indexOf("RED"),ed=-1!==el.fecMechanisms.indexOf("ULPFEC"),eh=_.matchPrefix(p,"a=ssrc:").map(p=>_.parseSsrcMedia(p)).filter(p=>"cname"===p.attribute),ep=eh.length>0&&eh[0].ssrc,ef=_.matchPrefix(p,"a=ssrc-group:FID").map(p=>p.substring(17).split(" ").map(p=>parseInt(p,10)));ef.length>0&&ef[0].length>1&&ef[0][0]===ep&&(Z=ef[0][1]),el.codecs.forEach(p=>{if("RTX"===p.name.toUpperCase()&&p.parameters.apt){let _={ssrc:ep,codecPayloadType:parseInt(p.parameters.apt,10)};ep&&Z&&(_.rtx={ssrc:Z}),et.push(_),eu&&((_=JSON.parse(JSON.stringify(_))).fec={ssrc:ep,mechanism:ed?"red+ulpfec":"red"},et.push(_))}}),0===et.length&&ep&&et.push({ssrc:ep});let eg=_.matchPrefix(p,"b=");return eg.length&&(eg=0===eg[0].indexOf("b=TIAS:")?parseInt(eg[0].substring(7),10):0===eg[0].indexOf("b=AS:")?1e3*parseInt(eg[0].substring(5),10)*.95-16e3:void 0,et.forEach(p=>{p.maxBitrate=eg})),et},_.parseRtcpParameters=function(p){let Z={},et=_.matchPrefix(p,"a=ssrc:").map(p=>_.parseSsrcMedia(p)).filter(p=>"cname"===p.attribute)[0];et&&(Z.cname=et.value,Z.ssrc=et.ssrc);let el=_.matchPrefix(p,"a=rtcp-rsize");Z.reducedSize=el.length>0,Z.compound=0===el.length;let eu=_.matchPrefix(p,"a=rtcp-mux");return Z.mux=eu.length>0,Z},_.writeRtcpParameters=function(p){let _="";return p.reducedSize&&(_+="a=rtcp-rsize\r\n"),p.mux&&(_+="a=rtcp-mux\r\n"),void 0!==p.ssrc&&p.cname&&(_+="a=ssrc:"+p.ssrc+" cname:"+p.cname+"\r\n"),_},_.parseMsid=function(p){let Z;let et=_.matchPrefix(p,"a=msid:");if(1===et.length)return{stream:(Z=et[0].substring(7).split(" "))[0],track:Z[1]};let el=_.matchPrefix(p,"a=ssrc:").map(p=>_.parseSsrcMedia(p)).filter(p=>"msid"===p.attribute);return el.length>0?{stream:(Z=el[0].value.split(" "))[0],track:Z[1]}:void 0},_.parseSctpDescription=function(p){let Z;let et=_.parseMLine(p),el=_.matchPrefix(p,"a=max-message-size:");el.length>0&&(Z=parseInt(el[0].substring(19),10)),isNaN(Z)&&(Z=65536);let eu=_.matchPrefix(p,"a=sctp-port:");if(eu.length>0)return{port:parseInt(eu[0].substring(12),10),protocol:et.fmt,maxMessageSize:Z};let ed=_.matchPrefix(p,"a=sctpmap:");if(ed.length>0){let p=ed[0].substring(10).split(" ");return{port:parseInt(p[0],10),protocol:p[1],maxMessageSize:Z}}},_.writeSctpDescription=function(p,_){let Z=[];return Z="DTLS/SCTP"!==p.protocol?["m="+p.kind+" 9 "+p.protocol+" "+_.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+_.port+"\r\n"]:["m="+p.kind+" 9 "+p.protocol+" "+_.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+_.port+" "+_.protocol+" 65535\r\n"],void 0!==_.maxMessageSize&&Z.push("a=max-message-size:"+_.maxMessageSize+"\r\n"),Z.join("")},_.generateSessionId=function(){return Math.random().toString().substr(2,22)},_.writeSessionBoilerplate=function(p,Z,et){return"v=0\r\no="+(et||"thisisadapterortc")+" "+(p||_.generateSessionId())+" "+(void 0!==Z?Z:2)+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},_.getDirection=function(p,Z){let et=_.splitLines(p);for(let p=0;p<et.length;p++)switch(et[p]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return et[p].substring(2)}return Z?_.getDirection(Z):"sendrecv"},_.getKind=function(p){return _.splitLines(p)[0].split(" ")[0].substring(2)},_.isRejected=function(p){return"0"===p.split(" ",2)[1]},_.parseMLine=function(p){let Z=_.splitLines(p)[0].substring(2).split(" ");return{kind:Z[0],port:parseInt(Z[1],10),protocol:Z[2],fmt:Z.slice(3).join(" ")}},_.parseOLine=function(p){let Z=_.matchPrefix(p,"o=")[0].substring(2).split(" ");return{username:Z[0],sessionId:Z[1],sessionVersion:parseInt(Z[2],10),netType:Z[3],addressType:Z[4],address:Z[5]}},_.isValidSDP=function(p){if("string"!=typeof p||0===p.length)return!1;let Z=_.splitLines(p);for(let p=0;p<Z.length;p++)if(Z[p].length<2||"="!==Z[p].charAt(1))return!1;return!0},p.exports=_},8096(p){p.exports=function(p,_){for(var Z=-1,et=Array(p);
1++Z<p;)et[Z]=_(Z);return et}},8223(p,_,Z){var et=Z(6110)(Z(9325),"Map");p.exports=et},8630(p,_,Z){var et,el;el=et||(et={}),function(){var p="object"==typeof globalThis?globalThis:"object"==typeof Z.g?Z.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(p){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(p){}}(),_=i(el);function i(p,_){return function(Z,et){Object.defineProperty(p,Z,{configurable:!0,writable:!0,value:et}),_&&_(Z,et)}}void 0!==p.Reflect&&(_=i(p.Reflect,_)),function(p,_){var Z,et=Object.prototype.hasOwnProperty,el="function"==typeof Symbol,eu=el&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",ed=el&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",eh="function"==typeof Object.create,ep=({__proto__:[]})instanceof Array,ef=!eh&&!ep,eg={create:eh?function(){return de(Object.create(null))}:ep?function(){return de({__proto__:null})}:function(){return de({})},has:ef?function(p,_){return et.call(p,_)}:function(p,_){return _ in p},get:ef?function(p,_){return et.call(p,_)?p[_]:void 0}:function(p,_){return p[_]}},ev=Object.getPrototypeOf(Function),em="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var p={},_=[],Z=function(){function e(p,_,Z){this._index=0,this._keys=p,this._values=_,this._selector=Z}return e.prototype["@@iterator"]=function(){return this},e.prototype[ed]=function(){return this},e.prototype.next=function(){var p=this._index;if(p>=0&&p<this._keys.length){var Z=this._selector(this._keys[p],this._values[p]);return p+1>=this._keys.length?(this._index=-1,this._keys=_,this._values=_):this._index++,{value:Z,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(p){throw this._index>=0&&(this._index=-1,this._keys=_,this._values=_),p},e.prototype.return=function(p){return this._index>=0&&(this._index=-1,this._keys=_,this._values=_),{value:p,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=p,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(p){return this._find(p,!1)>=0},t.prototype.get=function(p){var _=this._find(p,!1);return _>=0?this._values[_]:void 0},t.prototype.set=function(p,_){var Z=this._find(p,!0);return this._values[Z]=_,this},t.prototype.delete=function(_){var Z=this._find(_,!1);if(Z>=0){for(var et=this._keys.length,el=Z+1;el<et;el++)this._keys[el-1]=this._keys[el],this._values[el-1]=this._values[el];return this._keys.length--,this._values.length--,Y(_,this._cacheKey)&&(this._cacheKey=p,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=p,this._cacheIndex=-2},t.prototype.keys=function(){return new Z(this._keys,this._values,r)},t.prototype.values=function(){return new Z(this._keys,this._values,i)},t.prototype.entries=function(){return new Z(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[ed]=function(){return this.entries()},t.prototype._find=function(p,_){if(!Y(this._cacheKey,p)){this._cacheIndex=-1;for(var Z=0;Z<this._keys.length;Z++)if(Y(this._keys[Z],p)){this._cacheIndex=Z;break}}return this._cacheIndex<0&&_&&(this._cacheIndex=this._keys.length,this._keys.push(p),this._values.push(void 0)),this._cacheIndex},t}();function r(p,_){return p}function i(p,_){return _}function s(p,_){return[p,_]}}(),eE="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new em}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(p){return this._map.has(p)},e.prototype.add=function(p){return this._map.set(p,p),this},e.prototype.delete=function(p){return this._map.delete(p)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[ed]=function(){return this.keys()},e}(),eS="function"==typeof WeakMap?WeakMap:function(){var p=eg.create(),_=i();return function(){function e(){this._key=i()}return e.prototype.has=function(p){var _=o(p,!1);return void 0!==_&&eg.has(_,this._key)},e.prototype.get=function(p){var _=o(p,!1);return void 0!==_?eg.get(_,this._key):void 0},e.prototype.set=function(p,_){return o(p,!0)[this._key]=_,this},e.prototype.delete=function(p){var _=o(p,!1);return void 0!==_&&delete _[this._key]},e.prototype.clear=function(){this._key=i()},e}();function i(){var _;do _="@@WeakMap@@"+function(){var p=function(p){if("function"==typeof Uint8Array){var _=new Uint8Array(p);return"undefined"!=typeof crypto?crypto.getRandomValues(_):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(_):s(_,p),_}return s(Array(p),p)}(16);p[6]=79&p[6]|64,p[8]=191&p[8]|128;for(var _="",Z=0;Z<16;++Z){var et=p[Z];4!==Z&&6!==Z&&8!==Z||(_+="-"),et<16&&(_+="0"),_+=et.toString(16).toLowerCase()}return _}();while(eg.has(p,_));return p[_]=!0,_}function o(p,Z){if(!et.call(p,_)){if(!Z)return;Object.defineProperty(p,_,{value:eg.create()})}return p[_]}function s(p,_){for(var Z=0;Z<_;++Z)p[Z]=255*Math.random()|0;return p}}(),e_=el?Symbol.for("@reflect-metadata:registry"):void 0,ey=(!U(e_)&&F(_.Reflect)&&Object.isExtensible(_.Reflect)&&(Z=_.Reflect[e_]),U(Z)&&(Z=function(){U(e_)||void 0===_.Reflect||e_ in _.Reflect||"function"!=typeof _.Reflect.defineMetadata||(Z=(p=_.Reflect).defineMetadata,et=p.hasOwnMetadata,el=p.getOwnMetadata,eu=p.getOwnMetadataKeys,ed=p.deleteMetadata,eh=new eS,ep={isProviderFor:function(p,_){var Z=eh.get(p);return!(U(Z)||!Z.has(_))||!!eu(p,_).length&&(U(Z)&&(Z=new eE,eh.set(p,Z)),Z.add(_),!0)},OrdinaryDefineOwnMetadata:Z,OrdinaryHasOwnMetadata:et,OrdinaryGetOwnMetadata:el,OrdinaryOwnMetadataKeys:eu,OrdinaryDeleteMetadata:ed});var p,Z,et,el,eu,ed,eh,ep,ef,eg,ev,ey=new eS,eb={registerProvider:function(p){if(!Object.isExtensible(eb))throw Error("Cannot add provider to a frozen registry.");switch(!0){case ep===p:break;case U(ef):ef=p;break;case ef===p:break;case U(eg):eg=p;break;case eg===p:break;default:void 0===ev&&(ev=new eE),ev.add(p)}},getProvider:u,setProvider:function(p,_,Z){if(!function(p){if(U(p))throw TypeError();return ef===p||eg===p||!U(ev)&&ev.has(p)}(Z))throw Error("Metadata provider not registered.");var et=u(p,_);if(et!==Z){if(!U(et))return!1;var el=ey.get(p);U(el)&&(el=new em,ey.set(p,el)),el.set(_,Z)}return!0}};return eb;function u(p,_){var Z,et=ey.get(p);return U(et)||(Z=et.get(_)),U(Z)&&(U(Z=function(p,_){if(!U(ef)){if(ef.isProviderFor(p,_))return ef;if(!U(eg)){if(eg.isProviderFor(p,_))return ef;if(!U(ev))for(var Z=Q(ev);;){var et=ee(Z);if(!et)return;var el=et.value;if(el.isProviderFor(p,_))return te(Z),el}}}if(!U(ep)&&ep.isProviderFor(p,_))return ep}(p,_))||(U(et)&&(et=new em,ey.set(p,et)),et.set(_,Z))),Z}}()),!U(e_)&&F(_.Reflect)&&Object.isExtensible(_.Reflect)&&Object.defineProperty(_.Reflect,e_,{enumerable:!1,
1configurable:!1,writable:!1,value:Z}),Z),eb=function(p){var _=new eS,Z={isProviderFor:function(p,Z){var et=_.get(p);return!U(et)&&et.has(Z)},OrdinaryDefineOwnMetadata:function(p,_,Z,et){r(Z,et,!0).set(p,_)},OrdinaryHasOwnMetadata:function(p,_,Z){var et=r(_,Z,!1);return!U(et)&&!!et.has(p)},OrdinaryGetOwnMetadata:function(p,_,Z){var et=r(_,Z,!1);if(!U(et))return et.get(p)},OrdinaryOwnMetadataKeys:function(p,_){var Z=[],et=r(p,_,!1);if(U(et))return Z;for(var el=Q(et.keys()),eu=0;;){var ed=ee(el);if(!ed)return Z.length=eu,Z;var eh=ed.value;try{Z[eu]=eh}catch(p){try{te(el)}finally{throw p}}eu++}},OrdinaryDeleteMetadata:function(p,Z,et){var el=r(Z,et,!1);if(U(el)||!el.delete(p))return!1;if(0===el.size){var eu=_.get(Z);U(eu)||(eu.delete(et),0===eu.size&&_.delete(eu))}return!0}};return ey.registerProvider(Z),Z;function r(et,el,eu){var ed=_.get(et),eh=!1;if(U(ed)){if(!eu)return;ed=new em,_.set(et,ed),eh=!0}var ep=ed.get(el);if(U(ep)){if(!eu)return;if(ep=new em,ed.set(el,ep),!p.setProvider(et,el,Z))throw ed.delete(el),eh&&_.delete(et),Error("Wrong provider for target.")}return ep}}(ey);function k(p,_,Z){var et,el=ae(_,Z,!1);return!U(el)&&!!el.OrdinaryHasOwnMetadata(p,_,Z)}function D(p,_,Z){var et=ae(_,Z,!1);if(!U(et))return et.OrdinaryGetOwnMetadata(p,_,Z)}function P(p,_,Z,et){ae(Z,et,!0).OrdinaryDefineOwnMetadata(p,_,Z,et)}function L(p,_){var Z=ae(p,_,!1);return Z?Z.OrdinaryOwnMetadataKeys(p,_):[]}function x(p){if(null===p)return 1;switch(typeof p){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===p?1:6;default:return 6}}function U(p){return void 0===p}function B(p){return null===p}function F(p){return"object"==typeof p?null!==p:"function"==typeof p}function W(p){var _=function(p,_){switch(x(p)){case 0:case 1:case 2:case 3:case 4:case 5:return p}var Z=3===_?"string":5===_?"number":"default",et=X(p,eu);if(void 0!==et){var el=et.call(p,Z);if(F(el))throw TypeError();return el}return function(p,_){if("string"===_){var Z=p.toString;if(K(Z)&&!F(el=Z.call(p))||K(et=p.valueOf)&&!F(el=et.call(p)))return el}else{if(K(et=p.valueOf)&&!F(el=et.call(p)))return el;var et,el,eu=p.toString;if(K(eu)&&!F(el=eu.call(p)))return el}throw TypeError()}(p,"default"===Z?"number":Z)}(p,3);return"symbol"==typeof _?_:""+_}function $(p){return Array.isArray?Array.isArray(p):p instanceof Object?p instanceof Array:"[object Array]"===Object.prototype.toString.call(p)}function K(p){return"function"==typeof p}function z(p){return"function"==typeof p}function Y(p,_){return p===_||p!=p&&_!=_}function X(p,_){var Z=p[_];
1if(null!=Z){if(!K(Z))throw TypeError();return Z}}function Q(p){var _=X(p,ed);if(!K(_))throw TypeError();var Z=_.call(p);if(!F(Z))throw TypeError();return Z}function ee(p){var _=p.next();return!_.done&&_}function te(p){var _=p.return;_&&_.call(p)}function ne(p){var _=Object.getPrototypeOf(p);if("function"!=typeof p||p===ev||_!==ev)return _;var Z=p.prototype,et=Z&&Object.getPrototypeOf(Z);if(null==et||et===Object.prototype)return _;var el=et.constructor;return"function"!=typeof el||el===p?_:el}function ae(p,_,Z){var et=ey.getProvider(p,_);if(!U(et))return et;if(Z){if(ey.setProvider(p,_,eb))return eb;throw Error("Illegal state.")}}function de(p){return p.__=void 0,delete p.__,p}p("decorate",function(p,_,Z,et){if(U(Z)){if(!$(p)||!z(_))throw TypeError();return function(p,_){for(var Z=p.length-1;Z>=0;--Z){var et=(0,p[Z])(_);if(!U(et)&&!B(et)){if(!z(et))throw TypeError();_=et}}return _}(p,_)}if(!$(p)||!F(_)||!F(et)&&!U(et)&&!B(et))throw TypeError();return B(et)&&(et=void 0),function(p,_,Z,et){for(var el=p.length-1;el>=0;--el){var eu=(0,p[el])(_,Z,et);if(!U(eu)&&!B(eu)){if(!F(eu))throw TypeError();et=eu}}return et}(p,_,Z=W(Z),et)}),p("metadata",function(p,_){return function(Z,et){if(!F(Z)||!U(et)&&!function(p){switch(x(p)){case 3:case 4:return!0;default:return!1}}(et))throw TypeError();P(p,_,Z,et)}}),p("defineMetadata",function(p,_,Z,et){if(!F(Z))throw TypeError();return U(et)||(et=W(et)),P(p,_,Z,et)}),p("hasMetadata",function(p,_,Z){if(!F(_))throw TypeError();return U(Z)||(Z=W(Z)),function A(p,_,Z){if(k(p,_,Z))return!0;var et=ne(_);return!B(et)&&A(p,et,Z)}(p,_,Z)}),p("hasOwnMetadata",function(p,_,Z){if(!F(_))throw TypeError();return U(Z)||(Z=W(Z)),k(p,_,Z)}),p("getMetadata",function(p,_,Z){if(!F(_))throw TypeError();return U(Z)||(Z=W(Z)),function N(p,_,Z){if(k(p,_,Z))return D(p,_,Z);var et=ne(_);return B(et)?void 0:N(p,et,Z)}(p,_,Z)}),p("getOwnMetadata",function(p,_,Z){if(!F(_))throw TypeError();return U(Z)||(Z=W(Z)),D(p,_,Z)}),p("getMetadataKeys",function(p,_){if(!F(p))throw TypeError();return U(_)||(_=W(_)),function M(p,_){var Z=L(p,_),et=ne(p);if(null===et)return Z;var el=M(et,_);if(el.length<=0)return Z;if(Z.length<=0)return el;for(var eu=new eE,ed=[],eh=0;eh<Z.length;eh++){var ep=Z[eh];eu.has(ep)||(eu.add(ep),ed.push(ep))}for(var ef=0;ef<el.length;ef++)ep=el[ef],eu.has(ep)||(eu.add(ep),ed.push(ep));return ed}(p,_)}),p("getOwnMetadataKeys",function(p,_){if(!F(p))throw TypeError();return U(_)||(_=W(_)),L(p,_)}),p("deleteMetadata",function(p,_,Z){if(!F(_)||(U(Z)||(Z=W(Z)),!F(_)))throw TypeError();U(Z)||(Z=W(Z));var et=ae(_,Z,!1);return!U(et)&&et.OrdinaryDeleteMetadata(p,_,Z)})}(_,p),void 0===p.Reflect&&(p.Reflect=el)}()},8655(p,_,Z){var et=Z(6025);p.exports=function(p){return et(this.__data__,p)>-1}},8879(p,_,Z){var et=Z(4335)(Object.getPrototypeOf,Object);p.exports=et},8954(p){p.exports=(()=>{var p={228:p=>{"use strict";var _=Object.prototype.hasOwnProperty,Z="~";function r(){}function i(p,_,Z){this.fn=p,this.context=_,this.once=Z||!1}function o(p,_,et,el,eu){if("function"!=typeof et)throw TypeError("The listener must be a function");var ed=new i(et,el||p,eu),eh=Z?Z+_:_;return p._events[eh]?p._events[eh].fn?p._events[eh]=[p._events[eh],ed]:p._events[eh].push(ed):(p._events[eh]=ed,p._eventsCount++),p}function s(p,_){0==--p._eventsCount?p._events=new r:delete p._events[_]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(Z=!1)),a.prototype.eventNames=function(){var p,et,el=[];
vendor: 4,956 bytes, line 1
1if(0===this._eventsCount)return el;for(et in p=this._events)_.call(p,et)&&el.push(Z?et.slice(1):et);return Object.getOwnPropertySymbols?el.concat(Object.getOwnPropertySymbols(p)):el},a.prototype.listeners=function(p){var _=Z?Z+p:p,et=this._events[_];if(!et)return[];if(et.fn)return[et.fn];for(var el=0,eu=et.length,ed=Array(eu);el<eu;el++)ed[el]=et[el].fn;return ed},a.prototype.listenerCount=function(p){var _=Z?Z+p:p,et=this._events[_];return et?et.fn?1:et.length:0},a.prototype.emit=function(p,_,et,el,eu,ed){var eh=Z?Z+p:p;if(!this._events[eh])return!1;var ep,ef,eg=this._events[eh],ev=arguments.length;if(eg.fn){switch(eg.once&&this.removeListener(p,eg.fn,void 0,!0),ev){case 1:return eg.fn.call(eg.context),!0;case 2:return eg.fn.call(eg.context,_),!0;case 3:return eg.fn.call(eg.context,_,et),!0;case 4:return eg.fn.call(eg.context,_,et,el),!0;case 5:return eg.fn.call(eg.context,_,et,el,eu),!0;case 6:return eg.fn.call(eg.context,_,et,el,eu,ed),!0}for(ef=1,ep=Array(ev-1);ef<ev;ef++)ep[ef-1]=arguments[ef];eg.fn.apply(eg.context,ep)}else{var em,eE=eg.length;for(ef=0;ef<eE;ef++)switch(eg[ef].once&&this.removeListener(p,eg[ef].fn,void 0,!0),ev){case 1:eg[ef].fn.call(eg[ef].context);break;case 2:eg[ef].fn.call(eg[ef].context,_);break;case 3:eg[ef].fn.call(eg[ef].context,_,et);break;case 4:eg[ef].fn.call(eg[ef].context,_,et,el);break;default:if(!ep)for(em=1,ep=Array(ev-1);em<ev;em++)ep[em-1]=arguments[em];eg[ef].fn.apply(eg[ef].context,ep)}}return!0},a.prototype.on=function(p,_,Z){return o(this,p,_,Z,!1)},a.prototype.once=function(p,_,Z){return o(this,p,_,Z,!0)},a.prototype.removeListener=function(p,_,et,el){var eu=Z?Z+p:p;if(!this._events[eu])return this;if(!_)return s(this,eu),this;var ed=this._events[eu];if(ed.fn)ed.fn!==_||el&&!ed.once||et&&ed.context!==et||s(this,eu);else{for(var eh=0,ep=[],ef=ed.length;eh<ef;eh++)(ed[eh].fn!==_||el&&!ed[eh].once||et&&ed[eh].context!==et)&&ep.push(ed[eh]);ep.length?this._events[eu]=1===ep.length?ep[0]:ep:s(this,eu)}return this},a.prototype.removeAllListeners=function(p){var _;return p?(_=Z?Z+p:p,this._events[_]&&s(this,_)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=Z,a.EventEmitter=a,p.exports=a},1549:(p,_,Z)=>{var et=Z(2032),el=Z(3862),eu=Z(6721),ed=Z(2749),eh=Z(5749);function c(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}c.prototype.clear=et,c.prototype.delete=el,c.prototype.get=eu,c.prototype.has=ed,c.prototype.set=eh,p.exports=c},79:(p,_,Z)=>{var et=Z(3702),el=Z(80),eu=Z(4739),ed=Z(8655),eh=Z(1175);function c(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}c.prototype.clear=et,c.prototype.delete=el,c.prototype.get=eu,c.prototype.has=ed,c.prototype.set=eh,p.exports=c},8223:(p,_,Z)=>{var et=Z(6110)(Z(9325),"Map");p.exports=et},3661:(p,_,Z)=>{var et=Z(3040),el=Z(7670),eu=Z(289),ed=Z(4509),eh=Z(2949);function c(p){var _=-1,Z=null==p?0:p.length;for(this.clear();++_<Z;){var et=p[_];this.set(et[0],et[1])}}c.prototype.clear=et,c.prototype.delete=el,c.prototype.get=eu,c.prototype.has=ed,c.prototype.set=eh,p.exports=c},7217:(p,_,Z)=>{var et=Z(79),el=Z(1420),eu=Z(938),ed=Z(3605),eh=Z(9817),ep=Z(945);function u(p){var _=this.__data__=new et(p);this.size=_.size}u.prototype.clear=el,u.prototype.delete=eu,u.prototype.get=ed,u.prototype.has=eh,u.prototype.set=ep,p.exports=u},1873:(p,_,Z)=>{var et=Z(9325).Symbol;p.exports=et},7828:(p,_,Z)=>{var et=Z(9325).Uint8Array;p.exports=et},1033:p=>{p.exports=function(p,_,Z){switch(Z.length){case 0:return p.call(_);case 1:return p.call(_,Z[0]);case 2:return p.call(_,Z[0],Z[1]);case 3:return p.call(_,Z[0],Z[1],Z[2])}return p.apply(_,Z)}},695:(p,_,Z)=>{var et=Z(8096),el=Z(2428),eu=Z(6449),ed=Z(3656),eh=Z(361),ep=Z(7167),ef=Object.prototype.hasOwnProperty;p.exports=function(p,_){var Z=eu(p),eg=!Z&&el(p),ev=!Z&&!eg&&ed(p),em=!Z&&!eg&&!ev&&ep(p),eE=Z||eg||ev||em,eS=eE?et(p.length,String):[],e_=eS.length;for(var ey in p)!_&&!ef.call(p,ey)||eE&&("length"==ey||ev&&("offset"==ey||"parent"==ey)||em&&("buffer"==ey||"byteLength"==ey||"byteOffset"==ey)||eh(ey,e_))||eS.push(ey);return eS}},7805:(p,_,Z)=>{var et=Z(3360),el=Z(5288);p.exports=function(p,_,Z){(void 0===Z||el(p[_],Z))&&(void 0!==Z||_ in p)||et(p,_,Z)}},6547:(p,_,Z)=>{var et=Z(3360),el=Z(5288),eu=Object.prototype.hasOwnProperty;p.exports=function(p,_,Z){var ed=p[_];eu.call(p,_)&&el(ed,Z)&&(void 0!==Z||_ in p)||et(p,_,Z)}},6025:(p,_,Z)=>{var et=Z(5288);p.exports=function(p,_){for(var Z=p.length;Z--;)if(et(p[Z][0],_))return Z;return -1}},3360:(p,_,Z)=>{var et=Z(3243);p.exports=function(p,_,Z){"__proto__"==_&&et?et(p,_,{configurable:!0,enumerable:!0,value:Z,writable:!0}):p[_]=Z}},9344:(p,_,Z)=>{var et=Z(3805),el=Object.create,eu=function(){function e(){}return function(p){if(!et(p))return{};if(el)return el(p);e.prototype=p;var _=new e;return e.prototype=void 0,_}}();p.exports=eu}
vendor: 2,935 bytes, line 1
1,6649:(p,_,Z)=>{var et=Z(3221)();p.exports=et},2552:(p,_,Z)=>{var et=Z(1873),el=Z(659),eu=Z(9350),ed=et?et.toStringTag:void 0;p.exports=function(p){return null==p?void 0===p?"[object Undefined]":"[object Null]":ed&&ed in Object(p)?el(p):eu(p)}},7534:(p,_,Z)=>{var et=Z(2552),el=Z(346);p.exports=function(p){return el(p)&&"[object Arguments]"==et(p)}},5083:(p,_,Z)=>{var et=Z(1882),el=Z(7296),eu=Z(3805),ed=Z(7473),eh=/^\[object .+?Constructor\]$/,ep=Object.prototype,ef=Function.prototype.toString,eg=ep.hasOwnProperty,ev=RegExp("^"+ef.call(eg).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");p.exports=function(p){return!(!eu(p)||el(p))&&(et(p)?ev:eh).test(ed(p))}},4901:(p,_,Z)=>{var et=Z(2552),el=Z(294),eu=Z(346),ed={};ed["[object Float32Array]"]=ed["[object Float64Array]"]=ed["[object Int8Array]"]=ed["[object Int16Array]"]=ed["[object Int32Array]"]=ed["[object Uint8Array]"]=ed["[object Uint8ClampedArray]"]=ed["[object Uint16Array]"]=ed["[object Uint32Array]"]=!0,ed["[object Arguments]"]=ed["[object Array]"]=ed["[object ArrayBuffer]"]=ed["[object Boolean]"]=ed["[object DataView]"]=ed["[object Date]"]=ed["[object Error]"]=ed["[object Function]"]=ed["[object Map]"]=ed["[object Number]"]=ed["[object Object]"]=ed["[object RegExp]"]=ed["[object Set]"]=ed["[object String]"]=ed["[object WeakMap]"]=!1,p.exports=function(p){return eu(p)&&el(p.length)&&!!ed[et(p)]}},2903:(p,_,Z)=>{var et=Z(3805),el=Z(5527),eu=Z(181),ed=Object.prototype.hasOwnProperty;p.exports=function(p){if(!et(p))return eu(p);var _=el(p),Z=[];for(var eh in p)("constructor"!=eh||!_&&ed.call(p,eh))&&Z.push(eh);return Z}},5250:(p,_,Z)=>{var et=Z(7217),el=Z(7805),eu=Z(6649),ed=Z(2824),eh=Z(3805),ep=Z(7241),ef=Z(4974);p.exports=function e(p,_,Z,eg,ev){p!==_&&eu(_,function(eu,ep){if(ev||(ev=new et),eh(eu))ed(p,_,ep,Z,e,eg,ev);else{var em=eg?eg(ef(p,ep),eu,ep+"",p,_,ev):void 0;void 0===em&&(em=eu),el(p,ep,em)}},ep)}},2824:(p,_,Z)=>{var et=Z(7805),el=Z(3290),eu=Z(1961),ed=Z(3007),eh=Z(5529),ep=Z(2428),ef=Z(6449),eg=Z(3693),ev=Z(3656),em=Z(1882),eE=Z(3805),eS=Z(1331),e_=Z(7167),ey=Z(4974),eb=Z(9884);p.exports=function(p,_,Z,eC,eT,eI,eR){var eO=ey(p,Z),eA=ey(_,Z),ek=eR.get(eA);if(ek)et(p,Z,ek);else{var ew=eI?eI(eO,eA,Z+"",p,_,eR):void 0,eN=void 0===ew;if(eN){var eD=ef(eA),eP=!eD&&ev(eA),eM=!eD&&!eP&&e_(eA);ew=eA,eD||eP||eM?ef(eO)?ew=eO:eg(eO)?ew=ed(eO):eP?(eN=!1,ew=el(eA,!0)):eM?(eN=!1,ew=eu(eA,!0)):ew=[]:eS(eA)||ep(eA)?(ew=eO,ep(eO)?ew=eb(eO):eE(eO)&&!em(eO)||(ew=eh(eA))):eN=!1}eN&&(eR.set(eA,ew),eT(ew,eA,eC,eI,eR),eR.delete(eA)),et(p,Z,ew)}}},9302:(p,_,Z)=>{var et=Z(3488),el=Z(6757),eu=Z(2865);p.exports=function(p,_){return eu(el(p,_,et),p+"")}},9570:(p,_,Z)=>{var et=Z(7334),el=Z(3243),eu=Z(3488),ed=el?function(p,_){return el(p,"toString",{configurable:!0,enumerable:!1,value:et(_),writable:!0})}:eu;p.exports=ed},8096:p=>{p.exports=function(p,_){for(var Z=-1,et=Array(p);
vendor: 27,038 bytes, line 1
1++Z<p;)et[Z]=_(Z);return et}},7301:p=>{p.exports=function(p){return function(_){return p(_)}}},9653:(p,_,Z)=>{var et=Z(7828);p.exports=function(p){var _=new p.constructor(p.byteLength);return new et(_).set(new et(p)),_}},3290:(p,_,Z)=>{p=Z.nmd(p);var et=Z(9325),el=_&&!_.nodeType&&_,eu=el&&p&&!p.nodeType&&p,ed=eu&&eu.exports===el?et.Buffer:void 0,eh=ed?ed.allocUnsafe:void 0;p.exports=function(p,_){if(_)return p.slice();var Z=p.length,et=eh?eh(Z):new p.constructor(Z);return p.copy(et),et}},1961:(p,_,Z)=>{var et=Z(9653);p.exports=function(p,_){var Z=_?et(p.buffer):p.buffer;return new p.constructor(Z,p.byteOffset,p.length)}},3007:p=>{p.exports=function(p,_){var Z=-1,et=p.length;for(_||(_=Array(et));++Z<et;)_[Z]=p[Z];return _}},1791:(p,_,Z)=>{var et=Z(6547),el=Z(3360);p.exports=function(p,_,Z,eu){var ed=!Z;Z||(Z={});for(var eh=-1,ep=_.length;++eh<ep;){var ef=_[eh],eg=eu?eu(Z[ef],p[ef],ef,Z,p):void 0;void 0===eg&&(eg=p[ef]),ed?el(Z,ef,eg):et(Z,ef,eg)}return Z}},5481:(p,_,Z)=>{var et=Z(9325)["__core-js_shared__"];p.exports=et},999:(p,_,Z)=>{var et=Z(9302),el=Z(6800);p.exports=function(p){return et(function(_,Z){var et=-1,eu=Z.length,ed=eu>1?Z[eu-1]:void 0,eh=eu>2?Z[2]:void 0;for(ed=p.length>3&&"function"==typeof ed?(eu--,ed):void 0,eh&&el(Z[0],Z[1],eh)&&(ed=eu<3?void 0:ed,eu=1),_=Object(_);++et<eu;){var ep=Z[et];ep&&p(_,ep,et,ed)}return _})}},3221:p=>{p.exports=function(p){return function(_,Z,et){for(var el=-1,eu=Object(_),ed=et(_),eh=ed.length;eh--;){var ep=ed[p?eh:++el];if(!1===Z(eu[ep],ep,eu))break}return _}}},3243:(p,_,Z)=>{var et=Z(6110),el=function(){try{var p=et(Object,"defineProperty");return p({},"",{}),p}catch(p){}}();p.exports=el},4840:(p,_,Z)=>{var et="object"==typeof Z.g&&Z.g&&Z.g.Object===Object&&Z.g;p.exports=et},2651:(p,_,Z)=>{var et=Z(4218);p.exports=function(p,_){var Z=p.__data__;return et(_)?Z["string"==typeof _?"string":"hash"]:Z.map}},6110:(p,_,Z)=>{var et=Z(5083),el=Z(392);p.exports=function(p,_){var Z=el(p,_);return et(Z)?Z:void 0}},8879:(p,_,Z)=>{var et=Z(4335)(Object.getPrototypeOf,Object);p.exports=et},659:(p,_,Z)=>{var et=Z(1873),el=Object.prototype,eu=el.hasOwnProperty,ed=el.toString,eh=et?et.toStringTag:void 0;p.exports=function(p){var _=eu.call(p,eh),Z=p[eh];try{p[eh]=void 0;var et=!0}catch(p){}var el=ed.call(p);return et&&(_?p[eh]=Z:delete p[eh]),el}},392:p=>{p.exports=function(p,_){return null==p?void 0:p[_]}},2032:(p,_,Z)=>{var et=Z(1042);p.exports=function(){this.__data__=et?et(null):{},this.size=0}},3862:p=>{p.exports=function(p){var _=this.has(p)&&delete this.__data__[p];return this.size-=_?1:0,_}},6721:(p,_,Z)=>{var et=Z(1042),el=Object.prototype.hasOwnProperty;p.exports=function(p){var _=this.__data__;if(et){var Z=_[p];return"__lodash_hash_undefined__"===Z?void 0:Z}return el.call(_,p)?_[p]:void 0}},2749:(p,_,Z)=>{var et=Z(1042),el=Object.prototype.hasOwnProperty;p.exports=function(p){var _=this.__data__;return et?void 0!==_[p]:el.call(_,p)}},5749:(p,_,Z)=>{var et=Z(1042);p.exports=function(p,_){var Z=this.__data__;return this.size+=this.has(p)?0:1,Z[p]=et&&void 0===_?"__lodash_hash_undefined__":_,this}},5529:(p,_,Z)=>{var et=Z(9344),el=Z(8879),eu=Z(5527);p.exports=function(p){return"function"!=typeof p.constructor||eu(p)?{}:et(el(p))}},361:p=>{var _=/^(?:0|[1-9]\d*)$/;p.exports=function(p,Z){var et=typeof p;return!!(Z=null==Z?9007199254740991:Z)&&("number"==et||"symbol"!=et&&_.test(p))&&p>-1&&p%1==0&&p<Z}},6800:(p,_,Z)=>{var et=Z(5288),el=Z(4894),eu=Z(361),ed=Z(3805);p.exports=function(p,_,Z){if(!ed(Z))return!1;var eh=typeof _;return!!("number"==eh?el(Z)&&eu(_,Z.length):"string"==eh&&_ in Z)&&et(Z[_],p)}},4218:p=>{p.exports=function(p){var _=typeof p;return"string"==_||"number"==_||"symbol"==_||"boolean"==_?"__proto__"!==p:null===p}},7296:(p,_,Z)=>{var et,el=Z(5481),eu=(et=/[^.]+$/.exec(el&&el.keys&&el.keys.IE_PROTO||""))?"Symbol(src)_1."+et:"";p.exports=function(p){return!!eu&&eu in p}},5527:p=>{var _=Object.prototype;p.exports=function(p){var Z=p&&p.constructor;return p===("function"==typeof Z&&Z.prototype||_)}},3702:p=>{p.exports=function(){this.__data__=[],this.size=0}},80:(p,_,Z)=>{var et=Z(6025),el=Array.prototype.splice;p.exports=function(p){var _=this.__data__,Z=et(_,p);return!(Z<0||(Z==_.length-1?_.pop():el.call(_,Z,1),--this.size,0))}},4739:(p,_,Z)=>{var et=Z(6025);p.exports=function(p){var _=this.__data__,Z=et(_,p);return Z<0?void 0:_[Z][1]}},8655:(p,_,Z)=>{var et=Z(6025);p.exports=function(p){return et(this.__data__,p)>-1}},1175:(p,_,Z)=>{var et=Z(6025);p.exports=function(p,_){var Z=this.__data__,el=et(Z,p);return el<0?(++this.size,Z.push([p,_])):Z[el][1]=_,this}},3040:(p,_,Z)=>{var et=Z(1549),el=Z(79),eu=Z(8223);p.exports=function(){this.size=0,this.__data__={hash:new et,map:new(eu||el),string:new et}}},7670:(p,_,Z)=>{var et=Z(2651);p.exports=function(p){var _=et(this,p).delete(p);return this.size-=_?1:0,_}},289:(p,_,Z)=>{var et=Z(2651);p.exports=function(p){return et(this,p).get(p)}},4509:(p,_,Z)=>{var et=Z(2651);p.exports=function(p){return et(this,p).has(p)}},2949:(p,_,Z)=>{var et=Z(2651);p.exports=function(p,_){var Z=et(this,p),el=Z.size;return Z.set(p,_),this.size+=Z.size==el?0:1,this}},1042:(p,_,Z)=>{var et=Z(6110)(Object,"create");p.exports=et},181:p=>{p.exports=function(p){var _=[];if(null!=p)for(var Z in Object(p))_.push(Z);return _}},6009:(p,_,Z)=>{p=Z.nmd(p);var et=Z(4840),el=_&&!_.nodeType&&_,eu=el&&p&&!p.nodeType&&p,ed=eu&&eu.exports===el&&et.process,eh=function(){try{return eu&&eu.require&&eu.require("util").types||ed&&ed.binding&&ed.binding("util")}catch(p){}}();p.exports=eh},9350:p=>{var _=Object.prototype.toString;p.exports=function(p){return _.call(p)}},4335:p=>{p.exports=function(p,_){return function(Z){return p(_(Z))}}},6757:(p,_,Z)=>{var et=Z(1033),el=Math.max;p.exports=function(p,_,Z){return _=el(void 0===_?p.length-1:_,0),function(){for(var eu=arguments,ed=-1,eh=el(eu.length-_,0),ep=Array(eh);++ed<eh;)ep[ed]=eu[_+ed];ed=-1;for(var ef=Array(_+1);++ed<_;)ef[ed]=eu[ed];return ef[_]=Z(ep),et(p,this,ef)}}},9325:(p,_,Z)=>{var et=Z(4840),el="object"==typeof self&&self&&self.Object===Object&&self,eu=et||el||Function("return this")();p.exports=eu},4974:p=>{p.exports=function(p,_){if(("constructor"!==_||"function"!=typeof p[_])&&"__proto__"!=_)return p[_]}},2865:(p,_,Z)=>{var et=Z(9570),el=Z(1811)(et);p.exports=el},1811:p=>{var _=Date.now;p.exports=function(p){var Z=0,et=0;return function(){var el=_(),eu=16-(el-et);if(et=el,eu>0){if(++Z>=800)return arguments[0]}else Z=0;return p.apply(void 0,arguments)}}},1420:(p,_,Z)=>{var et=Z(79);p.exports=function(){this.__data__=new et,this.size=0}},938:p=>{p.exports=function(p){var _=this.__data__,Z=_.delete(p);return this.size=_.size,Z}},3605:p=>{p.exports=function(p){return this.__data__.get(p)}},9817:p=>{p.exports=function(p){return this.__data__.has(p)}},945:(p,_,Z)=>{var et=Z(79),el=Z(8223),eu=Z(3661);p.exports=function(p,_){var Z=this.__data__;if(Z instanceof et){var ed=Z.__data__;if(!el||ed.length<199)return ed.push([p,_]),this.size=++Z.size,this;Z=this.__data__=new eu(ed)}return Z.set(p,_),this.size=Z.size,this}},7473:p=>{var _=Function.prototype.toString;p.exports=function(p){if(null!=p){try{return _.call(p)}catch(p){}try{return p+""}catch(p){}}return""}},7334:p=>{p.exports=function(p){return function(){return p}}},5288:p=>{p.exports=function(p,_){return p===_||p!=p&&_!=_}},3488:p=>{p.exports=function(p){return p}},2428:(p,_,Z)=>{var et=Z(7534),el=Z(346),eu=Object.prototype,ed=eu.hasOwnProperty,eh=eu.propertyIsEnumerable,ep=et(function(){return arguments}())?et:function(p){return el(p)&&ed.call(p,"callee")&&!eh.call(p,"callee")};p.exports=ep},6449:p=>{var _=Array.isArray;p.exports=_},4894:(p,_,Z)=>{var et=Z(1882),el=Z(294);p.exports=function(p){return null!=p&&el(p.length)&&!et(p)}},3693:(p,_,Z)=>{var et=Z(4894),el=Z(346);p.exports=function(p){return el(p)&&et(p)}},3656:(p,_,Z)=>{p=Z.nmd(p);var et=Z(9325),el=Z(9935),eu=_&&!_.nodeType&&_,ed=eu&&p&&!p.nodeType&&p,eh=ed&&ed.exports===eu?et.Buffer:void 0,ep=(eh?eh.isBuffer:void 0)||el;p.exports=ep},1882:(p,_,Z)=>{var et=Z(2552),el=Z(3805);p.exports=function(p){if(!el(p))return!1;var _=et(p);return"[object Function]"==_||"[object GeneratorFunction]"==_||"[object AsyncFunction]"==_||"[object Proxy]"==_}},294:p=>{p.exports=function(p){return"number"==typeof p&&p>-1&&p%1==0&&p<=9007199254740991}},3805:p=>{p.exports=function(p){var _=typeof p;return null!=p&&("object"==_||"function"==_)}},346:p=>{p.exports=function(p){return null!=p&&"object"==typeof p}},1331:(p,_,Z)=>{var et=Z(2552),el=Z(8879),eu=Z(346),ed=Object.prototype,eh=Function.prototype.toString,ep=ed.hasOwnProperty,ef=eh.call(Object);p.exports=function(p){if(!eu(p)||"[object Object]"!=et(p))return!1;var _=el(p);if(null===_)return!0;var Z=ep.call(_,"constructor")&&_.constructor;return"function"==typeof Z&&Z instanceof Z&&eh.call(Z)==ef}},7167:(p,_,Z)=>{var et=Z(4901),el=Z(7301),eu=Z(6009),ed=eu&&eu.isTypedArray,eh=ed?el(ed):et;p.exports=eh},7241:(p,_,Z)=>{var et=Z(695),el=Z(2903),eu=Z(4894);p.exports=function(p){return eu(p)?et(p,!0):el(p)}},6924:(p,_,Z)=>{var et=Z(5250),el=Z(999)(function(p,_,Z,el){et(p,_,Z,el)});p.exports=el},9935:p=>{p.exports=function(){return!1}},9884:(p,_,Z)=>{var et=Z(1791),el=Z(7241);p.exports=function(p){return et(p,el(p))}},4355:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.CriteriaInputs=_.BooleanComparisonSchema=void 0;var et=Z(4713);_.BooleanComparisonSchema={comparison:{type:"string",required:!0},format:{type:"string",required:!0},value:{type:"string",required:!1}};var el=function(){function e(p){this.inputs=p}return e.prototype.matches=function(p,_){if(0===_.length)return{success:!0,matched:!1};var Z=this.inputs[p];if(void 0===Z)return{success:!0,matched:!1};for(var et=0;et<_.length;et++){var el=_[et],eu=this.matchSingleFilter(p,Z,el);if(!eu.success)return eu;if(eu.matched)return{success:!0,matched:!0}}return{success:!0,matched:!1}},e.prototype.matchSingleFilter=function(p,_,Z){return this.isPrimitiveFilter(Z)?this.matchPrimitive(_,Z):this.isComparatorFilter(Z)?this.matchComparator(p,_,Z):{success:!1,error:"Invalid filter type for property ".concat(p)}},e.prototype.matchPrimitive=function(p,_){return typeof p!=typeof _?{success:!0,matched:!1}:"string"==typeof p&&"string"==typeof _?{success:!0,matched:(0,et.matchesWithWildcard)(p,_)}:{success:!0,matched:p===_}},e.prototype.matchComparator=function(p,_,Z){var et=Z.comparison,el=Z.format,eu=Z.value;return this.isValidComparisonOperator(et)?"semver"===el?this.matchSemverComparator(_,et,eu):"number"===el?this.matchNumberComparator(_,et,eu):{success:!1,error:"Unknown comparator format: ".concat(el)}:{success:!1,error:"Invalid comparison operator: ".concat(et)}},e.prototype.matchSemverComparator=function(p,_,Z){if("string"!=typeof p)return{success:!1,error:"Input value must be string for semver comparison"};var el=(0,et.compareSemvers)(p,Z);return void 0===el?{success:!1,error:'Invalid semver: input="'.concat(p,'", filter="').concat(Z,'"')}:{success:!0,matched:this.evaluateComparison(el,_)}},e.prototype.matchNumberComparator=function(p,_,Z){if("number"!=typeof p)return{success:!1,error:"Input value must be number for number comparison"};var et=parseFloat(Z);return isNaN(et)?{success:!1,error:"Invalid number in filter: ".concat(Z)}:{success:!0,matched:this.evaluateComparison(p<et?-1:p>et?1:0,_)}},e.prototype.evaluateComparison=function(p,_){switch(_){case"<":return p<0;case"<=":return p<=0;case">":return p>0;case">=":return p>=0;case"==":return 0===p;case"!=":return 0!==p;default:return!1}},e.prototype.isPrimitiveFilter=function(p){return"string"==typeof p||"number"==typeof p||"boolean"==typeof p},e.prototype.isComparatorFilter=function(p){return"object"==typeof p&&null!==p&&"comparison"in p&&"format"in p&&"value"in p},e.prototype.isValidComparisonOperator=function(p){return["<","<=",">",">=","==","!="].includes(p)},e}();_.CriteriaInputs=el},5185:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.CriteriaParser=_.DeviceConfigCriteriaConfigSchema=_.DeviceConfigCriteriaSchema=_.DeviceConfigRulesSchema=void 0;var et=Z(4293);_.DeviceConfigRulesSchema={},_.DeviceConfigCriteriaSchema={version:{type:"number",required:!0},rules:{type:"object",required:!0,config:{schema:_.DeviceConfigRulesSchema}}},_.DeviceConfigCriteriaConfigSchema={criteria:{type:"object",required:!0,config:{schema:_.DeviceConfigCriteriaSchema}},payload:{type:"object",required:!0,config:{schema:{}}}};var el=function(){function e(){}return Object.defineProperty(e,"CURRENT_VERSION",{get:function(){return this.SUPPORTED_VERSION},enumerable:!1,configurable:!0}),e.evaluateCriteria=function(p,_){if(!p.criteria)return(0,et.err)("Missing criteria object");var Z=p.criteria;if(Z.version!==this.SUPPORTED_VERSION)return(0,et.ok)({matched:!1});if(!Z.rules)return(0,et.err)("Missing rules in criteria");var el=Z.rules;if(0===Object.keys(el).length)return(0,et.ok)({matched:!0,payload:p.payload});for(var eu=0,ed=Object.entries(el);eu<ed.length;eu++){var eh=ed[eu],ep=eh[0],ef=eh[1],eg=_.matches(ep,ef);if(!eg.success)return(0,et.err)(eg.error||"Match evaluation failed");if(!eg.matched)return(0,et.ok)({matched:!1})}return(0,et.ok)({matched:!0,payload:p.payload})},e.matchingPayloads=function(p,_){for(var Z=[],el=[],eu=0;eu<p.length;eu++){var ed=p[eu],eh=this.evaluateCriteria(ed,_);eh.ok?eh.value.matched&&void 0!==eh.value.payload&&Z.push(eh.value.payload):el.push(eh.error)}return el.length>0?(0,et.err)(el):(0,et.ok)({payloads:Z})},e.matches=function(p,_,Z){return Z.matches(p,_)},e.SUPPORTED_VERSION=1,e}();_.CriteriaParser=el},4713:(p,_)=>{"use strict";function n(p){if(p&&"string"==typeof p){var _=p.split("+")[0];if(_){var Z=_.split("-"),et=Z[0],el=Z.slice(1);if(et){var eu=et.split(".");if(!(0===eu.length||eu.length>3||eu.some(function(p){return""===p||!/^\d+$/.test(p)}))){var ed=eu.map(function(p){return parseInt(p,10)}),eh=ed[0],ep=ed[1],ef=ed[2],eg={major:void 0===eh?0:eh,minor:void 0===ep?0:ep,patch:void 0===ef?0:ef};if(el.length>0){var ev=el.join("-");ev&&(eg.prerelease=ev.split("."))}return eg}}}}}Object.defineProperty(_,"__esModule",{value:!0}),_.compareSemvers=_.parseSemver=_.matchesWithWildcard=void 0,_.matchesWithWildcard=function(p,_){if("*"===_)return!0;if(_.endsWith("*")){var Z=_.slice(0,-1);return 0===p.indexOf(Z)}return p===_},_.parseSemver=n,_.compareSemvers=function(p,_){var Z=n(p),et=n(_);if(Z&&et){if(Z.major!==et.major)return Z.major>et.major?1:-1;if(Z.minor!==et.minor)return Z.minor>et.minor?1:-1;if(Z.patch!==et.patch)return Z.patch>et.patch?1:-1;var el=Z.prerelease&&Z.prerelease.length>0,eu=et.prerelease&&et.prerelease.length>0;if(el&&!eu)return -1;if(!el&&eu)return 1;if(!el&&!eu)return 0;for(var ed=Z.prerelease,eh=et.prerelease,ep=Math.max(ed.length,eh.length),ef=0;ef<ep;ef++){var eg=ed[ef],ev=eh[ef];if(void 0===eg)return -1;if(void 0===ev)return 1;var em=/^\d+$/.test(eg),eE=/^\d+$/.test(ev);if(em&&eE){var eS=parseInt(eg,10),e_=parseInt(ev,10);if(eS!==e_)return eS>e_?1:-1}else{if(em&&!eE)return -1;if(!em&&eE)return 1;if(eg!==ev)return eg>ev?1:-1}}return 0}}},6270:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.DeviceConfigRulesSchema=_.DeviceConfigCriteriaSchema=_.DeviceConfigCriteriaConfigSchema=_.CriteriaParser=_.BooleanComparisonSchema=_.CriteriaInputs=_.compareSemvers=_.parseSemver=_.matchesWithWildcard=void 0;var et=Z(4713);Object.defineProperty(_,"matchesWithWildcard",{enumerable:!0,get:function(){return et.matchesWithWildcard}}),Object.defineProperty(_,"parseSemver",{enumerable:!0,get:function(){return et.parseSemver}}),Object.defineProperty(_,"compareSemvers",{enumerable:!0,get:function(){return et.compareSemvers}});var el=Z(4355);Object.defineProperty(_,"CriteriaInputs",{enumerable:!0,get:function(){return el.CriteriaInputs}}),Object.defineProperty(_,"BooleanComparisonSchema",{enumerable:!0,get:function(){return el.BooleanComparisonSchema}});var eu=Z(5185);Object.defineProperty(_,"CriteriaParser",{enumerable:!0,get:function(){return eu.CriteriaParser}}),Object.defineProperty(_,"DeviceConfigCriteriaConfigSchema",{enumerable:!0,get:function(){return eu.DeviceConfigCriteriaConfigSchema}}),Object.defineProperty(_,"DeviceConfigCriteriaSchema",{enumerable:!0,get:function(){return eu.DeviceConfigCriteriaSchema}}),Object.defineProperty(_,"DeviceConfigRulesSchema",{enumerable:!0,get:function(){return eu.DeviceConfigRulesSchema}})},7094:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.DefaultClock=_.DefaultStorage=_.DefaultAnalytics=_.DefaultTrace=_.getDefaultConfigRefreshOptions=_.getDefaultCommonAnalytics=_.DEFAULT_INITIAL_DELAY_SECONDS=_.DEFAULT_HTTP_TIMEOUT_SECONDS=_.DEFAULT_STOP_REFRESH_AFTER_SECONDS=_.DEFAULT_MAX_AGE_CACHE_SECONDS=_.DEFAULT_RETRY_INTERVAL_SECONDS=_.DEFAULT_RETRY_COUNT=_.DEFAULT_REFRESH_INTERVAL_SECONDS=_.STORAGE_PREFIX_KEY=_.ENCODING_BASE64=_.STATE_KEY=_.DATA_KEY=void 0;var et=Z(3259),el=Z(4811);_.DATA_KEY="data",_.STATE_KEY="state",_.ENCODING_BASE64="base64",_.STORAGE_PREFIX_KEY="amazon_ivs_device_config_v1_",_.DEFAULT_REFRESH_INTERVAL_SECONDS=(0,et.minutesToSeconds)(15),_.DEFAULT_RETRY_COUNT=3,_.DEFAULT_RETRY_INTERVAL_SECONDS=10,_.DEFAULT_MAX_AGE_CACHE_SECONDS=(0,et.daysToSeconds)(3),_.DEFAULT_STOP_REFRESH_AFTER_SECONDS=(0,et.hoursToSeconds)(2),_.DEFAULT_HTTP_TIMEOUT_SECONDS=15,_.DEFAULT_INITIAL_DELAY_SECONDS=5,_.getDefaultCommonAnalytics=function(){return{client_sdk:"unknown",env:el.DeviceConfigEnv.PROD}},_.getDefaultConfigRefreshOptions=function(){return{refreshIntervalSeconds:_.DEFAULT_REFRESH_INTERVAL_SECONDS,retryCount:_.DEFAULT_RETRY_COUNT,retryIntervalSeconds:_.DEFAULT_RETRY_INTERVAL_SECONDS,maxCacheAgeSeconds:_.DEFAULT_MAX_AGE_CACHE_SECONDS,stopRefreshAfterSeconds:_.DEFAULT_STOP_REFRESH_AFTER_SECONDS,canRefreshNow:function(){return!0}}};var eu=function(){function e(p){this.enableConsoleLog=p}return e.prototype.onTrace=function(p){this.enableConsoleLog&&console.log("DeviceConfig trace: "+p)},e}();_.DefaultTrace=eu;var ed=function(){function e(p){this.enableConsoleLog=p}return e.prototype.onValue=function(p){this.enableConsoleLog&&console.log("DeviceConfig analytics value: ".concat(p))},e.prototype.onError=function(p){this.enableConsoleLog&&console.error("DeviceConfig analytics error: ".concat(p))},e.prototype.onTrace=function(p){this.enableConsoleLog&&console.log("DeviceConfig analytics trace: ".concat(p))},e.prototype.onAssignment=function(p){this.enableConsoleLog&&console.log("DeviceConfig analytics assignment: ".concat(p))},e}();_.DefaultAnalytics=ed;var eh=function(){function e(p,_){this.prefix=p,this.storage=_}return e.prototype.getJson=function(p){var _=this.prefix+"_"+p;try{var Z=this.storage.getItem(_);if(Z)return JSON.parse(Z)}catch(p){console.error("Error getting local storage key ".concat(_)+p)}return null},e.prototype.setJson=function(p,_){var Z=this.prefix+"_"+p;try{this.storage.setItem(Z,JSON.stringify(_))}catch(p){console.error("Error setting local storage key ".concat(Z,": ")+p)}},e}();_.DefaultStorage=eh;var ep=function(){function e(){}return e.prototype.getMillis=function(){return Date.now()},e}();_.DefaultClock=ep},9225:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.BucketAssignmentManager=_.PERCENTAGE_SUM_TOLERANCE=void 0;var et=Z(8177),el=Z(4293),eu=Z(5234);_.PERCENTAGE_SUM_TOLERANCE=.001;var ed=function(){function e(){}return e.prototype.roll=function(p){var _=(0,et.getSecureRandom)();return _.method!==et.SecureRandomMethod.CRYPTO_RANDOM_VALUES&&p.push({type:eu.RolloutWarningType.NON_IDEAL_RANDOM_GENERATED,context:{details:_.method}}),_.value},e.prototype.assignVariant=function(p,_){var Z=[],et=this.validateRollout(p,Z);return et.ok?_&&p["rollout-id"]===_.rolloutId?(0,el.ok)({variant:_.assignedVariant,shouldUpdateState:!1,warnings:Z}):p["force-redistribute"]?this.performInitialAssignment(p,Z):_?this.performStickyAssignment(p,_,Z):this.performInitialAssignment(p,Z):et},e.prototype.validateRollout=function(p,Z){var et=p.variants;if(0===et.length)return(0,el.err)("Empty variants array");var eu=this.calculateTotalPercentage(et,Z);return Math.abs(eu-1)>_.PERCENTAGE_SUM_TOLERANCE?(0,el.err)("Variant percentages don't sum to 1.0 within ".concat(_.PERCENTAGE_SUM_TOLERANCE," tolerance (got ").concat(eu,")")):(0,el.ok)(p)},e.prototype.calculateTotalPercentage=function(p,_){return p.reduce(function(p,Z){var et=Object.values(Z);return et.length>1&&_.push({type:eu.RolloutWarningType.UNEXPECTED_VARIANT_PROPERTIES,context:{details:"Found more than 1 value for variant: ".concat(et)}}),p+et[0]},0)},e.prototype.performInitialAssignment=function(p,_){var Z=this.roll(_),et=this.selectVariantFromRoll(p.variants,Z);return(0,el.ok)({variant:et,shouldUpdateState:!0,warnings:_})},e.prototype.performStickyAssignment=function(p,_,Z){var et=_.assignedVariant,ed=_.rolloutConfig,eh=this.getVariantPercentage(p.variants,et),ep=this.getVariantPercentage(ed.variants,et);if(!eh.ok)return this.performInitialAssignment(p,Z);var ef=eh.value;if(!ep.ok||ef>=ep.value)return ep.ok||Z.push({type:eu.RolloutWarningType.PREVIOUS_VARIANT_NOT_FOUND,context:{details:"Previous variant not found: ".concat(et)}}),(0,el.ok)({variant:et,shouldUpdateState:!0,warnings:Z});var eg=ef/ep.value;if(this.roll(Z)<=eg)return(0,el.ok)({variant:et,shouldUpdateState:!0,warnings:Z});var ev=this.calculateFreeCapacity(p.variants,ed.variants),em=this.roll(Z),eE=this.selectVariantFromRoll(ev,em);return(0,el.ok)({variant:eE,shouldUpdateState:!0,warnings:Z})},e.prototype.getVariantPercentage=function(p,_){for(var Z=0;Z<p.length;Z++){var et=p[Z];if(void 0!==et[_])return(0,el.ok)(et[_])}return(0,el.err)("variant not found")},e.prototype.selectVariantFromRoll=function(p,_){for(var Z=0,et=0;et<p.length;et++){var el=Object.entries(p[et])[0],eu=el[0];if(_<=(Z+=el[1]))return eu}return Object.keys(p[p.length-1])[0]},e.prototype.calculateFreeCapacity=function(p,_){for(var Z,et=[],el=0;el<p.length;el++){var eu=Object.entries(p[el])[0],ed=eu[0],eh=eu[1],ep=this.getVariantPercentage(_,ed),ef=0;ep.ok&&(ef=ep.value),eh>ef&&et.push(((Z={})[ed]=eh-ef,Z))}return et},e}();_.BucketAssignmentManager=ed},5234:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.RolloutManager=_.RolloutWarningType=void 0;var et,el,eu=Z(2570),ed=Z(9225),eh=Z(8177),ep=Z(4293);(et=el||(_.RolloutWarningType=el={})).STORAGE_INITIAL_LOAD_FAILED="STORAGE_INITIAL_LOAD_FAILED",et.STORAGE_INITIAL_LOAD_VERSION_MISMATCH="STORAGE_INITIAL_LOAD_VERSION_MISMATCH",et.STORAGE_INITIAL_SAVE_FAILED="STORAGE_INITIAL_SAVE_FAILED",et.STORAGE_SAVE_FAILED="STORAGE_SAVE_FAILED",et.UNEXPECTED_VARIANT_PROPERTIES="UNEXPECTED_VARIANT_PROPERTIES",et.PREVIOUS_VARIANT_NOT_FOUND="PREVIOUS_VARIANT_NOT_FOUND",et.NON_IDEAL_UUID_GENERATED="NON_IDEAL_UUID_GENERATED",et.NON_IDEAL_RANDOM_GENERATED="NON_IDEAL_RANDOM_GENERATED";var ef=function(){function e(p){this.rolloutStateManager=new eu.LocalStorageRolloutStateManager(p),this.bucketAssignmentManager=new ed.BucketAssignmentManager}return e.prototype.getVariantAssignment=function(p){var _=[],Z=p["feature-id"],et=this.rolloutStateManager.getRolloutState(Z),eu=et.state,ed=et.warnings;_.push.apply(_,ed);var ef=this.bucketAssignmentManager.assignVariant(p,eu);if(!ef.ok)return(0,ep.err)(ef.error);_.push.apply(_,ef.value.warnings);var eg=null==eu?void 0:eu.trackingId;if(!eg){var ev=(0,eh.generateUuid)(),em=ev.value,eE=ev.method;eg=em,eE!==eh.UuidMethod.CRYPTO_RANDOM_UUID&&_.push({type:el.NON_IDEAL_UUID_GENERATED,context:{details:eE}})}if(ef.value.shouldUpdateState){var eS={rolloutId:p["rollout-id"],assignedVariant:ef.value.variant,rolloutConfig:p,trackingId:eg},e_=this.rolloutStateManager.setRolloutState(Z,eS);_.push.apply(_,e_.warnings)}return(0,ep.ok)({variant:ef.value.variant,featureId:Z,rolloutId:p["rollout-id"],trackingId:eg,warnings:_})},e}();_.RolloutManager=ef},7974:(p,_)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.DeviceConfigRolloutSchema=_.DeviceConfigRolloutVariantSchema=void 0,_.DeviceConfigRolloutVariantSchema={},_.DeviceConfigRolloutSchema={variants:{type:"array",required:!0,items:{type:"object",required:!0,config:{schema:_.DeviceConfigRolloutVariantSchema}}},"feature-id":{type:"string",required:!0},"rollout-id":{type:"number",required:!0},"force-redistribute":{type:"boolean",required:!1},version:{type:"number",required:!0}}},2570:function(p,_,Z){"use strict";var et=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))};Object.defineProperty(_,"__esModule",{value:!0}),_.LocalStorageRolloutStateManager=_.DEVICE_CONFIG_STORAGE_VERSION=void 0;var el=Z(5234);_.DEVICE_CONFIG_STORAGE_VERSION=1;var eu=function(){function e(p){this.storageKey="_amazon_ivs_dc_".concat(p,"_b8e4f7c1");var _=this.loadStorage(),Z=_.storage,et=_.warnings;this.storage=Z,this.loadWarnings=et}return e.prototype.getRolloutState=function(p){var _;return{state:(null===(_=this.storage.features[p])||void 0===_?void 0:_.rolloutState)||null,warnings:et([],this.loadWarnings,!0)}},e.prototype.setRolloutState=function(p,_){return this.storage.features[p]||(this.storage.features[p]={}),this.storage.features[p].rolloutState=_,this.saveStorage()},e.prototype.loadStorage=function(){var p=[];try{var Z=localStorage.getItem(this.storageKey);if(Z){var et=JSON.parse(Z);if("object"==typeof et){if(et.version===_.DEVICE_CONFIG_STORAGE_VERSION)return{storage:et,warnings:p};p.push({type:el.RolloutWarningType.STORAGE_INITIAL_LOAD_VERSION_MISMATCH,context:{details:"Expected version ".concat(_.DEVICE_CONFIG_STORAGE_VERSION,", but got ").concat(et.version)}})}}}catch(_){p.push({type:el.RolloutWarningType.STORAGE_INITIAL_LOAD_FAILED,context:{error:_}})}var eu={version:_.DEVICE_CONFIG_STORAGE_VERSION,features:{}};try{localStorage.setItem(this.storageKey,JSON.stringify(eu))}catch(_){p.push({type:el.RolloutWarningType.STORAGE_INITIAL_SAVE_FAILED,context:{error:_}})}return{storage:eu,warnings:p}},e.prototype.saveStorage=function(){try{return localStorage.setItem(this.storageKey,JSON.stringify(this.storage)),{warnings:[]}}catch(p){return{warnings:[{type:el.RolloutWarningType.STORAGE_SAVE_FAILED,context:{error:p}}]}}},e}();_.LocalStorageRolloutStateManager=eu},3259:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.daysToSeconds=_.hoursToSeconds=_.minutesToSeconds=_.secondsToMillis=_.createPropertyMap=void 0;var et=Z(4811);_.createPropertyMap=function(p){return new Map(Object.entries(p).map(function(p){var _=p[0],Z=p[1];return[_,new et.Property(_,"string"==typeof Z?et.ValueType.STRING:"number"==typeof Z?et.ValueType.NUMBER:"boolean"==typeof Z?et.ValueType.BOOLEAN:et.ValueType.JSON,"string"==typeof Z?Z:void 0,"number"==typeof Z?Z:void 0,"boolean"==typeof Z?Z:void 0,"object"==typeof Z?JSON.stringify(Z):void 0,_)]}))},_.secondsToMillis=function(p){return 1e3*p},_.minutesToSeconds=function(p){return 60*p},_.hoursToSeconds=function(p){return 60*p*60},_.daysToSeconds=function(p){return 60*p*1440}},3723:(p,_,Z)=>{"use strict";
1Object.defineProperty(_,"__esModule",{value:!0}),_.WindowPropertyOverrider=void 0;var et=Z(3259);_.WindowPropertyOverrider=function(p){return{getPropertyOverride:function(_){var Z,el,eu;if(!0===(null===(el=null==p?void 0:p.AMAZON_IVS_DEVICE_CONFIG)||void 0===el?void 0:el.enableOverrides)&&void 0!==(null===(eu=p.AMAZON_IVS_DEVICE_CONFIG.propertyOverrides)||void 0===eu?void 0:eu[_])){var ed=p.AMAZON_IVS_DEVICE_CONFIG.propertyOverrides;return(0,et.createPropertyMap)(((Z={})[_]=ed[_],Z)).get(_)}}}}},1743:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__setModuleDefault||(Object.create?function(p,_){Object.defineProperty(p,"default",{enumerable:!0,value:_})}:function(p,_){p.default=_}),eu=this&&this.__importStar||function(p){if(p&&p.__esModule)return p;var _={};if(null!=p)for(var Z in p)"default"!==Z&&Object.prototype.hasOwnProperty.call(p,Z)&&et(_,p,Z);return el(_,p),_};Object.defineProperty(_,"__esModule",{value:!0}),_.validateSchemaAndReturn=_.validateSchema=void 0;var ed=eu(Z(4293));function a(p,_){var Z;if(null==p)return ed.err("value is undefined or null");if("object"!=typeof p)return ed.err("value is not an object");for(var et=0,el=Object.entries(_);et<el.length;et++){var eu=el[et],eh=eu[0],ep=eu[1];if(ep.required||!(eh in p)||void 0!==p[eh]){if("object"===ep.type){if(ep.required&&!(eh in p))return ed.err("".concat(eh," is required in schema"));if(p[eh]&&!(ev=a(p[eh],null===(Z=null==ep?void 0:ep.config)||void 0===Z?void 0:Z.schema)).ok)return ed.err("".concat(eh," ").concat(ev.error))}else if("array"===ep.type){if(ep.required&&!(eh in p))return ed.err("".concat(eh," is required in schema"));if(eh in p){if(!Array.isArray(p[eh]))return ed.err("".concat(eh," is not an array"));if(ep.items)for(var ef=0,eg=p[eh];ef<eg.length;ef++){var ev,em=eg[ef];if("string"===ep.items.type||"number"===ep.items.type||"boolean"===ep.items.type){if(typeof em!==ep.items.type)return ed.err("".concat(em," in ").concat(eh," is not an ").concat(ep.items.type))}else if("object"===ep.items.type&&ep.items.config&&!(ev=a(em,ep.items.config.schema)).ok)return ev}}}else{if(ep.required&&!(eh in p))return ed.err("".concat(eh," is required in schema"));if(eh in p&&typeof p[eh]!==ep.type)return ed.err("".concat(eh," is not of type ").concat(ep.type))}}}return ed.ok(!0)}_.validateSchema=a,_.validateSchemaAndReturn=function(p,_){var Z=a(p,_);return Z.ok?ed.ok(p):ed.err(Z.error)}},3840:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.validateSchema=void 0;var et=Z(1743);Object.defineProperty(_,"validateSchema",{enumerable:!0,get:function(){return et.validateSchema}})},4811:function(p,_,Z){"use strict";var et,el,eu,ed=this&&this.__extends||(eu=function(p,_){return(eu=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(p,_){p.__proto__=_}||function(p,_){for(var Z in _)Object.prototype.hasOwnProperty.call(_,Z)&&(p[Z]=_[Z])})(p,_)},function(p,_){if("function"!=typeof _&&null!==_)throw TypeError("Class extends value "+String(_)+" is not a constructor or null");function n(){this.constructor=p}eu(p,_),p.prototype=null===_?Object.create(_):(n.prototype=_.prototype,new n)});Object.defineProperty(_,"__esModule",{value:!0}),_.HttpError=_.StateHolder=_.Property=_.ValueType=_.DeviceConfigEnv=void 0;var eh,ep,ef=Z(7094);(et=eh||(_.DeviceConfigEnv=eh={})).BETA="beta",et.PROD="prod",et.CUSTOM="custom",(el=ep||(_.ValueType=ep={}))[el.STRING=0]="STRING",el[el.NUMBER=1]="NUMBER",el[el.BOOLEAN=2]="BOOLEAN",el[el.JSON=3]="JSON",_.Property=function(p,_,Z,et,el,eu,ed,eh){switch(this.name=p,this.type=_,this.valueString=Z,this.valueNumber=et,this.valueBoolean=el,this.valueJson=eu,this.valueAnalytics=ed,this.type){case ep.STRING:eh===ef.ENCODING_BASE64&&Z&&(this.valueString=atob(Z));break;case ep.JSON:eh===ef.ENCODING_BASE64&&eu&&(this.valueJson=atob(eu))}};var eg=function(){function e(p,_){var Z;this.storage=p,this.key=_,this.state=null!==(Z=p.getJson(_))&&void 0!==Z?Z:{}}return e.prototype.getState=function(){return this.state},e.prototype.setState=function(p){Object.assign(this.state,p),this.storage.setJson(this.key,this.state)},e}();_.StateHolder=eg;var ev=function(p){function t(_){return p.call(this,_)||this}return ed(t,p),t}(Error);_.HttpError=ev},363:function(p,_,Z){"use strict";var et=this&&this.__assign||function(){return(et=Object.assign||function(p){for(var _,Z=1,et=arguments.length;Z<et;Z++)for(var el in _=arguments[Z])Object.prototype.hasOwnProperty.call(_,el)&&(p[el]=_[el]);return p}).apply(this,arguments)},el=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))};
vendor: 14,507 bytes, line 1
1Object.defineProperty(_,"__esModule",{value:!0}),_.DeviceConfigPropertyHolder=_.DeviceConfigManager=void 0;var eu=Z(4478),ed=Z(6270),eh=Z(4355),ep=Z(7094),ef=Z(3259),eg=Z(1743),ev=Z(3723),em=Z(5234),eE=Z(7974),eS=Z(4811),e_=function(){function e(p,_){if(!_.fileKey)throw Error("options.fileKey cannot be empty");var Z=null!==(eh=_.clock)&&void 0!==eh?eh:new ep.DefaultClock,el=Z.getMillis();switch(this.context=p,this.fileKey=_.fileKey,this.env=_.standardEnv,_.standardEnv){case eS.DeviceConfigEnv.BETA:this.fetchServer="beta.ivs-device-config-beta.live-video.net";break;case eS.DeviceConfigEnv.PROD:this.fetchServer="prod.ivs-device-config.live-video.net";break;case eS.DeviceConfigEnv.CUSTOM:if(!_.customServer)throw Error("Custom env requires options.customServer");this.fetchServer=_.customServer;break;default:throw Error("Invalid value for standardEnv: ".concat(_.standardEnv))}this.trace=null!==(ef=_.trace)&&void 0!==ef?ef:new ep.DefaultTrace(_.enableConsoleLog),this.fetch=null!==(eg=_.fetch)&&void 0!==eg?eg:new eb(p),this.storage=new ep.DefaultStorage(ep.STORAGE_PREFIX_KEY+_.fileKey,p.localStorage),this.state=new eS.StateHolder(this.storage,ep.STATE_KEY),this.refresh=et(et({},(0,ep.getDefaultConfigRefreshOptions)()),_.refresh),this.emitMetrics=_.emitMetrics,this.analyticsProperties=null!==(ev=_.analyticsProperties)&&void 0!==ev?ev:(0,ep.getDefaultCommonAnalytics)(),this.enableConsoleLog=_.enableConsoleLog,this.clock=Z,this.isInitialRefreshDone=!1;var eu=0,ed=this.state.getState();ed&&ed.fetchServer===this.fetchServer&&ed.lastFetchWhenMs&&(eu=ed.lastFetchWhenMs);var eh,ef,eg,ev,em,eE=Z.getMillis(),e_=(eE-eu)/1e3;if(e_<=this.refresh.maxCacheAgeSeconds){var ey=this.storage.getJson(ep.DATA_KEY);ey&&ey.fetchServer===this.fetchServer&&this.setData(ey.json)}this.lastUseMs=eE,e_>=this.refresh.refreshIntervalSeconds||0==eu?em=0:(em=Math.round(this.refresh.refreshIntervalSeconds-e_),this.isInitialRefreshDone=!0),em<5&&(em=ep.DEFAULT_INITIAL_DELAY_SECONDS),this.trace.onTrace("Will start refresh in "+em+" seconds"),this.fetchTask=this.context.setTimeout(this.startRefresh.bind(this),1e3*em);var eC=Z.getMillis();this.initialLoadTime=eC-el}return e.getInstance=function(p,_){try{if(!(p.fetch&&p.setTimeout&&p.clearTimeout&&p.localStorage))return void console.log("Context needs to provide fetch, setTimeout, clearTimeout, localStorage")}catch(p){return void console.error("Error checking for context properties "+p)}if(this.gInstance){if(this.gInstance.fileKey!=_.fileKey)throw Error("Existing instance has file key ".concat(this.gInstance.fileKey,", now asking for ").concat(_.fileKey));return this.gInstance}return this.gInstance=new e(p,_),this.gInstance},e.prototype.getConfigurationHolder=function(p){var _,Z,et,el=this.clock.getMillis();this.lastUseMs=el;var eu=null!==(_=p.analytics)&&void 0!==_?_:new ep.DefaultAnalytics(this.enableConsoleLog),ed=0,eh=this.state.getState();return eh&&eh.fetchServer===this.fetchServer&&eh.lastFetchWhenMs&&(ed=eh.lastFetchWhenMs),(el-ed)/1e3<=this.refresh.maxCacheAgeSeconds?new ey(eu,this.analyticsProperties,this.properties,ed,this.clock,this.fileKey,null!==(Z=this.enableConsoleLog)&&void 0!==Z&&Z):new ey(eu,this.analyticsProperties,void 0,0,this.clock,this.fileKey,null!==(et=this.enableConsoleLog)&&void 0!==et&&et)},e.prototype.getFetchUrl=function(){var p="https://".concat(this.fetchServer,"/").concat(this.fileKey,".json"),_=new URL(p);return _.searchParams.set("version","1.0"),_},e.clearInstance=function(){var p;null===(p=this.gInstance)||void 0===p||p.clearInstanceImpl(),this.gInstance=void 0},e.prototype.clearInstanceImpl=function(){this.context.clearTimeout(this.fetchTask),this.fetchTask=void 0,this.context.clearTimeout(this.retryTask),this.retryTask=void 0},e.prototype.startRefresh=function(){var p=this;this.trace.onTrace("Starting refresh request"),this.fetchTask=void 0,this.retryTask&&(this.context.clearTimeout(this.retryTask),this.retryTask=void 0),this.fetchTask=this.context.setTimeout(this.startRefresh.bind(this),1e3*this.refresh.refreshIntervalSeconds);var _=this.clock.getMillis();if((_-this.lastUseMs)/1e3>this.refresh.stopRefreshAfterSeconds)this.trace.onTrace("Will not refresh due to refresh timeout");else if(!this.isInitialRefreshDone||this.refresh.canRefreshNow()){this.isInitialRefreshDone=!0;var Z={};this.fetchData().then(function(et){p.processResponse(et,Z,_),p.emitMetricsImpl(Z)}).catch(function(_){p.exceptionMetrics(Z,_),p.emitMetricsImpl(Z),p.trace.onTrace("Fetch error: "+_),p.refresh.retryCount>0&&p.scheduleRetry(1)})}else this.trace.onTrace("Will not refresh due to callback having returned false")},e.prototype.fetchData=function(){var p=this.getFetchUrl(),_=new Headers,Z=this.state.getState();return Z.fetchServer===this.fetchServer&&(Z.lastFetchWhenFullMs&&this.clock.getMillis()-Z.lastFetchWhenFullMs>1e3*(0,ef.hoursToSeconds)(24)?this.trace.onTrace("Forcing full refresh"):this.properties&&Z.lastFetchEtagHeader&&_.set("If-None-Match",Z.lastFetchEtagHeader)),this.fetch.fetchUrl(p,_)},e.prototype.processResponse=function(p,_,Z){var et={fetchServer:this.fetchServer,lastFetchWhenMs:this.clock.getMillis()},el=p.headers.get("etag");if(el&&(et.lastFetchEtagHeader=el),p.status<300&&p.json){if(this.setData(p.json)){this.trace.onTrace("Successfully parsed fetched data"),this.storage.setJson(ep.DATA_KEY,{fetchServer:this.fetchServer,json:p.json});var eu=this.clock.getMillis();et.lastFetchWhenFullMs=eu,this.state.setState(et),_.success_new_data_count=1,_.fetch_duration_average=Math.max(0,eu-Z)}else _.fail_invalid_data_count=1}else{if(304!==p.status){var ed="Unexpected http fetch status: "+p.status;throw this.trace.onTrace(ed),new eS.HttpError(ed)}this.trace.onTrace("Server said no change in data"),eu=this.clock.getMillis(),et.lastFetchWhenMs=eu,this.state.setState(et),_.success_no_change_count=1,_.fetch_duration_average=Math.max(0,eu-Z)}},e.prototype.scheduleRetry=function(p){var _=this;this.retryTask&&this.context.clearTimeout(this.retryTask);var Z=p*this.refresh.retryIntervalSeconds;this.retryTask=this.context.setTimeout(function(){_.retryTask=void 0,_.fetchRetry(p)},1e3*Z)},e.prototype.fetchRetry=function(p){var _=this;this.trace.onTrace("Starting retry request ".concat(p,"..."));var Z={},et=this.clock.getMillis();this.fetchData().then(function(p){_.processResponse(p,Z,et),_.emitMetricsImpl(Z)}).catch(function(et){_.exceptionMetrics(Z,et),_.emitMetricsImpl(Z),_.trace.onTrace("Fetch error: "+et),_.refresh.retryCount>p&&_.scheduleRetry(p+1)})},e.prototype.setData=function(p){if(!p)return!1;if("1.0"!==p.version)return this.trace.onTrace("Data version is not 1.0, not applying"),!1;var _=p.properties;if(!_||!Array.isArray(_))return this.trace.onTrace("Data properties is not an array, not applying"),!1;for(var Z=new Map,et=0;et<_.length;et++){var el=_[et];if(el.name&&el.type&&this.isValidValueType(el.type)){if(el.value_string&&"string"!=typeof el.value_string){this.trace.onTrace("Invalid type of value.value_string "+typeof el.value_string);continue}if(el.value_number&&"number"!=typeof el.value_number){this.trace.onTrace("Invalid type of value.value_number "+typeof el.value_number);continue}if(el.value_boolean&&"boolean"!=typeof el.value_boolean){this.trace.onTrace("Invalid type of value.value_boolean "+typeof el.value_boolean);continue}if(el.value_json&&"string"!=typeof el.value_json){this.trace.onTrace("Invalid type of value.value_json "+typeof el.value_json);continue}if(el.value_analytics&&"string"!=typeof el.value_analytics){this.trace.onTrace("Invalid type of item.value_analytics "+typeof el.value_analytics);continue}var eu=new eS.Property(el.name,this.parseValueType(el.type),el.value_string,el.value_number,el.value_boolean,el.value_json,el.value_analytics,el.encoding);Z.set(eu.name,eu)}}return 0!=Z.size&&(this.properties=Z,!0)},e.prototype.isValidValueType=function(p){return"string"===p||"number"===p||"boolean"===p||"json"==p},e.prototype.parseValueType=function(p){switch(p){case"string":return eS.ValueType.STRING;case"number":return eS.ValueType.NUMBER;case"boolean":return eS.ValueType.BOOLEAN;case"json":return eS.ValueType.JSON;default:throw Error("Unsupported value type ".concat(p))}},e.prototype.emitMetricsImpl=function(p){var _,Z,el,eu,ed,eh,ep=et(et({},this.analyticsProperties),{initial_load_time:this.initialLoadTime,fetch_attempt_count:1,fetch_duration_average:null!==(_=p.fetch_duration_average)&&void 0!==_?_:0,success_no_change_count:null!==(Z=p.success_no_change_count)&&void 0!==Z?Z:0,success_new_data_count:null!==(el=p.success_new_data_count)&&void 0!==el?el:0,fail_exception_count:null!==(eu=p.fail_exception_count)&&void 0!==eu?eu:0,fail_http_error_count:null!==(ed=p.fail_http_error_count)&&void 0!==ed?ed:0,fail_invalid_data_count:null!==(eh=p.fail_invalid_data_count)&&void 0!==eh?eh:0});this.emitMetrics(ep)},e.prototype.exceptionMetrics=function(p,_){_ instanceof eS.HttpError||"string"==typeof(null==_?void 0:_.message)&&0===_.message.indexOf("http error")?p.fail_http_error_count=1:p.fail_exception_count=1},e}();_.DeviceConfigManager=e_;var ey=function(){function e(p,_,Z,el,eu,ed,eh){void 0===eh&&(eh=!1);var ep=this;this.emitValue=function(p,_){ep.analytics.onValue(et(et({},ep.analyticsProperties),{key_name:p,value:"".concat(_),fetched_seconds_ago:ep.getFetchedSecondsAgo()}))},this.emitTrace=function(p,_){ep.analytics.onTrace(et(et({},ep.analyticsProperties),{key_name:p,message:_}))},this.emitError=function(p,_){ep.analytics.onError(et(et({},ep.analyticsProperties),{key_name:p,message:_}))},this.emitAssignment=function(p){var _=p.warnings.map(function(p){return p.type}).join(",");ep.analytics.onAssignment(et(et({},ep.analyticsProperties),{assignment:p.variant,feature_id:p.featureId,rollout_id:p.rolloutId,tracking_id:p.trackingId,warnings:_}))},this.analytics=p,this.analyticsProperties=_,this.properties=Z,this.dataFetchedWhenMs=el,this.clock=eu,this.fileKey=ed,this.enableConsoleLog=eh,this.overrider=(0,ev.WindowPropertyOverrider)(window)}return e.prototype.getSize=function(){return this.properties?this.properties.size:-1},e.prototype.getProperty=function(p){var _=this.overrider.getPropertyOverride(p);if(_)return this.debugLog("Using override for key: ".concat(p)),_;if(this.properties){var Z=this.properties.get(p);if(Z)return Z;this.emitError(p,"No property exists for key name")}else this.emitTrace(p,"No properties, local cache is expired")},e.prototype.getStringValue=function(p){var _,Z,et=this.getProperty(p);if(et){if(et.type===eS.ValueType.STRING){var el=null!==(_=et.valueString)&&void 0!==_?_:"";return this.emitValue(et.name,null!==(Z=et.valueAnalytics)&&void 0!==Z?Z:el),el}this.emitError(et.name,"Type is not a string")}},e.prototype.getNumberValue=function(p){var _,Z,et=this.getProperty(p);if(et){if(et.type===eS.ValueType.NUMBER){var el=null!==(_=et.valueNumber)&&void 0!==_?_:0;return this.emitValue(et.name,null!==(Z=et.valueAnalytics)&&void 0!==Z?Z:el),el}this.emitError(et.name,"Type is not a number")}},e.prototype.getBooleanValue=function(p){var _,Z,et=this.getProperty(p);if(et){if(et.type===eS.ValueType.BOOLEAN){var el=null!==(_=et.valueBoolean)&&void 0!==_&&_;return this.emitValue(et.name,null!==(Z=et.valueAnalytics)&&void 0!==Z?Z:el),el}this.emitError(et.name,"Type is not a boolean")}},e.prototype.getJsonValue=function(p){var _,Z,et=this.getProperty(p);if(et){if(et.type===eS.ValueType.JSON){var el=null!==(_=et.valueAnalytics)&&void 0!==_?_:"",eu=et.valueJson;if(eu)try{var ed=JSON.parse(eu);return this.emitValue(et.name,null!==(Z=et.valueAnalytics)&&void 0!==Z?Z:ed),ed}catch(p){return void this.emitError(et.name,"JSON parse error")}else this.emitValue(et.name,el)}else this.emitError(et.name,"Type is not JSON")}},e.prototype.getResolvedConfigForPropertyKey=function(p){var _=p.key,Z=p.context,et=p.schema,ep=p.trace,ef=void 0!==ep&&ep,ev=this.getJsonValue(_);if(void 0!==ev){if(0!==ev.length){for(var em=[],eE=0;eE<ev.length;eE++){var eS=ev[eE];(eC=(0,eg.validateSchema)(eS,ed.DeviceConfigCriteriaConfigSchema)).ok?em.push(eS):this.emitError(_,"Criteria structure invalid: ".concat(eC.error))}for(var e_=new eh.CriteriaInputs(Z),ey=[],eb=0;eb<em.length;eb++)eS=em[eb],(eC=ed.CriteriaParser.evaluateCriteria(eS,e_)).ok?eC.value.matched&&ey.push(eC.value.payload):this.emitError(_,eC.error);if(0!==ey.length){for(var eC,eT=[],eI=0;eI<ey.length;eI++)eS=ey[eI],(eC=(0,eg.validateSchema)(eS,et)).ok?eT.push(eS):this.emitError(_,"Payload structure invalid: ".concat(eC.error));var eR=eu.mergeConfigs.apply(void 0,el([{}],eT,!1)),eO=JSON.stringify(eR);return this.emitValue(_,"Resolved: ".concat(eO)),eR}if(ef){var eA=em.length;this.emitTrace(_,"No matches from ".concat(eA," payloads"))}}else ef&&this.emitTrace(_,"No payloads exist for key")}},e.prototype.getResolvedExperimentForPropertyKeys=function(p){for(var _=p.keys,Z=p.context,et=p.trace,el=void 0!==et&&et,eu={},ed=new em.RolloutManager(this.fileKey),eh=0;eh<_.length;eh++){var ep=_[eh];eu[ep]=this.processExperimentKey(ep,Z,el,ed)}return eu},e.prototype.processExperimentKey=function(p,_,Z,et){var el=this.getJsonValue(p);if(void 0!==el){if(0!==el.length){for(var eu=[],eh=0;eh<el.length;eh++){var ep=el[eh],ef=(0,eg.validateSchema)(ep,ed.DeviceConfigCriteriaConfigSchema);ef.ok?eu.push(ep):this.emitError(p,"Criteria structure invalid: ".concat(ef.error))}var ev=this.getMatchedCriteria(eu,_,p),em=this.validateMatchedPayloads(ev,p),eE=this.selectPayload(em);if(eE){var eS=et.getVariantAssignment(eE);if(eS.ok){var e_=eS.value;return this.emitAssignment(e_),Z&&this.emitTrace(p,"Experiment variant assigned: ".concat(e_.variant)),e_}this.emitError(p,"Experiment assignment failed: ".concat(eS.error))}else Z&&this.emitTrace(p,"No matching criteria from ".concat(eu.length," experiment payloads"))}else Z&&this.emitTrace(p,"No experiment payloads exist for key")}},e.prototype.getMatchedCriteria=function(p,_,Z){for(var et=new eh.CriteriaInputs(_),el=[],eu=0;eu<p.length;eu++){var ep=p[eu],ef=ed.CriteriaParser.evaluateCriteria(ep,et);ef.ok?ef.value.matched&&el.push(ef.value.payload):this.emitError(Z,ef.error)}return el},e.prototype.validateMatchedPayloads=function(p,_){for(var Z=[],et=0;et<p.length;et++){var el=p[et];if(el){var eu=(0,eg.validateSchemaAndReturn)(el,eE.DeviceConfigRolloutSchema);eu.ok?Z.push(eu.value):this.emitError(_,"Rollout payload invalid: ".concat(eu.error))}}return Z},e.prototype.selectPayload=function(p){return p.length>0?p[0]:void 0},e.prototype.getFetchedSecondsAgo=function(){if(this.dataFetchedWhenMs)return(this.clock.getMillis()-this.dataFetchedWhenMs)/1e3}
1,e.prototype.debugLog=function(p){this.enableConsoleLog&&console.log("[DeviceConfig] ".concat(p))},e}();_.DeviceConfigPropertyHolder=ey;var eb=function(){function e(p){this.context=p}return e.prototype.fetchUrl=function(p,_){var Z=this,et={headers:_,cache:"no-store"},el=null;if("undefined"!=typeof AbortController){var eu=new AbortController;el=this.context.setTimeout(function(){return eu.abort()},1e3*ep.DEFAULT_HTTP_TIMEOUT_SECONDS),et.signal=eu.signal}return new Promise(function(_,eu){Z.context.fetch(p,et).then(function(p){if(p.status>=400)eu(new eS.HttpError("http error ".concat(p.status,", ").concat(p.statusText)));else{var Z={status:p.status,headers:p.headers};p.json().then(function(p){Z.json=p,_(Z)}).catch(function(){_(Z)})}}).catch(function(p){eu(p)}).finally(function(){el&&Z.context.clearTimeout(el)})})},e}()},3864:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__exportStar||function(p,_){for(var Z in p)"default"===Z||Object.prototype.hasOwnProperty.call(_,Z)||et(_,p,Z)};Object.defineProperty(_,"__esModule",{value:!0}),el(Z(363),_),el(Z(4811),_),el(Z(7094),_),el(Z(3259),_),el(Z(3840),_),el(Z(6270),_)},9456:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__exportStar||function(p,_){for(var Z in p)"default"===Z||Object.prototype.hasOwnProperty.call(_,Z)||et(_,p,Z)};Object.defineProperty(_,"__esModule",{value:!0}),el(Z(8903),_)},8903:function(p,_,Z){"use strict";var et=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))};Object.defineProperty(_,"__esModule",{value:!0}),_.TypedEmitter=void 0;var el=Z(228),eu=function(){function e(p){var _;this.emitter=new el.EventEmitter,this.propagateErrors=null!==(_=null==p?void 0:p.propagateErrors)&&void 0!==_&&_}return e.prototype.on=function(p,_){_.call=this.wrapCall(p,_),this.emitter.on(p,_)},e.prototype.off=function(p,_){this.emitter.off(p,_)},e.prototype.emit=function(p){for(var _,Z=[],el=1;el<arguments.length;el++)Z[el-1]=arguments[el];(_=this.emitter).emit.apply(_,et([p],Z,!1))},e.prototype.removeAllListeners=function(){this.emitter.removeAllListeners()},e.prototype.wrapCall=function(p,_){var Z=this;return function(et){for(var el=[],eu=1;eu<arguments.length;eu++)el[eu-1]=arguments[eu];if(Z.propagateErrors)_.apply(et,el);else try{_.apply(et,el)}catch(Z){var ed="Error in callback for ".concat(p),eh=_.name;return eh&&(ed+=" for function ".concat(eh)),void console.error(ed,Z)}}},e}();_.TypedEmitter=eu},5987:function(p,_,Z){"use strict";var et,el=this&&this.__extends||(et=function(p,_){return(et=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(p,_){p.__proto__=_}||function(p,_){for(var Z in _)Object.prototype.hasOwnProperty.call(_,Z)&&(p[Z]=_[Z])})(p,_)},function(p,_){if("function"!=typeof _&&null!==_)throw TypeError("Class extends value "+String(_)+" is not a constructor or null");function n(){this.constructor=p}et(p,_),p.prototype=null===_?Object.create(_):(n.prototype=_.prototype,new n)}),eu=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),ed=this&&this.__setModuleDefault||(Object.create?function(p,_){Object.defineProperty(p,"default",{enumerable:!0,value:_})}:function(p,_){p.default=_}),eh=this&&this.__importStar||function(p){if(p&&p.__esModule)return p;var _={};if(null!=p)for(var Z in p)"default"!==Z&&Object.prototype.hasOwnProperty.call(p,Z)&&eu(_,p,Z);return ed(_,p),_};
vendor: 9,272 bytes, line 1
1Object.defineProperty(_,"__esModule",{value:!0}),_.createFsm=_.FsmWildcardState=_.RejectedTransitionError=_.InvalidStateTransitionError=void 0;var ep=eh(Z(4293)),ef=function(p){function t(_,Z){var et=p.call(this,"Invalid transition from '".concat(Z,"' via event '").concat(_,"'"))||this;return et.name="InvalidStateTransitionError",et}return el(t,p),t}(Error);_.InvalidStateTransitionError=ef;var eg=function(p){function t(_,Z,et){var el=p.call(this,"Transition from '".concat(Z,"' via event '").concat(_,"' was rejected for: ").concat(et))||this;return el.name="RejectedTransitionError",el}return el(t,p),t}(Error);_.RejectedTransitionError=eg,_.FsmWildcardState="*",_.createFsm=function(p){var Z,et=p.transitions,el=p.callbacks,eu=p.initialState,s=function(p){var Z,el=null===(Z=et[p])||void 0===Z?void 0:Z.from;return!!el&&("string"==typeof el?el===_.FsmWildcardState:el.includes(eu))};return{canTransition:s,transition:function(p,_){if(!s(p))return ep.err(new ef(String(eu),String(p)));var ed,eh,ev,em,eE,eS,e_=et[p];return void 0===e_.shouldTransition||e_.shouldTransition(eu)?(null===(eh=null===(ed=null==el?void 0:el[eu])||void 0===ed?void 0:ed.onExiting)||void 0===eh||eh.call(ed),null===(ev=null==el?void 0:el.onStateExiting)||void 0===ev||ev.call(el,eu),Z=eu,eu=e_.to,null===(eE=null===(em=null==el?void 0:el[eu])||void 0===em?void 0:em.onChanged)||void 0===eE||eE.call(em,Z,_),null===(eS=null==el?void 0:el.onStateChanged)||void 0===eS||eS.call(el,Z,eu,_),ep.ok(eu)):ep.err(new eg(String(eu),String(p),"shouldTransition returned false"))},previousState:function(){return Z},currentState:function(){return eu}}}},8156:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__exportStar||function(p,_){for(var Z in p)"default"===Z||Object.prototype.hasOwnProperty.call(_,Z)||et(_,p,Z)};Object.defineProperty(_,"__esModule",{value:!0}),_.VERSION=void 0,_.VERSION="0.16.0",el(Z(3864),_),el(Z(9456),_),el(Z(5987),_),el(Z(9266),_),el(Z(6925),_),el(Z(5224),_)},6925:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__exportStar||function(p,_){for(var Z in p)"default"===Z||Object.prototype.hasOwnProperty.call(_,Z)||et(_,p,Z)};Object.defineProperty(_,"__esModule",{value:!0}),el(Z(6166),_),el(Z(7612),_),el(Z(7056),_),el(Z(8139),_),el(Z(3877),_)},6166:function(p,_,Z){"use strict";var et=this&&this.__assign||function(){return(et=Object.assign||function(p){for(var _,Z=1,et=arguments.length;Z<et;Z++)for(var el in _=arguments[Z])Object.prototype.hasOwnProperty.call(_,el)&&(p[el]=_[el]);return p}).apply(this,arguments)},el=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))};Object.defineProperty(_,"__esModule",{value:!0}),_.getLogConfig=_.setLogConfig=_.setLogConfigByCategories=_.setLogConfigByLevel=_.extractLogConfig=void 0;var eu=Z(7612),ed=Z(7056),eh=Z(8139),ep=Z(4478),ef={enabled:!1,levels:{debug:!0,log:!0,info:!0,warn:!0,error:!0},targets:[(0,ed.createConsoleLogTarget)()],categories:{}},eg=Object.keys(ef);_.extractLogConfig=function(p){var _={};if(Object.keys(p).some(function(p){return eg.includes(p)})){for(var Z=0;Z<eg.length;Z++){var et=eg[Z];if(void 0!==p[et]){var el=p[et];_[et]=el}}return _}},_.setLogConfigByLevel=function(p){var Z=p.enabled||ef.enabled,et=p.targets||ef.targets,el={debug:!1,log:!1,info:!1,warn:!1,error:!1},o=function(p,_){for(var Z=0;Z<p.length;Z++)el[p[Z]]=_};switch(p.level){case"debug":o(["debug","log","info","warn","error"],Z);break;case"log":o(["log","info","warn","error"],Z);break;case"info":o(["info","warn","error"],!0);break;case"warn":o(["warn","error"],!0);break;case"error":o(["error"],!0)}(0,_.setLogConfig)({enabled:Z,levels:el,targets:et})},_.setLogConfigByCategories=function(p,Z){void 0===Z&&(Z=!0);var et={};if(Array.isArray(p))for(var el=0;el<p.length;el++)et[p[el]]=!0;else et=p;Z&&(ef.categories={}),(0,_.setLogConfig)({categories:et})},_.setLogConfig=function(p){var _=(0,ep.mergeConfigs)(ef,p);_&&(ef=_,eu.defaultLogEmitter.emit(eh.LogEventType.CONFIG_UPDATED,ef))},_.getLogConfig=function(){return{enabled:ef.enabled,levels:et({},ef.levels),targets:el([],ef.targets,!0),categories:et({},ef.categories)}}},7612:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.defaultLogEmitter=void 0;var et=Z(9456);_.defaultLogEmitter=new et.TypedEmitter({})},7056:function(p,_,Z){"use strict";var et=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))};Object.defineProperty(_,"__esModule",{value:!0}),_.createEventLogTarget=_.createConsoleLogTarget=void 0;var el=Z(8139);_.createConsoleLogTarget=function(){return{handleMessage:function(p){for(var _=[],Z=1;Z<arguments.length;Z++)_[Z-1]=arguments[Z];console[p].apply(console,_)}}},_.createEventLogTarget=function(p){return{handleMessage:function(_){for(var Z=[],eu=1;eu<arguments.length;eu++)Z[eu-1]=arguments[eu];p.emit.apply(p,et([el.LogEventType.MESSAGE_LOGGED,_],Z,!1))}}}},8139:(p,_)=>{"use strict";var Z,et;Object.defineProperty(_,"__esModule",{value:!0}),_.LogEventType=void 0,(et=Z||(_.LogEventType=Z={})).CONFIG_UPDATED="logConfigUpdated",et.MESSAGE_LOGGED="messageLogged"},3877:function(p,_,Z){"use strict";var et=this&&this.__assign||function(){return(et=Object.assign||function(p){for(var _,Z=1,et=arguments.length;Z<et;Z++)for(var el in _=arguments[Z])Object.prototype.hasOwnProperty.call(_,el)&&(p[el]=_[el]);return p}).apply(this,arguments)},el=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))};Object.defineProperty(_,"__esModule",{value:!0}),_.createLogger=void 0;var eu=Z(4478),ed=Z(6166),eh=Z(7612),ep=Z(8139),u=function(p,_){return(0,eu.mergeConfigs)(p,_)||p};_.createLogger=function(p){var Z,eu=p.name,ef=p.category,eg=p.parent,ev=(0,ed.extractLogConfig)(p)||{},em=u((0,ed.getLogConfig)(),ev),f=function(){var p=em.enabled&&em.targets.length>0&&(void 0===ef||function(p,_){if(_[p])return!0;for(var Z=p.split("."),et=Z.length-1;et>0;et--)if(_[Z.slice(0,et).join(".")])return!0;return!1}(ef,em.categories));Z={debug:p&&em.levels.debug,log:p&&em.levels.log,info:p&&em.levels.info,warn:p&&em.levels.warn,error:p&&em.levels.error}};f(),eh.defaultLogEmitter.on(ep.LogEventType.CONFIG_UPDATED,function(p){em=u(p,ev||{}),f()});var g=function(p){for(var _=[],Z=1;Z<arguments.length;Z++)_[Z-1]=arguments[Z];if(eg&&!eg.canLog(p)||!m(p))return!1;for(var et=v(),eu=(new Date).toTimeString().split(" ")[0],ed=el(["".concat(eu," - (").concat(et,")")],_,!0),eh=0,ep=em.targets;eh<ep.length;eh++){var ef=ep[eh];ef.handleMessage.apply(ef,el([p],ed,!1))}return!0},v=function(){return eg?"".concat(eg.getName()," | ").concat(eu):eu},m=function(p){return Z[p]},E=function(p){em=u(em,ev=p),f()},eE={debug:function(){for(var p=[],_=0;_<arguments.length;_++)p[_]=arguments[_];return g.apply(void 0,el(["debug"],p,!1))},log:function(){for(var p=[],_=0;_<arguments.length;_++)p[_]=arguments[_];return g.apply(void 0,el(["log"],p,!1))},info:function(){for(var p=[],_=0;_<arguments.length;_++)p[_]=arguments[_];return g.apply(void 0,el(["info"],p,!1))},warn:function(){for(var p=[],_=0;_<arguments.length;_++)p[_]=arguments[_];return g.apply(void 0,el(["warn"],p,!1))},error:function(){for(var p=[],_=0;_<arguments.length;_++)p[_]=arguments[_];return g.apply(void 0,el(["error"],p,!1))},getName:v,canLog:m,getChildLogger:function(p){return(0,_.createLogger)(et(et({},p),{parent:eE}))},setConfig:E,setConfigByLevel:function(p){var _={debug:!1,log:!1,info:!1,warn:!1,error:!1},n=function(p){for(var Z=0;Z<p.length;Z++)_[p[Z]]=!0};switch(p){case"debug":n(["debug","log","info","warn","error"]);break;case"log":n(["log","info","warn","error"]);break;case"info":n(["info","warn","error"]);break;case"warn":n(["warn","error"]);break;case"error":n(["error"])}E({levels:_})}};return eE}},5224:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__exportStar||function(p,_){for(var Z in p)"default"===Z||Object.prototype.hasOwnProperty.call(_,Z)||et(_,p,Z)};
1Object.defineProperty(_,"__esModule",{value:!0}),el(Z(3443),_),el(Z(6468),_)},413:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.createExecutorNode=void 0;var et=Z(3431),i=function(p){return"succeeded"===p||"failed"===p||"canceled"===p},o=function(p){for(var _=p;_.parent;)_=_.parent;return _},s=function(p,_){var Z,el=(0,et.transition)(p.state,["pending","running"],"failed");el?(p.state=el,p.settledError=_,(0,et.notifyFailure)(p.deferStack,p.failureCBs,p.completedCBs,_),a(p.child,_)):null===(Z=p.logger)||void 0===Z||Z.debug("suppressing failure, state is",p.state)},a=function(p,_){p&&(0,et.transition)(p.state,["pending"],"failed")&&(p.state="failed",p.settledError=_,(0,et.notifyFailure)(p.deferStack,p.failureCBs,p.completedCBs,_),a(p.child,_))},c=function(p){if(p){var _=(0,et.transition)(p.state,["pending","running"],"canceling");_&&(p.state=_),c(p.child)}},u=function(p){p&&((0,et.transition)(p.state,["canceling"],"canceled")&&(p.state="canceled",(0,et.notifyCancel)(p.cancelHandlers,p.deferStack,p.canceledCBs,p.completedCBs)),u(p.parent))},l=function(p,_,Z){if((0,et.transition)(p.state,["pending"],"running")){p.state="running";var i=function(_){var el,eu;((eu=(0,et.transition)(p.state,["running"],"succeeded"))?(p.state=eu,p.settledResult=_,(0,et.notifySuccess)(p.deferStack,p.successCBs,p.completedCBs,_),!0):(null===(el=p.logger)||void 0===el||el.debug("suppressing success, state is",p.state),!1))&&p.child&&function(p,_){if(p===_)return!0;for(var Z=_;Z;){if(Z===p)return!0;Z=Z.parent}return!1}(p,Z)&&l(p.child,_,Z)};try{var el=p.func(_,p.context);el instanceof Promise?el.then(i).catch(function(_){return s(p,(0,et.normalizeError)(_))}):i(el)}catch(_){s(p,(0,et.normalizeError)(_))}}},d=function(p,_,Z){var et={state:"pending",func:p,parent:_,child:void 0,logger:Z,context:{isCanceled:function(){return"canceling"===et.state||"canceled"===et.state},defer:function(p){et.deferStack.push(p)},onCancel:function(p){et.cancelHandlers.push(p)}},settledResult:void 0,settledError:void 0,deferStack:[],cancelHandlers:[],successCBs:[],failureCBs:[],canceledCBs:[],completedCBs:[]};return _&&(_.child=et),et},h=function(p,_){var Z={run:function(){return l(o(p),void 0,_),Z},fold:function(_,et,el){return"succeeded"===p.state?_(p.settledResult):"failed"===p.state?et(p.settledError):"canceled"===p.state&&el?el():(p.successCBs.push(_),p.failureCBs.push(et),el&&p.canceledCBs.push(el)),Z},chain:function(_){var Z=d(function(p,Z){return _(p,Z)},p,p.logger);return h(Z,Z)},cancel:function(){return c(o(p)),u(function(p){for(var _=p;_.child;)_=_.child;return _}(p)),Z},fail:function(_){return s(p,_),Z},isCompleted:function(){return i(p.state)},onCompleted:function(_){return i(p.state)?_():p.completedCBs.push(_),Z}};return Z};_.createExecutorNode=function(p,_){var Z,et=d(function(_,Z){return p(Z)},void 0,null===(Z=null==_?void 0:_.logger)||void 0===Z?void 0:Z.getChildLogger({name:"Task"}));return h(et,et)}},6468:function(p,_,Z){"use strict";var et=this&&this.__awaiter||function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},el=this&&this.__generator||function(p,_){var Z,et,el,eu,ed={label:0,sent:function(){if(1&el[0])throw el[1];return el[1]},trys:[],ops:[]};return eu={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(eu[Symbol.iterator]=function(){return this}),eu;function a(eh){return function(ep){return function(eh){if(Z)throw TypeError("Generator is already executing.");for(;eu&&(eu=0,eh[0]&&(ed=0)),ed;)try{if(Z=1,et&&(el=2&eh[0]?et.return:eh[0]?et.throw||((el=et.return)&&el.call(et),0):et.next)&&!(el=el.call(et,eh[1])).done)return el;switch(et=0,el&&(eh=[2&eh[0],el.value]),eh[0]){case 0:case 1:el=eh;break;case 4:return ed.label++,{value:eh[1],done:!1};case 5:ed.label++,et=eh[1],eh=[0];continue;case 7:eh=ed.ops.pop(),ed.trys.pop();continue;default:if(!((el=(el=ed.trys).length>0&&el[el.length-1])||6!==eh[0]&&2!==eh[0])){ed=0;continue}if(3===eh[0]&&(!el||eh[1]>el[0]&&eh[1]<el[3])){ed.label=eh[1];break}if(6===eh[0]&&ed.label<el[1]){ed.label=el[1],el=eh;break}if(el&&ed.label<el[2]){ed.label=el[2],ed.ops.push(eh);break}el[2]&&ed.ops.pop(),ed.trys.pop();continue}eh=_.call(p,ed)}catch(p){eh=[6,p],et=0}finally{Z=el=0}if(5&eh[0])throw eh[1];return{value:eh[0]?eh[1]:void 0,done:!0}}([eh,ep])}}};
1Object.defineProperty(_,"__esModule",{value:!0}),_.LiveTask=_.Task=void 0;var eu=Z(6787),ed=Z(2086);_.Task={create:function(p){return(0,eu.createTask)(p)},run:function(p,_,Z,et){return(0,eu.createTask)(p).fold(_,Z,et).run()},from:function(p){return(0,eu.createTask)(function(){return p})},chain:function(p){for(var _=[],Z=1;Z<arguments.length;Z++)_[Z-1]=arguments[Z];for(var et=(0,eu.createTask)(p),el=0;el<_.length;el++){var ed=_[el];et=et.chain(ed)}return et},sequence:function(p){var _=this;return(0,eu.createTask)(function(Z){return et(_,void 0,void 0,function(){var _,et,eu,ed,eh;return el(this,function(el){switch(el.label){case 0:_=[],et=0,eu=p,el.label=1;case 1:return et<eu.length?(ed=eu[et],Z.isCanceled()?[3,4]:[4,ed(Z)]):[3,4];case 2:eh=el.sent(),_.push(eh),el.label=3;case 3:return et++,[3,1];case 4:return[2,_]}})})})},all:function(p){return(0,eu.createTask)(function(_){return new Promise(function(Z,et){var el=Array(p.length),ed=p.length,eh=!1,ep=[],u=function(){for(var p=0;p<ep.length;p++)ep[p].cancel()};_.onCancel(u),p.forEach(function(p,_){var ef=(0,eu.createTask)(p).fold(function(p){eh||(el[_]=p,0==--ed&&(eh=!0,Z(el)))},function(p){eh||(eh=!0,u(),et(p))}).run();ep.push(ef)})})})},race:function(p){return(0,eu.createTask)(function(_){return new Promise(function(Z,et){var el=!1,ed=[],a=function(){for(var p=0;p<ed.length;p++)ed[p].cancel()};_.onCancel(a);for(var eh=0;eh<p.length;eh++){var ep=p[eh],ef=(0,eu.createTask)(ep).fold(function(p){el||(el=!0,a(),Z(p))},function(p){el||(el=!0,a(),et(p))}).run();ed.push(ef)}})})}},_.LiveTask={create:function(p){return(0,ed.createLiveTask)(p)}}},2086:(p,_,Z)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.createLiveTask=void 0;var et=Z(3431);_.createLiveTask=function(p,_){var Z,el,eu,ed=null===(Z=null==_?void 0:_.logger)||void 0===Z?void 0:Z.getChildLogger({name:"LiveTask"}),eh="pending",ep=[],ef=[],eg=[],ev=[],em=[],eE=[],eS={isCanceled:function(){return"canceling"===eh||"canceled"===eh},defer:function(p){ep.push(p)},onCancel:function(p){ef.push(p)}},g=function(){return"failed"===eh||"canceled"===eh||"completed"===eh},v=function(p){if((0,et.transition)(eh,["running"],"live")){eh="live",el=p;for(var _=0;_<eg.length;_++)(0,eg[_])(p);eg.length=0}else null==ed||ed.debug("suppressing live, state is",eh)},m=function(p){(0,et.transition)(eh,["pending","running","live"],"failed")?(eh="failed",eu=p,(0,et.notifyFailure)(ep,ev,eE,p)):null==ed||ed.debug("suppressing failure, state is",eh)},e_={run:function(){if(!(0,et.transition)(eh,["pending"],"running"))return e_;eh="running";try{var _=p(eS);_ instanceof Promise?_.then(function(p){return v(p)}).catch(function(p){return m((0,et.normalizeError)(p))}):v(_)}catch(p){m((0,et.normalizeError)(p))}return e_},use:function(p){if("live"===eh)try{p(el)}catch(p){m((0,et.normalizeError)(p))}else g()||eg.push(p);return e_},done:function(){return function(){if((0,et.transition)(eh,["live"],"completed")){eh="completed",(0,et.runGuarded)(ep);for(var p=0;p<eE.length;p++)(0,eE[p])()}}(),e_},cancel:function(){return(0,et.transition)(eh,["pending","running","live"],"canceled")?(eh="canceled",(0,et.notifyCancel)(ef,ep,em,eE)):null==ed||ed.debug("suppressing cancel, state is",eh),e_},fail:function(p){return m(p),e_},isLive:function(){return"live"===eh},onCanceled:function(p){return"canceled"===eh?p():em.push(p),e_},onFailed:function(p){return"failed"===eh?p(eu):ev.push(p),e_},onCompleted:function(p){return g()?p():eE.push(p),e_}};return e_}},3443:(p,_)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0})},3431:(p,_)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.notifyCancel=_.notifyFailure=_.notifySuccess=_.runGuarded=_.transition=_.normalizeError=void 0,_.normalizeError=function(p){return p instanceof Error?p:Error(String(p))},_.transition=function(p,_,Z){return!!_.includes(p)&&Z},_.runGuarded=function(p){for(var _=0;_<p.length;_++){var Z=p[_];try{Z()}catch(p){}}},_.notifySuccess=function(p,Z,et,el){(0,_.runGuarded)(p);for(var eu=0;eu<Z.length;eu++)(0,Z[eu])(el);for(var ed=0;ed<et.length;ed++)(0,et[ed])()},_.notifyFailure=function(p,Z,et,el){(0,_.runGuarded)(p);for(var eu=0;eu<Z.length;eu++)(0,Z[eu])(el);for(var ed=0;ed<et.length;ed++)(0,et[ed])()},_.notifyCancel=function(p,Z,et,el){(0,_.runGuarded)(p),(0,_.runGuarded)(Z);for(var eu=0;eu<et.length;eu++)(0,et[eu])();for(var ed=0;ed<el.length;ed++)(0,el[ed])()}},6787:(p,_,Z)=>{"use strict";
1Object.defineProperty(_,"__esModule",{value:!0}),_.createTask=void 0;var et=Z(413);_.createTask=function(p,_){return(0,et.createExecutorNode)(p,_)}},8177:function(p,_,Z){"use strict";var et,el,eu=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),ed=this&&this.__setModuleDefault||(Object.create?function(p,_){Object.defineProperty(p,"default",{enumerable:!0,value:_})}:function(p,_){p.default=_}),eh=this&&this.__importStar||function(p){if(p&&p.__esModule)return p;var _={};if(null!=p)for(var Z in p)"default"!==Z&&Object.prototype.hasOwnProperty.call(p,Z)&&eu(_,p,Z);return ed(_,p),_},ep=this&&this.__awaiter||function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},ef=this&&this.__generator||function(p,_){var Z,et,el,eu,ed={label:0,sent:function(){if(1&el[0])throw el[1];return el[1]},trys:[],ops:[]};return eu={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(eu[Symbol.iterator]=function(){return this}),eu;function a(eh){return function(ep){return function(eh){if(Z)throw TypeError("Generator is already executing.");for(;eu&&(eu=0,eh[0]&&(ed=0)),ed;)try{if(Z=1,et&&(el=2&eh[0]?et.return:eh[0]?et.throw||((el=et.return)&&el.call(et),0):et.next)&&!(el=el.call(et,eh[1])).done)return el;switch(et=0,el&&(eh=[2&eh[0],el.value]),eh[0]){case 0:case 1:el=eh;break;case 4:return ed.label++,{value:eh[1],done:!1};case 5:ed.label++,et=eh[1],eh=[0];continue;case 7:eh=ed.ops.pop(),ed.trys.pop();continue;default:if(!((el=(el=ed.trys).length>0&&el[el.length-1])||6!==eh[0]&&2!==eh[0])){ed=0;continue}if(3===eh[0]&&(!el||eh[1]>el[0]&&eh[1]<el[3])){ed.label=eh[1];break}if(6===eh[0]&&ed.label<el[1]){ed.label=el[1],el=eh;break}if(el&&ed.label<el[2]){ed.label=el[2],ed.ops.push(eh);break}el[2]&&ed.ops.pop(),ed.trys.pop();continue}eh=_.call(p,ed)}catch(p){eh=[6,p],et=0}finally{Z=el=0}if(5&eh[0])throw eh[1];return{value:eh[0]?eh[1]:void 0,done:!0}}([eh,ep])}}};Object.defineProperty(_,"__esModule",{value:!0}),_.generateUuid=_.getSecureRandom=_.UuidMethod=_.SecureRandomMethod=_.hashProperty=void 0;var eg,ev,em=eh(Z(4293));function d(){if("undefined"!=typeof crypto&&crypto.getRandomValues)try{var p=new Uint32Array(1);return crypto.getRandomValues(p),{value:p[0]/4294967296,method:eg.CRYPTO_RANDOM_VALUES}}catch(p){}return{value:Math.random(),method:eg.MATH_RANDOM}}_.hashProperty=function(p){return ep(void 0,void 0,void 0,function(){var _,Z,et,el;return ef(this,function(eu){switch(eu.label){case 0:if("undefined"==typeof crypto)return[2,em.err("WebCrypto is unsupported, skipping hash")];if("function"!=typeof(null==crypto?void 0:crypto.subtle.digest))return[2,em.err("WebCrypto subtle.digest does not exist, possible insecure origin")];eu.label=1;case 1:return eu.trys.push([1,3,,4]),_=(new TextEncoder).encode(p),[4,crypto.subtle.digest("SHA-256",_)];case 2:return Z=eu.sent(),et=Array.from(new Uint8Array(Z)).map(function(p){return p.toString(16).padStart(2,"0")}).join(""),[2,em.ok({key:p,hash:et})];case 3:return el=eu.sent(),[2,em.err("Unable to hash rule: ".concat(el))];case 4:return[2]}})})},(et=eg||(_.SecureRandomMethod=eg={})).CRYPTO_RANDOM_VALUES="crypto-random-values",et.MATH_RANDOM="math-random",(el=ev||(_.UuidMethod=ev={})).CRYPTO_RANDOM_UUID="crypto-random-uuid",el.MANUAL_CRYPTO_RANDOM_VALUES="manual-crypto-random-values",el.MANUAL_MATH_RANDOM="manual-math-random",_.getSecureRandom=d,_.generateUuid=function(){if("undefined"!=typeof crypto&&crypto.randomUUID)try{return{value:crypto.randomUUID(),method:ev.CRYPTO_RANDOM_UUID}}catch(p){}for(var p,_="0123456789abcdef",Z="",et=ev.MANUAL_CRYPTO_RANDOM_VALUES,el=0;el<36;el++)8===el||13===el||18===el||23===el?Z+="-":14===el?Z+="4":19===el?((p=d()).method===eg.MATH_RANDOM&&(et=ev.MANUAL_MATH_RANDOM),Z+=_[Math.floor(4*p.value)+8]):((p=d()).method===eg.MATH_RANDOM&&(et=ev.MANUAL_MATH_RANDOM),Z+=_[Math.floor(16*p.value)]);return{value:Z,method:et}}},6889:function(p,_,Z){"use strict";var et=this&&this.__awaiter||function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},el=this&&this.__generator||function(p,_){var Z,et,el,eu,ed={label:0,sent:function(){if(1&el[0])throw el[1];return el[1]},trys:[],ops:[]};return eu={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(eu[Symbol.iterator]=function(){return this}),eu;function a(eh){return function(ep){return function(eh){if(Z)throw TypeError("Generator is already executing.");for(;eu&&(eu=0,eh[0]&&(ed=0)),ed;)try{if(Z=1,et&&(el=2&eh[0]?et.return:eh[0]?et.throw||((el=et.return)&&el.call(et),0):et.next)&&!(el=el.call(et,eh[1])).done)return el;switch(et=0,el&&(eh=[2&eh[0],el.value]),eh[0]){case 0:case 1:el=eh;break;case 4:return ed.label++,{value:eh[1],done:!1};case 5:ed.label++,et=eh[1],eh=[0];continue;case 7:eh=ed.ops.pop(),ed.trys.pop();continue;default:if(!((el=(el=ed.trys).length>0&&el[el.length-1])||6!==eh[0]&&2!==eh[0])){ed=0;continue}if(3===eh[0]&&(!el||eh[1]>el[0]&&eh[1]<el[3])){ed.label=eh[1];break}if(6===eh[0]&&ed.label<el[1]){ed.label=el[1],el=eh;break}if(el&&ed.label<el[2]){ed.label=el[2],ed.ops.push(eh);break}el[2]&&ed.ops.pop(),ed.trys.pop();continue}eh=_.call(p,ed)}catch(p){eh=[6,p],et=0}finally{Z=el=0}if(5&eh[0])throw eh[1];return{value:eh[0]?eh[1]:void 0,done:!0}}([eh,ep])}}};
vendor: 4,505 bytes, line 1
1Object.defineProperty(_,"__esModule",{value:!0}),_.delay=void 0;var eu=Z(6468);_.delay=function(p){return eu.Task.create(function(_){return et(void 0,void 0,void 0,function(){return el(this,function(Z){return[2,new Promise(function(Z){var et=setTimeout(Z,p);_.defer(function(){clearTimeout(et)})})]})})})}},9266:function(p,_,Z){"use strict";var et=this&&this.__createBinding||(Object.create?function(p,_,Z,et){void 0===et&&(et=Z);var el=Object.getOwnPropertyDescriptor(_,Z);el&&!("get"in el?!_.__esModule:el.writable||el.configurable)||(el={enumerable:!0,get:function(){return _[Z]}}),Object.defineProperty(p,et,el)}:function(p,_,Z,et){void 0===et&&(et=Z),p[et]=_[Z]}),el=this&&this.__exportStar||function(p,_){for(var Z in p)"default"===Z||Object.prototype.hasOwnProperty.call(_,Z)||et(_,p,Z)};Object.defineProperty(_,"__esModule",{value:!0}),el(Z(8177),_),el(Z(3012),_),el(Z(4293),_),el(Z(4478),_),el(Z(6889),_)},4478:function(p,_,Z){"use strict";var et=this&&this.__spreadArray||function(p,_,Z){if(Z||2==arguments.length)for(var et,el=0,eu=_.length;el<eu;el++)!et&&el in _||(et||(et=Array.prototype.slice.call(_,0,el)),et[el]=_[el]);return p.concat(et||Array.prototype.slice.call(_))},el=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(_,"__esModule",{value:!0}),_.mergeConfigsOld=_.mergeConfigs=void 0;var eu=el(Z(6924)),s=function(p,_){if(Array.isArray(p))return _};_.mergeConfigs=function(p){for(var _=[],Z=1;Z<arguments.length;Z++)_[Z-1]=arguments[Z];var el=_.map(function(p){return null==p||"object"!=typeof p}).filter(Boolean).length>0;if("object"==typeof p&&!el)return eu.default.apply(void 0,et(et([{},p],_,!1),[s],!1))},_.mergeConfigsOld=function(p){for(var _=[],Z=1;Z<arguments.length;Z++)_[Z-1]=arguments[Z];return eu.default.apply(void 0,et(et([{},p],_,!1),[function(p,_){if(Array.isArray(_))return _}],!1))}},4293:(p,_)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.getErr=_.getOk_or=_.getOk=_.isNotOk=_.isOk=_.err=_.ok=void 0,_.ok=function(p){return{ok:!0,value:p}},_.err=function(p){return{ok:!1,error:p}},_.isOk=function(p){return!0===p.ok},_.isNotOk=function(p){return!(0,_.isOk)(p)},_.getOk=function(p){if(!0===p.ok)return p.value},_.getOk_or=function(p,_){return!0===p.ok?p.value:_},_.getErr=function(p){if(!0!==p.ok)return p.error}},3012:(p,_)=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0}),_.timedThrottle=void 0,_.timedThrottle=function(p,_){var Z=0;return function(){for(var et=[],el=0;el<arguments.length;el++)et[el]=arguments[el];var eu=Date.now();eu-Z>=_&&(Z=eu,p.apply(this,et))}}}},_={};function n(Z){var et=_[Z];if(void 0!==et)return et.exports;var el=_[Z]={id:Z,loaded:!1,exports:{}};return p[Z].call(el.exports,el,el.exports,n),el.loaded=!0,el.exports}return n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(p){if("object"==typeof window)return window}}(),n.nmd=p=>(p.paths=[],p.children||(p.children=[]),p),n(8156)})()},9302(p,_,Z){var et=Z(3488),el=Z(6757),eu=Z(2865);p.exports=function(p,_){return eu(el(p,_,et),p+"")}},9325(p,_,Z){var et=Z(4840),el="object"==typeof self&&self&&self.Object===Object&&self,eu=et||el||Function("return this")();p.exports=eu},9344(p,_,Z){var et=Z(3805),el=Object.create,eu=function(){function e(){}return function(p){if(!et(p))return{};if(el)return el(p);e.prototype=p;var _=new e;return e.prototype=void 0,_}}();p.exports=eu},9350(p){var _=Object.prototype.toString;p.exports=function(p){return _.call(p)}},9570(p,_,Z){var et=Z(7334),el=Z(3243),eu=Z(3488),ed=el?function(p,_){return el(p,"toString",{configurable:!0,enumerable:!1,value:et(_),writable:!0})}:eu;p.exports=ed},9653(p,_,Z){var et=Z(7828);p.exports=function(p){var _=new p.constructor(p.byteLength);return new et(_).set(new et(p)),_}},9817(p){p.exports=function(p){return this.__data__.has(p)}},9884(p,_,Z){var et=Z(1791),el=Z(7241);p.exports=function(p){return et(p,el(p))}},9935(p){p.exports=function(){return!1}}},_={};function n(Z){var et=_[Z];if(void 0!==et)return et.exports;var el=_[Z]={id:Z,loaded:!1,exports:{}};return p[Z].call(el.exports,el,el.exports,n),el.loaded=!0,el.exports}n.n=p=>{var _=p&&p.__esModule?()=>p.default:()=>p;return n.d(_,{a:_}),_},n.d=(p,_)=>{for(var Z in _)n.o(_,Z)&&!n.o(p,Z)&&Object.defineProperty(p,Z,{enumerable:!0,get:_[Z]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(p){if("object"==typeof window)return window}
1}(),n.o=(p,_)=>Object.prototype.hasOwnProperty.call(p,_),n.r=p=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},n.nmd=p=>(p.paths=[],p.children||(p.children=[]),p);var Z={};return(()=>{"use strict";n.r(Z),n.d(Z,{BASIC_FULL_HD_LANDSCAPE:()=>tu,BASIC_FULL_HD_PORTRAIT:()=>td,BASIC_LANDSCAPE:()=>ti,BASIC_PORTRAIT:()=>tl,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>tE,ConnectionState:()=>tz,Errors:()=>ep,InitialLayerPreference:()=>t5,JitterBufferMinDelay:()=>rs,LOG_LEVEL:()=>eZ,LocalStageStream:()=>LocalStageStream,LocalStageStreamEvents:()=>au,LogLevels:()=>eZ,RemoteStageStream:()=>RemoteStageStream,RemoteStageStreamEvents:()=>as,SIMULCAST_DUPLICATE_LAYERS_CONFIGURED:()=>rP,SIMULCAST_LAYER_CONFIGURATION_CONFLICT:()=>rV,SIMULCAST_LAYER_INPUT_FRAMERATE_INSUFFICIENT:()=>rH,SIMULCAST_LAYER_INPUT_RESOLUTION_INSUFFICIENT:()=>rG,SIMULCAST_LAYER_INVALID_TYPE:()=>rN,SIMULCAST_LAYER_ORIENTATION_MISMATCH:()=>rF,SIMULCAST_MAX_LAYERS_EXCEEDED:()=>rD,SIMULCAST_MAX_LAYER_BITRATE_EXCEEDED:()=>rM,SIMULCAST_MAX_LAYER_DIMENSIONS_EXCEEDED:()=>rB,SIMULCAST_MAX_LAYER_FRAMERATE_EXCEEDED:()=>rx,SIMULCAST_MIN_LAYER_BITRATE_EXCEEDED:()=>rL,SIMULCAST_MIN_LAYER_DIMENSIONS_EXCEEDED:()=>rj,SIMULCAST_MIN_LAYER_FRAMERATE_EXCEEDED:()=>rU,SIMULCAST_UNSUPPORTED:()=>rw,STAGE_MAX_AUDIO_BITRATE_KBPS:()=>rR,STAGE_MAX_AUDIO_BITRATE_KBPS_DEFAULT:()=>rO,STAGE_MAX_BITRATE:()=>rE,STAGE_MAX_FRAMERATE:()=>r_,STAGE_MAX_RESOLUTION:()=>rb,STAGE_MIN_AUDIO_BITRATE_KBPS:()=>rI,STAGE_MIN_BITRATE:()=>rm,STAGE_MIN_FRAMERATE:()=>rS,STAGE_MIN_RESOLUTION:()=>ry,STANDARD_LANDSCAPE:()=>th,STANDARD_PORTRAIT:()=>tp,SimulcastLayerPresets:()=>rf,Stage:()=>Stage,StageConnectionState:()=>oP,StageErrorCategory:()=>iY,StageErrorCode:()=>iQ,StageEvents:()=>aM,StageLeftReason:()=>et,StageParticipantPublishState:()=>am,StageParticipantSubscribeState:()=>aE,StageStream:()=>StageStream,StageStreamLayerSelectedReason:()=>al,StreamType:()=>nV,SubscribeType:()=>oq,_StageVideoCodec:()=>t8,_StageVideoCodecPresets:()=>rv,_StageVideoH264ProfileLevel:()=>t7,__version:()=>n0,create:()=>zo,default:()=>aL,isSupported:()=>ue});var p,_,et,el={};n.r(el),n.d(el,{fixNegotiationNeeded:()=>N,shimAddTrackRemoveTrack:()=>A,shimAddTrackRemoveTrackWithNative:()=>w,shimGetDisplayMedia:()=>b,shimGetSendersWithDtmf:()=>I,shimGetStats:()=>R,shimGetUserMedia:()=>y,shimMediaStream:()=>C,shimOnTrack:()=>T,shimPeerConnection:()=>k,shimSenderReceiverGetStats:()=>O});var eu={};n.r(eu),n.d(eu,{shimAddTransceiver:()=>F,shimCreateAnswer:()=>H,shimCreateOffer:()=>G,shimGetDisplayMedia:()=>P,shimGetParameters:()=>V,shimGetUserMedia:()=>D,shimOnTrack:()=>M,shimPeerConnection:()=>L,shimRTCDataChannel:()=>j,shimReceiverGetStats:()=>U,shimRemoveStream:()=>B,shimSenderGetStats:()=>x});var ed={};n.r(ed),n.d(ed,{shimAudioContext:()=>Q,shimCallbacksAPI:()=>$,shimConstraints:()=>z,shimCreateOfferLegacy:()=>X,shimGetUserMedia:()=>K,shimLocalStreamsAPI:()=>q,shimRTCIceServerUrls:()=>J,shimRemoteStreamsAPI:()=>W,shimTrackEventTransceiver:()=>Y});var eh={};n.r(eh),n.d(eh,{removeExtmapAllowMixed:()=>se,shimAddIceCandidateNullOrEmpty:()=>ae,shimConnectionState:()=>oe,shimMaxMessageSize:()=>re,shimParameterlessSetLocalDescription:()=>ce,shimRTCIceCandidate:()=>te,shimRTCIceCandidateRelayProtocol:()=>ne,shimSendThrowTypeError:()=>ie});var ep={};n.r(ep),n.d(ep,{ADD_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>eI,ADD_DEVICE_COMPOSITION_MISSING_ERROR:()=>eT,ADD_DEVICE_CONSTRAINTS_ERROR:()=>eA,ADD_DEVICE_DEVICE_ERROR:()=>eb,ADD_DEVICE_NAME_EXISTS_ERROR:()=>eC,ADD_DEVICE_NAME_MISSING_ERROR:()=>eR,ADD_DEVICE_UNSUPPORTED:()=>eO,BROADCAST_CONFIGURATION_ERROR:()=>ej,BROADCAST_ERROR:()=>eS,CAMERA_ERROR:()=>e_,CLIENT_INVALID_ERROR:()=>eq,EXCHANGE_POSITION_DEVICE_NOT_FOUND_ERROR:()=>eM,FAILED_TO_ADD_IMAGE_ERROR:()=>eL,INGEST_ENDPOINT_TYPE_ERROR:()=>eF,INGEST_ENDPOINT_URL_ERROR:()=>eG,INPUT_ERROR:()=>ey,INVALID_STREAM_KEY:()=>eB,LOGGER_TYPE_ERROR:()=>eW,LOG_LEVEL_TYPE_ERROR:()=>eH,NETWORK_RECONNECT_CONFIGURATION_ERROR:()=>
vendor: 8,700 bytes, line 1
1e$,NETWORK_RECONNECT_CONFIGURATION_INVALID_TIMEOUT_ERROR:()=>eK,PEER_CONNECTION_ERROR:()=>eU,PEER_SETUP_ERROR:()=>ex,REMOVE_DEVICE_NOT_FOUND_ERROR:()=>ek,REMOVE_IMAGE_NOT_FOUND_ERROR:()=>ew,STAGE_TOKEN_TYPE_ERROR:()=>eJ,STAGE_WHIP_OVERRIDE_ERROR:()=>eX,STREAM_CONFIGURATION_ERROR:()=>eV,STREAM_KEY_INVALID_CHAR_ERROR:()=>ez,UPDATE_VIDEO_DEVICE_COMPOSITION_INDEX_MISSING_ERROR:()=>eD,UPDATE_VIDEO_DEVICE_COMPOSITION_MISSING_ERROR:()=>eN,UPDATE_VIDEO_DEVICE_COMPOSITION_NAME_NOT_FOUND_ERROR:()=>eP});var ef={};n.r(ef),n.d(ef,{BASIC_FULL_HD_LANDSCAPE:()=>tu,BASIC_FULL_HD_PORTRAIT:()=>td,BASIC_LANDSCAPE:()=>ti,BASIC_PORTRAIT:()=>tl,BroadcastClientError:()=>BroadcastClientError,BroadcastClientEvents:()=>tE,ConnectionState:()=>tz,Errors:()=>ep,LOG_LEVEL:()=>eZ,LogLevels:()=>eZ,STANDARD_LANDSCAPE:()=>th,STANDARD_PORTRAIT:()=>tp,__version:()=>n0,create:()=>zo,isSupported:()=>ue});function l(p,_,Z){let et=p.match(_);return et&&et.length>=Z&&parseInt(et[Z],10)}function d(p,_,Z){if(!p.RTCPeerConnection)return;let et=p.RTCPeerConnection.prototype,el=et.addEventListener;et.addEventListener=function(p,et){if(p!==_)return el.apply(this,arguments);let o=p=>{let _=Z(p);_&&(et.handleEvent?et.handleEvent(_):et(_))};return this._eventMap=this._eventMap||{},this._eventMap[_]||(this._eventMap[_]=new Map),this._eventMap[_].set(et,o),el.apply(this,[p,o])};let eu=et.removeEventListener;et.removeEventListener=function(p,Z){if(p!==_||!this._eventMap||!this._eventMap[_]||!this._eventMap[_].has(Z))return eu.apply(this,arguments);let et=this._eventMap[_].get(Z);return this._eventMap[_].delete(Z),0===this._eventMap[_].size&&delete this._eventMap[_],0===Object.keys(this._eventMap).length&&delete this._eventMap,eu.apply(this,[p,et])},Object.defineProperty(et,"on"+_,{get(){return this["_on"+_]},set(p){this["_on"+_]&&(this.removeEventListener(_,this["_on"+_]),delete this["_on"+_]),p&&this.addEventListener(_,this["_on"+_]=p)},enumerable:!0,configurable:!0})}function f(){}function g(p,_){console.warn(p+" is deprecated, please use "+_+" instead.")}function v(p){return"[object Object]"===Object.prototype.toString.call(p)}function S(p,_,Z){let et=Z?"outbound-rtp":"inbound-rtp",el=new Map;if(null===_)return el;let eu=[];return p.forEach(p=>{"track"===p.type&&p.trackIdentifier===_.id&&eu.push(p)}),eu.forEach(_=>{p.forEach(Z=>{Z.type===et&&Z.trackId===_.id&&function E(p,_,Z){_&&!Z.has(_.id)&&(Z.set(_.id,_),Object.keys(_).forEach(et=>{et.endsWith("Id")?E(p,p.get(_[et]),Z):et.endsWith("Ids")&&_[et].forEach(_=>{E(p,p.get(_),Z)})}))}(p,Z,el)})}),el}function y(p,_){let Z=p&&p.navigator;if(!Z.mediaDevices)return;let r=function(p){if("object"!=typeof p||p.mandatory||p.optional)return p;let _={};return Object.keys(p).forEach(Z=>{if("require"===Z||"advanced"===Z||"mediaSource"===Z)return;let et="object"==typeof p[Z]?p[Z]:{ideal:p[Z]};void 0!==et.exact&&"number"==typeof et.exact&&(et.min=et.max=et.exact);let i=function(p,_){return p?p+_.charAt(0).toUpperCase()+_.slice(1):"deviceId"===_?"sourceId":_};if(void 0!==et.ideal){_.optional=_.optional||[];let p={};"number"==typeof et.ideal?(p[i("min",Z)]=et.ideal,_.optional.push(p),(p={})[i("max",Z)]=et.ideal):p[i("",Z)]=et.ideal,_.optional.push(p)}void 0!==et.exact&&"number"!=typeof et.exact?(_.mandatory=_.mandatory||{},_.mandatory[i("",Z)]=et.exact):["min","max"].forEach(p=>{void 0!==et[p]&&(_.mandatory=_.mandatory||{},_.mandatory[i(p,Z)]=et[p])})}),p.advanced&&(_.optional=(_.optional||[]).concat(p.advanced)),_},i=function(p,et){if(_.version>=61)return et(p);if((p=JSON.parse(JSON.stringify(p)))&&"object"==typeof p.audio){let t=function(p,_,Z){_ in p&&!(Z in p)&&(p[Z]=p[_],delete p[_])};t((p=JSON.parse(JSON.stringify(p))).audio,"autoGainControl","googAutoGainControl"),t(p.audio,"noiseSuppression","googNoiseSuppression"),p.audio=r(p.audio)}if(p&&"object"==typeof p.video){let el=p.video.facingMode;el=el&&("object"==typeof el?el:{ideal:el});let eu=_.version<66;if(el&&("user"===el.exact||"environment"===el.exact||"user"===el.ideal||"environment"===el.ideal)&&(!Z.mediaDevices.getSupportedConstraints||!Z.mediaDevices.getSupportedConstraints().facingMode||eu)){let _;if(delete p.video.facingMode,"environment"===el.exact||"environment"===el.ideal?_=["back","rear"]:"user"!==el.exact&&"user"!==el.ideal||(_=["front"]),_)return Z.mediaDevices.enumerateDevices().then(Z=>{let eu=(Z=Z.filter(p=>"videoinput"===p.kind)).find(p=>_.some(_=>p.label.toLowerCase().includes(_)));return!eu&&Z.length&&_.includes("back")&&(eu=Z[Z.length-1]),eu&&(p.video.deviceId=el.exact?{exact:eu.deviceId}:{ideal:eu.deviceId}),p.video=r(p.video),f("chrome: "+JSON.stringify(p)),et(p)})}p.video=r(p.video)}return f("chrome: "+JSON.stringify(p)),et(p)},o=function(p){return _.version>=64?p:{name:({PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"})[p.name]||p.name,message:p.message,constraint:p.constraint||p.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(Z.getUserMedia=(function(p,_,et){i(p,p=>{Z.webkitGetUserMedia(p,_,p=>{et&&et(o(p))})})}).bind(Z),Z.mediaDevices.getUserMedia){let p=Z.mediaDevices.getUserMedia.bind(Z.mediaDevices);Z.mediaDevices.getUserMedia=function(_){return i(_,_=>p(_).then(p=>{if(_.audio&&!p.getAudioTracks().length||_.video&&!p.getVideoTracks().length)throw p.getTracks().forEach(p=>{p.stop()}),new DOMException("","NotFoundError");return p},p=>Promise.reject(o(p))))}}}function b(p,_){p.navigator.mediaDevices&&"getDisplayMedia"in p.navigator.mediaDevices||p.navigator.mediaDevices&&("function"==typeof _?p.navigator.mediaDevices.getDisplayMedia=function(Z){return _(Z).then(_=>{let et=Z.video&&Z.video.width,el=Z.video&&Z.video.height,eu=Z.video&&Z.video.frameRate;return Z.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:_,maxFrameRate:eu||3}},et&&(Z.video.mandatory.maxWidth=et),el&&(Z.video.mandatory.maxHeight=el),p.navigator.mediaDevices.getUserMedia(Z)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function C(p){p.MediaStream=p.MediaStream||p.webkitMediaStream}function T(p){if("object"!=typeof p||!p.RTCPeerConnection||"ontrack"in p.RTCPeerConnection.prototype)d(p,"track",p=>(p.transceiver||Object.defineProperty(p,"transceiver",{value:{receiver:p.receiver}}),p));else{Object.defineProperty(p.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(p){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=p)},enumerable:!0,configurable:!0});let _=p.RTCPeerConnection.prototype.setRemoteDescription;p.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=_=>{_.stream.addEventListener("addtrack",Z=>{let et;et=p.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(p=>p.track&&p.track.id===Z.track.id):{track:Z.track};let el=new Event("track");el.track=Z.track,el.receiver=et,el.transceiver={receiver:et},el.streams=[_.stream],this.dispatchEvent(el)}),_.stream.getTracks().forEach(Z=>{let et;et=p.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(p=>p.track&&p.track.id===Z.id):{track:Z};let el=new Event("track");el.track=Z,el.receiver=et,el.transceiver={receiver:et},el.streams=[_.stream],this.dispatchEvent(el)})},this.addEventListener("addstream",this._ontrackpoly)),_.apply(this,arguments)}}}function I(p){if("object"==typeof p&&p.RTCPeerConnection&&!("getSenders"in p.RTCPeerConnection.prototype)&&"createDTMFSender"in p.RTCPeerConnection.prototype){let t=function(p,_){return{track:_,get dtmf(){return void 0===this._dtmf&&("audio"===_.kind?this._dtmf=p.createDTMFSender(_):this._dtmf=null),this._dtmf},_pc:p}};if(!p.RTCPeerConnection.prototype.getSenders){p.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let _=p.RTCPeerConnection.prototype.addTrack;p.RTCPeerConnection.prototype.addTrack=function(p,Z){let et=_.apply(this,arguments);return et||(et=t(this,p),this._senders.push(et)),et};let Z=p.RTCPeerConnection.prototype.removeTrack;p.RTCPeerConnection.prototype.removeTrack=function(p){Z.apply(this,arguments);let _=this._senders.indexOf(p);-1!==_&&this._senders.splice(_,1)}}let _=p.RTCPeerConnection.prototype.addStream;p.RTCPeerConnection.prototype.addStream=function(p){this._senders=this._senders||[],_.apply(this,[p]),p.getTracks().forEac
1h(p=>{this._senders.push(t(this,p))})};let Z=p.RTCPeerConnection.prototype.removeStream;p.RTCPeerConnection.prototype.removeStream=function(p){this._senders=this._senders||[],Z.apply(this,[p]),p.getTracks().forEach(p=>{let _=this._senders.find(_=>_.track===p);_&&this._senders.splice(this._senders.indexOf(_),1)})}}else if("object"==typeof p&&p.RTCPeerConnection&&"getSenders"in p.RTCPeerConnection.prototype&&"createDTMFSender"in p.RTCPeerConnection.prototype&&p.RTCRtpSender&&!("dtmf"in p.RTCRtpSender.prototype)){let _=p.RTCPeerConnection.prototype.getSenders;p.RTCPeerConnection.prototype.getSenders=function(){let p=_.apply(this,[]);return p.forEach(p=>p._pc=this),p},Object.defineProperty(p.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function R(p){if(!p.RTCPeerConnection)return;let _=p.RTCPeerConnection.prototype.getStats;p.RTCPeerConnection.prototype.getStats=function(){let[p,Z,et]=arguments;if(arguments.length>0&&"function"==typeof p)return _.apply(this,arguments);if(0===_.length&&(0==arguments.length||"function"!=typeof p))return _.apply(this,[]);let i=function(p){let _={};return p.result().forEach(p=>{let Z={id:p.id,timestamp:p.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[p.type]||p.type};p.names().forEach(_=>{Z[_]=p.stat(_)}),_[Z.id]=Z}),_},o=function(p){return new Map(Object.keys(p).map(_=>[_,p[_]]))};return arguments.length>=2?_.apply(this,[function(p){Z(o(i(p)))},p]):new Promise((p,Z)=>{_.apply(this,[function(_){p(o(i(_)))},Z])}).then(Z,et)}}function O(p){if(!("object"==typeof p&&p.RTCPeerConnection&&p.RTCRtpSender&&p.RTCRtpReceiver))return;if(!("getStats"in p.RTCRtpSender.prototype)){let _=p.RTCPeerConnection.prototype.getSenders;_&&(p.RTCPeerConnection.prototype.getSenders=function(){let p=_.apply(this,[]);return p.forEach(p=>p._pc=this),p});let Z=p.RTCPeerConnection.prototype.addTrack;Z&&(p.RTCPeerConnection.prototype.addTrack=function(){let p=Z.apply(this,arguments);return p._pc=this,p}),p.RTCRtpSender.prototype.getStats=function(){let p=this;return this._pc.getStats().then(_=>S(_,p.track,!0))}}if(!("getStats"in p.RTCRtpReceiver.prototype)){let _=p.RTCPeerConnection.prototype.getReceivers;_&&(p.RTCPeerConnection.prototype.getReceivers=function(){let p=_.apply(this,[]);return p.forEach(p=>p._pc=this),p}),d(p,"track",p=>(p.receiver._pc=p.srcElement,p)),p.RTCRtpReceiver.prototype.getStats=function(){let p=this;return this._pc.getStats().then(_=>S(_,p.track,!1))}}if(!("getStats"in p.RTCRtpSender.prototype)||!("getStats"in p.RTCRtpReceiver.prototype))return;let _=p.RTCPeerConnection.prototype.getStats;p.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof p.MediaStreamTrack){let p,_,Z;let et=arguments[0];return this.getSenders().forEach(_=>{_.track===et&&(p?Z=!0:p=_)}),this.getReceivers().forEach(p=>(p.track===et&&(_?Z=!0:_=p),p.track===et)),Z||p&&_?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):p?p.getStats():_?_.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return _.apply(this,arguments)}}function w(p){p.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(p=>this._shimmedLocalStreams[p][0])};let _=p.RTCPeerConnection.prototype.addTrack;p.RTCPeerConnection.prototype.addTrack=function(p,Z){if(!Z)return _.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let et=_.apply(this,arguments);return this._shimmedLocalStreams[Z.id]?-1===this._shimmedLocalStreams[Z.id].indexOf(et)&&this._shimmedLocalStreams[Z.id].push(et):this._shimmedLocalStreams[Z.id]=[Z,et],et};let Z=p.RTCPeerConnection.prototype.addStream;p.RTCPeerConnection.prototype.addStream=function(p){this._shimmedLocalStreams=this._shimmedLocalStreams||{},p.getTracks().forEach(p=>{if(this.getSenders().find(_=>_.track===p))throw new DOMException("Track already exists.","InvalidAccessError")});let _=this.getSenders();Z.apply(this,arguments);let et=this.getSenders().filter(p=>-1===_.indexOf(p));this._shimmedLocalStreams[p.id]=[p].concat(et)};let et=p.RTCPeerConnection.prototype.removeStream;p.RTCPeerConnection.prototype.removeStream=function(p){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[p.id],et.apply(this,arguments)};let el=p.RTCPeerConnection.prototype.removeTrack;p.RTCPeerConnection.prototype.removeTrack=function(p){return this._shimmedLocalStreams=this._shimmedLocalStreams||{}
vendor: 21,269 bytes, line 1
1,p&&Object.keys(this._shimmedLocalStreams).forEach(_=>{let Z=this._shimmedLocalStreams[_].indexOf(p);-1!==Z&&this._shimmedLocalStreams[_].splice(Z,1),1===this._shimmedLocalStreams[_].length&&delete this._shimmedLocalStreams[_]}),el.apply(this,arguments)}}function A(p,_){if(!p.RTCPeerConnection)return;if(p.RTCPeerConnection.prototype.addTrack&&_.version>=65)return w(p);let Z=p.RTCPeerConnection.prototype.getLocalStreams;p.RTCPeerConnection.prototype.getLocalStreams=function(){let p=Z.apply(this);return this._reverseStreams=this._reverseStreams||{},p.map(p=>this._reverseStreams[p.id])};let et=p.RTCPeerConnection.prototype.addStream;p.RTCPeerConnection.prototype.addStream=function(_){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},_.getTracks().forEach(p=>{if(this.getSenders().find(_=>_.track===p))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[_.id]){let Z=new p.MediaStream(_.getTracks());this._streams[_.id]=Z,this._reverseStreams[Z.id]=_,_=Z}et.apply(this,[_])};let el=p.RTCPeerConnection.prototype.removeStream;function o(p,_){let Z=_.sdp;return Object.keys(p._reverseStreams||[]).forEach(_=>{let et=p._reverseStreams[_],el=p._streams[et.id];Z=Z.replace(RegExp(el.id,"g"),et.id)}),new RTCSessionDescription({type:_.type,sdp:Z})}p.RTCPeerConnection.prototype.removeStream=function(p){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},el.apply(this,[this._streams[p.id]||p]),delete this._reverseStreams[this._streams[p.id]?this._streams[p.id].id:p.id],delete this._streams[p.id]},p.RTCPeerConnection.prototype.addTrack=function(_,Z){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let et=[].slice.call(arguments,1);if(1!==et.length||!et[0].getTracks().find(p=>p===_))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(p=>p.track===_))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let el=this._streams[Z.id];if(el)el.addTrack(_),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{let et=new p.MediaStream([_]);this._streams[Z.id]=et,this._reverseStreams[et.id]=Z,this.addStream(et)}return this.getSenders().find(p=>p.track===_)},["createOffer","createAnswer"].forEach(function(_){let Z=p.RTCPeerConnection.prototype[_];p.RTCPeerConnection.prototype[_]=({[_](){let p=arguments;return arguments.length&&"function"==typeof arguments[0]?Z.apply(this,[_=>{let Z=o(this,_);p[0].apply(null,[Z])},_=>{p[1]&&p[1].apply(null,_)},arguments[2]]):Z.apply(this,arguments).then(p=>o(this,p))}})[_]});let eu=p.RTCPeerConnection.prototype.setLocalDescription;p.RTCPeerConnection.prototype.setLocalDescription=function(){var p,_;let Z;return arguments.length&&arguments[0].type&&(arguments[0]=(p=this,_=arguments[0],Z=_.sdp,Object.keys(p._reverseStreams||[]).forEach(_=>{let et=p._reverseStreams[_],el=p._streams[et.id];Z=Z.replace(RegExp(et.id,"g"),el.id)}),new RTCSessionDescription({type:_.type,sdp:Z}))),eu.apply(this,arguments)};let ed=Object.getOwnPropertyDescriptor(p.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(p.RTCPeerConnection.prototype,"localDescription",{get(){let p=ed.get.apply(this);return""===p.type?p:o(this,p)}}),p.RTCPeerConnection.prototype.removeTrack=function(p){let _;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!p._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(p._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach(Z=>{this._streams[Z].getTracks().find(_=>p.track===_)&&(_=this._streams[Z])}),_&&(1===_.getTracks().length?this.removeStream(this._reverseStreams[_.id]):_.removeTrack(p.track),this.dispatchEvent(new Event("negotiationneeded")))}}function k(p,_){!p.RTCPeerConnection&&p.webkitRTCPeerConnection&&(p.RTCPeerConnection=p.webkitRTCPeerConnection),p.RTCPeerConnection&&_.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(_){let Z=p.RTCPeerConnection.prototype[_];p.RTCPeerConnection.prototype[_]=({[_](){return arguments[0]=new("addIceCandidate"===_?p.RTCIceCandidate:p.RTCSessionDescription)(arguments[0]),Z.apply(this,arguments)}})[_]})}function N(p,_){d(p,"negotiationneeded",p=>{let Z=p.target;if(!(_.version<72||Z.getConfiguration&&"plan-b"===Z.getConfiguration().sdpSemantics)||"stable"===Z.signalingState)return p})}function D(p,_){let Z=p&&p.navigator,et=p&&p.MediaStreamTrack;if(Z.getUserMedia=function(p,_,et){g("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),Z.mediaDevices.getUserMedia(p).then(_,et)},!(_.version>55&&"autoGainControl"in Z.mediaDevices.getSupportedConstraints())){let e=function(p,_,Z){_ in p&&!(Z in p)&&(p[Z]=p[_],delete p[_])},p=Z.mediaDevices.getUserMedia.bind(Z.mediaDevices);if(Z.mediaDevices.getUserMedia=function(_){return"object"==typeof _&&"object"==typeof _.audio&&(e((_=JSON.parse(JSON.stringify(_))).audio,"autoGainControl","mozAutoGainControl"),e(_.audio,"noiseSuppression","mozNoiseSuppression")),p(_)},et&&et.prototype.getSettings){let p=et.prototype.getSettings;et.prototype.getSettings=function(){let _=p.apply(this,arguments);return e(_,"mozAutoGainControl","autoGainControl"),e(_,"mozNoiseSuppression","noiseSuppression"),_}}if(et&&et.prototype.applyConstraints){let p=et.prototype.applyConstraints;et.prototype.applyConstraints=function(_){return"audio"===this.kind&&"object"==typeof _&&(e(_=JSON.parse(JSON.stringify(_)),"autoGainControl","mozAutoGainControl"),e(_,"noiseSuppression","mozNoiseSuppression")),p.apply(this,[_])}}}}function P(p,_){p.navigator.mediaDevices&&"getDisplayMedia"in p.navigator.mediaDevices||p.navigator.mediaDevices&&(p.navigator.mediaDevices.getDisplayMedia=function(Z){if(!Z||!Z.video){let p=new DOMException("getDisplayMedia without video constraints is undefined");return p.name="NotFoundError",p.code=8,Promise.reject(p)}return!0===Z.video?Z.video={mediaSource:_}:Z.video.mediaSource=_,p.navigator.mediaDevices.getUserMedia(Z)})}function M(p){"object"==typeof p&&p.RTCTrackEvent&&"receiver"in p.RTCTrackEvent.prototype&&!("transceiver"in p.RTCTrackEvent.prototype)&&Object.defineProperty(p.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function L(p,_){if("object"!=typeof p||!p.RTCPeerConnection&&!p.mozRTCPeerConnection)return;!p.RTCPeerConnection&&p.mozRTCPeerConnection&&(p.RTCPeerConnection=p.mozRTCPeerConnection),_.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(_){let Z=p.RTCPeerConnection.prototype[_];p.RTCPeerConnection.prototype[_]=({[_](){return arguments[0]=new("addIceCandidate"===_?p.RTCIceCandidate:p.RTCSessionDescription)(arguments[0]),Z.apply(this,arguments)}})[_]});let Z={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},et=p.RTCPeerConnection.prototype.getStats;p.RTCPeerConnection.prototype.getStats=function(){let[p,el,eu]=arguments;return et.apply(this,[p||null]).then(p=>{if(_.version<53&&!el)try{p.forEach(p=>{p.type=Z[p.type]||p.type})}catch(_){if("TypeError"!==_.name)throw _;p.forEach((_,et)=>{p.set(et,Object.assign({},_,{type:Z[_.type]||_.type}))})}return p}).then(el,eu)}}function x(p){if("object"!=typeof p||!p.RTCPeerConnection||!p.RTCRtpSender||p.RTCRtpSender&&"getStats"in p.RTCRtpSender.prototype)return;let _=p.RTCPeerConnection.prototype.getSenders;_&&(p.RTCPeerConnection.prototype.getSenders=function(){let p=_.apply(this,[]);return p.forEach(p=>p._pc=this),p});let Z=p.RTCPeerConnection.prototype.addTrack;Z&&(p.RTCPeerConnection.prototype.addTrack=function(){let p=Z.apply(this,arguments);return p._pc=this,p}),p.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function U(p){if("object"!=typeof p||!p.RTCPeerConnection||!p.RTCRtpSender||p.RTCRtpSender&&"getStats"in p.RTCRtpReceiver.prototype)return;let _=p.RTCPeerConnection.prototype.getReceivers;_&&(p.RTCPeerConnection.prototype.getReceivers=function(){let p=_.apply(this,[]);return p.forEach(p=>p._pc=this),p}),d(p,"track",p=>(p.receiver._pc=p.srcElement,p)),p.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function B(p){!p.RTCPeerConnection||"removeStream"in p.RTCPeerConnection.prototype||(p.RTCPeerConnection.prototype.removeStream=function(p){g("removeStream","removeTrack"),this.getSenders().forEach(_=>{_.track&&p.getTracks().includes(_.track)&&this.removeTrack(_)})})}function j(p){p.DataChannel&&!p.RTCDataChannel&&(p.RTCDataChannel=p.DataChannel)}function F(p){if("object"!=typeof p||!p.RTCPeerConnection)return;let _=p.RTCPeerConnection.prototype.addTransceiver;_&&(p.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let p=arguments[1]&&arguments[1].sendEncodings;void 0===p&&(p=[]),p=[...p];let Z=p.length>0;Z&&p.forEach(p=>{if("rid"in p&&!/^[a-z0-9]{0,16}$/i.test(p.rid))throw TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in p&&!(parseFloat(p.scaleResolutionDownBy)>=1))throw RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in p&&!(parseFloat(p.maxFramerate)>=0))throw RangeError("max_framerate must be >= 0.0")});let et=_.apply(this,arguments);if(Z){let{sender:_}=et,Z=_.getParameters();"encodings"in Z&&(1!==Z.encodings.length||0!==Object.keys(Z.encodings[0]).length)||(Z.encodings=p,_.sendEncodings=p,this.setParametersPromises.push(_.setParameters(Z).then(()=>{delete _.sendEncodings}).catch(()=>{delete _.sendEncodings})))}return et})}function V(p){if("object"!=typeof p||!p.RTCRtpSender)return;let _=p.RTCRtpSender.prototype.getParameters;_&&(p.RTCRtpSender.prototype.getParameters=function(){let p=_.apply(this,arguments);return"encodings"in p||(p.encodings=[].concat(this.sendEncodings||[{}])),p})}function G(p){if("object"!=typeof p||!p.RTCPeerConnection)return;let _=p.RTCPeerConnection.prototype.createOffer;p.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>_.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):_.apply(this,arguments)}}function H(p){if("object"!=typeof p||!p.RTCPeerConnection)return;let _=p.RTCPeerConnection.prototype.createAnswer;p.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>_.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):_.apply(this,arguments)}}function q(p){if("object"==typeof p&&p.RTCPeerConnection){if("getLocalStreams"in p.RTCPeerConnection.prototype||(p.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in p.RTCPeerConnection.prototype)){let _=p.RTCPeerConnection.prototype.addTrack;p.RTCPeerConnection.prototype.addStream=function(p){this._localStreams||(this._localStreams=[]),this._localStreams.includes(p)||this._localStreams.push(p),p.getAudioTracks().forEach(Z=>_.call(this,Z,p)),p.getVideoTracks().forEach(Z=>_.call(this,Z,p))},p.RTCPeerConnection.prototype.addTrack=function(p,...Z){return Z&&Z.forEach(p=>{this._localStreams?this._localStreams.includes(p)||this._localStreams.push(p):this._localStreams=[p]}),_.apply(this,arguments)}}"removeStream"in p.RTCPeerConnection.prototype||(p.RTCPeerConnection.prototype.removeStream=function(p){this._localStreams||(this._localStreams=[]);let _=this._localStreams.indexOf(p);if(-1===_)return;this._localStreams.splice(_,1);let Z=p.getTracks();this.getSenders().forEach(p=>{Z.includes(p.track)&&this.removeTrack(p)})})}}function W(p){if("object"==typeof p&&p.RTCPeerConnection&&("getRemoteStreams"in p.RTCPeerConnection.prototype||(p.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in p.RTCPeerConnection.prototype))){Object.defineProperty(p.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(p){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=p),this.addEventListener("track",this._onaddstreampoly=p=>{p.streams.forEach(p=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(p))return;this._remoteStreams.push(p);let _=new Event("addstream");_.stream=p,this.dispatchEvent(_)})})}});let _=p.RTCPeerConnection.prototype.setRemoteDescription;p.RTCPeerConnection.prototype.setRemoteDescription=function(){let p=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(_){_.streams.forEach(_=>{if(p._remoteStreams||(p._remoteStreams=[]),p._remoteStreams.indexOf(_)>=0)return;p._remoteStreams.push(_);let Z=new Event("addstream");Z.stream=_,p.dispatchEvent(Z)})}),_.apply(p,arguments)}}}function $(p){if("object"!=typeof p||!p.RTCPeerConnection)return;let _=p.RTCPeerConnection.prototype,Z=_.createOffer,et=_.createAnswer,el=_.setLocalDescription,eu=_.setRemoteDescription,ed=_.addIceCandidate;_.createOffer=function(p,_){let et=arguments.length>=2?arguments[2]:arguments[0],el=Z.apply(this,[et]);return _?(el.then(p,_),Promise.resolve()):el},_.createAnswer=function(p,_){let Z=arguments.length>=2?arguments[2]:arguments[0],el=et.apply(this,[Z]);return _?(el.then(p,_),Promise.resolve()):el};let a=function(p,_,Z){let et=el.apply(this,[p]);return Z?(et.then(_,Z),Promise.resolve()):et};_.setLocalDescription=a,a=function(p,_,Z){let et=eu.apply(this,[p]);return Z?(et.then(_,Z),Promise.resolve()):et},_.setRemoteDescription=a,a=function(p,_,Z){let et=ed.apply(this,[p]);return Z?(et.then(_,Z),Promise.resolve()):et},_.addIceCandidate=a}function K(p){let _=p&&p.navigator;if(_.mediaDevices&&_.mediaDevices.getUserMedia){let p=_.mediaDevices,Z=p.getUserMedia.bind(p);_.mediaDevices.getUserMedia=p=>Z(z(p))}!_.getUserMedia&&_.mediaDevices&&_.mediaDevices.getUserMedia&&(_.getUserMedia=(function(p,Z,et){_.mediaDevices.getUserMedia(p).then(Z,et)}).bind(_))}function z(p){return p&&void 0!==p.video?Object.assign({},p,{video:function m(p){return v(p)?Object.keys(p).reduce(function(_,Z){let et=v(p[Z]),el=et?m(p[Z]):p[Z],eu=et&&!Object.keys(el).length;return void 0===el||eu?_:Object.assign(_,{[Z]:el})},{}):p}(p.video)}):p}function J(p){if(!p.RTCPeerConnection)return;let _=p.RTCPeerConnection;p.RTCPeerConnection=function(p,Z){if(p&&p.iceServers){let _=[];for(let Z=0;Z<p.iceServers.length;Z++){let et=p.iceServers[Z];void 0===et.urls&&et.url?(g("RTCIceServer.url","RTCIceServer.urls"),(et=JSON.parse(JSON.stringify(et))).urls=et.url,delete et.url,_.push(et)):_.push(p.iceServers[Z])}p.iceServers=_}return new _(p,Z)},p.RTCPeerConnection.prototype=_.prototype,"generateCertificate"in _&&Object.defineProperty(p.RTCPeerConnection,"generateCertificate",{get:()=>_.generateCertificate})}function Y(p){"object"==typeof p&&p.RTCTrackEvent&&"receiver"in p.RTCTrackEvent.prototype&&!("transceiver"in p.RTCTrackEvent.prototype)&&Object.defineProperty(p.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function X(p){let _=p.RTCPeerConnection.prototype.createOffer;p.RTCPeerConnection.prototype.createOffer=function(p){if(p){void 0!==p.offerToReceiveAudio&&(p.offerToReceiveAudio=!!p.offerToReceiveAudio);let _=this.getTransceivers().find(p=>"audio"===p.receiver.track.kind);!1===p.offerToReceiveAudio&&_?"sendrecv"===_.direction?_.setDirection?_.setDirection("sendonly"):_.direction="sendonly":"recvonly"===_.direction&&(_.setDirection?_.setDirection("inactive"):_.direction="inactive"):!0!==p.offerToReceiveAudio||_||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==p.offerToReceiveVideo&&(p.offerToReceiveVideo=!!p.offerToReceiveVideo);let Z=this.getTransceivers().find(p=>"video"===p.receiver.track.kind);!1===p.offerToReceiveVideo&&Z?"sendrecv"===Z.direction?Z.setDirection?Z.setDirection("sendonly"):Z.direction="sendonly":"recvonly"===Z.direction&&(Z.setDirection?Z.setDirection("inactive"):Z.direction="inactive"):!0!==p.offerToReceiveVideo||Z||this.addTransceiver("video",{direction:"recvonly"})}return _.apply(this,arguments)}}function Q(p){"object"!=typeof p||p.AudioContext||(p.AudioContext=p.webkitAudioContext)}var eg=n(7963),ev=n.n(eg);function te(p){if(!p.RTCIceCandidate||p.RTCIceCandidate&&"foundation"in p.RTCIceCandidate.prototype)return;let _=p.RTCIceCandidate;p.RTCIceCandidate=function(p){if("object"==typeof p&&p.candidate&&0===p.candidate.indexOf("a=")&&((p=JSON.parse(JSON.stringify(p))).candidate=p.candidate.substring(2)),p.candidate&&p.candidate.length){let Z=new _(p),et=ev().parseCandidate(p.candidate);for(let p in et)p in Z||Object.defineProperty(Z,p,{value:et[p]});return Z.toJSON=function(){return{candidate:Z.candidate,sdpMid:Z.sdpMid,sdpMLineIndex:Z.sdpMLineIndex,usernameFragment:Z.usernameFragment}},Z}return new _(p)},p.RTCIceCandidate.prototype=_.prototype,d(p,"icecandidate",_=>(_.candidate&&Object.defineProperty(_,"candidate",{value:new p.RTCIceCandidate(_.candidate),writable:"false"}),_))}function ne(p){!p.RTCIceCandidate||p.RTCIceCandidate&&"relayProtocol"in p.RTCIceCandidate.prototype||d(p,"icecandidate",p=>{if(p.candidate){let _=ev().parseCandidate(p.candidate.candidate);"relay"===_.type&&(p.candidate.relayProtocol=({0:"tls",1:"tcp",2:"udp"})[_.priority>>24])}return p})}function re(p,_){if(!p.RTCPeerConnection)return;"sctp"in p.RTCPeerConnection.prototype||Object.defineProperty(p.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});let Z=p.RTCPeerConnection.prototype.setRemoteDescription;p.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===_.browser&&_.version>=76){let{sdpSemantics:p}=this.getConfiguration();"plan-b"===p&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(p){if(!p||!p.sdp)return!1;let _=ev().splitSections(p.sdp);return _.shift(),_.some(p=>{let _=ev().parseMLine(p);return _&&"application"===_.kind&&-1!==_.protocol.indexOf("SCTP")})}(arguments[0])){let p,Z;let et=function(p){let _=p.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===_||_.length<2)return -1;let Z=parseInt(_[1],10);return Z!=Z?-1:Z}(arguments[0]),el=(Z=65536,"firefox"===_.browser&&(Z=_.version<57?-1===et?16384:2147483637:_.version<60?57===_.version?65535:65536:2147483637),Z),eu=function(p,Z){let et=65536;"firefox"===_.browser&&57===_.version&&(et=65535);let el=ev().matchPrefix(p.sdp,"a=max-message-size:");return el.length>0?et=parseInt(el[0].substring(19),10):"firefox"===_.browser&&-1!==Z&&(et=2147483637),et}(arguments[0],et);p=0===el&&0===eu?Number.POSITIVE_INFINITY:0===el||0===eu?Math.max(el,eu):Math.min(el,eu);let ed={};Object.defineProperty(ed,"maxMessageSize",{get:()=>p}),this._sctp=ed}return Z.apply(this,arguments)}}function ie(p){if(!p.RTCPeerConnection||!("createDataChannel"in p.RTCPeerConnection.prototype))return;function t(p,_){let Z=p.send;p.send=function(){let et=arguments[0],el=et.length||et.size||et.byteLength;if("open"===p.readyState&&_.sctp&&el>_.sctp.maxMessageSize)throw TypeError("Message too large (can send a maximum of "+_.sctp.maxMessageSize+" bytes)");return Z.apply(p,arguments)}}let _=p.RTCPeerConnection.prototype.createDataChannel;p.RTCPeerConnection.prototype.createDataChannel=function(){let p=_.apply(this,arguments);return t(p,this),p},d(p,"datachannel",p=>(t(p.channel,p.target),p))}function oe(p){if(!p.RTCPeerConnection||"connectionState"in p.RTCPeerConnection.prototype)return;let _=p.RTCPeerConnection.prototype;Object.defineProperty(_,"connectionState",{get(){return({completed:"connected",checking:"connecting"})[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(_,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(p){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),p&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=p)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(p=>{let Z=_[p];_[p]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=p=>{let _=p.target;if(_._lastConnectionState!==_.connectionState){_._lastConnectionState=_.connectionState;let Z=new Event("connectionstatechange",p);_.dispatchEvent(Z)}return p},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),Z.apply(this,arguments)}})}function se(p,_){if(!p.RTCPeerConnection||"chrome"===_.browser&&_.ver
1sion>=71||"safari"===_.browser&&_.version>=605)return;let Z=p.RTCPeerConnection.prototype.setRemoteDescription;p.RTCPeerConnection.prototype.setRemoteDescription=function(_){if(_&&_.sdp&&-1!==_.sdp.indexOf("\na=extmap-allow-mixed")){let Z=_.sdp.split("\n").filter(p=>"a=extmap-allow-mixed"!==p.trim()).join("\n");p.RTCSessionDescription&&_ instanceof p.RTCSessionDescription?arguments[0]=new p.RTCSessionDescription({type:_.type,sdp:Z}):_.sdp=Z}return Z.apply(this,arguments)}}function ae(p,_){if(!p.RTCPeerConnection||!p.RTCPeerConnection.prototype)return;let Z=p.RTCPeerConnection.prototype.addIceCandidate;Z&&0!==Z.length&&(p.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===_.browser&&_.version<78||"firefox"===_.browser&&_.version<68||"safari"===_.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():Z.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ce(p,_){if(!p.RTCPeerConnection||!p.RTCPeerConnection.prototype)return;let Z=p.RTCPeerConnection.prototype.setLocalDescription;Z&&0!==Z.length&&(p.RTCPeerConnection.prototype.setLocalDescription=function(){let p=arguments[0]||{};if("object"!=typeof p||p.type&&p.sdp)return Z.apply(this,arguments);if(!(p={type:p.type,sdp:p.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":p.type="offer";break;default:p.type="answer"}return p.sdp||"offer"!==p.type&&"answer"!==p.type?Z.apply(this,[p]):("offer"===p.type?this.createOffer:this.createAnswer).apply(this).then(p=>Z.apply(this,[p]))})}(function({window:p}={},_={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){let Z=function(p){let _={browser:null,version:null};if(void 0===p||!p.navigator||!p.navigator.userAgent)return _.browser="Not a browser.",_;let{navigator:Z}=p;if(Z.mozGetUserMedia)_.browser="firefox",_.version=l(Z.userAgent,/Firefox\/(\d+)\./,1);else if(Z.webkitGetUserMedia||!1===p.isSecureContext&&p.webkitRTCPeerConnection)_.browser="chrome",_.version=l(Z.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!p.RTCPeerConnection||!Z.userAgent.match(/AppleWebKit\/(\d+)\./))return _.browser="Not a supported browser.",_;_.browser="safari",_.version=l(Z.userAgent,/AppleWebKit\/(\d+)\./,1),_.supportsUnifiedPlan=p.RTCRtpTransceiver&&"currentDirection"in p.RTCRtpTransceiver.prototype}return _}(p),et={};switch(Z.browser){case"chrome":if(!el||!k||!_.shimChrome)return f("Chrome shim is not included in this adapter release.");if(null===Z.version)return f("Chrome shim can not determine version, not shimming.");f("adapter.js shimming chrome."),et.browserShim=el,ae(p,Z),ce(p),y(p,Z),C(p),k(p,Z),T(p),A(p,Z),I(p),R(p),O(p),N(p,Z),te(p),ne(p),oe(p),re(p,Z),ie(p),se(p,Z);break;case"firefox":if(!eu||!L||!_.shimFirefox)return f("Firefox shim is not included in this adapter release.");f("adapter.js shimming firefox."),et.browserShim=eu,ae(p,Z),ce(p),D(p,Z),L(p,Z),M(p),B(p),x(p),U(p),j(p),F(p),V(p),G(p),H(p),te(p),oe(p),re(p,Z),ie(p);break;case"safari":if(!ed||!_.shimSafari)return f("Safari shim is not included in this adapter release.");f("adapter.js shimming safari."),et.browserShim=ed,ae(p,Z),ce(p),J(p),X(p),$(p),q(p),W(p),Y(p),K(p),Q(p),te(p),ne(p),re(p,Z),ie(p),se(p,Z);break;default:f("Unsupported browser!")}})({window:"undefined"==typeof window?void 0:window}),n(8630);let ue=()=>"function"==typeof RTCPeerConnection;(eY=eZ||(eZ={}))[eY.TRACE=0]="TRACE",eY[eY.DEBUG=1]="DEBUG",eY[eY.INFO=2]="INFO",eY[eY.WARN=3]="WARN",eY[eY.ERROR=4]="ERROR",eY[eY.SILENT=5]="SILENT",(eQ=e0||(e0={})).TIME="Time",eQ.WEBRTC="WebRTC",eQ.EMITTER="Emitter",eQ.MEDIA="Media",eQ.SUBSCRIPTION="StageSubscription",eQ.PUBLICATION="StagePublication",eQ.CONNECTION="StageConnection",eQ.SOCKET="StageSocket",eQ.BROADCAST_STAGE_CLIENT="BroadcastStageClient",eQ.STAGE="Stage",eQ.REMOTE_PARTICIPANT="RemoteParticipant",eQ.LOCAL_PARTICIPANT="LocalParticipant",eQ.CONFIGURATION="Configuration",eQ.REMOTE_PLAYBACK="RemotePlaybackController",eQ.REMOTE_STAGE_STREAM="RemoteStageStream";let em=(new Uint8Array([158,80,78,165,238,90,79,2,148,159,176,51,163,118,141,162]),"no-rid"),eE="unknown";
1let BroadcastClientError=class BroadcastClientError extends Error{constructor({name:p,message:_,code:Z,details:et,cause:el,params:eu}){super(_),Error.captureStackTrace&&Error.captureStackTrace(this,BroadcastClientError),this.name=p||"BroadcastClientError",this.message=_,this.code=Z,this.details=et,this.cause=el,this.params=eu}};let eS={name:"BroadcastError",code:1e3,message:"Unable to broadcast"},e_={name:"CameraError",code:2e3,message:"Camera could not be captured"},ey={name:"InputError",code:3e3,message:"Input could not be attached"},eb={name:"AddDeviceError",code:4e3,message:"Device is missing"},eC={name:"AddDeviceNameExistsError",code:4001,message:"Name is already registered"},eT={name:"AddDeviceCompositionMissingError",code:4002,message:"VideoComposition is missing"},eI={name:"AddDeviceCompositionIndexMissingError",code:4003,message:'VideoComposition\'s "index" property is missing'},eR={name:"AddDeviceNameMissingError",code:4004,message:"Name property is missing"},eO={name:"AddDeviceUnsupported",code:4005,message:"Unsupported device"},eA={name:"AddDeviceConstraintsError",code:4006,message:"Constraints error"},ek={name:"RemoveDeviceNotFoundError",code:5e3,message:"Device not found"},ew={name:"RemoveImageNotFoundError",code:6e3,message:"Image not found"},eN={name:"UpdateVideoDeviceCompositionMissingError",code:7e3,message:"VideoComposition is missing"},eD={name:"UpdateVideoDeviceCompositionIndexMissingError",code:7001,message:'VideoComposition\'s "index" property is missing'},eP={name:"UpdateVideoDeviceCompositionNameMissingError",code:7002,message:"Video device with that name is not found"},eM={name:"ExchangePositionDeviceNotFoundError",code:8e3,message:"Device with that name is not found"},eL={name:"FailedToAddImageError",code:9e3,message:"Failed to add image"},ex={name:"PeerSetupError",code:1e4,message:"Unexpected return value from setup request"},eU={name:"PeerConnectionError",code:10001,message:"Peer connection has failed."},eB={name:"InvalidStreamKey",code:10003,message:"Invalid Stream Key."},ej={name:"BroadcastConfigurationError",code:11e3,message:"Error when configuring broadcast client"},eV={name:"StreamConfigurationError",code:12e3,message:"Error when configuring stream"},eF={name:"IngestEndpointTypeError",code:13e3,message:"Ingest endpoint must be a string"},eG={name:"IngestEndpointUrlError",code:13001,message:"Ingest endpoint must be a valid https or rtmps URL"},eH={name:"LogLevelTypeError",code:14e3,message:"Log Level must be a valid integer between [0..5]"},eW={name:"LoggerTypeError",code:15e3,message:"Logger must be an object"},eq={name:"ClientInvalidError",code:16e3,message:"Client is no longer valid, possibly due to delete() invocation."},e$={name:"NetworkReconnectConfigurationError",code:17e3,message:"Error when configuring network reconnect"},eK={name:"NetworkReconnectConfigurationInvalidTimeoutError",code:17001,message:"Network reconnect timeout value must be a number between [10000, 300000]"},ez={name:"StreamKeyInvalidCharError",code:18e3,message:"Streamkey must contain only [A-Za-z0-9_-] characters"},eJ={name:"StageTokenTypeError",code:19e3,message:"Stage token must be a string"},eX={name:"StageWhipUrlOverrideError",code:19001,message:"Stage WHIP override URL must be a string starting with http"};var eY,eQ,eZ,e0,e1,e2,e3,e4,e5,e9,e6,e8,e7,rt=function(p,_,Z,et){if("a"===Z&&!et)throw TypeError("Private accessor was defined without a getter");if("function"==typeof _?p!==_||!et:!_.has(p))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Z?et:"a"===Z?et.call(p):et?et.value:_.get(p)},it=function(p,_,Z,et,el){if("m"===et)throw TypeError("Private method is not writable");if("a"===et&&!el)throw TypeError("Private accessor was defined without a setter");if("function"==typeof _?p!==_||!el:!_.has(p))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===et?el.call(p,Z):el?el.value=Z:_.set(p,Z),Z};let tt=eZ.ERROR,ti={maxResolution:{width:852,height:480},maxFramerate:30,maxBitrate:1500},tl={maxResolution:{width:480,height:852},maxFramerate:30,maxBitrate:1500},tu={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:3500},td={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:3500},th={maxResolution:{width:1920,height:1080},maxFramerate:30,maxBitrate:8500},tp={maxResolution:{width:1080,height:1920},maxFramerate:30,maxBitrate:8500},tf={reconnect:!1,timeout:12e4};function gt(p){var _,Z;if("string"!=typeof p&&void 0!==p)throw new BroadcastClientError(eF);if(p){if(p.startsWith("https"))return p;{let et=/(?<protocol>(rtmps|https):\/\/)?(?<id>.+)\.(?<environment>(?=\S*['-])([a-zA-Z'-]+))\.live-video\.net.*/.exec(p);if("rtmps"===(null===(_=null==et?void 0:et.groups)||void 0===_?void 0:_.protocol)&&console.warn("rtmps
1server url detected; please pass in the ingest endpoint (no rtmps:// protocol) instead"),null===(Z=null==et?void 0:et.groups)||void 0===Z?void 0:Z.id)return`https://${et.groups.id}.webrtc.live-video.net:4443`;throw new BroadcastClientError(eG)}}return""}let Config=class Config{constructor(p,_,Z=ti,et,el=tf){this.LOG_LEVEL=eZ,this.BASIC_LANDSCAPE=ti,this.BASIC_PORTRAIT=tl,this.BASIC_FULL_HD_LANDSCAPE=tu,this.BASIC_FULL_HD_PORTRAIT=td,this.STANDARD_LANDSCAPE=th,this.STANDARD_PORTRAIT=tp,e1.set(this,void 0),e2.set(this,void 0),e3.set(this,ti),e4.set(this,void 0),e5.set(this,tf),e9.set(this,p=>{if(!p)throw new BroadcastClientError(Object.assign(Object.assign({},eV),{details:"missing stream configuration"}));if(!(p.maxBitrate<=8500&&p.maxBitrate>=200))throw new BroadcastClientError(Object.assign(Object.assign({},eV),{details:"maxBitrate must be between 200 and 8500"}));if(!(p.maxFramerate<=60&&p.maxFramerate>=10))throw new BroadcastClientError(Object.assign(Object.assign({},eV),{details:"maxFramerate must be between 10 and 60"}));let _=p.maxResolution.width,Z=p.maxResolution.height;if(_>1920||Z>1920||_<160||Z<160||1920===_&&Z>1080||1920===Z&&_>1080)throw new BroadcastClientError(Object.assign(Object.assign({},eV),{details:"maxResolution values must be between 1080x1920 or 1920x1080"}))}),e6.set(this,p=>{if(!p)return;let _=Number(p),Z=Number.isInteger(_),et=_>=eZ.TRACE,el=_<=eZ.SILENT;if(!Z||!et||!el)throw new BroadcastClientError(eH)}),e8.set(this,p=>{if(p&&"object"!=typeof p)throw new BroadcastClientError(eW)}),e7.set(this,p=>{if(!p)return;if("object"!=typeof p||"boolean"!=typeof p.reconnect)throw new BroadcastClientError(e$);let{timeout:_}=p;if(void 0!==_&&(Number.isNaN(_)||"number"!=typeof _||_<1e4||_>3e5))throw new BroadcastClientError(eK)}),rt(this,e8,"f").call(this,et),rt(this,e6,"f").call(this,_),rt(this,e9,"f").call(this,Z),it(this,e1,p,"f"),it(this,e2,_,"f"),it(this,e3,Z,"f"),it(this,e4,et,"f"),it(this,e5,el,"f")}get ingestEndpoint(){return rt(this,e1,"f")}set ingestEndpoint(p){it(this,e1,gt(p),"f")}get streamConfig(){return rt(this,e3,"f")}set streamConfig(p){rt(this,e9,"f").call(this,p),it(this,e3,p,"f")}get logLevel(){return rt(this,e2,"f")}set logLevel(p){rt(this,e6,"f").call(this,p),it(this,e2,p,"f")}get logger(){return rt(this,e4,"f")}set logger(p){rt(this,e8,"f").call(this,p),it(this,e4,p,"f")}get networkReconnectConfig(){return rt(this,e5,"f")}set networkReconnectConfig(p){rt(this,e7,"f").call(this,p),it(this,e5,p,"f")}};e1=new WeakMap,e2=new WeakMap,e3=new WeakMap,e4=new WeakMap,e5=new WeakMap,e9=new WeakMap,e6=new WeakMap,e8=new WeakMap,e7=new WeakMap;var tg,tv=n(228),tm=n(8954);(tN=tg||(tg={})).PUBLISHED_VIDEO_STATS="ivs_broadcast_webrtc_published_video_stats",tN.PUBLISHED_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_published_video_stats_window",tN.PUBLISHED_AUDIO_STATS="ivs_broadcast_webrtc_published_audio_stats",tN.PUBLISHED_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_published_audio_stats_window",tN.SUBSCRIBED_VIDEO_STATS="ivs_broadcast_webrtc_subscribed_video_stats",tN.SUBSCRIBED_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_sbcrbd_video_stats_window",tN.SUBSCRIBED_AUDIO_STATS="ivs_broadcast_webrtc_subscribed_audio_stats",tN.SUBSCRIBED_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_sbcrbd_audio_stats_window",tN.PUBLISH="ivs_broadcast_multihost_publish",tN.UNPUBLISH="ivs_broadcast_multihost_unpublish",tN.SUBSCRIBE="ivs_broadcast_multihost_subscribe",tN.UNSUBSCRIBE="ivs_broadcast_multihost_unsubscribe",tN.PUBLISH_STARTED="ivs_broadcast_multihost_publish_started",tN.PUBLISH_FAILED="ivs_broadcast_multihost_publish_failed",tN.PUBLISH_ENDED="ivs_broadcast_multihost_publish_ended",tN.STATE_UPDATED="ivs_broadcast_multihost_event_state_updated",tN.SUBSCRIBE_STARTED="ivs_broadcast_multihost_subscribe_started",tN.SUBSCRIBE_FAILED="ivs_broadcast_multihost_subscribe_failed",tN.SUBSCRIBE_ENDED="ivs_broadcast_multihost_subscribe_ended",tN.FIRST_FRAME="ivs_broadcast_multihost_first_frame",tN.JOIN="ivs_broadcast_multihost_join",tN.JOIN_ATTEMPT="ivs_broadcast_multihost_event_connect_attempt",tN.JOIN_ATTEMPT_FAILED="ivs_broadcast_multihost_event_connect_failed",tN.JOIN_ENDED="ivs_broadcast_multihost_join_ended",tN.LEAVE="ivs_broadcast_multihost_leave",tN.REASSIGNMENT_REQUEST="ivs_broadcast_multihost_reassignment_request",tN.SERVER_REQUEST="ivs_broadcast_multihost_server_request",tN.SERVER_RESPONSE="ivs_broadcast_multihost_server_response",tN.TRACE="ivs_broadcast_stage_trace",tN.ERROR="ivs_broadcast_error",tN.MINUTE="ivs_broadcast_multihost_minute",tN.CONNECTION_STATE="ivs_broadcast_webrtc_connection_state",tN.ICE_GATHERING_STATE="ivs_broadcast_webrtc_gathering_state",tN.EDP_CONNECTED="ivs_broadcast_multihost_event_connected",tN.EDP_DISCONNECTED="ivs_broadcast_multihost_event_disconnected",tN.EDP_PONG="ivs_broadcast_multihost_edp_rtt",tN.SIMULCAST_LAYER_INFO="ivs_broadcast_simulcast_layer_info",tN.MULTIHOST_CONFIGURATION="ivs_broadcast_multihost_configuration",tN.MULTIHOST_SUBSCRIBE_CONFIGURATION="ivs_broadcast_multihost_subscribe_configuration",tN.PLAYBACK_LAYER_REQUEST="ivs_broadcast_multihost_playback_layer_request",tN.PLAYBACK_LAYER_STATE="ivs_broadcast_multihost_playback_layer_state",tN.SELECTED_PAIR_CHANGE="ivs_broadcast_webrtc_selected_pair_change",tN.ANALYTICS_HEALTH_REPORT="ivs_broadcast_analytics_health_report",tN.DEVCONF_ERROR="ivs_devconf_error",tN.DEVCONF_OPS_METRICS="ivs_devconf_ops_metrics",tN.DEVCONF_TRACE="ivs_devconf_trace",tN.DEVCONF_VALUE="ivs_devconf_value",tN.DEVCONF_ROLLOUT_ASSIGNMENT="ivs_devconf_rollout_assignment",tN.TOKEN_EXCHANGE="ivs_broadcast_multihost_token_exchange",tN.TIME_TO_MEDIA="ivs_broadcast_multihost_time_to_media";let StageAnalyticsEvent=class StageAnalyticsEvent{constructor(p,_,Z,et,el){this.event=p,this.properties={client_time:(new Date).toISOString(),customer_id:_.customerId,device_softw
1are:window.navigator.userAgent,multihost_id:_.stageARN,participant_id:_.participantID,participant_user_id:_.userID,platform:"web",sdk_version:"1.38.0",stage_arn:_.stageARN,trace_id:Z.value},_.attrGsRole&&(this.properties.token_attribute_0=_.attrGsRole),_.attrGsSessionId&&(this.properties.token_attribute_1=_.attrGsSessionId),this.critical=et,this.priority=el}};let StageErrorEvent=class StageErrorEvent extends StageAnalyticsEvent{constructor(p){super(tg.ERROR,p.token,p.traceId,!0),Object.assign(this.properties,{code:p.code,tag:p.tag,description:p.message,remote_participant_id:p.remoteParticipantId,request_uuid:p.requestUUID,is_nominal:p.nominal,is_fatal:p.fatal,details:p.details,location:p.location,event_count:p.count})}};function St(p){let _=window.IVS_CLIENT_OVERRIDES;return"object"==typeof _?_[p]:"logLevel"===p?window.STAGES_LOG_LEVEL:"appLabel"===p?window.IVS_APP_LABEL:"whipUrl"===p?window.IVS_DATA_PLANE_ENDPOINT:void 0}function _t(p){let _=St(p);if("string"==typeof _)return _}function yt(p){let _=St(p);if("boolean"==typeof _)return _}function bt(p){let _=St(p);if("number"==typeof _)return _;if("string"==typeof _){let p=parseFloat(_);if(!isNaN(p))return p}}function Ct(){let p=St("logLevel");if("number"==typeof p&&Object.values(eZ).includes(p))return p}function Tt(){let p=_t("appLabel");if(void 0!==p)return p.substring(0,64)}function It(){return _t("whipUrl")}function Rt(){return _t("eventsUrl")}function Ot(){return yt("disableXdp")}function At(){return _t("node")||_t("dataPlaneEndpoint")}function kt(){return _t("cluster")}function Nt(){return yt("disableReassignments")}function Dt(){return yt("multiCodecAnswer")}function Pt(){return yt("disableAudioRtcpRsize")}function Mt(){let p=_t("subscribeForceIceProtocol");if("tcp"===p||"udp"===p)return p}function Lt(){return yt("disableXdpPublish")}function xt(){return yt("disableXdpSubscribe")}function Ut(){return yt("disableTokenValidation")}function jt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,p=>{let _=16*Math.random()|0;return("x"===p?_:3&_|8).toString(16)})}function Ft(p,_=p=>{}){(()=>{var Z,et,el,eu;Z=this,et=void 0,el=void 0,eu=function*(){try{yield p()}catch(p){_(p)}},new(el||(el=Promise))(function(p,_){function s(p){try{c(eu.next(p))}catch(p){_(p)}}function a(p){try{c(eu.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof el?Z:new el(function(p){p(Z)})).then(s,a)}c((eu=eu.apply(Z,et||[])).next())})})()}let Vt=p=>{throw Error(`Unexpected value: ${p}`)};var Gt=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},Ht=function(p,_){var Z={};for(var et in p)Object.prototype.hasOwnProperty.call(p,et)&&0>_.indexOf(et)&&(Z[et]=p[et]);if(null!=p&&"function"==typeof Object.getOwnPropertySymbols){var el=0;for(et=Object.getOwnPropertySymbols(p);el<et.length;el++)0>_.indexOf(et[el])&&Object.prototype.propertyIsEnumerable.call(p,et[el])&&(Z[et[el]]=p[et[el]])}return Z};function qt(p,_,Z={},et=""){return Gt(this,void 0,void 0,function*(){let el=new XMLHttpRequest;return el.open(p,_,!0),Z&&Object.keys(Z).forEach(p=>{Z.hasOwnProperty(p)&&el.setRequestHeader(p,Z[p])}),new Promise((Z,eu)=>{el.onreadystatechange=()=>{4===el.readyState&&(el.status>=200&&el.status<300?Z(el.responseText):eu(Error(`Ingest ${p} ${_} responded ${el.status} 2${el.responseText}`)))},el.send(et)})})}function Wt(p){let _=Date.now();for(let Z of p)Z.properties.batch_time_millis=_;let Z=p.map(p=>{var{priority:_}=p;return Ht(p,["priority"])});return{headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:`data=${btoa(encodeURIComponent(JSON.stringify(Z)).replace(/%([0-9A-F]{2})/g,(p,_)=>String.fromCharCode(Number(`0x${_}`))))}`}}let EventSender=class EventSender{send(p,_=!1){return Gt(this,void 0,void 0,function*(){let{currentEndpoint:Z}=nR,{headers:et,body:el}=Wt(p),eu="eventSenderResult",ed=p.length;if(_){let p=navigator.sendBeacon(Z,el);nR.trackEvent({type:eu,success:p,count:ed})}else Ft(()=>Gt(this,void 0,void 0,function*(){yield qt("POST",Z,et,el),nR.trackEvent({type:eu,success:!0,count:ed})}),()=>{nR.trackEvent({type:eu,success:!1,count:ed})})})}};let tE={CONNECTION_STATE_CHANGE:"connectionStateChange",ERROR:"clientError",ACTIVE_STATE_CHANGE:"activeStateChange"},tS="connectionStateChange",t_="sdpNegotiated",ty="clientError",tb="seiMessageReceived",tC="transformError";function Zt(){}
2function en(p){switch(p){case"new":return tz.NEW;case"closed":return tz.CLOSED;case"disconnected":return tz.DISCONNECTED;case"failed":return tz.FAILED;case"idle":return tz.IDLE;case"checking":case"connecting":return tz.CONNECTING;case"completed":case"connected":return tz.CONNECTED;default:throw Error(`unknown connecion state: ${p}`)}}function tn(p,_,Z){let et=document.createElement(_),i=()=>{et&&(et.removeEventListener("loadeddata",o),et.removeEventListener("error",i),et.srcObject=null,et.src="",et=null)},o=()=>{i(),Z(_)};return et.addEventListener("loadeddata",o),et.addEventListener("error",i),et.srcObject=p,i}function nn(p){throw Error(`Unknown case kind: ${p}`)}(tD=tz||(tz={})).CLOSED="closed",tD.COMPLETED="completed",tD.CONNECTED="connected",tD.CONNECTING="connecting",tD.DISCONNECTED="disconnected",tD.FAILED="failed",tD.IDLE="idle",tD.NEW="new",tD.NONE="none";let TypedEmitter=class TypedEmitter{constructor(){this.emitter=new tv}hasListenersFor(p){return this.emitter.listenerCount(p)>0}on(p,_,Z){_.call=function(Z,...et){try{_.apply(Z,et)}catch(el){let Z=`Error in callback for ${p}`,et=_.name;return et&&(Z+=` for function ${et}`),void console.error(`${Z} 3`,el)}},this.emitter.on(p,_,Z)}off(p,_,Z){this.emitter.off(p,_,Z)}emit(p,..._){this.emitter.emit(p,..._)}removeAllListeners(){this.emitter.removeAllListeners()}};let tT="https://broadcast.stats.live-video.net/";let AnalyticsHealthReport=class AnalyticsHealthReport{constructor({totalEvents:p,totalEventsLost:_,windowedEvents:Z,windowedEventsLost:et,currentEndpoint:el}){this.transformProperties=(p,_,Z,et,el)=>({total_events:p,total_events_lost:_,windowed_events:Z,windowed_events_lost:et,current_endpoint:null!=el?el:tT});let eu=this.transformProperties(p,_,Z,et,el);this.data={event:tg.ANALYTICS_HEALTH_REPORT,properties:Object.assign({},eu)}}};let tI={totalEvents:0,totalEventsSent:0,totalEventsLost:0,windowedEvents:0,windowedEventsSent:0,windowedEventsLost:0};(tJ||(tJ={})).ANALYTICS_EVENT="ANALYTICS_EVENT";let HealthReporter=class HealthReporter extends TypedEmitter{constructor(){super(),this.eventSenderMetrics=Object.assign({},tI),this.scheduleHealthReport=()=>{this.reportTimer=window.setTimeout(this.onHealthReportInterval,6e4)},this.onHealthReportInterval=()=>{let p=Object.assign({},this.eventSenderMetrics);if(0===this.eventSenderMetrics.windowedEvents?this.emptyWindows++:this.emptyWindows=0,this.emptyWindows>3)return window.clearTimeout(this.reportTimer),void(this.reportTimer=void 0);this.postHealthReport(p),this.eventSenderMetrics.windowedEvents=0,this.eventSenderMetrics.windowedEventsSent=0,this.eventSenderMetrics.windowedEventsLost=0,this.scheduleHealthReport()},this.emptyWindows=0}trackEventSendResult(p){let{count:_,success:Z}=p;this.eventSenderMetrics.totalEvents+=_,this.eventSenderMetrics.windowedEvents+=_,Z?(this.eventSenderMetrics.totalEventsSent+=_,this.eventSenderMetrics.windowedEventsSent+=_):(this.eventSenderMetrics.totalEventsLost+=_,this.eventSenderMetrics.windowedEventsLost+=_),this.isHealthReportScheduled()||this.scheduleHealthReport()}isHealthReportScheduled(){return"number"==typeof this.reportTimer}postHealthReport(p){let _=new AnalyticsHealthReport(p);this.emit(tJ.ANALYTICS_EVENT,_)}};(tP=tX||(tX={}))[tP.EXCELLENT=4]="EXCELLENT",tP[tP.GOOD=3]="GOOD",tP[tP.NORMAL=2]="NORMAL",tP[tP.POOR=1]="POOR",tP[tP.DOWN=0]="DOWN",(tY||(tY={})).NETWORK_QUALITY_CHANGE="networkQualityChange";let NetworkQualityMonitor=class NetworkQualityMonitor extends TypedEmitter{constructor(){super(),this.lastNetworkStatus={},this.networkAssessment={networkQuality:tX.NORMAL,reason:"no-data"},this.checkNetworkStatus=()=>{var p,_;let Z=null!==(p=null==navigator?void 0:navigator.connection)&&void 0!==p?p:{},et={downlink:Z.downlink,effectiveType:Z.effectiveType,rtt:Z.rtt,isOnline:null===(_=navigator.onLine)||void 0===_||_};if(!this.isChangedNetworkStatus(this.lastNetworkStatus,et))return;this.lastNetworkStatus=et;let el=this.networkAssessment,eu=function(p){let{rtt:_,downlink:Z,isOnline:et}=p;if(!et)return{networkQuality:tX.DOWN,reason:"offline"};if("number"!=typeof _||"number"!=typeof Z)return{networkQuality:tX.NORMAL,reason:"no-data"};let el=0;_>800?el+=2:_>300&&(el+=1),Z<2.5?el+=2:Z<5&&(el+=1);let eu="score";switch(el){case 4:return{networkQuality:tX.POOR,reason:eu};case 0:return{networkQuality:tX.EXCELLENT,reason:eu};default:return{networkQuality:el<=2?tX.GOOD:tX.NORMAL,reason:eu}}}(et);
3el.networkQuality!==eu.networkQuality&&this.emit(tY.NETWORK_QUALITY_CHANGE,el.networkQuality,eu.networkQuality),this.networkAssessment=eu},this.getNetworkQuality=()=>this.networkAssessment.networkQuality,this.setupWindowListeners(),this.checkNetworkStatus()}setupWindowListeners(){window.addEventListener("online",()=>{this.checkNetworkStatus()}),window.addEventListener("offline",()=>{this.checkNetworkStatus()}),window.navigator.connection&&window.navigator.connection.addEventListener("change",()=>{this.checkNetworkStatus()})}isChangedNetworkStatus(p,_){let{downlink:Z,effectiveType:et,rtt:el,isOnline:eu}=_;return p.effectiveType!==et||p.downlink!==Z||p.rtt!==el||p.isOnline!==eu}};(tM=tQ||(tQ={})).ANALYTICS_EVENT="ANALYTICS_EVENT",tM.REFRESH="REFRESH",(tL=tZ||(tZ={})).IDLE="idle",tL.ACTIVATING="activating",tL.ACTIVE="active",tL.REFRESHING="refreshing",tL.PAUSED="paused",tL.DESTROYED="destroyed",(tx=t0||(t0={})).INITIALIZE="initialize",tx.REFRESH="refresh",tx.ACTIVATE="activate",tx.PAUSE="pause",tx.DESTROY="destroy";let tR={[t0.INITIALIZE]:{from:[tZ.IDLE],to:tZ.ACTIVATING},[t0.REFRESH]:{from:[tZ.ACTIVATING,tZ.ACTIVE,tZ.PAUSED],to:tZ.REFRESHING},[t0.ACTIVATE]:{from:[tZ.ACTIVATING,tZ.REFRESHING,tZ.PAUSED],to:tZ.ACTIVE},[t0.PAUSE]:{from:[tZ.REFRESHING,tZ.ACTIVE],to:tZ.PAUSED},[t0.DESTROY]:{from:[tZ.ACTIVE,tZ.PAUSED],to:tZ.DESTROYED}};(tU=t1||(t1={})).STAGE_CONFIGURATION="stage_configuration",tU.STAGE_SUBSCRIBE_CONFIGURATION="stage_subscribe_configuration",tU.STAGE_LOCAL_STREAM_CONFIGURATION="stage_local_stream_configuration",tU.BROADCAST_CONFIGURATION="broadcast_configuration",(tB=t2||(t2={})).RT="real_time",tB.LL="low_latency";let CongestionTimeEvent=class CongestionTimeEvent{constructor(p,_){this.transformProperties=(p,_)=>({sum:p.sum,median:p.median(),min:p.min,max:p.max,p90:p.percentile(.9),event_count:p.data.length,period:_});let Z=this.transformProperties(p,_);this.data={event:t3.CONGESTION_TIME,properties:Z}}};let ConnectionEstablishedEvent=class ConnectionEstablishedEvent{constructor(p,_,Z){this.transformProperties=(p,_,Z)=>({duration:(p.getTime()-((null==_?void 0:_.getTime())||0))/1e3,ecn_negotiated:!1,ingest_session_id:Z});let et=this.transformProperties(p,_,Z);this.data={event:t3.CONNECTION_ESTABLISHED,properties:et}}};let ConnectionRTTEvent=class ConnectionRTTEvent{constructor(p,_){this.transformProperties=(p,_)=>({sum:p.sum,median:p.median(),min:p.min,max:p.max,p90:p.percentile(.9),event_count:p.data.length,period:_});let Z=this.transformProperties(p,_);this.data={event:t3.CONNECTION_RTT,properties:Z}}};let DevConfErrorEvent=class DevConfErrorEvent{constructor(p){this.transformProperties=()=>({}),this.data={event:tg.DEVCONF_ERROR,properties:p}}};let DevConfOpsMetricsEvent=class DevConfOpsMetricsEvent{constructor(p){this.transformProperties=()=>({}),this.data={event:tg.DEVCONF_OPS_METRICS,properties:p}}};let DevConfRolloutAssignmentEvent=class DevConfRolloutAssignmentEvent{constructor(p){this.transformProperties=()=>({}),this.data={event:tg.DEVCONF_ROLLOUT_ASSIGNMENT,properties:p}}};let DevConfTraceEvent=class DevConfTraceEvent{constructor(p){this.transformProperties=()=>({}),this.data={event:tg.DEVCONF_TRACE,properties:p}}};let DevConfValueEvent=class DevConfValueEvent{constructor(p){this.transformProperties=()=>({}),this.data={event:tg.DEVCONF_VALUE,properties:p}}};let ErrorEvent=class ErrorEvent{constructor(p){this.transformProperties=p=>{var _;return{is_fatal:null!==(_=p.isFatal)&&void 0!==_&&_,value:p.value,code:p.code,description:p.description}};let _=this.transformProperties(p);this.data={event:t3.ERROR,properties:_}}};let InputDeviceAttachedEvent=class InputDeviceAttachedEvent{constructor(p,_){this.transformProperties=(p,_)=>({type:p,input_device_id:_.deviceId,position:_.facingMode||"unknown"});let Z=this.transformProperties(p,_);this.data={event:t3.INPUT_DEVICE_ATTACHED,properties:Z}}};let InputDeviceDetachedEvent=class InputDeviceDetachedEvent{constructor(p,_){this.transformProperties=(p,_)=>({type:p,input_device_id:_.deviceId,position:_.facingMode||"unknown"});let Z=this.transformProperties(p,_);this.data={event:t3.INPUT_DEVICE_DETACHED,properties:Z}}};let MeasuredBitrateEvent=class MeasuredBitrateEvent{constructor(p,_){this.transformProperties=(p,_)=>({sum:p.sum,median:p.median(),min:p.min,max:p.max,p90:p.percentile(.9),event_count:p.data.length,period:_});let Z=this.transformProperties(p,_);this.data={event:t3.MEASURED_BITRATE,properties:Z}}};let MinuteBroadcastEvent=class MinuteBroadcastEvent{constructor(p,_){this.transformProperties=(p,_)=>({minutes_logged:Math.round((p.timestamp-_)/6e4)});let Z=this.transformProperties(p,_);this.data={event:t3.MINUTE_BROADCAST,properties:Z}}};let RecommendedBitrateEvent=class RecommendedBitrateEvent{constructor(p,_){this.transformProperties=(p,_)=>({sum:p.sum,median:p.median(),min:p.min,max:p.max,p90:p.percentile(.9),event_count:p.data.length,period:_});let Z=this.transformProperties(p,_);this.data={event:t3.RECOMMENDED_BITRATE,properties:Z}}};let SessionAudioEncoderConfiguredEvent=class SessionAudioEncoderConfiguredEvent{constructor(p){this.transformProperties=p=>
3({codec:p.mimeType,bitrate:0,sample_rate:p.clockRate,channel_count:p.channels});let _=this.transformProperties(p);this.data={event:t3.SESSION_AUDIO_ENCODER_CONFIGURED,properties:_}}};let SessionAudioPropertiesEvent=class SessionAudioPropertiesEvent{constructor(p){this.transformProperties=p=>({codec:"audio",bitrate:32e3,sample_rate:p.sampleRate,channel_count:p.channelCount});let _=this.transformProperties(p);this.data={event:t3.SESSION_AUDIO_PROPERTIES,properties:_}}};let SessionVideoEncoderConfiguredEvent=class SessionVideoEncoderConfiguredEvent{constructor(p,_,Z){this.transformProperties=(p,_,Z)=>({codec:Z.mimeType,codec_profile:_.profile,codec_level:_.level,rate_mode:"vbr",initial_bitrate:0,keyframe_interval:2,width:p.width,height:p.height,bframe_count:0,target_fps:p.frameRate});let et=this.transformProperties(p,_,Z);this.data={event:t3.SESSION_VIDEO_ENCODER_CONFIGURED,properties:et}}};let SessionVideoPropertiesEvent=class SessionVideoPropertiesEvent{constructor(p){this.transformProperties=p=>({codec:"video",initial_bitrate:32e3,min_bitrate:0,max_bitrate:0,keyframe_interval:2,width:p.width,height:p.height,auto_bitrate_enabled:!0,bframes_enabled:!1,target_fps:p.frameRate});let _=this.transformProperties(p);this.data={event:t3.SESSION_VIDEO_PROPERTIES,properties:_}}};let SourceAudioLatencyEvent=class SourceAudioLatencyEvent{constructor(p,_){this.transformProperties=(p,_)=>({sum:p.sum,median:p.median(),min:p.min,max:p.max,p90:p.percentile(.9),event_count:p.data.length,period:_});let Z=this.transformProperties(p,_);this.data={event:t3.SOURCE_AUDIO_LATENCY,properties:Z}}};let SourceVideoLatencyEvent=class SourceVideoLatencyEvent{constructor(p,_){this.transformProperties=(p,_)=>({sum:p.sum,median:p.median(),min:p.min,max:p.max,p90:p.percentile(.9),event_count:p.data.length,period:_});let Z=this.transformProperties(p,_);this.data={event:t3.SOURCE_VIDEO_LATENCY,properties:Z}}};let StartBroadcastEvent=class StartBroadcastEvent{constructor(p,_){this.transformProperties=({protocol:p,hostname:_,port:Z},et)=>({protocol:p,endpoint_host:_,endpoint_port:Z,reason:et});let Z=this.transformProperties(p,_);this.data={event:t3.START_BROADCAST,properties:Z}}};let StopBroadcastEvent=class StopBroadcastEvent{constructor(p){this.transformProperties=({protocol:p,hostname:_,port:Z})=>({protocol:p,endpoint_host:_,endpoint_port:Z});let _=this.transformProperties(p);this.data={event:t3.STOP_BROADCAST,properties:_}}};let WebRTCAudioStatsEvent=class WebRTCAudioStatsEvent{constructor(p){this.transformProperties=p=>({bytes_sent:p.bytesSent,header_bytes_sent:p.headerBytesSent,nack_count:p.nackCount,packets_sent:p.packetsSent,retransmitted_bytes_sent:p.retransmittedBytesSent,retransmitted_packets_sent:p.retransmittedPacketsSent});let _=this.transformProperties(p);this.data={event:t3.WEBRTC_AUDIO_STATS,properties:_}}};let WebRTCVideoStatsEvent=class WebRTCVideoStatsEvent{constructor(p){this.transformProperties=p=>({bytes_sent:p.bytesSent,fir_count:p.firCount,frames_encoded:p.framesEncoded,frames_sent:p.framesSent,header_bytes_sent:p.headerBytesSent,huge_frames_sent:p.hugeFramesSent,key_frames_encoded:p.keyFramesEncoded,nack_count:p.nackCount,packets_sent:p.packetsSent,pli_count:p.pliCount,quality_limitation_reason:p.qualityLimitationReason,quality_limitation_resolution_changes:p.qualityLimitationResolutionChanges,retransmitted_bytes_sent:p.retransmittedBytesSent,retransmitted_packets_sent:p.retransmittedPacketsSent,total_encode_time:p.totalEncodeTime,total_encoded_bytes_target:p.totalEncodedBytesTarget,total_packet_send_delay:p.totalPacketSendDelay});let _=this.transformProperties(p);this.data={event:t3.WEBRTC_VIDEO_STATS,properties:_}}};(tj=t3||(t3={})).START_BROADCAST="ivs_broadcast_start_broadcast",tj.STOP_BROADCAST="ivs_broadcast_stop_broadcast",tj.MINUTE_BROADCAST="ivs_broadcast_minute_broadcast",tj.WEBRTC_AUDIO_STATS="ivs_broadcast_webrtc_audio_stats",tj.WEBRTC_VIDEO_STATS="ivs_broadcast_webrtc_video_stats",tj.WEBRTC_AUDIO_STATS_WINDOW="ivs_broadcast_webrtc_audio_stats_window",tj.WEBRTC_VIDEO_STATS_WINDOW="ivs_broadcast_webrtc_video_stats_window",tj.CONNECTION_ESTABLISHED="ivs_broadcast_connection_established",tj.SESSION_VIDEO_PROPERTIES="ivs_broadcast_session_video_properties",tj.SESSION_AUDIO_PROPERTIES="ivs_broadcast_session_audio_properties",tj.SESSION_VIDEO_ENCODER_CONFIGURED="ivs_broadcast_session_video_encoder_configured",tj.SESSION_AUDIO_ENCODER_CONFIGURED="ivs_broadcast_session_audio_encoder_configured",tj.SOURCE_AUDIO_LATENCY="ivs_broadcast_source_audio_latency",tj.SOURCE_VIDEO_LATENCY="ivs_broadcast_source_video_latency",tj.INPUT_DEVICE_ATTACHED="ivs_broadcast_input_device_attached",tj.INPUT_DEVICE_DETACHED="ivs_broadcast_input_device_detached",tj.CONGESTION_TIME="ivs_broadcast_congestion_time",tj.BUFFER_DURATION="ivs_broadcast_buffer_duration",tj.MEASURED_BITRATE="ivs_broadcast_measured_bitrate",tj.RECOMMENDED_BITRATE="ivs_broadcast_recommended_bitrate",tj.CONNECTION_RTT="ivs_broadcast_connection_rtt",tj.ERROR="ivs_broadcast_error",(tV=t4||(t4={})).USER_INITIATED="user-initiated",tV.NETWORK_DISCONNECT="network-disconnect",(tF=t5||(t5={})).LOWEST_QUALITY="lowest_quality",tF.HIGHEST_QUALITY="highest_quality",(tG=t9||(t9={})).HI="hi",tG.MID="mid",tG.LOW="low",(tH=t6||(t6={})).PORTRAIT="portrait",tH.LANDSCAPE="landscape",(tW=t8||(t8={})).VP8="VP8",tW.H264="H264",(tq=t7||(t7={})).BASELINE_31_CONSTRAINED="42e01f",tq.BASELINE_31="42001f",tq.MAIN_31="4d001f",tq.HIGH_31="64001f",(t$=ri||(ri={})).VIDEO="video",t$.AUDIO="audio";let tO={minBitrate:{type:"number",required:!1},maxBitrate:{type:"number",required:!1},stereo:{type:"boolean",required:!1},maxAudioBitrateKbps:{type:"number",required:!1},maxVideoBitrateKbps:{type:"number",required:!1},maxFramerate:{type:"number",required:!1},simulcast:{type:"object",required:!1,config:{schema:{enabled:{type:"boolean",required:!0},layers:{type:"array",required:!1,items:{type:"object",required:!1,config:{schema:{maxBitrateKbps:{type:"number",required:!0},maxFramerate:{type:"number",required:!0},width:{type:"number",required:!0},height:{type:"number",required:!0}}}}}}}},inBandMessaging:{type:"object",required:!1,config:{schema:{enabled:{type:"boolean",required:!1}}}},codecs:{type:"array",required:!1,items:{type:"object",required:!1,config:{schema:{codec:{type:"string",required:!0},priority:{type:"number",required:!1},profileLevels:{type:"array",required:!1,items:{type:"object",required:!1,config:{schema:{profileLevel:{type:"string",required:!0},priority:{type:"number",required:!1}}}}}}}}}};(tK=rs||(rs={})).DEFAULT="default",tK.LOW="low",tK.MEDIUM="medium",tK.HIGH="high";let tA={jitterBuffer:{type:"object",required:!1,config:{schema:{minDelayWhenPublishing:{type:"number",required:!1},minDelayWhenSubscribeOnly:{type:"number",required:!1}}}},inBandMessaging:{type:"object",required:!1,config:{schema:{enabled:{type:"boolean",required:!1}}}},simulcast:{type:"object",required:!1,config:{schema:{initialLayerPreference:{type:"string",required:!1},layerPollingEnabled:{type:"boolean",required:!1},layerPollingIntervalMs:{type:"number",required:!1}}}}},tk={connections:{type:"object",required:!1,config:{schema:{socket:{type:"object",required:!1,config:{schema:{pingIntervalMs:{type:"number",required:!1},pongTimeoutMs:{type:"number",required:!1},connectTimeoutMs:{type:"number",required:!1},maxConnectRetries:{type:"number",required:!1},maxConnectRetryDelayMs:{type:"number",required:!1},fallbackRequestRetryDelayMs:{type:"number",required:!1},minRequestRetryDelayMs:{type:"number",required:!1},maxRequestRetryDelayMs:{type:"number",required:!1},openWithoutState:{type:"boolean",required:!1}}}}}}},signaling:{type:"object",required:!1,config:{schema:{connectionImplV2:{type:"boolean",required:!1}
3,forceNode:{type:"string",required:!1},forceCluster:{type:"string",required:!1},eventsUrl:{type:"string",required:!1},disableReassignments:{type:"boolean",required:!1},disableTokenReuseMessage:{type:"boolean",required:!1},whip:{type:"object",required:!1,config:{schema:{url:{type:"string",required:!1}}}},sdp:{type:"object",required:!1,config:{schema:{xdp:{type:"object",required:!1,config:{schema:{enabled:{type:"boolean",required:!1},disablePublish:{type:"boolean",required:!1},disableSubscribe:{type:"boolean",required:!1},exchangeTimeoutMs:{type:"number",required:!1}}}},multiCodecAnswer:{type:"boolean",required:!1}}}},ice:{type:"object",required:!1,config:{schema:{forceProtocol:{type:"string",required:!1}}}},state:{type:"object",required:!1,config:{schema:{setStateTimeoutMs:{type:"number",required:!1}}}}}}},media:{type:"object",required:!1,config:{schema:{disableRemoteAudioMuteEnforcement:{type:"boolean",required:!1}}}},logging:{type:"object",required:!1,config:{schema:{level:{type:"number",required:!1},categories:{type:"object",required:!1,config:{schema:{}}},levels:{type:"object",required:!1,config:{schema:{debug:{type:"boolean",required:!1},log:{type:"boolean",required:!1},info:{type:"boolean",required:!1},warn:{type:"boolean",required:!1},error:{type:"boolean",required:!1}}}}}}},analytics:{type:"object",required:!1,config:{schema:{appLabel:{type:"string",required:!1},postUrl:{type:"string",required:!1},highPriorityBatchMs:{type:"number",required:!1},lowPriorityBatchMs:{type:"number",required:!1},maxBatchSize:{type:"number",required:!1}}}},auth:{type:"object",required:!1,config:{schema:{disableValidation:{type:"boolean",required:!1}}}}};var tw=n(2543);let kn=p=>{console.warn(`[IVS Stages] ${p}`)};var tN,tD,tP,tM,tL,tx,tU,tB,tj,tV,tF,tG,tH,tW,tq,t$,tK,tz,tJ,tX,tY,tQ,tZ,t0,t1,t2,t3,t4,t5,t9,t6,t8,t7,ri,rs,rc,rl,ru,rd=n(6880);(nw=rc||(rc={})).Mobile="mobile",nw.Tablet="tablet",nw.Desktop="desktop",nw.Tv="tv",(nN=rl||(rl={})).IOS="iOS",nN.MacOS="macOS",nN.Windows="Windows",nN.Android="Android",(nD=ru||(ru={})).Safari="Safari",nD.Firefox="Firefox",nD.Chrome="Chrome",nD.IE="Internet Explorer",nD.Edge="Microsoft Edge";let rh=function(p){var _,Z,et,el;let eu=xn(p);return{platform:{isMobile:Un(rc.Mobile,eu),isTablet:Un(rc.Tablet,eu),isDesktop:Un(rc.Desktop,eu),isTv:Un(rc.Tv,eu)},os:{name:(_=eu,()=>(_||(_=xn()),_&&_.getOSName()||"")),version:(Z=eu,()=>(Z||(Z=xn()),Z&&Z.getOSVersion()||"")),isIOS:Fn(rl.IOS,eu),isMacOS:Fn(rl.MacOS,eu),isWindows:Fn(rl.Windows,eu),isAndroid:Fn(rl.Android,eu)},browser:{name:(et=eu,()=>(et||(et=xn()),et&&et.getBrowserName()||"")),version:(el=eu,()=>(el||(el=xn()),el&&el.getBrowserVersion()||"")),isSafari:Hn(ru.Safari,eu),isFirefox:Hn(ru.Firefox,eu),isChrome:Hn(ru.Chrome,eu),isIE:Hn(ru.IE,eu),isEdge:Hn(ru.Edge,eu)}}}(window.navigator.userAgent);function xn(p){try{return rd.getParser(p||window.navigator.userAgent)}catch(p){}}function Un(p,_){return()=>(_||(_=xn()),!(!_||_.getPlatformType(!0)!==p.toLowerCase()))}function Fn(p,_){return()=>(_||(_=xn()),!(!_||_.getOSName(!0)!==p.toLowerCase()))}function Hn(p,_){return()=>(_||(_=xn()),!(!_||_.getBrowserName().toLowerCase()!==p.toLowerCase()))}function qn(p){let{config:_}=p;return[{maxBitrate:_.maxBitrateBps}]}function Wn(p){return 1e3*p}let $n=(p,_)=>"object"==typeof p&&"object"==typeof _&&(0,tw.isEqual)(p,_),Kn=p=>zn(p),zn=p=>(0,tw.cloneDeep)(p),Jn=p=>{switch(p){case t5.HIGHEST_QUALITY:return"highest";case t5.LOWEST_QUALITY:default:return"lowest"}},Yn=p=>Object.freeze(p),rp=Object.freeze({DEFAULT_1080:Yn({maxBitrateKbps:2500,maxFramerate:30,width:1920,height:1080}),INACTIVE:Yn({maxBitrateKbps:0,maxFramerate:0,width:0,height:0})}),rf=Object.freeze({DEFAULT_720:Yn({maxBitrateKbps:2500,maxFramerate:30,width:1280,height:720}),DEFAULT_540:Yn({maxBitrateKbps:1400,maxFramerate:15,width:960,height:540}),DEFAULT_480:Yn({maxBitrateKbps:1100,maxFramerate:15,width:854,height:480}),DEFAULT_360:Yn({maxBitrateKbps:600,maxFramerate:15,width:640,height:360}),DEFAULT_270:Yn({maxBitrateKbps:350,maxFramerate:15,width:480,height:270}),DEFAULT_180:Yn({maxBitrateKbps:150,maxFramerate:15,width:320,height:180}),DEFAULT_160:Yn({maxBitrateKbps:120,maxFramerate:15,width:284,height:160})}),rg=Object.freeze({HI:Yn(Object.assign({},rf.DEFAULT_720)),MID:Yn(Object.assign(Object.assign({},rf.DEFAULT_360),{maxBitrateKbps:700,maxFramerate:20})),LOW:Yn(Object.assign(Object.assign({},rf.DEFAULT_180),{maxBitrateKbps:200,maxFramerate:15}))}),er=p=>({rid:p,active:!1,scaleFactor:tr(p),maxBitrateBps:Wn(rp.INACTIVE.maxBitrateKbps),maxFramerate:rp.INACTIVE.maxFramerate,width:rp.INACTIVE.width,height:rp.INACTIVE.height}),tr=p=>{switch(p){case t9.HI:return 1;case t9.MID:return 2;case t9.LOW:return 4;default:return 1}},nr=p=>Object.freeze(p),rv=Object.freeze({VP8:nr({codec:t8.VP8,priority:0}),H264:nr({codec:t8.H264,priority:0,profileLevels:[]}),H264_CB:nr({codec:t8.H264,priority:0,profileLevels:[{profileLevel:t7.BASELINE_31_CONSTRAINED,priority:0},{profileLevel:t7.BASELINE_31,priority:1},{profileLevel:t7.MAIN_31,priority:2},{profileLevel:t7.HIGH_31,priority:3}]}),H264_MAIN:nr({codec:t8.H264,priority:0,profileLevels:[{profileLevel:t7.MAIN_31,priority:0},{profileLevel:t7.BASELINE_31_CONSTRAINED,priority:1},{profileLevel:t7.BASELINE_31,priority:2},{profileLevel:t7.HIGH_31,priority:3}]}),H264_HIGH:nr({codec:t8.H264,priority:0,profileLevels:[{profileLevel:t7.HIGH_31,priority:0},{profileLevel:t7.MAIN_31,priority:1},{profileLevel:t7.BASELINE_31_CONSTRAINED,priority:2},{profileLevel:t7.BASELINE_31,priority:3}]})}),sr=()=>({connections:{socket:{pingIntervalMs:15e3,pongTimeoutMs:3e4,connectTimeoutMs:12e3,maxConnectRetries:6,maxConnectRetryDelayMs:32e3,fallbackRequestRetryDelayMs:500,minRequestRetryDelayMs:100,maxRequestRetryDelayMs:1e4,openWithoutState:!1}},signaling:{connectionImplV2:!1,forceCluster:void 0,eventsUrl:void 0,disableReassignments:!1,disableTokenReuseMe
3ssage:!1,whip:{url:void 0},sdp:{xdp:{enabled:!0,disablePublish:!1,disableSubscribe:!1,exchangeTimeoutMs:12e3},multiCodecAnswer:!0},ice:{forceProtocol:void 0},state:{setStateTimeoutMs:5e3}},media:{disableRemoteAudioMuteEnforcement:!1},logging:{level:eZ.ERROR,categories:{},levels:{debug:!1,log:!1,info:!0,warn:!0,error:!0}},analytics:{appLabel:void 0,postUrl:void 0,highPriorityBatchMs:1e3,lowPriorityBatchMs:3e4,maxBatchSize:100},auth:{disableValidation:!1}}),rm=50,rE=2500,rS=10,r_=30,ry=160,rb=1280,rC=720*rb,rT=16/9,rI=12,rR=128,rO=64,rA={[rs.DEFAULT]:0,[rs.LOW]:50,[rs.MEDIUM]:150,[rs.HIGH]:250},rk={[rs.DEFAULT]:0,[rs.LOW]:100,[rs.MEDIUM]:200,[rs.HIGH]:300},_r=()=>({minBitrate:rm,maxBitrate:rE,maxVideoBitrateKbps:rE,maxFramerate:r_,simulcast:{enabled:!1,layers:[Object.assign({},rg.HI),Object.assign({},rg.MID),Object.assign({},rg.LOW)]},inBandMessaging:{enabled:!1},codecs:[]}),yr=()=>({maxAudioBitrateKbps:rO,stereo:!1}),rw={name:"SimulcastUnsupported",message:`Simulcast is only supported on Chromium browsers at bitrates over ${rg.MID.maxBitrateKbps}Kbps`,code:100},rN={name:"SimulcastLayerInvalidType",message:"Layer configuration is invalid: ",code:101},rD={name:"SimulcastMaxLayersExceeded",message:"No more than 3 simulcast layers may be configured",code:102},rP={name:"SimulcastDuplicateLayersConfigured",message:"Two duplicate layers are configured. At minimum bitrate, framerate, or dimensions must differ",code:103},rM={name:"SimulcastMaxLayerBitrateExceeded",message:`maxBitrateKbps cannot exceed ${rE} Kbps`,code:105},rL={name:"SimulcastMinLayerBitrateExceeded",message:`maxBitrateKbps cannot be less than ${rm} Kbps`,code:106},rx={name:"SimulcastMaxLayerFramerateExceeded",message:`maxFramerate cannot exceed ${r_} fps`,code:107},rU={name:"SimulcastMinLayerFramerateExceeded",message:`maxFramerate cannot be less than ${rS} fps`,code:108},rB={name:"SimulcastMaxLayerDimensionsExceeded",message:`dimensions cannot exceed max resolution of ${rb}x720`,code:109},rj={name:"SimulcastMinLayerDimensionsExceeded",message:`width or height cannot be lower than ${ry}`,code:110},rV={name:"SimulcastLayerConfigurationConflict",message:"Layer configuration conflict: ",code:111},rF={name:"SimulcastLayerOrientationMismatch",message:"Layer orientation different from input video track: ",code:112},rG={name:"SimulcastLayerInputResolutionInsufficient",message:"Input video resolution is lower than the configured layer: ",code:113},rH={name:"SimulcastLayerInputFramerateInsufficient",message:"Input video framerate is lower than the configured layer: ",code:114};let SimulcastConfigurationError=class SimulcastConfigurationError extends Error{constructor({name:p,message:_,code:Z,details:et,cause:el,params:eu}){super(_),Error.captureStackTrace&&Error.captureStackTrace(this,SimulcastConfigurationError),this.name=p,this.message=_,this.code=Z,this.details=et,this.cause=el,this.params=eu}};let xr=p=>({rid:p.rid,active:p.active,scaleResolutionDownBy:p.scaleFactor,maxBitrate:p.maxBitrateBps,maxFramerate:p.maxFramerate}),Ur=(p,_)=>p.width*p.height>_.width*_.height||p.maxBitrateKbps>_.maxBitrateKbps||p.maxFramerate>_.maxFramerate?1:Br(p,_)?0:-1,Br=(p,_)=>{if("object"!=typeof p||"object"!=typeof _)return!1;let Z=Object.keys(p);for(let et of Z)if(p[et]!==_[et])return!1;return!0},jr=p=>{let{width:_,height:Z}=Fr(p);return _*Z},Fr=p=>{let{height:_,width:Z}=p,et=rb/rT,el=rb;return void 0!==_&&(et=_),void 0!==Z&&(el=Z),_&&!Z&&(el=_*rT),!_&&Z&&(et=Z/rT),{height:et,width:el}},Vr=p=>{let{width:_,height:Z}=p;return _/Z>=1?t6.LANDSCAPE:t6.PORTRAIT},Gr=(p,_,Z)=>{var et;let el=null!==(et=p.getSettings().frameRate)&&void 0!==et?et:r_;return Object.assign(Object.assign({},Z),{active:!0,height:_.height,width:_.width,maxBitrateBps:Wn(_.maxBitrateKbps),maxFramerate:Math.min(_.maxFramerate,el),scaleFactor:Hr(_,p)})},Hr=(p,_)=>{let Z=jr(_.getSettings()),et=jr(p);return et>=Z?1:Math.max(1/Math.sqrt(et/Z),1)},qr=p=>{if("object"!=typeof p){let p=Object.assign({},rN);throw p.message+=" is not an object",new SimulcastConfigurationError(p)}},Wr=(p,_)=>{if("number"!=typeof p){let p=Object.assign({},rN);throw p.message+="maxBitrateKbps is not a number",new SimulcastConfigurationError(p)}if(p<rm)throw new SimulcastConfigurationError(Object.assign({},rL));if(p>rE)throw new SimulcastConfigurationError(Object.assign({},rM));if(_&&p>_){let p=Object.assign({},rV);throw p.message+=`maxBitrateKbps cannot be greater than stage maxVideoBitrateKbps of ${_}`,new SimulcastConfigurationError(p)}},$r=(p,_)=>{if("number"!=typeof p){let p=Object.assign({},rN);throw p.message+="maxFramerate is not a number",new SimulcastConfigurationError(p)}if(p<rS)throw new SimulcastConfigurationError(Object.assign({},rU));if(p>r_)throw new SimulcastConfigurationError(Object.assign({},rx));if(_&&p>_){let p=Object.assign({},rV);
3throw p.message+=`maxFramerate cannot be greater than stage maxFramerate of ${_} `,new SimulcastConfigurationError(p)}},Kr=(p,_)=>{var Z;if("number"!=typeof p||"number"!=typeof _){let p=Object.assign({},rN);throw p.message+="width and height must be numbers",new SimulcastConfigurationError(p)}if(p<ry||_<ry)throw new SimulcastConfigurationError(Object.assign({},rj));let et=null!==(Z=yt("enable1080pResolution"))&&void 0!==Z&&Z,el=et?1920:rb;if(p>el||_>el||p*_>(et?2073600:rC))throw new SimulcastConfigurationError(Object.assign({},rB))},zr=(p,_)=>{let Z=Fr(_.getSettings()),et=Vr(Z);et!==Vr(p)&&kn(`${rF.message}forcing orientation to ${et}`)},Jr=(p,_)=>{var Z,et,el,eu,ed;let eh=(0,tw.cloneDeep)(_),ep=null!==(Z=eh.simulcast)&&void 0!==Z?Z:{},ef=!rh.browser.isChrome()&&!rh.browser.isEdge(),eg=null!==(el=null===(et=p.getSettings())||void 0===et?void 0:et.displaySurface)&&void 0!==el&&el,ev=null!==(eu=eh.maxVideoBitrateKbps)&&void 0!==eu?eu:rE,em=!(Array.isArray(null===(ed=_.simulcast)||void 0===ed?void 0:ed.layers)||!_.maxVideoBitrateKbps)&&ev<rg.MID.maxBitrateKbps;if("boolean"==typeof ep.enabled&&ep.enabled&&(ef||eg||em)){eh.simulcast={enabled:!1};let{name:p,message:_}=rw;kn(`${p}${_}, disabling the feature`)}return((p,_)=>{var Z,et;let el=null===(Z=_.simulcast)||void 0===Z?void 0:Z.layers;if(void 0===el)return _;if(!Array.isArray(el)){let p=Object.assign({},rN);throw p.message+=" layers is not an array",new SimulcastConfigurationError(p)}if(0===el.length)return null===(et=_.simulcast)||void 0===et||delete et.layers,_;if(el.length>3)throw new SimulcastConfigurationError(Object.assign({},rD));if((0,tw.uniqWith)(el,Br).length!==el.length)throw new SimulcastConfigurationError(Object.assign({},rP));for(let Z of el)qr(Z),Wr(Z.maxBitrateKbps,_.maxVideoBitrateKbps),$r(Z.maxFramerate,_.maxFramerate),Kr(Z.width,Z.height),zr(Z,p);return _})(p,eh)},rW={name:"CodecInvalidType",message:"Codec configuration must be an object",code:200},rq={name:"CodecMissingProperty",message:"Codec configuration must have a codec property",code:201},r$={name:"CodecInvalid",message:"Invalid codec: ",code:202},rK={name:"CodecPriorityInvalid",message:"Codec priority must be a non-negative number",code:203},rz={name:"CodecProfileLevelIncompatible",message:"does not support profile-levels. Only H264 supports profile-level configuration.",code:204},rJ={name:"CodecProfileLevelArrayInvalid",message:"Profile levels must be an array",code:205},rX={name:"CodecProfileLevelInvalidType",message:"Profile level must be an object",code:206},rY={name:"CodecProfileLevelMissingProperty",message:"Profile level must have a profileLevel property",code:207},rQ={name:"CodecProfileLevelInvalid",message:"Invalid profile level: ",code:208},rZ={name:"CodecProfileLevelPriorityInvalid",message:"Profile level priority must be a non-negative number",code:209},r0={name:"CodecsArrayInvalid",message:"Codecs must be an array",code:210};let CodecConfigurationError=class CodecConfigurationError extends Error{constructor({name:p,message:_,code:Z,details:et,cause:el,params:eu}){super(_),Error.captureStackTrace&&Error.captureStackTrace(this,CodecConfigurationError),this.name=p,this.message=_,this.code=Z,this.details=et,this.cause=el,this.params=eu}};let ai=p=>{if("object"!=typeof p||null===p)return tm.err(new CodecConfigurationError(rX));if(!p.profileLevel)return tm.err(new CodecConfigurationError(rY));let _=(0,tw.cloneDeep)(p),{profileLevel:Z,priority:et}=_,el=Object.values(t7);return el.includes(Z)?void 0!==et&&("number"!=typeof et||et<0)?tm.err(new CodecConfigurationError(rZ)):tm.ok(_):tm.err(new CodecConfigurationError(Object.assign(Object.assign({},rQ),{message:`${rQ.message}${Z}. Must be one of: ${el.join(", ")}`})))},ci=p=>{if("object"!=typeof p||null===p||Array.isArray(p))return tm.err(new CodecConfigurationError(rW));let _=(0,tw.cloneDeep)(p),{codec:Z,priority:et}=_;if(!Z)return tm.err(new CodecConfigurationError(rq));let el=Object.values(t8);if(!el.includes(Z))return tm.err(new CodecConfigurationError(Object.assign(Object.assign({},r$),{message:`${r$.message}${Z}. Must be one of: ${el.join(", ")}`})));if(void 0!==et&&("number"!=typeof et||et<0))return tm.err(new CodecConfigurationError(rK));if(Z===t8.H264){if(void 0!==_.profileLevels){if(!Array.isArray(_.profileLevels))return tm.err(new CodecConfigurationError(rJ));for(let p of _.profileLevels){let _=ai(p);if(!_.ok)return tm.err(_.error)}0===_.profileLevels.length&&delete _.profileLevels}}else if(Object.keys(_).indexOf("profileLevels")>-1)return tm.err(new CodecConfigurationError(Object.assign(Object.assign({},rz),{message:`${Z} ${rz.message}`})));return tm.ok(_)};function ui(p){return p.track.kind===ri.AUDIO}function li(p){return p.track.kind===ri.VIDEO&&"object"==typeof p.config}function di(p){if(void 0!==p&&(p<rm||p>
3rE))throw Error(`Stage bitrate must be a number between ${rm} kbps and ${rE} kbps inclusive`)}function hi(p){return void 0!==p&&("maxBitrate"in p||"maxVideoBitrateKbps"in p||"maxFramerate"in p||"simulcast"in p||"inBandMessaging"in p||"codecs"in p||"minBitrate"in p)}let r1=function(){if("undefined"!=typeof URLSearchParams){let p=new URLSearchParams(window.location.search);return{get:_=>p.get(_),has:_=>p.has(_)}}let p=window.location.search.slice(1),_={};return p&&p.split("&").forEach(p=>{let[Z,et]=p.split("=");_[decodeURIComponent(Z)]=decodeURIComponent(et||"")}),{get:p=>{var Z;return null!==(Z=_[p])&&void 0!==Z?Z:null},has:p=>p in _}}(),r2=r1.get("ivs_dc_cnf_env")===tm.DeviceConfigEnv.BETA?tm.DeviceConfigEnv.BETA:tm.DeviceConfigEnv.PROD,r3=tm.DEFAULT_REFRESH_INTERVAL_SECONDS,r4=r2===tm.DeviceConfigEnv.BETA?10:r3,r5="broadcast-web-v1",r9=(null===(nU=null===(nx=window.location)||void 0===nx?void 0:nx.hostname)||void 0===nU?void 0:nU.indexOf("localhost"))>-1,r6=`amazon_ivs_device_config_v1_${r5}_context`,Ci=()=>({[t2.RT]:{customerIds:[],hosts:[]},[t2.LL]:{customerIds:[],hosts:[]}}),Ii=p=>{let _=(0,tw.merge)(Ci(),p),Z=(()=>{try{let p=localStorage.getItem(r6);return null===p?tm.err("Key does not exist"):tm.ok(JSON.parse(p))}catch(p){return tm.err(`Error while parsing: ${p}`)}})();if(!Z.ok)return _;let et=Z.value;return _=Oi(t2.RT,et[t2.RT],_),_=Oi(t2.LL,et[t2.LL],_)},Ri=(p,_)=>p.hash===_.hash&&p.key===_.key,Oi=(p,_,Z)=>{let et=Object.keys(Z[p]);for(let el of et)Z[p][el]=(0,tw.uniqWith)([..._[el],...Z[p][el]],Ri);return Z},wi=(p,_,Z)=>{let et=(0,tw.cloneDeep)(null!=p?p:{}),el=Object.assign(Object.assign({},et),{cFilter:et.customerId,hFilter:et.host});for(let et of Z[_].customerIds)et.key===p.customerId&&(el.cFilter=et.hash);for(let et of Z[_].hosts)et.key===p.host&&(el.hFilter=et.hash);return el},Ai=p=>p?{customer_id:p.customerId,session_id:p.sessionId}:{};(nP=nB||(nB={})).EXPERIMENT_FOOBAR="experiment_foobar",nP.EXPERIMENT_CONNECTION_V2="experiment_connection_v2";let GlobalConfigManager=class GlobalConfigManager extends TypedEmitter{constructor(p){var _;super(),this.onStateChanged=(p,_)=>{this.logger.log(`[onStateChanged] From ${p} to ${_}`)},this.handleRefresh=()=>{this.logger.log("[handleRefresh] Starting refresh trigger");let p=this.fsm.currentState()===tZ.ACTIVATING||this.fsm.currentState()===tZ.ACTIVE;return p?(this.logger.log("[handleRefresh] Starting refresh"),this.fsm.transition(t0.REFRESH)):this.logger.log("[handleRefresh] Skipping refresh due to inactive state"),p},this.onMetricsEmitted=p=>{this.fsm.currentState()!==tZ.ACTIVATING&&this.fsm.currentState()!==tZ.REFRESHING||this.fsm.transition(t0.ACTIVATE);let _=new DevConfOpsMetricsEvent(Object.assign({},p));this.emit(tQ.ANALYTICS_EVENT,_),this.emit(tQ.REFRESH)},this.onConfigValue=(p,_)=>{let Z=new DevConfValueEvent(Object.assign(Object.assign({},p),Ai(_)));this.emit(tQ.ANALYTICS_EVENT,Z)},this.onConfigError=(p,_)=>{let Z=new DevConfErrorEvent(Object.assign(Object.assign({},p),Ai(_)));this.emit(tQ.ANALYTICS_EVENT,Z)},this.onConfigTrace=(p,_)=>{let Z=new DevConfTraceEvent(Object.assign(Object.assign({},p),Ai(_)));this.emit(tQ.ANALYTICS_EVENT,Z)},this.onConfigAssignment=(p,_)=>{let Z=new DevConfRolloutAssignmentEvent(Object.assign(Object.assign({},p),Ai(_)));this.emit(tQ.ANALYTICS_EVENT,Z)},this.cacheContextForSource=(p,_)=>{var Z,et,el,eu;return Z=this,et=void 0,el=void 0,eu=function*(){var Z,et,el,eu;let ed=yield(Z=void 0,et=void 0,el=void 0,eu=function*(){let p={customerIds:[],hosts:[]};if(_.customerId){let Z=yield(0,tm.hashProperty)(_.customerId);if(!Z.ok)return tm.err(`customerId: ${Z.error}`);p.customerIds.push(Z.value)}if(_.host){let Z=yield(0,tm.hashProperty)(_.host);if(!Z.ok)return tm.err(`host: ${Z.error}`);p.hosts.push(Z.value)}return tm.ok(p)},new(el||(el=Promise))(function(p,_){function s(p){try{c(eu.next(p))}catch(p){_(p)}}function a(p){try{c(eu.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof el?Z:new el(function(p){p(Z)})).then(s,a)}c((eu=eu.apply(Z,et||[])).next())}));ed.ok?(this.context=Oi(p,ed.value,this.context),(p=>{try{let _=JSON.stringify(p);return localStorage.setItem(r6,_),tm.ok(void 0)}catch(p){return tm.err(`Error while storing: ${p}`)}})(this.context)):this.logger.error("[cacheContextForSource] ",ed.error)},new(el||(el=Promise))(function(p,_){function s(p){try{c(eu.next(p))}catch(p){_(p)}}function a(p){try{c(eu.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof el?Z:new el(function(p){p(Z)})).then(s,a)}c((eu=eu.apply(Z,et||[])).next())})},this.disableConfigRefresh=()=>{this.fsm.transition(t0.PAUSE)},this.enableConfigRefresh=()=>{this.fsm.transition(t0.ACTIVATE)},this.logger=(0,tm.createLogger)({name:"GlobalConfigManager"}),this.logger.setConfig({enabled:!0,levels:{debug:!1,log:r9,info:r9,error:r9,warn:r9}}),this.context=Ii(Ci()),this.overrides=Object.assign(Object.assign({},{refreshIntervalSeconds:r4}),p),this.fsm=(0,tm.createFsm)({initialState:tZ.IDLE,transitions:tR,callbacks:{onStateChanged:this.onStateChanged}}),this.manager=tm.DeviceConfigManager.getInstance(window,{fileKey:null!==(_=_t("fileKey"))&&void 0!==_?_:r5,standardEnv
3:r2,refresh:{refreshIntervalSeconds:this.overrides.refreshIntervalSeconds,canRefreshNow:this.handleRefresh},fetch:this.overrides.refreshRequestHook,trace:{onTrace:p=>{this.logger.log("[onTrace] ",p)}},emitMetrics:this.onMetricsEmitted,analyticsProperties:{env:r2,client_sdk:"broadcast-web"},enableConsoleLog:r9}),this.fsm.transition(t0.INITIALIZE)}get state(){return this.fsm.currentState()}resolveExperimentsForSource(p,_){let Z=wi(_,p,this.context),et=this.getResolvedExperiments([nB.EXPERIMENT_FOOBAR,nB.EXPERIMENT_CONNECTION_V2],Z);this.logger.info("[resolveExperimentContext]",et);let el={};if(et)for(let[p,_]of Object.entries(et))el[p]=null==_?void 0:_.variant;return el}getRemoteStageSubscribeConfiguration(p){let _=wi(p,t2.RT,this.context);return this.getRemoteConfigurationForProperty(t1.STAGE_SUBSCRIBE_CONFIGURATION,_,tA)}getRemoteStageConfiguration(p){let _=wi(p,t2.RT,this.context);return this.getRemoteConfigurationForProperty(t1.STAGE_CONFIGURATION,_,tk)}getRemoteStageVideoConfiguration(p){let _=wi(p,t2.RT,this.context),Z=this.getRemoteConfigurationForProperty(t1.STAGE_LOCAL_STREAM_CONFIGURATION,_,tO);if(Z)return void 0!==Z&&("maxVideoBitrateKbps"in Z||"maxFramerate"in Z||"simulcast"in Z||"inBandMessaging"in Z||"codecs"in Z)?Z:void 0}getRemoteStageAudioConfiguration(p){let _=wi(p,t2.RT,this.context),Z=this.getRemoteConfigurationForProperty(t1.STAGE_LOCAL_STREAM_CONFIGURATION,_,tO);if(Z)return void 0!==Z&&("stereo"in Z||"maxAudioBitrateKbps"in Z)?Z:void 0}getConfigurationHolder(p){var _;return null===(_=this.manager)||void 0===_?void 0:_.getConfigurationHolder({analytics:{onValue:_=>{this.onConfigValue(_,p)},onError:_=>{this.onConfigError(_,p)},onTrace:_=>{this.onConfigTrace(_,p)},onAssignment:_=>{this.onConfigAssignment(_,p)}}})}getRemoteConfigurationForProperty(p,_,Z){let et=this.getConfigurationHolder(_);if(et)return et.getResolvedConfigForPropertyKey({key:p,context:_,schema:Z,trace:r9});this.logger.error("[getRemoteConfigurationForProperty] No config manager is present")}getResolvedExperiments(p,_){let Z=this.getConfigurationHolder(_);if(Z)return Z.getResolvedExperimentForPropertyKeys({keys:p,context:_,trace:r9});this.logger.error("[getResolvedExperiments] No config manager is present")}};var Di=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};function Mi(p,_,Z){var et,el;return Z?(null===(et=null==p?void 0:p.find(p=>p.brand===Z.brand))||void 0===et?void 0:et.version)||`${Z.version}.0.0.0`:(null===(el=null==p?void 0:p.find(p=>"Google Chrome"==p.brand))||void 0===el?void 0:el.version)||`${_}.0.0.0`}let r8="model",r7="type",nt="vendor",ni="console",nc="mobile",nl="tablet",nu="smarttv",nd="wearable",nh="embedded",np="Amazon",nf="Apple",ng="ASUS",nv="Google",nm="Huawei",nE="Microsoft",nS="Motorola",n_="Samsung",ny="Sharp",nb="Sony",nC="Xiaomi",nT="Zebra",ro=(p,_)=>{if("string"==typeof p)return p=p.replace(/^\s\s*/,""),void 0===_?p:p.substring(0,500)},io=function(p,_){let Z,et,el,eu,ed,eh,ep=0;for(;_&&ep<_.length&&!ed;){let ef=_[ep],eg=_[ep+1];for(Z=et=0;Z<ef.length&&!ed&&ef[Z];){let _=ef[Z++];if(ed="function"==typeof _.exec?_.exec(p):void 0)for(el=0;el<eg.length;el++)eh=ed[++et],"object"==typeof(eu=eg[el])&&eu.length>0?2===eu.length?"function"==typeof eu[1]?this[eu[0]]=eu[1].call(this,eh):this[eu[0]]=eu[1]:3===eu.length?"function"!=typeof eu[1]||eu[1].exec&&eu[1].test?this[eu[0]]="string"==typeof eh?eh.replace(eu[1],eu[2]):void 0:this[eu[0]]=eh?eu[1].call(this,eh,eu[2]):void 0:4===eu.length&&void 0!==eu[0]&&(this[eu[0]]=eh?eu[3].call(this,eh.replace(eu[1],eu[2])):void 0):this[eu]=eh||void 0}ep+=2}},nI={device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[r8,[nt,n_],[r7,nl]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[r8,[nt,n_],[r7,nc]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[r8,[nt,nf],[r7,nc]],[/\((ipad);[-\w),; ]+apple/i,/applecoremedia\/[\w.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[r8,[nt,nf],[r7,nl]],[/(macintosh);/i],[r8,[nt,nf]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[r8,[nt,ny],[r7,nc]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[r8,[nt,nm],[r7,nl]],[/(?:huawei|honor)([-\w ]+)[;)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[r8,[nt,nm],[r7,nc]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[r8,/_/g," "],[nt,nC],[r7,nc]],[/oid[^)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[r8,/_/g," "],[nt,nC],[r7,nl]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[r8,[nt,"OPPO"],[r7,nc]],[/\b(opd2\d{3}a?) bui/i],[r8,[nt,"OPPO"],[r7,nl]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at]?)(?: bui|;|\))/i],[r8,[nt,"Vivo"],[r7,nc]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[r8,[nt,"Realme"],[r7,nc]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w() ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[r8,[nt,nS],[r7,nc]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[r8,[nt,nS],[r7,nl]],[/((?=lg)?[vl]k-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[r8,[nt,"LG"],[r7,nl]],[/(lm(?:-?f100[nv]?|-[\w.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[r8,[nt,"LG"],[r7,nc]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[r8,[nt,"Lenovo"],[r7,nl]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w.]*)/i],[[r8,/_/g," "],[nt,"Nokia"],[r7,nc]],[/(pixel c)\b/i],[r8,[nt,nv],[r7,nl]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[r8,[nt,nv],[r7,nc]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[r8,[nt,nb],[r7,nc]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[r8,"Xperia Tablet"],[nt,nb],[r7,nl]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[r8,[nt,"OnePlus"],[r7,nc]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[r8,[nt,np],[r7,nl]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[r8,/(.+)/g,"Fire Phone $1"],[nt,np],[r7,nc]],[/(playbook);[-\w),; ]+(rim)/i],[r8,nt,[r7,nl]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[r8,[nt,"BlackBerry"],[r7,nc]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[r8,[nt,ng],[r7,nl]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[r8,[nt,ng],[r7,nc]],[/(nexus 9)/i],[r8,[nt,"HTC"],[r7,nl]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[nt,[r8,/_/g," "],[r7,nc]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[r8,[nt,"Acer"],[r7,nl]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[r8,[nt,"Meizu"],[r7,nc]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[r8,[nt,"Ulefone"],[r7,nc]],[/(blackberry|benq|palm(?=-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 4,674 bytes, line 3
3s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[nt,r8,[r7,nc]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[nt,r8,[r7,nl]],[/(surface duo)/i],[r8,[nt,nE],[r7,nl]],[/droid [\d.]+; (fp\du?)(?: b|\))/i],[r8,[nt,"Fairphone"],[r7,nc]],[/(u304aa)/i],[r8,[nt,"AT&T"],[r7,nc]],[/\bsie-(\w*)/i],[r8,[nt,"Siemens"],[r7,nc]],[/\b(rct\w+) b/i],[r8,[nt,"RCA"],[r7,nl]],[/\b(venue[\d ]{2,7}) b/i],[r8,[nt,"Dell"],[r7,nl]],[/\b(q(?:mv|ta)\w+) b/i],[r8,[nt,"Verizon"],[r7,nl]],[/\b(?:barnes[& ]+noble |bn[rt])([\w+ ]*) b/i],[r8,[nt,"Barnes & Noble"],[r7,nl]],[/\b(tm\d{3}\w+) b/i],[r8,[nt,"NuVision"],[r7,nl]],[/\b(k88) b/i],[r8,[nt,"ZTE"],[r7,nl]],[/\b(nx\d{3}j) b/i],[r8,[nt,"ZTE"],[r7,nc]],[/\b(gen\d{3}) b.+49h/i],[r8,[nt,"Swiss"],[r7,nc]],[/\b(zur\d{3}) b/i],[r8,[nt,"Swiss"],[r7,nl]],[/\b((zeki)?tb.*\b) b/i],[r8,[nt,"Zeki"],[r7,nl]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[nt,"Dragon Touch"],r8,[r7,nl]],[/\b(ns-?\w{0,9}) b/i],[r8,[nt,"Insignia"],[r7,nl]],[/\b((nxa|next)-?\w{0,9}) b/i],[r8,[nt,"NextBook"],[r7,nl]],[/\b(xtreme_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[nt,"Voice"],r8,[r7,nc]],[/\b(lvtel-)?(v1[12]) b/i],[[nt,"LvTel"],r8,[r7,nc]],[/\b(ph-1) /i],[r8,[nt,"Essential"],[r7,nc]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[r8,[nt,"Envizen"],[r7,nl]],[/\b(trio[-\w. ]+) b/i],[r8,[nt,"MachSpeed"],[r7,nl]],[/\btu_(1491) b/i],[r8,[nt,"Rotor"],[r7,nl]],[/(shield[\w ]+) b/i],[r8,[nt,"Nvidia"],[r7,nl]],[/(sprint) (\w+)/i],[nt,r8,[r7,nc]],[/(kin\.[onetw]{3})/i],[[r8,/\./g," "],[nt,nE],[r7,nc]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[r8,[nt,nT],[r7,nl]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[r8,[nt,nT],[r7,nc]],[/smart-tv.+(samsung)/i],[nt,[r7,nu]],[/hbbtv.+maple;(\d+)/i],[[r8,/^/,"SmartTV"],[nt,n_],[r7,nu]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[nt,"LG"],[r7,nu]],[/(apple) ?tv/i],[nt,[r8,nf+" TV"],[r7,nu]],[/crkey/i],[[r8,"Chromecast"],[nt,nv],[r7,nu]],[/droid.+aft(\w+)( bui|\))/i],[r8,[nt,np],[r7,nu]],[/\(dtv[);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[r8,[nt,ny],[r7,nu]],[/(bravia[\w ]+)( bui|\))/i],[r8,[nt,nb],[r7,nu]],[/(mitv-\w{5}) bui/i],[r8,[nt,nC],[r7,nu]],[/Hbbtv.*(technisat) (.*);/i],[nt,r8,[r7,nu]],[/\b(roku)[\dx]*[)/]((?:dvp-)?[\d.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w+ ]*; *([\w\d][^;]*);([^;]*)/i],[[nt,ro],[r8,ro],[r7,nu]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[r7,nu]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[nt,r8,[r7,ni]],[/droid.+; (shield) bui/i],[r8,[nt,"Nvidia"],[r7,ni]],[/(playstation [345portablevi]+)/i],[r8,[nt,nb],[r7,ni]],[/\b(xbox(?: one)?(?!; xbox))[); ]/i],[r8,[nt,nE],[r7,ni]],[/((pebble))app/i],[nt,r8,[r7,nd]],[/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i],[r8,[nt,nf],[r7,nd]],[/droid.+; (glass) \d/i],[r8,[nt,nv],[r7,nd]],[/droid.+; (wt63?0{2,3})\)/i],[r8,[nt,nT],[r7,nd]],[/(quest( \d| pro)?)/i],[r8,[nt,"Facebook"],[r7,nd]],[/(tesla)(?: qtcarbrowser|\/[-\w.]+)/i],[nt,[r7,nh]],[/(aeobc)\b/i],[r8,[nt,np],[r7,nh]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[r8,[r7,nc]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[r8,[r7,nl]],[/\b((tablet|tab)[;/]|focus\/\d(?!.+mobile))/i],[[r7,nl]],[/(phone|mobile(?:[;/]| [ \w/.]*safari)|pda(?=.+windows ce))/i],[[r7,nc]],[/(android[-\w. ]{0,9});.+buil/i],[r8,[nt,"Generic"]]]};function ao(p){var _,Z;let{globalSessionId:et,userAgent:el}=p,eu=null!=el?el:navigator.userAgent,ed=rd.getParser(eu),eh=function(p){let _=/^(\d+)\.(\d+)\.(\d+)[+|-]?(.*)?$/.exec(p)||/^(\d+)\.(\d+)[+|-]?(.*)?$/.exec(p)||/^(\d+)$/.exec(p)||[];return{major:parseInt(_[1],10)||0,minor:parseInt(_[2],10)||0,patch:parseInt(_[3],10)||0}}(String(ed.getBrowserVersion())),ep=(p=>{var _;let Z={};return Z[nt]=void 0,Z[r8]=void 0,Z[r7]=void 0,io.call(Z,null!==(_=null!=p?p:navigator.userAgent)&&void 0!==_?_:"",nI.device),Z})(eu);return{browser:navigator.appVersion,browser_family:ed.getBrowserName().toLowerCase(),browser_version:`${eh.major}.${eh.minor}`,customer_id:"ivs",host:window.location.hostname,os_name:ed.getOSName(),os_version:String(ed.getOSVersion()),platform:"web",global_session_id:et,sdk_version:"1.38.0",user_agent:eu,is_backgrounded:"hidden"===(null==document?void 0:document.visibilityState),device_model:null!==(_=ep.model)&&void 0!==_?_:"unknown",device_manufacturer:null!==(Z=ep.vendor)&&void 0!==Z?Z:"unknown",device_os_version:String(ed.getOSVersion()),device_softw
3are:eu}}window.IVS_CLIENT_GLOBAL_STATE||(window.IVS_CLIENT_GLOBAL_STATE={}),window.IVS_CLIENT_GLOBAL_STATE.session||(window.IVS_CLIENT_GLOBAL_STATE.session=new class{constructor(){this.globalSessionId=jt(),this.currentGlobalEndpoint=tT,this.signalInternalUsage=()=>{this.usageReferences>0?this.configManager.enableConfigRefresh():this.configManager.disableConfigRefresh()},this.markSdkUsage=()=>{this.usageReferences++,this.signalInternalUsage()},this.removeSdkUsage=()=>{this.usageReferences=Math.max(0,this.usageReferences-1),this.signalInternalUsage()},this.usageReferences=0,this.healthReporter=new HealthReporter,this.networkMonitor=new NetworkQualityMonitor,this.configManager=new GlobalConfigManager,this.healthReporter.on(tJ.ANALYTICS_EVENT,p=>{this.trackGlobalEvent(p)}),this.configManager.on(tQ.ANALYTICS_EVENT,p=>{this.trackGlobalEvent(p)}),this.configManager.on(tQ.REFRESH,()=>{this.signalInternalUsage()}),this.globalProperties=ao({globalSessionId:this.globalSessionId}),(function(p){var _,Z,et,el;return _=this,Z=void 0,et=void 0,el=function*(){let _=yield function(p=["architecture","bitness","model","platformVersion","fullVersionList"]){return Di(this,void 0,void 0,function*(){try{let _=yield function(p){return Di(this,void 0,void 0,function*(){let t=p=>{let _="";return"x86"==p.architecture&&"64"==p.bitness?_="; Win64; x64":"arm"==p.architecture?_="; ARM":!0===p.wow64&&(_="; WOW64"),`Windows NT ${function(p){let _=new Map([["0.3.0","6.3"],["0.2.0","6.2"],["0.1.0","6.1"]]),Z=null!=p?p:"";return _.has(Z)?_.get(Z):"10.0"}(p.platformVersion)}${_}`},_=navigator.userAgentData;if(!_)return Promise.resolve(void 0);let Z,et,el=!1,eu=RegExp("AppleWebKit/537.36 \\(KHTML, like Gecko\\) (?:SamsungBrowser/[\\d.]+ )?Chrome/[\\d.]+ (Mobile )?Safari/537.36(?: Edg[A]?/[\\d.]+)?");return _.brands.forEach(p=>{"Chromium"==p.brand?(el=eu.test(navigator.userAgent),Z=parseFloat(p.version)):"Samsung Internet"==p.brand?et={brand:"Samsung Internet",version:p.version}:"Microsoft Edge"==p.brand&&(et={brand:"Microsoft Edge",version:p.version})}),!el||Z&&Z<100?Promise.resolve(void 0):new Promise(el=>{_.getHighEntropyValues(p).then(p=>{var eu,ed,eh,ep,ef,eg,ev,em,eE;let eS,e_,ey,eb;let eC={platform:null===(eu=navigator.userAgentData)||void 0===eu?void 0:eu.platform,version:Z},eT=Object.assign(eC,p);(eg=eT).architecture||(eg.architecture="x86"),eg.bitness||(eg.bitness="64"),eg.model||(eg.model=""),eg.platform||(eg.platform="Windows"),eg.platformVersion||(eg.platformVersion="10.0"),eg.wow64||(eg.wow64=!1);let eI="Mozilla/5.0 (";if(["Chrome OS","Chromium OS"].includes(null!==(ed=null==(eT=eg)?void 0:eT.platform)&&void 0!==ed?ed:"")?eI+=(eS="","64"==(ev=eT).bitness?"x86"==ev.architecture?eS="x86_64":"arm"==ev.architecture&&(eS="aarch64"):"arm"==ev.architecture&&"32"==ev.bitness&&(eS="armv7l"),""==eS?`X11; CrOS ${ev.platformVersion}`:`X11; CrOS ${eS} ${ev.platformVersion}`):"Windows"==eT.platform?eI+=t(eT):"macOS"==eT.platform?eI+=(e_="Macintosh; Intel Mac OS X ",(ey=null!==(em=eT.platformVersion)&&void 0!==em?em:"").indexOf(".")>-1&&(ey=ey.split(".").join("_")),e_+=ey):"Android"==eT.platform?eI+=(eb="Linux; Android "+(eE=eT).platformVersion,eE.model&&(eb+="; "+eE.model),eb):eI+="X11; Linux x86_64",eI+=") AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"+Mi(null!==(eh=null==eT?void 0:eT.fullVersionList)&&void 0!==eh?eh:[],eC.version,et),_.mobile&&(eI+=" Mobile"),eI+=" Safari/537.36","Samsung Internet"===(null==et?void 0:et.brand)){let p=Mi(null!==(ep=null==eT?void 0:eT.fullVersionList)&&void 0!==ep?ep:[],void 0,et);eI=eI.replace(" Safari/537.36",` SamsungBrowser/${p} Safari/537.36`)}else if("Microsoft Edge"===(null==et?void 0:et.brand)){let p=Mi(null!==(ef=null==eT?void 0:eT.fullVersionList)&&void 0!==ef?ef:[],void 0,et);eI+=` ${_.mobile?"EdgA":"Edg"}/${p}`}el(eI)}).catch(()=>{el(void 0)})})})}(p);return null!=_?_:navigator.userAgent}catch(p){return navigator.userAgent}})}();return ao(Object.assign(Object.assign({},p),{userAgent:_}))},new(et||(et=Promise))(function(p,eu){function s(p){try{c(el.next(p))}catch(p){eu(p)}}function a(p){try{c(el.throw(p))}catch(p){eu(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof et?Z:new et(function(p){p(Z)})).then(s,a)}c((el=el.apply(_,Z||[])).next())})})({globalSessionId:this.globalSessionId}).then(p=>{this.globalProperties=Object.assign(Object.assign({},this.globalProperties),p)}).catch(Zt)}updateGlobalProperties(){this.globalProperties=Object.assign(Object.assign({},this.globalProperties),{is_backgrounded:"hidden"===(null==document?void 0:document.visibilityState)})}trackGlobalEvent(p){let _=this.getGlobalProperties();p.data.properties=Object.assign(Object.assign(Object.assign({},_),p.data.properties),{client_time:(new Date).toISOString(),current_endpoint:this.currentEndpoint});let{headers:Z,body:et}=Wt([p.data]);Ft(()=>{var p,_,el,eu;return p=this,_=void 0,el=void 0,eu=function*(){yield qt("POST",this.currentEndpoint,Z,et)},new(el||(el=Promise))(function(Z,et){function s(p){try{c(eu.next(p))}catch(p){et(p)}}function a(p){try{c(eu.throw(p))}catch(p){et(p)}}function c(p){var _;p.done?Z(p.value):((_=p.value)instanceof el?_:new el(function(p){p(_)})).then(s,a)}c((eu=eu.apply(p,_||[])).next())})})}enrichContext(p){var _,Z;return Object.assign({appLabel:null!==(_=Tt())&&void 0!==_?_:"default",customerId:this.globalProperties.customer_id,host:this.globalProperties.host,browserFamily:this.globalProperties.browser_family,browserVersion:this.globalProperties.browser_version,osName:this.globalProperties.os_name,osVersion:this.globalProperties.os_version,userAgent:this.globalProperties.user_agent,sdkVersion:this.globalProperties.sdk_version,sessionId:null!==(Z=p.sessionId)&&void 0!==Z?Z:"",deviceModel:this.globalProperties.device_model,deviceManufacturer:this.globalProperties.device_manufacturer},p)}getGlobalSessionId(){return this.globalSessionId}getGlobalProperties(){return this.updateGlobalProperties(),this.globalProperties}set currentEndpoint(p){this.currentGlobalEndpoint=p}get currentEndpoint(){var p;return(null===(p=window.IVS_CLIENT_OVERRIDES)||void 0===p?void 0:p.analyticsPostUrl)?window.IVS_CLIENT_OVERRIDES.analyticsPostUrl:this.currentGlobalEndpoint}trackEvent(p){"eventSenderResult"===p.type&&this.healthReporter.trackEventSendResult(p)}getNetworkQuality(){return this.networkMonitor.getNetworkQuality()}cacheRealTimeContext(p){let _=this.enrichContext(p);this.configManager.cacheContextForSource(t2.RT,_).catch(Zt)}cacheLowLatencyContext(p){let _=this.enrichContext(p);
3this.configManager.cacheContextForSource(t2.LL,_).catch(Zt)}resolveExperimentsForRealTimeContext(p){let _=this.enrichContext(p);return this.configManager.resolveExperimentsForSource(t2.RT,_)}getRemoteSubscribeConfig(p){let _=this.enrichContext(p);return this.configManager.getRemoteStageSubscribeConfiguration(_)}getRemoteStageConfig(p){let _=this.enrichContext(p);return this.configManager.getRemoteStageConfiguration(_)}getRemoteVideoStreamConfig(p){let _=this.enrichContext(p);return this.configManager.getRemoteStageVideoConfiguration(_)}getRemoteAudioStreamConfig(p){let _=this.enrichContext(p);return this.configManager.getRemoteStageAudioConfiguration(_)}});let nR=window.IVS_CLIENT_GLOBAL_STATE.session;(nM=nj||(nj={})).HIGH="batch_high_priority",nM.LOW="batch_low_priority";let po=p=>{var _,Z,et;let el=new TypedEmitter,eu=null!==(_=null==p?void 0:p.maxBatchSize)&&void 0!==_?_:100,ed={[nj.LOW]:[],[nj.HIGH]:[]},eh={[nj.LOW]:void 0,[nj.HIGH]:void 0},ep={[nj.LOW]:null!==(Z=null==p?void 0:p.lowPriorityBatchMs)&&void 0!==Z?Z:3e4,[nj.HIGH]:null!==(et=null==p?void 0:p.highPriorityBatchMs)&&void 0!==et?et:1e3},u=(p,_=!1)=>{let Z=ed[p];0!==Z.length&&(_&&(Z=Z.filter(p=>p.critical)),Z.length>0&&el.emit("flushed",Z,_),ed[p]=[])},l=(p,_)=>{ed[p].push(_),ed[p].length>=eu&&u(p)},d=p=>{void 0===eh[p]&&(eh[p]=window.setInterval(()=>{u(p)},ep[p]))},h=p=>{clearInterval(eh[p]),eh[p]=void 0};return Object.assign(el,{start:()=>{d(nj.HIGH),d(nj.LOW)},stop:p=>{var _;h(nj.HIGH),h(nj.LOW);let Z=null!==(_=null==p?void 0:p.useBeacon)&&void 0!==_&&_;u(nj.HIGH,Z),u(nj.LOW,Z)},append:p=>{p.priority!==nj.LOW?l(nj.HIGH,p):l(nj.LOW,p)},get highPriorityQueue(){return ed[nj.HIGH]},get lowPriorityQueue(){return ed[nj.LOW]}})};let AnalyticsTracker=class AnalyticsTracker{constructor(p){var _;this.sharedProperties={},this.eventSender={},this.genSessionId();let Z=Tt();this.eventSender=new EventSender,this.initSharedProperties({appLabel:Z}),this.errorReports=new Map;let{categories:et,levels:el}=null!==(_=null==p?void 0:p.logging)&&void 0!==_?_:{};this.logger=(0,tm.createLogger)({name:"AnalyticsTracker",category:"analytics",enabled:!0,categories:et,levels:el}),this.batcher=po(null==p?void 0:p.analytics),this.batcher.on("flushed",(p,_)=>{var Z,et,el,eu;return Z=this,et=void 0,el=void 0,eu=function*(){try{yield this.eventSender.send(p,_)}catch(p){this.logger.error("Unable to send event ",p)}},new(el||(el=Promise))(function(p,_){function s(p){try{c(eu.next(p))}catch(p){_(p)}}function a(p){try{c(eu.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof el?Z:new el(function(p){p(Z)})).then(s,a)}c((eu=eu.apply(Z,et||[])).next())})})}start(){this.errorAggregationInterval||(this.errorAggregationInterval=window.setInterval(()=>{this.queueAggregateErrors({force:!1})},6e4)),this.batcher.start()}stop(p){clearInterval(this.errorAggregationInterval),this.errorAggregationInterval=void 0,this.queueAggregateErrors({force:!0}),this.batcher.stop({useBeacon:p}),this.genSessionId()}trackEvent(p,_=!1){let Z=nR.getGlobalProperties(),et,el=Object.assign(Object.assign(Object.assign({},this.sharedProperties),Z),{session_id:this.sessionId});_&&(el={global_session_id:el.global_session_id,session_id:this.sessionId,browser:el.browser,browser_family:el.browser_family,browser_version:el.browser_version,os_name:el.os_name,os_version:el.os_version,is_backgrounded:el.is_backgrounded,device_model:el.device_model,device_manufacturer:el.device_manufacturer,user_agent:el.user_agent,device_os_version:el.device_os_version,device_softw
3are:el.device_software}),"data"in p?(p.data.properties=Object.assign({},el,p.data.properties),et=p.data):(p.properties=Object.assign({},el,p.properties),et=p),this.batcher.append(et)}trackEventNoSharedProps(p){this.trackEvent(p,!0)}trackErrorAndThrow(p){throw this.trackError(p),p}trackError(p){let _=`${p.code}${p.fatal}${p.nominal}${p.tag}${p.traceId.value}`,Z=this.errorReports.get(_),et={error:p,queuedAt:Date.now(),count:0};return Z?(0===Z.count&&(Z.error=p),Z.count+=1,Z.queuedAt+6e4<=Date.now()?(this.trackErrorReportIfNeeded(Z),void this.errorReports.set(_,et)):void 0):(this.errorReports.set(_,et),void this.trackEvent(new StageErrorEvent(p)))}queueAggregateErrors({force:p=!1}){this.errorReports.forEach((_,Z)=>{let et=_.queuedAt+6e4;!p&&et>Date.now()||(this.trackErrorReportIfNeeded(_),this.errorReports.delete(Z))})}trackErrorReportIfNeeded(p){if(0===p.count)return;let _=p.error;_.count=p.count,this.trackEvent(new StageErrorEvent(_))}batchEvents(p){!function(p){if(!p)throw Error("eventSender is not defined")}(this.eventSender);let _=p.map(p=>(p.data.properties=Object.assign({},this.sharedProperties,p.data.properties),p.data));this.eventSender.send(_)}initSharedProperties({appLabel:p}){let _=nR.getGlobalProperties();this.sharedProperties=Object.assign(Object.assign({},_),{session_id:this.sessionId}),p&&(this.sharedProperties.app_label=p)}genSessionId(){this.sessionId=jt(),this.sharedProperties.session_id=this.sessionId}getSessionId(){return this.sessionId}};let nO={[eZ.INFO]:"#528bff",[eZ.WARN]:"#ffb31a",[eZ.DEBUG]:"#00f593",[eZ.ERROR]:"#ff4f4d",[eZ.TRACE]:"",[eZ.SILENT]:"",[e0.TIME]:"#53535f",[e0.WEBRTC]:"#0e9bd8",[e0.SUBSCRIPTION]:"#ffc400",[e0.CONNECTION]:"#ff5edb",[e0.SOCKET]:"#8585ff",[e0.EMITTER]:"#adadb8",[e0.LOCAL_PARTICIPANT]:"#1DD21D",[e0.STAGE]:"#EC9806",[e0.REMOTE_PARTICIPANT]:"#0680EC",details:"#808080"},mo=({label:p})=>`background: ${nO[p]||"#333333"}; color: white; padding: 3px; margin-left: 3px;`,nA=Object.entries(eZ),So=(p,_,Z)=>{let et=mo({label:p}),[el]=nA.find(([,_])=>_===Number(p))||[],eu=`%c${el}`,ed=mo({label:_}),eh=`%c${_}`,ep=mo({label:e0.TIME}),ef=`%c[${(new Date).toISOString()}]`,eg=mo({label:"details"}),ev=`%c[${Z}]`,em=[ef,eu,eh],eE=[ep,et,ed];return Z&&(em.push(ev),eE.push(eg)),[em.join(""),...eE]},nk={debug(p){console.groupCollapsed(...So(eZ.DEBUG,p.scope,p.label)),console.debug(p.msg,Object.assign(Object.assign({},p),{level:"debug"})),console.groupEnd()},info(p){console.groupCollapsed(...So(eZ.INFO,p.scope,p.label)),console.info(p.msg,Object.assign(Object.assign({},p),{level:"info"})),console.groupEnd()},warn(p){console.groupCollapsed(...So(eZ.WARN,p.scope,p.label)),console.warn(p.msg,Object.assign(Object.assign({},p),{level:"warn"})),console.groupEnd()},error(p){console.groupCollapsed(...So(eZ.ERROR,p.scope,p.label)),console.error(p),console.groupEnd()}};var yo=function(p,_){var Z={};for(var et in p)Object.prototype.hasOwnProperty.call(p,et)&&0>_.indexOf(et)&&(Z[et]=p[et]);if(null!=p&&"function"==typeof Object.getOwnPropertySymbols){var el=0;for(et=Object.getOwnPropertySymbols(p);el<et.length;el++)0>_.indexOf(et[el])&&Object.prototype.propertyIsEnumerable.call(p,et[el])&&(Z[et[el]]=p[et[el]])}return Z};Object.entries(eZ);let Logger=class Logger{constructor(p=tt,_=nk){this.logLevel=p,this.loggerInstance=_}debug(p){var _,Z;this.logLevel>eZ.DEBUG||null===(Z=(_=this.loggerInstance).debug)||void 0===Z||Z.call(_,JSON.parse(JSON.stringify(Object.assign(Object.assign({},p),{level:"debug"}))))}info(p){var _,Z;this.logLevel>eZ.INFO||null===(Z=(_=this.loggerInstance).info)||void 0===Z||Z.call(_,JSON.parse(JSON.stringify(Object.assign(Object.assign({},p),{level:"info"}))))}warn(p){var _,Z;this.logLevel>eZ.WARN||null===(Z=(_=this.loggerInstance).warn)||void 0===Z||Z.call(_,JSON.parse(JSON.stringify(Object.assign(Object.assign({},p),{level:"warn"}))))}error(p){var _,Z,{err:et}=p,el=yo(p,["err"]);this.logLevel>eZ.ERROR||null===(Z=(_=this.loggerInstance).error)||void 0===Z||Z.call(_,Object.assign({err:et},el))}};let ScopedLogger=class ScopedLogger{constructor(p,_){this.logger=p,this.scope=_}debug(p){var _,Z;
3null===(Z=(_=this.logger).debug)||void 0===Z||Z.call(_,JSON.parse(JSON.stringify(Object.assign(Object.assign({},p),{scope:this.scope}))))}info(p){var _,Z;null===(Z=(_=this.logger).info)||void 0===Z||Z.call(_,JSON.parse(JSON.stringify(Object.assign(Object.assign({},p),{scope:this.scope}))))}warn(p){var _,Z;null===(Z=(_=this.logger).warn)||void 0===Z||Z.call(_,JSON.parse(JSON.stringify(Object.assign(Object.assign({},p),{scope:this.scope}))))}error(p){var _,Z,{err:et}=p,el=yo(p,["err"]);null===(Z=(_=this.logger).error)||void 0===Z||Z.call(_,Object.assign(Object.assign({err:et},el),{scope:this.scope}))}unwrap(){return this.logger}};let Samples=class Samples{constructor(){this.min=0,this.max=0,this.sum=0,this.data=[]}push(p){(0===this.min||p<this.min)&&(this.min=p),p>=this.max&&(this.max=p),this.data.push(p),this.sum+=p}median(){this.data.sort();let p=this.data.length>>1;return this.data.length%2==0?this.data[p-1]+this.data[p]>>1:this.data[p]}percentile(p){if(0===this.data.length)return 0;if(p<=0)return this.data[0];if(p>=1)return this.data[this.data.length-1];let _=(this.data.length-1)*p,Z=Math.floor(_),et=Z+1,el=_%1;return et>=this.data.length?this.data[Z]:this.data[Z]*(1-el)+this.data[et]*el}};var bo=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let PeerStatsTracker=class PeerStatsTracker{constructor(p,_,Z,et){this.peerClient=p,this.broadcastCanvasManager=_,this.analyticsTracker=et,this.logger=new ScopedLogger(Z,e0.EMITTER),this.previousBytesSent=0,this.startTimestamp=0,this.initializeSamples()}start(){this.logger.info({msg:"start emitter"}),this.collectSamplesTimerId=window.setInterval(()=>{this.collectSamples()},1e3),this.trackSamplesTimerId=window.setInterval(()=>{this.trackSamples()},3e4),this.trackPeerConnectionStatsTimerId=window.setInterval(()=>{this.trackPeerConnectionStats()},6e4),this.trackSamples()}stop(){clearInterval(this.collectSamplesTimerId),clearInterval(this.trackSamplesTimerId),clearInterval(this.trackPeerConnectionStatsTimerId),this.collectSamplesTimerId=void 0,this.trackSamplesTimerId=void 0,this.trackPeerConnectionStatsTimerId=void 0}trackPeerConnectionStats(){return bo(this,void 0,void 0,function*(){(yield this.peerClient.getReports()).forEach(p=>{if("outbound-rtp"===p.type)switch(p.kind){case"audio":this.analyticsTracker.trackEvent(new WebRTCAudioStatsEvent(p));break;case"video":{let _=new WebRTCVideoStatsEvent(p),Z=new MinuteBroadcastEvent(p,this.startTimestamp);this.analyticsTracker.batchEvents([_,Z]);break}default:this.logger.warn({msg:"unknown report kind: ",reportKind:p.kind})}})})}collectSamples(){return bo(this,void 0,void 0,function*(){let p=0;this.audioLatencySamples.push(this.broadcastCanvasManager.getAudioLatency()),this.videoLatencySamples.push(this.broadcastCanvasManager.getVideoLatency()),(yield this.peerClient.getReports()).forEach(_=>{switch(_.type){case"candidate-pair":_.nominated&&(this.rttSamples.push(_.currentRoundTripTime),this.recommendedBitrateSamples.push(_.availableOutgoingBitrate));break;case"outbound-rtp":p+=_.bytesSent||0,0===this.startTimestamp&&"video"===_.kind&&(this.startTimestamp=_.timestamp)}});let _=8*Math.round(p-this.previousBytesSent);this.previousBytesSent=p,this.measuredBitrateSamples.push(_)})}trackSamples(){let p=new SourceAudioLatencyEvent(this.audioLatencySamples,30),_=new SourceVideoLatencyEvent(this.videoLatencySamples,30),Z=new CongestionTimeEvent(this.congestionTimeSamples,30),et=new MeasuredBitrateEvent(this.measuredBitrateSamples,30),el=new RecommendedBitrateEvent(this.recommendedBitrateSamples,30),eu=new ConnectionRTTEvent(this.rttSamples,30);this.analyticsTracker.batchEvents([p,_,Z,et,el,eu]),this.initializeSamples()}initializeSamples(){this.audioLatencySamples=new Samples,this.videoLatencySamples=new Samples,this.congestionTimeSamples=new Samples,this.measuredBitrateSamples=new Samples,this.recommendedBitrateSamples=new Samples,this.rttSamples=new Samples}};let Co=p=>{let t=p=>{var _;return(null===(_=p.deviceId)||void 0===_?void 0:_.startsWith("web-contents-media-stream"))?"tab":void 0},n=p=>{var _;return(null===(_=p.deviceId)||void 0===_?void 0:_.startsWith("window"))&&"window"===p.displaySurface?"window":void 0},r=p=>{var _;return(null===(_=p.deviceId)||void 0===_?void 0:_.startsWith("screen"))&&"monitor"===p.displaySurface?"screen":void 0};return(t(p)||n(p)||r(p)?void 0:"camera")||r(p)||n(p)||t(p)||"unknown"};function To(p,_){return p.find(p=>p.kind===_)}function Io(p){return"live"===(null==p?void 0:p.readyState)}(nL=nV||(nV={})).VIDEO="video",nL.AUDIO="audio";let MediaStreamManager=class MediaStreamManager{constructor(){this.mediaTracks=new Map([[nV.VIDEO,void 0],[nV.AUDIO,void 0]])}setTrack(p,_){this.mediaTracks.set(p,_)}getTrack(p){return this.mediaTracks.get(p)}};let SDPFmtpLine=class SDPFmtpLine{constructor(){this.levelAsymmetryAllowed=!1,this.packetisationMode=!1,this.profile="",this.level=0}extractVideoSdpFmtpLine(p){return p&&p.split("\r").join(";").split("\n").join(";").split(" ").join(";").split(";").map(p=>
3p.trim()).filter(Boolean).forEach(p=>{let _=p.split("=");if(2===_.length)switch(_[0]){case"level-asymmetry-allowed":"1"===_[1]?this.levelAsymmetryAllowed=!0:this.levelAsymmetryAllowed=!1;break;case"packetization-mode":"1"===_[1]?this.packetisationMode=!0:this.packetisationMode=!1;break;case"profile-level-id":this.profile=this.getProfileFromId(_[1]),this.level=this.getLevelFromId(_[1])}}),{levelAsymmetryAllowed:this.levelAsymmetryAllowed,packetisationMode:this.packetisationMode,profile:this.profile,level:this.level}}getProfileFromId(p){let _=p.substr(0,2),Z=p.substr(2,2);switch(_.substr(0,2)){case"42":return"baseline";case"4d":return"main";case"58":return"extended";case"64":return"high";case"6e":return"00"===Z?"high 10":"high 10 intra";case"7a":return"00"===Z?"high 42":"high 42 intra";case"f4":return"00"===Z?"high 44":"high 44 intra";default:return"unknown"}}getLevelFromId(p){return parseInt(p.substr(4,2),16)}};var nw,nN,nD,nP,nM,nL,nx,nU,nB,nj,nV,nF,Ao=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};(nG=nF||(nF={})).IDLE="idle",nG.EXECUTING="executing",nG.RECONNECTING="reconnecting";let BaseReconnectStrategy=class BaseReconnectStrategy{constructor(p,_=12e4,Z,et){this.state=nF.IDLE,this.failureCallback=()=>{},this.peerClient=p,this.timeout=_,this.logger=Z,this.emitter=et}onFailure(p){this.failureCallback=p}setStartConfig(p,_){this.ingestEndpoint=p,this.streamKey=_}execute(){let{id:p}=this;this.state===nF.IDLE&&(this.state=nF.EXECUTING,this.emitter.emit(tE.CONNECTION_STATE_CHANGE,tz.CONNECTING),this.logger.info({msg:"Starting execution of reconnect strategy.",id:p}),this.startTimeoutTimer(this.timeout),this.executeStrategy())}startTimeoutTimer(p){this.timeoutTimerId=window.setTimeout(()=>{this.state!==nF.IDLE&&(this.logger.info({msg:"Reconnect strategy timed out."}),this.stop(),this.emitter.emit(tE.CONNECTION_STATE_CHANGE,tz.FAILED),this.failureCallback())},p)}stop(){this.state=nF.IDLE,clearTimeout(this.timeoutTimerId),this.stopStrategy()}reconnect(){return Ao(this,void 0,void 0,function*(){if(this.ingestEndpoint&&this.streamKey){let p=this.peerClient.getConnectionState();try{this.logger.info({msg:"Attempting reconnect."}),p===tz.CONNECTED?this.logger.info({msg:"Already connected! Stopping reconnect strategy."}):(yield this.peerClient.start(this.ingestEndpoint,this.streamKey),this.logger.info({msg:"Reconnect succeeded!"})),this.stop()}catch(p){throw this.logger.error({err:p}),p}}})}isActive(){return this.state!==nF.IDLE}};let ExponentialBackoffStrategy=class ExponentialBackoffStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="ExponentialBackoffStrategy"}executeStrategy(){let p=5e3,t=()=>Ao(this,void 0,void 0,function*(){if(this.state===nF.EXECUTING)try{this.state=nF.RECONNECTING,yield this.reconnect()}catch(_){this.logger.warn({msg:"Attempted reconnect failed. Trying again in: ",nextRetry:p}),this.state=nF.EXECUTING,this.currentTimeoutId=window.setTimeout(t,p),p*=2}});this.currentTimeoutId=window.setTimeout(t,0)}stopStrategy(){clearTimeout(this.currentTimeoutId)}};let NetworkApiStrategy=class NetworkApiStrategy extends BaseReconnectStrategy{constructor(){super(...arguments),this.id="NetworkApiStrategy",this.onConnectionChange=()=>Ao(this,void 0,void 0,function*(){if(navigator.onLine&&this.state===nF.EXECUTING){this.state=nF.RECONNECTING;try{yield this.reconnect()}catch(p){this.logger.warn({msg:"Attempted reconnect failed."}),this.state=nF.EXECUTING}}})}executeStrategy(){navigator.connection.addEventListener("change",this.onConnectionChange),this.onConnectionChange()}stopStrategy(){navigator.connection.removeEventListener("change",this.onConnectionChange)}};let PeerClientReconnectStrategyFactory=class PeerClientReconnectStrategyFactory{static create(p,_=tf,Z,et){let{reconnect:el,timeout:eu}=_;if(el){let _=rd.getParser(navigator.userAgent).getBrowserName().toLowerCase();return["edge","chrome"].includes(_)&&navigator.connection?new NetworkApiStrategy(p,eu,Z,et):new ExponentialBackoffStrategy(p,eu,Z,et)}}};var nG,nH,No=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},Do=function(p,_,Z,et){if("a"===Z&&!et)throw TypeError("Private accessor was defined without a getter");if("function"==typeof _?p!==_||!et:!_.has(p))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Z?et:"a"===Z?et.call(p):et?et.value:_.get(p)};let Po=p=>!!p;function Mo(p){if(!p)throw Error("PeerConnection is not defined")}let nW={bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",enableDtlsSrtp:{exact:!0},enableRtpDataChannels:{exact:!1},optional:[{googHighStartBitrate:{exact:0}},{googPayloadPadding:{exact:!0}},{googScreencastMinBitrate:{exact:100}},{googCpuOveruseDetection:{exact:!0}},{googCpuOveruseEncodeUsage:{exact:!0}},{googCpuUnderuseThreshold:{exact:55}},{googCpuOveruseThreshold:{exact:85}},{enableDscp:{exact:!0}}]};let PeerClient=class PeerClient{constructor(p,_,Z,et,el){this.config=p,this.emitter=_,this.mediaStreamManager=Z,this.analyticsTracker=el,this.establishConnection=(p,_)=>No(this,void 0,void 0,function*(){var Z,et;Mo(this.peerConnection);try{let Z=yield this.peerConnection.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});yield this.handleLocalDescription(Z),yield this.sendSetupRequest(p,_,Z)}catch(p){if(p instanceof Error){null!==(Z=p.code)&&void 0!==Z||(p.code=ex.co
3de);let _=new BroadcastClientError(Object.assign(Object.assign({},ex),{name:p.name,message:p.message,code:null==p?void 0:p.code,cause:p}));throw(null===(et=this.reconnectStrategy)||void 0===et?void 0:et.isActive())||this.handleError(p.code,p.message),this.stop(),_}}}),this.getSessionId=()=>this.ingestSessionId,this.getConnectionState=()=>{var p;if(!this.peerConnection)return tz.NONE;let _=null===(p=this.reconnectStrategy)||void 0===p?void 0:p.isActive(),Z=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;switch(Z){case"new":return tz.NEW;case"closed":return tz.CLOSED;case"disconnected":return _?tz.CONNECTING:tz.DISCONNECTED;case"failed":return _?tz.CONNECTING:tz.FAILED;case"idle":return tz.IDLE;case"checking":case"connecting":return tz.CONNECTING;case"completed":case"connected":return tz.CONNECTED;default:return this.logger.warn({msg:"Unhandled connection state:",rawState:Z}),tz.IDLE}},this.onConnectionStateChange=()=>{var p;let _=this.getConnectionState();switch(_){case tz.CONNECTED:{this.emitter.emit(tE.CONNECTION_STATE_CHANGE,_);let Z=new Date;this.analyticsTracker.trackEvent(new ConnectionEstablishedEvent(Z,this.connectionStartDate,this.ingestSessionId));let et=this.mediaStreamManager.getTrack(nV.AUDIO),el=this.mediaStreamManager.getTrack(nV.VIDEO);if(el){let p=el.getSettings();this.analyticsTracker.trackEvent(new SessionVideoPropertiesEvent(p))}if(et){let p=et.getSettings();this.analyticsTracker.trackEvent(new SessionAudioPropertiesEvent(p))}((null===(p=this.peerConnection)||void 0===p?void 0:p.getSenders())||[]).forEach(p=>{var _;((null===(_=p.getParameters())||void 0===_?void 0:_.codecs)||[]).forEach(_=>{var Z;switch(null===(Z=p.track)||void 0===Z?void 0:Z.kind){case"video":{if(!el)break;let p=(new SDPFmtpLine).extractVideoSdpFmtpLine(_.sdpFmtpLine),Z=el.getSettings();this.analyticsTracker.trackEvent(new SessionVideoEncoderConfiguredEvent(Z,p,_));break}case"audio":if(!et)break;this.analyticsTracker.trackEvent(new SessionAudioEncoderConfiguredEvent(_))}})});break}case tz.CONNECTING:this.emitter.emit(tE.CONNECTION_STATE_CHANGE,_),this.connectionStartDate=new Date,this.disconnectionStartDate=void 0;break;case tz.FAILED:this.reconnectStrategy?this.reconnectStrategy.execute():(this.emitter.emit(tE.CONNECTION_STATE_CHANGE,_),this.handleTerminalConnectionFailure());break;case tz.DISCONNECTED:this.emitter.emit(tE.CONNECTION_STATE_CHANGE,_),this.disconnectionStartDate=new Date;break;default:this.emitter.emit(tE.CONNECTION_STATE_CHANGE,_)}},this.handleLocalDescription=p=>No(this,void 0,void 0,function*(){var _;return null===(_=this.peerConnection)||void 0===_?void 0:_.setLocalDescription(p)}),nH.set(this,p=>{if("string"!=typeof p)throw new BroadcastClientError(eF);try{new URL(p)}catch(p){throw new BroadcastClientError(eG)}}),this.logger=new ScopedLogger(et,e0.WEBRTC),this.createReconnectStrategy(p)}start(p,_){var Z;return No(this,void 0,void 0,function*(){Do(this,nH,"f").call(this,p);let et=[this.mediaStreamManager.getTrack(nV.VIDEO),this.mediaStreamManager.getTrack(nV.AUDIO)].filter(Po);if(this.createPeerConnection(),this.addTracks({tracks:et}),this.reconnectStrategy&&this.reconnectStrategy.setStartConfig(p,_),yield this.establishConnection(p,_),null===(Z=this.reconnectStrategy)||void 0===Z?void 0:Z.isActive()){let _=new URL(p);this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:_.hostname,port:_.port},t4.NETWORK_DISCONNECT))}})}stop(){var p,_,Z,et;this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stopStreamDataChannel&&"open"===this.stopStreamDataChannel.readyState&&this.stopStreamDataChannel.send(" "),[tz.NEW,tz.CONNECTING,tz.CONNECTED].includes(this.getConnectionState())&&this.emitter.emit(tE.CONNECTION_STATE_CHANGE,tz.CLOSED),null===(p=this.peerConnection)||void 0===p||p.close(),null===(_=this.peerConnection)||void 0===_||_.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(Z=this.peerConnection)||void 0===Z||Z.removeEventListener("iceconnectionstatechange",this.onConnectionStateChange),this.ingestSessionId=void 0,null===(et=this.reconnectStrategy)||void 0===et||et.stop()}addTracks(p){var _;if(Mo(this.peerConnection),!p)return;let Z=this.peerConnection.getSenders().map(p=>{var _;return null===(_=p.track)||void 0===_?void 0:_.id}),et=p.tracks.filter(p=>!Z.includes(p.id));for(let p of et)null===(_=this.peerConnection)||void 0===_||_.addTrack(p)}getReports(){var p;return No(this,void 0,void 0,function*(){try{let _=(yield null===(p=this.peerConnection)||void 0===p?void 0:p.getStats())||[],Z=[];return _.forEach(p=>{Z.push(p)}),Z}catch(p){return[]}})}sendSetupRequest(p,_,Z){var et;return No(this,void 0,void 0,function*(){let el=yield fetch(`${p}/v1/offer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Object.assign({offer:btoa(JSON.stringify(Z)),streamKey:_},this.config.streamConfig))});if(!el.ok){var eu;let p;throw eu=yield el.json(),p=new BroadcastClientError(Object.assign({},ex)),1007===(null==eu?void 0:eu.code)&&(p=new BroadcastClientError(Object.assign({},eB))),(null==eu?void 0:eu.message)&&(p.message=eu.message),p}let ed=yield el.json();(null==ed?void 0:ed.answer)&&(yield null===(et=this.peerConnection)||void 0===et?void 0:et.setRemoteDescription(JSON.parse(atob(ed.answer))),this.ingestSessionId=ed.ingestSessionId)})}handleTerminalConnectionFailure(){let p=new BroadcastClientError(eU);this.handleError(p.code,p.message)}handleError(p,_){this.analyticsTracker.trackEvent(new ErrorEvent({code:p,description:_,isFatal:!0})),this.emitter.emit(tE.ERROR,{code:p,message:_})}createPeerConnection(){var p;let _=this.getConnectionState(),Z=_!==tz.NONE,et=_!==tz.CLOSED,el=null===(p=this.reconnectStrategy)||void 0===p?void 0:p.isActive();Z&&et&&!el||(this.stateCheckInterval&&(clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0),this.stateCheckInterval=window.setInterval(()=>{let p=this.getConnectionState();if(this.reconnectStrategy&&p===tz.DISCONNECTED&&this.disconnectionStartDate){let p=Date.now()-this.disconnectionStartDate.getTime();this.logger.info({msg:"Time since disconnected:",timeSinceDisconnect:p}),p>1e4&&(this.disconnectionStartDate=void 0,this.reconnectStrategy.execute())}else p===tz.CLOSED&&(this.handleTerminalConnectionFailure(),clearInterval(this.stateCheckInterval),this.stateCheckInterval=void 0)},1e3),this.peerConnection=new RTCPeerConnection(nW),this.stopStreamDataChannel=this.peerConnection.createDataChannel
3("stopStream"),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onConnectionStateChange))}createReconnectStrategy(p){if(this.reconnectStrategy=PeerClientReconnectStrategyFactory.create(this,p.networkReconnectConfig,this.logger,this.emitter),this.reconnectStrategy){this.reconnectStrategy.onFailure(this.handleTerminalConnectionFailure.bind(this));let p=this.reconnectStrategy.id;this.logger.info({msg:"Using reconnect strategy:",strategyId:p})}}};nH=new WeakMap;var nq,n$,nK=n(5364);(nX=nq||(nq={})).CONFIG="config",nX.UPDATE="update",nX.START="start",nX.STOP="stop",(nY=n$||(n$={})).VIDEO_SEND="video/send",nY.VIDEO_RECEIVE="video/receive",nY.INSERT_SEI="insertSei";var nz=n(5512),nJ=n.n(nz);function Vo(){return nJ()('/*! For license information please see scheduler.worker.worker.js.LICENSE.txt */\n(()=>{"use strict";var i,t;!function(i){i.CONFIG="config",i.UPDATE="update",i.START="start",i.STOP="stop"}(i||(i={})),function(i){i.VIDEO_SEND="video/send",i.VIDEO_RECEIVE="video/receive",i.INSERT_SEI="insertSei"}(t||(t={}));const s=self;const n=new class Scheduler{constructor(){this.config={frameRate:60,isRunning:!1}}setConfig(i){this.config=Object.assign(Object.assign({},this.config),i),this.config.isRunning&&(this.stop(),this.start())}start(){this.config.isRunning||(this.intervalId=setInterval((()=>{s.postMessage({type:i.UPDATE})}),1e3/this.config.frameRate),this.config.isRunning=!0)}stop(){this.config.isRunning&&(clearInterval(this.intervalId),this.intervalId=void 0,this.config.isRunning=!1)}};s.addEventListener("message",(function(t){var s;if(null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.type)switch(t.data.type){case i.CONFIG:n.setConfig(t.data.payload||{});break;case i.START:n.start();break;case i.STOP:n.stop()}}))})();',"Worker",void 0,void 0)}var Go=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let BroadcastCanvasManager=class BroadcastCanvasManager{constructor(p,_,Z){this.config=p,this.mediaStreamManager=_,this.analyticsTracker=Z,this.handleWorkerEvent=p=>{var _;(null===(_=p.data)||void 0===_?void 0:_.type)===nq.UPDATE&&this.drawComposite()},this.mixer={video:[],audio:[]},this.schedulerWorker=new Vo,this.running=!1,this.compositeEl=document.createElement("canvas"),this.compositeEl.height=this.config.streamConfig.maxResolution.height,this.compositeEl.width=this.config.streamConfig.maxResolution.width;let et=this.compositeEl.getContext("2d");if(null===et)throw new BroadcastClientError(Object.assign({},eS));this.compositeContext=et,this.compositeStream=this.compositeEl.captureStream(0);let el=To(this.compositeStream.getTracks(),nV.VIDEO);this.audioContext=new AudioContext,this.unlockAudioContext(),this.audioDestination=this.audioContext.createMediaStreamDestination(),this.setupSilence();let eu=To(this.audioDestination.stream.getTracks(),nV.AUDIO);el&&this.mediaStreamManager.setTrack(nV.VIDEO,el),eu&&this.mediaStreamManager.setTrack(nV.AUDIO,eu),this.schedulerWorker.addEventListener("message",this.handleWorkerEvent),this.schedulerWorker.postMessage({type:nq.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.previewElement=null,this.previewCtx=null,this.nextMix=(new Date).getTime()}attachPreview(p){this.previewElement=p;let{width:_,height:Z}=this.config.streamConfig.maxResolution;this.previewElement.width=_,this.previewElement.height=Z,this.previewCtx=this.previewElement.getContext("2d")}detachPreview(){this.previewElement=null,this.previewCtx=null}setupSilence(){let p=this.audioContext.createConstantSource(),_=this.audioContext.createGain();_.gain.value=.001,p.connect(_),_.connect(this.audioDestination),p.start()}unlockAudioContext(){if("suspended"!==this.audioContext.state)return;let p=document.body,_=["touchstart","touchend","mousedown","keydown"],n=()=>{_.forEach(_=>{p.removeEventListener(_,r)})},r=()=>{this.audioContext.resume().then(n)};_.forEach(_=>{p.addEventListener(_,r,!1)})}getTracks(){return[this.mediaStreamManager.getTrack(nV.VIDEO),this.mediaStreamManager.getTrack(nV.AUDIO)]}getCanvasVideoTrack(){return this.mediaStreamManager.getTrack(nV.VIDEO)}getAudioInputDevice(p){if("string"!=typeof p)return;let _=this.mixer.audio.find(_=>{if(_.name===p)return _.source});return null==_?void 0:_.source}getVideoInputDevice(p){if("string"==typeof p)return this.mixer.video.find(_=>_.name===p)}getCanvasDimensions(){return{height:this.compositeEl.height,width:this.compositeEl.width}}addVideoInputDevice(p,_,Z){var et;return Go(this,void 0,void 0,function*(){if("object"!=typeof p)throw new BroadcastClientError(Object.assign({},eb));if(!_||"string"!=typeof _)throw new BroadcastClientError(Object.assign({},eR));if(this.mixer.video.some(p=>p.name===_))throw new BroadcastClientError(Object.assign({},eC));if(!Z)throw new BroadcastClientError(Object.assign({},eT));if("number"!=typeof Z.index)throw new BroadcastClientError(Object.assign({},eI));let el=function(){let p=document.createElement("video");return p.autoplay=!0,p.muted=!0,p.setAttribute("playsinline",""),p.setAttribute("webkit-playsinline",""),p}(),eu=p.getVideoTracks(),[ed]=eu;if(!eu.length)throw new BroadcastClientError(Object.assign({},e_));let eh=ed.getConstraints(),ep=nK({},eh,{frameRate:this.config.streamConfig.maxFramerate});try{yield ed.applyConstraints(ep)}catch(_){let p="Unknown constraints error";_ instanceof Error&&(p=_.message),this.analyticsTracker.trackEvent(new ErrorEvent({description:`${eA.message}: ${p}`,isFatal:!1,code:eA.code}))}let ef=new MediaStream([ed]);el.srcObject=ef;try{yield Go(this,void 0,void 0,function*(){let p=0;for(;p<5;)try{return void(yield el.play())}catch(_){if(!(_ instanceof Error))throw Error("unknown error trying to add video to broadcast");p++,yield new Promise(p=>setTimeout(p,150))}throw Error("Error playing video, tries exceeded")});let p=(null===(et=ed.getSettings)||void 0===et?void 0:et.call(ed))||{};this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent(Co(p),p)),this.mixer.video.push({name:_,element:el,position:Z,source:ef,render:!0})}catch(p){throw new BroadcastClientError(Object.assign(Object.assign({},e_),{cause:p}))}})}addImageSource(p,_,Z){var et;return Go(this,void 0,void 0,function*(){if(!p)throw new BroadcastClientError(Object.assign({},eb));if(!_||"string"!=typeof _)throw new BroadcastClientError(Object.assign({},eR));if("image"===p.tagName)throw new BroadcastClientError(Object.assign({},eO));if(this.mixer.video.some(p=>p.name===_))throw new BroadcastClientError(Object.assign({},eC));if(!Z)throw new BroadcastClientError(Object.assign({},eT));if("number"!=typeof Z.index)throw new BroadcastClientError(Object.assign({},eI));if(p instanceof Image){let _=null===(et=p.src)||void 0===et?void 0:et.slice();try{let _=p.src?new URL(p.src):{};if(_.host&&_.hostname){let _=yield fetch(p.src).then(p=>Go(this,void 0,void 0,function*(){return p.blob()})),Z=yield new Promise(p=>{let Z=new FileReader;Z.onload=()=>{p(Z.result)},Z.readAsDataURL(_)});p.src=Z}}catch(p){throw new BroadcastClientError(Object.assign(Object.assign({},eL),{params:{details:`Image URL: ${_}`}}))}}this.mixer.video.push({name:_,element:p,position:Z,render:!0})})}addAudioInputDevice(p,_){return Go(this,void 0,void 0,function*(){if("object"!=typeof p)throw new BroadcastClientError(Object.assign({},eb));if(!_||"string"!=typeof _)throw new BroadcastClientError(Object.assign({},eR));if(this.mixer.audio.some(p=>p.name===_))throw new BroadcastClientError(Object.assign({},eC));let Z=p.getAudioTracks();if(!Z.length)throw new BroadcastClientError(Object.assign({},ey));let et=this.audioContext.createMediaStreamSource(new MediaStream(Z)),el=this.audioContext.createGain();el.gain.value=1,et.connect(el),el.connect(this.audioDestination),this.analyticsTracker.trackEvent(new InputDeviceAttachedEvent("audio",{deviceId:p.id})),this.mixer.audio.push({name:_,source:p,audioTrackSource:et,gainNode:el})})}removeImage(p){let _=this.mixer.video.findIndex(_=>_.name===p);if(_<0)throw new BroadcastClientError(Object.assign({},ew));this.mixer.video.splice(_,1)}removeVideoInputDevice(p){var _;let Z=this.removeDevice(p,this.mixer.video);if(!Z)throw new BroadcastClientError(Object.assign({},ek));{let p=To(Z.source.getTracks(),nV.VIDEO);if(!p)throw new BroadcastClientError(Object.assign({},ek));Z.element.srcObject=null,p.stop();let et=(null===(_=null==p?void 0:p.getSettings)||void 0===_?void 0:_.call(p))||{};this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent(Co(et),et))}}removeAudioInputDevice(p){let _=this.removeDevice(p,this.mixer.audio);if(null==_?void 0:_.audioTrackSource){for(let p of _.source.getTracks())p.stop(),this.analyticsTracker.trackEvent(new InputDeviceDetachedEvent("audio",{deviceId:p.id}));_.gainNode.disconnect(this.audioDestination)}else if(!_)throw new BroadcastClientError(Object.assign({},ek))}updateVideoDeviceComposition(p,_){if(!p||"string"!=typeof p)throw new BroadcastClientError(Object.assign({},eP));if(!_)throw new BroadcastClientError(Object.assign({},eN));if("number"!=typeof _.index)throw new BroadcastClientError(Object.assign({},eD));this.mixer.video.forEach((Z,et)=>
3{Z.name===p&&(Z.position=_)})}exchangeVideoDevicePositions(p,_){let Z=this.getVideoInputDevice(p),et=this.getVideoInputDevice(_);if(!Z)throw new BroadcastClientError(Object.assign(Object.assign({},eM),{params:{details:`device with name: "${p}" not found`}}));if(!et)throw new BroadcastClientError(Object.assign(Object.assign({},eM),{params:{details:`device with name: "${_}" not found`}}));let el=Object.assign({},Z.position),eu=Object.assign({},et.position);for(let Z of this.mixer.video)Z.name===p&&(Ho(eu.x)?Z.position=Object.assign(Object.assign({},Z.position),eu):Z.position={index:eu.index}),Z.name===_&&(Ho(el.x)?Z.position=Object.assign(Object.assign({},Z.position),el):Z.position={index:el.index})}start(){this.running||(this.running=!0,this.schedulerWorker.postMessage({type:nq.CONFIG,payload:{frameRate:this.config.streamConfig.maxFramerate}}),this.schedulerWorker.postMessage({type:nq.START}))}stop(){this.running&&(this.running=!1,this.schedulerWorker.removeEventListener("message",this.handleWorkerEvent))}isCapturing(){return this.running}getAudioLatency(){return this.audioContext.baseLatency}getVideoLatency(){var p;return(null===(p=this.mediaStreamManager.getTrack(nV.VIDEO))||void 0===p?void 0:p.getConstraints().latency)||0}disableVideo(){this.mixer.video.forEach(p=>{p.render=!1})}enableVideo(){this.mixer.video.forEach(p=>{p.render=!0})}disableAudio(){this.mixer.audio.forEach(p=>{p.audioTrackSource&&(p.gainNode.gain.value=0)})}enableAudio(){this.mixer.audio.forEach(p=>{p.audioTrackSource&&(p.gainNode.gain.value=1)})}getDrawRegion(p,_,Z){var et,el,eu,ed;let eh=null!==(et=p.position.x)&&void 0!==et?et:0,ep=null!==(el=p.position.y)&&void 0!==el?el:0,ef=null!==(eu=p.position.width)&&void 0!==eu?eu:_-eh,eg=null!==(ed=p.position.height)&&void 0!==ed?ed:Z-ep,ev=ef/eg,em=p.element.width,eE=p.element.height;p.element instanceof HTMLVideoElement&&(em=p.element.videoWidth,eE=p.element.videoHeight);let eS=em/eE,e_=ef,ey=eg;return eS>ev?(e_=ef,ep+=(eg-(ey=2*Math.round(ef/eS/2)))/2):eS<ev&&(ey=eg,eh+=(ef-(e_=2*Math.round(eg*eS/2)))/2),{x:eh,y:ep,width:e_,height:ey}}drawComposite(){if(!this.shouldMix(new Date))return;this.compositeContext.clearRect(0,0,this.compositeEl.width,this.compositeEl.height),this.drawBlackScreen();let p=this.mixer.video.filter(p=>p.render);for(let _ of(p.sort((p,_)=>p.position.index-_.position.index),p)){let{x:p,y:Z,width:et,height:el}=this.getDrawRegion(_,this.compositeEl.width,this.compositeEl.height);this.compositeContext.drawImage(_.element,p,Z,et,el)}this.previewElement&&this.previewCtx&&this.previewCtx.drawImage(this.compositeEl,0,0,this.previewElement.width,this.previewElement.height),this.requestCanvasCapture()}requestCanvasCapture(){"function"==typeof this.compositeStream.requestFrame?this.compositeStream.requestFrame():this.mediaStreamManager.getTrack(nV.VIDEO).requestFrame()}drawBlackScreen(){this.compositeContext.fillStyle="#000000",this.compositeContext.fillRect(0,0,this.compositeEl.width,this.compositeEl.height)}removeDevice(p,_){let Z=_.findIndex(_=>_.name===p);if(!(Z<0))return _.splice(Z,1)[0]}shouldMix(p){if(p.getTime()<this.nextMix)return!1;for(;this.nextMix<=p.getTime();)this.nextMix+=1e3/this.config.streamConfig.maxFramerate;return!0}};function Ho(p){return Number.isSafeInteger(p)}var nX,nY,nQ,nZ,$o=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},Ko=function(p,_,Z,et){if("a"===Z&&!et)throw TypeError("Private accessor was defined without a getter");if("function"==typeof _?p!==_||!et:!_.has(p))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Z?et:"a"===Z?et.call(p):et?et.value:_.get(p)};let AmazonIVSBroadcastClient=class AmazonIVSBroadcastClient{constructor(p){this.config=p,nQ.add(this),this.emitter=new tv,this.isValid=!0,this.emitter.on(tE.ERROR,this.stopBroadcast),this.config.ingestEndpoint&&(this.url=new URL(this.config.ingestEndpoint)),this.analyticsTracker=new AnalyticsTracker,this.mediaStreamManager=new MediaStreamManager;let _=new Logger(p.logLevel,p.logger);this.peerClient=new PeerClient(this.config,this.emitter,this.mediaStreamManager,_,this.analyticsTracker),this.broadcastCanvasManager=new BroadcastCanvasManager(p,this.mediaStreamManager,this.analyticsTracker),this.peerStatsTracker=new PeerStatsTracker(this.peerClient,this.broadcastCanvasManager,_,this.analyticsTracker),this.broadcastCanvasManager.start(),Object.getOwnPropertyNames(AmazonIVSBroadcastClient.prototype).forEach(p=>{this[p]=new Proxy(this[p],{apply:(p,_,Z)=>
3{if(!_.isValid)throw new BroadcastClientError(Object.assign({},eq));return Reflect.apply(p,_,Z)}})}),window.addEventListener("beforeunload",()=>{this.analyticsTracker.stop(!0)})}delete(){this.isValid=!1,this.peerClient.stop(),this.broadcastCanvasManager.stop(),this.emitter.removeAllListeners()}startBroadcast(p,_){return $o(this,void 0,void 0,function*(){nR.markSdkUsage(),Ko(this,nQ,"m",nZ).call(this,p);let Z=gt(_||this.config.ingestEndpoint);this.analyticsTracker.start(),this.peerStatsTracker.start(),yield this.peerClient.start(Z,p),this.emitter.emit(tE.ACTIVE_STATE_CHANGE,!0),this.url=new URL(Z),this.url&&this.analyticsTracker.trackEvent(new StartBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port},t4.USER_INITIATED))})}stopBroadcast(){var p,_,Z;this.url&&this.analyticsTracker.trackEvent(new StopBroadcastEvent({protocol:"webrtc",hostname:this.url.hostname,port:this.url.port})),null===(p=this.peerStatsTracker)||void 0===p||p.stop(),null===(_=this.peerClient)||void 0===_||_.stop(),null===(Z=this.emitter)||void 0===Z||Z.emit(tE.ACTIVE_STATE_CHANGE,!1)}getCanvasDimensions(){return this.broadcastCanvasManager.getCanvasDimensions()}addVideoInputDevice(p,_,Z){return $o(this,void 0,void 0,function*(){return this.broadcastCanvasManager.addVideoInputDevice(p,_,Z)})}addImageSource(p,_,Z){return $o(this,void 0,void 0,function*(){return this.broadcastCanvasManager.addImageSource(p,_,Z)})}addAudioInputDevice(p,_){return $o(this,void 0,void 0,function*(){return this.broadcastCanvasManager.addAudioInputDevice(p,_)})}removeVideoInputDevice(p){this.broadcastCanvasManager.removeVideoInputDevice(p)}removeAudioInputDevice(p){this.broadcastCanvasManager.removeAudioInputDevice(p)}removeImage(p){this.broadcastCanvasManager.removeImage(p)}updateVideoDeviceComposition(p,_){this.broadcastCanvasManager.updateVideoDeviceComposition(p,_)}exchangeVideoDevicePositions(p,_){this.broadcastCanvasManager.exchangeVideoDevicePositions(p,_)}getAudioInputDevice(p){return this.broadcastCanvasManager.getAudioInputDevice(p)}getVideoInputDevice(p){return this.broadcastCanvasManager.getVideoInputDevice(p)}getConnectionState(){return this.peerClient.getConnectionState()}getSessionId(){return this.peerClient.getSessionId()}on(p,_){this.emitter.on(p,_)}off(p,_){this.emitter.off(p,_)}getAudioContext(){return this.broadcastCanvasManager.audioContext}attachPreview(p){this.broadcastCanvasManager.attachPreview(p)}detachPreview(){this.broadcastCanvasManager.detachPreview()}disableVideo(){this.broadcastCanvasManager.disableVideo()}enableVideo(){this.broadcastCanvasManager.enableVideo()}disableAudio(){this.broadcastCanvasManager.disableAudio()}enableAudio(){this.broadcastCanvasManager.enableAudio()}};function zo(p){return new AmazonIVSBroadcastClient(function(p){let _=new Config;return _.streamConfig=p.streamConfig,_.ingestEndpoint=p.ingestEndpoint,_.logger=p.logger,_.logLevel=p.logLevel,_.networkReconnectConfig=p.networkReconnectConfig,_}(p))}nQ=new WeakSet,nZ=function(p){if("string"!=typeof p||!/^[a-zA-Z0-9_-]+$/.test(p))throw new BroadcastClientError(ez)};let n0="1.38.0";(ix=iG||(iG={})).PUBLISH="publish",ix.SUBSCRIBE="subscribe",ix.JOIN="join",ix.LEAVE="leave",ix.EXCHANGE_TOKEN="exchange_token";let LeaveEvent=class LeaveEvent extends StageAnalyticsEvent{constructor(p){super(tg.LEAVE,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.LEAVE,event_endpoint:p.eventEndpoint,whip_endpoint:p.whipEndpoint,reason:p.reason}),this.critical=!0}};function es(p){let _="";for(let Z=0;Z<p;Z+=1)_+="0123456789abcdef".charAt(Math.floor(16*Math.random()));return _}let RequestUUID=class RequestUUID{constructor(){this.value=`${es(8)}-${es(4)}-${es(4)}-${es(4)}-${es(12)}`}};function ts(){return new RequestUUID}let TraceId=class TraceId{constructor(){let p=(Date.now()/1e3|0).toString(16);this.value=`1-${p}-${es(24)}`}};function ns(){return new TraceId}let HttpError=class HttpError extends Error{constructor(p){super(p.message),this.name="HttpError",this.status=p.status,this.statusText=p.statusText,this.data=p.data,this.url=p.url,this.code=p.code}static fromResponse(p,_,Z){return new HttpError({message:`HTTP Error ${p.status}`,status:p.status,statusText:p.statusText,data:_,url:p.url,code:Z})}};(iU=iH||(iH={})).MESSAGE="message",iU.RESPONSE="response",(iB=iW||(iW={})).STAGE_DELETED="STAGE_DELETED",iB.PARTICIPANT_DISCONNECTED="PARTICIPANT_DISCONNECTED",iB.TOKEN_INVALID="TOKEN_INVALID",iB.TOKEN_EXPIRED="TOKEN_EXPIRED",iB.TOKEN_INVALID_SIGNATURE="TOKEN_INVALID_SIGNATURE",iB.TOKEN_MISSING="TOKEN_MISSING",iB.INTERNAL="INTERNAL",iB.BAD_REQUEST="BAD_REQUEST",(ij=iq||(iq={}))[ij.BAD_REQUEST=400]="BAD_REQUEST",ij[ij.UNAUTHORIZED=401]="UNAUTHORIZED",ij[ij.FORB
3IDDEN=403]="FORBIDDEN",ij[ij.NOT_FOUND=404]="NOT_FOUND",ij[ij.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR";let StageClientError=class StageClientError extends BroadcastClientError{constructor({token:p,traceId:_,code:Z,tag:et,location:el,message:eu,details:ed,remoteParticipantId:eh,requestUUID:ep,fatal:ef,nominal:eg,action:ev,count:em=1}){super({name:"StageClientError",message:eu,code:Z}),Error.captureStackTrace&&Error.captureStackTrace(this,StageClientError),this.action=ev,this.token=p,this.traceId=_,this.code=Z,this.tag=et,this.location=el,this.message=eu,this.details=ed,this.remoteParticipantId=eh,this.requestUUID=ep,this.fatal=ef,this.nominal=eg,this.count=em}};let n1="signalling_session",n2="webrtc_sink",n3="webrtc_source",n4="token_exchange";function ds(p,_){switch(p){case iG.PUBLISH:return n2;case iG.SUBSCRIBE:return`webrtc_source:${_}`;default:return"unknown"}}function hs(p,_){var Z,et,el,eu;let ed={code:p.code,message:`${p.message}: ${_.name} ${_.message}`,fatal:null!==(Z=p.fatal)&&void 0!==Z&&Z,nominal:null!==(et=p.nominal)&&void 0!==et&&et};return _ instanceof StageClientError&&(ed.fatal=null!==(el=_.fatal)&&void 0!==el&&el,ed.nominal=null!==(eu=_.nominal)&&void 0!==eu&&eu),ed}function ps(p,_){if(0===p)return n5.NETWORK_FAILURE;if(!(p<400)){if(p>=400&&p<=403)switch(_){case i$.TokenExpired:return n5.EXPIRED_TOKEN;case i$.NoPermissions:return n5.TOKEN_PERMISSIONS_DENIED;case i$.StageAtCapacity:return n5.STAGE_AT_CAPACITY;case i$.NoMatchingCodec:return n5.NO_MATCHING_CODEC;default:return n5.UNKNOWN_SERVER_ERROR}else{if(404===p)return _===i$.RemoteStreamNotFound?n5.REMOTE_STREAM_NOT_FOUND:n5.UNKNOWN_SERVER_ERROR;if(412===p)return _===i$.AbortedMHCPError?n5.MHCP_ABORTED:n5.UNKNOWN_SERVER_ERROR;if(429===p)return _===i$.StageAuthThrottled?n5.STAGE_AUTH_THROTTLED:n5.WHIP_TOO_MANY_REQUESTS;if(500!==p)return n5.UNKNOWN_SERVER_ERROR;switch(_){case i$.InternalMHCPError:return n5.INTERNAL_MHCP_ERROR;case i$.UnreachableMHCP:return n5.UNREACHABLE_MHCP;case i$.InvalidSessionStatus:return n5.INVALID_SESSION_STATUS;default:return n5.INTERNAL_SERVER_ERROR}}}}(iV=i$||(i$={}))[iV.Unspecified=2001]="Unspecified",iV[iV.TokenExpired=2002]="TokenExpired",iV[iV.NoPermissions=2003]="NoPermissions",iV[iV.RemoteStreamNotFound=2004]="RemoteStreamNotFound",iV[iV.StageAtCapacity=2005]="StageAtCapacity",iV[iV.InternalMHCPError=2006]="InternalMHCPError",iV[iV.UncategorizedMHCPError=2007]="UncategorizedMHCPError",iV[iV.UnreachableMHCP=2008]="UnreachableMHCP",iV[iV.InvalidSessionStatus=2010]="InvalidSessionStatus",iV[iV.PostWithoutOptions=2011]="PostWithoutOptions",iV[iV.AbortedMHCPError=2012]="AbortedMHCPError",iV[iV.StageAuthThrottled=2013]="StageAuthThrottled",iV[iV.NoMatchingCodec=2014]="NoMatchingCodec";let n5={MALFORMED_TOKEN:{code:1e3,message:"Token is malformed",fatal:!0,nominal:!0},EXPIRED_TOKEN:{code:1001,message:"Token expired and is no longer valid",fatal:!0,nominal:!0},STAGE_DELETED:{code:1037,message:"Stage has been deleted",fatal:!0,nominal:!0},PARTICIPANT_DISCONNECTED:{code:1038,message:"Participant has been disconnected",fatal:!0,nominal:!0},JOIN_SERVER_INTERNAL_ERROR:{code:1039,message:"Internal server error during join",fatal:!1,nominal:!1},JOIN_SERVER_BAD_REQUEST:{code:1040,message:"Bad request during join",fatal:!0,nominal:!1},UNPUBLISH_FAILURE:{code:1013,message:"Failed to unpublish",fatal:!1,nominal:!1},UNSUBSCRIBE_FAILURE:{code:1014,message:"Failed to unsubscribe",fatal:!1,nominal:!1},PUBLISH_FAILURE:{code:1015,message:"Failed to publish",fatal:!1,nominal:!1},SUBSCRIBE_FAILURE:{code:1016,message:"Failed to subscribe",fatal:!1,nominal:!1},JOIN_FAILURE:{code:1017,message:"Failed to join",fatal:!0,nominal:!1},JOIN_TIMED_OUT:{code:1019,message:"Join timed out",fatal:!0,nominal:!1},PUBLISH_TIMED_OUT:{code:1020,message:"Publish timed out",fatal:!1,nominal:!1},SUBSCRIBE_TIMED_OUT:{code:1021,message:"Subscribe timed out",fatal:!1,nominal:!1},OPERATION_ABORTED:{code:1023,message:"Request aborted",fatal:!1,nominal:!0},STAGE_AT_CAPACITY:{code:1024,message:"Stage at capacity",fatal:!0,nominal:!0},INTERNAL_SERVER_ERROR:{code:1025,message:"Internal server error",fatal:!0,nominal:!1},TOKEN_PERMISSIONS_DENIED:{code:1026,message:"Token permissions are not valid for the operation",fatal:!0,nominal:!1},REMOTE_STREAM_NOT_FOUND:{code:1027,message:"Contributor group (PUBLISH) or remote stream (SUBSCRIBE) not found",fatal:!0,nominal:!1},INTERNAL_MHCP_ERROR:{code:1028,message:"Authorization failed due to internal MHCP error",fatal:!0,nominal:!1},UNREACHABLE_MHCP:{code:1030,message:"Authorization failed due to MHCP unreachable",fatal:!0,nominal:!1},INVALID_SESSION_STATUS:{code:1031,message:"Stream has already been published (PUBLISH) or subscribed to (SUBSCRIBE)",fatal:!0,nominal:!1},MHCP_ABORTED:{code:1033,message:"Publisher state conflict",fatal:!0,nominal:!1},STAGE_AUTH_THROTTLED:{code:1034,message:"Too many requests",fatal:!1,nominal:!1},NO_MATCHING_CODEC:{code:1035,message:"No matching codec found",fatal:!0,nominal:!1},UNKNOWN_SERVER_ERROR:{code:1099,message:"Service error code unknown or not found",fatal:!0,nominal:!1},XDP_CONNECTION_LOST:{code:1221,message:"Connection lost during SDP exchange",fatal:!1,nominal:!1},XDP_INVALID_ANSWER_MSG:{code:1222,message:"Invalid answer message received by client",fatal:!1,nominal:!1},XDP_TIMEOUT:{code:1223,message:"Failed to receive SDP answer within timeout peri
3od",fatal:!1,nominal:!1},XDP_UNEXPECTED_ERROR:{code:1224,message:"Unexpected error encountered",fatal:!1,nominal:!1},WEBSOCKET_MESSAGE_PARSE_FAILURE:{code:1204,message:"Failed to parse websocket message",fatal:!1,nominal:!1},WHIP_TOO_MANY_REQUESTS:{code:1207,message:"WHIP endpoint received too many requests",fatal:!1,nominal:!1},WHIP_POST_FAILURE:{code:1502,message:"WHIP post failure",fatal:!1,nominal:!1},WHIP_DELETE_FAILURE:{code:1503,message:"WHIP delete failure",fatal:!1,nominal:!1},WHIP_URL_MISSING:{code:1504,message:"WHIP delete failure",fatal:!1,nominal:!1},WHEP_SET_LAYER_REQUEST_FAILED:{code:1510,message:"Set layer request failed for reason: Unknown",fatal:!1,nominal:!1},WHEP_SET_LAYER_REQUEST_THROTTLED:{code:1511,message:"Too many set layer requests",fatal:!1,nominal:!0},WHEP_GET_LAYER_STATE_FAILED:{code:1512,message:"Get layer state failed for reason: Unknown",fatal:!1,nominal:!1},WHEP_GET_LAYER_STATE_THROTTLED:{code:1513,message:"Too many get layer state requests",fatal:!1,nominal:!0},EVENT_PLANE_WS_CREATE_FAILED:{code:1300,message:"Error creating WebSocket",fatal:!0,nominal:!1},EVENT_PLANE_WS_UNEXPECTED_CLOSE:{code:1302,message:"Unexpectedly not connected to event plane",fatal:!1,nominal:!1},EVENT_PLANE_PONG_TIMEOUT:{code:1304,message:"Pong timed out",fatal:!1,nominal:!1},EVENT_PLANE_WS_CLOSE_BEFORE_OPEN:{code:1305,message:"Connect attempt closed by server",fatal:!1,nominal:!1},PEER_CONNECTION_NETWORK_FAILURE:{code:1400,message:"PeerConnection is lost due to unknown network error",fatal:!1,nominal:!1},CREATE_OFFER_FAILURE:{code:1402,message:"Failed to set local description",fatal:!1,nominal:!1},CREATE_PEER_CONNECTION_FAILURE:{code:1403,message:"Failed to create a peer connection",fatal:!1,nominal:!1},ICE_CANDIDATE_ERROR:{code:1404,message:"ICE candidate error",fatal:!1,nominal:!1},SET_ANSWER_FAILURE:{code:1405,message:"Failed to set remote answer",fatal:!1,nominal:!1},NETWORK_FAILURE:{code:1406,message:"Failed due to network problem",fatal:!1,nominal:!1},SEI_INSERT_NOT_PUBLISHING_VIDEO:{code:1460,message:"SEI failed to insert due to not publishing video",fatal:!1,nominal:!0},SEI_INSERT_INBAND_NOT_ENABLED:{code:1461,message:"SEI failed to insert due to in-band messaging not being enabled",fatal:!1,nominal:!0},REASSIGNMENT_REQUEST_INVALID_LOCAL_PARTICIPANT_ID:{code:1470,message:"Invalid participant id in the reassignment message",fatal:!1,nominal:!1},REASSIGNMENT_REQUEST_INVALID_REMOTE_PARTICIPANT_ID:{code:1471,message:"Invalid remote participant id in the reassignment message",fatal:!1,nominal:!1},REASSIGNMENT_REQUEST_INVALID_REMOTE_PEER_CONNECTION_STATE:{code:1472,message:"Invalid subscriber peer connection state for reassignment",fatal:!1,nominal:!1},REASSIGNMENT_REQUEST_ALREADY_IN_PROGRESS:{code:1473,message:"Request rejected because client is already processing a previous reassignment request",fatal:!1,nominal:!1},UNEXPECTED_ERROR:{code:9999,message:"Encountered unexpected error condition. Expected StageClientError type.",fatal:!1,nominal:!1},TRANSFORM_UNEXPECTED_ERROR:{code:1480,message:"Unexpected error occurred during transform execution",fatal:!1,nominal:!1},TRANSFORM_TOO_MANY_ERRORS:{code:1481,message:"Transformer encountered too many consecutive errors",fatal:!1,nominal:!1},TRANSFORM_NOT_SUPPORTED_BY_PLATFORM:{code:1482,message:"Transforms are not supported by this platform",fatal:!1,nominal:!1},CODEC_HANDLE_INCOMPATIBLE_UNEXPECTED_ERROR:{code:1490,message:"Unexpected error occurred when handling incompatible codecs",fatal:!1,nominal:!1},EXCHANGE_TOKEN_INVALID:{code:1051,message:"Invalid token provided for exchange",fatal:!1,nominal:!0},EXCHANGE_TOKEN_INCOMPATIBLE_TOKEN:{code:1052,message:"Token exchange failed: incompatible token",fatal:!1,nominal:!0},EXCHANGE_TOKEN_FAILED_INVALID:{code:1230,message:"Invalid response returned by remote server",fatal:!0,nominal:!1},EXCHANGE_TOKEN_FAILED:{code:1231,message:"Token exchange failed",fatal:!0,nominal:!1},EXCHANGE_TOKEN_TIMEOUT:{code:1232,message:"Token exchange timed out",fatal:!0,nominal:!1}};function ms(p){var _,Z;let et;switch(p.code){case iW.TOKEN_EXPIRED:et=n5.EXPIRED_TOKEN;break;case iW.TOKEN_INVALID:case iW.TOKEN_INVALID_SIGNATURE:case iW.TOKEN_MISSING:et=n5.MALFORMED_TOKEN;break;case iW.STAGE_DELETED:et=n5.STAGE_DELETED;break;case iW.PARTICIPANT_DISCONNECTED:et=n5.PARTICIPANT_DISCONNECTED;break;case iW.INTERNAL:et=n5.JOIN_SERVER_INTERNAL_ERROR;break;case iW.BAD_REQUEST:et=n5.JOIN_SERVER_BAD_REQUEST;break;default:et=Object.assign(Object.assign({},n5.JOIN_FAILURE),{message:p.message||n5.JOIN_FAILURE.message})}return Object.assign(Object.assign({},et),{fatal:null!==(_=p.fatal)&&void 0!==_?_:et.fatal,nominal:null!==(Z=p.nominal)&&void 0!==Z?Z:et.nominal})}(iF=iK||(iK={})).UNPUBLISH="unpublish",iF.UNSUBSCRIBE="unsubscribe",iF.UNLOAD="unload",iF.CONNECTION_FAIL="connection fail",iF.REASSIGNMENT="reassignment";let n9="stageJoined",n6="stageParticipantJoined",n8="stageParticipantLeft",n7="stageParticipantKicked",is="stageParticipantUpdated",il="localPublishingChanged",iu="stateChange",id="error",ih="reassignmentRequest",ip="incompatibleCodecs",ig="subscriberCountChanged",iv="connectionStateChange",im="mediaStreamCreated",iE="mediaStreamRemoved",iS="error",i_="stageStreamSeiMessageReceived",iy="transformError",ib="reassignmentStarted",iC="reassignmentSuccess",iT="reassignmentFailed",iI="open",iR="closed",iO="messageParseError",iA="error",ik="stageStateMessage",iw="sdpAnswer",iN="disconnectMessage",iD="reassignmentMessage",iP="incompatibleCodecs",iM="subscriberCountMessage",iL="exchangeTokenMessage";function Ys(p){let _=p.replace(/-/g,"+").replace(/_/g,"/").padEnd(p.length+(4-p.length%4)%4,"=");return window.atob(_)}let Xs=(p,_,Z,et)=>{let el=null!=_?_:{},eu=null!=et?et:{},ed=Object.keys(el),eh=Object.keys(eu);return{userIdChanged:p!==Z,attributesChanged:ed.length!==eh.length||ed.some(p=>el[p]!==eu[p])}};var ix,iU,iB,ij,iV,iF,iG,iH,iW,iq,i$,iK,iz,iJ,iX,iY,iQ,ra=function(p,_,Z,et,el){if("m"===et)throw TypeError("Private method is not writable");if("a"===et&&!el)throw TypeError("Private accessor was defined without a setter");if("function"==typeof _?p!==_||!el:!_.has(p))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===et?el.call(p,Z):el?el.value=Z:_.set(p,Z),Z},ia=function(p,_,Z,et){if("a"===Z&&!et)throw TypeError("Private accessor was defined without a getter");if("function"==typeof _?p!==_||!et:!_.has(p))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Z?et:"a"===Z?et.call(p):et?et.value:_.get(p)};let StageTokenData=class StageTokenData{constructor(p,_){var Z;this.analyticsTracker=_,this.rawToken=p;let et=p.split(".");if(3!==et.length)throw Error(`Token format incorrect. length: ${et.length}`);try{this.header=JSON.parse(Ys(et[0]))}catch(_){let p=_ instanceof Error?`: ${_.message}`:"";throw Error(`Error parsing Stage Token header${p}`)}try{this.claims=JSON.parse(Ys(et[1]))}catch(_){let p=_ instanceof Error?`: ${_.message}`:"";throw Error(`Error parsing Stage Token claims${p}`)}this.signature=et[2];let{claims:el}=this;this.stageARN=el.resource,this.customerId=null!==(Z=function(p){if(0>p.indexOf("arn:aws:"))return;let _=p.split(":");return _.length>=5?_[4]:void 0}(this.stageARN))&&void 0!==Z?Z:"unknown",this.participantID=el.jti,this.eventsURL=Rt()||el.events_url,this.whipURL=It()||el.whip_url,this.userID=el.user_id,this.expirationTime=el.exp,this.topic=el.topic,this.parseVersionFlags(el.version);let{attributes:eu}=el;
3eu&&(this.attrGsRole=eu.gs_role,this.attrGsSessionId=eu.gs_session_id)}getPublishEndpoint(){let p="";return this.whipURL&&this.participantID&&(p=`${this.whipURL}/publish/${this.participantID}`),p}getSubscribeEndpoint(p){let _="";return this.whipURL&&(_=`${this.whipURL}/subscribe/${p}`),_}assertTokenIsUnexpired(p,_,Z,et){Ut()||(!this.expirationTime||Date.now()/1e3>=this.expirationTime)&&this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},n5.EXPIRED_TOKEN),{action:iG.JOIN,location:Z,tag:_,token:this,traceId:p,remoteParticipantId:et,message:n5.EXPIRED_TOKEN.message,details:`Token expired at ${this.expirationTime} and is no longer valid`})))}parseVersionFlags(p){if(!p)return;let _=p.split(".");2===_.length&&(this.versionFlags=parseInt(_[1],10))}shouldSendSilentAudio(){return void 0===this.versionFlags||!!(2&this.versionFlags)}};let StageTokenRefImpl=class StageTokenRefImpl{constructor(p,_){iz.set(this,void 0),ra(this,iz,new StageTokenData(p,_),"f")}update(p){ra(this,iz,p,"f")}getSnapshot(){return Object.assign({},ia(this,iz,"f"))}get header(){return ia(this,iz,"f").header}get signature(){return ia(this,iz,"f").signature}get participantID(){return ia(this,iz,"f").participantID}get rawToken(){return ia(this,iz,"f").rawToken}get topic(){return ia(this,iz,"f").topic}get stageARN(){return ia(this,iz,"f").stageARN}get eventsURL(){return ia(this,iz,"f").eventsURL}get whipURL(){return ia(this,iz,"f").whipURL}get customerId(){return ia(this,iz,"f").customerId}get claims(){return ia(this,iz,"f").claims}get versionFlags(){return ia(this,iz,"f").versionFlags}get userID(){return ia(this,iz,"f").userID}get expirationTime(){return ia(this,iz,"f").expirationTime}get attrGsRole(){return ia(this,iz,"f").attrGsRole}get attrGsSessionId(){return ia(this,iz,"f").attrGsSessionId}assertTokenIsUnexpired(p,_,Z,et){ia(this,iz,"f").assertTokenIsUnexpired(p,_,Z,et)}getPublishEndpoint(){return ia(this,iz,"f").getPublishEndpoint()}getSubscribeEndpoint(p){return ia(this,iz,"f").getSubscribeEndpoint(p)}shouldSendSilentAudio(){return ia(this,iz,"f").shouldSendSilentAudio()}};iz=new WeakMap,(i5=iJ||(iJ={})).PUBLISH="publish",i5.SUBSCRIBE="subscribe",(i9=iX||(iX={})).STARTED="started",i9.SUCCEEDED="succeeded",i9.FAILED="failed";let TokenExchangeEvent=class TokenExchangeEvent extends StageAnalyticsEvent{constructor(p){super(tg.TOKEN_EXCHANGE,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.EXCHANGE_TOKEN,status:p.status,request_id:p.requestId}),void 0!==p.durationMs&&(this.properties.duration_ms=p.durationMs),p.reason&&(this.properties.reason=p.reason)}};(i6=iY||(iY={})).JOIN_ERROR="JOIN_ERROR",i6.PUBLISH_ERROR="PUBLISH_ERROR",i6.SUBSCRIBE_ERROR="SUBSCRIBE_ERROR",(i8=iQ||(iQ={}))[i8.TOKEN_MALFORMED=1]="TOKEN_MALFORMED",i8[i8.TOKEN_EXPIRED=2]="TOKEN_EXPIRED",i8[i8.TIMEOUT=3]="TIMEOUT",i8[i8.FAILED=4]="FAILED",i8[i8.CANCELED=5]="CANCELED",i8[i8.STAGE_AT_CAPACITY=6]="STAGE_AT_CAPACITY",i8[i8.CODEC_MISMATCH=7]="CODEC_MISMATCH",i8[i8.TOKEN_NOT_ALLOWED=8]="TOKEN_NOT_ALLOWED",i8[i8.STAGE_DELETED=9]="STAGE_DELETED",i8[i8.PARTICIPANT_DISCONNECTED=10]="PARTICIPANT_DISCONNECTED",i8[i8.TOKEN_EXCHANGE_REQUEST_INVALID=11]="TOKEN_EXCHANGE_REQUEST_INVALID",i8[i8.TOKEN_EXCHANGE_FAILED=12]="TOKEN_EXCHANGE_FAILED";let iZ={[iQ.TOKEN_MALFORMED]:"Token is malformed",[iQ.TOKEN_EXPIRED]:"Token expired and is no longer valid",[iQ.TIMEOUT]:"Operation timed out",[iQ.FAILED]:"Operation failed",[iQ.CANCELED]:"Operation canceled",[iQ.STAGE_AT_CAPACITY]:"Stage at capacity",[iQ.CODEC_MISMATCH]:"Client codec is not supported",[iQ.TOKEN_NOT_ALLOWED]:"Token not allowed to perform operation",[iQ.STAGE_DELETED]:"Stage has been deleted, unable to join",[iQ.PARTICIPANT_DISCONNECTED]:"Participant has been disconnected, unable to join",[iQ.TOKEN_EXCHANGE_REQUEST_INVALID]:"Token exchange failed due to invalid or incompatible token",[iQ.TOKEN_EXCHANGE_FAILED]:"Token exchange failed"},i0={[n5.EXPIRED_TOKEN.code]:iQ.TOKEN_EXPIRED,[n5.MALFORMED_TOKEN.code]:iQ.TOKEN_MALFORMED,[n5.JOIN_SERVER_BAD_REQUEST.code]:iQ.FAILED,[n5.TOKEN_PERMISSIONS_DENIED.code]:iQ.TOKEN_NOT_ALLOWED,[n5.OPERATION_ABORTED.code]:iQ.CANCELED,[n5.JOIN_TIMED_OUT.code]:iQ.TIMEOUT,[n5.STAGE_DELETED.code]:iQ.STAGE_DELETED,[n5.PARTICIPANT_DISCONNECTED.code]:iQ.PARTICIPANT_DISCONNECTED,[n5.EVENT_PLANE_WS_CREATE_FAILED.code]:iQ.FAILED,[n5.EXCHANGE_TOKEN_INVALID.code]:iQ.TOKEN_EXCHANGE_REQUEST_INVALID,[n5.EXCHANGE_TOKEN_INCOMPATIBLE_TOKEN.code]:iQ.TOKEN_EXCHANGE_REQUEST_INVALID,[n5.EXCHANGE_TOKEN_FAILED_INVALID.code]:iQ.TOKEN_EXCHANGE_FAILED,[n5.EXCHANGE_TOKEN_FAILED.code]:iQ.TOKEN_EXCHANGE_FAILED,[n5.EXCHANGE_TOKEN_TIMEOUT.code]:iQ.TOKEN_EXCHANGE_FAILED,[n5.PUBLISH_TIMED_OUT.code]:iQ.TIMEOUT,[n5.PUBLISH_FAILURE.code]:iQ.FAILED,[n5.SUBSCRIBE_TIMED_OUT.code]:iQ.TIMEOUT,[n5.SUBSCRIBE_FAILURE.code]:iQ.FAILED,[n5.STAGE_AT_CAPACITY.code]:iQ.STAGE_AT_CAPACITY,[n5.NO_MATCHING_CODEC.code]:iQ.CODEC_MISMATCH,[n5.NETWORK_FAILURE.code]:iQ.FAILED,[n5.INTERNAL_SERVER_ERROR.code]:iQ.FAILED,[n5.REMOTE_STREAM_NOT_FOUND.code]:iQ.FAILED,[n5.INTERNAL_MHCP_ERROR.code]:iQ.FAILED,[n5.UNREACHABLE_MHCP.code]:iQ.FAILED,[n5.INVALID_SESSION_STATUS.code]:iQ.FAILED,[n5.MHCP_ABORTED.code]:iQ.FAILED,[n5.EVENT_PLANE_PONG_TIMEOUT.code]:iQ.FAILED,[n5.EVENT_PLANE_WS_UNEXPECTED_CLOSE.code]:iQ.FAILED},i1={[n5.SEI_INSERT_NOT_PUBLISHING_VIDEO.code]:"SEI insert failed due to not publishing video",[n5.SEI_INSERT_INBAND_NOT_ENABLED.code]:"SEI insert failed due to in-band messaging not being enabled for the stage stream"};let stage_error_manager_StageErrorEvent=class stage_error_manager_StageErrorEvent extends
3Error{constructor(p,_,Z){super(),this.code=p,this.category=_,this.message=Z,this.name="StageError",this.errorDetails=[],this.message=`[${_}] ${Z}`}addDetails(p){this.errorDetails.push(p)}get details(){return this.errorDetails.length?JSON.stringify(this.errorDetails):""}toString(){return` 4${this.message} 5details - ${this.details} 6 `.trim()}};(on||(on={})).ERROR="error";let StageErrorManager=class StageErrorManager extends TypedEmitter{constructor(p){super(),this.logger=p,this.handleError=(p,_,Z=!0)=>{let et;let el=(p instanceof StageClientError&&(et=i1[p.code]),et),eu=function(p,_){let Z;if(p instanceof StageClientError){if(_===iY.JOIN_ERROR&&(p.code===n5.EVENT_PLANE_PONG_TIMEOUT.code||p.code===n5.EVENT_PLANE_WS_UNEXPECTED_CLOSE.code))return;let et=i0[p.code];et&&(Z=function(p,_,Z){var et,el,eu;let ed=iZ[p],eh=new stage_error_manager_StageErrorEvent(p,_,ed);return eh.addDetails({stageErrorMessage:ed,stageErrorCode:p,stageErrorCategory:_,stageArn:null===(et=Z.token)||void 0===et?void 0:et.stageARN,traceId:null===(el=Z.traceId)||void 0===el?void 0:el.value,causeCode:Z.code,causeDetails:Z.details,causeMessage:Z.message,causeLocation:Z.location,participantId:null===(eu=Z.token)||void 0===eu?void 0:eu.participantID,timeUTC:(new Date).toISOString()}),eh}(et,_,p))}return Z}(p,_);if(el&&this.logger.warn({msg:el}),eu)return Z&&this.emit(on.ERROR,eu),eu}}};let ExchangeTracker=class ExchangeTracker{constructor(p,_,Z){this.analyticsTracker=p,this.tokenRef=_,this.errorManager=Z}trackExchange(){let{analyticsTracker:p,errorManager:_}=this,Z=this.tokenRef.getSnapshot(),et=ns(),el=ns(),eu=Date.now();return{getTraceId:()=>et,getRequestId:()=>el.value,trackStarted(){p.trackEventNoSharedProps(new TokenExchangeEvent({token:Z,traceId:et,status:iX.STARTED,requestId:el.value}))},trackValidationFailed(_){let ed=Date.now()-eu;p.trackEventNoSharedProps(new TokenExchangeEvent({token:Z,traceId:et,status:iX.FAILED,requestId:el.value,durationMs:ed,reason:_.message}))},trackSucceeded(_){p.trackEventNoSharedProps(new TokenExchangeEvent({token:Z,traceId:et,status:iX.SUCCEEDED,requestId:el.value,durationMs:_}))},trackServerFailed(_,eu){p.trackEventNoSharedProps(new TokenExchangeEvent({token:Z,traceId:et,status:iX.FAILED,requestId:el.value,durationMs:eu,reason:_ instanceof Error?_.message:"Unknown error"}))},createParseError(p){var el;let eu=new StageClientError(Object.assign(Object.assign({action:iG.EXCHANGE_TOKEN,token:Z,traceId:et,tag:n4,location:"Stage.exchangeToken"},n5.EXCHANGE_TOKEN_INVALID),{details:p instanceof Error?p.message:"Unknown parse error"}));return null!==(el=_.handleError(eu,iY.JOIN_ERROR))&&void 0!==el?el:eu},createValidationError(p){var el;let eu=new StageClientError(Object.assign(Object.assign({action:iG.EXCHANGE_TOKEN,token:Z,traceId:et,tag:n4,location:"Stage.exchangeToken"},n5.EXCHANGE_TOKEN_INCOMPATIBLE_TOKEN),{details:p.join(", ")}));return null!==(el=_.handleError(eu,iY.JOIN_ERROR))&&void 0!==el?el:eu}}}};let ThrottleTimer=class ThrottleTimer{constructor(p,_){this.throttleDuration=0,this.throttled=!1,this.timeout=0,this.unthrottle=()=>{this.trailing&&this.trailingFn&&this.trailingFn(...this.trailingFnArgs),this.clear()},this.throttleDuration=p,this.trailing=!(_&&_.skipTrailing)}invoke(p,..._){return this.throttled?(this.trailingFn=p,this.trailingFnArgs=_,!1):(this.throttled=!0,this.timeout=window.setTimeout(this.unthrottle,this.throttleDuration),p(..._),!0)}clear(){clearTimeout(this.timeout),this.timeout=0,this.throttled=!1,delete this.trailingFn,delete this.trailingFnArgs}};(i7=oo||(oo={})).ABORTED="ABORTED",i7.NETWORK_ERROR="NETWORK_ERROR",i7.MAX_REDIRECTS="MAX_REDIRECTS",i7.PARSE_ERROR="PARSE_ERROR",i7.FORBIDDEN="FORBIDDEN";let ServerRequestEvent=class ServerRequestEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep){super(tg.SERVER_REQUEST,_,ed,!0),Object.assign(this.properties,{action:p,http_method:et,remote_participant_id:eu,request_uuid:el,url:Z,transport:eh,retry_count:ep})}};let i2="draft-ietf-wish-whip-04";function fa(p){var _,Z,et,el;return _=this,Z=void 0,et=void 0,el=function*(){try{let _=p.headers.get("content-type");if(null==_?void 0:_.includes("application/json")){let _=yield p.json();return tm.ok(_)}let Z=yield p.text();return tm.ok(Z)}catch(_){return tm.err(HttpError.fromResponse(p,null,oo.PARSE_ERROR))}},new(et||(et=Promise))(function(p,eu){function s(p){try{c(el.next(p))}catch(p){eu(p)}}function a(p){try{c(el.throw(p))}catch(p){eu(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof et?Z:new et(function(p){p(Z)})).then(s,a)}c((el=el.apply(_,Z||[])).next())})}function ga(p){return new HttpError({message:"Request aborted",status:0,statusText:"Aborted",data:null,url:p,code:oo.ABORTED})}function va(p,_){return new HttpError({message:`Network request failed: ${_}`,status:0,statusText:"Network Error",data:null,url:p,code:oo.NETWORK_E
6RROR})}function ma(p,_,Z){var et;return{Authorization:`Bearer ${p.rawToken}`,"X-Stages-Platform":"web","X-Stages-Request-ID":ts().value,"X-Stages-SDK":"1.38.0","X-Stages-Session-ID":_,"X-Stages-Trace-ID":null!==(et=null==Z?void 0:Z.value)&&void 0!==et?et:"","X-Stages-WHIP-Version":i2}}var Ea=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};function _a(p){return Ea(this,void 0,void 0,function*(){return function Sa(p,_){return Ea(this,void 0,void 0,function*(){var Z;let et;if(_>5)return tm.err((Z=p.url,new HttpError({message:"Max redirects exceeded",status:0,statusText:"Max Redirects",data:null,url:Z,code:oo.MAX_REDIRECTS})));let el=p.params?function(p,_){let Z=new URL(p);return Object.entries(_).forEach(([p,_])=>{void 0!==_&&Z.searchParams.set(p,String(_))}),Z.toString()}(p.url,p.params):p.url;try{et=yield fetch(el,{method:p.method,headers:p.headers,body:p.body,signal:p.signal})}catch(_){return _ instanceof Error&&"AbortError"===_.name?tm.err(ga(p.url)):tm.err(va(p.url,_))}let eu=yield fa(et);if(!eu.ok)return tm.err(eu.error);let ed=eu.value;return 403===et.status&&2003===(null==ed?void 0:ed.code)?tm.err(HttpError.fromResponse(et,ed,oo.FORBIDDEN)):"safari"===nR.getGlobalProperties().browser_family&&403===et.status&&p.url!==et.url?Sa(Object.assign(Object.assign({},p),{url:et.url}),_+1):et.ok?tm.ok({data:ed,status:et.status,statusText:et.statusText,headers:et.headers,url:et.url}):tm.err(HttpError.fromResponse(et,ed))})}(Object.assign({method:"POST"},p),0)})}let TraceEvent=class TraceEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el){super(tg.TRACE,p,_,!1,nj.LOW),Object.assign(this.properties,{action:et,message:Z,remote_participant_id:el})}};let ConnectionStateEvent=class ConnectionStateEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el){super(tg.CONNECTION_STATE,_,Z,!1,nj.LOW),Object.assign(this.properties,{action:p,remote_participant_id:el,state:et})}};let IceGatheringStateEvent=class IceGatheringStateEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el){super(tg.ICE_GATHERING_STATE,_,Z,!1,nj.LOW),Object.assign(this.properties,{action:p,remote_participant_id:el,state:et})}};(ot=ol||(ol={})).POST="post",ot.CONNECTED="connected",ot.ICE_GATHERING="icegathering",ot.SDP_EXCHANGE="sdpExchange",ot.SET_REMOTE_DESC="setRemoteDesc",ot.PEER_CONNECTION="peerConnection";let i3="start",i4="stop";let PeerClientPerformanceTracker=class PeerClientPerformanceTracker{constructor(p,_){this.marks={},this.optionsDuration=0,this.postDuration=0,this.timeToCandidate=0,this.timeToConnected=0,this.sdpExchangeDuration=0,this.sdpExchangeTransport="",this.setRemoteDescDuration=0,this.peerConnectionDuration=0,this.action=p,this.traceId=_}markActionStart(){this.markStart(ol.CONNECTED)}markPostStart(){this.markStart(ol.POST)}markPostStop(){this.markStop(ol.POST),this.postDuration=this.measure(ol.POST)}markIceGatheringStart(){this.markStart(ol.ICE_GATHERING)}markIceGatheringStop(){this.markStop(ol.ICE_GATHERING),this.timeToCandidate=this.measure(ol.ICE_GATHERING)}markActionStop(){this.markStop(ol.CONNECTED),this.timeToConnected=this.measure(ol.CONNECTED),this.markStop(ol.PEER_CONNECTION),this.peerConnectionDuration=this.measure(ol.PEER_CONNECTION)}markSetRemoteDescStart(){this.markStart(ol.SET_REMOTE_DESC)}markSetRemoteDescStop(){let p=ol.SET_REMOTE_DESC;this.markStop(p),this.setRemoteDescDuration=this.measure(p),this.markStart(ol.PEER_CONNECTION)}markSdpExchangeStart(){this.markStart(ol.SDP_EXCHANGE)}markSdpExchangeStop(){let p=ol.SDP_EXCHANGE;this.markStop(p),this.sdpExchangeDuration=this.measure(p)}setTransport(p){this.sdpExchangeTransport=p}markStart(p){this.marks[`${this.namespace}.${p}.${i3}`]=performance.now()}markStop(p){this.marks[`${this.namespace}.${p}.${i4}`]=performance.now()}measure(p){let _=`${this.namespace}.${p}.${i3}`,Z=`${this.namespace}.${p}.${i4}`,et=this.marks[_],el=this.marks[Z];return void 0===et||void 0===el?0:el-et}get namespace(){return`ivswb.peerclient.${this.action}.${this.traceId.value}`}getMeasurements(){let{optionsDuration:p,postDuration:_,timeToCandidate:Z,timeToConnected:et,sdpExchangeDuration:el,sdpExchangeTransport:eu,setRemoteDescDuration:ed,peerConnectionDuration:eh}=this;return{optionsDuration:p,postDuration:_,timeToCandidate:Z,timeToConnected:et,sdpExchangeDuration:el,sdpExchangeTransport:eu,setRemoteDescDuration:ed,peerConnectionDuration:eh}}resetMeasurements(p){this.traceId=p,this.marks={},this.optionsDuration=0,this.postDuration=0,this.timeToCandidate=0,this.timeToConnected=0,this.sdpExchangeDuration=0,this.sdpExchangeTransport="",this.setRemoteDescDuration=0,this.peerConnectionDuration=0}};var i5,i9,i6,i8,i7,ot,on,oo,ol,od,oh=n(7363);let SdpMunger=class SdpMunger{constructor(p){this.sdp=p}static splitLines(p){return p.trim().split("\n").map(p=>p.trim())}static splitSections(p){return p.split("\nm=").map((p,_)=>(_>0?`m=${p}`:p).trim()+SdpMunger.CRLF)}getUniqueRtpHeaderExtensionId(p){let _=[];for(let Z of p)if(/^a=extmap:/.test(Z.trim())){let p=+Z.split("a=extmap:")[1].split(" ")[0];_.includes(p)||_.push(p)}_.sort((p,_)=>p-_);let Z=0;for(let p of _){if(p-Z>1)return Z+1;Z=p}return 14===Z?-1:Z+1}withVideoLayersAllocationRtpHeaderExtension(p){let _="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00",Z=p?p.getRtpHeaderExtensionId(_):-1,et=-1===Z?this.getUniqueRtpHeaderExtensionId(SdpMunger.splitLines(this.sdp)):Z,el=SdpMunger.splitSections(this.sdp),eu=[];for(let p of el){if(/^m=video/.test(p)&&-1===SdpMunger.getRtpHeaderExtensionIdInSection(p,_)){let Z=SdpMunger.splitLines(p),el=[];
6if(-1===et||this.hasRtpHeaderExtensionId(et)){eu.push(p);continue}for(let p of Z)if(el.push(p),/^a=sendrecv/.test(p.trim())){let p=`a=extmap:${et} ${_}`;el.push(p)}p=el.join(SdpMunger.CRLF)+SdpMunger.CRLF}else if(-1!==Z&&/^m=video/.test(p)&&SdpMunger.getRtpHeaderExtensionIdInSection(p,_)!==Z){let et=SdpMunger.splitLines(p),el=[];for(let p of et){if(/^a=extmap:/.test(p.trim())&&p.split("a=extmap:")[1].split(" ")[1]===_){if(!this.hasRtpHeaderExtensionId(Z)){let p=`a=extmap:${Z} ${_}`;el.push(p)}continue}el.push(p)}p=el.join(SdpMunger.CRLF)+SdpMunger.CRLF}eu.push(p)}let ed=eu.join("");return new SdpMunger(ed)}withOpusAudioConfig(p,_){let Z=oh.qg(this.sdp);for(let et of Z.media)if("audio"===et.type){let{payload:Z}=et.rtp.find(p=>"opus"===p.codec);if(!Z)continue;let el=et.fmtp.find(p=>p.payload===Z);el||(el={payload:Z,config:""});let eu=oh.Sl(el.config);if(eu.maxaveragebitrate=p,"boolean"==typeof _){let p=_?1:0;eu["sprop-stereo"]=p,eu.stereo=p}let ed="";for(let p of Object.keys(eu))ed+=`${p}=${eu[p]}; `;el.config=ed.trim()}return new SdpMunger(oh.M9(Z))}withoutAudioRtcpRSize(){var p;let _=oh.qg(this.sdp);for(let Z of _.media){if("audio"!==Z.type)continue;let _=void 0!==Pt(),et=null!==(p=Pt())&&void 0!==p&&p;_&&(Z.rtcpRsize=et?void 0:"rtcp-rsize")}return new SdpMunger(oh.M9(_))}withFilteredCandidates(p){let _=oh.qg(this.sdp);return _.media.forEach(_=>{let Z=_.candidates;if(Z){let et=Z.filter(_=>_.transport===p);_.candidates=et}}),new SdpMunger(oh.M9(_))}static getRtpHeaderExtensionIdInSection(p,_){let Z=SdpMunger.splitLines(p);for(let p of Z)if(/^a=extmap:/.test(p.trim())){let Z=p.split("a=extmap:")[1].split(" "),et=+Z[0];if(Z[1]===_)return et}return -1}getRtpHeaderExtensionId(p){let _=SdpMunger.splitSections(this.sdp);for(let Z of _)if(/^m=video/.test(Z)){let _=SdpMunger.getRtpHeaderExtensionIdInSection(Z,p);if(-1!==_)return _}return -1}hasRtpHeaderExtensionId(p){let _=SdpMunger.splitLines(this.sdp);for(let Z of _)if(/^a=extmap:/.test(Z.trim())&&+Z.split("a=extmap:")[1].split(" ")[0]===p)return!0;return!1}hasAudioNacksEnabled(){var p,_,Z;return(null!==(Z=null===(_=(null!==(p=oh.qg(this.sdp).media.filter(p=>"audio"===p.type)[0])&&void 0!==p?p:{}).rtcpFb)||void 0===_?void 0:_.filter(p=>"nack"===p.type))&&void 0!==Z?Z:[]).length>0}};SdpMunger.CRLF="\r\n",SdpMunger.rfc7587LowestBitrate=6e3,SdpMunger.rfc7587HighestBitrate=51e4,(o_=od||(od={})).SDP_EXCHANGE="xdp",o_.JITTER_BUFFER_MIN_DELAY_MS="jit_buf_min_delay_ms",(oy=oN||(oN={})).USER_INITIATED="user-initiated",oy.CLIENT_RECONNECT="reconnect",oy.TOKEN_REUSED="token-reused",oy.UNKNOWN="unknown",oy.PARTICIPANT_DISCONNECTED="participant-disconnected",oy.STAGE_DELETED="stage-deleted",oy.TOKEN_EXPIRED="token-expired",oy.MAX_CONCURRENT_CONNECTIONS="maxConcurrentConnections",(ob=oD||(oD={}))[ob.NOT_CONNECTED=0]="NOT_CONNECTED",ob[ob.CONNECTION_LOST=1]="CONNECTION_LOST",ob[ob.TIMEDOUT=2]="TIMEDOUT",ob[ob.ABORTED=3]="ABORTED",ob[ob.INVALID_MESSAGE=4]="INVALID_MESSAGE",ob[ob.UNEXPECTED_ERROR=5]="UNEXPECTED_ERROR",(oC=oP||(oP={})).DISCONNECTED="disconnected",oC.CONNECTING="connecting",oC.CONNECTED="connected",oC.ERRORED="errored",(oT=oM||(oM={})).PARTICIPANT_DISCONNECTED="PARTICIPANT_DISCONNECTED",oT.STAGE_DELETED="STAGE_DELETED",oT.TOKEN_REUSED="TOKEN_REUSED",oT.MAX_CONCURRENT_CONNECTIONS="MAX_CONCURRENT_CONNECTIONS";let BaseSdpExchanger=class BaseSdpExchanger{constructor(p){this.token=p}};let op=RegExp("^(?:[a-z+]+:)?//","i");function Da({sdpExchangeTransport:p,serverHttpResponse:_,serverErrorCode:Z}){return`sdpExchangeTransport: ${p}, serverHttpResponse: ${_}, serverErrorCode: ${Z}`}let of={[oD.ABORTED]:n5.OPERATION_ABORTED,[oD.NOT_CONNECTED]:n5.EVENT_PLANE_WS_UNEXPECTED_CLOSE,[oD.CONNECTION_LOST]:n5.XDP_CONNECTION_LOST,[oD.TIMEDOUT]:n5.XDP_TIMEOUT,[oD.INVALID_MESSAGE]:n5.XDP_INVALID_ANSWER_MSG,[oD.UNEXPECTED_ERROR]:n5.XDP_UNEXPECTED_ERROR};let EdpSdpExchanger=class EdpSdpExchanger extends BaseSdpExchanger{constructor(p,_,Z,et){super(p),this.token=p,this.stageConnection=_,this.contextData=Z,this.analyticsTracker=et}exchange(p){var _,Z,et,el,eu;return Z=this,et=void 0,el=void 0,eu=function*(){let Z;let et=ts(),{action:el}
6=this.contextData,{sdpOffer:eu,url:ed,traceId:eh,forceNode:ep,forceCluster:ef,assignmentToken:eg,multiCodec:ev,abortController:em,initialLayerPreference:eE}=p;(null===(_=this.contextData.signalingConfig)||void 0===_?void 0:_.connectionImplV2)||this.trackAttempt(ed,et,eh);try{Z=yield this.stageConnection.exchangeSdp({sdpOffer:eu,url:ed,traceId:eh.value,requestUUID:et.value,signal:null==em?void 0:em.signal,forceNode:ep,forceCluster:ef,assignmentToken:eg,multiCodec:ev,initialLayerPreference:eE,action:el})}catch(p){if("number"==typeof p)throw this.createClientSideErrorFromReasonCode(p,eh,et,el)}if(!Z)return;let{httpStatusCode:eS,errorCode:e_,location:ey,content:eb,sessionDeleteLink:eC,subscriberControlLink:eT,videoLayersLink:eI}=Z;if(eS>=200&&eS<300)return{sdpAnswer:eb,url:ed,location:ey,sessionDeleteLink:eC,mediaControls:eT,layerControls:eI};throw this.createServerSideError(eh,et,eS,e_,el)},new(el||(el=Promise))(function(p,_){function s(p){try{c(eu.next(p))}catch(p){_(p)}}function a(p){try{c(eu.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof el?Z:new el(function(p){p(Z)})).then(s,a)}c((eu=eu.apply(Z,et||[])).next())})}trackAttempt(p,_,Z){let{remoteParticipantId:et,action:el}=this.contextData;this.analyticsTracker.trackEventNoSharedProps(new ServerRequestEvent(el,this.token,p,"POST",_.value,et,Z,"xdp",0))}createServerSideError(p,_,Z,et,el){let eu=this.baseErrorProps(p,_),ed=ps(Z,et);return ed||(ed=n5.UNKNOWN_SERVER_ERROR),new StageClientError(Object.assign(Object.assign(Object.assign({action:el},eu),ed),{details:Da({sdpExchangeTransport:"xdp",serverHttpResponse:Z,serverErrorCode:et})}))}baseErrorProps(p,_){let{remoteParticipantId:Z,action:et}=this.contextData;return{token:this.token,traceId:p,tag:ds(et,Z),location:"EdpSdpExchanger.exchange",requestUUID:_,remoteParticipantId:Z}}createClientSideErrorFromReasonCode(p,_,Z,et){let el=this.baseErrorProps(_,Z),eu=of[p];return new StageClientError(eu?Object.assign(Object.assign({action:et},el),eu):Object.assign(Object.assign({action:et},el),n5.XDP_INVALID_ANSWER_MSG))}getTransport(){return"sdp"}};let HttpSdpExchanger=class HttpSdpExchanger extends BaseSdpExchanger{constructor(p,_,Z){super(p),this.contextData=_,this.analyticsTracker=Z}exchange(p){var _,Z,et,el,eu,ed,eh;return el=this,eu=void 0,ed=void 0,eh=function*(){let el=ts(),{token:eu}=this,{action:ed,remoteParticipantId:eh}=this.contextData,{sdpOffer:ep,url:ef,traceId:eg,forceNode:ev,forceCluster:em,assignmentToken:eE,multiCodec:eS,abortController:e_,initialLayerPreference:ey}=p;this.analyticsTracker.trackEventNoSharedProps(new ServerRequestEvent(ed,eu,ef,"POST",el.value,eh,eg,"http",0));let eb=ma(eu,this.analyticsTracker.getSessionId(),eg),eC={url:ef,headers:Object.assign(Object.assign({},eb),{"Content-Type":"application/sdp","X-Stages-Request-ID":el.value,"X-Stages-Options":btoa(JSON.stringify({cap:["sau"]})).replace(/[^A-Za-z0-9+/]/g,"")}),body:ep,signal:null==e_?void 0:e_.signal};eC.params={},ev&&(eC.params.force_node=ev),em&&(eC.params.force_cluster=em),eE&&(eC.params.assignment_token=eE),eS&&(eC.params.multi_codec=!0),ey&&eC.headers&&(eC.headers["X-Stages-Initial-Layer-Pref"]=Jn(ey));let eT=yield _a(eC);if(!eT.ok){let p=eT.error;if("ABORTED"===p.code)throw new StageClientError(Object.assign(Object.assign({},hs(n5.OPERATION_ABORTED,p)),{action:ed,token:eu,traceId:eg,tag:ds(ed,eh),location:"StagePeerClient.start",requestUUID:el,remoteParticipantId:eh}));let ep=null!==(_=p.status)&&void 0!==_?_:-1,ef=null!==(et=null===(Z=p.data)||void 0===Z?void 0:Z.code)&&void 0!==et?et:-1,ev=function(p,_){var Z;if(!(p instanceof HttpError))return p instanceof TypeError?n5.NETWORK_FAILURE:_;let et=ps(p.status,null===(Z=p.data)||void 0===Z?void 0:Z.code);return et||_}(p,n5.WHIP_POST_FAILURE);throw new StageClientError(Object.assign(Object.assign({},hs(ev,p)),{action:ed,token:eu,traceId:eg,tag:ds(ed,eh),details:Da({sdpExchangeTransport:"http",serverHttpResponse:ep,serverErrorCode:ef}),location:"StagePeerClient.start",requestUUID:el,remoteParticipantId:eh}))}let eI=eT.value,eR=this.parseWhipResource(ef,eI.headers.get("location")||void 0,eI.headers.get("link")||void 0);return{url:eI.url,sdpAnswer:eI.data,location:null==eR?void 0:eR.location,sessionDeleteLink:null==eR?void 0:eR.sessionDeleteLink,mediaControl
6s:null==eR?void 0:eR.mediaControls,layerControls:null==eR?void 0:eR.layerControls}},new(ed||(ed=Promise))(function(p,_){function s(p){try{c(eh.next(p))}catch(p){_(p)}}function a(p){try{c(eh.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof ed?Z:new ed(function(p){p(Z)})).then(s,a)}c((eh=eh.apply(el,eu||[])).next())})}parseWhipResource(p,_,Z){let et;let el=new URL(p);return function(p,_,Z){if(!Z)return p;p||(p={});let et=p;return Z.split(",").forEach(p=>{let Z;let el=/<(.+)>;\s?rel="([a-z:-]+)"/.exec(p);if(3===(null==el?void 0:el.length)){var eu;if(eu=el[1],op.test(eu))Z=el[1];else{let p=_.port?`:${_.port}`:"";Z=`${_.protocol}//${_.hostname}${p}${el[1]}`}switch(el[2]){case"urn:ietf:params:whip:ivs-stages:session-delete":et.sessionDeleteLink=Z;break;case"urn:ietf:params:whep:core:playback-controls":et.mediaControls=Z;break;case"urn:ietf:params:whep:ext:core:layer":et.layerControls=Z;break;default:return}}}),et}(et=function(p,_,Z){if(!Z)return p;if(p||(p={}),op.test(Z))return p.location=Z,p;let et=_.port?`:${_.port}`:"";return p.location=`${_.protocol}//${_.hostname}${et}${Z}`,p}(et,el,_),el,Z)}getTransport(){return"http"}};let xa=(p,_,Z)=>{var et;let el={[t9.HI]:er(t9.HI),[t9.MID]:er(t9.MID),[t9.LOW]:er(t9.LOW)},eu=_.simulcast,ed=null==Z?void 0:Z.simulcast,eh=eu.layers.sort(Ur),ep=null!==(et=null==ed?void 0:ed.layers)&&void 0!==et?et:[],ef=eh.length,eg=ep.length;return eh=eh.map(Z=>(((p,_)=>{let{width:Z,height:et}=Fr(_.getSettings()),{width:el,height:eu}=p;if(el*eu>Z*et){let p=`forcing layer of ${el}x${eu} to the input dimensions ${Z}x${et}`,{name:_,message:ed}=rG;kn(`${_}${ed}${p}`)}})(Z,p),((p,_)=>{var Z;let et=null!==(Z=_.getSettings().frameRate)&&void 0!==Z?Z:r_,el=p.maxFramerate;if(el>et){let p=`forcing layer of ${el}fps to the input framerate of ${et}`,{name:_,message:Z}=rH;kn(`${_}${Z}${p}`)}})(Z,p),((p,_)=>{let{maxVideoBitrateKbps:Z}=_;return Z&&p.maxBitrateKbps>Z&&(p.maxBitrateKbps=Z)})(Z,_),((p,_)=>{let{maxFramerate:Z}=_;return Z&&p.maxFramerate>Z&&(p.maxFramerate=Z),p})(Z,_))),(0===eg||3===eg)&&3===ef?(el.hi=Gr(p,eh[2],el.hi),el.mid=Gr(p,eh[1],el.mid),el.low=Gr(p,eh[0],el.low),tm.ok(el)):1===eg&&1===ef?(el.hi=Gr(p,eh[0],el.hi),tm.ok(el)):2===eg&&2===ef?(el.hi=Gr(p,eh[1],el.hi),el.low=Gr(p,eh[0],el.low),tm.ok(el)):tm.err(null)},Ua=p=>{if(!p)return;let _=p.split("/");return _.length<2?void 0:_[1].toUpperCase()},Ba=p=>{if(!p)return;let _=p.match(/profile-level-id=([0-9a-fA-F]{6})/i);return _?_[1].toLowerCase():void 0},ja=(p,_)=>{if(!_||0===_.length)return!0;let Z=Ba(p.sdpFmtpLine);return!!Z&&_.some(p=>p.profileLevel.toLowerCase()===Z)},Fa=(p,_)=>{let{codec:Z}=p;if(!Va(Z,_)){let p=_.map(p=>Ua(p.mimeType)).join(", ");return kn(`Codec ${Z} is not supported by this browser, must be one of ${p}`),[]}let et=_.filter(_=>Ua(_.mimeType)===Z.toUpperCase()&&(Z!==t8.H264||ja(_,p.profileLevels)));if(Z===t8.H264&&p.profileLevels&&p.profileLevels.length>0){let{profileLevels:_}=p;if(0===(et=et.sort((p,Z)=>{var et,el,eu,ed;let eh=Ba(p.sdpFmtpLine),ep=Ba(Z.sdpFmtpLine);return(null!==(el=null===(et=_.find(p=>p.profileLevel.toLowerCase()===eh))||void 0===et?void 0:et.priority)&&void 0!==el?el:999)-(null!==(ed=null===(eu=_.find(p=>p.profileLevel.toLowerCase()===ep))||void 0===eu?void 0:eu.priority)&&void 0!==ed?ed:999)})).length){let p=_.map(p=>p.profileLevel).join(", ");kn(`No H.264 codecs found matching profile-levels: ${p}`)}}return et},Va=(p,_)=>_.some(_=>_.mimeType.toLowerCase().includes(p.toLowerCase())),Ga=p=>{let _=p.codecs;if(!Array.isArray(_)||0===_.length)return;let Z=(()=>{var p;if(!RTCRtpReceiver||"function"!=typeof RTCRtpReceiver.getCapabilities)return kn("RTCRtpSender does not exist, unable to get capabilities"),[];let _=RTCRtpReceiver.getCapabilities("video");return null!==(p=null==_?void 0:_.codecs)&&void 0!==p?p:[]})(),et=[],el=[];for(let p of Z)"RTX"===Ua(p.mimeType)&&el.push(p);let eu=[..._].sort((p,_)=>{var Z,et;return(null!==(Z=p.priority)&&void 0!==Z?Z:0)-(null!==(et=_.priority)&&void 0!==et?et:0)});for(let p of eu){let _=Fa(p,Z);et=[...et,..._]}if(0!==et.length)return[...et,...el];kn("No supported codecs found in configuration, using browser defaults")},Ha=(p,_,Z)=>{let et=_.simulcast,el=_.inBandMessaging,eu=Wn(_.minBitrate),ed=Wn(_.maxVideoBitrateKbps),eh=_.maxFramerate,ep=[{maxBitrate:ed,maxFramerate:eh}
6],ef=xa(p,_,null!=Z?Z:{});et.enabled&&ef.ok&&(ep=(p=>{let{hi:_,mid:Z,low:et}=p;return[xr(et),xr(Z),xr(_)]})(ef.value));let eg=Ga(null!=_?_:{});return{track:p,config:{minBitrateBps:eu,maxBitrateBps:ed,maxFramerate:eh,inBandMessagingEnabled:el.enabled,simulcastEnabled:et.enabled,simulcastLayers:ef.ok?ef.value:void 0,encodingLayers:ep,codecs:eg}}},qa=p=>{let _=p.mediaStreamTrack,Z=p.normalizedConfig,et={},el=p.validatedExternalConfig;return hi(el)&&(et=el),_.kind===ri.AUDIO?((p,_)=>{let Z={maxBitrateBps:Wn(_.maxAudioBitrateKbps)},et=null==_?void 0:_.stereo;return"boolean"==typeof et&&(Z.stereo=et),{track:p,config:Z}})(_,Z):Ha(_,Z,et)},Wa=(p,_)=>{let Z="video"===p.kind,et=Z?_r():yr(),el=(0,tw.cloneDeep)(_),eu=Object.assign(Object.assign(Object.assign({},Object.assign(Object.assign({},_r()),yr())),et),el);return Z&&hi(et)&&hi(el)&&(el.simulcast&&(eu.simulcast=Object.assign(Object.assign({},et.simulcast),el.simulcast)),el.inBandMessaging&&(eu.inBandMessaging=Object.assign(Object.assign({},et.inBandMessaging),el.inBandMessaging))),eu},$a=(p,_)=>{if("number"==typeof p)return p;let Z=_?rA:rk;return void 0!==Z[p]?Z[p]:0};function Ka({stageErrorValue:p,action:_,token:Z,traceId:et,tag:el,identifier:eu,details:ed}){return new StageClientError(Object.assign(Object.assign({},p),{token:Z,traceId:et,location:"peer-client",tag:el,action:_,remoteParticipantId:eu,details:ed}))}let Ja=(p,_)=>{let Z=(p=>{let _=null==p?void 0:p.split("/");if(2===(null==_?void 0:_.length))return _[1]})(p);if(void 0===p||void 0===Z)return;let et={mimeSubtype:Z};if(_){let p=(p=>{let _=p.split(";"),Z=new Map;for(let p of _){let[_,et]=p.split("=");Z.set(_,et)}return Z})(_);switch(Z){case"H264":{let _=p.get("profile-level-id");_&&((p,_)=>{if(_.length<6)return;let Z=_.substring(0,4),et=parseInt(_.substring(4,6),16);p.profile=Z,p.level=et})(et,_);break}case"H265":((p,_)=>{let Z=_.get("profile-id")||"0",et=_.get("tier-flag")||"0",el=parseInt(_.get("level-id")||"0",10),eu=[et,Z].join("_");p.profile=eu,p.level=el})(et,p)}}return et},Ya=(p,_)=>{var Z;let et=Ja(p.mimeType,p.sdpFmtpLine);return(null==et?void 0:et.mimeSubtype.toLowerCase())===_.mime.toLowerCase()&&0===(null===(Z=null==et?void 0:et.profile)||void 0===Z?void 0:Z.toLowerCase().indexOf(_.config.toLowerCase()))},Xa=(p,_)=>_.filter(p=>!p.mimeType.endsWith("rtx")).filter(p=>-1===p.mimeType.indexOf("packetization-mode=0")).find(_=>p.reduce((p,Z)=>p&&!1===Ya(_,Z),!0));function Za(p){var _;return(null===(_=null==p?void 0:p.sender)||void 0===_?void 0:_.createEncodedStreams)?oL.INSERTABLE_STREAMS:window.RTCRtpSender&&"transform"in RTCRtpSender.prototype&&window.RTCRtpScriptTransform?oL.ENCODED_TRANSFORMS:oL.NONE}function ec(p){var _;return(null===(_=null==p?void 0:p.receiver)||void 0===_?void 0:_.createEncodedStreams)?oL.INSERTABLE_STREAMS:window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&window.RTCRtpScriptTransform?oL.ENCODED_TRANSFORMS:oL.NONE}function tc(){return nJ()('/*! For license information please see transform.worker.worker.js.LICENSE.txt */\n(()=>{"use strict";const e=new Uint8Array([158,80,78,165,238,90,79,2,148,159,176,51,163,118,141,162]);var t;!function(e){e.VIDEO_SEND="video/send",e.VIDEO_RECEIVE="video/receive",e.INSERT_SEI="insertSei"}(t||(t={}));function n(t,n){const{transformerId:s,type:r,payloads:a}=n;let o=[];if("sei"===n.type){const{value:n,messages:s}=function(t,n){function s(e,t,n){return n+t.length<=e.byteLength&&t.every(((t,s)=>e.getUint8(n+s)===t))}function r(e,t){const n=function(e,t){return new Uint8Array([0,0,1,6,5,...t,...e])}(e,function(e){const t=[];for(;e>=255;)t.push(255),e-=255;return t.push(e),new Uint8Array(t)}(t.length+e.length)),s=function(e){const t=[...e];let n=3;for(;n<t.length-2;)0!==t[n]||0!==t[n+1]||0!==t[n+2]&&1!==t[n+2]&&2!==t[n+2]&&3!==t[n+2]?n+=1:(t.splice(n+2,0,3),n+=3);return t}(new Uint8Array([...n,...t,128]));return new Uint8Array(s)}function a(e,n){const r=function(e){const t=new DataView(e);for(let e=0;e<t.byteLength-4;e++)if(s(t,[0,0,1],e)){const n=31&t.getUint8(e+3);if(n>=1&&n<=5)return e}return-1}(t.data);if(r>=0){const e=new ArrayBuffer(t.data.byteLength+n.byteLength),s=new Uint8Array(e);return s.set(new Uint8Array(t.data.slice(0,r)),0),s.set(n,r),s.set(new Uint8Array(t.data.slice(r)),r+n.byteLength),e}return e}return function(){const s=[];for(let o=0;o<n.length;o+=1){const i=r(e,new Uint8Array(n[o]));t.data=a(t.data,i),s.push({uuid:e,payload:n[o]})}return{value:t,messages:s}}()}(t,a||[]);t=n,o=s}return{success:!0,frame:t,transformerId:s,type:r,seiResult:o}}const s=function(){let e=[];const t=new Map;return{add:({payload:t,repeatCount:n})=>(e.push({payload:t,repeatCount:n}),!0),poll(n){t.has(n)||t.set(n,[]),t.size>0&&(t.forEach((t=>{t.push(...e)})),e=[]);const s=t.get(n)||[],r=s.filter((e=>e.repeatCount>0)).map((e=>Object.assign(Object.assign({},e),{repeatCount:e.repeatCount-1})));return t.set(n,r),s}}}(),r=e=>(t,r)=>{try{const a=t.getMetadata().synchronizationSource,o=(s?s.poll(a):[]).map((e=>e.payload)),i=n(t,Object.assign(Object.assign({},e),{payloads:o}));r.enqueue(i.frame),self.postMessage(Object.assign({success:i.success,seiResult:i.seiResult},e))}catch(t){self.postMessage(Object.assign({success:!1},e))}},a=e=>(t,n)=>{try{const s=function(e,t){const{type:n,transformerId:s}=t;if("sei"===n){const t=function(e){function t(e,t,n){return n+t.length<e.byteLength&&t.every(((t,s)=>e.getUint8(n+s)===t))}function n(e){const t=[];let n=0;for(;n<e.length;)n<e.length-2&&0===e[n]&&0===e[n+1]&&3===e[n+2]?(t.push(e[n]),t.push(e[n+1]),n+=3):(t.push(e[n]),n+=1);return new Uint8Array(t)}function s(e){let t=2;const n=e.byteLength;for(;t<n;){let s=0;for(;t<n&&255===e[t];)s+=255,t++;s+=e[t],t++;const r=Math.min(t+s,n),a=new Uint8Array(e.slice(t,r));return{uuid:a.slice(0,16),payload:a.slice(16)}}}return{messages:function(e){const r=new DataView(e.data),a=[];let o=0;if(!t(r,[0,0,1],0)&&!t(r,[0,0,0,1],0))return[];for(;o<r.byteLength-5;)if(t(r,[0,0,1],o)){const i=o+3;o=i;const c=31&r.getUint8(o),u=31&r.getUint8(o+1);if(6===c&&5===u){for(;o<r.byteLength&&!t(r,[0,0,1],o);)o++;const c=o,u=s(n(new Uint8Array(e.data.slice(i,c))));u&&a.push(Object.assign({},u))}else o++}else o++;return a}(e),frame:e}}(e),{frame:r,messages:a}=t;return{success:!0,frame:r,type:n,transformerId:s,seiResult:a}}return{success:!0,frame:e,transformerId:s,type:n}}(t,e);n.enqueue(s.frame),self.postMessage(Object.assign({success:s.success,seiResult:s.seiResult},e))}catch(t){self.postMessage(Object.assign({success:!1},e))}};function o(e,t,n,s){const o=new TransformStream({transform:"video/send"===e?r(t):a(t)});n.pipeThrough(o).pipeTo(s)}const i=self;i.addEventListener("message",(function(e){var n,r,a;if(!(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.operation)||!(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.transformerId))return;const{operation:i,transformerId:c}=e.data;switch(i){case t.VIDEO_SEND:case t.VIDEO_RECEIVE:o(i,{method:i,transformerId:c,type:"sei"},e.data.readable,e.data.writable);break;case t.INSERT_SEI:s.add({payload:e.data.payload,repeatCount:null!==(a=e.data.repeatCount)&&void 0!==a?a:0})}})),i.addEventListener("rtctransform",(function(e){const t=e.transformer;if(!t)return;o(t.options.method,t.options,t.readable,t.writable)}))})();',"Worker",void 0,void 0)}(oI=oL||(oL={})).NONE="none",oI.ENCODED_TRANSFORMS="encodedTransforms",oI.INSERTABLE_STREAMS="insertableStreams";let og=(()=>{let p={};return{getWorker:_=>(p[_]||(p[_]=new tc),p[_]),destroy:_=>{var Z;null===(Z=p[_])||void 0===Z||Z.terminate(),p[_]=void 0}}})();(oR=ox||(ox={})).NOT_PUBLISHING_VIDEO="NOT_PUBLISHING_VIDEO",oR.INBAND_MESSAGING_NOT_ENABLED="INBAND_MESSAGING_NOT_ENABLED",oR.INVALID_REPEAT_COUNT="INVALID_REPEAT_COUNT",oR.PAYLOAD_SIZE_INVALID="PAYLOAD_SIZE_INVALID",oR.PAYLOAD_RATE_EXCEEDED="PAYLOAD_RATE_EXCEEDED",oR.INVALID_TRACK_TYPE="INVALID_TRACK_TYPE";let SeiSendRequestValidator=class SeiSendRequestValidator{constructor(p){this.maxFramerate=p,this.queued=[]}validateMessagePayload(p,_){if(p.byteLength<=0)return tm.err(ox.PAYLOAD_SIZE_INVALID);if(_<0||_>30)return tm.err(ox.INVALID_REPEAT_COUNT);if(p.byteLength>1024)return tm.err(ox.PAYLOAD_SIZE_INVALID);this.queued=this.trimPastPayloads(this.queued,1e3);let{before:Z,after:et}=this.getPayloadSums(this.queued);if(Z+p.byteLength>10240||et+p.byteLength*Math.max(1,_)>10240)return tm.err(ox.PAYLOAD_RATE_EXCEEDED);if(this.queued.push({byteLength:p.byteLength,timestamp:Date.now()}),_>0){let Z=1e3/this.maxFramerate,et=Date.now()+Z;for(let el=0;el<_;el+=1)this.queued.push({byteLength:p.byteLength,timestamp:et}),et+=Z}return tm.ok(!0)}trimPastPayloads(p,_){let Z=Date.now()-_;return p.filter(p=>p.timestamp>Z)}getPayloadSums(p){let _=Date.now();return p.reduce((p,Z)=>{let{before:et,after:el}=p;return Z.timestamp<=_?{before:et+Z.byteLength,after:el}:{before:et,after:el+Z.byteLength}},{before:0,after:0})}};let ov="seiMessageReceived",om="error";(oO=oU||(oU={})).CREATED="created",oO.INITIALIZED="initialized",oO.DESTROYED="destroyed";let VideoReceiverTransformer=class VideoReceiverTransformer extends TypedEmitter{constructor(p){super(),this.sessionId=p,this.state=oU.CREATED,this.transformerId=ts().value,this.prevResultWasError=!1,this.consecutiveErrorResults=0,this.seiReadCnt=0,this.seiBytesRead=0,this.onMessage=p=>{this.onTransformResult(p.data)}}initializeInsertableStreams(p){var _,Z;this.worker=og.getWorker(this.sessionId);let et=p.receiver.createEncodedStreams(),{readable:el,writable:eu}=et;null===(_=this.worker)||void 0===_||_.postMessage({operation:"video/receive",transformerId:this.transformerId,readable:el,writable:eu},[el,eu]),null===(Z=this.worker)||void 0===Z||Z.addEventListener("message",this.onMessage)}initializeEncodedTransforms(p){var _;this.worker=og.getWorker(this.sessionId);let Z={method:"video/receive",type:"sei",transformerId:this.transformerId};p.receiver.transform=new RTCRtpScriptTransform(this.worker,Z),null===(_=this.worker)||void 0===_||_.addEventListener("message",this.onMessage)}initialize(p,_){if(this.state!==oU.CREATED)return!1;let Z=ec(p);if(Z===oL.NONE)return!1;if(_&&Z===oL.INSERTABLE_STREAMS)this.initializeInsertableStreams(p);else{if(_||Z!==oL.ENCODED_TRANSFORMS)return!1;this.initializeEncodedTransforms(p)}return this.transceiver=p,this.state=oU.INITIALIZED,!0}
6onTransceiverAdd(p){return this.initialize(p,!0)}onTrackEvent(p){return"video"===p.track.kind&&this.initialize(p.transceiver,!1)}static isSupported(p){return ec(p)!==oL.NONE}onTransformResult(p){return p.transformerId===this.transformerId&&(p.success?(this.prevResultWasError=!1,this.consecutiveErrorResults=0,!!p.seiResult&&(p.seiResult.forEach(p=>{let{payload:_,uuid:Z}=p;this.updateReadStats(p),this.emit(ov,{uuid:Z,payload:_})}),p.seiResult.length>0)):(this.prevResultWasError&&this.consecutiveErrorResults++,this.consecutiveErrorResults>=300&&this.onError(p,n5.TRANSFORM_TOO_MANY_ERRORS),this.prevResultWasError=!0,this.onError(p,n5.TRANSFORM_UNEXPECTED_ERROR),!1))}updateReadStats(p){this.seiReadCnt++,this.seiBytesRead+=p.payload.byteLength}getReceiverStats(){let{seiBytesRead:p,seiReadCnt:_}=this;return{seiReadCnt:_,seiBytesRead:p}}onError(p,_){let{type:Z}=p;this.emit(om,{type:Z,stageErrorValue:_})}destroy(){var p,_;this.state!==oU.DESTROYED&&(this.removeAllListeners(),null===(p=this.worker)||void 0===p||p.removeEventListener("message",this.onMessage),(null===(_=this.transceiver)||void 0===_?void 0:_.receiver)&&(this.transceiver.receiver.transform=null),this.state=oU.DESTROYED)}getState(){return this.state}};let VideoSenderTransformer=class VideoSenderTransformer{constructor(p){this.sessionId=p,this.state=oU.CREATED,this.transformerId=ts().value,this.seiWriteCnt=0,this.seiBytesWritten=0,this.onMessage=p=>{this.onTransformResult(p.data)}}initializeInsertableStreams(p,_){var Z,et;this.worker=og.getWorker(this.sessionId);let el=p.sender.createEncodedStreams(),{readable:eu,writable:ed}=el;null===(Z=this.worker)||void 0===Z||Z.postMessage({operation:"video/send",transformerId:this.transformerId,readable:eu,writable:ed},[eu,ed]),null===(et=this.worker)||void 0===et||et.addEventListener("message",this.onMessage)}initializeEncodedTransforms(p,_){var Z;this.worker=og.getWorker(this.sessionId);let et={method:"video/send",type:"sei",transformerId:this.transformerId,encodingLayers:_};p.sender.transform=new RTCRtpScriptTransform(this.worker,et),null===(Z=this.worker)||void 0===Z||Z.addEventListener("message",this.onMessage)}initialize(p){var _;if(this.state!==oU.CREATED)return!1;let Z=Za(p);if(Z===oL.NONE)return!1;let et=p.sender.getParameters(),el=(null===(_=null==et?void 0:et.encodings)||void 0===_?void 0:_.length)||1;if(Z===oL.INSERTABLE_STREAMS)this.initializeInsertableStreams(p,el);else{if(Z!==oL.ENCODED_TRANSFORMS)return!1;this.initializeEncodedTransforms(p,el)}return this.transceiver=p,this.state=oU.INITIALIZED,!0}static isSupported(p){return Za(p)!==oL.NONE}sendSeiMessage(p,_){var Z;return this.state===oU.INITIALIZED&&this.transceiver?(null===(Z=this.worker)||void 0===Z||Z.postMessage({operation:"insertSei",transformerId:this.transformerId,payload:p,repeatCount:_}),tm.ok(!0)):tm.err(ox.NOT_PUBLISHING_VIDEO)}onTransceiverAdd(p){return this.initialize(p)}onTrackEvent(p){return!1}onTransformResult(p){return p.transformerId===this.transformerId&&(p.success&&this.updateSendStats(p),p.success)}updateSendStats(p){p.seiResult&&p.seiResult.forEach(p=>{this.seiWriteCnt++,this.seiBytesWritten+=p.payload.byteLength})}getSenderStats(){let{seiBytesWritten:p,seiWriteCnt:_}=this;return{seiWriteCnt:_,seiBytesWritten:p}}destroy(){var p;this.state!==oU.DESTROYED&&((null===(p=this.transceiver)||void 0===p?void 0:p.receiver)&&(this.transceiver.receiver.transform=null),this.state=oU.DESTROYED)}getState(){return this.state}};let SelectedPairChangeEvent=class SelectedPairChangeEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep){super(tg.SELECTED_PAIR_CHANGE,_,Z,!1,nj.LOW),Object.assign(this.properties,{action:p,protocol:et,local_type:el,local_addr:eu,remote_addr:ed,local_candidate_priority:eh,remote_participant_id:ep})}};var ac=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let oE=null;let StagePeerClient=class StagePeerClient extends TypedEmitter{constructor(p,_,Z,et,el,eu,ed,eh,ep,ef,eg){var ev;if(super(),this.analyticsTracker=eu,this.subscribeConfig=ef,this.stageConfig=eg,this.sfuResource={node:"",cluster:""},this.protocol="",this.incompatibleCodecs=new Set,this.connect=({audioOnly:p=!1,traceId:_,iceRestartOptions:Z})=>ac(this,void 0,void 0,function*(){let et,el,eu;let{token:ed,tag:eh,identifier:ep,action:ef}=this,eg=!!Z,ev=new AbortController;this.abortController=ev,this.traceId=_,this.protocol="",this.perfTracker.resetMeasurements(_);let em=new Promise((p,Z)=>{var em,eE,eS;let e_=function({action:p,token:_,traceId:Z,tag:et,identifier:el}){let eu=p===iG.SUBSCRIBE?n5.SUBSCRIBE_TIMED_OUT:n5.PUBLISH_TIMED_OUT;return new StageClientError(Object.assign(Object.assign({},eu),{action:p,token:_,traceId:Z,tag:et,location:"connect",remoteParticipantId:el}))}({action:ef,token:ed,traceId:_,tag:eh,identifier:ep}),ey=function({action:p,token:_,traceId:Z,tag:et}){let el=n5.OPERATION_ABORTED;return new StageClientError(Object.assign(Object.assign({},el),{token:_,traceId:Z,location:"peer-client.connect",tag:et,action:p}))}({action:ef,token:ed,traceId:_,tag:eh}),eb=(null===(em=this.stageConfig)||void 0===em?void 0:em.signaling.connectionImplV2)&&(null===(eE=this.stageConnection)||void 0===eE?void 0:eE.supportsSdpExchange())&&(null===(eS=this.stageConnection)||void 0===eS?void 0:eS.isConnected())?void 0:setTimeout(()=>{this.stop(),this.analyticsTracker.trackError(e_),Z(e_)},1e4);et=p=>{clearTimeout(eb),eg||this.stop(),Z(p)}
6,el=et=>{if(et===tz.CONNECTED)clearTimeout(eb),p();else if(et===tz.FAILED){let p=function({action:p,token:_,traceId:Z,tag:et}){return new StageClientError(Object.assign(Object.assign({},n5.PEER_CONNECTION_NETWORK_FAILURE),{token:_,traceId:Z,location:"peer-client.connect",tag:et,action:p}))}({action:ef,token:ed,traceId:_,tag:eh});clearTimeout(eb),Z(p)}},this.on(ty,et),this.on(tS,el),eu=()=>{clearTimeout(eb)},ev.signal.aborted&&(clearTimeout(eb),Z(ey)),ev.signal.addEventListener("abort",()=>{clearTimeout(eb),Z(ey)})});try{let et=yield Promise.all([ac(this,void 0,void 0,function*(){eg||(yield this.start(),this.mediaStream=yield this.initializePeerConnection(p));let _=null==Z?void 0:Z.assignmentToken,et=null==Z?void 0:Z.nodeOverride;return yield this.exchangeSdp({iceRestart:eg,nodeOverride:et,assignmentToken:_,abortController:ev}),this.mediaStream}),em]);this.statsReporter.traceId=_;let el=et[0];if(this.abortController=void 0,!eg&&ef===iG.PUBLISH)try{yield this.verifyOrUpdateTransceiverSync()}catch(p){this.logger.error({err:p,msg:"error syncing transceivers"})}return{mediaStream:el}}catch(p){throw eu&&eu(),p}finally{(()=>{et&&this.off(ty,et),el&&this.off(tS,el)})()}}),this.disconnect=(p=!1)=>ac(this,void 0,void 0,function*(){var _;let{token:Z,action:et}=this;null===(_=this.abortController)||void 0===_||_.abort(),this.stop(),this.protocol="",p?this.cleanup(et,Z.participantID,Z,p):yield this.cleanup(et,Z.participantID,Z,p)}),this.resetTransformers=()=>{var p,_;null===(p=this.videoSenderTransformer)||void 0===p||p.destroy(),this.videoSenderTransformer=this.createVideoSenderTransformer(),null===(_=this.videoReceiverTransformer)||void 0===_||_.destroy(),this.videoReceiverTransformer=this.createVideoReceiverTransformer(),this.statsReporter.resetTransformers(this.videoReceiverTransformer,this.videoSenderTransformer)},this.onTrack=p=>{var _,Z;let{token:et,action:el,traceId:eu,identifier:ed}=this;this.trace(et,eu,`onTrack: ${p.track.kind}`,el,ed),this.sendInBandMessagingEnabled&&(null===(_=this.videoSenderTransformer)||void 0===_||_.onTrackEvent(p)),this.receiveInBandMessagingEnabled&&(null===(Z=this.videoReceiverTransformer)||void 0===Z||Z.onTrackEvent(p))},this.onIceGatheringStateChange=()=>{var p,_;let{token:Z,action:et,traceId:el,identifier:eu}=this;if("gathering"===(null===(p=this.peerConnection)||void 0===p?void 0:p.iceGatheringState)?this.perfTracker.markIceGatheringStart():"complete"===(null===(_=this.peerConnection)||void 0===_?void 0:_.iceGatheringState)&&this.perfTracker.markIceGatheringStop(),this.peerConnection){let p=this.peerConnection.iceGatheringState,_=new IceGatheringStateEvent(et,Z,el,p,eu);this.analyticsTracker.trackEventNoSharedProps(_)}},this.onSelectedCandidatePairChange=()=>{var p,_,Z,et,el,eu,ed,eh,ep,ef,eg,ev,em,eE;let{token:eS,action:e_,traceId:ey,identifier:eb}=this,eC=null===(_=null===(p=this.peerConnection)||void 0===p?void 0:p.getReceivers()[0].transport)||void 0===_?void 0:_.iceTransport,eT=null==eC?void 0:eC.getSelectedCandidatePair();if(eT){let{local:p,remote:_}=eT,eC=`Selected candidate pair change (local, remote): ${null==p?void 0:p.candidate}, ${null==_?void 0:_.candidate}`;this.logger.debug({msg:eC});let eI=new SelectedPairChangeEvent(e_,eS,ey,null!==(et=null===(Z=eT.local)||void 0===Z?void 0:Z.protocol)&&void 0!==et?et:"",null!==(eu=null===(el=eT.local)||void 0===el?void 0:el.type)&&void 0!==eu?eu:"",null!==(eh=null===(ed=eT.local)||void 0===ed?void 0:ed.address)&&void 0!==eh?eh:"",null!==(ef=null===(ep=eT.remote)||void 0===ep?void 0:ep.address)&&void 0!==ef?ef:"",null!==(ev=null===(eg=eT.local)||void 0===eg?void 0:eg.priority)&&void 0!==ev?ev:0,eb);this.analyticsTracker.trackEvent(eI),this.protocol=null!==(eE=null===(em=eT.local)||void 0===em?void 0:em.protocol)&&void 0!==eE?eE:""}},this.onIceCandidate=p=>ac(this,void 0,void 0,function*(){var _,Z;let{identifier:et,action:el,traceId:eu}=this,ed=null===(_=p.target.localDescription)||void 0===_?void 0:_.sdp.includes("relay");this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,eu,`ice candidate: hasRelay = ${ed}, candidate = ${null===(Z=p.candidate)||void 0===Z?void 0:Z.candidate}`,el,et))}),this.onMute=()=>ac(this,void 0,void 0,function*(){let{token:p,action:_,traceId:Z,identifier:et}=this;this.trace(p,Z,"Track has muted",_,et)}),this.onUnMute=()=>ac(this,void 0,void 0,function*(){let{token:p,action:_,traceId:Z,identifier:et}=this;this.trace(p,Z,"Track has unmuted",_,et)}),this.fetchAndSetRemoteDescription=p=>ac(this,void 0,void 0,function*(){var _,Z,et,el,eu;let ed;let eh=null===(Z=null===(_=this.peerConnection)||void 0===_?void 0:_.localDescription)||void 0===Z?void 0:Z.sdp;eh||this.logger.warn({msg:"Unexpected state: No SDP offer when attempting to fetch remote description"});let{token:ep,traceId:ef,action:eg,identifier:ev,tag:em}=this,{endpointURL:eE,nodeOverride:eS,assignmentToken:e_,multiCodec:ey,abortController:eb}=p;this.perfTracker.markPostStart(),this.perfTracker.markSdpExchangeStart();try{let p=function(p){let{connection:_,token:Z,action:et,identifier:el,tracker:eu,signalingConfig:ed}=p,eh=_&&_.supportsSdpExchange()&&_.isConnected(),ep=et===iG.SUBSCRIBE&&eh&&!Ot()&&!xt(),ef=et===iG.PUBLISH&&eh&&!Ot()&&!Lt();return ep||ef?new EdpSdpExchanger(Z,_,{action:et,remoteParticipantId:el,signalingConfig:ed},eu):new HttpSdpExchanger(Z,{action:et,remoteParticipantId:el},eu)}({connection:this.stageConnection,action:eg,token:ep,identifier:this.identifier,tracker:this.analyticsTracker,signalingConfig:null===(et=this.stageConfig)||void 0===et?void 0:et.signaling});this.perfTracker.setTransport(p.getTransport());let _=eS||At(),Z=kt();ed=yield p.exchange({sdpOffer:eh,url:eE,traceId:ef,forceNode:_,forceCluster:Z,assignmentToken:e_,multiCodec:ey,abortController:eb,initialLayerPreference:null===(el=this.simulcastSubscribeConfig)||void 0===el?void 0:el.initialLayerPreference})}catch(_){let p=_;p instanceof StageClientError||(p=new StageClientError(Object.assign(Object.assign({},n5.UNEXPECTED_ERROR),{action:eg,token:ep,traceId:ef,tag:em,details:_ instanceof Error?_.message:"",location:"sdp-exchange"}))),p instanceof StageClientError&&(this.analyticsTracker.trackError(p),this.emit
6(ty,p))}if(this.perfTracker.markSdpExchangeStop(),!ed)return;let{location:eC,sessionDeleteLink:eT,mediaControls:eI}=ed,eR=ed.sdpAnswer;try{eR=this.mungeSdpAnswer(eR),ed.sdpAnswer=eR}catch(p){this.logger.error({err:p,msg:"Error while attempting to munge SDP, keeping original answer"})}this.statsReporter.sdpAnswer=eR,this.emit(t_,ed),eC&&(this.whipResource={location:eC,sessionDeleteLink:eT,mediaControls:eI},this.sfuResource=function(p){let _=p.match(/https:\/\/([^/]+)\//);if(_){let p=_[1].split(".");if(p[0].includes("video-rtx"))return{node:`${p[0]}.${p[1]}`,cluster:p[1]}}}(eC)||{node:"",cluster:""},this.statsReporter.updateSfuResource(this.sfuResource));try{this.perfTracker.markSetRemoteDescStart(),yield null===(eu=this.peerConnection)||void 0===eu?void 0:eu.setRemoteDescription({sdp:eR,type:"answer"}),this.perfTracker.markSetRemoteDescStop(),this.perfTracker.markPostStop()}catch(_){let p=new StageClientError(Object.assign(Object.assign({},n5.SET_ANSWER_FAILURE),{action:eg,token:ep,traceId:ef,tag:ds(eg,ev),location:"setRemoteDescription",remoteParticipantId:ev,details:_ instanceof Error?_.message:""}));this.analyticsTracker.trackError(p),this.emit(ty,p)}}),this.cleanup=(p,_,Z,et=!1)=>ac(this,void 0,void 0,function*(){var el,eu;let ed=ts();if(this.toggleStageConnectionListeners(!1),this.currentJitterBufferMinDelayInMs=void 0,this.stageConnection=void 0,this.closeFailedPeerConnections(),!(null===(el=this.whipResource)||void 0===el?void 0:el.location))return this.trace(Z,this.traceId,"whipResource location not known, exiting cleanup",p,_),void this.analyticsTracker.trackError(new StageClientError(Object.assign(Object.assign({},n5.WHIP_URL_MISSING),{action:p,token:Z,traceId:this.traceId,tag:ds(p,_),location:p===iG.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:ed,remoteParticipantId:_})));let eh=this.whipResource.location;if(this.trace(Z,this.traceId,`use hostnamecachedurl: ${eh}`,p,_),et){if(null===(eu=this.whipResource)||void 0===eu?void 0:eu.sessionDeleteLink){eh=this.whipResource.sessionDeleteLink,this.trace(Z,this.traceId,`DELETE via session-delete beacon path: ${eh}`,p,_);try{navigator.sendBeacon(eh,JSON.stringify({authorization:Z.rawToken}))}catch(et){this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},hs(n5.WHIP_DELETE_FAILURE,et)),{action:p,token:Z,traceId:this.traceId,tag:ds(p,_),location:iG.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:ed,remoteParticipantId:_})))}}}else{let et=yield function(p){return Ea(this,void 0,void 0,function*(){let _;try{_=yield fetch(p.url,{method:"DELETE",headers:p.headers,signal:p.signal})}catch(_){return _ instanceof Error&&"AbortError"===_.name?tm.err(ga(p.url)):tm.err(va(p.url,_))}if(404===_.status)return tm.ok(void 0);if(!_.ok){let p=yield fa(_),Z=p.ok?p.value:null;return tm.err(HttpError.fromResponse(_,Z))}return tm.ok(void 0)})}({url:eh,headers:{Authorization:`Bearer ${Z.rawToken}`,"X-Stages-Platform":"web","X-Stages-Request-ID":ed.value,"X-Stages-SDK":"1.38.0","X-Stages-Session-ID":this.analyticsTracker.getSessionId(),"X-Stages-Trace-ID":this.traceId.value,"X-Stages-WHIP-Version":i2}});if(!et.ok){let el=et.error;404===el.status?this.trace(Z,this.traceId,`DELETE returned 404, ignoring, action = ${p}, uuid = ${ed.value}`,p,_):this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},hs(n5.WHIP_DELETE_FAILURE,el)),{action:p,token:Z,traceId:this.traceId,tag:ds(p,_),location:p===iG.SUBSCRIBE?"unsubscribe":"unpublish",requestUUID:ed,remoteParticipantId:_})))}}}),this.getConnectionState=()=>{if(!this.peerConnection)return tz.NONE;let p=this.peerConnection.connectionState||this.peerConnection.iceConnectionState;try{return en(p)}catch(_){return this.logger.warn({msg:"Unhandled connection state:",rawState:p}),tz.IDLE}},this.onIceCandidateError=p=>{let{token:_,traceId:Z,tag:et}=this;if(701!==p.errorCode){let p=new StageClientError(Object.assign(Object.assign({},n5.ICE_CANDIDATE_ERROR),{action:this.action,token:_,traceId:Z,tag:et,location:"onIceCandidateError",remoteParticipantId:this.identifier}));
6this.analyticsTracker.trackError(p),this.emit(ty,p)}},this.onIceConnectionStateChange=()=>{var p;"checking"===(null===(p=this.peerConnection)||void 0===p?void 0:p.iceConnectionState)&&this.peerConnection.getTransceivers().forEach(({receiver:p,sender:_})=>{[p,_].forEach(p=>{var _,Z;null===(Z=null===(_=null==p?void 0:p.transport)||void 0===_?void 0:_.iceTransport)||void 0===Z||Z.addEventListener("selectedcandidatepairchange",this.onSelectedCandidatePairChange)})}),this.onConnectionStateChange()},this.createVideoSenderTransformer=()=>new VideoSenderTransformer(this.analyticsTracker.getSessionId()),this.createVideoReceiverTransformer=()=>{var p;let _;let Z=new VideoReceiverTransformer(this.analyticsTracker.getSessionId()),{token:et,tag:el,identifier:eu,action:ed,traceId:eh}=this;Z.on(ov,p=>{this.emit(tb,p)});let ep=(p=p=>{let _=`Transform error occurred: ${p.type}`,Z=Ka({traceId:eh,token:et,tag:el,identifier:eu,action:ed,details:_,stageErrorValue:n5.TRANSFORM_UNEXPECTED_ERROR});this.logger.warn({err:Z,msg:"Error encountered when transforming receiver",error:p})},_=0,function(...Z){let et=Date.now();et-_>=1e3&&(_=et,p(...Z))}),a=p=>{let _=`Too many errors occurred: ${p.type}`,ep=Ka({traceId:eh,token:et,tag:el,identifier:eu,action:ed,details:_,stageErrorValue:n5.TRANSFORM_TOO_MANY_ERRORS});this.logger.error({err:ep,msg:"Too many errors encountered when transforming receiver. Shutting down transformer.",error:p}),Z.destroy(),this.analyticsTracker.trackError(ep),this.emit(tC,ep)};return Z.on(om,p=>{p.stageErrorValue.code!==n5.TRANSFORM_TOO_MANY_ERRORS.code?ep(p):a(p)}),Z},this.onConnectionStateChange=()=>{if(this.peerConnection){let p=this.peerConnection.connectionState||this.peerConnection.iceConnectionState,{token:_,traceId:Z,identifier:et,action:el}=this,eu=new ConnectionStateEvent(el,_,Z,p,et);this.analyticsTracker.trackEventNoSharedProps(eu)}let p=this.getConnectionState();switch(p){case tz.CONNECTED:this.closeFailedPeerConnections(),this.perfTracker.markActionStop(),this.emit(tS,p),this.statsReporter.updateMultihostConfiguration(this.publishAudioStream,this.publishVideoStream);break;case tz.FAILED:this.storeFailedPeerConnection(this.peerConnection),this.destroyPeerConnection({closeConnection:!1}),this.emit(tS,p),this.handleConnectionFailure();break;
6default:this.emit(tS,p)}},this.onIncompatibleCodecs=p=>ac(this,void 0,void 0,function*(){var _,Z,et,el,eu,ed;if(p.forEach(p=>{let _=!1;this.incompatibleCodecs.forEach(Z=>{Z.config===p.config&&Z.mime===p.mime&&(_=!0)}),_||this.incompatibleCodecs.add(p)}),this.peerConnection)try{yield(_=this.peerConnection,Z=[...this.incompatibleCodecs],et=void 0,el=void 0,eu=void 0,ed=function*(){var p;for(let et of _.getSenders()){let _=et.getParameters();if(_.codecs.length>1){let el=_.codecs[0],eu=!1;for(let p of Z)Ya(el,p)&&(eu=!0);if(eu){let el=Xa(Z,_.codecs);null===(p=_.encodings)||void 0===p||p.forEach(p=>{p.active&&(p.codec=el)}),yield et.setParameters(_)}}}},new(eu||(eu=Promise))(function(p,_){function s(p){try{c(ed.next(p))}catch(p){_(p)}}function a(p){try{c(ed.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof eu?Z:new eu(function(p){p(Z)})).then(s,a)}c((ed=ed.apply(et,el||[])).next())}))}catch(eu){let{token:p,action:_,traceId:Z,identifier:et}=this,el=new StageClientError(Object.assign(Object.assign({},n5.CODEC_HANDLE_INCOMPATIBLE_UNEXPECTED_ERROR),{action:_,token:p,traceId:Z,tag:ds(_,et),location:"onIncompatibleCodecs",remoteParticipantId:et,details:eu instanceof Error?eu.message:""}));this.analyticsTracker.trackError(el),this.emit(ty,el)}}),this.token=p,this.logger=new ScopedLogger(_,e0.WEBRTC),this.action=Z,this.tag=et,this.traceId=el,Z===iG.SUBSCRIBE&&!eh)throw Error("Subscribe action provided without subscriber Id");this.jitterBufferConfig=null==ef?void 0:ef.jitterBuffer,this.simulcastSubscribeConfig=null==ef?void 0:ef.simulcast,this.subscriberId=eh,this.stageConnection=ep,this.failedPeerConnections=[],this.receiveInBandMessagingEnabled=!!(null===(ev=this.subscribeConfig)||void 0===ev?void 0:ev.inBandMessaging.enabled),this.perfTracker=new PeerClientPerformanceTracker(this.action,this.traceId),this.statsReporter=ed,this.handlePublishingChangedBinding=this.handlePublishingChanged.bind(this),this.toggleStageConnectionListeners(!0)}get videoMediaId(){var p,_;return null!==(_=null===(p=this.videoTransceiver)||void 0===p?void 0:p.mid)&&void 0!==_?_:null}toggleStageConnectionListeners(p){var _,Z;p?null===(_=this.stageConnection)||void 0===_||_.on(il,this.handlePublishingChangedBinding):null===(Z=this.stageConnection)||void 0===Z||Z.off(il,this.handlePublishingChangedBinding)}updateSubscribeConfig(p){var _,Z;if(this.jitterBufferConfig=p.jitterBuffer,this.simulcastSubscribeConfig=p.simulcast,this.action===iG.SUBSCRIBE){let _=p.inBandMessaging.enabled;this.receiveInBandMessagingEnabled!==_&&this.logger.warn({msg:"Cannot mutate in-band messaging config value for receiver"})}this.applyJitterBufferMinDelayConditionally(null!==(Z=null===(_=this.stageConnection)||void 0===_?void 0:_.getIsStagePublishing())&&void 0!==Z&&Z)}verifyOrUpdateTransceiverSync(){var p,_;return ac(this,void 0,void 0,function*(){if(this.publishVideoStream){let _=this.getTransceiverForKind("video");_?this.publishVideoStream.track.id!==(null===(p=_.sender.track)||void 0===p?void 0:p.id)&&(this.logger.debug({msg:"found out of sync video transceiver... updating"}),yield this.replaceOrUpdateStream(this.publishVideoStream)):this.logger.warn({msg:"missing transceiver for video"})}if(this.publishAudioStream){let p=this.getTransceiverForKind("audio");p?this.publishAudioStream.track.id!==(null===(_=p.sender.track)||void 0===_?void 0:_.id)&&(this.logger.debug({msg:"found out of sync audio transceiver... updating"}),yield this.replaceOrUpdateStream(this.publishAudioStream)):this.logger.warn({msg:"missing transceiver for audio"})}})}start(){return ac(this,void 0,void 0,function*(){let{token:p,action:_,traceId:Z,identifier:et}=this;_!==iG.PUBLISH||p.claims.capabilities.allow_publish||this.analyticsTracker.trackErrorAndThrow(new StageClientError(Object.assign(Object.assign({},hs(n5.TOKEN_PERMISSIONS_DENIED,Error("Cannot publish with subscribe only token"))),{action:_,token:p,traceId:Z,tag:ds(_,et),location:"StagePeerClient.start",remoteParticipantId:et})));let el=function({action:p,identifier:_,token:Z,analyticsTracker:et}){let el="",eu=new StageTokenRefImpl(Z,et);switch(p){case iG.PUBLISH:el=eu.getPublishEndpoint();break;case iG.SUBSCRIBE:_&&(el=eu.getSubscribeEndpoint(_))}return el}({action:_,identifier:et,token:p.rawToken,analyticsTracker:this.analyticsTracker});try{this.perfTracker.markActionStart(),this.endpointURL=el,this.createPeerConnection(),this.trace(p,Z,"peer connection created",_,et)}catch(eu){let el=new StageClientError(Object.assign(Object.assign({action:_},hs(n5.CREATE_PEER_CONNECTION_FAILURE,eu)),{token:p,traceId:Z,tag:ds(_,et),location:"StagePeerClient.start",remoteParticipantId:et}));
6_===iG.PUBLISH&&this.emit(tS,tz.FAILED),this.emit(ty,el),this.analyticsTracker.trackErrorAndThrow(el)}})}mungeSdpOffer(p,_,Z){if(Z.simulcastEnabled&&(p=new SdpMunger(p).withVideoLayersAllocationRtpHeaderExtension().sdp),_===iG.SUBSCRIBE)p=new SdpMunger(p).withOpusAudioConfig(Wn(rR),!0).sdp;else if(_===iG.PUBLISH&&Z.audioConfig){let{maxBitrateBps:_,stereo:et}=Z.audioConfig;p=new SdpMunger(p).withOpusAudioConfig(_,et).sdp}return p}mungeSdpAnswer(p){rh.browser.isFirefox()&&this.publishAudioStream&&this.action===iG.PUBLISH&&(p=new SdpMunger(p).withOpusAudioConfig(this.publishAudioStream.config.maxBitrateBps,void 0).sdp);let _=rh.browser.isChrome()||rh.browser.isEdge();this.action===iG.SUBSCRIBE&&_&&(p=new SdpMunger(p).withoutAudioRtcpRSize().sdp);let Z=Mt();return this.action===iG.SUBSCRIBE&&Z&&(p=new SdpMunger(p).withFilteredCandidates(Z).sdp),p}createPeerConnection(){var p;this.logger.debug({msg:"setting up peer connection"}),this.peerConnection&&(this.logger.debug({msg:"peer connection is already established, cleaning up previous connection"}),this.destroyPeerConnection({closeConnection:!1})),this.peerConnection=new RTCPeerConnection({iceTransportPolicy:"all"}),this.statsReporter.start(this.peerConnection,null===(p=this.publishVideoStream)||void 0===p?void 0:p.config.simulcastEnabled),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError),this.peerConnection.addEventListener("icegatheringstatechange",this.onIceGatheringStateChange),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate),this.peerConnection.addEventListener("track",this.onTrack),this.peerConnection.addEventListener("mute",this.onMute),this.peerConnection.addEventListener("unmute",this.onUnMute)}destroyPeerConnection(p){var _,Z,et,el,eu,ed,eh,ep,ef;this.statsReporter.stop(),null===(_=this.peerConnection)||void 0===_||_.removeEventListener("connectionstatechange",this.onConnectionStateChange),null===(Z=this.peerConnection)||void 0===Z||Z.removeEventListener("iceconnectionstatechange",this.onIceConnectionStateChange),null===(et=this.peerConnection)||void 0===et||et.removeEventListener("icecandidateerror",this.onIceCandidateError),null===(el=this.peerConnection)||void 0===el||el.removeEventListener("icegatheringstatechange",this.onIceGatheringStateChange),null===(eu=this.peerConnection)||void 0===eu||eu.removeEventListener("icecandidate",this.onIceCandidate),null===(ed=this.peerConnection)||void 0===ed||ed.removeEventListener("track",this.onTrack),null===(eh=this.peerConnection)||void 0===eh||eh.removeEventListener("mute",this.onMute),null===(ep=this.peerConnection)||void 0===ep||ep.removeEventListener("unmute",this.onUnMute),(p.closeConnection||this.action===iG.PUBLISH)&&(null===(ef=this.peerConnection)||void 0===ef||ef.close()),this.peerConnection=void 0}closeFailedPeerConnections(){for(let p of this.failedPeerConnections)null==p||p.close();this.failedPeerConnections=[]}storeFailedPeerConnection(p){p&&this.action!==iG.PUBLISH&&this.failedPeerConnections.push(p)}stop(){var p,_;null===(p=this.videoReceiverTransformer)||void 0===p||p.destroy(),null===(_=this.videoSenderTransformer)||void 0===_||_.destroy(),this.destroyPeerConnection({closeConnection:!0})}getTransceiverForKind(p){if(!this.peerConnection)return;let _=this.peerConnection.getTransceivers();return"audio"===p?_.find(p=>"0"===p.mid):"video"===p?_.find(p=>"1"===p.mid):void 0}removeTrack(p){return ac(this,void 0,void 0,function*(){if("audio"===p||"video"===p){if(this.trace(this.token,this.traceId,`removeTrack: type=${p}`,this.action,this.identifier),this.peerConnection)try{let _=this.getTransceiverForKind(p);if(!_)return void this.logger.warn({msg:`tried removing track type ${p} but couldn't find transceiver`});yield _.sender.replaceTrack(null),p===ri.AUDIO?this.publishAudioStream=void 0:this.publishVideoStream=void 0,yield this.statsReporter.updateMultihostConfiguration(this.publishAudioStream,this.publishVideoStream)}catch(p){this.logger.warn({msg:"error replacing track",err:p})}else p===ri.AUDIO?this.publishAudioStream=void 0:this.publishVideoStream
6=void 0}else this.logger.warn({msg:"RemoveTrack called with invalid track type",trackType:p})})}replaceOrUpdateStream(p){return ac(this,void 0,void 0,function*(){if(p.track){if(this.trace(this.token,this.traceId,`replaceOrUpdateStream: kind=${p.track.kind} started`,this.action,this.identifier),ui(p)?this.publishAudioStream=p:li(p)&&(this.publishVideoStream=p),this.peerConnection)try{let _=this.getTransceiverForKind(p.track.kind);if(!_)return void this.logger.warn({msg:`tried replacing track type ${p.track.kind} but couldn't find transceiver`,track:p.track});if(li(p)){let Z=_.sender.getParameters(),et=p.config.encodingLayers;Z.encodings=Z.encodings.map(p=>{var _;let Z=null!==(_=p.rid)&&void 0!==_?_:"",el=et.find(p=>{var _;return(null!==(_=p.rid)&&void 0!==_?_:"")===Z});return el?Object.assign(Object.assign({},p),el):p}),yield _.sender.setParameters(Z)}else if(ui(p)){let Z=_.sender.getParameters(),et=qn(p)[0];Z.encodings=Z.encodings.map(p=>Object.assign(Object.assign({},p),et)),yield _.sender.setParameters(Z)}yield _.sender.replaceTrack(p.track),this.trace(this.token,this.traceId,`replaceOrUpdateStream: kind=${p.track.kind} finished`,this.action,this.identifier),yield this.statsReporter.updateMultihostConfiguration(this.publishAudioStream,this.publishVideoStream)}catch(_){this.trace(this.token,this.traceId,`replaceOrUpdateStream: kind=${p.track.kind} failed`,this.action,this.identifier),this.logger.warn({msg:"error replacing track",err:_})}}else this.logger.warn({msg:"Unexpected call to replaceOrUpdateStream with no track"})})}initializePeerConnection(p=!1){var _,Z,et,el,eu,ed,eh,ep;return ac(this,void 0,void 0,function*(){let{traceId:ef,token:eg,action:ev,identifier:em}=this;Mo(this.peerConnection),this.resetTransformers();let eE=new MediaStream;if(ev===iG.PUBLISH){this.publishAudioStream||(this.publishAudioStream={track:this.getSilentAudio(),config:{maxBitrateBps:Wn(rI),stereo:!1}});let p=this.peerConnection.getTransceivers(),ed=[];p.forEach(p=>{var _;ed.concat(null===(_=p.sender.track)||void 0===_?void 0:_.id)}),eE=new MediaStream([this.publishAudioStream.track,null===(_=this.publishVideoStream)||void 0===_?void 0:_.track].filter(p=>!!p&&!ed.includes(p.id)));let eh=eE.getAudioTracks()[0]||"audio",ep=eE.getVideoTracks()[0]||"video",eS={direction:"sendonly",streams:[eE],sendEncodings:qn(this.publishAudioStream)},e_={direction:"sendrecv",streams:[eE],sendEncodings:null===(Z=this.publishVideoStream)||void 0===Z?void 0:Z.config.encodingLayers};this.peerConnection.addTransceiver(eh,eS),this.trace(eg,ef,`track added, type: ${eh.kind||eh}`,ev,em);let ey=this.peerConnection.addTransceiver(ep,e_);this.trace(eg,ef,`track added, type: ${ep.kind||ep}`,ev,em);let eb=!!(null===(el=null===(et=this.publishVideoStream)||void 0===et?void 0:et.config)||void 0===el?void 0:el.inBandMessagingEnabled);void 0===this.sendInBandMessagingEnabled?this.sendInBandMessagingEnabled=eb:this.sendInBandMessagingEnabled!==eb&&this.logger.warn({msg:"Cannot mutate in-band messaging config value for sender"}),this.sendInBandMessagingEnabled&&!VideoSenderTransformer.isSupported(ey)?this.handleTransformNotSupported():this.sendInBandMessagingEnabled&&(null===(eu=this.videoSenderTransformer)||void 0===eu||eu.onTransceiverAdd(ey))}else ev===iG.SUBSCRIBE&&(eg.shouldSendSilentAudio()?this.peerConnection.addTransceiver(this.getSilentAudio(),{direction:"sendrecv"}):this.peerConnection.addTransceiver("audio",{direction:"recvonly"}),this.trace(eg,ef,"track added, type: audio",ev,em),p||(this.videoTransceiver=this.peerConnection.addTransceiver("video",{direction:"recvonly"}),this.trace(eg,ef,"track added, type: video",ev,em),this.receiveInBandMessagingEnabled&&!VideoReceiverTransformer.isSupported(this.videoTransceiver)?this.handleTransformNotSupported():this.receiveInBandMessagingEnabled&&(null===(ed=this.videoReceiverTransformer)||void 0===ed||ed.onTransceiverAdd(this.videoTransceiver))),this.peerConnection.getTransceivers().forEach(p=>{p.receiver?(this.logger.info({msg:"dbg: Subscribe succeeded, adding media track to participant mediaStream"}),null==eE||eE.addTrack(p.receiver.track)):this.logger.info({msg:"dbg: Subscribe succeeded, but Transceiver were negotiated without Receiver"})}),this.applyJitterBufferMinDelayConditionally(null!==(ep=null===(eh=this.stageConnection)||void 0===eh?void 0:eh.getIsStagePublishing())&&void 0!==ep&&ep));return eE})}handlePublishingChanged(p){this.logger.debug({msg:`[handlePublishingChanged (${this.subscriberId})] isStagePublishing: ${p}, currentMinDelay: ${this.currentJitterBufferMinDelayInMs}`}),this.action===iG.SUBSCRIBE&&this.applyJitterBufferMinDelayConditionally(p)}applyJitterBufferMinDelayConditionally(p){let _=this.currentJitterBufferMinDelayInMs,Z=this.calcJitterBufferMinDelay(p,this.jitterBufferConfig);if(p){if(void 0===_||_>Z){let p=`[applyJitterBufferMinDelayConditionally (${this.subscriberId})] participant is publishing and min delay is unset or > configured; attempting to update to ${Z}`;this.logger.debug({msg:p}),this.trace(this.token,this.traceId,p,this.action,this.identifier),this.applyAndTrackJitterBufferMinDelay(Z)}}else if(void 0===_||Z!==_){let p=`[applyJitterBufferMinDelayConditionally (${this.subscriberId})] participant is subscribe-only and min delay is unset or != configured; attempting to update to ${Z}`;this.logger.debug({msg:p}),this.trace(this.token,this.traceId,p,this.action,this.identifier),this.applyAndTrackJitterBufferMinDelay(Z)}}calcJitterBufferMinDelay(p,_){var Z,et,el;let eu=0;if(!(()=>{let p=RTCRtpReceiver.prototype;
6return!(!p||"object"!=typeof p)&&("jitterBufferTarget"in p||"playoutDelayHint"in p)})())return 0;if(p)eu=$a(null!==(Z=null==_?void 0:_.minDelayWhenPublishing)&&void 0!==Z?Z:rs.DEFAULT,p);else{eu=$a(null!==(et=null==_?void 0:_.minDelayWhenSubscribeOnly)&&void 0!==et?et:rs.DEFAULT,p);let Z=null===(el=this.stageConnection)||void 0===el?void 0:el.jitterBufferMinDelayInMs();(null==_?void 0:_.minDelayWhenSubscribeOnly)===rs.DEFAULT&&void 0!==Z&&(eu=Z,this.logger.debug({msg:`[calcJitterBufferMinDelay] overriding min delay with remote value: ${eu}`}))}return eu}applyAndTrackJitterBufferMinDelay(p){var _,Z;this.currentJitterBufferMinDelayInMs=p,this.statsReporter.updateJitterBufferMinDelay(p),void 0!==p&&(null===(Z=null===(_=this.peerConnection)||void 0===_?void 0:_.getTransceivers())||void 0===Z||Z.forEach(_=>{_.receiver&&this.applyJitterBufferMinDelay(_.receiver,p)}))}applyJitterBufferMinDelay(p,_){let Z="Unable to set jitter buffer min delay";if("jitterBufferTarget"in p)Z=`setting jitterBufferTarget to: ${_} for track: ${p.track.kind}`,this.logger.debug({msg:Z}),p.jitterBufferTarget=_;else if("playoutDelayHint"in p){let et=_/1e3;Z=`setting playoutDelayHint to: ${_} for track: ${p.track.kind}`,this.logger.debug({msg:Z}),p.playoutDelayHint=et}else this.logger.warn({msg:Z});this.trace(this.token,this.traceId,Z,this.action,this.identifier)}exchangeSdp(p){var _,Z,et,el,eu;return ac(this,void 0,void 0,function*(){let ed;let{traceId:eh,token:ep,action:ef,identifier:eg,tag:ev,endpointURL:em}=this,{iceRestart:eE=!1,nodeOverride:eS,assignmentToken:e_,abortController:ey}=p;if(this.logger.debug({msg:`Exchanging SDP: ${eh.value}, iceRestart=${eE}, nodeOverride=${eS}, assignmentToken=${e_}`}),Mo(this.peerConnection),ef===iG.PUBLISH&&(null===(_=this.publishVideoStream)||void 0===_?void 0:_.config.codecs)){this.logger.debug({msg:"Applying publisher codec preferences",codecs:this.publishVideoStream.config.codecs});let p=this.peerConnection.getTransceivers().find(p=>"video"===p.receiver.track.kind);p?p.setCodecPreferences(this.publishVideoStream.config.codecs):this.trace(ep,eh,"Unable to setCodecPreferences, no transceiver",ef,eg)}try{this.trace(ep,eh,"Creating offer",ef,eg),ed=yield this.peerConnection.createOffer({iceRestart:eE})}catch(_){let p=new StageClientError(Object.assign(Object.assign({},hs(n5.CREATE_OFFER_FAILURE,_)),{action:ef,token:ep,traceId:eh,tag:ev,location:"exchangeSdp",remoteParticipantId:eg}));this.emit(ty,p),this.analyticsTracker.trackErrorAndThrow(p)}ed.sdp&&(ed.sdp=this.mungeSdpOffer(ed.sdp,ef,{simulcastEnabled:null!==(et=null===(Z=this.publishVideoStream)||void 0===Z?void 0:Z.config.simulcastEnabled)&&void 0!==et&&et,audioConfig:null===(el=this.publishAudioStream)||void 0===el?void 0:el.config})),this.trace(ep,eh,"Setting local description",ef,eg),yield this.peerConnection.setLocalDescription(ed),this.trace(ep,eh,"local description set",ef,eg),em||this.logger.warn({msg:"Unexpected state: No endpointURL specified for fetching of remote description."});let eb=ef===iG.PUBLISH&&(p=>{if(!p||0===p.length)return!1;let _=p[0];return ja(_,[{profileLevel:t7.MAIN_31}])})(null===(eu=this.publishVideoStream)||void 0===eu?void 0:eu.config.codecs)||ef===iG.SUBSCRIBE&&Dt();yield this.fetchAndSetRemoteDescription({endpointURL:em,nodeOverride:eS,assignmentToken:e_,multiCodec:eb,abortController:ey})})}getReports(){var p;return ac(this,void 0,void 0,function*(){try{let _=(yield null===(p=this.peerConnection)||void 0===p?void 0:p.getStats())||[],Z=[];return _.forEach(p=>{Z.push(p)}),Z}catch(p){return[]}})}requestRTCStats(p){return ac(this,void 0,void 0,function*(){if(this.peerConnection)return this.statsReporter.getStats(p)})}get identifier(){return this.subscriberId||this.token.participantID}handleTransformNotSupported(){let{token:p,tag:_,identifier:Z,action:et,traceId:el}=this,eu=Ka({traceId:el,token:p,tag:_,identifier:Z,action:et,stageErrorValue:n5.TRANSFORM_NOT_SUPPORTED_BY_PLATFORM});this.logger.error({err:eu,msg:"Transforms not supported by this platform"}),this.analyticsTracker.trackError(eu),this.emit(tC,eu)}handleConnectionFailure(){return ac(this,void 0,void 0,function*(){let{token:p,traceId:_,tag:Z}=this;this.analyticsTracker.trackError(new StageClientError(Object.assign(Object.assign({},n5.PEER_CONNECTION_NETWORK_FAILURE),{action:this.action,token:p,traceId:_,tag:Z,location:"onIceCandidateError",remoteParticipantId:this.identifier})))})}getSilentAudio(){oE||(oE=new AudioContext);let p=oE.createOscillator(),_=oE.createGain();p.connect(_);let Z=oE.createMediaStreamDestination();return _.connect(Z),_.gain.value=0,p.start(),Z.stream.getAudioTracks()[0]}getActionMeasurements(){return this.perfTracker.getMeasurements()}getProtocol(){return this.protocol}
6initStreamsToPublish(p){this.publishVideoStream=p.find(li),this.publishAudioStream=p.find(ui)}getSfuResource(){return this.sfuResource}requestReassignment(){var p;return ac(this,void 0,void 0,function*(){let _=null===(p=this.whipResource)||void 0===p?void 0:p.location;if(!_)return void this.logger.warn({msg:"Cannot trigger adhoc reassignment: location not available"});let Z=_.replace(/\/session\//,"/reassign/");this.logger.debug({msg:`Triggering adhoc reassignment to: ${Z}`});try{let p=yield _a({url:Z,headers:ma(this.token,this.analyticsTracker.getSessionId(),this.traceId)});if(!p.ok)throw Error(`Reassignment request failed: ${p.error.status} ${p.error.statusText}`);this.logger.debug({msg:"Adhoc reassignment request sent"})}catch(p){throw this.logger.error({msg:"Adhoc reassignment request failed",err:p}),p}})}getExpectedJitterBufferMinDelayInMs(){var p,_;return this.calcJitterBufferMinDelay(null!==(_=null===(p=this.stageConnection)||void 0===p?void 0:p.getIsStagePublishing())&&void 0!==_&&_,this.jitterBufferConfig)}trace(p,_,Z,et,el){this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(p,_,Z,et,el))}sendSeiMessage(p,_){let Z=this.getTransceiverForKind("video");return this.videoSenderTransformer&&this.sendInBandMessagingEnabled?this.action===iG.PUBLISH&&Z?this.videoSenderTransformer.sendSeiMessage(p,_):tm.err(ox.NOT_PUBLISHING_VIDEO):tm.err(ox.INBAND_MESSAGING_NOT_ENABLED)}};let PublishEvent=class PublishEvent extends StageAnalyticsEvent{constructor(p){super(tg.PUBLISH,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.PUBLISH,remote_participant_id:p.token.participantID})}};let UnpublishEvent=class UnpublishEvent extends StageAnalyticsEvent{constructor(p){super(tg.UNPUBLISH,p.token,p.traceId,!0),Object.assign(this.properties,{action:iG.PUBLISH,remote_participant_id:p.token.participantID})}};let SubscribeEvent=class SubscribeEvent extends StageAnalyticsEvent{constructor(p){var _,Z,et,el;super(tg.SUBSCRIBE,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.SUBSCRIBE,remote_participant_id:p.subscribedId,subscribed_id:p.subscribedId,is_edp_connected:p.isEdpConnected,is_reassignment:p.isReassignment,node:null!==(Z=null===(_=p.preAttemptSfuResource)||void 0===_?void 0:_.node)&&void 0!==Z?Z:"",cluster:null!==(el=null===(et=p.preAttemptSfuResource)||void 0===et?void 0:et.cluster)&&void 0!==el?el:""})}};let UnsubscribeEvent=class UnsubscribeEvent extends StageAnalyticsEvent{constructor(p){super(tg.UNSUBSCRIBE,p.token,p.traceId,!0),Object.assign(this.properties,{action:iG.SUBSCRIBE,remote_participant_id:p.unsubscribedId,unsubscribed_id:p.unsubscribedId})}};let PublishStartedEvent=class PublishStartedEvent extends StageAnalyticsEvent{constructor(p){var _,Z,et,el;super(tg.PUBLISH_STARTED,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.PUBLISH,options_duration:p.optionsDuration,post_duration:p.postDuration,remote_participant_id:p.token.participantID,time_to_candidate:p.timeToCandidate,total_duration:p.totalDuration,edp_initial_connect_duration:p.edpInitialConnectDuration,edp_initial_connect_retry_times:p.edpInitialConnectRetries,edp_initial_state_duration:p.edpInitialStateDuration,edp_state_update_count:p.edpStateUpdateCount,sdp_exchange_duration:p.sdpExchangeDuration,sdp_exchange_transport:p.sdpExchangeTransport,set_remote_desc_duration:p.setRemoteDescDuration,peer_connection_duration:p.peerConnectionDuration,node:null!==(Z=null===(_=p.sfuResource)||void 0===_?void 0:_.node)&&void 0!==Z?Z:"",cluster:null!==(el=null===(et=p.sfuResource)||void 0===et?void 0:et.cluster)&&void 0!==el?el:"",publish_retry_times:p.publishRetries,total_duration_with_retries:p.totalDurationWithRetries,protocol:p.protocol})}};let PublishFailedEvent=class PublishFailedEvent extends StageAnalyticsEvent{constructor(p){super(tg.PUBLISH_FAILED,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.PUBLISH,code:p.code,message:p.message,fatal:p.fatal,nominal:p.nominal,protocol:p.protocol})}};let PublishEndedEvent=class PublishEndedEvent extends StageAnalyticsEvent{constructor(p){super(tg.PUBLISH_ENDED,p.token,p.traceId,!0),Ob
6ject.assign(this.properties,{action:iG.PUBLISH,remote_participant_id:p.token.participantID,unpublish_successful:p.isUnpublishSuccessful,reason:p.reason,protocol:p.protocol})}};let SubscribeStartedEvent=class SubscribeStartedEvent extends StageAnalyticsEvent{constructor(p){var _,Z,et,el;super(tg.SUBSCRIBE_STARTED,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.SUBSCRIBE,options_duration:p.optionsDuration,post_duration:p.postDuration,remote_participant_id:p.remoteParticipantId,time_to_candidate:p.timeToCandidate,total_duration:p.totalDuration,edp_initial_connect_duration:p.edpInitialConnectDuration,edp_initial_connect_retry_times:p.edpInitialConnectRetries,edp_initial_state_duration:p.edpInitialStateDuration,edp_initial_state_publishing_count:p.edpInitialStatePublishingCount,edp_state_update_count:p.edpStateUpdateCount,sdp_exchange_duration:p.sdpExchangeDuration,sdp_exchange_transport:p.sdpExchangeTransport,set_remote_desc_duration:p.setRemoteDescDuration,peer_connection_duration:p.peerConnectionDuration,node:null!==(Z=null===(_=p.sfuResource)||void 0===_?void 0:_.node)&&void 0!==Z?Z:"",cluster:null!==(el=null===(et=p.sfuResource)||void 0===et?void 0:et.cluster)&&void 0!==el?el:"",total_duration_with_retries:p.totalDurationWithRetries,subscribe_retry_times:p.subscribeRetryTimes,is_reassignment:p.isReassignment,protocol:p.protocol})}};let SubscribeFailedEvent=class SubscribeFailedEvent extends StageAnalyticsEvent{constructor(p){super(tg.SUBSCRIBE_FAILED,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.SUBSCRIBE,remote_participant_id:p.remoteParticipantId,code:p.code,message:p.message,fatal:p.fatal,nominal:p.nominal,is_reassignment:p.isReassignment,protocol:p.protocol})}};let SubscribeEndedEvent=class SubscribeEndedEvent extends StageAnalyticsEvent{constructor(p){super(tg.SUBSCRIBE_ENDED,p.token,p.traceId,!0),Object.assign(this.properties,{action:iG.SUBSCRIBE,remote_participant_id:p.remoteParticipantId,unsubscribe_successful:p.isUnsubscribeSuccessful,reason:p.reason,protocol:p.protocol}),this.critical=!0}};let StateUpdatedEvent=class StateUpdatedEvent extends StageAnalyticsEvent{constructor(p){super(tg.STATE_UPDATED,p.token,p.traceId,!1),Object.assign(this.properties,{audio_muted:p.isAudioMuted,is_disconnected:p.isDisconnected,is_publishing:p.isPublishing,other_participant_id:p.otherParticipantId,other_participant_user_id:p.otherParticipantUserId,video_stopped:p.isVideoStopped})}};let FirstFrameEvent=class FirstFrameEvent extends StageAnalyticsEvent{constructor(p){var _,Z,et,el,eu;super(tg.FIRST_FRAME,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.SUBSCRIBE,remote_participant_id:p.remoteParticipantId,edp_initial_connect_duration:p.edpInitialConnectDuration,edp_initial_connect_retry_times:p.edpInitialConnectRetries,edp_initial_state_duration:p.edpInitialStateDuration,edp_initial_state_publishing_count:p.edpInitialStatePublishingCount,edp_state_update_count:p.edpStateUpdateCount,sdp_exchange_duration:p.sdpExchangeDuration,sdp_exchange_transport:p.sdpExchangeTransport,set_remote_desc_duration:p.setRemoteDescDuration,peer_connection_duration:p.peerConnectionDuration,node:null!==(Z=null===(_=p.sfuResource)||void 0===_?void 0:_.node)&&void 0!==Z?Z:"",cluster:null!==(el=null===(et=p.sfuResource)||void 0===et?void 0:et.cluster)&&void 0!==el?el:"",video_was_paused:p.videoWasPaused,first_frame_duration:p.firstFrameDuration,total_duration_with_retries:p.totalDurationWithRetries,subscribe_retry_times:p.subscribeRetryTimes,media_type:p.mediaType,configured_jitter_buffer_min_delay_ms:null!==(eu=p.currentJitterBufferMinDelayInMs)&&void 0!==eu?eu:0,protocol:p.protocol,rid:p.rid})}};let TimeToMediaEvent=class TimeToMediaEvent extends StageAnalyticsEvent{constructor(p){super(tg.TIME_TO_MEDIA,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.SUBSCRIBE,remote_participant_id:p.remoteParticipantId,media_type:p.mediaType,subscribe_type:p.subscribeType,time_to_media:p.timeToMedia,video_was_paused:p.videoWasPaused,rid:p.rid})}};let oS=iG.SUBSCRIBE;let SubscribeTracker=class SubscribeTracker{constructor({analyticsTracker:p,token:_,remoteId:Z,ttmEligible:et=!1}){this.action=oS,this.analyticsTracker=p,this.token=_,this.remoteId=Z,this.ttmEligible=et}trackAttempt({stageConnectionStats:p,isReassignment:_=!1,traceIdOverride:Z,preAttemptSfuResource:et}){let{action:el,analyticsTracker:eu,token:ed,remoteId:eh}=this,ep=Z||ns();return eu.trackEvent(new SubscribeEvent({token:this.token,subscribedId:this.remoteId,traceId:ep,isEdpConnected:p.isConnected,isReassignment:_,preAttemptSfuResource:et})),{getTraceId:()=>ep,trackSubscribeStarted({totalDurationWithRetries:Z,retryTimes:et,sfuResource:el,peerClientPerfStats:ef,protocol:eg}){let{optionsDuration:ev,postDuration:em,timeToCandidate:eE,timeToConnected:eS,sdpExchangeDuration:e_,sdpExchangeTransport:ey,setRemoteDescDuration:eb,peerConnectionDuration:eC}=ef,{edpInitialConnectDuration:eT,edpInitialConnectRetries:eI,edpInitialStateDuration:eR,edpInitialStatePublishingCount:eO,edpStateUpdateCount:eA}=p;eu.trackEvent(new SubscribeStartedEvent({token:ed,traceId:ep,remoteParticipantId:eh,optionsDuration:ev,postDuration:em,timeToCandidate:eE,totalDuration:eS,edpInitialConnectDuration:eT,edpInitialConnectRetries:eI,edpInitialStateDuration:eR,edpInitialStatePublishingCount:eO,edpStateUpdateCount:eA,sdpExchangeDuration:e_,sdpExchangeTransport:ey,setRemoteDescDuration:eb,peerConnectionDuration:eC,sfuResource:el,totalDurationWithRetries:Z,subscribeRetryTimes:et,isReassignment:_,protocol:eg}))},trackSubscribeFirstFrame:({peerClientPerfStats:_,totalDurationWithRetries:Z,sfuResource:et,retryTimes:el,currentJitterBufferMinDelayInMs:eu,mediaType:ed,firstFrameDuration:ef,protocol:eg,rid:ev})=>{let{sdpExchangeDuration:em,sdpExchangeTransport:eE,setRemoteDescDuration:eS,peerConnectionDuration:e_}=_,{edpInitialConnectDuration:ey,edpInitialConnectRetries:eb,edpInitialStateDuration:eC,edpInitialStatePublishingCount:eT,edpStateUpdateCount:eI}=p;this.analyticsTracker.trackEvent(new FirstFrameEvent({token:this.token,traceId:ep,remoteParticipantId:eh,edpInitialConnectDuration:ey,edpInitialConnectRetries:eb,edpInitialStateDuration:eC,edpInitialStatePublishingCount:eT,edpStateUpdateCount:eI,sdpExchangeDuration:em,sdpExchangeTransport:eE,setRemoteDescDuration:eS,peerConnectionDuration:e_,videoWasPaused:!1,firstFrameDuration:ef,mediaType:ed,sfuResource:et,totalDurationWithRetries:Z,subscribeRetryTimes:el,currentJitterBufferMinDelayInMs:eu,protocol:eg,rid:ev}))},trackTimeToMedia:({totalDurationWithRetries:_,firstFrameDuration:Z,mediaType:et,subscribeType:el,rid:eu})=>{if(!this.ttmEligible)return;let ed=p.edpInitialConnectDuration+p.edpInitialStateDuration+_+Z;this.analyticsTracker.trackEvent(new TimeToMediaEvent({token:this.token,traceId:ep,remoteParticipantId:eh,mediaType:et,subscribeType:el,timeToMedia:ed,videoWasPaused:!1,rid:eu}))},trackSubscribeFailed(Z,et,ef){let eg=((p,_,Z)=>
6{if(p instanceof StageClientError)return p;let et="";return p instanceof HttpError&&(et+=`HttpError - ${p.code||p.status}`),new StageClientError(Object.assign(Object.assign(Object.assign({},n5.SUBSCRIBE_FAILURE),{action:oS,token:_,traceId:Z,tag:n3,location:"subscribe",details:`${et} ${null==p?void 0:p.message}`}),{fatal:!0}))})(Z,ed,ep);eu.trackEvent(new SubscribeFailedEvent({token:ed,traceId:ep,remoteParticipantId:eh,code:eg.code,message:eg.message,fatal:eg.fatal,nominal:eg.nominal,isReassignment:_,protocol:et}));let{isConnected:ev}=p,em=new StageClientError(Object.assign(Object.assign({},n5.SUBSCRIBE_FAILURE),{action:el,token:ed,traceId:ep,tag:ds(iG.SUBSCRIBE,eh),location:"subscribe",remoteParticipantId:eh,isEdpConnected:ev,details:ef}));return Z instanceof StageClientError&&(em.fatal=Z.fatal,em.nominal=Z.nominal,em.location=`subscribe > ${Z.location}`),eu.trackError(em),eg},trackUnsubscribe:()=>{eu.trackEvent(new UnsubscribeEvent({token:ed,unsubscribedId:eh,traceId:ep}))},trackEndSucceeded:(p,_)=>{eu.trackEvent(new SubscribeEndedEvent({token:ed,traceId:ep,remoteParticipantId:eh,isUnsubscribeSuccessful:!0,reason:p,protocol:_}))},trackEndFailed:(p,_)=>{let Z=new StageClientError(Object.assign(Object.assign({},n5.UNSUBSCRIBE_FAILURE),{token:ed,traceId:ep,tag:ds(iG.SUBSCRIBE,eh),location:"unsubscribe",remoteParticipantId:eh}));return p!==iK.UNLOAD&&p!==iK.UNSUBSCRIBE||eu.trackError(Z),eu.trackEvent(new SubscribeEndedEvent({token:ed,traceId:ep,remoteParticipantId:eh,isUnsubscribeSuccessful:!0,reason:p,protocol:_})),Z}}}};let PlaybackLayerRequest=class PlaybackLayerRequest extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu){super(tg.PLAYBACK_LAYER_REQUEST,p,_,!1),Object.assign(this.properties,{media_type:Z,remote_participant_id:et,track_id:el,layer_id:eu})}};let PlaybackLayerState=class PlaybackLayerState extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu=1){super(tg.PLAYBACK_LAYER_STATE,p,_,!1),Object.assign(this.properties,{media_type:Z,remote_participant_id:et,track_id:el,request_count:eu})}};(oA=oB||(oB={})).PAUSE="pause",oA.PLAY="play",(ok=oj||(oj={})).IDLE="idle",ok.ACTIVE="active",ok.ERRORED="errored",ok.DESTROYED="destroyed",(oV||(oV={})).SUCCESS="success",(ow=oF||(oF={})).FAILED="failed",ow.DESTROYED="destroyed",ow.THROTTLED="throttled";var fc=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let RemotePlaybackController=class RemotePlaybackController{constructor(p){this.state=oj.IDLE,this.mid=null,this.playbackEndpoint=null,this.layersEndpoint=null,this.cachedLayers=[],this.stopVideo=()=>fc(this,void 0,void 0,function*(){return this.state!==oj.ACTIVE?(this.logCommandSkipped("stopVideo"),this.mapSkippedResultFromState(this.state)):this.sendPlaybackRequest(oB.PAUSE)}),this.startVideo=()=>fc(this,void 0,void 0,function*(){return this.state!==oj.ACTIVE?(this.logCommandSkipped("startVideo"),this.mapSkippedResultFromState(this.state)):this.sendPlaybackRequest(oB.PLAY)}),this.setLayer=p=>fc(this,void 0,void 0,function*(){return this.state!==oj.ACTIVE?(this.logCommandSkipped("setLayer"),this.mapSkippedResultFromState(this.state)):this.sendLayerRequest(p)}),this.unsetLayer=()=>fc(this,void 0,void 0,function*(){return this.state!==oj.ACTIVE?(this.logCommandSkipped("unsetLayer"),this.mapSkippedResultFromState(this.state)):this.sendLayerRequest()}),this.getLayers=()=>fc(this,void 0,void 0,function*(){return this.state!==oj.ACTIVE?(this.logCommandSkipped("getLayers"),this.mapSkippedResultFromState(this.state)):this.sendLayerStateRequest()}),this.sendPlaybackRequest=p=>fc(this,void 0,void 0,function*(){if(!this.mid)return this.logger.warn({msg:"mid is unexpectedly undefined"}),(0,tm.err)(oF.FAILED);if(!this.playbackEndpoint)return this.logger.warn({msg:"Playback endpoint is unset and required for playback control requests"}),(0,tm.err)(oF.FAILED);this.logger.info({msg:`Sending ${p} request to ${this.playbackEndpoint}`});let _=p===oB.PAUSE?{pause:[this.mid]}:{play:[this.mid]},Z=this.createPostWhepRequest(_);return fetch(this.playbackEndpoint,Z).then(_=>{if(_.status>=300){let p=Error(`Error sending media controls request: ${_.status}:${_.statusText}`);return this.logger.error({err:p}),(0,tm.err)(oF.FAILED)}return this.logger.debug({msg:`Request to ${p} was successful: ${_.status}`}),(0,tm.ok)(oV.SUCCESS)}).catch(p=>(this.logger.error({err:p,msg:"Error sending media controls request"}),(0,tm.err)(oF.FAILED)))}),this.sendLayerRequest=p=>fc(this,void 0,void 0,function*(){if(!this.mid)return this.logger.warn({msg:"mid is unexpectedly undefined"}),(0,tm.err)(oF.FAILED);if(!this.layersEndpoint)return this.logger.warn({msg:"Layers endpoint is unset and required for layer requests"}),(0,tm.err)(oF.FAILED);let _="string"==typeof p,Z=_?{mediaId:this.mid,encodingId:p}:{},et=_?`set : ${p}`:"unset layer";this.logger.info({msg:`sendLayerRequest for ${et} at ${this.layersEndpoint}`});let el=this.createPostWhepRequest(Z);
6return this.trackLayerRequest(null!=p?p:"auto"),fetch(this.layersEndpoint,el).then(p=>this.state===oj.DESTROYED?(0,tm.err)(oF.DESTROYED):p.status>=300?this.handleLayerRequestError(p.status,p.statusText):(this.logger.debug({msg:`Request to ${et} was successful: ${p.status}`}),(0,tm.ok)(oV.SUCCESS))).catch(p=>this.handleLayerRequestError(0,p.message))}),this.sendLayerStateRequest=()=>fc(this,void 0,void 0,function*(){if(!this.mid)return this.logger.warn({msg:"mid is unexpectedly undefined"}),(0,tm.err)(oF.FAILED);if(!this.layersEndpoint)return this.logger.warn({msg:"Layers endpoint is unset and required for layer requests"}),(0,tm.err)(oF.FAILED);this.logger.info({msg:`sendLayerStateRequest for ${this.mid} at ${this.layersEndpoint}`});let p=this.createGetWhepRequest();return this.trackLayerStateRequest(),fetch(this.layersEndpoint,p).then(p=>fc(this,void 0,void 0,function*(){var _;if(this.state===oj.DESTROYED)return(0,tm.err)(oF.DESTROYED);if(p.status>=300)return this.handleLayerStateRequestError(p.status,p.statusText);let Z=yield p.json(),et=null!==(_=null==Z?void 0:Z.layers)&&void 0!==_?_:[];this.cachedLayers=et;let el=JSON.stringify(et,null,2);return this.logger.debug({msg:`sendLayerStateRequest was successful: ${el}`}),(0,tm.ok)(et)})).catch(p=>this.handleLayerStateRequestError(0,p.message))}),this.logger=new ScopedLogger(p.logger,e0.REMOTE_PLAYBACK),this.token=p.token,this.traceId=p.traceId,this.analyticsTracker=p.analyticsTracker,this.remoteParticipantId=p.remoteParticipantId}set mediaId(p){if(this.state!==oj.DESTROYED){if(this.mid=p,null===this.mid)return this.logger.info({msg:"media id is unset, controller is transitioning to idle state"}),void(this.state=oj.IDLE);(this.playbackEndpoint||this.layersEndpoint)&&(this.state=oj.ACTIVE)}else this.logCommandSkipped("set mediaId")}set endpoints(p){var _,Z;if(this.state!==oj.DESTROYED){if(this.playbackEndpoint=null!==(_=p.playback)&&void 0!==_?_:null,this.layersEndpoint=null!==(Z=p.layers)&&void 0!==Z?Z:null,!this.playbackEndpoint||!this.layersEndpoint){let p={playbackEndpoint:this.playbackEndpoint,layersEndpoint:this.layersEndpoint};return this.logger.info({msg:`no endpoints are set, transitioning to idle state: ${JSON.stringify(p,null)}`}),void(this.state=oj.IDLE)}this.mid&&(this.state=oj.ACTIVE)}else this.logCommandSkipped("set endpoints")}getSelectedLayerRid(){var p;let _=this.cachedLayers.find(p=>p.selected);return null!==(p=null==_?void 0:_.encodingId)&&void 0!==p?p:""}destroy(){this.state=oj.DESTROYED,this.mid=null,this.playbackEndpoint=null,this.layersEndpoint=null,this.cachedLayers=[]}logCommandSkipped(p="command"){this.logger.info({msg:`skipping ${p}, controller state invalid: ${this.state}`})}mapSkippedResultFromState(p){return p===oj.DESTROYED?(0,tm.err)(oF.DESTROYED):(0,tm.err)(oF.FAILED)}createPostWhepRequest(p){return{method:"POST",headers:this.createRequestHeaders(),body:JSON.stringify(p)}}createGetWhepRequest(){return{method:"GET",headers:this.createRequestHeaders()}}createRequestHeaders(){var p,_;return{Authorization:`Bearer ${this.token.rawToken}`,"Content-Type":"application/json","X-Stages-Platform":"web","X-Stages-Request-ID":ts().value,"X-Stages-SDK":"1.38.0","X-Stages-Session-ID":this.analyticsTracker.getSessionId(),"X-Stages-Trace-ID":null!==(_=null===(p=this.traceId)||void 0===p?void 0:p.value)&&void 0!==_?_:"","X-Stages-WHIP-Version":i2}}trackLayerRequest(p){var _;this.analyticsTracker.trackEventNoSharedProps(new PlaybackLayerRequest(this.token,this.traceId,nV.VIDEO,this.remoteParticipantId,null!==(_=this.mid)&&void 0!==_?_:"unknown",p))}trackLayerStateRequest(p=1){var _;this.analyticsTracker.trackEventNoSharedProps(new PlaybackLayerState(this.token,this.traceId,nV.VIDEO,this.remoteParticipantId,null!==(_=this.mid)&&void 0!==_?_:"unknown",p))}handleLayerRequestError(p,_){let Z,et;let el=`sendLayerRequest failed for reason: ${p} ${_}`;return 429===p?(Z=oF.THROTTLED,et=n5.WHEP_SET_LAYER_REQUEST_THROTTLED):(Z=oF.FAILED,et=n5.WHEP_SET_LAYER_REQUEST_FAILED),this.trackRequestError(et,el),(0,tm.err)(Z)}handleLayerStateRequestError(p,_){let Z,et;let el=`sendLayerStateRequest failed for reason: ${p} ${_}`;return 429===p?(Z=oF.THROTTLED,et=n5.WHEP_GET_LAYER_STATE_THROTTLED):(Z=oF.FAILED,et=n5.WHEP_GET_LAYER_STATE_FAILED),this.trackRequestError(et,el),(0,tm.err)(Z)}trackRequestError(p,_){let Z=Error(_);this.logger.error({err:Z}),p.message=_;let et=this.createError(p);this.analyticsTracker.trackError(et)}createError(p,_){return new StageClientError(Object.assign({action:iG.SUBSCRIBE,traceId:this.traceId,token:this.token,location:"RemotePlaybackController",tag:n3,details:_},p))}};function mc(p,_){let Z=new Map,et=new Map;for(let el of _.values())if(el.kind===p&&"outbound-rtp"===el.type&&el.ssrc){let p=el.rid||em;et.set(el.ssrc,p);let _=Z.get(p);_||(_={},Z.set(p,_)),_.outbound=el}for(let el of _.values())if(el.kind===p&&"remote-inbound-rtp"===el.type&&el.ssrc){let p=et.get(el.ssrc)||em,_=Z.get(p);_&&(_.remoteInbound=el)}return Z}function Ec(p,_){let Z=new Map;for(let et of _.values())if(et.kind===p&&"inbound-rtp"===et.type){let p=et.rid||em;Z.set(p,{inbound:et})}return Z}function Sc(p,_){return p!==tX.DOWN&&null!=_?_:p}let _c=(p,_)=>{let Z=[],et=nR.getNetworkQuality(),el=mc("audio",p);for(let p of el.values())if(p.outbound){let el=p.outbound.rid||em,eu=Sc(et,_.get(el)),ed=function(p){let{outbound:_,remoteInbound:Z,networkQuality:et}=p;
6return{networkQuality:et,nackCount:_.nackCount,packetsSent:_.packetsSent,packetsLost:null==Z?void 0:Z.packetsLost,retransmittedPacketsSent:_.retransmittedPacketsSent,bytesSent:_.bytesSent,headerBytesSent:_.headerBytesSent,retransmittedBytesSent:_.retransmittedBytesSent,totalPacketSendDelay:_.totalPacketSendDelay}}({outbound:p.outbound,remoteInbound:p.remoteInbound,networkQuality:eu});Z.push(ed)}if(Z.length)return Z},yc=(p,_)=>{let Z=[],et=nR.getNetworkQuality(),el=mc("video",p);for(let p of el.values())if(p.outbound){let el=p.outbound.rid||em,eu=function(p){var _,Z,et,el;let{outbound:eu,remoteInbound:ed,networkQuality:eh}=p;return{networkQuality:eh,nackCount:eu.nackCount,packetsSent:eu.packetsSent,packetsLost:null==ed?void 0:ed.packetsLost,retransmittedPacketsSent:eu.retransmittedPacketsSent,bytesSent:eu.bytesSent,headerBytesSent:eu.headerBytesSent,retransmittedBytesSent:eu.retransmittedBytesSent,totalPacketSendDelay:eu.totalPacketSendDelay,firCount:eu.firCount,pliCount:eu.pliCount,framesEncoded:eu.framesEncoded,keyFramesEncoded:eu.keyFramesEncoded,totalEncodeTime:eu.totalEncodeTime,totalEncodedBytesTarget:eu.totalEncodedBytesTarget,framesSent:eu.framesSent,hugeFramesSent:eu.hugeFramesSent,active:0!==(null!==(_=eu.framesPerSecond)&&void 0!==_?_:0),qualityLimitationReason:eu.qualityLimitationReason,qualityLimitationResolutionChanges:eu.qualityLimitationResolutionChanges,qualityLimitationCpuDuration:null===(Z=eu.qualityLimitationDurations)||void 0===Z?void 0:Z.cpu,qualityLimitationBandwidthDuration:null===(et=eu.qualityLimitationDurations)||void 0===et?void 0:et.bandwidth,frameWidth:eu.frameWidth,frameHeight:eu.frameHeight,framesPerSecond:eu.framesPerSecond,rid:eu.rid,ssrc:eu.ssrc,encoderImplementation:null!==(el=eu.encoderImplementation)&&void 0!==el?el:eE}}({outbound:p.outbound,remoteInbound:p.remoteInbound});if(eu.active){let p=Sc(et,_.get(el));eu.networkQuality=p}Z.push(eu)}if(Z.length)return Z},bc=(p,_)=>{var Z;let et=[],el=nR.getNetworkQuality(),eu=Ec("audio",p);for(let p of eu.values())if(p.inbound){let eu=p.inbound.id;if(!eu)continue;let ed=Sc(el,_.get(eu)),eh={networkQuality:(Z={inbound:p.inbound,networkQuality:ed}).networkQuality,nackCount:Z.inbound.nackCount,packetsReceived:Z.inbound.packetsReceived,packetsLost:Z.inbound.packetsLost,packetsDiscarded:Z.inbound.packetsDiscarded,bytesReceived:Z.inbound.bytesReceived,headerBytesReceived:Z.inbound.headerBytesReceived,jitterBufferDelay:Z.inbound.jitterBufferDelay,jitterBufferEmittedCount:Z.inbound.jitterBufferEmittedCount,jitter:Z.inbound.jitter,totalSamplesReceived:Z.inbound.totalSamplesReceived,concealedSamples:Z.inbound.concealedSamples,silentConcealedSamples:Z.inbound.silentConcealedSamples,concealmentEvents:Z.inbound.concealmentEvents,insertedSamplesForDeceleration:Z.inbound.insertedSamplesForDeceleration,removedSamplesForAcceleration:Z.inbound.removedSamplesForAcceleration,audioLevel:Z.inbound.audioLevel};et.push(eh)}if(et.length)return et},Cc=(p,_)=>{var Z;let et=[],el=nR.getNetworkQuality(),eu=Ec("video",p);for(let p of eu.values())if(p.inbound){let eu=p.inbound.id;if(!eu)continue;let ed={networkQuality:(Z={inbound:p.inbound,networkQuality:Sc(el,_.get(eu))}).networkQuality,nackCount:Z.inbound.nackCount,packetsReceived:Z.inbound.packetsReceived,packetsLost:Z.inbound.packetsLost,packetsDiscarded:Z.inbound.packetsDiscarded,bytesReceived:Z.inbound.bytesReceived,headerBytesReceived:Z.inbound.headerBytesReceived,jitterBufferDelay:Z.inbound.jitterBufferDelay,jitterBufferEmittedCount:Z.inbound.jitterBufferEmittedCount,jitter:Z.inbound.jitter,pliCount:Z.inbound.pliCount,firCount:Z.inbound.firCount,framesReceived:Z.inbound.framesReceived,framesDecoded:Z.inbound.framesDecoded,keyFramesDecoded:Z.inbound.keyFramesDecoded,framesDropped:Z.inbound.framesDropped,totalDecodeTime:Z.inbound.totalDecodeTime,totalInterFrameDelay:Z.inbound.totalInterFrameDelay,totalSquaredInterFrameDelay:Z.inbound.totalSquaredInterFrameDelay,pauseCount:Z.inbound.pauseCount,totalPausesDuration:Z.inbound.totalPausesDuration,freezeCount:Z.inbound.freezeCount,totalFreezesDuration:Z.inbound.totalFreezesDuration,frameWidth:Z.inbound.frameWidth,frameHeight:Z.inbound.frameHeight,framesPerSecond:Z.inbound.framesPerSecond,ssr
vendor: 11,869 bytes, line 6
6c:Z.inbound.ssrc};et.push(ed)}if(et.length)return et};let PublishedVideoStatsEvent=class PublishedVideoStatsEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep){var ef,eg;super(tg.PUBLISHED_VIDEO_STATS,p,_,!1),Object.assign(this.properties,Object.assign({action:iG.PUBLISH,node:null!==(ef=null==Z?void 0:Z.node)&&void 0!==ef?ef:"",cluster:null!==(eg=null==Z?void 0:Z.cluster)&&void 0!==eg?eg:""},((p,_,Z,et,el,eu)=>{var ed,eh,ep,ef,eg,ev,eS,e_,ey,eb,eC,eT,eI,eR,eO,eA,ek,ew,eN,eD,eP,eM,eL,ex,eU,eB,ej,eV,eF,eG,eH,eW,eq;let e$=null!==(eh=null===(ed=null==p?void 0:p.qualityLimitationDurations)||void 0===ed?void 0:ed.cpu)&&void 0!==eh?eh:0,eK=null!==(ef=null===(ep=null==p?void 0:p.qualityLimitationDurations)||void 0===ep?void 0:ep.bandwidth)&&void 0!==ef?ef:0,ez=Math.max(null!==(eg=null==p?void 0:p.bytesSent)&&void 0!==eg?eg:0,0),eJ=Math.max(null!==(ev=null==_?void 0:_.packetsLost)&&void 0!==ev?ev:0,0),eX=Math.max(null!==(eS=null==p?void 0:p.packetsSent)&&void 0!==eS?eS:0,0),eY=Ja(null==et?void 0:et.mimeType,null==et?void 0:et.sdpFmtpLine);return{active:!!(null==p?void 0:p.framesPerSecond)&&0!==p.framesPerSecond,bytes_sent:ez,codec_mime_type:null==eY?void 0:eY.mimeSubtype,codec_profile:null==eY?void 0:eY.profile,codec_level:null==eY?void 0:eY.level,configured_bitrate:null==el?void 0:el.max_bitrate,connection_bandwidth:null!==(ey=null===(e_=null==Z?void 0:Z.candidatePair)||void 0===e_?void 0:e_.availableOutgoingBitrate)&&void 0!==ey?ey:0,encode_bitrate:8*ez/(null!=eu?eu:1),encoder_implementation:null!==(eb=null==p?void 0:p.encoderImplementation)&&void 0!==eb?eb:eE,fir_count:null!==(eC=null==p?void 0:p.firCount)&&void 0!==eC?eC:0,fraction_packets_lost:eJ/Math.max(eX,1),frame_height:Math.max(null!==(eT=null==p?void 0:p.frameHeight)&&void 0!==eT?eT:0,0),frame_width:Math.max(null!==(eI=null==p?void 0:p.frameWidth)&&void 0!==eI?eI:0,0),frames_encoded:null!==(eR=null==p?void 0:p.framesEncoded)&&void 0!==eR?eR:0,frames_per_second:Math.max(null!==(eO=null==p?void 0:p.framesPerSecond)&&void 0!==eO?eO:0,0),frames_sent:null!==(eA=null==p?void 0:p.framesSent)&&void 0!==eA?eA:0,header_bytes_sent:null!==(ek=null==p?void 0:p.headerBytesSent)&&void 0!==ek?ek:0,huge_frames_sent:null!==(ew=null==p?void 0:p.hugeFramesSent)&&void 0!==ew?ew:0,key_frames_encoded:null!==(eN=null==p?void 0:p.keyFramesEncoded)&&void 0!==eN?eN:0,nack_count:null!==(eD=null==p?void 0:p.nackCount)&&void 0!==eD?eD:0,packets_lost:eJ,packets_sent:eX,power_efficient_encoder:null!==(eP=null==p?void 0:p.powerEfficientEncoder)&&void 0!==eP&&eP,pli_count:null!==(eM=null==p?void 0:p.pliCount)&&void 0!==eM?eM:0,quality_limitation_reason:null!==(eL=null==p?void 0:p.qualityLimitationReason)&&void 0!==eL?eL:"none",quality_limitation_resolution_changes:null!==(ex=null==p?void 0:p.qualityLimitationResolutionChanges)&&void 0!==ex?ex:0,quality_limitation_cpu_duration:e$,quality_limitation_bandwidth_duration:eK,retransmitted_bytes_sent:null!==(eU=null==p?void 0:p.retransmittedBytesSent)&&void 0!==eU?eU:0,retransmitted_packets_sent:null!==(eB=null==p?void 0:p.retransmittedPacketsSent)&&void 0!==eB?eB:0,rid:null!==(ej=null==p?void 0:p.rid)&&void 0!==ej?ej:em,scalability_mode:null!==(eV=null==p?void 0:p.scalabilityMode)&&void 0!==eV?eV:"unknown",target_bitrate:Math.max(null!==(eF=null==p?void 0:p.targetBitrate)&&void 0!==eF?eF:0,0),total_encode_time:null!==(eG=null==p?void 0:p.totalEncodeTime)&&void 0!==eG?eG:0,total_encoded_bytes_target:null!==(eH=null==p?void 0:p.totalEncodedBytesTarget)&&void 0!==eH?eH:0,total_packet_send_delay:null!==(eW=null==p?void 0:p.totalPacketSendDelay)&&void 0!==eW?eW:0,protocol:null===(eq=null==Z?void 0:Z.localCandidate)||void 0===eq?void 0:eq.protocol}})(et,el,eu,ed,eh,ep)))}};let PublishedVideoStatsWindowEvent=class PublishedVideoStatsWindowEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep,ef,eg,ev){var eS,e_,ey,eb;super(tg.PUBLISHED_VIDEO_STATS_WINDOW,p,_,!1);let eC=Math.max((null!==(eS=null==et?void 0:et.timestamp)&&void 0!==eS?eS:0)-(null!==(e_=null==el?void 0:el.timestamp)&&void 0!==e_?e_:0),0);Object.assign(this.properties,Object.assign({action:iG.PUBLISH,node:null!==(ey=null==Z?void 0:Z.node)&&void 0!==ey?ey:"",cluster:null!==(eb=null==Z?void 0:Z.cluster)&&void 0!==eb?eb:"",window_size_ms:eC},((p,_,Z,et,el,eu,ed,eh,ep,ef)=>{var eg,ev,eS,e_,ey,eb,eC,eT,eI,eR,eO,eA,ek,ew,eN,eD,eP,eM,eL,ex,eU,eB,ej,eV,eF,eG,eH,eW,eq,e$,eK,ez,eJ,eX,eY,eQ,eZ,e0,e1,e2,e3,e4,e5,e9,e6,e8,e7,tt,ti,tl,tu,td,th,tp;let tf=null!==(ev=null===(eg=null==p?void 0:p.qualityLimitationDurations)||void 0===eg?void 0:eg.cpu)&&void 0!==ev?ev:0,tg=null!==(e_=null===(eS=null==_?void 0:_.qualityLimitationDurations)||void 0===eS?void 0:eS.cpu)&&void 0!==e_?e_:0,tv=null!==(eb=null===(ey=null==p?void 0:p.qualityLimitationDurations)||void 0===ey?void 0:ey.bandwidth)&&void 0!==eb?eb:0,tm=null!==(eT=null===(eC=null==_?void 0:_.qualityLimitationDurations)||void 0===eC?void 0:eC.bandwidth)&&void 0!==eT?eT:0,tE=Math.max((null!==(eI=null==p?void 0:p.bytesSent)&&void 0!==eI?eI:0)-(null!==(eR=null==_?void 0:_.bytesSent)&&void 0!==eR?eR:0),0),tS="number"!=typeof eh?1:eh/1e3,t_=Math.max((null!==(eO=null==Z?void 0:Z.packetsLost)&&void 0!==eO?eO:0)-(null!==(eA=null==et?void 0:et.packetsLost)&&void 0!==eA?eA:0),0),ty=Math.max((null!==(ek=null==p?void 0:p.packetsSent)&&void 0!==ek?ek:0)-(null!==(ew=null==_?void 0:_.packetsSent)&&void 0!==ew?ew:0),0),tb=Ja(null==eu?void 0:eu.mimeType,null==eu?void 0:eu.sdpFmtpLine);return{active:!!(null==p?void 0:p.framesPerSecond)&&0!==(null==p?void 0:p.framesPerSecond),bytes_sent:tE,codec_mime_type:null==tb?void 0:tb.mimeSubtype,codec_profile:null==tb?void 0:tb.profile,codec_level:null==tb?void 0:tb.level,configured_bitrate:null==ed?void 0:ed.max_bitrate,connection_bandwidth:null!==(eD=null===(eN=null==el?void 0:el.candidatePair)||void 0===eN?void 0:eN.availableOutgoingBitrate)&&void 0!==eD?eD:0,encode_bitrate:8*tE/tS,encoder_implementation:null!==(eP=null==p?void 0:p.encoderImplementation)&&void 0!==eP?eP:eE,fir_count:Math.max((null!==(eM=null==p?void 0:p.firCount)&&void 0!==eM?eM:0)-(null!==(eL=null==_?void 0:_.firCount)&&void 0!==eL?eL:0),0),fraction_packets_lost:t_/Math.max(ty,1),frame_height:Math.max(null!==(ex=null==p?void 0:p.frameHeight)&&void 0!==ex?ex:0,0),frame_width:Math.max(null!==(eU=null==p?void 0:p.frameWidth)&&void 0!==eU?eU:0,0),frames_encoded:Math.max((null!==(eB=null==p?void 0:p.framesEncoded)&&void 0!==eB?eB:0)-(null!==(ej=null==_?void 0:_.framesEncoded)&&void 0!==ej?ej:0),0),frames_per_second:Math.max(null!==(eV=null==p?void 0:p.framesPerSecond)&&void 0!==eV?eV:0,0),frames_sent:Math.max((null!==(eF=null==p?void 0:p.framesSent)&&void 0!==eF?eF:0)-(null!==(eG=null==_?void 0:_.framesSent)&&void 0!==eG?eG:0),0),header_bytes_sent:Math.max((null!==(eH=null==p?void 0:p.headerBytesSent)&&void 0!==eH?eH:0)-(null!==(eW=null==_?void 0:_.headerBytesSent)&&void 0!==eW?eW:0),0),huge_frames_sent:Math.max((null!==(eq=null==p?void 0:p.hugeFramesSent)&&void 0!==eq?eq:0)-(null!==(e$=null==_?void 0:_.hugeFramesSent)&&void 0!==e$?e$:0),0),key_frames_encoded:Math.max((null!==(eK=null==p?void 0:p.keyFramesEncoded)&&void 0!==eK?eK:0)-(null!==(ez=null==_?void 0:_.keyFramesEncoded)&&void 0!==ez?ez:0),0),nack_count:Math.max((null!==(eJ=null==p?void 0:p.nackCount)&&void 0!==eJ?eJ:0)-(null!==(eX=null==_?void 0:_.nackCount)&&void 0!==eX?eX:0),0),packets_lost:t_,packets_sent:ty,power_efficient_encoder:null!==(eY=null==p?void 0:p.powerEfficientEncoder)&&void 0!==eY&&eY,pli_count:Math.max((null!==(eQ=null==p?void 0:p.pliCount)&&void 0!==eQ?eQ:0)-(null!==(eZ=null==_?void 0:_.pliCount)&&void 0!==eZ?eZ:0),0),quality_limitation_reason:null!==(e0=null==p?void 0:p.qualityLimitationReason)&&void 0!==e0?e0:"none",quality_limitation_resolution_changes:Math.max((null!==(e1=null==p?void 0:p.qualityLimitationResolutionChanges)&&void 0!==e1?e1:0)-(null!==(e2=null==_?void 0:_.qualityLimitationResolutionChanges)&&void 0!==e2?e2:0),0),quality_limitation_cpu_duration:Math.max(tf-tg,0),quality_limitation_bandwidth_duration:Math.max(tv-tm,0),retransmitted_bytes_sent:Math.max((null!==(e3=null==p?void 0:p.retransmittedBytesSent)&&void 0!==e3?e3:0)-(null!==(e4=null==_?void 0:_.retransmittedBytesSent)&&void 0!==e4?e4:0),0),rid:null!==(e5=null==p?void 0:p.rid)&&void 0!==e5?e5:em,retransmitted_packets_sent:Math.max((null!==(e9=null==p?void 0:p.retransmittedPacketsSent)&&void 0!==e9?e9:0)-(null!==(e6=null==_?void 0:_.retransmittedPacketsSent)&&void 0!==e6?e6:0),0),scalability_mode:null!==(e8=null==p?void 0:p.scalabilityMode)&&void 0!==e8?e8:"unknown",target_bitrate:Math.max(null!==(e7=null==p?void 0:p.targetBitrate)&&void 0!==e7?e7:0,0),total_encode_time:Math.max((null!==(tt=null==p?void 0:p.totalEncodeTime)&&void 0!==tt?tt:0)-(null!==(ti=null==_?void 0:_.totalEncodeTime)&&void 0!==ti?ti:0),0),total_encoded_bytes_target:Math.max((null!==(tl=null==p?void 0:p.totalEncodedBytesTarget)&&void 0!==tl?tl:0)-(null!==(tu=null==_?void 0:_.totalEncodedBytesTarget)&&void 0!==tu?tu:0),0),total_packet_send_delay:Math.max((null!==(td=null==p?void 0:p.totalPacketSendDelay)&&void 0!==td?td:0)-(null!==(th=null==_?void 0:_.totalPacketSendDelay)&&void 0!==th?th:0),0),sei_write_count:ep,sei_bytes_sent:ef,sei_bitrate:8*(ef||0)/tS,protocol:null===(tp=null==el?void 0:el.localCandidate)||void 0===tp?void 0:tp.protocol}})(et,el,eu,ed,eh,ep,ef,eC,eg,ev)))}};let PublishedAudioStatsEvent=class PublishedAudioStatsEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep,ef){var eg,ev;super(tg.PUBLISHED_AUDIO_STATS,p,_,!1),Object.assign(this.properties,Object.assign({action:iG.PUBLISH,node:null!==(eg=null==Z?void 0:Z.node)&&void 0!==eg?eg:"",cluster:null!==(ev=null==Z?void 0:Z.cluster)&&void 0!==ev?ev:""},((p,_,Z,et,el,eu,ed)=>{var eh,ep,ef,eg,ev,em,eE,eS,e_,ey,eb,eC,eT;let eI=Math.max(null!==(eh=null==p?void 0:p.bytesSent)&&void 0!==eh?eh:0,0),eR=Math.max(null!==(ep=null==_?void 0:_.packetsLost)&&void 0!==ep?ep:0,0),eO=Math.max(null!==(ef=null==p?void 0:p.packetsSent)&&void 0!==ef?ef:0,0),eA=Ja(null==et?void 0:et.mimeType,null==et?void 0:et.sdpFmtpLine);return{audio_nacks_enabled:null!==(eg=null==ed?void 0:ed.audioNacks)&&void 0!==eg&&eg,bytes_sent:eI,codec_mime_type:null==eA?void 0:eA.mimeSubtype,configured_bitrate:null!==(ev=null==el?void 0:el.max_audio_bitrate_bps)&&void 0!==ev?ev:0,connection_bandwidth:null!==(eE=null===(em=null==Z?void 0:Z.candidatePair)||void 0===em?void 0:em.availableOutgoingBitrate)&&void 0!==eE?eE:0,encode_bitrate:8*eI/(null!=eu?eu:1),fraction_packets_lost:eR/Math.max(eO,1),header_bytes_sent:null!==(eS=null==p?void 0:p.headerBytesSent)&&void 0!==eS?eS:0,nack_count:null!==(e_=null==p?void 0:p.nackCount)&&void 0!==e_?e_:0,packets_lost:eR,packets_sent:eO,retransmitted_bytes_sent:null!==(ey=null==p?void 0:p.retransmittedBytesSent)&&void 0!==ey?ey:0,retransmitted_packets_sent:null!==(eb=null==p?void 0:p.retransmittedPacketsSent)&&void 0!==eb?eb:0,target_bitrate:null!==(eC=null==p?void 0:p.targetBitrate)&&void 0!==eC?eC:0,protocol:null===(eT=null==Z?void 0:Z.localCandidate)||void 0===eT?void 0:eT.protocol}})(et,el,eu,ed,eh,ep,ef)))}};let PublishedAudioStatsWindowEvent=class PublishedAudioStatsWindowEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep,ef,eg){var ev,em,eE,eS;super(tg.PUBLISHED_AUDIO_STATS_WINDOW,p,_,!1);let e_=Math.max((null!==(ev=null==et?void 0:et.timestamp)&&void 0!==ev?ev:0)-(null!==(em=null==el?void 0:el.timestamp)&&void 0!==em?em:0),0);Object.assign(this.properties,Object.assign({action:iG.PUBLISH,node:null!==(eE=null==Z?void 0:Z.node)&&void 0!==eE?eE:"",cluster:null!==(eS=null==Z?void 0:Z.cluster)&&void 0!==eS?eS:"",window_size_ms:e_},((p,_,Z,et,el,eu,ed,eh,ep)=>{var ef,eg,ev,em,eE,eS,e_,ey,eb,eC,eT,eI,eR,eO,eA,ek,ew,eN,eD,eP,eM,eL;let ex=Math.max((null!==(ef=null==p?void 0:p.bytesSent)&&void 0!==ef?ef:0)-(null!==(eg=null==_?void 0:_.bytesSent)&&void 0!==eg?eg:0),0
6),eU=Math.max((null!==(ev=null==Z?void 0:Z.packetsLost)&&void 0!==ev?ev:0)-(null!==(em=null==et?void 0:et.packetsLost)&&void 0!==em?em:0),0),eB=Math.max((null!==(eE=null==p?void 0:p.packetsSent)&&void 0!==eE?eE:0)-(null!==(eS=null==_?void 0:_.packetsSent)&&void 0!==eS?eS:0),0),ej=Ja(null==eu?void 0:eu.mimeType,null==eu?void 0:eu.sdpFmtpLine);return{audio_nacks_enabled:null!==(e_=null==ep?void 0:ep.audioNacks)&&void 0!==e_&&e_,bytes_sent:ex,codec_mime_type:null==ej?void 0:ej.mimeSubtype,configured_bitrate:null!==(ey=null==ed?void 0:ed.max_audio_bitrate_bps)&&void 0!==ey?ey:0,connection_bandwidth:null!==(eC=null===(eb=null==el?void 0:el.candidatePair)||void 0===eb?void 0:eb.availableOutgoingBitrate)&&void 0!==eC?eC:0,encode_bitrate:8*ex/("number"!=typeof eh?1:eh/1e3),fraction_packets_lost:eU/Math.max(eB,1),header_bytes_sent:Math.max((null!==(eT=null==p?void 0:p.headerBytesSent)&&void 0!==eT?eT:0)-(null!==(eI=null==_?void 0:_.headerBytesSent)&&void 0!==eI?eI:0),0),nack_count:Math.max((null!==(eR=null==p?void 0:p.nackCount)&&void 0!==eR?eR:0)-(null!==(eO=null==_?void 0:_.nackCount)&&void 0!==eO?eO:0),0),packets_lost:eU,packets_sent:Math.max((null!==(eA=null==p?void 0:p.packetsSent)&&void 0!==eA?eA:0)-(null!==(ek=null==_?void 0:_.packetsSent)&&void 0!==ek?ek:0),0),retransmitted_bytes_sent:Math.max((null!==(ew=null==p?void 0:p.retransmittedBytesSent)&&void 0!==ew?ew:0)-(null!==(eN=null==_?void 0:_.retransmittedBytesSent)&&void 0!==eN?eN:0),0),retransmitted_packets_sent:Math.max((null!==(eD=null==p?void 0:p.retransmittedPacketsSent)&&void 0!==eD?eD:0)-(null!==(eP=null==_?void 0:_.retransmittedPacketsSent)&&void 0!==eP?eP:0),0),target_bitrate:Math.max(null!==(eM=null==p?void 0:p.targetBitrate)&&void 0!==eM?eM:0,0),protocol:null===(eL=null==el?void 0:el.localCandidate)||void 0===eL?void 0:eL.protocol}})(et,el,eu,ed,eh,ep,ef,e_,eg)))}};let SubscribedVideoStatsEvent=class SubscribedVideoStatsEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh){var ep,ef;super(tg.SUBSCRIBED_VIDEO_STATS,p,_,!1),Object.assign(this.properties,Object.assign({action:iG.SUBSCRIBE,node:null!==(ep=null==et?void 0:et.node)&&void 0!==ep?ep:"",cluster:null!==(ef=null==et?void 0:et.cluster)&&void 0!==ef?ef:"",remote_participant_id:Z},((p,_,Z,et)=>{var el,eu,ed,eh,ep,ef,eg,ev,em,eE,eS,e_,ey,eb,eC,eT,eI,eR,eO,eA,ek,ew,eN,eD;let eP=0;(null==p?void 0:p.jitterBufferDelay)&&(null==p?void 0:p.jitterBufferEmittedCount)&&p.jitterBufferEmittedCount>0&&(eP=p.jitterBufferDelay/p.jitterBufferEmittedCount);let eM=Math.max(null!==(el=null==p?void 0:p.bytesReceived)&&void 0!==el?el:0,0),eL=0;(null==p?void 0:p.totalDecodeTime)&&(null==p?void 0:p.framesDecoded)&&(eL=p.totalDecodeTime/Math.max(null==p?void 0:p.framesDecoded,1));let ex=Math.max(null!==(eu=null==p?void 0:p.packetsLost)&&void 0!==eu?eu:0,0),eU=Math.max(null!==(ed=null==p?void 0:p.packetsReceived)&&void 0!==ed?ed:0,0),eB=Ja(null==Z?void 0:Z.mimeType,null==Z?void 0:Z.sdpFmtpLine);return{bytes_received:eM,codec_mime_type:null==eB?void 0:eB.mimeSubtype,codec_profile:null==eB?void 0:eB.profile,codec_level:null==eB?void 0:eB.level,connection_bandwidth:null!==(ep=null===(eh=null==_?void 0:_.candidatePair)||void 0===eh?void 0:eh.availableIncomingBitrate)&&void 0!==ep?ep:0,decode_bitrate:8*eM/(null!=et?et:1),decoder_implementation:null!==(ef=null==p?void 0:p.decoderImplementation)&&void 0!==ef?ef:"unknown",fir_count:Math.max(null!==(eg=null==p?void 0:p.firCount)&&void 0!==eg?eg:0,0),fraction_packets_lost:ex/Math.max(eU+ex,1),frame_decode_time_avg:eL,frame_height:Math.max(null!==(ev=null==p?void 0:p.frameHeight)&&void 0!==ev?ev:0,0),frame_width:Math.max(null!==(em=null==p?void 0:p.frameWidth)&&void 0!==em?em:0,0),frames_decoded:Math.max(null!==(eE=null==p?void 0:p.framesDecoded)&&void 0!==eE?eE:0,0),frames_dropped:Math.max(null!==(eS=null==p?void 0:p.framesDropped)&&void 0!==eS?eS:0,0),frames_received:Math.max(null!==(e_=null==p?void 0:p.framesReceived)&&void 0!==e_?e_:0,0),freeze_count:Math.max(null!==(ey=null==p?void 0:p.freezeCount)&&void 0!==ey?ey:0,0),frames_rendered:Math.max(null!==(eb=null==p?void 0:p.framesRendered)&&void 0!==eb?eb:0,0),frames_per_second:Math.max(null!==(eC=null==p?void 0:p.framesPerSecond)&&void 0!==eC?eC:0,0),header_bytes_received:Math.max(null!==(eT=null==p?void 0:p.headerBytesReceived)&&void 0!==eT?eT:0,0),jitter_buffer_delay_avg:eP,key_frames_decoded:Math.max(null!==(eI=null==p?void 0:p.keyFramesDecoded)&&void 0!==eI?eI:0,0),nack_count:Math.max(null!==(eR=null==p?void 0:p.nackCount)&&void 0!==eR?eR:0,0),packets_discarded:Math.max(null!==(eO=null==p?void 0:p.packetsDiscarded)&&void 0!==eO?eO:0,0),packets_lost:ex,packets_received:eU,pause_count:Math.max(null!==(eA=null==p?void 0:p.pauseCount)&&void 0!==eA?eA:0,0),pli_count:Math.max(null!==(ek=null==p?void 0:p.pliCount)&&void 0!==ek?ek:0,
60),power_efficient_decoder:null!==(ew=null==p?void 0:p.powerEfficientDecoder)&&void 0!==ew&&ew,total_freezes_duration:Math.max(null!==(eN=null==p?void 0:p.totalFreezesDuration)&&void 0!==eN?eN:0,0),total_pauses_duration:Math.max(null!==(eD=null==p?void 0:p.totalPausesDuration)&&void 0!==eD?eD:0,0)}})(el,eu,ed,eh)))}};let SubscribedVideoStatsWindowEvent=class SubscribedVideoStatsWindowEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep,ef,eg,ev){var em,eE,eS,e_;super(tg.SUBSCRIBED_VIDEO_STATS_WINDOW,p,_,!1);let ey=Math.max((null!==(em=null==el?void 0:el.timestamp)&&void 0!==em?em:0)-(null!==(eE=null==eu?void 0:eu.timestamp)&&void 0!==eE?eE:0),0);Object.assign(this.properties,Object.assign({action:iG.SUBSCRIBE,node:null!==(eS=null==et?void 0:et.node)&&void 0!==eS?eS:"",cluster:null!==(e_=null==et?void 0:et.cluster)&&void 0!==e_?e_:"",window_size_ms:ey,remote_participant_id:Z},((p,_,Z,et,el,eu,ed,eh,ep)=>{var ef,eg,ev,em,eE,eS,e_,ey,eb,eC,eT,eI,eR,eO,eA,ek,ew,eN,eD,eP,eM,eL,ex,eU,eB,ej,eV,eF,eG,eH,eW,eq,e$,eK,ez,eJ,eX,eY,eQ,eZ,e0,e1,e2,e3,e4;let e5=0,e9=0;if((null==p?void 0:p.jitterBufferEmittedCount)&&(null==_?void 0:_.jitterBufferEmittedCount)&&p.jitterBufferEmittedCount>_.jitterBufferEmittedCount){(null==p?void 0:p.jitterBufferDelay)&&(null==_?void 0:_.jitterBufferDelay)&&(e5=(p.jitterBufferDelay-_.jitterBufferDelay)/(p.jitterBufferEmittedCount-_.jitterBufferEmittedCount));let Z=null==_?void 0:_.jitterBufferMinimumDelay,et=null==p?void 0:p.jitterBufferMinimumDelay;Z&&et&&(e9=(et-Z)/(p.jitterBufferEmittedCount-_.jitterBufferEmittedCount))}let e6=Math.max((null!==(ef=null==p?void 0:p.bytesReceived)&&void 0!==ef?ef:0)-(null!==(eg=null==_?void 0:_.bytesReceived)&&void 0!==eg?eg:0),0),e8="number"!=typeof el?1:el/1e3,e7=Math.max((null!==(ev=null==p?void 0:p.totalDecodeTime)&&void 0!==ev?ev:0)-(null!==(em=null==_?void 0:_.totalDecodeTime)&&void 0!==em?em:0),0),tt=Math.max((null!==(eE=null==p?void 0:p.framesDecoded)&&void 0!==eE?eE:0)-(null!==(eS=null==_?void 0:_.framesDecoded)&&void 0!==eS?eS:0),0),ti=Math.max((null!==(e_=null==p?void 0:p.packetsLost)&&void 0!==e_?e_:0)-(null!==(ey=null==_?void 0:_.packetsLost)&&void 0!==ey?ey:0),0),tl=Math.max((null!==(eb=null==p?void 0:p.packetsReceived)&&void 0!==eb?eb:0)-(null!==(eC=null==_?void 0:_.packetsReceived)&&void 0!==eC?eC:0),0),tu=Ja(null==et?void 0:et.mimeType,null==et?void 0:et.sdpFmtpLine);return{bytes_received:e6,codec_mime_type:null==tu?void 0:tu.mimeSubtype,codec_profile:null==tu?void 0:tu.profile,codec_level:null==tu?void 0:tu.level,connection_bandwidth:null!==(eI=null===(eT=null==Z?void 0:Z.candidatePair)||void 0===eT?void 0:eT.availableIncomingBitrate)&&void 0!==eI?eI:0,decode_bitrate:8*e6/e8,decoder_implementation:null!==(eR=null==p?void 0:p.decoderImplementation)&&void 0!==eR?eR:"unknown",fir_count:Math.max((null!==(eO=null==p?void 0:p.firCount)&&void 0!==eO?eO:0)-(null!==(eA=null==_?void 0:_.firCount)&&void 0!==eA?eA:0),0),fraction_packets_lost:ti/Math.max(tl+ti,1),frame_decode_time_avg:e7/Math.max(tt,1),frame_height:Math.max(null!==(ek=null==p?void 0:p.frameHeight)&&void 0!==ek?ek:0,0),frame_width:Math.max(null!==(ew=null==p?void 0:p.frameWidth)&&void 0!==ew?ew:0,0),frames_decoded:Math.max((null!==(eN=null==p?void 0:p.framesDecoded)&&void 0!==eN?eN:0)-(null!==(eD=null==_?void 0:_.framesDecoded)&&void 0!==eD?eD:0),0),frames_dropped:Math.max((null!==(eP=null==p?void 0:p.framesDropped)&&void 0!==eP?eP:0)-(null!==(eM=null==_?void 0:_.framesDropped)&&void 0!==eM?eM:0),0),frames_received:Math.max((null!==(eL=null==p?void 0:p.framesReceived)&&void 0!==eL?eL:0)-(null!==(ex=null==_?void 0:_.framesReceived)&&void 0!==ex?ex:0),0),freeze_count:Math.max((null!==(eU=null==p?void 0:p.freezeCount)&&void 0!==eU?eU:0)-(null!==(eB=null==_?void 0:_.freezeCount)&&void 0!==eB?eB:0),0),frames_rendered:Math.max(null!==(ej=null==p?void 0:p.framesRendered)&&void 0!==ej?ej:0,0),frames_per_second:Math.max(null!==(eV=null==p?void 0:p.framesPerSecond)&&void 0!==eV?eV:0,0),header_bytes_received:Math.max((null!==(eF=null==p?void 0:p.headerBytesReceived)&&void 0!==eF?eF:0)-(null!==(eG=null==_?void 0:_.headerBytesReceived)&&void 0!==eG?eG:0),0),configured_jitter_buffer_min_delay_ms:null!=eu?eu:0,jitter_buffer_min_obtainable_delay:e9,jitter_buffer_delay_avg:e5,key_frames_decoded:Math.max((null!==(eH=null==p?void 0:p.keyFramesDecoded)&&void 0!==eH?eH:0)-(null!==(eW=null==_?void 0:_.keyFramesDecoded)&&void 0!==eW?eW:0),0
6),nack_count:Math.max((null!==(eq=null==p?void 0:p.nackCount)&&void 0!==eq?eq:0)-(null!==(e$=null==_?void 0:_.nackCount)&&void 0!==e$?e$:0),0),packets_discarded:Math.max((null!==(eK=null==p?void 0:p.packetsDiscarded)&&void 0!==eK?eK:0)-(null!==(ez=null==_?void 0:_.packetsDiscarded)&&void 0!==ez?ez:0),0),packets_lost:ti,packets_received:tl,pause_count:Math.max((null!==(eJ=null==p?void 0:p.pauseCount)&&void 0!==eJ?eJ:0)-(null!==(eX=null==_?void 0:_.pauseCount)&&void 0!==eX?eX:0),0),pli_count:Math.max((null!==(eY=null==p?void 0:p.pliCount)&&void 0!==eY?eY:0)-(null!==(eQ=null==_?void 0:_.pliCount)&&void 0!==eQ?eQ:0),0),power_efficient_decoder:null!==(eZ=null==p?void 0:p.powerEfficientDecoder)&&void 0!==eZ&&eZ,total_freezes_duration:Math.max((null!==(e0=null==p?void 0:p.totalFreezesDuration)&&void 0!==e0?e0:0)-(null!==(e1=null==_?void 0:_.totalFreezesDuration)&&void 0!==e1?e1:0),0),total_pauses_duration:Math.max((null!==(e2=null==p?void 0:p.totalPausesDuration)&&void 0!==e2?e2:0)-(null!==(e3=null==_?void 0:_.totalPausesDuration)&&void 0!==e3?e3:0),0),sei_read_count:ed,sei_bytes_received:eh,sei_bitrate:8*(eh||0)/e8,protocol:null===(e4=null==Z?void 0:Z.localCandidate)||void 0===e4?void 0:e4.protocol,rid:ep}})(el,eu,ed,eh,ey,ep,ef,eg,ev)))}};let SubscribedAudioStatsEvent=class SubscribedAudioStatsEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep){var ef,eg;super(tg.SUBSCRIBED_AUDIO_STATS,p,_,!1),Object.assign(this.properties,Object.assign({action:iG.SUBSCRIBE,node:null!==(ef=null==et?void 0:et.node)&&void 0!==ef?ef:"",cluster:null!==(eg=null==et?void 0:et.cluster)&&void 0!==eg?eg:"",remote_participant_id:Z},((p,_,Z,et,el)=>{var eu,ed,eh,ep,ef,eg,ev,em,eE,eS,e_,ey,eb,eC,eT,eI,eR,eO;let eA=0;(null==p?void 0:p.jitterBufferDelay)&&(null==p?void 0:p.jitterBufferEmittedCount)&&p.jitterBufferEmittedCount>0&&(eA=p.jitterBufferDelay/p.jitterBufferEmittedCount);let ek=Math.max(null!==(eu=null==p?void 0:p.bytesReceived)&&void 0!==eu?eu:0,0),ew=Math.max(null!==(ed=null==p?void 0:p.packetsLost)&&void 0!==ed?ed:0,0),eN=Math.max(null!==(eh=null==p?void 0:p.packetsReceived)&&void 0!==eh?eh:0,0),eD=Math.max(null!==(ep=null==p?void 0:p.concealedSamples)&&void 0!==ep?ep:0,0),eP=Math.max(null!==(ef=null==p?void 0:p.totalSamplesReceived)&&void 0!==ef?ef:0,0),eM=Ja(null==Z?void 0:Z.mimeType,null==Z?void 0:Z.sdpFmtpLine);return{audio_level:null!==(eg=null==p?void 0:p.audioLevel)&&void 0!==eg?eg:0,audio_nacks_enabled:null!==(ev=null==el?void 0:el.audioNacks)&&void 0!==ev&&ev,bytes_received:ek,codec_mime_type:null==eM?void 0:eM.mimeSubtype,connection_bandwidth:null!==(eE=null===(em=null==_?void 0:_.candidatePair)||void 0===em?void 0:em.availableIncomingBitrate)&&void 0!==eE?eE:0,concealed_samples:eD,concealment_events:Math.max(null!==(eS=null==p?void 0:p.concealmentEvents)&&void 0!==eS?eS:0,0),silent_concealed_samples:Math.max(null!==(e_=null==p?void 0:p.silentConcealedSamples)&&void 0!==e_?e_:0,0),decode_bitrate:8*ek/(null!=et?et:1),fraction_audio_concealed:eD/Math.max(eP,1),fraction_packets_lost:ew/Math.max(eN+ew,1),header_bytes_received:Math.max(null!==(ey=null==p?void 0:p.headerBytesReceived)&&void 0!==ey?ey:0,0),inserted_samples_for_deceleration:Math.max(null!==(eb=null==p?void 0:p.insertedSamplesForDeceleration)&&void 0!==eb?eb:0,0),jitter_buffer_delay_avg:eA,packets_discarded:Math.max(null!==(eC=null==p?void 0:p.packetsDiscarded)&&void 0!==eC?eC:0,0),retransmitted_packets_received:Math.max(null!==(eT=null==p?void 0:p.retransmittedPacketsReceived)&&void 0!==eT?eT:0,0),retransmitted_bytes_received:Math.max(null!==(eI=null==p?void 0:p.retransmittedBytesReceived)&&void 0!==eI?eI:0,0),packets_lost:ew,packets_received:eN,nack_count:Math.max(null!==(eR=null==p?void 0:p.nackCount)&&void 0!==eR?eR:0,0),removed_samples_for_acceleration:Math.max(null!==(eO=null==p?void 0:p.removedSamplesForAcceleration)&&void 0!==eO?eO:0,0),total_samples_received:eP}})(el,eu,ed,eh,ep)))}};let SubscribedAudioStatsWindowEvent=class SubscribedAudioStatsWindowEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el,eu,ed,eh,ep,ef){var eg,ev,em,eE;super(tg.SUBSCRIBED_AUDIO_STATS_WINDOW,p,_,!1);let eS=Math.max((null!==(eg=null==el?void 0:el.timestamp)&&void 0!==eg?eg:0)-(null!==(ev=null==eu?void 0:eu.timestamp)&&void 0!==ev?ev:0),0);Object.assign(this.properties,Object.assign({action:iG.SUBSCRIBE,window_size_ms:eS,node:null!==(em=null==et?void 0:et.node)&&void 0!==em?em:"",cluster:null!==(eE=null==et?void 0:et.cluster)&&void 0!==eE?eE:"",remote_participant_id:Z},((p,_,Z,et,el,eu,ed)=>{var eh,ep,ef,eg,ev,em,eE,eS,e_,ey,eb,eC,eT,eI,eR,eO,eA,ek,ew,eN,eD,eP,eM,eL,ex,eU,eB,ej,eV,eF,eG,eH,eW;let eq=0,e$=0;if((null==p?void 0:p.jitterBufferEmittedCount)&&(null==_?void 0:_.jitterBufferEmittedCount)&&p.jitterBufferEmittedCount>_.jitterBufferEmittedCount){(null==p?void 0:p.jitterBufferDelay)&&(null==_?void 0:_.jitterBufferDelay)&&(eq=(p.jitterBufferDelay-_.jitterBufferDelay)/(p.jitterBufferEmittedCount-_.jitterBufferEmittedCount));let Z=null==_?void 0:_.jitterBufferMinimumDelay,et=null==p?void 0:p.jitterBufferMinimumDelay;Z&&et&&(e$=(et-Z)/(p.jitterBufferEmittedCount-_.jitterBufferEmittedCount))}let eK=Math.max((null!==(eh=null==p?void 0:p.bytesReceived)&&void 0!==eh?eh:0)-(null!==(ep=null==_?void 0:_.bytesReceived)&&void 0!==ep?ep:0),0),ez=Math.max((null!==(ef=null==p?void 0:p.packetsLost)&&void 0!==ef?ef:0)-(null!==(eg=null==_?void 0:_.packetsLost)&&void 0!==eg?eg:0),0
6),eJ=Math.max((null!==(ev=null==p?void 0:p.packetsReceived)&&void 0!==ev?ev:0)-(null!==(em=null==_?void 0:_.packetsReceived)&&void 0!==em?em:0),0),eX=Math.max((null!==(eE=null==p?void 0:p.concealedSamples)&&void 0!==eE?eE:0)-(null!==(eS=null==_?void 0:_.concealedSamples)&&void 0!==eS?eS:0),0),eY=Math.max((null!==(e_=null==p?void 0:p.totalSamplesReceived)&&void 0!==e_?e_:0)-(null!==(ey=null==_?void 0:_.totalSamplesReceived)&&void 0!==ey?ey:0),0),eQ=Ja(null==et?void 0:et.mimeType,null==et?void 0:et.sdpFmtpLine);return{audio_level:null!==(eb=null==p?void 0:p.audioLevel)&&void 0!==eb?eb:0,audio_nacks_enabled:null!==(eC=null==eu?void 0:eu.audioNacks)&&void 0!==eC&&eC,bytes_received:eK,codec_mime_type:null==eQ?void 0:eQ.mimeSubtype,connection_bandwidth:null!==(eI=null===(eT=null==Z?void 0:Z.candidatePair)||void 0===eT?void 0:eT.availableIncomingBitrate)&&void 0!==eI?eI:0,decode_bitrate:8*eK/("number"!=typeof el?1:el/1e3),concealed_samples:eX,concealment_events:Math.max((null!==(eR=null==p?void 0:p.concealmentEvents)&&void 0!==eR?eR:0)-(null!==(eO=null==_?void 0:_.concealmentEvents)&&void 0!==eO?eO:0),0),silent_concealed_samples:Math.max((null!==(eA=null==p?void 0:p.silentConcealedSamples)&&void 0!==eA?eA:0)-(null!==(ek=null==_?void 0:_.silentConcealedSamples)&&void 0!==ek?ek:0),0),fraction_audio_concealed:eX/Math.max(eY,1),fraction_packets_lost:ez/Math.max(eJ+ez,1),header_bytes_received:Math.max((null!==(ew=null==p?void 0:p.headerBytesReceived)&&void 0!==ew?ew:0)-(null!==(eN=null==_?void 0:_.headerBytesReceived)&&void 0!==eN?eN:0),0),inserted_samples_for_deceleration:Math.max((null!==(eD=null==p?void 0:p.insertedSamplesForDeceleration)&&void 0!==eD?eD:0)-(null!==(eP=null==_?void 0:_.insertedSamplesForDeceleration)&&void 0!==eP?eP:0),0),configured_jitter_buffer_min_delay_ms:null!=ed?ed:0,jitter_buffer_min_obtainable_delay:e$,jitter_buffer_delay_avg:eq,packets_discarded:Math.max((null!==(eM=null==p?void 0:p.packetsDiscarded)&&void 0!==eM?eM:0)-(null!==(eL=null==_?void 0:_.packetsDiscarded)&&void 0!==eL?eL:0),0),packets_lost:ez,packets_received:eJ,nack_count:Math.max((null!==(ex=null==p?void 0:p.nackCount)&&void 0!==ex?ex:0)-(null!==(eU=null==_?void 0:_.nackCount)&&void 0!==eU?eU:0),0),removed_samples_for_acceleration:Math.max((null!==(eB=null==p?void 0:p.removedSamplesForAcceleration)&&void 0!==eB?eB:0)-(null!==(ej=null==_?void 0:_.removedSamplesForAcceleration)&&void 0!==ej?ej:0),0),retransmitted_packets_received:Math.max((null!==(eV=null==p?void 0:p.retransmittedPacketsReceived)&&void 0!==eV?eV:0)-(null!==(eF=null==_?void 0:_.retransmittedPacketsReceived)&&void 0!==eF?eF:0),0),retransmitted_bytes_received:Math.max((null!==(eG=null==p?void 0:p.retransmittedBytesReceived)&&void 0!==eG?eG:0)-(null!==(eH=null==_?void 0:_.retransmittedBytesReceived)&&void 0!==eH?eH:0),0),total_samples_received:eY,protocol:null===(eW=null==Z?void 0:Z.localCandidate)||void 0===eW?void 0:eW.protocol}})(el,eu,ed,eh,eS,ep,ef)))}};let SimulcastLayerInfoEvent=class SimulcastLayerInfoEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el=iG.PUBLISH,eu=!1,ed=""){super(tg.SIMULCAST_LAYER_INFO,p,_,!1),Object.assign(this.properties,{rid:Z,active:et,selected:eu,source:el===iG.PUBLISH?"publisher":"subscriber",remote_participant_id:ed})}};let MultihostConfigurationEvent=class MultihostConfigurationEvent extends StageAnalyticsEvent{constructor(p,_,Z,et){super(tg.MULTIHOST_CONFIGURATION,p,_,!1),Object.assign(this.properties,Object.assign(Object.assign({},Z),{action:et}))}};let MultihostSubscribeConfigurationEvent=class MultihostSubscribeConfigurationEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el){super(tg.MULTIHOST_SUBSCRIBE_CONFIGURATION,p,_,!1);let eu={trigger:Z,remote_participant_id:et,min_delay_when_publishing:$a(el.jitterBuffer.minDelayWhenPublishing,!0),min_delay_when_subscribe_only:$a(el.jitterBuffer.minDelayWhenSubscribeOnly,!1),in_band_messaging_enabled:el.inBandMessaging.enabled,simulcast_initial_layer_preference:el.simulcast.initialLayerPreference,simulcast_layer_poll_interval_ms:el.simulcast.layerPollingIntervalMs,simulcast_layer_poll_enabled:el.simulcast.layerPollingEnabled};Object.assign(this.properties,eu)}};var Tc=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let PeerClientStatsReporter=class PeerClientStatsReporter{constructor(p){this.simulcastEnabled=!1,this.simulcastState={low:!1,mid:!1,hi:!1},this.sdp=new SdpMunger(""),this.sdpFeatures={audioNacks:!1},this.multihostConfiguration=PeerClientStatsReporter.defaultMultihostConfiguration(),this.prevOutboundVideoStats=new Map,this.prevInboundVideoStats=new Map,this.prevRemoteInboundStats=new Map,this.sfuResource={node:"",cluster:""},this.connectionStartedTimestamp=Date.now(),this.seiStats={seiReadCnt:0,seiBytesRead:0,seiWriteCnt:0,seiBytesWritten:0},this.prevVideoReceiverTransformerStats={seiReadCnt:0,seiBytesRead:0},this.prevVideoSenderTransformerStats={seiWriteCnt:0,seiBytesWritten:0},this.vidNetworkQualityMap=new Map,this.audioNetworkQualityMap=new Map,this.onPeerConnectionStateChange=()=>{switch(this.getConnectionState()){case tz.CONNECTED:this.connectionStartedTimestamp=Date.now(),this.setupIntervals();break;case tz.FAILED:this.flushStats()}},this.action=p.action,this.token=p.token,this.traceId=p.traceId,this.identifier=p.identifier,this.analyticsTracker=p.analyticsTracker,this.remotePlaybackController=p.remotePlaybackController}static defaultMultihostConfiguration(){return{video_codec:"unknown",width:0,height:0,max_bitrate:0,min_bitrate:0,target_fps:0,echo_cancellation:!1,auto_gain:!1,noise_suppression:!1,enable_simulcast:!1,max_audio_bitrate_bps:Wn(rR),hi_video_layer:"",mid_video_layer:"",low_video_layer:""}}set sdpAnswer(p){try{this.sdp=new SdpMunger(p),this.sdpFeatures.audioNacks=this.sdp.hasAudioNacksEnabled()}catch(p){}}start(p,_=!1){this.peerConnection=p,this.simulcastEnabled=_,this.prevOutboundAudioStats=void 0,this.prevOutboundVideoStats=new Map,this.prevRemoteInboundStats=new Map,this.peerConnection.addEventListener("connectionstatechange",this.onPeerConnectionStateChange)}stop(){var p;clearInterval(this.uploadStatsInterval),this.uploadStatsInterval=void 0,null===(p=this.peerConnection)||void 0===p||p.removeEventListener("connectionstatechange",this.onPeerConnectionStateChange)}updateSfuResource(p){this.sfuResource=p}updateMultihostConfiguration(p,_){var Z,et,el,eu,ed,eh,ep,ef,eg;return Tc(this,void 0,void 0,function*(){if(this.action!==iG.PUBLISH||!this.peerConnection)return;let ev=PeerClientStatsReporter.defaultMultihostConfiguration();if(_){let p=this.peerConnection.getSenders().filter(p=>null!==p.track&&"video"===p.track.kind),ep="unknown";p.length>
60&&(yield p[0].getStats()).forEach(p=>{if("codec"===p.type&&(ev.video_codec=p.mimeType,p.sdpFmtpLine)){let _=p.sdpFmtpLine.match(/profile-level-id=([a-f0-9]+)/);_&&_.length>0&&(ep=_[1])}});let ef=_.track.getSettings();ev.width=null!==(Z=ef.width)&&void 0!==Z?Z:0,ev.height=null!==(et=ef.height)&&void 0!==et?et:0,ev.target_fps=null!==(el=ef.frameRate)&&void 0!==el?el:0,_.config?(ev.max_bitrate=_.config.maxBitrateBps,ev.min_bitrate=_.config.minBitrateBps,ev.enable_simulcast=_.config.simulcastEnabled):(ev.max_bitrate=Wn(rE),ev.min_bitrate=Wn(rm),ev.enable_simulcast=!1),_.config.simulcastEnabled&&(ev.hi_video_layer=this.mapLayerToMetric(ep,null===(eu=_.config.simulcastLayers)||void 0===eu?void 0:eu.hi),ev.mid_video_layer=this.mapLayerToMetric(ep,null===(ed=_.config.simulcastLayers)||void 0===ed?void 0:ed.mid),ev.low_video_layer=this.mapLayerToMetric(ep,null===(eh=_.config.simulcastLayers)||void 0===eh?void 0:eh.low))}if(p){let _=p.track.getSettings();ev.auto_gain=null!==(ep=_.autoGainControl)&&void 0!==ep&&ep,ev.echo_cancellation=null!==(ef=_.echoCancellation)&&void 0!==ef&&ef,ev.noise_suppression=null!==(eg=_.noiseSuppression)&&void 0!==eg&&eg,ev.max_audio_bitrate_bps=p.config.maxBitrateBps,ev.stereo=p.config.stereo}(0,tw.isEqual)(ev,this.multihostConfiguration)||(this.analyticsTracker.trackEventNoSharedProps(new MultihostConfigurationEvent(this.token,this.traceId,ev,this.action)),this.multihostConfiguration=ev)})}resetTransformers(p,_){this.senderVideoTransformer=_,this.receiveVideoTransformer=p,this.prevVideoReceiverTransformerStats={seiReadCnt:0,seiBytesRead:0},this.prevVideoSenderTransformerStats={seiWriteCnt:0,seiBytesWritten:0}}getStats(p){var _;return Tc(this,void 0,void 0,function*(){let Z=yield null===(_=this.peerConnection)||void 0===_?void 0:_.getStats(p),{action:et}=this;if(Z){if("audio"===p.kind){if(et===iG.PUBLISH)return{action:et,rawReport:Z,stats:_c(Z,this.audioNetworkQualityMap)};if(et===iG.SUBSCRIBE)return{action:et,rawReport:Z,stats:bc(Z,this.audioNetworkQualityMap)}}else{if(et===iG.PUBLISH)return{action:et,rawReport:Z,stats:yc(Z,this.vidNetworkQualityMap)};if(et===iG.SUBSCRIBE)return{action:et,rawReport:Z,stats:Cc(Z,this.vidNetworkQualityMap)}}}})}mapLayerToMetric(p,_){return _&&_.active?`${_.height}x${_.width}_${_.maxFramerate}fps_${_.maxBitrateBps/1e3+"kbps"}_${p}`:""}updateJitterBufferMinDelay(p){this.jitterBufferMinDelayInMs=p}setupIntervals(){this.action===iG.PUBLISH&&this.simulcastEnabled&&!this.pollSimulcastLayerInterval&&(this.pollSimulcastLayers(),this.pollSimulcastLayerInterval=this.startInterval(this.pollSimulcastLayers,5e3)),this.uploadStatsInterval||(this.uploadStats(),this.uploadStatsInterval=this.startInterval(this.uploadStats,1e4))}startInterval(p,_){return setInterval(p.bind(this),_)}getConnectionState(){var p;if(!this.peerConnection)return tz.NONE;let _=null!==(p=this.peerConnection.connectionState)&&void 0!==p?p:this.peerConnection.iceConnectionState;try{return en(_)}catch(p){return tz.IDLE}}pollSimulcastLayers(){var p;return Tc(this,void 0,void 0,function*(){if(this.getConnectionState()===tz.CONNECTED){let _=yield null===(p=this.peerConnection)||void 0===p?void 0:p.getStats();_&&_.forEach(p=>{var _;if("outbound-rtp"===p.type){let Z=0!==(null!==(_=p.framesPerSecond)&&void 0!==_?_:0);switch(p.rid){case"low":Z!==this.simulcastState.low&&(this.simulcastState.low=Z,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,p.rid,Z)));break;case"mid":Z!==this.simulcastState.mid&&(this.simulcastState.mid=Z,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,p.rid,Z)));break;case"hi":Z!==this.simulcastState.hi&&(this.simulcastState.hi=Z,this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,this.traceId,p.rid,Z)))}}})}})}flushStats(){var p;return Tc(this,void 0,void 0,function*(){let _=yield null===(p=this.peerConnection)||void 0===p?void 0:p.getStats();_&&(this.action===iG.PUBLISH?this.uploadPublisherStats(_):this.action===iG.SUBSCRIBE&&this.uploadSubscriberStats(_))})}uploadStats(){var p;return Tc(this,void 0,void 0,function*(){if(this.getConnectionState()===tz.CONNECTED){let _=yield null===(p=this.peerConnection)||void 0===p?void 0:p.getStats();_&&(this.action===iG.PUBLISH?this.uploadPublisherStats(_):this.action===iG.SUBSCRIBE&&this.uploadSubscriberStats(_))}})}uploadPublisherStats(p){var _,Z;let et={audio:{},video:[],candidateStats:{}},el=new Map,eu=(Date.now()-this.connectionStartedTimestamp)/1e3,ed=Object.assign({},this.multihostConfiguration),{seiWriteCnt:eh,seiBytesWritten:ep}=this.updateAndDiffSeiPublishStatsSinceLastUpdate(null===(_=this.senderVideoTransformer)||void 0===_?void 0:_.getSenderStats());if(this.seiStats.seiWriteCnt+=eh,this.seiStats.seiBytesWritten+=ep,p.forEach(_=>{if("outbound-rtp"===_.type){let Z=p.get(_.remoteId),eu=this.prevRemoteInboundStats.get(_.remoteId);switch(Z&&this.prevRemoteInboundStats.set(Z.id,Z),_.kind){case"audio":et.audio=this.updateOutboundAudio(_),et.audio.remoteInbound=Z,et.audio.prevRemoteInbound=eu,et.audio.codec=el.get(_.codecId);break;case"video":et.video.push(Object.assign({},this.updateOutboundVideo(_),{remoteInbound:Z,prevRemoteInbound:eu,codec:el.get(_.codecId)}))}}"candidate-pair"===_.type&&_.nominated&&(et.candidateStats.candidatePair=_,et.candidateStats.localCandidate=p.get(_.localCandidateId),et.candidateStats.remoteCandidate=p.get(_.remoteCandidate)),"codec"===_.type&&el.set(_.id,_)}),et.video.forEach(p=>{var _,Z;let{outbound:et,prevOutbound:el}=p;if(!et)return;let eu=null!==(Z=null===(_=p.outbound)||void 0===_?void 0:_.rid)&&void 0!==Z?Z:em;this.updateNetworkQualityPublish(eu,this.vidNetworkQualityMap,et,el)}),et.audio.outbound){let p=null!==(Z=et.audio.outbound.rid)&&void 0!==Z?Z:em;this.updateNetworkQualityPublish(p,this.audioNetworkQualityMap,et.audio.outbound,et.audio.prevOutbound)}this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsEvent(this.token,this.traceId,this.sfuResource,et.audio.outbound,et.audio.remoteInbound,et.candidateStats,et.audio.codec,ed,eu,this.sdpFeatures)),et.audio.prevOutbound&&this.analyticsTracker.trackEventNoSharedProps(new PublishedAudioStatsWindowEvent(this.token,this.traceId,this.sfuResource,et.audio.outbound,et.audio.prevOutbound,et.audio.remoteInbound,et.audio.prevRemoteInbound,et.candidateStats,et.audio.codec,ed,this.sdpFeatures)),et.video.forEach(p=>{this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsEvent(this.token,this.traceId,this.sfuResource,p.outbound,p.remoteInbound,et.candidateStats,p.codec,ed,eu)),p.prevOutbound&&this.analyticsTracker.trackEventNoSharedProps(new PublishedVideoStatsWindowEvent(this.token,this.traceId,this.sfuResource,p.outbound,p.prevOutbound,p.remoteInbound,p.prevRemoteInbound,et.candidateStats,p.codec,ed,this.seiStats.seiWriteCnt,this.seiStats.seiBytesWritten))})}updateNetworkQualityPublish(p,_,Z,et){var el,eu,ed,eh;let ep=0,ef=nR.getNetworkQuality(),eg=null!==(el=Z.packetsSent)&&void 0!==el?el:0,ev=null!==(eu=Z.nackCount)&&void 0!==eu?eu:0;if(et){if(ef===tX.DOWN)_.set(p,tX.DOWN);else{ep=(ev-(null!==(ed=null==et?void 0:et.nackCount)&&void 0!==ed?ed:0))/(eg-(null!==(eh=null==et?void 0:et.packetsSent)&&void 0!==eh?eh:0));let Z=this.convertLostRatioToQuality(ep);_.set(p,Z)}}else _.set(p,ef)}updateNetworkQualitySubscribe(p,_,Z){var et,el,eu,ed;let eh=0,ep=nR.getNetworkQuality(),ef=null!==(et=null==_?void 0:_.packetsReceived)&&void 0!==et?et:0,eg=null!==(el=null==_?void 0:_.nackCount)&&void 0!==el?el:0;if(!_)return;let ev=_.id;if(ev){if(Z){if(ep===tX.DOWN)p.set(ev,tX.DOWN);else{eh=(eg-(null!==(eu=null==Z?void 0:Z.nackCount)&&void 0!==eu?eu:0))/(ef-(null!==(ed=null==Z?void 0:Z.packetsReceived)&&void 0!==ed?ed:0));let _=this.convertLostRatioToQuality(eh);p.set(ev,_)}}else p.set(ev,ep)}}uploadSubscriberStats(p){var _,Z,et,el;let eu={audio:{},video:{},candidateStats:{}},ed=new Map,eh=(Date.now()-this.connectionStartedTimestamp)/1e3,ep=null!==(_=this.jitterBufferMinDelayInMs)&&void 0!==_?_:0,{seiReadCnt:ef,seiBytesRead:eg}=this.updateAndDiffSeiSubscribeStatsSinceLastUpdate(null===(Z=this.receiveVideoTransformer)||void 0===Z?void 0:Z.getReceiverStats());if(this.seiStats.seiReadCnt+=ef,this.seiStats.seiBytesRead+=eg,p.forEach(_=>{if("inbound-rtp"===_.type)switch(_.kind){case"audio":eu.audio=this.updateInboundAudio(_),eu.audio.codec=ed.get(_.codecId),this.updateNetworkQualitySubscribe(this.audioNetworkQualityMap,eu.audio.inbound,eu.audio.prevInbound);break;case"video":eu.video=this.updateInboundVideo(_),eu.video.codec=ed.get(_.codecId),this.updateNetworkQualitySubscribe(this.vidNetworkQualityMap,eu.video.inbound,eu.video.prevInbound)}"candidate-pair"===_.type&&_.nominated&&(eu.candidateStats.candidatePair=_,eu.candidateStats.localCandidate=p.get(_.localCandidateId),eu.candidateStats.remoteCandidate=p.get(_.remoteCandidate)),"codec"===_.type&&ed.set(_.id,_)}),this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsEvent(this.token,this.traceId,this.identifier,this.sfuResource,eu.audio.inbound,eu.candidateStats,eu.audio.codec,eh,this.sdpFeatures)),eu.audio.prevInbound&&this.analyticsTracker.trackEventNoSharedProps(new SubscribedAudioStatsWindowEvent(this.token,this.traceId,this.identifier,this.sfuResource,eu.audio.inbound,eu.audio.prevInbound,eu.candidateStats,eu.audio.codec,this.sdpFeatures,ep)),this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsEvent(this.token,this.traceId,this.identifier,this.sfuResource,eu.video.inbound,eu.candidateStats,eu.video.codec,eh)),eu.video.prevInbound){let p=null!==(el=null===(et=this.remotePlaybackController)||void 0===et?void 0:et.getSelectedLayerRid())&&void 0!==el?el:"";this.analyticsTracker.trackEventNoSharedProps(new SubscribedVideoStatsWindowEvent(this.token,this.traceId,this.identifier,this.sfuResource,eu.video.inbound,eu.video.prevInbound,eu.candidateStats,eu.video.codec,ep,this.seiStats.seiReadCnt,this.seiStats.seiBytesRead,p))}}updateAndDiffSeiSubscribeStatsSinceLastUpdate(p){let _=this.prevVideoReceiverTransformerStats;
6if(!p)return{seiReadCnt:_.seiReadCnt,seiBytesRead:_.seiBytesRead};let Z=p.seiReadCnt-_.seiReadCnt,et=p.seiBytesRead-_.seiBytesRead;return this.prevVideoReceiverTransformerStats={seiReadCnt:p.seiReadCnt,seiBytesRead:p.seiBytesRead},{seiReadCnt:Z,seiBytesRead:et}}updateAndDiffSeiPublishStatsSinceLastUpdate(p){let _=this.prevVideoSenderTransformerStats;if(!p)return{seiWriteCnt:_.seiWriteCnt,seiBytesWritten:_.seiBytesWritten};let Z=p.seiWriteCnt-_.seiWriteCnt,et=p.seiBytesWritten-_.seiBytesWritten;return this.prevVideoSenderTransformerStats={seiWriteCnt:p.seiWriteCnt,seiBytesWritten:p.seiBytesWritten},{seiWriteCnt:Z,seiBytesWritten:et}}updateOutboundAudio(p){let _=this.prevOutboundAudioStats,Z=p.id===(null==_?void 0:_.id)?_:void 0;return this.prevOutboundAudioStats=p,{outbound:p,prevOutbound:Z}}updateInboundAudio(p){let _=this.prevInboundAudioStats,Z=p.id===(null==_?void 0:_.id)?_:void 0;return this.prevInboundAudioStats=p,{inbound:p,prevInbound:Z}}updateInboundVideo(p){let _=this.prevInboundVideoStats.get(em),Z=p.id===(null==_?void 0:_.id)?_:void 0;return this.prevInboundVideoStats.set(em,p),{inbound:p,prevInbound:Z}}updateOutboundVideo(p){let _=this.getPrevOutboundVideo(p),Z=p.id===(null==_?void 0:_.id)?_:void 0;return this.setPrevVideoStat(p),{outbound:p,prevOutbound:Z}}getPrevOutboundVideo(p){return this.simulcastEnabled&&p.rid&&this.prevOutboundVideoStats.has(p.rid)?this.prevOutboundVideoStats.get(p.rid):!this.simulcastEnabled&&this.prevOutboundVideoStats.has(em)?this.prevOutboundVideoStats.get(em):void 0}setPrevVideoStat(p){this.simulcastEnabled&&p.rid?this.prevOutboundVideoStats.set(p.rid,p):this.simulcastEnabled||this.prevOutboundVideoStats.set(em,p)}convertLostRatioToQuality(p){return p<=0?tX.EXCELLENT:p<=.01?tX.GOOD:p<=.03?tX.NORMAL:p<=.1?tX.POOR:tX.DOWN}};var o_,oy,ob,oC,oT,oI,oR,oO,oA,ok,ow,oN,oD,oP,oM,oL,ox,oU,oB,oj,oV,oF,oG,oH,oW,oq,Ac=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})},kc=function(p,_,Z,et){if("a"===Z&&!et)throw TypeError("Private accessor was defined without a getter");if("function"==typeof _?p!==_||!et:!_.has(p))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===Z?et:"a"===Z?et.call(p):et?et.value:_.get(p)};(oz=oW||(oW={})).DISCONNECTED="disconnected",oz.CONNECTING="connecting",oz.CONNECTED="connected",oz.ERRORED="errored",(oJ=oq||(oq={})).NONE="none",oJ.AUDIO_ONLY="audio_only",oJ.AUDIO_VIDEO="audio_video";let StageSubscription=class StageSubscription extends TypedEmitter{constructor(p,_,Z,et,el,eu,ed,eh,ep=!1){super(),this.id=p,this.token=_,this.stageConnection=Z,this.nonScopedLogger=et,this.analyticsTracker=el,this.desiredSubscribeType=eu,this.stageConfig=eh,oG.add(this),this.isSubscriptionActive=!1,this.subscriptionState={connectionState:oW.DISCONNECTED,subscribeInProgress:!1},this.previousSignalState={isTargetPublishing:!1},this.failedRetries=0,this.startConnectingTimestamp=-1,this.throttler=new ThrottleTimer(1e3),this.cleanupFirstFrameTracking=Zt,this.actualSubscribeType=oq.NONE,this.action=iG.SUBSCRIBE,this.updateDesiredSubscribeType=p=>{this.desiredSubscribeType=p,this.attemptToActualizeSubscribeType()},this.updateSubscribeConfig=p=>{this.peerClient.updateSubscribeConfig(p)},this.getDesiredSubscribeType=()=>this.desiredSubscribeType,this.attemptToActualizeSubscribeType=()=>{let p=this.actualSubscribeType,_=this.desiredSubscribeType;this.logger.debug({msg:`Attempt to actualize subscribe type to ${_}`}),this.subscriptionState.connectionState===oW.CONNECTED&&_!==oq.NONE&&p!==_&&this.applyVideoControlsBySubscribeType(_,p)},this.onParticipantUpdated=p=>{kc(this,oG,"m",oH).call(this,p)&&(this.logger.debug({msg:"onParticipantUpdated",participant:p}),this.processStateUpdate({isTargetPublishing:p.isPublishing}))},this.onParticipantJoined=p=>{kc(this,oG,"m",oH).call(this,p)&&(this.logger.debug({msg:"onParticipantJoined",participant:p}),this.processStateUpdate({isTargetPublishing:p.isPublishing}))},this.onParticipantLeft=p=>{kc(this,oG,"m",oH).call(this,p)&&(this.logger.debug({msg:"onParticipantLeft",participant:p}),this.processStateUpdate({isTargetPublishing:!1}))},this.onPeerClientConnectionStateChange=p=>
6{let _=this.stageConnection.getParticipant(this.id);this.logger.debug({msg:`onPeerClientConnectionStateChange: ${p}`,state:p,targetParticipant:_}),this.processStateUpdate({peerClientState:p})},this.onPeerClientTransformError=p=>{this.emit(iy,p)},this.onSdpNegotiated=p=>{this.remotePlaybackController.endpoints={playback:p.mediaControls,layers:p.layerControls}},this.seiMessageHandler=p=>{this.emit(i_,p)},this.requestRTCStats=p=>Ac(this,void 0,void 0,function*(){return this.peerClient.requestRTCStats(p)}),this.trySubscribe=p=>Ac(this,void 0,void 0,function*(){var _,Z;if(this.logger.debug({msg:`Subscribe attempt started: ${p}`}),!this.isSubscriptionActive)return this.logger.warn({msg:"Subscribe attempt invalid: Subscription is inactive"}),!1;this.logger.debug({msg:"Subscribe attempt is valid."}),this.startConnectingTimestamp<0&&(this.startConnectingTimestamp=performance.now()),this.subscriptionState.connectionState!==oW.ERRORED&&(this.logger.debug({msg:"Updating state to CONNECTING"}),this.updateState({connectionState:oW.CONNECTING}));let et=this.stageConnection.getConnectionStats(),el=this.peerClient.getExpectedJitterBufferMinDelayInMs(),eu=this.peerClient.getSfuResource();this.attemptTracker=this.subscribeTracker.trackAttempt({stageConnectionStats:et,preAttemptSfuResource:eu});try{this.remotePlaybackController.traceId=this.attemptTracker.getTraceId();let{mediaStream:p}=yield this.subscribe(this.attemptTracker.getTraceId()),_=performance.now()-this.startConnectingTimestamp,Z=this.peerClient.getSfuResource();this.remotePlaybackController.mediaId=this.peerClient.videoMediaId;let et=this.failedRetries;this.attemptToActualizeSubscribeType();let eu=this.peerClient.getActionMeasurements(),ed=this.peerClient.getProtocol();if(this.attemptTracker.trackSubscribeStarted({sfuResource:Z,totalDurationWithRetries:_,retryTimes:et,peerClientPerfStats:eu,protocol:ed}),p){this.cleanupFirstFrameTracking();let eh=this.actualSubscribeType,ep=this.attemptTracker;this.cleanupFirstFrameTracking=this.measureFirstFrameDuration({mediaStream:p,subscribeType:eh,callback:(p,ef)=>{ep.trackSubscribeFirstFrame({peerClientPerfStats:eu,sfuResource:Z,totalDurationWithRetries:_,retryTimes:et,currentJitterBufferMinDelayInMs:el,mediaType:ef,firstFrameDuration:p,protocol:ed,rid:this.remotePlaybackController.getSelectedLayerRid()}),ep.trackTimeToMedia({totalDurationWithRetries:_,firstFrameDuration:p,mediaType:ef,subscribeType:eh,rid:this.remotePlaybackController.getSelectedLayerRid()})}})}return this.throttler.clear(),this.failedRetries=0,this.startConnectingTimestamp=-1,p&&this.emit(im,p,this.remotePlaybackController),this.logger.debug({msg:"Subscribe attempt succeeded"}),!0}catch(eu){let et=null!==(Z=null===(_=this.peerClient)||void 0===_?void 0:_.getProtocol())&&void 0!==Z?Z:"",el=this.attemptTracker.trackSubscribeFailed(eu,et);this.logger.error({log:"Subscribe attempt failed",err:eu}),this.onTrySubscribeFailure(el,p)}return!1});let ef=ns();this.remotePlaybackController=new RemotePlaybackController({token:_,analyticsTracker:el,traceId:ef,logger:this.nonScopedLogger,remoteParticipantId:this.id});let eg=new PeerClientStatsReporter({action:this.action,token:_,traceId:ef,identifier:p,analyticsTracker:el,remotePlaybackController:this.remotePlaybackController});this.peerClient=new StagePeerClient(_,this.nonScopedLogger,this.action,ds(this.action,p),ef,el,eg,p,Z,ed,this.stageConfig),this.logger=new ScopedLogger(et,e0.SUBSCRIPTION),this.subscribeTracker=new SubscribeTracker({analyticsTracker:this.analyticsTracker,token:_,remoteId:p,ttmEligible:ep})}applyVideoControlsBySubscribeType(p,_){try{p===oq.AUDIO_ONLY?this.remotePlaybackController.stopVideo().catch(p=>{this.logger.error({err:p,msg:"Remote playback request to stop video failed"})}):p===oq.AUDIO_VIDEO&&this.remotePlaybackController.startVideo().catch(p=>{this.logger.error({err:p,msg:"Remote playback request to start video failed"})}),this.actualSubscribeType=p,this.logger.debug({msg:`Desired subscribe type actualized from ${_} to ${p}.`})}catch(Z){this.logger.error({err:Z,msg:`Error updating subscribe type from ${_} to ${p}.`})}}processStateUpdate(p){let _=this.previousSignalState,Z=Object.assign({},_,p);if(!this.isSubscriptionActive)return void this.logger.warn({msg:"Unexpected processStateUpdate when subscription is inactive"});Z.isTargetPublishing?p.peerClientState===tz.CONNECTED?this.updateState({connectionState:oW.CONNECTED,subscribeInProgress:!0}):p.peerClientState===tz.FAILED&&this.subscriptionState.subscribeInProgress&&(this.attemptTracker&&this.attemptTracker.trackEndFailed(iK.CONNECTION_FAIL,this.peerClient.getProtocol()),this.updateState({subscribeInProgress:!1}
6),this.emit(iE)):(_.isTargetPublishing&&this.subscriptionState.subscribeInProgress&&(this.logger.debug({msg:"Scheduling an unsubscribe on the event loop"}),this.unsubscribe()),this.throttler.clear(),this.updateState({connectionState:oW.DISCONNECTED}));let et=!_.isTargetPublishing&&p.isTargetPublishing,el=this.subscriptionState.connectionState===oW.CONNECTED&&p.peerClientState===tz.FAILED;(et||el)&&this.throttledTrySubscribe("onSignalState change: isTargetPublishing is now true"),Object.assign(this.previousSignalState,p)}onTrySubscribeFailure(p,_){this.logger.debug({msg:"Changing/keeping state FAILED"});let Z=this.stageConnection.getIsTokenExchangeInFlight(),et=p.fatal&&!Z;p.fatal&&Z&&this.logFatalErrorSuppressedDuringExchange(p);let el=p.code===n5.OPERATION_ABORTED.code,eu=this.failedRetries<=4;if(el||et||!eu)this.updateState({connectionState:oW.ERRORED}),this.emit(iS,p),this.onTerminalFailure();else{let p=1e3*Math.pow(2,this.failedRetries);this.logger.debug({msg:`Retrying in ${p}ms`}),this.failedRetries++,this.nextAttemptTimerId=window.setTimeout(()=>Ac(this,void 0,void 0,function*(){this.throttledTrySubscribe(_)}),p)}}onTerminalFailure(){this.previousSignalState.isTargetPublishing=!1,this.startConnectingTimestamp=-1,this.failedRetries=0}logFatalErrorSuppressedDuringExchange(p){let _=`Fatal subscribe error suppressed during token exchange: ${p.message} (code: ${p.code})`;this.logger.warn({msg:_}),this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,this.attemptTracker.getTraceId(),_,iG.SUBSCRIBE,this.id))}start(){this.isSubscriptionActive=!0,this.peerClient.on(tS,this.onPeerClientConnectionStateChange),this.peerClient.on(t_,this.onSdpNegotiated),this.peerClient.on(tb,this.seiMessageHandler),this.peerClient.on(tC,this.onPeerClientTransformError),this.stageConnection.on(is,this.onParticipantUpdated),this.stageConnection.on(n6,this.onParticipantJoined),this.stageConnection.on(n8,this.onParticipantLeft),this.stageConnection.on(n7,this.onParticipantLeft);let p=!0;if(this.stageConnection.isConnected()){let _=this.stageConnection.getParticipant(this.id
6);p=!!(null==_?void 0:_.isPublishing)}this.processStateUpdate({isTargetPublishing:p})}throttledTrySubscribe(p){return this.throttler.invoke(this.trySubscribe,p)}updateState(p){void 0!==p.subscribeInProgress&&(this.subscriptionState.subscribeInProgress=p.subscribeInProgress),p.connectionState&&this.subscriptionState.connectionState!==p.connectionState&&(this.subscriptionState.connectionState=p.connectionState,this.emit(iv,this.subscriptionState.connectionState))}stop(p=!1){this.peerClient.off(tS,this.onPeerClientConnectionStateChange),this.peerClient.off(tC,this.onPeerClientTransformError),this.peerClient.off(t_,this.onSdpNegotiated),this.peerClient.off(tb,this.seiMessageHandler),this.unsubscribe(p),this.throttler.clear(),this.stageConnection.off(is,this.onParticipantUpdated),this.stageConnection.off(n6,this.onParticipantJoined),this.stageConnection.off(n8,this.onParticipantLeft),this.stageConnection.off(n7,this.onParticipantLeft),this.isSubscriptionActive=!1,this.updateState({connectionState:oW.DISCONNECTED})}isActive(){return this.isSubscriptionActive}subscribe(p,_){return Ac(this,void 0,void 0,function*(){let{token:Z,id:et}=this;Z.assertTokenIsUnexpired(p,ds(iG.SUBSCRIBE,et),"subscribe",et);let{mediaStream:el}=yield this.peerClient.connect({audioOnly:_,traceId:p});return{peerClient:this.peerClient,mediaStream:el}})}unsubscribe(p=!1){return Ac(this,void 0,void 0,function*(){if(window.clearTimeout(this.nextAttemptTimerId),this.remotePlaybackController.destroy(),!this.isSubscriptionActive||!this.attemptTracker||this.subscriptionState.connectionState===oW.DISCONNECTED)return;this.cleanupFirstFrameTracking(),this.attemptTracker.trackUnsubscribe();let _=p?iK.UNLOAD:iK.UNSUBSCRIBE,Z=this.peerClient.getProtocol();try{p?this.peerClient.disconnect(p):yield this.peerClient.disconnect(p),this.updateState({subscribeInProgress:!1}),this.attemptTracker.trackEndSucceeded(_,Z)}catch(p){this.attemptTracker.trackEndFailed(_,Z)}})}triggerIceRestart(p){var _;return Ac(this,void 0,void 0,function*(){let Z=this.stageConnection.getConnectionStats(),et=this.peerClient.getSfuResource(),el=this.subscribeTracker.trackAttempt({stageConnectionStats:Z,isReassignment:!0,traceIdOverride:p.traceId,preAttemptSfuResource:et}),eu=performance.now();try{this.emit(ib),this.logger.debug({msg:`Triggering attempt. Current node: ${this.peerClient.getSfuResource().node}`}),yield this.peerClient.connect({iceRestartOptions:p,traceId:p.traceId}),this.logger.debug({msg:`Successful ICE restart attempt. Current node: ${this.peerClient.getSfuResource().node}`});let Z=performance.now()-eu,et=this.peerClient.getSfuResource(),ed=this.peerClient.getActionMeasurements();null===(_=this.attemptTracker)||void 0===_||_.trackEndSucceeded(iK.REASSIGNMENT,this.peerClient.getProtocol()),this.applyVideoControlsBySubscribeType(this.actualSubscribeType,this.actualSubscribeType),el.trackSubscribeStarted({totalDurationWithRetries:Z,sfuResource:et,retryTimes:0,peerClientPerfStats:ed,protocol:this.peerClient.getProtocol()}),this.emit(iC)}catch(Z){this.emit(iT),this.logger.error({msg:"ICE restart attempt failed",err:Z});let p=this.peerClient.getSfuResource(),_=el.trackSubscribeFailed(Z,this.peerClient.getProtocol(),`iceRestart=true, startNode=${et.node}, endNode=${null==p?void 0:p.node}`);throw _.code===n5.SUBSCRIBE_TIMED_OUT.code&&this.onTrySubscribeFailure(_,"ice restart timeout"),Z}})}triggerAdhocReassignment(){return Ac(this,void 0,void 0,function*(){yield this.peerClient.requestReassignment()})}measureFirstFrameDuration({mediaStream:p,subscribeType:_,callback:Z}){let et=performance.now(),i=p=>{let _=performance.now()-et;Z(_,p),"audio"===p?eu():el()},el=Zt,eu=Zt;return _!==oq.AUDIO_ONLY&&(el=tn(p,"video",i)),eu=tn(p,"audio",i),()=>{el(),eu()}}};oG=new WeakSet,oH=function(p){return p.id===this.id};let MinuteEvent=class MinuteEvent extends StageAnalyticsEvent{constructor(p,_,Z,et,el){super(tg.MINUTE,p,_,!1),Object.assign(this.properties,{action:et?iG.PUBLISH:iG.SUBSCRIBE,is_publishing:et,minutes_logged:Z,subscribed_number:el})}};let EDPPongEvent=class EDPPongEvent extends StageAnalyticsEvent{constructor(p){super(tg.EDP_PONG,p.token,p.traceId,!1),Ob
6ject.assign(this.properties,{event_endpoint:p.eventEndpoint,protocol:p.protocol,edp_rtt:p.edpRttMs})}};let JoinEvent=class JoinEvent extends StageAnalyticsEvent{constructor(p){super(tg.JOIN,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.JOIN,event_endpoint:p.eventEndpoint,whip_endpoint:p.whipEndpoint})}};let JoinAttemptEvent=class JoinAttemptEvent extends StageAnalyticsEvent{constructor(p){super(tg.JOIN_ATTEMPT,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.JOIN,event_endpoint:p.eventEndpoint,whip_endpoint:p.whipEndpoint})}};let JoinFailedEvent=class JoinFailedEvent extends StageAnalyticsEvent{constructor(p){super(tg.JOIN_ATTEMPT_FAILED,p.token,p.traceId,!1),Object.assign(this.properties,{action:iG.JOIN,event_endpoint:p.eventEndpoint,whip_endpoint:p.whipEndpoint,code:p.code,message:p.message,fatal:p.fatal,nominal:p.nominal,connect_retry_times:p.retryCnt})}};let EDPDisconnectedEvent=class EDPDisconnectedEvent extends StageAnalyticsEvent{constructor(p){super(tg.EDP_DISCONNECTED,p.token,p.traceId,!1),Object.assign(this.properties,{event_endpoint:p.eventEndpoint,protocol:p.protocol}),this.critical=!0}};let EDPConnectedEvent=class EDPConnectedEvent extends StageAnalyticsEvent{constructor(p){super(tg.EDP_CONNECTED,p.token,p.traceId,!1),Object.assign(this.properties,{event_endpoint:p.eventEndpoint,protocol:p.protocol,connect_retry_times:p.numRetries}),this.critical=!0}};let StageSocket=class StageSocket{constructor(p){this.protocol="",this.connecting=!1,this.closing=!1,this.windowUnloading=!1,this.maxConnectRetries=6,this.connectionAttempts=0,this.latestSequenceNumber=0,this.latestSubscriberCountSequenceNumber=0,this.nextConnectionAttemptId=0,this.connectTimeoutId=0,this.latestPingTimestamp=0,this.pingIntervalId=0,this.pongTimeoutId=0,this.pingIntervalMs=15e3,this.pongTimeoutMs=3e4,this.attemptConnect=p=>{this.latestSequenceNumber=0,this.latestSubscriberCountSequenceNumber=0,this.traceId=p||ns(),this.connectionAttempts++,this.trackJoinAttempt(this.connectionAttempts);let{topic:_,rawToken:Z}=this.token;this.connecting=!0,this.closing=!1;try{let p=encodeURIComponent(this.traceId.value),et=`topic=${_}/publishers`,el=`traceid=${p}`,eu=`${this.addr}?error_over_ws=1&${et}&${el}`;this.socket=this.createWebSocket(eu,Z),this.socket.onmessage=this.onMessage.bind(this),this.socket.onerror=this.onError.bind(this),this.socket.onclose=this.onClose.bind(this),this.socket.onopen=this.onOpen.bind(this),this.protocol=this.socket.protocol}catch(Z){let p=Z instanceof Error?Z.message:void 0,_=this.createError(n5.EVENT_PLANE_WS_CREATE_FAILED,p);this.trackJoinFailed(_,this.getRetryCount()),this.emitter.emit(iA,_)}},this.triggerSocketOpen=p=>{this.clearConnectionAttemptTimeouts();let _=this.getRetryCount();this.connectionAttempts=0,this.connecting=!1,this.trackJoinStarted(_),this.emitter.emit(iI,{retryCnt:_,traceId:this.traceId,initialStageState:p}),this.pingIntervalId=window.setInterval(this.ping,this.pingIntervalMs)},this.ping=()=>{var p;if(this.logger.debug({msg:`${this.id}sending PING`}),!this.isSocketOpen()){let p=`${this.id} attempting to ping an unopened socket`;return this.logger.warn({msg:p}),void this.traceJoinOp(p)}this.latestPingTimestamp=performance.now(),0===this.pongTimeoutId&&(this.pongTimeoutId=window.setTimeout(this.pongTimedOut,this.pongTimeoutMs)),null===(p=this.socket)||void 0===p||p.send(JSON.stringify({type:"PING"}))},this.pongTimedOut=()=>{if(!this.isSocketOpen()){let p=`${this.id} attempting pong timeout on an unopened socket`;return this.logger.warn({msg:p}),void this.traceJoinOp(p)}this.logger.debug({msg:`${this.id} Pong timed out!`}),this.clearPingPongTracking();let p=this.createError(n5.EVENT_PLANE_PONG_TIMEOUT);this.emitter.emit(iA,p)},this.beforeUnload=()=>{this.emitter.emit(iR,"beforeunload"),this.windowUnloading=!0},this.sendSdpOffer=(p,_,Z,et,el,eu,ed,eh,ep)=>{var ef;let eg={type:"aws:ivs:SDP_OFFER",payload:{whipUrl:_,requestId:et,traceId:Z,platform:"web",sdk:"1.38.0",whipVersion:i2,content:p,contentType:"application/sdp"}};el&&(eg.payload.forceNode=el),eu&&(eg.payload.forceCluster=eu),ed&&(eg.payload.assignmentToken=ed),eh&&(eg.payload.multiCodec=eh),ep&&(eg.payload.initialLayerPref=Jn(ep)),this.logger.debug({msg:`${this.id} Sending SDP_OFFER`}),null===(ef=this.socket)||void 0===ef||ef.send(JSON.stringify(eg))},this.checkNonFatalRetriesLimit=p=>{if(p.fatal||this.connectionAttempts<=this.maxConnectRetries)return tm.ok(!0);this.logger.debug({msg:`${this.id} maximum non-fatal retries of ${this.maxConnectRetries} exceeded`});let _=this.createError(n5.JOIN_TIMED_OUT);return tm.err(_)},this.getRetryCount=()=>Math.max(this.connectionAttempts-1,0),this.trackSocketError=p=>{this.connecting&&this.trackJoinFailed(p,this.getRetryCount()),this.analyticsTracker.trackError(p)},this.trackJoinEnded=()=>{this.analyticsTracker.trackEventNoSharedProps(new EDPDisconnectedEvent({token:this.token,eventEndpoint:this.token.eventsURL,traceId:this.traceId,protocol:this.protocol}))},this.traceJoinOp=p=>{this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,this.traceId,p,iG.JOIN))},this.token=p.token,this.analyticsTracker=p.analyticsTracker,this.signalingConfig=p.signalingConfig,this.logger=new ScopedLogger(p.logger,e0.SOCKET),this.emitter=new tv.EventEmitter,this.traceId=ns(),this.id=`[${ts().value}] `,this.pingIntervalMs=p.socketConfig.pingIntervalMs,this.pongTimeoutMs=p.socketConfig.pongTimeoutMs,this.maxConnectRetries=p.socketConfig.maxConnectRetries,window.addEventListener("beforeunload",this.beforeUnload)}connect(p,_,Z=!1){this.close(),this.logger.debug({msg:`${this.id}connecting to ${this.addr}`}),this.addr=p,this.traceId=_,Z&&!this.connecting&&(window.clearTimeout(this.connectTimeoutId),this.connectTimeoutId=window.setTimeout(this.connectTimedOut.bind(this),12e3)),this.attemptConnect(_)}send(p){var _;this.logger.debug({msg:`${this.id}sending ${JSON.stringify(p)}`}),this.logger.debug({msg:`${this.id}isReady called`}),this.isSocketOpen()?null===(_=this.socket)||void 0===_||_.send(JSON.stringify(p)):this.logger.warn({msg:"Trying to send data over stage socket that is not ready"})}sendExchangeToken(p){this.send({type:"aws:ivs:EXCHANGE_TOKEN",payload:p})}close(){this.logger.debug({msg:`${this.id}closing`});let p=this.connecting,_=this.isSocketOpen(),Z=this.socket&&this.socket.readyState===this.socket.CLOSING,et=this.getRetryCount();if(this.markSocketAsClosed(),this.clearPingPongTracking(),this.clearConnectionAttemptTimeouts(),this.connectionAttempts=0,this.socket){if(this.cleanupWebSocket(),_&&this.isStateMessageReceived())this.trackJoinEnded(),this.emitter.emit(iR,"intentional-close");else if(p&&!Z){let p=this.createError(n5.OPERATION_ABORTED);this.trackJoinFailed(p,et),this.analyticsTracker.trackError(p),this.emitter.emit(iA,p)}}}markSocketAsClosed(){this.closing=!0,this.connecting=!1}removeAllListeners(){window.removeEventListener("beforeunload",this.beforeUnload),this.emitter.removeAllListeners()}createWebSocket(p,_){return new WebSocket(p,_)}cleanupWebSocket(){this.socket&&(this.socket.close(),this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.socket.onopen=null,this.socket=void 0)}createError(p,_){return new StageClientError(Object.assign({action:iG.JOIN,traceId:this.traceId,token:this.token,location:"StageSocket.connection",tag:n1,details:_},p))}on(p,_){this.emitter.on(p,_)}off(p,_){this.emitter.off(p,_)}onMessage(p){this.logger.debug({msg:`${this.id}received message: ${p.data}`});try{let _=JSON.parse(p.data);switch(_.type){case"STAGE_STATE":case"aws:ivs:STAGE_STATE":{let p=_.payload.sequenceNumber;if(p>this.latestSequenceNumber){let Z=_.payload;0===this.latestSequenceNumber&&this.connectTimeoutId>0?(this.triggerSocketOpen(Z),window.setTimeout(()=>{this.emitter.emit(ik,Z)})):this.emitter.emit(ik,Z),this.latestSequenceNumber=p}break}case"PONG":window.clearTimeout(this.pongTimeoutId),this.pongTimeoutId=0,this.analyticsTracker.trackEventNoSharedProps(new EDPPongEvent({token:this.token,eventEndpoint:this.token.eventsURL,protocol:this.protocol,traceId:this.traceId,edpRttMs:performance.now()-this.latestPingTimestamp}));break;case"aws:ivs:SDP_ANSWER":this.emitter.emit(iw,_.payload);break;case"aws:ivs:DISCONNECT":this.emitter.emit(iN,_.payload);break;case"aws:ivs:REASSIGN":this.emitter.emit(iD,_.payload);break;case"aws:ivs:INCOMPATIBLE_CODECS":this.emitter.emit(iP,_.payload);break;case"aws:ivs:SSU":this.emitter.emit("ssu",_.payload);break;case"aws:ivs:SUBSCRIBER_COUNT":{let p=_.payload.sequenceNumber;p>this.latestSubscriberCountSequenceNumber&&(this.emitter.emit(iM,_.payload),this.latestSubscriberCountSequenceNumber=p);break}case"aws:ivs:EXCHANGE_TOKEN":this.emitter.emit(iL,_);break;case"aws:ivs:JOIN_ERROR":this.handleJoinError(_.payload);break;default:(0,tw.noop)()}}catch(p){this.logger.debug({msg:`onMessage JSON Parse error: ${p}`}),this.emitter.emit(iO,p)}}onError(p){this.logger.debug({msg:`${this.id}error: ${JSON.stringify(p)}`})}onClose(p){if(this.logger.debug({msg:`${this.id} onClose triggered with code (closing = ${this.closing}, connecting = ${this.connecting})`}),this.clearPingPongTracking(),this.closing)return void(this.closing=!1);if(this.windowUnloading)return;let _=`code: ${null==p?void 0:p.code}, reason: ${null==p?void 0:p.reason}, wasClean: ${null==p?void 0:p.wasClean}`;if(this.connecting){let p=this.createError(n5.EVENT_PLANE_WS_CLOSE_BEFORE_OPEN,_);return void this.handleSocketError(p)}this.logger.debug({msg:`${this.id}unexpected close`}),this.emitter.emit(iR,"unknown");let Z=this.createError(n5.EVENT_PLANE_WS_UNEXPECTED_CLOSE,_);this.trackJoinEnded(),this.emitter.emit(iA,Z)}onOpen(){this.logger.debug({msg:`${this.id} socket opened`}),this.clearConnectionAttemptTimeouts(),this.connectTimeoutId=window.setTimeout(this.triggerSocketOpen,12e3)}clearConnectionAttemptTimeouts(){window.clearTimeout(this.nextConnectionAttemptId),window.clearTimeout(this.connectTimeoutId),this.nextConnectionAttemptId=0,this.connectTimeoutId=0}clearConnectionAttempts(){this.connectionAttempts=0}connectTimedOut(){this.connecting=!1,this.logger.debug({msg:`${this.id} Connect timed out!`});let p=this.createError(n5.JOIN_TIMED_OUT);this.isSocketConnecting()&&this.trackJoinFailed(p,this.getRetryCount()),this.emitter.emit(iA,p),this.close()}clearPingPongTracking(){window.clearInterval(this.pingIntervalId),window.clearTimeout(this.pongTimeoutId),this.pingIntervalId=0,this.pongTimeoutId=0}handleJoinError(p){let _=ms(p),Z=this.createError(_,`JOIN_ERROR: ${p.code}`);this.logger.debug({msg:`${this.id} received JOIN_ERROR: ${JSON.stringify(p)}`}),this.handleSocketError(Z)}handleSocketError(p){let _=this.checkNonFatalRetriesLimit(p),Z=p;_.ok||((Z=_.error).details=`Timeout triggered by ${p.code}`),this.trackSocketError(Z),this.markSocketAsClosed(),this.clearPingPongTracking(),this.clearConnectionAttemptTimeouts(),this.cleanupWebSocket(),Z.fatal?(this.clearConnectionAttempts(),this.emitter.emit(iA,Z)):this.queueExponentialBackoffRetry()}queueExponentialBackoffRetry(){let p=1e3*Math.pow(2,this.connectionAttempts-1);p>32e3&&(p=32e3),this.logger.debug({msg:`${this.id} reconnecting in ${p/1e3} seconds`}),window.clearTimeout(this.nextConnectionAttemptId),this.nextConnectionAttemptId=window.setTimeout(this.attemptConnect,p)}isSocketConnecting(){return this.socket&&this.socket.readyState===this.socket.CONNECTING}isSocketOpen(){return this.socket&&this.socket.readyState===this.socket.OPEN}isStateMessageReceived(){return 0!==this.latestSequenceNumber}trackJoinStarted(p){this.analyticsTracker.trackEventNoSharedProps(new EDPConnectedEvent({token:this.token,eventEndpoint:this.token.eventsURL,numRetries:p,protocol:this.protocol,traceId:this.traceId}))}trackJoinAttempt(p){let{token:_,traceId:Z}=this;this.analyticsTracker.trackEvent(new JoinAttemptEvent({token:_,eventEndpoint:(null==_?void 0:_.eventsURL)||"",whipEndpoint:(null==_?void 0:_.whipURL)||"",traceId:Z}))}trackJoinFailed(p,_){let{token:Z,traceId:et,code:el,message:eu,fatal:ed,nominal:eh}=p;this.analyticsTracker.trackEvent(new JoinFailedEvent({token:Z,eventEndpoint:Z.eventsURL,whipEndpoint:Z.whipURL,traceId:et,code:el,message:eu,fatal:ed,nominal:eh,retryCnt:_}))}};let Nc=(p,_,Z,et)=>{let el=[],eu=[],ed=[],eh=[],ep=["isPublishing","id","audioMuted","userId","videoStopped"];return p.forEach(p=>{var Z;let et=_.find(_=>_.id===p.id);if(!et)return void eu.push(p);let el=ep.some(_=>et[_]!==p[_]),eh=((p,_)=>{let Z=null!=p?p:{},et=null!=_?_:{},el=new Set([...Object.keys(Z),...Object.keys(et)]),eu=!1;return el.forEach(p=>{et[p]!==Z[p]&&(eu=!0)}),eu})(p.attributes,et.attributes);(el||eh)&&ed.push(Object.assign(Object.assign({},et),{attributes:null!==(Z=et.attributes)&&void 0!==Z?Z:{}}))}),_.forEach(_=>{p.has(_.id)||el.push(_)}),Z.forEach(p=>{et.find(_=>_.id===p.id)||"KICKED"!==p.status||eh.push(p)}),{joined:el,left:eu,updated:ed,kicked:eh}},Dc=p=>{let _={sdpExchange:-1!==p.indexOf(od.SDP_EXCHANGE)},Z=p.find(p=>-1!==p.indexOf(od.JITTER_BUFFER_MIN_DELAY_MS));return void 0!==Z&&(_.jitterBufferMinDelayInMs=(p=>{let _=p.split("=")[1],Z=parseInt(_,10);if(!(isNaN(Z)||Z<0))return Z})(Z)),_},Pc=p=>{switch(p){case oM.PARTICIPANT_DISCONNECTED:return oN.PARTICIPANT_DISCONNECTED;case oM.STAGE_DELETED:return oN.STAGE_DELETED;case oM.TOKEN_REUSED:return oN.TOKEN_REUSED;case oM.MAX_CONCURRENT_CONNECTIONS:return oN.MAX_CONCURRENT_CONNECTIONS;default:return oN.UNKNOWN}},Mc=p=>{switch(p.code){case n5.PARTICIPANT_DISCONNECTED.code:return oN.PARTICIPANT_DISCONNECTED;case n5.STAGE_DELETED.code:return oN.STAGE_DELETED;case n5.EXPIRED_TOKEN.code:return oN.TOKEN_EXPIRED;default:return oN.UNKNOWN}};var Lc=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let StageConnection=class StageConnection extends TypedEmitter{constructor(p){super(),this.participants=new Map,this.disconnected=[],this.isInitialGroupState=!0,this.state={value:oP.DISCONNECTED,context:{connectStartTime:0,hasConnected:!1}},this.features={sdpExchange:!1},this.stats=this.resetStats(),this.stageMinutesLogged=0,this.isStagePublishing=!1,this.isTokenExchangeInFlight=!1,this.onConnecting=(p,_)=>{this.logger.debug({msg:"onConnecting",context:p,event:_}),p.connectStartTime=performance.now();let Z="RECONNECT"===_.type;Z&&this.stageSocket.close();let{eventsURL:et}=this.token;
6this.emit(iu,oP.CONNECTING),this.state.value=oP.CONNECTING,this.stageSocket.connect(et,this.traceId,!Z)},this.onConnected=(p,_)=>{this.logger.debug({msg:"onConnected",context:p,event:_}),p.hasConnected=!0,this.emit(n9),this.emit(iu,oP.CONNECTED),this.state.value=oP.CONNECTED},this.onDisconnected=(p,_)=>{this.logger.debug({msg:"onDisconnected",context:p}),this.state.value=oP.DISCONNECTED,this.stopStageMinuteLoggedInterval(!0),this.stageSocket.close(),p.hasConnected=!1,this.participants=new Map,this.disconnected=[],this.stageSocket.removeAllListeners(),this.resetStats(),this.emit(iu,oP.DISCONNECTED,_)},this.onErrored=(p,_)=>{var Z;this.logger.error({msg:"Connection failure occurred",err:_.payload.error}),this.emit(iu,oP.ERRORED),this.emit(id,_.payload.error),this.state.value=oP.ERRORED;let et=_.payload.error;if(et instanceof StageClientError&&et.fatal&&(null===(Z=et.details)||void 0===Z?void 0:Z.includes("JOIN_ERROR"))&&p.hasConnected){let p=Mc(et);this.processStateUpdate({type:"DISCONNECT",reason:p})}else p.hasConnected?this.processStateUpdate({type:"RECONNECT"}):this.stageSocket.close()},this.processStateUpdate=p=>{let _=this.state.value,Z=this.state.context;switch(_){case oP.DISCONNECTED:"CONNECT"===p.type&&this.onConnecting(Z,p);break;case oP.CONNECTING:"RECONNECT"===p.type?this.onConnecting(Z,p):"DISCONNECT"===p.type?this.onDisconnected(Z,p.reason):"CONNECT_SUCCESS"===p.type?this.onConnected(Z,p):"ERROR"===p.type&&this.onErrored(Z,p);break;case oP.CONNECTED:"RECONNECT"===p.type?this.onConnecting(Z,p):"DISCONNECT"===p.type?this.onDisconnected(Z,p.reason):"ERROR"===p.type&&this.onErrored(Z,p);break;case oP.ERRORED:"RECONNECT"===p.type?this.onConnecting(Z,p):"DISCONNECT"===p.type&&this.onDisconnected(Z,p.reason)}},this.measureConnect=(p,_)=>{let Z=this.stats.edpConnectCount,et=performance.now(),el=et-_;return Object.assign(this.stats,{edpConnectCount:Z+1,edpConnectDuration:el}),0===Z&&Object.assign(this.stats,{edpInitialStartConnectTime:_,edpInitialFinishConnectTime:et,edpInitialConnectDuration:el,edpInitialConnectRetries:p}),this.stats},this.measureStateUpdate=p=>{let{edpInitialFinishConnectTime:_}=this.stats,Z=this.stats.edpStateUpdateCount;return Object.assign(this.stats,{edpStateUpdateCount:Z+1}),0===Z&&Object.assign(this.stats,{edpInitialStateDuration:performance.now()-_,edpInitialStatePublishingCount:p}),this.stats},this.trackMessageParseError=p=>{this.logger.error({msg:"Message Parse Error occurred",err:p.err});let _=new StageClientError({token:p.token,traceId:p.traceId,code:n5.WEBSOCKET_MESSAGE_PARSE_FAILURE.code,tag:p.tag,location:p.location,message:p.message,details:p.err.message});this.analyticsTracker.trackEvent(new StageErrorEvent(_))},this.trackStageSocketMessageParseError=(p,_,Z)=>{this.trackMessageParseError({token:p,traceId:_,tag:n1,location:"StageConnection.onMessage",message:n5.WEBSOCKET_MESSAGE_PARSE_FAILURE.message,err:Z})},this.trackStageStateMessageParseError=(p,_,Z,et)=>{this.trackMessageParseError({token:p,traceId:_,tag:n1,location:"StageConnection.onStageStateMessage",message:et,err:Z})},this.onDisconnectMessage=p=>{this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,this.traceId,`DISCONNECT message received: ${p.code}:${p.reason}`,iG.JOIN));let _=Pc(p.code);p.code===oM.TOKEN_REUSED&&this.stageConfig.signaling.disableTokenReuseMessage?console.warn("Token reuse is detected, but skipping as feature is disabled"):(console.warn(`Disconnecting client due to: ${p.reason}`),this.processStateUpdate({type:"DISCONNECT",reason:_}))},this.onReassignmentMessage=p=>{this.emit(ih,p)},this.onIncompatibleCodecsMessage=p=>{this.emit(ip,p)},this.onSsuMessage=p=>{var _;let Z=window.atob(null!==(_=p.A)&&void 0!==_?_:"").trim();Z&&Z.startsWith("http")?nR.currentEndpoint=Z:this.logger.warn({msg:"SSU Url invalid"})},this.onSubscriberCountMessage=p=>{this.emit(ig,p)},this.onStageStateMessage=(p,_,Z)=>{var et,el;this.logger.debug({msg:"State Stage Message occurred",state:Z});let eu=null!==(et=Z.participants)&&void 0!==et?et:[],ed=null!==(el=Z.disconnected)&&void 0!==el?el:[];this.measureStateUpdate(eu.length),this.enableFeaturesBasedOnServerFeatures(Z.serverFeatures||[]);let a=(Z,et)=>{this.analyticsTracker.trackEventNoSharedProps(new StateUpdatedEvent({token:p,otherParticipantId:Z.id,otherParticipantUserId:Z.userId,isAudioMuted:Z.audioMuted,isVideoStopped:Z.videoStopped,isPublishing:Z.isPublishing,isDisconnected:et,traceId:_}))},eh=Nc(this.participants,eu,ed,this.disconnected);eh.left.forEach(p=>
6{this.participants.delete(p.id),a(p,!0),this.emit(n8,p)}),eh.updated.forEach(p=>{this.participants.set(p.id,p),a(p,!1),this.emit(is,p)}),eh.joined.forEach(p=>{this.participants.set(p.id,p),a(p,!1),this.emit(n6,p,this.isInitialGroupState)}),eh.kicked.forEach(p=>{this.emit(n7,p)}),this.disconnected=ed,this.isInitialGroupState=!1},this.token=p.token,this.nonScopedLogger=p.logger,this.analyticsTracker=p.analyticsTracker,this.stageConfig=p.stageConfig,this.logger=new ScopedLogger(p.logger,e0.CONNECTION),this.stageSocket=new StageSocket({token:p.token,logger:p.logger,analyticsTracker:p.analyticsTracker,socketConfig:p.stageConfig.connections.socket,signalingConfig:p.stageConfig.signaling}),this.traceId=ns()}resetStats(){return this.isInitialGroupState=!0,this.stats={isConnected:!1,edpInitialStartConnectTime:0,edpInitialFinishConnectTime:0,edpConnectCount:0,edpInitialConnectDuration:0,edpConnectDuration:0,edpInitialStateDuration:0,edpInitialStatePublishingCount:0,edpStateUpdateCount:0,edpInitialConnectRetries:0},this.stats}connect(p){return Lc(this,void 0,void 0,function*(){return this.logger.debug({msg:"
6connect invoked",token:this.token,traceId:p}),this.traceId=p,this.state.value!==oP.DISCONNECTED&&(this.logger.debug({msg:"Disconnecting previous connection"}),this.processStateUpdate({type:"DISCONNECT",reason:oN.CLIENT_RECONNECT})),new Promise((_,Z)=>{this.stageSocket.on(iI,p=>{var Z;let{retryCnt:et,initialStageState:el}=p;el&&this.enableFeaturesBasedOnServerFeatures(null!==(Z=el.serverFeatures)&&void 0!==Z?Z:[]),this.traceId=p.traceId||ns(),this.measureConnect(et,this.state.context.connectStartTime),this.processStateUpdate({type:"CONNECT_SUCCESS"}),this.startStageMinuteLoggedInterval(this.token,this.traceId),_(this.traceId)}),this.stageSocket.on(iA,p=>{Z(p),this.processStateUpdate({type:"ERROR",payload:{error:p}})}),this.stageSocket.on(ik,p=>this.onStageStateMessage(this.token,this.traceId,p)),this.stageSocket.on(iO,p=>this.trackStageSocketMessageParseError(this.token,this.traceId,p)),this.stageSocket.on(iN,this.onDisconnectMessage),this.stageSocket.on(iD,this.onReassignmentMessage),this.stageSocket.on(iP,this.onIncompatibleCodecsMessage),this.stageSocket.on("ssu",this.onSsuMessage),this.stageSocket.on(iM,this.onSubscriberCountMessage),this.stageSocket.on(iR,p=>{this.stopStageMinuteLoggedInterval()}),this.processStateUpdate({type:"CONNECT",payload:{token:this.token,traceId:p}})})})}disconnect(){return this.logger.debug({msg:"disconnect invoked"}),this.processStateUpdate({type:"DISCONNECT",reason:oN.USER_INITIATED}),this.traceId}getParticipant(p){return this.participants.get(p)}listAvailableParticipants(){return Array.from(this.participants.values())}emitStageState(p,_){this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,this.traceId,`ws send SET_STATE: audioMuted=${p}, videoStopped=${_}`,iG.JOIN)),this.stageSocket.send({audioMuted:p,type:"SET_STATE",version:"0",videoStopped:_})}setStagePublishing(p){this.isStagePublishing=p,this.emit(il,this.isStagePublishing)}getIsStagePublishing(){return this.isStagePublishing}startStageMinuteLoggedInterval(p,_){this.uploadStageMinutesBroadcastInterval||(this.analyticsTracker.trackEvent(new MinuteEvent(p,_,this.stageMinutesLogged,this.isStagePublishing,0)),this.stageMinutesLogged++,this.uploadStageMinutesBroadcastInterval=setInterval(()=>{this.analyticsTracker.trackEvent(new MinuteEvent(p,null!=_?_:ns(),this.stageMinutesLogged,this.isStagePublishing,0)),this.stageMinutesLogged++},6e4))}stopStageMinuteLoggedInterval(p=!1){this.uploadStageMinutesBroadcastInterval&&(clearInterval(this.uploadStageMinutesBroadcastInterval),this.uploadStageMinutesBroadcastInterval=void 0),p&&(this.stageMinutesLogged=0)}enableFeaturesBasedOnServerFeatures(p){let _=Dc(p);this.features.sdpExchange!==_.sdpExchange&&this.logger.debug({msg:`XDP SDP exchange feature toggled: ${_.sdpExchange}`});let Z=p.find(p=>-1!==p.indexOf(od.JITTER_BUFFER_MIN_DELAY_MS));void 0!==Z&&void 0===_.jitterBufferMinDelayInMs&&this.trackStageStateMessageParseError(this.token,this.traceId,Error("Unable to parse jitter buffer value"),`Could not parse "${Z}" from the Eevee server features list`),void 0!==_.jitterBufferMinDelayInMs&&this.features.jitterBufferMinDelayInMs!==_.jitterBufferMinDelayInMs?this.logger.debug({msg:`jitterBufferMinDelay feature updated to: ${_.jitterBufferMinDelayInMs}`}):void 0===_.jitterBufferMinDelayInMs&&void 0!==this.features.jitterBufferMinDelayInMs&&this.logger.debug({msg:"jitterBufferMinDelay feature updated to: undefined"}),this.features=_}isConnected(){return this.state.value===oP.CONNECTED}supportsSdpExchange(){return this.features.sdpExchange}jitterBufferMinDelayInMs(){return this.features.jitterBufferMinDelayInMs}getConnectionStats(){return Object.assign({},this.stats,{isConnected:this.isConnected()})}exchangeSdp(p){return Lc(this,void 0,void 0,function*(){return this.isConnected()?new Promise((_,Z)=>{var et;let el=window.setTimeout(()=>{o(),Z(oD.TIMEDOUT)},12e3),o=()=>{window.clearTimeout(el),this.stageSocket.off(iw,s),this.stageSocket.off(iA,a)},s=Z=>{Z.requestId===p.requestUUID&&(o(),_(Z))},a=()=>{o(),Z(oD.CONNECTION_LOST)};null===(et=p.signal)||void 0===et||et.addEventListener("abort",()=>{o(),Z(oD.ABORTED)}),this.stageSocket.on(iw,s),this.stageSocket.on(iA,a),this.stageSocket.sendSdpOffer(p.sdpOffer,p.url,p.traceId,p.requestUUID,p.forceNo
6de,p.forceCluster,p.assignmentToken,p.multiCodec,p.initialLayerPreference)}):Promise.reject(oD.NOT_CONNECTED)})}exchangeToken(p,_,Z,et){return Lc(this,void 0,void 0,function*(){this.isTokenExchangeInFlight=!0;try{return yield new Promise((el,eu)=>{let s=(p,_)=>new StageClientError(Object.assign(Object.assign({action:iG.EXCHANGE_TOKEN,token:this.token,traceId:et,tag:n4,location:"StageConnection.exchangeToken"},p),{details:_})),ed=window.setTimeout(()=>{c(),eu(s(n5.EXCHANGE_TOKEN_TIMEOUT))},5e3),c=()=>{window.clearTimeout(ed),this.stageSocket.off(iL,u),this.stageSocket.off(iA,l)},u=p=>{if(!this.validateExchangeTokenMessage(p))return c(),void eu(s(n5.EXCHANGE_TOKEN_FAILED_INVALID));if(p.payload.requestId===Z){if(c(),p.payload.error)return void eu(s(n5.EXCHANGE_TOKEN_FAILED,p.payload.error.message));el()}},l=p=>{c(),eu(s(n5.EXCHANGE_TOKEN_FAILED,p.message))};this.stageSocket.on(iL,u),this.stageSocket.on(iA,l),this.stageSocket.sendExchangeToken({oldToken:p,newToken:_,requestId:Z,traceId:et})})}finally{this.isTokenExchangeInFlight=!1}})}validateExchangeTokenMessage(p){return(null==p?void 0:p.payload)&&"string"==typeof p.payload.requestId&&"string"==typeof p.payload.traceId}getIsTokenExchangeInFlight(){return this.isTokenExchangeInFlight}};(oX=o1||(o1={})).DISCONNECTED="disconnected",oX.CONNECTING="connecting",oX.CONNECTED="connected",oX.ERROR="error",(oY=o2||(o2={})).CONNECT="CONNECT",oY.CONNECTED="CONNECTED",oY.ERROR="ERROR",oY.DISCONNECT="DISCONNECT";let o$={[o2.CONNECT]:{from:"*",to:o1.CONNECTING},[o2.CONNECTED]:{from:[o1.CONNECTING],to:o1.CONNECTED},[o2.ERROR]:{from:[o1.CONNECTING,o1.CONNECTED],to:o1.ERROR},[o2.DISCONNECT]:{from:"*",to:o1.DISCONNECTED}};(oQ=o3||(o3={})).TIMEOUT="timeout",oQ.CANCELED="canceled",oQ.SOCKET_CLOSED="socket_closed",(oZ=o4||(o4={})).STALE_SEQUENCE="stale_sequence",oZ.NO_PENDING_PINGS="no_pending_pings",oZ.NO_REQUEST_ID="no_request_id",oZ.UNKNOWN_REQUEST="unknown_request";let Vc=p=>{if(null==p)return tm.err("absent");let _="string"==typeof p?parseInt(p,10):p;return"number"!=typeof _||isNaN(_)?tm.err("invalid"):tm.ok(_)},Gc=(p,_)=>{let Z={},et={},el=new TypedEmitter,o=p=>{let _=((p,_)=>{if(!p.cancelOnNewRequest)return[];let Z="function"==typeof p.cancelOnNewRequest?p.cancelOnNewRequest:()=>!0;return Object.keys(_).filter(et=>_[et].config.messageType===p.messageType&&Z(_[et].config))})(p,Z);_.forEach(p=>{Z[p].cancel()})},s=p=>{el.emit("received",{requestId:p.requestId,messageType:p.config.messageType,retries:p.retries,durationMs:p.lastRequestDurationMs,status:"OK"})},a=p=>{var _;let et=Object.keys(_=Z).filter(p=>"PING"===_[p].config.messageType);if(!et.length)return tm.err(o4.NO_PENDING_PINGS);let el=Z[et[et.length-1]];return et.forEach(_=>{Z[_].receive(p)}),tm.ok({retry:!1,request:el})},c=(et,eu)=>{let ed=eu.requestId;if(!ed)return _.debug(`[${et}] no requestId for correlateResponseByRequestId`),tm.err(o4.NO_REQUEST_ID);let eh=Z[ed];if(!eh)return _.debug(`[${et}][${ed}] unknown request for correlateResponseByRequestId`),tm.err(o4.UNKNOWN_REQUEST);let ep=eh.config.responseType;ep!==et&&el.emit("mismatch",ep,et,ed);let ef=eu.error;if(ef){let Z=ef.fatal?0:((p,_)=>{var Z;let et=null===(Z=p.details)||void 0===Z?void 0:Z.retryAfterMs;return"number"!=typeof et?_.fallbackRequestRetryDelayMs:Math.min(Math.max(et,_.minRequestRetryDelayMs),_.maxRequestRetryDelayMs)})(ef,p);return el.emit("errored",{requestId:eh.requestId,messageType:eh.config.messageType,error:ef,durationMs:eh.lastRequestDurationMs,retries:eh.retries,retryAfterMs:Z}),ef.fatal?(eh.receive(eu),s(eh),tm.ok({retry:!1,request:eh})):(eh.reset(),_.info(`[${eh.config.messageType}][${eh.requestId}] retrying non-fatal error after ${Z}ms`),tm.ok({retry:!0,request:eh,retryAfterMs:Z}))}return eh.receive(eu),s(eh),_.debug(`[${eh.config.messageType}][${eh.requestId}] correlateResponseByRequestId is resolved`),tm.ok({retry:!1,request:eh})};return{events:el,create:(p,et)=>{o(p);let eu=((p,_)=>{let Z=ts().value,et,el="idle",eu=-1,ed=0,eh=0,ep=0,ef=new TypedEmitter;return{message:{type:p.messageType,payload:Object.assign(Object.assign({},p.payload),{requestId:Z,traceId:_})},config:p,requestId:Z,traceId:_,events:ef,get retries(){return eu},get state(){return el},get sentAt(){return ed},get receivedAt(){return eh},get lastRequestDurationMs(){return ep},send:()=>{null==et||et.cancel(),eu++,el="running",ed=performance.now(),(et=(0,tm.delay)(p.timeoutMs)).fold(()=>{"running"===el&&(el="timed_out",ef.emit("timedOut"),ef.emit("deferred"))},Zt),et.run(),ef.emit("sent")},receive:p=>{"running"===el&&(null==et||et.cancel(),el="resolved",ep=(eh=performance.now())-ed,ef.emit("received",p),ef.emit("deferred"))},cancel:()=>{"resolved"!==el&&"cancelled"!==el&&(null==et||et.cancel(),el="cancelled",ef.emit("cancelled"),ef.emit("deferred"))},reset:()=>{null==et||et.cancel(),el="idle"}}})(p,et),a=()=>`[${p.messageType}][${eu.requestId}]`,c=()=>`| state=${eu.state}`+(eu.retries>-1?` retries=${eu.retries}`:"")+(eu.lastRequestDurationMs>0?` reqDuration=${Math.round(100*eu.lastRequestDurationMs)/100}ms`:"");return _.debug(`${a()} created ${c()}`),eu.events.on("sent",()=>{var p,Z;_.debug(`${a()} sent ${c()}`),el.emit("sent",{requestId:eu.requestId,messageType:eu.config.messageType,retries:eu.retries,url:null!==(Z=null===(p=null==eu?void 0:eu.config.payload)||void 0===p?void 0:p.whipUrl)&&void 0!==Z?Z:"",action:eu.config.action})}),eu.events.on("received",()=>{_.debug(`${a()} received ${c()}`)}),eu.events.on("deferred",()=>{_.debug(`${a()} cleaned up ${c()}`),delete Z[eu.requestId]}),Z[eu.requestId]=eu,eu},handleResponse:(p,_)=>{var Z;let el=Vc(_.sequenceNumber);return!el.ok||el.value>(null!==(Z=et[p])&&void 0!==Z?Z:-1)?(el.ok&&(et[p]=el.value),"PONG"===p?a(_):c(p,_)):tm.err(o4.STALE_SEQUENCE)},cancelAll:()=>
6{Object.keys(Z).forEach(p=>{Z[p].cancel()}),Z={}},resetAll:()=>{Object.keys(Z).forEach(p=>{Z[p].config.persistAcrossReconnects?Z[p].reset():Z[p].cancel()}),et={}},filterPersistentIdleRequests:()=>{var p;return Object.keys(p=Z).filter(_=>"idle"===p[_].state&&p[_].config.persistAcrossReconnects).map(_=>p[_])},activeCount:()=>Object.keys(Z).length}},qc=p=>{try{let _=JSON.parse(p);return tm.ok(_)}catch(p){return tm.err(p instanceof Error?p:Error(String(p)))}},Wc=p=>p&&"code"in p?`code: ${p.code}, reason: ${p.reason}, wasClean: ${p.wasClean}`:"code: unknown",$c=p=>{let{addr:_,token:Z,traceId:et,config:el}=p,o=p=>new StageClientError(Object.assign({action:iG.JOIN,traceId:et,token:Z,location:"StageSocketV2",tag:n1},p));return tm.LiveTask.create(eu=>{var ed,eh,ep,ef;return ed=void 0,eh=void 0,ep=void 0,ef=function*(){let ed;let eh=((p,_,Z)=>{let et=encodeURIComponent(Z);return`${p}?error_over_ws=1&topic=${_.topic}/publishers&traceid=${et}`})(_,Z,et.value);try{ed=new WebSocket(eh,Z.rawToken)}catch(Z){let p=Z instanceof Error?Z.message:void 0,_=o(n5.EVENT_PLANE_WS_CREATE_FAILED);throw p&&(_.details=p),_}let ep=0,ef=0,d=()=>{window.clearTimeout(ep),window.clearTimeout(ef),ep=0,ef=0};return eu.defer(()=>{d(),ed.onopen=null,ed.onmessage=null,ed.onerror=null,ed.onclose=null,ed.close()}),new Promise((_,Z)=>{p.waitForOpenIndefinitely||(d(),ep=window.setTimeout(()=>{Z(o(n5.JOIN_TIMED_OUT))},el.connectTimeoutMs)),ed.onopen=()=>{d(),d(),ef=window.setTimeout(()=>{_({ws:ed})},el.connectTimeoutMs)},ed.onmessage=p=>{let et=qc(p.data);if(!et.ok)return;let eu=et.value;if("aws:ivs:JOIN_ERROR"===eu.type)return d(),void Z(o(ms(eu.payload)));let eh=Kc(eu);if(eh){if(el.openWithoutState)return d(),void _({ws:ed,message:eh});if("STAGE_STATE"===eh.type){if(eh.payload.sequenceNumber<=0)return;d(),_({ws:ed,message:eh})}}},ed.onclose=p=>{d();let _=o(n5.EVENT_PLANE_WS_CLOSE_BEFORE_OPEN);_.details=Wc(p),Z(_)}})},new(ep||(ep=Promise))(function(p,_){function s(p){try{c(ef.next(p))}catch(p){_(p)}}function a(p){try{c(ef.throw(p))}catch(p){_(p)}}function c(_){var Z;_.done?p(_.value):((Z=_.value)instanceof ep?Z:new ep(function(p){p(Z)})).then(s,a)}c((ef=ef.apply(ed,eh||[])).next())})})},Kc=p=>{var _;switch(p.type){case"aws:ivs:STAGE_STATE":case"STAGE_STATE":{let Z=Vc(null===(_=p.payload)||void 0===_?void 0:_.sequenceNumber),et=p.payload;return et.sequenceNumber=Z.ok?Z.value:0,{type:"STAGE_STATE",payload:et}}case"aws:ivs:DISCONNECT":return{type:"DISCONNECT",payload:p.payload};case"aws:ivs:REASSIGN":return{type:"REASSIGNMENT",payload:p.payload};case"aws:ivs:INCOMPATIBLE_CODECS":return{type:"INCOMPATIBLE_CODECS",payload:p.payload};case"aws:ivs:SSU":return{type:"SSU",payload:p.payload};case"aws:ivs:SUBSCRIBER_COUNT":return{type:"SUBSCRIBER_COUNT",payload:p.payload};default:return}};let ServerResponseEvent=class ServerResponseEvent extends StageAnalyticsEvent{constructor(p){super(tg.SERVER_RESPONSE,p.token,p.traceId,!0),Object.assign(this.properties,{request_id:p.requestId,transport:p.transport,http_method:p.httpMethod,url:p.url,duration_ms:p.durationMs,status:p.status,retry_count:p.retryCount,retry_duration_ms:p.retryDurationMs})}};let StageSocketV2=class StageSocketV2 extends TypedEmitter{constructor(p){super(),this.connectionAttempts=0,this.protocol="",this.addr="",this.beforeUnload=()=>{this.emit("closed","beforeunload")},this.onUnexpectedClose=p=>{let _=this.createError(n5.EVENT_PLANE_WS_UNEXPECTED_CLOSE);_.details=Wc(p),this.dispatch(o2.ERROR,{error:_})},this.onMessage=p=>{var _;let Z=qc(p.data);if(!Z.ok)return void this.tracker.trackParseError(this.traceId,Z.error);let et=this.requestManager.handleResponse(Z.value.type,null!==(_=Z.value.payload)&&void 0!==_?_:{});if(et.ok){let p=et.value;return void(p.retry&&this.scheduleRequest(p.request,p.retryAfterMs))}let el=Kc(Z.value);el&&this.emit("message",el)},this.token=p.token,this.config=p.stageConfig.connections.socket,this.traceId=ns();let{categories:_,levels:Z}=p.stageConfig.logging;this.logger=(0,tm.createLogger)({name:"StageSocketV2",category:"signaling.connection.socket",enabled:!0,categories:_,levels:Z});let et=(0,tm.createLogger)({name:"SocketRequestManager",category:"signaling.connection.socket.requests",enabled:!0,categories:_,levels:Z});this.tracker=(p=>{let{analyticsTracker:_,token:Z}=p;return{trackJoinAttempt:p=>{_.trackEvent(new JoinAttemptEvent({token:Z,eventEndpoint:Z.eventsURL,whipEndpoint:Z.whipURL,traceId:p}))},trackJoinStarted:(p,et,el)=>{_.trackEventNoSharedProps(new EDPConnectedEvent({token:Z,eventEndpoint:Z.eventsURL,numRetries:p,protocol:el,traceId:et}))},trackJoinFailed:(p,et)=>{let{traceId:el,code:eu,message:ed,fatal:eh,nominal:ep}=p;_.trackEvent(new JoinFailedEvent({token:Z,eventEndpoint:Z.eventsURL,whipEndpoint:Z.whipURL,traceId:el,code:eu,message:ed,fatal:eh,nominal:ep,retryCnt:et}))},trackJoinEnded:(p,et)=>{_.trackEventNoSharedProps(new EDPDisconnectedEvent({token:Z,eventEndpoint:Z.eventsURL,traceId:p,protocol:et}))},trackPongRtt:(p,et,el)=>{_.trackEventNoSharedProps(new EDPPongEvent({token:Z,eventEndpoint:Z.eventsURL,protocol:et,traceId:p,edpRttMs:el}))},trackError:p=>{_.trackError(p)},trackParseError:(p,et)=>{_.trackEventNoSharedProps(new TraceEvent(Z,p,`onMessage JSON parse error: ${et.message}`,iG.JOIN))},trackResponseMismatch:(p,et,el,eu)=>{_.trackEventNoSharedProps(new TraceEvent(Z,p,`response type mismatch: expected=${et} got=${el} requestId=${eu}`,iG.JOIN))},trackServerRequest:(p,et,el,eu,ed,eh)=>{var ep;let ef=null!==(ep=ed.split("/").pop())&&void 0!==ep?ep:"";_.trackEventNoSharedProps(new ServerRequestEvent(null!=eh?eh:iG.JOIN,Z,el,"edp",et,ef,p,"edp",eu))},trackServerResponse:(p,et,el,eu,ed,eh,ep)=>{_.trackEventNoSharedProps(new ServerResponseEvent({token:Z,traceId:p,requestId:et,transport:"edp",httpMethod:"edp",url:el,durationMs:eu,status:ed,retryCount:eh,retryDurationMs:ep}))}}})({analyticsTracker:p.analyticsTracker,token:this.token}),this.requestManager=Gc(this.config,et),this.requestManager.events.on("mismatch",(p,_,Z)=>{this.logger.warn("response type mismatch",`expected=${p}`,`got=${_}`,Z),this.tracker.trackResponseMismatch(this.traceId,p,_,Z)}),this.requestManager.events.on("sent",p=>
6{"PING"!==p.messageType&&this.tracker.trackServerRequest(this.traceId,p.requestId,p.messageType,p.retries,p.url,p.action)}),this.requestManager.events.on("received",p=>{"PING"!==p.messageType&&this.tracker.trackServerResponse(this.traceId,p.requestId,p.messageType,p.durationMs,p.status,p.retries)}),this.requestManager.events.on("errored",p=>{"PING"!==p.messageType&&this.tracker.trackServerResponse(this.traceId,p.requestId,p.messageType,p.durationMs,p.error.fatal?"ERROR":p.error.type,p.retries,p.retryAfterMs)}),this.fsm=(0,tm.createFsm)({initialState:o1.DISCONNECTED,transitions:o$,callbacks:{onStateChanged:(p,_,Z)=>{this.handleStateTransition(p,_,Z)}}})}handleStateTransition(p,_,Z){switch(this.logger.info(`[handleStateTransition] ${p} -> ${_}`),p===o1.CONNECTED&&this.stopPingPong(),_!==o1.ERROR&&_!==o1.DISCONNECTED||this.resetForNextAttempt(),_){case o1.CONNECTING:return this.tracker.trackJoinAttempt(this.traceId),void this.attemptConnect(null==Z?void 0:Z.waitForOpenIndefinitely);case o1.CONNECTED:return void((null==Z?void 0:Z.connected)?(this.tracker.trackJoinStarted(this.getRetryCount(),this.traceId,this.protocol),this.onConnected(Z.connected),this.startPingPong()):this.logger.warn("CONNECTED without connect result in context"));case o1.ERROR:return void((null==Z?void 0:Z.error)?this.onError(p,Z.error):this.logger.warn("ERROR without error in context"));case o1.DISCONNECTED:if(p===o1.CONNECTED)this.tracker.trackJoinEnded(this.traceId,this.protocol);else if(p===o1.CONNECTING){let p=this.createError(n5.OPERATION_ABORTED);this.tracker.trackJoinFailed(p,this.getRetryCount())}return;default:Vt(_)}}attemptConnect(p=!1){var _;null===(_=this.websocketTask)||void 0===_||_.cancel(),this.connectionAttempts++,this.logger.debug(`attemptConnect #${this.connectionAttempts}`,this.addr),this.websocketTask=$c({addr:this.addr,token:this.token,traceId:this.traceId,config:this.config,waitForOpenIndefinitely:p}),this.websocketTask.use(p=>{this.dispatch(o2.CONNECTED,{connected:p})}),this.websocketTask.onFailed(p=>{this.dispatch(o2.ERROR,{error:p})}),this.websocketTask.run()}onConnected({ws:p,message:_}){var Z;this.wireSocketListeners(p);let et="STAGE_STATE"===(null==_?void 0:_.type)&&null!==(Z=_.payload.serverFeatures)&&void 0!==Z?Z:[];this.emit("connected",{retryCnt:this.getRetryCount(),traceId:this.traceId,serverFeatures:et}),this.resendPersistedRequests(),void 0!==_&&("STAGE_STATE"!==_.type?this.emit("message",_):setTimeout(()=>{this.emit("message",_)}))}wireSocketListeners(p){var _;p.onmessage=this.onMessage,p.onclose=this.onUnexpectedClose,this.protocol=null!==(_=p.protocol)&&void 0!==_?_:"",window.addEventListener("beforeunload",this.beforeUnload)}resendPersistedRequests(){this.requestManager.filterPersistentIdleRequests().forEach(p=>{this.dispatchRequest(p)})}onError(p,_){if(this.logger.warn("onError",_.code,_.message,`fatal=${_.fatal}`),p!==o1.CONNECTING)return this.tracker.trackError(_),this.tracker.trackJoinEnded(this.traceId,this.protocol),this.connectionAttempts=0,void this.emit("errored",_);let Z=((p,_,Z)=>
6{if(p.fatal||_<=Z)return p;let et=new StageClientError(Object.assign({token:p.token,traceId:p.traceId,action:iG.JOIN,location:"StageSocketV2",tag:n1},n5.JOIN_TIMED_OUT));return et.details=`Timeout triggered by ${p.code}`,et})(_,this.connectionAttempts,this.config.maxConnectRetries);(this.tracker.trackJoinFailed(Z,this.getRetryCount()),this.tracker.trackError(Z),Z.fatal)?(this.connectionAttempts=0,this.emit("errored",Z)):this.scheduleConnect(Math.min(1e3*Math.pow(2,this.connectionAttempts-1),this.config.maxConnectRetryDelayMs))}resetForNextAttempt(){var p;null===(p=this.websocketTask)||void 0===p||p.cancel(),this.requestManager.resetAll(),window.removeEventListener("beforeunload",this.beforeUnload)}scheduleConnect(p){this.logger.warn(`reconnecting in ${p/1e3} seconds`),setTimeout(()=>{this.traceId=ns(),this.dispatch(o2.CONNECT)},p)}createError(p){return new StageClientError(Object.assign({action:iG.JOIN,traceId:this.traceId,token:this.token,location:"StageSocketV2",tag:n1},p))}dispatch(p,_){let Z=this.fsm.transition(p,_);Z.ok||this.logger.warn("dispatch rejected",p,Z.error.message)}dispatchRequest(p){var _;null===(_=this.websocketTask)||void 0===_||_.use(({ws:_})=>{p.send();try{_.send(JSON.stringify(p.message))}catch(p){this.logger.warn("ws.send failed",p instanceof Error?p.message:String(p))}})}scheduleRequest(p,_){setTimeout(()=>{this.dispatchRequest(p)},_)}startPingPong(){this.pingIntervalId=setInterval(()=>{let p=performance.now(),_=this.sendRequest({messageType:"PING",responseType:"PONG",payload:{},timeoutMs:this.config.pongTimeoutMs,persistAcrossReconnects:!1,cancelOnNewRequest:!1},this.traceId.value);_.events.on("received",()=>{this.tracker.trackPongRtt(this.traceId,this.protocol,performance.now()-p)}),_.events.on("timedOut",()=>{this.dispatch(o2.ERROR,{error:this.createError(n5.EVENT_PLANE_PONG_TIMEOUT)})})},this.config.pingIntervalMs)}stopPingPong(){void 0!==this.pingIntervalId&&(clearInterval(this.pingIntervalId),this.pingIntervalId=void 0)}getRetryCount(){return Math.max(this.connectionAttempts-1,0)}connect(p,_,Z=!1){this.logger.info("[connect]",p),this.addr=p,this.traceId=_,this.connectionAttempts=0,this.dispatch(o2.CONNECT,{waitForOpenIndefinitely:Z})}disconnect(){this.logger.info("[disconnect]"),this.requestManager.cancelAll(),this.dispatch(o2.DISCONNECT)}sendRequest(p,_){this.logger.debug("[sendRequest] ",p.messageType);let Z=this.requestManager.create(p,_);return this.dispatchRequest(Z),Z}};(o0=o5||(o5={})).CONNECT="CONNECT",o0.CONNECTED="CONNECTED",o0.RECONNECT="RECONNECT",o0.ERROR="ERROR",o0.DISCONNECT="DISCONNECT";let oK={[o5.CONNECT]:{from:[oP.DISCONNECTED],to:oP.CONNECTING},[o5.CONNECTED]:{from:[oP.CONNECTING],to:oP.CONNECTED},[o5.RECONNECT]:{from:[oP.CONNECTING,oP.CONNECTED,oP.ERRORED],to:oP.CONNECTING},[o5.ERROR]:{from:[oP.CONNECTING,oP.CONNECTED],to:oP.ERRORED},[o5.DISCONNECT]:{from:[oP.CONNECTING,oP.CONNECTED,oP.ERRORED],to:oP.DISCONNECTED}};var oz,oJ,oX,oY,oQ,oZ,o0,o1,o2,o3,o4,o5,o9,o6,Qc=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let StageConnectionV2=class StageConnectionV2 extends TypedEmitter{constructor(p){super(),this.participants=new Map,this.disconnected=[],this.isInitialGroupState=!0,this.features={sdpExchange:!1},this.tokenExchangeInFlight=!1,this.token=p.token,this.analyticsTracker=p.analyticsTracker,this.stageConfig=p.stageConfig;let{categories:_,levels:Z}=p.stageConfig.logging,et=Object.keys(_).length>0;(0,tm.createLogger)({name:"signaling",category:"signaling",enabled:et,categories:_,levels:Z}).info("connectionImplV2 enabled"),this.logger=(0,tm.createLogger)({name:"StageConnectionV2",category:"signaling.connection",enabled:et,categories:_,levels:Z}),this.traceId=ns(),this.socket=new StageSocketV2({token:p.token,analyticsTracker:p.analyticsTracker,stageConfig:p.stageConfig}),this.tracker=(p=>{let{analyticsTracker:_,token:Z}=p,et,el=0,eu=0,ed=!1,eh={isConnected:!1,edpInitialStartConnectTime:0,edpInitialFinishConnectTime:0,edpConnectCount:0,edpInitialConnectDuration:0,edpConnectDuration:0,edpInitialStateDuration:0,edpInitialStatePublishingCount:0,edpStateUpdateCount:0,edpInitialConnectRetries:0};return{traceSetState:(p,et,el)=>{_.trackEventNoSharedProps(new TraceEvent(Z,p,`ws send SET_STATE: audioMuted=${et}, videoStopped=${el}`,iG.JOIN))},trackParticipantStateUpdate:(p,et,el)=>{_.trackEventNoSharedProps(new StateUpdatedEvent({token:Z,otherParticipantId:et.id,otherParticipantUserId:et.userId,isAudioMuted:et.audioMuted,isVideoStopped:et.videoStopped,isPublishing:et.isPublishing,isDisconnected:el,traceId:p}))},trackParseError:(p,et)=>{let el=new StageClientError({action:iG.JOIN,token:Z,traceId:p,code:n5.WEBSOCKET_MESSAGE_PARSE_FAILURE.code,tag:n1,location:"StageConnectionV2.onMessage",message:n5.WEBSOCKET_MESSAGE_PARSE_FAILURE.message,details:et.message,nominal:!1,fatal:!1});_.trackEvent(new StageErrorEvent(el))},markConnectStart:()=>{el=performance.now()},measureConnect:p=>{let _=eh.edpConnectCount,Z=performance.now(),et=Z-el;Object.assign(eh,{edpConnectCount:_+1,edpConnectDuration:et}),0===_&&Object.assign(eh,{edpInitialStartConnectTime:el,edpInitialFinishConnectTime:Z,edpInitialConnectDuration:et,edpInitialConnectRetries:p})},measureStateUpdate:p=>{let _=eh.edpStateUpdateCount;Object.assign(eh,{edpStateUpdateCount:_+1}),0===_&&Object.assign(eh,{edpInitialStateDuration:performance.now()-eh.edpInitialFinishConnectTime,edpInitialStatePublishingCount:p})},startMinuteTracking:(p,Z)=>{et||(_.trackEvent(new MinuteEvent(p,Z,eu,ed,0)),eu++,et=setInterval(()=>{_.trackEvent(new MinuteEvent(p,null!=Z?Z:ns(),eu,ed,0)),eu++},6e4))},stopMinuteTracking:p=>{et&&(clearInterval(et),et=void 0),p&&(eu=0)},set publishing(e){ed=e},get publishing(){return ed},getStats:p=>Object.assign(Object.assign({},eh),{isConnected:p}),reset:()=>{eh={isConnected:!1,edpInitialStartConnectTime:0,edpInitialFinishConnectTime:0,edpConnectCount:0,edpInitialConnectDuration:0,edpConnectDuration:0,edpInitialStateDuration:0,edpInitialStatePublishingCount:0,edpStateUpdateCount:0,edpInitialConnectRetries:0},eu=0,el=0}}})({analyticsTracker:p.analyticsTracker,token:p.token}),this.fsm=(0,tm.createFsm)({initialState:oP.DISCONNECTED,transitions:oK,callbacks:{onStateChanged:(p,_,Z)=>{this.handleStateTransition(p,_,Z)}}}),this.wireSocketEvents()}wireSocketEvents(){this.socket.on("connected",({retryCnt:p,traceId:_,serverFeatures:Z})=>{this.traceId=_||ns(),this.features=Dc(Z),this.tracker.measureConnect(p),this.dispatch(o5.CONNECTED)}),this.socket.on("errored",p=>{this.dispatch(o5.ERROR,{error:p})}),this.socket.on("closed",()=>{this.tracker.stopMinuteTracking()}),this.socket.on("message",p=>{this.handleServerMessage(p)})}handleStateTransition(p,_,Z){var et;switch(this.logger.info(`[handleStateTransition] ${p}
6 -> ${_}`,(null==Z?void 0:Z.reason)?`reason=${Z.reason}`:""),_){case oP.CONNECTING:p===oP.DISCONNECTED&&(this.isInitialGroupState=!0),this.emit(iu,_),this.tracker.markConnectStart(),this.socket.connect(this.token.eventsURL,this.traceId,!0===(null==Z?void 0:Z.fromReconnect));break;case oP.CONNECTED:this.emit(n9),this.emit(iu,_),this.tracker.startMinuteTracking(this.token,this.traceId);break;case oP.ERRORED:{this.emit(iu,_),(null==Z?void 0:Z.error)&&this.emit(id,Z.error);let et=null==Z?void 0:Z.error;if(et instanceof StageClientError&&et.fatal){let p=Mc(et);return void this.dispatch(o5.DISCONNECT,{reason:p})}if(p===oP.CONNECTED)return this.tracker.stopMinuteTracking(),this.socket.disconnect(),void this.dispatch(o5.RECONNECT,{fromReconnect:!0});this.socket.disconnect();break}case oP.DISCONNECTED:this.cleanup(),this.emit(iu,oP.DISCONNECTED,null!==(et=null==Z?void 0:Z.reason)&&void 0!==et?et:oN.UNKNOWN);break;default:Vt(_)}}cleanup(){this.tracker.stopMinuteTracking(!0),this.socket.disconnect(),this.socket.removeAllListeners(),this.participants.clear(),this.disconnected=[],this.features={sdpExchange:!1},this.isInitialGroupState=!0,this.tracker.reset()}handleServerMessage(p){var _,Z,et,el;this.logger.debug("[handleServerMessage] received ",p.type);let eu=p.type;switch(eu){case"STAGE_STATE":{let el=p.payload,eu=null!==(_=el.participants)&&void 0!==_?_:[],ed=null!==(Z=el.disconnected)&&void 0!==Z?Z:[];this.features=Dc(null!==(et=el.serverFeatures)&&void 0!==et?et:[]),this.tracker.measureStateUpdate(eu.length);let eh=Nc(this.participants,eu,ed,this.disconnected);eh.left.forEach(p=>{this.participants.delete(p.id),this.tracker.trackParticipantStateUpdate(this.traceId,p,!0),this.emit(n8,p)}),eh.updated.forEach(p=>{this.participants.set(p.id,p),this.tracker.trackParticipantStateUpdate(this.traceId,p,!1),this.emit(is,p)}),eh.joined.forEach(p=>{this.participants.set(p.id,p),this.tracker.trackParticipantStateUpdate(this.traceId,p,!1),this.emit(n6,p,this.isInitialGroupState)}),eh.kicked.forEach(p=>{this.emit(n7,p)}),this.isInitialGroupState=!1,this.disconnected=ed;break}case"DISCONNECT":{this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,this.traceId,`DISCONNECT message received: ${p.payload.code}:${p.payload.reason}`,iG.JOIN));let _=Pc(p.payload.code);if(p.payload.code===oM.TOKEN_REUSED&&this.stageConfig.signaling.disableTokenReuseMessage)return void this.logger.warn("token reuse detected, skipping â feature disabled");this.logger.warn(`disconnecting: ${p.payload.reason}`),this.dispatch(o5.DISCONNECT,{reason:_});break}case"REASSIGNMENT":this.emit(ih,p.payload);break;case"INCOMPATIBLE_CODECS":this.emit(ip,p.payload);break;case"SSU":{let _=window.atob(null!==(el=p.payload.A)&&void 0!==el?el:"").trim();if(!_||!_.startsWith("http")){this.logger.warn({msg:"SSU Url invalid"});break}nR.currentEndpoint=_;break}case"SUBSCRIBER_COUNT":this.emit(ig,p.payload);break;default:Vt(eu)}}dispatch(p,_){let Z=this.fsm.transition(p,_);Z.ok||this.logger.warn("dispatch rejected",p,Z.error.message)}createError(p,_,Z,et,el){return new StageClientError(Object.assign(Object.assign({action:p,token:this.token,traceId:Z,tag:_,location:"StageConnectionV2"},et),{details:el}))}createAbortError(){return this.createError(iG.JOIN,n1,this.traceId,n5.OPERATION_ABORTED)}createTokenExchangeError(p,_,Z){return this.createError(iG.EXCHANGE_TOKEN,n4,p,_,Z)}connect(p){return Qc(this,void 0,void 0,function*(){return this.logger.info(`[connect] traceId=${p.value}`),this.traceId=p,this.fsm.currentState()!==oP.DISCONNECTED&&(this.dispatch(o5.DISCONNECT,{reason:oN.CLIENT_RECONNECT}),this.emit(id,this.createAbortError())),this.socket.removeAllListeners(),this.wireSocketEvents(),new Promise((p,_)=>{let n=()=>{i(),p(this.traceId)},r=p=>{i(),_(p)},i=()=>{this.off(n9,n),this.off(id,r)};this.on(n9,n),this.on(id,r),this.dispatch(o5.CONNECT)})})}disconnect(){return this.logger.info("[disconnect]"),this.dispatch(o5.DISCONNECT,{reason:oN.USER_INITIATED}),this.traceId}getParticipant(p){return this.participants.get(p)}listAvailableParticipants(){return Array.from(this.participants.values())}isConnected(){return this.fsm.currentState()===oP.CONNECTED}getIsStagePublishing(){return this.tracker.publishing}getIsTokenExchangeInFlight(){return this.tokenExchangeInFlight}supportsSdpExchange(){return this.features.sdpExchange||this.stageConfig.connections.socket.openWithoutState}jitterBufferMinDelayInMs(){return this.features.jitterBufferMinDelayInMs}getConnectionStats(){return this.tracker.getStats(this.isConnected())}
6setStagePublishing(p){this.tracker.publishing=p,this.emit(il,this.tracker.publishing)}emitStageState(p,_){this.tracker.traceSetState(this.traceId,p,_),this.logger.debug(`[emitStageState] Sending stage state | audioMuted=${p} videoStopped=${_}`);let Z=this.socket.sendRequest({messageType:"aws:ivs:SET_STATE",responseType:"aws:ivs:SET_STATE",payload:{audioMuted:p,videoStopped:_},timeoutMs:this.stageConfig.signaling.state.setStateTimeoutMs,persistAcrossReconnects:!0,cancelOnNewRequest:!0,action:iG.JOIN},this.traceId.value);Z.events.on("received",p=>{p.error&&this.logger.warn(`SET_STATE error: ${p.error.type}`)}),Z.events.on("timedOut",()=>{this.logger.warn("SET_STATE timed out")})}exchangeSdp(p){return Qc(this,void 0,void 0,function*(){return this.isConnected()?(this.logger.debug(`[exchangeSdp] Sending SDP offer | traceId=${p.traceId}`),new Promise((_,Z)=>{var et,el,eu;let ed=this.socket.sendRequest((el=this.stageConfig.signaling.sdp.xdp.exchangeTimeoutMs,{messageType:"aws:ivs:SDP_OFFER",responseType:"aws:ivs:SDP_ANSWER",payload:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({whipUrl:p.url,platform:"web",sdk:"1.38.0",whipVersion:i2,content:p.sdpOffer,contentType:"application/sdp"},p.forceNode?{forceNode:p.forceNode}:{}),p.forceCluster?{forceCluster:p.forceCluster}:{}),p.assignmentToken?{assignmentToken:p.assignmentToken}:{}),p.multiCodec?{multiCodec:p.multiCodec}:{}),p.initialLayerPreference?{initialLayerPref:Jn(p.initialLayerPreference)}:{}),timeoutMs:el,persistAcrossReconnects:!1,cancelOnNewRequest:_=>_.payload.whipUrl===p.url,action:null!==(eu=p.action)&&void 0!==eu?eu:iG.PUBLISH}),p.traceId),o=()=>{ed.events.removeAllListeners(),ed.cancel(),Z(oD.ABORTED)};null===(et=p.signal)||void 0===et||et.addEventListener("abort",o,{once:!0}),ed.events.on("received",Z=>{var et,el,eu,ed,eh,ep,ef,eg,ev,em,eE;null===(et=p.signal)||void 0===et||et.removeEventListener("abort",o),_({requestId:null!==(el=Z.requestId)&&void 0!==el?el:"",httpStatusCode:null!==(eu=Z.httpStatusCode)&&void 0!==eu?eu:200,content:null!==(ed=Z.content)&&void 0!==ed?ed:"",contentType:null!==(eh=Z.contentType)&&void 0!==eh?eh:"",location:null!==(ep=Z.location)&&void 0!==ep?ep:"",sessionDeleteLink:null!==(ef=Z.sessionDeleteLink)&&void 0!==ef?ef:"",subscriberControlLink:null!==(eg=Z.subscriberControlLink)&&void 0!==eg?eg:"",videoLayersLink:null!==(ev=Z.videoLayersLink)&&void 0!==ev?ev:"",errorCode:null!==(em=Z.errorCode)&&void 0!==em?em:0,errorMessage:null!==(eE=Z.errorMessage)&&void 0!==eE?eE:""})}),ed.events.on("timedOut",()=>{var _;this.logger.debug("[exchangeSdp] request timed out"),null===(_=p.signal)||void 0===_||_.removeEventListener("abort",o),Z(oD.TIMEDOUT)}),ed.events.on("cancelled",()=>{var _;this.logger.debug("[exchangeSdp] request cancelled"),null===(_=p.signal)||void 0===_||_.removeEventListener("abort",o),Z(oD.TIMEDOUT)})})):(this.logger.warn(`[exchangeSdp] Skipping SDP offer, not connected | traceId=${p.traceId}`),Promise.reject(oD.NOT_CONNECTED))})}exchangeToken(p,_,Z,et){return Qc(this,void 0,void 0,function*(){return this.logger.info(`[exchangeToken] Exchanging token | traceId=${et}`),new Promise((el,eu)=>{let ed=this.socket.sendRequest({messageType:"aws:ivs:EXCHANGE_TOKEN",responseType:"aws:ivs:EXCHANGE_TOKEN",payload:{oldToken:p,newToken:_,requestId:Z,traceId:et},timeoutMs:5e3,persistAcrossReconnects:!1,cancelOnNewRequest:!0,action:iG.EXCHANGE_TOKEN},et);this.tokenExchangeInFlight=!0,ed.events.on("received",p=>{this.tokenExchangeInFlight=!1,p.error?eu(this.createTokenExchangeError(et,n5.EXCHANGE_TOKEN_FAILED,p.error.message)):el()}),ed.events.on("timedOut",()=>{this.tokenExchangeInFlight=!1,eu(this.createTokenExchangeError(et,n5.EXCHANGE_TOKEN_TIMEOUT))})})})}};(o8=o9||(o9={})).INTERNAL="internal",o8.REMOTE="remote",o8.API="api",(o7=o6||(o6={})).ADDITIVE="additive",o7.REPLACE="replace";let ConfigManager=class ConfigManager{constructor(p){var _;this.logger=new ScopedLogger(p.logger,e0.CONNECTION),this.subscribeConfig={defaults:p.subscribeDefaults,participants:{}},this.videoPublishConfig={defaults:p.videoPublishDefaults,internalOverrides:{},apiOverrides:{},remoteOverrides:{},lastMerged:p.videoPublishDefaults},this.audioPublishConfig={defaults:p.audioPublishDefaults,internalOverrides:{},apiOverrides:{},remoteOverrides:{},lastMerged:p.audioPublishDefaults};let Z=null!==(_=p.stageDefaults)&&void 0!==_?_:sr();this.stageConfig={defaults:Z,internalOverrides:{},apiOverrides:{},remoteOverrides:{},lastMerged:Z}}handleSubscribeConfigUpdate(p,_,Z,et=o6.REPLACE){_=(p=>{let _=zn(p);if(void 0!==_.jitterBuffer){let e=p=>
6{if("number"==typeof p){if(p<0)return 0;if(p>4e3)return 4e3}return p};void 0!==_.jitterBuffer.minDelayWhenPublishing&&(_.jitterBuffer.minDelayWhenPublishing=e(_.jitterBuffer.minDelayWhenPublishing)),void 0!==_.jitterBuffer.minDelayWhenSubscribeOnly&&(_.jitterBuffer.minDelayWhenSubscribeOnly=e(_.jitterBuffer.minDelayWhenSubscribeOnly))}return _})(_),void 0===this.subscribeConfig.participants[p]&&(this.subscribeConfig.participants[p]={internalOverrides:{},apiOverrides:{},remoteOverrides:{},lastMerged:this.subscribeConfig.defaults});let el=this.subscribeConfig.participants[p];switch(Z){case o9.INTERNAL:el.internalOverrides=this.handleSubscribeConfigLevelMerging(el.internalOverrides,_,et);break;case o9.REMOTE:el.remoteOverrides=this.handleSubscribeConfigLevelMerging(el.remoteOverrides,_,et);break;case o9.API:el.apiOverrides=this.handleSubscribeConfigLevelMerging(el.apiOverrides,_,et);break;default:nn(Z)}let eu=(0,tm.mergeConfigs)(this.subscribeConfig.defaults,el.internalOverrides,el.remoteOverrides,el.apiOverrides);if(void 0===eu)return this.logger.warn({msg:`Unable to merge subscribe configs for participant: ${p} | ${el}, ${_}`}),!1;let ed=!1===$n(el.lastMerged,eu);return el.lastMerged=eu,this.subscribeConfig.participants[p]=el,ed}handleExternalSubscribeConfigUpdate(p,_,Z,et=o6.REPLACE){let el=(p=>{let _={};return"object"!=typeof p?tm.err(Error("Invalid input")):(void 0!==p.jitterBuffer&&(_.jitterBuffer={},void 0!==p.jitterBuffer.minDelay&&(_.jitterBuffer.minDelayWhenSubscribeOnly=p.jitterBuffer.minDelay)),void 0!==p.inBandMessaging&&(_.inBandMessaging={enabled:!0===p.inBandMessaging.enabled}),void 0!==p.simulcast&&(_.simulcast={},void 0!==p.simulcast.initialLayerPreference&&(_.simulcast.initialLayerPreference=p.simulcast.initialLayerPreference)),tm.ok(_))})(_);return!0===el.ok&&this.handleSubscribeConfigUpdate(p,el.value,Z,et)}handleSubscribeConfigLevelMerging(p,_,Z){if(Z===o6.REPLACE)return _;{let et=(0,tm.mergeConfigs)(p,_);return void 0===et?(this.logger.warn({msg:`Unable to merge '${p}' and '${_}' with type ${Z}`}),p):et}}getSubscribeConfigSnapshot(p){return void 0===this.subscribeConfig.participants[p]?Kn(this.subscribeConfig.defaults):Kn(this.subscribeConfig.participants[p].lastMerged)}handleLocalStreamConfigUpdate(p,_,Z,et=o6.REPLACE){let el=p===nV.VIDEO?this.videoPublishConfig:this.audioPublishConfig,eu=p===nV.VIDEO?"video":"audio";switch(Z){case o9.INTERNAL:el.internalOverrides=this.handlePublishConfigLevelMerging(el.internalOverrides,_,et,eu);break;case o9.REMOTE:el.remoteOverrides=this.handlePublishConfigLevelMerging(el.remoteOverrides,_,et,eu);break;case o9.API:el.apiOverrides=this.handlePublishConfigLevelMerging(el.apiOverrides,_,et,eu);break;default:nn(Z)}let ed=(0,tm.mergeConfigs)(el.defaults,el.internalOverrides,el.remoteOverrides,el.apiOverrides);if(void 0===ed)return this.logger.warn({msg:`Unable to merge ${eu} publish configs`}),!1;let eh=!1===$n(el.lastMerged,ed);return el.lastMerged=ed,eh}handlePublishConfigLevelMerging(p,_,Z,et){if(Z===o6.REPLACE)return _;let el=(0,tm.mergeConfigs)(p,_);return void 0===el?(this.logger.warn({msg:`Unable to merge ${et} publish configs with type ${Z}`}),p):el}getLocalStreamConfigSnapshot(p){let _=p===nV.VIDEO?this.videoPublishConfig:this.audioPublishConfig;return zn(_.lastMerged)}resetLocalStreamConfig(p){let _=p===nV.VIDEO?this.videoPublishConfig:this.audioPublishConfig;_.internalOverrides={},_.apiOverrides={},_.remoteOverrides={},_.lastMerged=_.defaults}handleStageConfigUpdate(p,_,Z=o6.REPLACE){switch(_){case o9.INTERNAL:this.stageConfig.internalOverrides=this.handleStageConfigLevelMerging(this.stageConfig.internalOverrides,p,Z);break;case o9.REMOTE:this.stageConfig.remoteOverrides=this.handleStageConfigLevelMerging(this.stageConfig.remoteOverrides,p,Z);break;case o9.API:this.stageConfig.apiOverrides=this.handleStageConfigLevelMerging(this.stageConfig.apiOverrides,p,Z);break;default:nn(_)}let et=(0,tm.mergeConfigs)(this.stageConfig.defaults,this.stageConfig.internalOverrides,this.stageConfig.remoteOverrides,this.stageConfig.apiOverrides);if(void 0===et)return this.logger.warn({msg:"Unable to merge stage configs"}),!1;let el=!1===$n(this.stageConfig.lastMerged,et);return this.stageConfig.lastMerged=et,el}handleStageConfigLevelMerging(p,_,Z){if(Z===o6.REPLACE)return _;let et=(0,tm.mergeConfigs)(p,_);return void 0===et?(this.logger.warn({msg:`Unable to merge stage configs with type ${Z}`}),p):et}getStageConfigSnapshot(){return Kn(this.stageConfig.lastMerged)}};let Zc=p=>{let _=(0,tw.pickBy)(p,p=>void 0!==p);for(let p of Object.keys(_))if("object"==typeof _[p]&&null!==_[p]&&!Array.isArray(_[p])){let Z=Zc(_[p]);0===Object.keys(Z).length?delete _[p]:_[p]=Z}return _};let ReassignmentRequestEvent=class ReassignmentRequestEvent extends StageAnalyticsEvent{constructor(p){super(tg.REASSIGNMENT_REQUEST,p.token,p.traceId,!1),Ob
6ject.assign(this.properties,{target_local_participant_id:p.targetLocalParticipantId,target_remote_participant_id:p.targetRemoteParticipantId}),this.critical=!0}};var o8,o7,at,aa,as,al,au,ou=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let StageStream=class StageStream extends TypedEmitter{constructor(p,_){super(),this.setGetStats=p=>{this._getInternalStats=p},this.getStats=()=>ou(this,void 0,void 0,function*(){return this.requestRTCStats()}),this.requestRTCStats=()=>ou(this,void 0,void 0,function*(){if(!this._getInternalStats)return;let p=yield this._getInternalStats(this.mediaStreamTrack);return p?p.rawReport:void 0}),this._getInternalStats=_,this.id=p.id,this.isMuted=!p.enabled,this.mediaStreamTrack=p,this.streamType="audio"===this.mediaStreamTrack.kind?nV.AUDIO:nV.VIDEO}cleanup(){this.removeAllListeners(),this._getInternalStats=void 0}};(ad=at||(at={})).IDLE="IDLE",ad.INITIALIZING="INITIALIZING",ad.ACTIVE="ACTIVE",ad.CONTROLS_PAUSED="CONTROLS_PAUSED",ad.DESTROYED="DESTROYED",(ah=aa||(aa={})).LAYERS_CHANGED="LAYERS_CHANGED",ah.LAYER_SELECTED="LAYER_SELECTED",ah.ADAPTION_CHANGED="ADAPTION_CHANGED",(ap=as||(as={})).LAYERS_CHANGED="LAYERS_CHANGED",ap.LAYER_SELECTED="LAYER_SELECTED",ap.ADAPTION_CHANGED="ADAPTION_CHANGED",(af=al||(al={})).UNAVAILABLE="unavailable",af.SELECTED="selected",(ag=au||(au={})).LOCAL_STREAM_MUTE_CHANGED="localStreamMutedChanged",ag.LOCAL_STREAM_INSERT_SEI_MSG_REQUEST="localStreamInsertSeiMsgRequest";var ad,ah,ap,af,ag,av,am,aE,uu=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let LocalStageStream=class LocalStageStream extends StageStream{constructor(p,_){super(p),this.setMuted=p=>{p!==this.isMuted&&(this.mediaStreamTrack.enabled=!p,this.isMuted=p,this.emit(au.LOCAL_STREAM_MUTE_CHANGED,this))},this.insertSeiMessage=(p,_)=>uu(this,void 0,void 0,function*(){let Z;if("audio"===this.streamType)Z=ox.INVALID_TRACK_TYPE;else if(this.mediaConfig.inBandMessaging.enabled){let et=this.validator.validateMessagePayload(p,(null==_?void 0:_.repeatCount)||0);Z=tm.getErr(et)}else Z=ox.INBAND_MESSAGING_NOT_ENABLED;Z?console.warn(`Unable to insert SEI message due to ${Z}`):this.emit(au.LOCAL_STREAM_INSERT_SEI_MSG_REQUEST,this,p,_)}),this.requestQualityStats=()=>uu(this,void 0,void 0,function*(){if(!this._getInternalStats)return;let p=yield this._getInternalStats(this.mediaStreamTrack);return p?p.stats:void 0}),this.validatedExternalConfig=function(p,_){if(void 0===_)return _;let Z=(0,tw.cloneDeep)(_);return hi(Z)?(void 0!==Z.maxBitrate&&(Z.maxVideoBitrateKbps=Z.maxBitrate,kn("maxBitrate is deprecated in favor of maxVideoBitrateKbps")),di((Z=(p=>{let _=(0,tw.cloneDeep)(p),{codecs:Z}=_;if(void 0===Z)return _;if(!Array.isArray(Z))throw new CodecConfigurationError(r0);if(0===Z.length)return delete _.codecs,_;for(let p of Z){let _=ci(p);if(!_.ok)throw _.error}return _})(Z=Jr(p,Z))).maxVideoBitrateKbps),di(Z.minBitrate),function(p){if(void 0!==p&&(p>r_||p<rS))throw Error(`Stage framerate must be between ${rS} fps and ${r_} fps inclusive`)}(Z.maxFramerate),function(p){if(void 0!==p){if("object"!=typeof p)throw Error("In-band messaging config must be an object");if("boolean"!=typeof p.enabled)throw Error("In-band messaging config enabled property must be a boolean")}}(Z.inBandMessaging)):(function(p){if(void 0!==p&&(p<rI||p>rR))throw Error(`Stage audio bitrate must be between ${rI} Kbps and ${rR} Kbps inclusive`)}(Z.maxAudioBitrateKbps),function(p){if(void 0!==p&&"boolean"!=typeof p)throw Error("Stage stereo prop must be a boolean")}(Z.stereo)),Z}(p,_),this.normalizedConfig=Wa(p,this.validatedExternalConfig),this.mediaConfig=(0,tw.cloneDeep)(this.normalizedConfig),this.validator=new SeiSendRequestValidator(r_)}};let StageStrategyWrapper=class StageStrategyWrapper{constructor(p,_){this.strategy=p,this.logger=_}setStrategy(p){this.strategy=p}hasStrategy(p){return void 0!==this.strategy[p]}stageStreamsToPublish(){let p=[];try{p=(p=this.strategy.stageStreamsToPublish()).filter(p=>p instanceof LocalStageStream)}catch(p){return this.logger.warn({msg:"error executing stageStreamsToPublish treating this as a no-op",err:p}),console.error("Error executing stageStreamsToPublish",p),tm.err(p)}let _=0,Z=0;for(let et of p)"audio"===et.mediaStreamTrack.kind?_++:"video"===et.mediaStreamTrack.kind&&Z++;if(_>1||Z>1){let p=Error("stageStreamsToPublish strategy function returned more than 1 video or audio stream and as a result will not publish",{cause:"UserStrategy"});return tm.err(p)}return tm.ok(p)}
6shouldPublishParticipant(p){try{return tm.ok(this.strategy.shouldPublishParticipant(p))}catch(p){return this.logger.warn({msg:"error executing shouldPublishParticipant treating this as a no-op",err:p}),console.error("Error executing shouldPublishParticipant",p),tm.err(p)}}shouldSubscribeToParticipant(p){try{return tm.ok(this.strategy.shouldSubscribeToParticipant(p))}catch(p){return this.logger.warn({msg:"error executing shouldSubscribeToParticipant. Treating it as a no-op",err:p}),console.error("Error executing shouldSubscribeToParticipant",p),tm.err(p)}}subscribeConfiguration(p){var _,Z;try{return tm.ok(null===(Z=(_=this.strategy).subscribeConfiguration)||void 0===Z?void 0:Z.call(_,p))}catch(p){return this.logger.warn({msg:"error executing subscribeConfiguration. Treating it as a no-op",err:p}),console.error("Error executing subscribeConfiguration",p),tm.err(p)}}preferredLayerForStream(p,_){var Z,et;try{return tm.ok(null===(et=(Z=this.strategy).preferredLayerForStream)||void 0===et?void 0:et.call(Z,p,_))}catch(p){return this.logger.warn({msg:"error executing preferredLayerForStream. Treating it as a no-op",err:p}),console.error("Error executing preferredLayerForStream",p),tm.err(p)}}};let StageParticipant=class StageParticipant extends TypedEmitter{constructor(p,_){super(),this.audioMuted=!0,this.videoStopped=!0,this.publishState=am.NOT_PUBLISHED,this.logger=_,this.info=p,this.audioMuted=p.audioMuted,this.videoStopped=p.videoStopped}};function lu(p){return{id:p.id,userId:p.userId,attributes:p.attributes,capabilities:new Set([av.SUBSCRIBE]),isLocal:!1,userInfo:{},videoStopped:p.videoStopped,audioMuted:p.audioMuted,isPublishing:p.isPublishing}}function du(p){var _,Z;let et=new Set;return p.token.claims.capabilities.allow_publish&&et.add(av.PUBLISH),p.token.claims.capabilities.allow_subscribe&&et.add(av.SUBSCRIBE),{id:p.token.participantID,userId:null!==(_=p.token.userID)&&void 0!==_?_:"",attributes:null!==(Z=p.token.claims.attributes)&&void 0!==Z?Z:{},capabilities:et,isLocal:!0,userInfo:{},videoStopped:p.videoStopped,audioMuted:p.audioMuted,isPublishing:p.isPublishing}}function hu(p){return p.map(p=>p.remote)}function pu(p){return{label:p.encodingId,bitrateBps:1e3*p.bitrate,width:p.width,height:p.height,framesPerSecond:p.framesPerSecond,selected:p.selected}}function fu(p,_){let Z=p.width*p.height,et=_.width*_.height;return Z>et||p.bitrateBps>_.bitrateBps||p.framesPerSecond>_.framesPerSecond?1:Z===et&&p.bitrateBps===_.bitrateBps&&p.framesPerSecond===_.framesPerSecond?0:-1}(ab=av||(av={})).PUBLISH="publish",ab.SUBSCRIBE="subscribe",(aC=am||(am={})).NOT_PUBLISHED="not_published",aC.ATTEMPTING_PUBLISH="attempting_publish",aC.PUBLISHED="published",aC.ERRORED="errored",(aT=aE||(aE={})).NOT_SUBSCRIBED="not_subscribed",aT.ATTEMPTING_SUBSCRIBE="attempting_subscribe",aT.SUBSCRIBED="subscribed",aT.ERRORED="errored";var gu=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let RemoteStageStream=class RemoteStageStream extends TypedEmitter{constructor(p){var _,Z,et;super(),this.onAdaptionChanged=p=>{this.emit(as.ADAPTION_CHANGED,p)},this.onLayersChanged=p=>{this.emit(as.LAYERS_CHANGED,p)},this.onLayerSelected=(p,_)=>{this.emit(as.LAYER_SELECTED,p,_)},this.setGetStats=()=>{},this.requestRTCStats=()=>gu(this,void 0,void 0,function*(){var p;return null===(p=this.internalStream)||void 0===p?void 0:p.requestRTCStats()}),this.requestQualityStats=()=>gu(this,void 0,void 0,function*(){if(this.internalStream)try{let p=yield this.internalStream.getInternalStats();if(!p)return;return p.stats}catch(p){return}}),this.getStats=()=>gu(this,void 0,void 0,function*(){var p;return null===(p=this.internalStream)||void 0===p?void 0:p.requestRTCStats()}),this.setMuted=p=>{var _;null===(_=this.internalStream)||void 0===_||_.setMuted(p)},this.getLayers=()=>{var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.layers)&&void 0!==_?_:this.cachedLayers}
vendor: 4,983 bytes, line 6
6,this.getSelectedLayer=()=>{var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.selectedLayer)&&void 0!==_?_:this.cachedSelectedLayer},this.getLowestQualityLayer=()=>{var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.lowestQualityLayer)&&void 0!==_?_:this.cachedLowestLowestLayer},this.getHighestQualityLayer=()=>{var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.highestQualityLayer)&&void 0!==_?_:this.cachedHighestQualityLayer},this.internalStream=p,this.cachedId=this.internalStream.id,this.cachedParticipantInfo=(0,tw.cloneDeep)(this.internalStream.participantInfo),this.cachedStreamType=this.internalStream.streamType,this.cachedMediaStreamTrack=null!==(et=null===(Z=(_=this.internalStream.mediaStreamTrack).clone)||void 0===Z?void 0:Z.call(_))&&void 0!==et?et:{},this.cachedIsMuted=this.internalStream.isMuted,this.cachedIsAdapting=this.internalStream.isAdapting,this.cachedLayers=this.internalStream.layers,this.updateCachedStreamData(),this.internalStream.on(aa.ADAPTION_CHANGED,this.onAdaptionChanged),this.internalStream.on(aa.LAYERS_CHANGED,this.onLayersChanged),this.internalStream.on(aa.LAYER_SELECTED,this.onLayerSelected)}updateCachedStreamData(){var p,_,Z,et,el;this.cachedLayers=null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.layers)&&void 0!==_?_:[],this.cachedHighestQualityLayer=null===(Z=this.internalStream)||void 0===Z?void 0:Z.highestQualityLayer,this.cachedLowestLowestLayer=null===(et=this.internalStream)||void 0===et?void 0:et.lowestQualityLayer,this.cachedSelectedLayer=null===(el=this.internalStream)||void 0===el?void 0:el.selectedLayer}get id(){var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.id)&&void 0!==_?_:this.cachedId}get participantInfo(){var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.participantInfo)&&void 0!==_?_:this.cachedParticipantInfo}get streamType(){var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.streamType)&&void 0!==_?_:this.cachedStreamType}get mediaStreamTrack(){var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.mediaStreamTrack)&&void 0!==_?_:this.cachedMediaStreamTrack}get isMuted(){var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.isMuted)&&void 0!==_?_:this.cachedIsMuted}set isMuted(p){var _;null===(_=this.internalStream)||void 0===_||_.setMuted(p)}get isAdapting(){var p,_;return null!==(_=null===(p=this.internalStream)||void 0===p?void 0:p.isAdapting)&&void 0!==_?_:this.cachedIsAdapting}cleanup(){var p,_,Z;this.updateCachedStreamData(),null===(p=this.internalStream)||void 0===p||p.off(aa.ADAPTION_CHANGED,this.onAdaptionChanged),null===(_=this.internalStream)||void 0===_||_.off(aa.LAYERS_CHANGED,this.onLayersChanged),null===(Z=this.internalStream)||void 0===Z||Z.off(aa.LAYER_SELECTED,this.onLayerSelected),this.internalStream=void 0,this.removeAllListeners()}};let InternalStageStream=class InternalStageStream extends StageStream{constructor({track:p,info:_,getStats:Z,remotePlaybackController:et,analyticsTracker:el,token:eu,subscribeConfig:ed,stageConfig:eh}){super(p,Z),this.hasRemoteListenersForLayerEvents=()=>{let p=this.remote;return p.hasListenersFor(as.ADAPTION_CHANGED)||p.hasListenersFor(as.LAYERS_CHANGED)||p.hasListenersFor(as.LAYER_SELECTED)},this.setMuted=p=>{var _,Z;this.isMuted=p,this.streamType===nV.AUDIO&&(null===(Z=null===(_=this.stageConfig)||void 0===_?void 0:_.media)||void 0===Z?void 0:Z.disableRemoteAudioMuteEnforcement)||(this.mediaStreamTrack.enabled=!p)},this.setLayer=p=>{let _=(0,tw.cloneDeep)(p);if(this.queueLayerUpdateForValidState(_))return void this.logger.debug({msg:`setLayer:${_} queued, skipping for now`});let Z=function(p,_){if(!p)return(0,tm.ok)(void 0);let Z="string"==typeof p?p:p.label,et=_.filter(p=>p.label===Z)[0];return et?(0,tm.ok)(et):(0,tm.err)(`Provided layer with id ${Z} does not exist`)}(_,this._layers);if(!Z.ok){let p=Z.error;return void this.logger.error({err:p,msg:"Unable to select layer, skipping selection"})}let et=Z.value;if(this.isNextUpdateAdaptionOnly(et))return this.logger.warn({msg:"setLayer:dynamic"}),void this.handleDynamicUpdate();this.isFirstLayerUpdate()||!this.isRepeatLayerSelection(et)||this.isAdapting?et&&(this.logger.warn({msg:`setLayer:${JSON.stringify(et)} `}),this.handleManualUpdate(et)):this.logger.debug({msg:"Setting the same layer, same adaption state, skipping selection"})},this.state=at.INITIALIZING,this.prevState=at.IDLE,this.analyticsTracker=el,this.token=eu,this.id=p.id,this.info=_,this.mediaStreamTrack=p,this.remotePlaybackController=et,this.layerPollingIntervalId=null,this.weakRemoteMap=new WeakMap,this.weakRemoteKey={id:"remote"},this.commandMap=new Map,this.subscribeConfig=ed,this.stageConfig=eh,this._isAdapting=!0,this._layers=[],this._selectedLayer=null;let ep=Ct();this.logger=new ScopedLogger(new Logger(ep),e0.REMOTE_STAGE_STREAM),this.streamType===nV.AU
6DIO?this.isMuted=_.audioMuted:this.isMuted=_.videoStopped,this.initializeLayerPolling(),this.pollInternalLayers(!0)}transitionStateTo(p){this.state!==p&&(this.prevState=this.state,this.state=p)}initializeLayerPolling(){Io(this.mediaStreamTrack)?this.streamType!==nV.AUDIO?(this.logger.debug({msg:"Setting up RemoteStageStream, requesting initial layers"}),null!==this.layerPollingIntervalId&&clearInterval(this.layerPollingIntervalId),this.layerPollingIntervalId=setInterval(()=>{this.pollInternalLayers()},this.subscribeConfig.simulcast.layerPollingIntervalMs)):this.logger.debug({msg:"Skipping initializing polling for audio streams"}):this.logger.debug({msg:"Skipping initializing polling, media track is not active"})}startLayerPolling(){null===this.layerPollingIntervalId?this.initializeLayerPolling():this.logger.debug({msg:"Skipping start polling request, already started"})}stopLayerPolling(){null!==this.layerPollingIntervalId?(clearInterval(this.layerPollingIntervalId),this.layerPollingIntervalId=null):this.logger.debug({msg:"Skipping stop polling request, already stopped"})}pollInternalLayers(p=!1){if(!Io(this.mediaStreamTrack))return void this.pauseControls();if(this.streamType===nV.AUDIO)return this.logger.debug({msg:"Skipping layer poll request for audio stream"}),void this.transitionStateTo(at.ACTIVE);let _=!this.hasRemoteListenersForLayerEvents(),Z=!this.subscribeConfig.simulcast.layerPollingEnabled;!p&&_&&Z?this.logger.debug({msg:"Skipping layer request due to no listeners"}):this.remotePlaybackController.getLayers().then(p=>{if(this.isStateValidForLayerUpdates()){if(!p.ok)throw Error(p.error);this.updateInternalLayersFromRemote(p.value),this.transitionStateTo(at.ACTIVE),this.flushCommandQueue()}else this.logger.warn({msg:"Stream controls have been paused, skipping getLayers"})}).catch(p=>{this.logger.error({err:p,msg:"Error calling getLayers, returning current layers"})})}updateInternalLayersFromRemote(p){let _=this._layers,Z=p.map(pu).sort(fu),et=!(0,tw.isEqual)(Z,_);this._layers=Z;let el=this._selectedLayer,eu=this._layers.filter(p=>p.selected)[0],ed=!(0,tw.isEqual)(eu,el);el&&(el.selected=!1),this._selectedLayer=eu,ed&&(this.trackLayerUpdate(el),this.trackLayerUpdate(eu)),this.isCommandQueueEmpty()&&(et&&this.emitLayersChanged(),ed&&this.emitLayerSelected(eu))}flushCommandQueue(){if(this.isCommandQueueEmpty())return;let p=Array.from(this.commandMap.keys());for(let _ of(this.logger.debug({msg:`Flushing active commands from map ${p}`}),this.commandMap.keys())){let p=this.commandMap.get(_);null==p||p()}this.commandMap.clear()}queueLayerUpdateForValidState(p){if(!p)return this.commandMap.delete("setLayer"),!1;if(this.state===at.INITIALIZING){let _=this.setLayer.bind(this,p);return this.commandMap.set("setLayer",_),!0}return!1}handleDynamicUpdate(){if(!this.isStateValidForLayerUpdates())return void this.logger.warn({msg:"Stream controls have been paused, skipping dynamic mode transition"});let p=this._isAdapting;this._isAdapting=!0,this.emitAdaptionChanged(),this.remotePlaybackController.unsetLayer().then(_=>{if(!this.isStateValidForLayerUpdates())return this.logger.warn({msg:"Stream controls have been paused, skipping dynamic mode transition"}),void this.resetAdaptionStateOnError(p,`Stream in invalid state: ${this.state}`);_.ok?this.logger.debug({msg:"Layer successfully unset, restarting dynamic adaption"}):this.resetAdaptionStateOnError(p,_.error)}).catch(()=>{})}resetAdaptionStateOnError(p,_){this._isAdapting=p,this.emitAdaptionChanged(),this.logger.error({err:_,msg:"Error unsetting layer, reverting adaption state"})}handleManualUpdate(p){if(!this.isStateValidForLayerUpdates())return void this.logger.warn({msg:"Stream controls have been paused, skipping manual updates"});let _=this._isAdapting,Z=this._selectedLayer;Z&&(Z.selected=!1),this._isAdapting=!1,this._selectedLayer=p,p.selected=!0,_!==this._isAdapting&&this.emitAdaptionChanged(),this.updateLocalLayerStateBeforeRemote(p,Z),this.trackLayerUpdate(Z),this.trackLayerUpdate(p),this.emitLayersChanged(),this.emitLayerSelected(p),this.remotePlaybackController.setLayer(p.label).then(et=>{if(!this.isStateValidForLayerUpdates()){this.logger.warn({msg:"Stream controls have been paused, skipping dynamic mode transition"});
6let et=`Stream in invalid state: ${this.state}`;return this.resetAdaptionStateOnError(_,et),void this.resetLayerOnError(Z,p,et)}if(!et.ok){let el=et.error;return this.resetAdaptionStateOnError(_,el),void this.resetLayerOnError(Z,p,el)}this.logger.debug({msg:`Layer successfully selected: ${p.label}`})}).catch(()=>{})}applyExistingControlState(){var p;this._isAdapting?this.remotePlaybackController.unsetLayer().then(()=>{}).catch(()=>{}):(null===(p=this._selectedLayer)||void 0===p?void 0:p.label)&&this.remotePlaybackController.setLayer(this._selectedLayer.label).then(()=>{}).catch(()=>{})}resetLayerOnError(p,_,Z){_&&(_.selected=!1),p&&(p.selected=!0),this._selectedLayer=p,this.logger.error({err:Z,msg:"Error unsetting layer, leaving current selection in place"}),this.updateLocalLayerStateBeforeRemote(p,_),this.emitLayersChanged(),null!==p&&this.emitLayerSelected(p,al.UNAVAILABLE),this.trackLayerUpdate(_),this.trackLayerUpdate(p)}updateLocalLayerStateBeforeRemote(p,_){this._layers=this._layers.map(Z=>Z.label===(null==p?void 0:p.label)?p:Z.label===(null==_?void 0:_.label)?_:Z).sort(fu)}trackLayerUpdate(p){var _,Z;this.analyticsTracker.trackEventNoSharedProps(new SimulcastLayerInfoEvent(this.token,ns(),null!==(_=null==p?void 0:p.label)&&void 0!==_?_:"auto",!0,iG.SUBSCRIBE,null!==(Z=null==p?void 0:p.selected)&&void 0!==Z&&Z,this.info.id))}isNextUpdateAdaptionOnly(p){return void 0===p&&this.isFirstLayerUpdate()||void 0===p&&!this.isAdapting}isFirstLayerUpdate(){return null===this._selectedLayer}isRepeatLayerSelection(p){var _;return(null===(_=this._selectedLayer)||void 0===_?void 0:_.label)===(null==p?void 0:p.label)}isStateValidForLayerUpdates(){return this.state===at.ACTIVE||this.state===at.INITIALIZING}isCommandQueueEmpty(){return 0===this.commandMap.size}emitLayerSelected(p,_=al.SELECTED){this.logger.debug({msg:`Emitting layers selected ${JSON.stringify(p,null,2)}`}),this.emit(aa.LAYER_SELECTED,(0,tw.cloneDeep)(p),_)}emitLayersChanged(){this.emit(aa.LAYERS_CHANGED,(0,tw.cloneDeep)(this._layers))}emitAdaptionChanged(){this.emit(aa.ADAPTION_CHANGED,this._isAdapting)}get remote(){let p=this.weakRemoteMap.get(this.weakRemoteKey);if(p)return p;let _=new RemoteStageStream(this);return this.weakRemoteMap.set(this.weakRemoteKey,_),_}get participantInfo(){return(0,tw.cloneDeep)(this.info)}get isAdapting(){return this._isAdapting}get layers(){return(0,tw.cloneDeep)(this._layers)}get selectedLayer(){var p;return(0,tw.cloneDeep)(null!==(p=this._selectedLayer)&&void 0!==p?p:void 0)}get highestQualityLayer(){return(0,tw.cloneDeep)(this.layers[this.layers.length-1])}get lowestQualityLayer(){return(0,tw.cloneDeep)(this.layers[0])}getInternalStats(){var p,_,Z,et;return p=this,_=void 0,et=function*(){if(this._getInternalStats)return this._getInternalStats(this.mediaStreamTrack)},new(Z=void 0,Z=Promise)(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})}pauseControls(){this.transitionStateTo(at.CONTROLS_PAUSED),this.stopLayerPolling()}resumeControls(){this.applyExistingControlState(),this.startLayerPolling(),this.transitionStateTo(at.ACTIVE)}updateSubscribeConfig(p){let _=this.subscribeConfig;this.subscribeConfig=p,_.simulcast.layerPollingIntervalMs!==p.simulcast.layerPollingIntervalMs&&this.isStateValidForLayerUpdates()&&this.initializeLayerPolling()}cleanup(){this.transitionStateTo(at.DESTROYED),super.cleanup(),this.weakRemoteMap.delete(this.weakRemoteKey),this.stopLayerPolling(),this._layers=[],this._selectedLayer=null,this._isAdapting=!0,this.commandMap.clear()}};(aO=aI||(aI={})).STATE_CHANGE="stateChange",aO.MEDIA_STREAM_ADDED="mediaStreamAdded",aO.MEDIA_STREAM_REMOVED="mediaStreamRemoved",aO.MEDIA_STREAM_MUTE_CHANGED="mediaStreamMuteChanged",aO.ERROR="error",(aA=aR||(aR={})).SUBSCRIPTION_STATE_CHANGE="subscriptionStateChange",aA.MEDIA_STREAM_SEI_MESSAGE_RECEIVED="mediaStreamSeiMessageReceived";let aS=Object.assign(Object.assign({},aI),aR);(ak||(ak={})).PUBLICATION_STATE_CHANGE="publicationStateChange";let a_=Object.assign(Object.assign({},aI),ak);var bu=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let RemoteStageParticipant=class RemoteStageParticipant extends StageParticipant{constructor(p,_,Z,et,el,eu,ed,eh,ep=!1){super(p,new ScopedLogger(et,e0.REMOTE_PARTICIPANT)),this.stageConfig=eh,this.subscribeState=aE.NOT_SUBSCRIBED,this.reassigning=!1,this.streams=[],this.left=!1,this.onSubscriptionStateChange=p=>{this.logger.debug({msg:"subscriptionStateChange",state:p}),p===oW.DISCONNECTED?this.updateSubscriptionState(aE.NOT_SUBSCRIBED):p===oW.CONNECTED?this.updateSubscriptionState(aE.SUBSCRIBED):p===oW.CONNECTING?this.updateSubscriptionState(aE.ATTEMPTING_SUBSCRIBE):p===oW.E
vendor: 4,104 bytes, line 6
6RRORED?(this.emitStreamsRemovedByType(this.getDesiredSubscribeType()),this.cleanupStreams(),this.updateSubscriptionState(aE.ERRORED)):this.logger.warn({msg:"FIXME onSubscriptionStateChange UNHANDLED STATE",state:p})},this.onSubscriptionStreamRemoved=()=>{this.logger.debug({msg:"onSubscriptionStreamRemoved"}),this.emitStreamsRemovedByType(this.getDesiredSubscribeType()),this.cleanupStreams()},this.onSubscriptionStreamCreated=(p,_)=>{this.logger.debug({msg:"onSubscriptionStreamCreated",stream:p}),this.pruneInactiveStreams();let Z=p.getTracks().map(p=>{let Z=new InternalStageStream({track:p,info:this.info,getStats:this.subscription.requestRTCStats,remotePlaybackController:_,analyticsTracker:this.analyticsTracker,token:this.token,subscribeConfig:this.subscribeConfig,stageConfig:this.stageConfig});return this.streams.push(Z),Z});this.subscription.getDesiredSubscribeType()===oq.AUDIO_ONLY&&(Z=Z.filter(p=>p.streamType!==nV.VIDEO)),this.emit(aS.MEDIA_STREAM_ADDED,Z)},this.onSubscriptionError=p=>{this.emit(aS.ERROR,p)},this.onSubscriptionSeiMessageReceived=p=>{this.emit(aS.MEDIA_STREAM_SEI_MESSAGE_RECEIVED,p)},this.onSubscriptionTransformError=p=>{this.emit(aS.ERROR,p)},this.onSubscriptionReassignmentStart=()=>{for(let p of this.streams)p.pauseControls()},this.onSubscriptionReassignmentDone=()=>{for(let p of this.streams)p.resumeControls()},this.updateSubscribeStateIfNecessary=(p,_)=>{if(!this.info.capabilities.has(av.SUBSCRIBE))return;void 0!==_&&(this.subscribeConfig=_,this.subscription.updateSubscribeConfig(_),this.streams.forEach(p=>{p.updateSubscribeConfig(_)}));let Z=p!==oq.NONE&&this.publishState===am.PUBLISHED,et=this.subscribeState!==aE.NOT_SUBSCRIBED&&this.subscribeState!==aE.ERRORED;if(Z&&!et)this.subscription.updateDesiredSubscribeType(p),this.subscribe();else if(!Z&&et)this.unsubscribe(),this.subscription.updateDesiredSubscribeType(p);else if(this.subscribeState===aE.SUBSCRIBED&&this.subscription.getDesiredSubscribeType()!==p)try{p===oq.AUDIO_ONLY?this.emit(aS.MEDIA_STREAM_REMOVED,this.filterStreamsByType(this.streams,nV.VIDEO)):p===oq.AUDIO_VIDEO&&this.emit(aS.MEDIA_STREAM_ADDED,this.filterStreamsByType(this.streams,nV.VIDEO)),this.subscription.updateDesiredSubscribeType(p)}catch(p){this.logger.error({err:p,msg:"error updating subscribe type"})}},this.updatePublishState=p=>{let _=p&&this.publishState===am.PUBLISHED,Z=!p&&this.publishState===am.NOT_PUBLISHED;return!_&&!Z&&(this.info.isPublishing=p,this.publishState=p?am.PUBLISHED:am.NOT_PUBLISHED,!0)},this.updateStreamState=(p,_)=>{this.audioMuted!==p&&(this.audioMuted=p,this.info.audioMuted=p,this.updateStreamMuteState(nV.AUDIO,p)),this.videoStopped!==_&&(this.videoStopped=_,this.info.videoStopped=_,this.updateStreamMuteState(nV.VIDEO,_))},this.updateStreamMuteState=(p,_)=>{let Z=this.filterStreamsByType(this.streams,p),et=Z[Z.length-1];if(!et){let _=`state update received for ${this.info.id} for non-existent ${p} stream`;return this.logger.warn({msg:_}),void this.traceRemoteParticipantMsg(_)}et.setMuted(_),this.emit(aS.MEDIA_STREAM_MUTE_CHANGED,et)},this.cleanup=()=>{this.removeAllListeners()},this.quickUnsubscribe=()=>this.subscribeState!==aE.NOT_SUBSCRIBED&&this.subscription.stop(!0),this.getDesiredSubscribeType=()=>this.subscription.getDesiredSubscribeType(),this.isReassigning=()=>this.reassigning,this.analyticsTracker=ed,this.token=_,this.subscribeConfig=eu;let ef=!0;this.createSubscription=()=>{let eh=ep&&ef&&el!==oq.NONE;ef=!1;let eg=new StageSubscription(p.id,_,Z,et,ed,el,eu,this.stageConfig,eh);return eg.on(iv,this.onSubscriptionStateChange),eg.on(im,this.onSubscriptionStreamCreated),eg.on(iE,this.onSubscriptionStreamRemoved),eg.on(iS,this.onSubscriptionError),eg.on(i_,this.onSubscriptionSeiMessageReceived),eg.on(iy,this.onSubscriptionTransformError),eg.on(ib,this.onSubscriptionReassignmentStart),eg.on(iC,this.onSubscriptionReassignmentDone),eg.on(iT,this.onSubscriptionReassignmentDone),eg},this.subscription=this.createSubscription(),p.isPublishing&&(this.publishState=am.PUBLISHED)}updateSubscriptionState(p){p!==this.subscribeState&&(this.subscribeState=p,this.emit
6(aS.SUBSCRIPTION_STATE_CHANGE,this.subscribeState))}pruneInactiveStreams(){let p=[];this.streams=this.streams.filter(_=>!!Io(_.mediaStreamTrack)||(p.push(_),!1));let _=p.length;if(0===_)return;let Z=this.filterStreamsByType(p,nV.AUDIO).length,et=_-Z;this.traceRemoteParticipantMsg(`Pruning inactive streams (${Z} audio, ${et} video)`),this.emitStreamsRemoved(p),p.forEach(p=>{p.remote.cleanup(),p.cleanup()})}filterStreamsByType(p,_){return p.filter(p=>p.streamType===_)}participantLeave(){this.left=!0}subscribe(){this.left?this.logger.warn({msg:"tried to subscribe to a participant that left"}):(this.updateSubscriptionState(aE.ATTEMPTING_SUBSCRIBE),this.logger.debug({msg:"subscribe"}),this.subscription.start())}unsubscribe(){if(this.subscribeState===aE.NOT_SUBSCRIBED)return;this.logger.debug({msg:"unsubscribe"}),this.subscription.stop(),this.subscription.off(iv,this.onSubscriptionStateChange),this.subscription.off(im,this.onSubscriptionStreamCreated),this.subscription.off(iE,this.onSubscriptionStreamRemoved),this.subscription.off(iS,this.onSubscriptionError),this.subscription.off(iy,this.onSubscriptionTransformError);let p=this.getDesiredSubscribeType();this.subscription=this.createSubscription(),this.emitStreamsRemovedByType(p),this.updateSubscriptionState(aE.NOT_SUBSCRIBED),this.cleanupStreams()}emitStreamsRemovedByType(p){switch(p){case oq.AUDIO_VIDEO:this.emitStreamsRemoved(this.streams);break;case oq.AUDIO_ONLY:this.emitStreamsRemoved(this.filterStreamsByType(this.streams,nV.AUDIO));case oq.NONE:}}emitStreamsRemoved(p){this.emit(aS.MEDIA_STREAM_REMOVED,p)}cleanupStreams(){0!==this.streams.length&&(this.logger.debug({msg:"Cleaning up streams due to internal removal"}),this.streams.forEach(p=>{p.remote.cleanup(),p.cleanup()}),this.streams=[])}traceRemoteParticipantMsg(p){this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,ns(),p,iG.SUBSCRIBE,this.info.id))}triggerIceRestart(p){return bu(this,void 0,void 0,function*(){this.reassigning=!0;try{yield this.subscription.triggerIceRestart(p)}finally{this.reassigning=!1}})}requestAdhocReassignment(){return bu(this,void 0,void 0,function*(){yield this.subscription.triggerAdhocReassignment()})}};let ay=iG.PUBLISH;function Tu(p,_,Z){return new StageClientError(Object.assign(Object.assign({},p),{token:_,traceId:Z,location:"stage-publication.sendSeiMessage",tag:n2,action:iG.PUBLISH}))}let PublishTracker=class PublishTracker{constructor(p,_){this.analyticsTracker=p,this.token=_,this.action=ay,this.traceId=ns()}trackPublish(p){let{action:_,traceId:Z,analyticsTracker:et,token:el}=this;return et.trackEvent(new PublishEvent({token:el,traceId:Z})),{getTraceId:()=>Z,trackPublishStarted({totalDurationWithRetries:_,retryTimes:eu,sfuResource:ed,peerClientPerfStats:eh,protocol:ep}){let{optionsDuration:ef,postDuration:eg,timeToCandidate:ev,timeToConnected:em,sdpExchangeDuration:eE,sdpExchangeTransport:eS,setRemoteDescDuration:e_,peerConnectionDuration:ey}=eh,{edpInitialConnectDuration:eb,edpInitialConnectRetries:eC,edpInitialStateDuration:eT,edpStateUpdateCount:eI}=p;et.trackEvent(new PublishStartedEvent({token:el,traceId:Z,optionsDuration:ef,postDuration:eg,timeToCandidate:ev,totalDuration:em,edpInitialConnectDuration:eb,edpInitialConnectRetries:eC,edpInitialStateDuration:eT,edpStateUpdateCount:eI,sdpExchangeDuration:eE,sdpExchangeTransport:eS,setRemoteDescDuration:e_,peerConnectionDuration:ey,publishRetries:eu,totalDurationWithRetries:_,sfuResource:ed,protocol:ep}))},trackPublishFailed(p,eu){let ed=((p,_,Z)=>{if(p instanceof StageClientError)return p;let et="";return p instanceof HttpError&&(et+=`HttpError - ${p.code||p.status}`),new StageClientError(Object.assign(Object.assign(Object.assign({},n5.PUBLISH_FAILURE),{action:ay,token:_,traceId:Z,tag:n2,location:"publish",details:`${et} ${p.message}`}),{fatal:!0}))})(p,el,Z);et.trackEvent(new PublishFailedEvent({token:el,traceId:Z,code:ed.code,message:ed.message,fatal:ed.fatal,nominal:ed.nominal,protocol:eu}));let eh=new StageClientError(Object.assign(Object.assign({},n5.PUBLISH_FAILURE),{action:_,token:el,traceId:Z,tag:n2,location:"publish"}));
6return p instanceof StageClientError&&(eh.fatal=p.fatal,eh.nominal=p.nominal,eh.location=`publish > ${p.location}`),et.trackError(eh),ed},trackUnpublish:()=>{et.trackEvent(new UnpublishEvent({token:el,traceId:Z}))},trackEndSucceeded:(p,_)=>{et.trackEvent(new PublishEndedEvent({token:el,isUnpublishSuccessful:!0,traceId:Z,reason:p,protocol:_}))},trackEndFailed:(p,_)=>{let eu=new StageClientError(Object.assign(Object.assign({},n5.UNPUBLISH_FAILURE),{token:el,traceId:Z,tag:"webrtc_unsink",location:"unpublish"}));return p!==iK.UNLOAD&&p!==iK.UNPUBLISH||this.analyticsTracker.trackError(eu),et.trackEvent(new PublishEndedEvent({token:el,isUnpublishSuccessful:!1,traceId:Z,reason:p,protocol:_})),eu},createSeiNotPublishingVideoError:()=>Tu(n5.SEI_INSERT_NOT_PUBLISHING_VIDEO,el,Z),createSeiInBandMessagingNotEnabledError:()=>Tu(n5.SEI_INSERT_INBAND_NOT_ENABLED,el,Z)}}};var ab,aC,aT,aI,aR,aO,aA,ak,aw,aN,Ou=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};(aD=aw||(aw={})).DISCONNECTED="disconnected",aD.CONNECTING="connecting",aD.CONNECTED="connected",aD.ERRORED="errored",(aP=aN||(aN={})).STATE_CHANGE="stateChange",aP.ERROR="error",aP.TRANSFORM_ERROR="transformError";let StagePublication=class StagePublication extends TypedEmitter{constructor(p,_,Z,et,el){super(),this.token=p,this.stageConnection=_,this.nonScopedLogger=Z,this.analyticsTracker=et,this.stageConfig=el,this.streamsToPublish=[],this.publicationState=aw.DISCONNECTED,this.latestPubAttemptNum=0,this.startConnectingTimestamp=-1,this.action=iG.PUBLISH,this.start=p=>{this.publicationState===aw.DISCONNECTED||this.publicationState===aw.ERRORED?(this.streamsToPublish=p,this.latestPubAttemptNum=0,this.processStateUpdate()):this.logger.warn("cannot be started if not in disconnected or error state")},this.requestRTCStats=p=>Ou(this,void 0,void 0,function*(){return this.peerClient.requestRTCStats(p)}),this.stop=(p=!1)=>Ou(this,void 0,void 0,function*(){this.peerClient.off(tS,this.onPeerClientConnectionStateChange),this.peerClient.off(tC,this.onPeerClientTransformError),yield this.unpublish(p),this.updateState(aw.DISCONNECTED)}),this.processStateUpdate=p=>{let{publicationState:_}=this;_===aw.DISCONNECTED||_===aw.ERRORED?0===this.latestPubAttemptNum&&(this.startConnectingTimestamp=performance.now(),this.updateState(aw.CONNECTING),this.tryPublish()):_===aw.CONNECTING?p===tz.CONNECTED&&this.updateState(aw.CONNECTED):_===aw.CONNECTED&&p===tz.FAILED&&(this.attemptTracker&&this.attemptTracker.trackEndFailed(iK.CONNECTION_FAIL,this.peerClient.getProtocol()),0===this.latestPubAttemptNum&&(this.startConnectingTimestamp=performance.now(),this.updateState(aw.CONNECTING),this.tryPublish()))},this.updateState=p=>{this.publicationState=p,this.emit(aN.STATE_CHANGE,p)},this.tryPublish=()=>Ou(this,void 0,void 0,function*(){if(this.latestPubAttemptNum++,this.latestPubAttemptNum<=4){let p=this.stageConnection.getConnectionStats();this.attemptTracker=this.publishTracker.trackPublish(p);try{this.logger.debug(`attempting to publish, attemptNum: ${this.latestPubAttemptNum}`),yield this.publish(this.streamsToPublish,this.attemptTracker.getTraceId()),this.logger.debug("publish succeeded!");let p=this.peerClient.getSfuResource(),_=this.latestPubAttemptNum-1,Z=performance.now()-this.startConnectingTimestamp,et=this.peerClient.getActionMeasurements();this.attemptTracker.trackPublishStarted({sfuResource:p,totalDurationWithRetries:Z,retryTimes:_,peerClientPerfStats:et,protocol:this.peerClient.getProtocol()}),this.latestPubAttemptNum=0}catch(ed){this.logger.error("publish failed!",ed);let p=this.attemptTracker.trackPublishFailed(ed,this.peerClient.getProtocol()),_=p.code===n5.OPERATION_ABORTED.code,Z=this.stageConnection.getIsTokenExchangeInFlight(),et=p.fatal&&!Z;p.fatal&&Z&&this.logFatalErrorSuppressedDuringExchange(p);let el=4===this.latestPubAttemptNum;if(_)return;if(et||el)return this.logger.error(`Stopping attempts: isFatal=${et}, isLastAttempt=${el}
6`,ed),this.updateState(aw.ERRORED),void this.emit(aN.ERROR,p);let eu=1e3*Math.pow(2,this.latestPubAttemptNum);this.logger.debug(`attempt failed, retrying in ${eu}ms`),this.nextAttemptTimerId=window.setTimeout(()=>{this.tryPublish()},eu)}}}),this.publish=(p,_)=>Ou(this,void 0,void 0,function*(){this.peerClient.initStreamsToPublish(p),yield this.peerClient.connect({audioOnly:!1,traceId:_})}),this.unpublish=(p=!1)=>Ou(this,void 0,void 0,function*(){if(window.clearTimeout(this.nextAttemptTimerId),this.publicationState===aw.DISCONNECTED||this.publicationState===aw.ERRORED||!this.attemptTracker)return;this.attemptTracker.trackUnpublish();let _=p?iK.UNLOAD:iK.UNPUBLISH,Z=this.peerClient.getProtocol();try{p?this.peerClient.disconnect(p):yield this.peerClient.disconnect(p),this.attemptTracker.trackEndSucceeded(_,Z)}catch(p){this.attemptTracker.trackEndFailed(_,Z)}}),this.replaceOrUpdateStream=p=>Ou(this,void 0,void 0,function*(){this.streamsToPublish.find(_=>_.track.kind===p.track.kind)?this.streamsToPublish=this.streamsToPublish.map(_=>_.track.kind===p.track.kind?p:_):this.streamsToPublish.push(p),yield this.peerClient.replaceOrUpdateStream(p)}),this.onPeerClientConnectionStateChange=p=>{this.logger.debug(`onPeerClientConnectionStateChange: ${p}`),this.processStateUpdate(p)},this.onPeerClientTransformError=p=>{this.emit(aN.TRANSFORM_ERROR,p)},this.onIncompatibleCodecs=p=>Ou(this,void 0,void 0,function*(){yield this.peerClient.onIncompatibleCodecs(p)}),this.sendSeiMessage=(p,_)=>{if(this.publicationState!==aw.CONNECTED)return this.attemptTracker&&this.emit(aN.ERROR,this.attemptTracker.createSeiNotPublishingVideoError()),tm.err(ox.NOT_PUBLISHING_VIDEO);let Z=this.peerClient.sendSeiMessage(p,_),et=tm.getErr(Z);return et&&this.attemptTracker&&(et===ox.INBAND_MESSAGING_NOT_ENABLED?this.emit(aN.ERROR,this.attemptTracker.createSeiInBandMessagingNotEnabledError()):et===ox.NOT_PUBLISHING_VIDEO&&this.emit(aN.ERROR,this.attemptTracker.createSeiNotPublishingVideoError())),Z};let eu=ns(),ed=new PeerClientStatsReporter({action:this.action,token:p,traceId:eu,identifier:p.participantID,analyticsTracker:et});this.peerClient=new StagePeerClient(p,this.nonScopedLogger,this.action,ds(this.action),eu,this.analyticsTracker,ed,void 0,_,void 0,this.stageConfig);let{categories:eh,levels:ep}=el.logging,ef=Object.keys(eh).length>0;this.logger=(0,tm.createLogger)({name:"StagePublication",category:"media",enabled:ef,categories:eh,levels:ep}),this.peerClient.on(tS,this.onPeerClientConnectionStateChange),this.peerClient.on(tC,this.onPeerClientTransformError),this.publishTracker=new PublishTracker(this.analyticsTracker,this.token)}logFatalErrorSuppressedDuringExchange(p){let _=`Fatal publish error suppressed during token exchange: ${p.message} (code: ${p.code})`;this.logger.warn(_),this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,this.attemptTracker.getTraceId(),_,iG.PUBLISH))}removeTrack(p){return Ou(this,void 0,void 0,function*(){this.streamsToPublish=this.streamsToPublish.filter(_=>_.track.kind!==p),yield this.peerClient.removeTrack(p)})}};var aD,aP,aM,Au=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let LocalStageParticipant=class LocalStageParticipant extends StageParticipant{constructor(p,_,Z,et,el,eu){super(p,new ScopedLogger(Z,e0.LOCAL_PARTICIPANT)),this.stageConfig=eu,this.onPublicationStateChange=p=>{switch(this.logger.debug({msg:"publicationStateChange",state:p}),p){case"connected":this.connection.setStagePublishing(!0),this.updatePublishState(am.PUBLISHED);break;case"connecting":this.updatePublishState(am.ATTEMPTING_PUBLISH);break;case"errored":this.updatePublishState(am.ERRORED),this.connection.setStagePublishing(!1);break;default:return void this.logger.warn({msg:"FIXME onPublicationStateChange UNHANDLED STATE",state:p})}},this.onPublicationError=p=>{this.emit(a_.ERROR,p)},this.updatePublishState=p=>{this.info.isPublishing=p===am.PUBLISHED,this.publishState=p,this.emit
6(a_.PUBLICATION_STATE_CHANGE,this.publishState)},this.handleMute=p=>{p.streamType===nV.AUDIO&&(this.audioMuted=p.isMuted,this.info.audioMuted=p.isMuted),p.streamType===nV.VIDEO&&(this.videoStopped=p.isMuted,this.info.videoStopped=p.isMuted),this.connection.emitStageState(this.audioMuted,this.videoStopped),this.emit(a_.MEDIA_STREAM_MUTE_CHANGED,p)},this.handleInsertSeiMsgRequest=(p,_,Z)=>{this.sendSeiMessage(_,null==Z?void 0:Z.repeatCount)},this.publish=p=>{this.logger.debug({msg:"publish"}),p.forEach(p=>{p&&(this.setupStreamListeners(p),p.streamType===nV.AUDIO?(this.audioStream=p,this.audioMuted=!p.mediaStreamTrack.enabled,this.info.audioMuted=this.audioMuted):p.streamType===nV.VIDEO&&(this.videoStream=p,this.videoStopped=!p.mediaStreamTrack.enabled,this.info.videoStopped=this.videoStopped),p.setGetStats(this.publication.requestRTCStats))}),this.connection.emitStageState(this.audioMuted,this.videoStopped);let _=p.map(p=>qa(p));this.publication.start(_)},this.cleanup=()=>this.removeAllListeners(),this.quickUnpublish=()=>this.publishState!==am.NOT_PUBLISHED&&this.publishState!==am.ERRORED&&void this.publication.stop(!0),this.onIncompatibleCodecs=p=>Au(this,void 0,void 0,function*(){yield this.publication.onIncompatibleCodecs(p)}),this.sendSeiMessage=(p,_=0)=>this.publication.sendSeiMessage(p,_),this.sendSeiMessageString=(p,_=0)=>{let Z=(new TextEncoder).encode(p);return this.publication.sendSeiMessage(Z,_)},this.connection=et,this.createPublication=()=>{let p=new StagePublication(_,et,Z,el,this.stageConfig);return p.on(aN.STATE_CHANGE,this.onPublicationStateChange),p.on(aN.ERROR,this.onPublicationError),p.on(aN.TRANSFORM_ERROR,this.onPublicationError),p},this.publication=this.createPublication()}setupStreamListeners(p){p.on(au.LOCAL_STREAM_MUTE_CHANGED,this.handleMute),p.streamType===nV.VIDEO&&p.on(au.LOCAL_STREAM_INSERT_SEI_MSG_REQUEST,this.handleInsertSeiMsgRequest)}removeTrack(p){var _,Z,et;p.streamType===nV.AUDIO?(null===(_=this.audioStream)||void 0===_||_.off(au.LOCAL_STREAM_MUTE_CHANGED,this.handleMute),this.audioStream=void 0,this.audioMuted=!0,this.info.audioMuted=!0):p.streamType===nV.VIDEO&&(null===(Z=this.videoStream)||void 0===Z||Z.off(au.LOCAL_STREAM_MUTE_CHANGED,this.handleMute),null===(et=this.videoStream)||void 0===et||et.off(au.LOCAL_STREAM_INSERT_SEI_MSG_REQUEST,this.handleMute),this.videoStream=void 0,this.videoStopped=!0,this.info.videoStopped=!0),this.connection.emitStageState(this.audioMuted,this.videoStopped),this.publication.removeTrack(p.streamType)}replaceOrAddTrack(p){return Au(this,void 0,void 0,function*(){this.setupStreamListeners(p),p.setGetStats(this.publication.requestRTCStats),p.streamType===nV.AUDIO?(this.audioStream=p,this.audioMuted=!p.mediaStreamTrack.enabled):p.streamType===nV.VIDEO&&(this.videoStream=p,this.videoStopped=!p.mediaStreamTrack.enabled),this.connection.emitStageState(this.audioMuted,this.videoStopped);let _=qa(p);yield this.publication.replaceOrUpdateStream(_)})}unpublish(){if(this.publishState===am.NOT_PUBLISHED||this.publishState===am.ERRORED)return;this.logger.debug({msg:"unpublish"}),this.connection.setStagePublishing(!1),this.publication.stop(),this.publication.off(aN.STATE_CHANGE,this.onPublicationStateChange),this.publication.off(aN.ERROR,this.onPublicationError),this.publication.off(aN.TRANSFORM_ERROR,this.onPublicationError);let p=[this.audioStream,this.videoStream].filter(p=>!!p);p.forEach(p=>{p.cleanup()}),this.audioStream=void 0,this.videoStream=void 0,this.emit(a_.MEDIA_STREAM_REMOVED,p),this.updatePublishState(am.NOT_PUBLISHED),this.publication=this.createPublication()}};(p=aM||(aM={})).STAGE_CONNECTION_STATE_CHANGED="stageConnectionStateChanged",p.STAGE_PARTICIPANT_JOINED="stageParticipantJoined",p.STAGE_PARTICIPANT_LEFT="stageParticipantLeft",p.STAGE_PARTICIPANT_STREAMS_ADDED="stageParticipantStreamsAdded",p.STAGE_PARTICIPANT_STREAMS_REMOVED="stageParticipantStreamsRemoved",p.STAGE_STREAM_MUTE_CHANGED="stageStreamMuteChanged",p.STAGE_STREAM_SEI_MESSAGE_RECEIVED="stageStreamSeiMessageReceived",p.STAGE_STREAM_LAYERS_CHANGED="stageStreamLayersChanged",p.STAGE_STREAM_LAYER_SELECTED="stageStreamLayerSelected",p.STAGE_STREAM_ADAPTION_CHANGED="stageStreamAdaptionChanged",p.STAGE_PARTICIPANT_SUBSCRIBE_STATE_CHANGED="stageParticipantSubscribeStateChanged",p.STAGE_PARTICIPANT_PUBLISH_STATE_CHANGED="stageParticipantPublishStateChanged",p.STAGE_SUBSCRIBER_COUNT_CHANGED="stageSubscriberCountChanged",p.ERROR="error",p.STAGE_LEFT="stageLeft",p.STAGE_PARTICIPANT_METADATA_CHANGED="stageParticipantMetadataChanged";var ku=function(p,_,Z,et){return new(Z||(Z=Promise))(function(el,eu){function s(p){try{c(et.next(p))}catch(p){eu(p)}}function a(p){try{c(et.throw(p))}catch(p){eu(p)}}function c(p){var _;p.done?el(p.value):((_=p.value)instanceof Z?_:new Z(function(p){p(_)})).then(s,a)}c((et=et.apply(p,_||[])).next())})};let Nu=p=>!!p;let Stage=class Stage extends TypedEmitter{constructor(p,_){var Z,el;super(),this.connectionState=oP.DISCONNECTED,this.participants=new Map,this.connectionStateErrored=!1,this.latestExchangeRequestId=null,this.onConnectionStateChanged=(p,_)=>{var Z,el;if(this.connectionState=p,p===oP.ERRORED&&(this.connectionStateErrored=!0),p===oP.CONNECTED&&this.localParticipant&&this.localParticipant.publishState!==am.NOT_PUBLISHED&&this.stageConnection.emitStageState(null===(Z=this.localParticipant)||void 0===Z?void 0:Z.audioMuted,null===(el=this.localParticipant)||void 0===el?void 0:el.videoStopped),p===oP.CONNECTED&&this.connectionStateErrored&&(this.connectionStateErrored=!1,this.refreshStrategy()),p===oP.DISCONNECTED){if(_&&_!==oN.CLIENT_RECONNECT&&_!==oN.USER_INITIATED){let p=et.UNKNOWN;Object.values(et).includes(_)?p=_:this.logger.warn({msg:`DISCONNECTED reason is not a StageLeftReason: ${_}`}),this.cleanup(p)}}
6else this.emit(aM.STAGE_CONNECTION_STATE_CHANGED,this.connectionState)},this.setupLocalParticipantOnce=()=>{var p;this.localParticipant?this.analyticsTracker.trackEventNoSharedProps(new TraceEvent(this.token,null!==(p=this.joinTraceId)&&void 0!==p?p:new TraceId,"reusing local participant from repeat join",iG.JOIN,"")):this.createLocalParticipant()},this.createLocalParticipant=()=>{let p=du({token:this.token,videoStopped:!0,audioMuted:!0,isPublishing:!1});this.localParticipant=new LocalStageParticipant(p,this.token,this.logger.unwrap(),this.stageConnection,this.analyticsTracker,this.stageConfig),this.localParticipant.on(a_.PUBLICATION_STATE_CHANGE,p=>{this.onPublishStateChanged(this.localParticipant.info,p)}),this.localParticipant.on(a_.MEDIA_STREAM_REMOVED,this.onLocalStreamsRemoved),this.localParticipant.on(a_.MEDIA_STREAM_MUTE_CHANGED,p=>{this.localParticipant?this.onStreamMuteChange(this.localParticipant.info,p):this.logger.warn({msg:"tried to emit a stream mute change event for undefined local participant"})}),this.localParticipant.on(a_.ERROR,p=>{this.errorManager.handleError(p,iY.PUBLISH_ERROR)}),this.emit(aM.STAGE_PARTICIPANT_JOINED,p)},this.onRemoteParticipantJoined=(p,_)=>{if(p.id===this.token.participantID)return;let Z=lu(p);if(this.participants.has(Z.id))return void this.logger.warn({msg:"Remote participant already tracked"});let et=oq.NONE;Z.capabilities.has(av.SUBSCRIBE)&&(et=tm.getOk_or(this.strategyWrapper.shouldSubscribeToParticipant(Z),et),this.updateManagerWithExternalSubscribeConfig(Z,"joined"));let el=this.configManager.getSubscribeConfigSnapshot(Z.id),eu=new RemoteStageParticipant(Z,this.token,this.stageConnection,this.logger.unwrap(),et,el,this.analyticsTracker,this.stageConfig,_&&p.isPublishing);this.participants.set(Z.id,eu),this.setupRemoteParticipantListeners(eu),this.emit(aM.STAGE_PARTICIPANT_JOINED,eu.info),eu.updateSubscribeStateIfNecessary(et)},this.setupRemoteParticipantListeners=p=>{p.on(aS.SUBSCRIPTION_STATE_CHANGE,_=>{this.onParticipantSubscribeStateChanged(p.info.id,_)}),p.on(aS.MEDIA_STREAM_ADDED,_=>{let Z=this.participants.get(p.info.id);if(Z){for(let p of _)this.setupRemoteParticipantStreamEvents(Z.info,p);this.emit(aM.STAGE_PARTICIPANT_STREAMS_ADDED,Z.info,hu(_)),this.updateStreamLayerForParticipantInfo(p.info,p.streams)}else this.logger.warn({msg:"Got stream add for participant no longer being tracked"})}),p.on(aS.MEDIA_STREAM_REMOVED,_=>{let Z=this.participants.get(p.info.id);Z?this.emit(aM.STAGE_PARTICIPANT_STREAMS_REMOVED,Z.info,hu(_)):this.logger.warn({msg:"Got stream remove for participant no longer being tracked"})}),p.on(aS.MEDIA_STREAM_MUTE_CHANGED,_=>{this.onStreamMuteChange(p.info,_.remote)}),p.on(aS.ERROR,p=>{this.errorManager.handleError(p,iY.SUBSCRIBE_ERROR)}),p.on(aS.MEDIA_STREAM_SEI_MESSAGE_RECEIVED,_=>{this.onSeiMessageReceived(p.info,_)})},this.onRemoteParticipantLeft=p=>{if(this.connectionState!==oP.CONNECTED)return;let _=this.participants.get(p);_?(_.participantLeave(),_.unsubscribe(),_.cleanup(),this.participants.delete(p),this.emitParticipantLeave(_.info)):this.logger.warn({msg:"Remote participant no longer tracked"})},this.emitParticipantLeave=p=>{this.emit(aM.STAGE_PARTICIPANT_LEFT,p)},this.onRemoteParticipantStateChanged=p=>{let _=this.participants.get(p.id);if(!_)return void this.logger.warn({msg:"Remote participant updated but not tracked"});let{userIdChanged:Z,attributesChanged:et}=Xs(_.info.userId,_.info.attributes,p.userId,p.attributes);_.updatePublishState(p.isPublishing)&&this.onPublishStateChanged(_.info,_.publishState),_.updateStreamState(p.audioMuted,p.videoStopped),(Z||et)&&(_.info=lu(p),this.emit(aM.STAGE_PARTICIPANT_METADATA_CHANGED,_.info));let el=this.strategyWrapper.shouldSubscribeToParticipant(_.info);if(tm.isNotOk(el))return;this.updateManagerWithExternalSubscribeConfig(_.info,"updated");let eu=this.configManager.getSubscribeConfigSnapshot(_.info.id),ed=tm.getOk_or(el,oq.NONE);_.updateSubscribeStateIfNecessary(ed,eu)},this.onPublishStateChanged=(p,_)=>{this.emit(aM.STAGE_PARTICIPANT_PUBLISH_STATE_CHANGED,p,_)},this.onParticipantSubscribeStateChanged=(p,_)=>{let Z=this.participants.get(p);
vendor: 1,896 bytes, line 6
6Z?this.emit(aM.STAGE_PARTICIPANT_SUBSCRIBE_STATE_CHANGED,Z.info,_):this.logger.warn({msg:"Remote participant subscribe state changed but not tracked"})},this.onLocalStreamsAdded=p=>{this.localParticipant&&this.emit(aM.STAGE_PARTICIPANT_STREAMS_ADDED,this.localParticipant.info,p)},this.onLocalStreamsRemoved=p=>{this.localParticipant&&this.emit(aM.STAGE_PARTICIPANT_STREAMS_REMOVED,this.localParticipant.info,p)},this.onStreamMuteChange=(p,_)=>{this.emit(aM.STAGE_STREAM_MUTE_CHANGED,p,_)},this.onSeiMessageReceived=(p,_)=>{this.emit(aM.STAGE_STREAM_SEI_MESSAGE_RECEIVED,p,_)},this.leave=()=>{this.cleanup(et.USER_INITIATED)},this.onBeforeUnloadCleanup=()=>{var p;this.participants.forEach(p=>{p.quickUnsubscribe()}),null===(p=this.localParticipant)||void 0===p||p.quickUnpublish(),this.stageConnection.disconnect(),this.emit(aM.STAGE_CONNECTION_STATE_CHANGED,oP.DISCONNECTED),this.analyticsTracker.stop(!0)},this.cleanup=p=>{if(this.latestExchangeRequestId=null,!this.localParticipant)return;this.analyticsTracker.trackEventNoSharedProps(new LeaveEvent({token:this.token,eventEndpoint:this.token.eventsURL,whipEndpoint:this.token.whipURL,traceId:this.joinTraceId,reason:p})),this.localParticipant.unpublish(),this.localParticipant.cleanup();let _=this.localParticipant.info;this.localParticipant=void 0,this.emitParticipantLeave(_);let Z=this.participants.entries();for(let[p,_]of Z)_.unsubscribe(),this.participants.delete(p),_.cleanup(),this.emitParticipantLeave(_.info);og.destroy(this.analyticsTracker.getSessionId()),this.stageConnection.disconnect(),this.emit(aM.STAGE_CONNECTION_STATE_CHANGED,oP.DISCONNECTED),this.emit(aM.STAGE_LEFT,p),this.analyticsTracker.stop(!1),window.removeEventListener("beforeunload",this.onBeforeUnloadCleanup)},this.refreshStrategy=()=>{var p;(null===(p=this.localParticipant)||void 0===p?void 0:p.info.capabilities.has(av.SUBSCRIBE))&&this.participants.forEac
6h(p=>{let _=this.strategyWrapper.shouldSubscribeToParticipant(p.info);if(tm.isNotOk(_))return;let Z=tm.getOk_or(_,oq.NONE);this.updateManagerWithExternalSubscribeConfig(p.info,"updated");let et=this.configManager.getSubscribeConfigSnapshot(p.info.id);p.updateSubscribeStateIfNecessary(Z,et),this.updateStreamLayerForParticipantInfo(p.info,p.streams)}),this.updateStreamsToPublishIfNecessary()},this.updateManagerWithExternalSubscribeConfig=(p,_)=>{var Z;let et=tm.getOk(this.strategyWrapper.subscribeConfiguration(p)),el=tm.getOk(this.getRemoteSubscribeConfiguration()),eu=this.getInternalSubscribeOverrides(),ed=p.id,eh=!1;et&&(eh=this.configManager.handleExternalSubscribeConfigUpdate(ed,et,o9.API));let ep=!1;el&&(ep=this.configManager.handleSubscribeConfigUpdate(ed,el,o9.REMOTE));let ef=!1;if(eu&&(ef=this.configManager.handleSubscribeConfigUpdate(ed,eu,o9.INTERNAL)),eh||ef||ep){let p=this.configManager.getSubscribeConfigSnapshot(ed);this.analyticsTracker.trackEventNoSharedProps(new MultihostSubscribeConfigurationEvent(this.token,null!==(Z=this.joinTraceId)&&void 0!==Z?Z:ns(),"j
6oined"===_?"initial":"ad-hoc",ed,p))}},this.getRemoteSubscribeConfiguration=()=>{let p=nR.getRemoteSubscribeConfig({customerId:this.token.customerId,sessionId:this.analyticsTracker.getSessionId()});return p?tm.ok(p):tm.err("No payload found")},this.getRemoteVideoPublishConfiguration=()=>{let p=nR.getRemoteVideoStreamConfig({customerId:this.token.customerId,sessionId:this.analyticsTracker.getSessionId()});return p?tm.ok(p):tm.err("No video config found")},this.getRemoteAudioPublishConfiguration=()=>{let p=nR.getRemoteAudioStreamConfig({customerId:this.token.customerId,sessionId:this.analyticsTracker.getSessionId()});return p?tm.ok(p):tm.err("No audio config found")},this.updateLocalStreamWithRemoteConfig=p=>{let _=p.streamType;this.configManager.resetLocalStreamConfig(_);let Z=p.validatedExternalConfig;Z&&this.configManager.handleLocalStreamConfigUpdate(_,Z,o9.API);let et=p.normalizedConfig;et&&this.configManager.handleLocalStreamConfigUpdate(_,et,o9.INTERNAL);let el=_===nV.VIDEO?this.getRemoteVideoPublishConfiguration():this.getRemoteAudioPublishConfiguration();el.ok&&this.configManager.handleLocalStreamConfigUpdate(_,el.value,o9.REMOTE);let eu=this.configManager.getLocalStreamConfigSnapshot(_);p.normalizedConfig=eu},this.updateStreamsToPublishIfNecessary=()=>{var p;if(!this.localParticipant||!(null===(p=this.localParticipant)||void 0===p?void 0:p.info.capabilities.has(av.PUBLISH)))return;let _=this.localParticipant.publishState!==am.NOT_PUBLISHED&&this.localParticipant.publishState!==am.ERRORED,Z=this.strategyWrapper.shouldPublishParticipant(this.localParticipant.info);if(tm.isNotOk(Z))return;let et=tm.getOk_or(Z,!1);if(!_&&!et)return;if(_&&!et)return void this.localParticipant.unpublish();let el=this.strategyWrapper.stageStreamsToPublish();if(tm.isNotOk(el)){let p=tm.getErr(el);if(p instanceof Error&&"UserStrategy"===p.cause)throw p;return}let eu=tm.getOk_or(el,[]);for(let p of eu)this.updateLocalStreamWithRemoteConfig(p);et=et&&eu.length>0,!_&&et?(this.localParticipant.publish(eu),this.onLocalStreamsAdded(eu)):this.syncTracksToPublish(eu)},this.syncTracksToPublish=p=>{var _;if(!this.localParticipant)return;let Z=this.localParticipant.audioStream,et=this.localParticipant.videoStream,{updates:el,streamsToAdd:eu,streamsToRemove:ed}=this.determineStreamUpdates(Z,et,p);if(el.length){for(let p of el)p.newStream?null===(_=this.localParticipant)||void 0===_||_.replaceOrAddTrack(p.newStream):p.oldStream&&this.localParticipant.removeTrack(p.oldStream);0!==ed.length&&this.onLocalStreamsRemoved(ed),0!==eu.length&&this.onLocalStreamsAdded(eu)}},this.determineStreamUpdates=(p,_,Z=[])=>{let et=[],el=Z.slice(0,2);if(el.sort((p,_)=>p.streamType===nV.AUDIO?-1:1),0===el.length)p&&et.push({oldStream:p}),_&&et.push({oldStream:_});else if(1===el.length){let Z=el[0];Z.streamType===nV.AUDIO?_&&et.push({oldStream:_}):Z.streamType===nV.VIDEO&&p&&et.push({oldStream:p})}el.forEach(Z=>{var el,eu;Z.streamType===nV.AUDIO?p?p.id===Z.id&&(0,tw.isEqual)(p.mediaConfig,Z.mediaConfig)||(!!(null===(el=p.mediaConfig)||void 0===el?void 0:el.stereo)!=!!(null===(eu=Z.mediaConfig)||void 0===eu?void 0:eu.stereo)&&this.logger.warn({msg:"Ignoring change to audio stream's stereo configuration. Re-publish to change stereo configuraiton."}),et.push({oldStream:p,newStream:Z})):et.push({newStream:Z}):Z.streamType===nV.VIDEO&&(_?_.id===Z.id&&(0,tw.isEqual)(_.mediaConfig,Z.mediaConfig)||et.push({oldStream:_,newStream:Z}):et.push({newStream:Z}))});let eu=et.map(p=>p.newStream).filter(Nu),ed=et.map(p=>p.oldStream).filter(Nu);return{updates:et,streamsToAdd:eu,streamsToRemove:ed}},this.onReassignmentMessage=p=>ku(this,void 0,void 0,function*(){if(Nt())return void this.logger.debug({msg:"REASSIGN message ignored: disableReassignments is configured"});if(!rh.browser.isChrome())return void this.logger.debug({msg:"REASSIGN message ignored: browser is not chrome"});let _=ns();this.trackReassignmentRequest(p,_);let Z=this.participants.get(p.remoteParticipantId),et=this.token.participantID,el=function(p,{localParticipantId:_,remoteParticipant:Z}){let{participantId:et}=p;if(_!==et)return tm.err(Object.assign(Object.assign({},n5.REASSIGNMENT_REQUEST_INVALID_LOCAL_PARTICIPANT_ID),{details:`Invalid participantId received: ${et}`}));if(!Z)return tm.err(Object.assign(Object.assign({},n5.REASSIGNMENT_REQUEST_INVALID_REMOTE_PARTICIPANT_ID),{details:`Invalid remoteParticipantId received: ${Z}`}));if(Z.isReassigning())return tm.err(n5.REASSIGNMENT_REQUEST_ALREADY_IN_PROGRESS);let el=Z.subscription.peerClient.getConnectionState();return[tz.CONNECTED,tz.DISCONNECTED].includes(el)?tm.ok(Z):tm.err(Object.assign(Object.assign({},n5.REASSIGNMENT_REQUEST_INVALID_REMOTE_PEER_CONNECTION_STATE),{details:`connectionState: ${el}`}))}(p,{localParticipantId:et,remoteParticipant:Z});if(el.ok)try{let{token:Z,nodeOverride:et}=p;yield el.value.triggerIceRestart({assignmentToken:Z,traceId:_,nodeOverride:et})}catch(p){this.logger.error({msg:"Reassignment failed.",err:p})}else this.trackReassignmentRequestRejected(el.error,_)}),this.onIncompatibleCodecsMessage=p=>ku(this,void 0,void 0,function*(){var _;yield null===(_=this.localParticipant)||void 0===_?void 0:_.onIncompatibleCodecs(p.codecs)});let eu=Zc({connections:{socket:{pingIntervalMs:bt("socketPingMs"),pongTimeoutMs:bt("socketPongMs"),maxConnectRetries:bt("socketConnectMax
6Retries")}},signaling:{forceNode:At(),forceCluster:kt(),eventsUrl:Rt(),disableReassignments:Nt(),disableTokenReuseMessage:yt("disableTokenReuseMessage"),whip:{url:It()},sdp:{xdp:{enabled:void 0!==Ot()?!Ot():void 0,disablePublish:Lt(),disableSubscribe:xt()},multiCodecAnswer:Dt()},ice:{forceProtocol:Mt()}},logging:{level:Ct()},analytics:{appLabel:Tt(),postUrl:function(){let p=_t("analyticsPostUrl");if(void 0!==p)return p}()},auth:{disableValidation:Ut()}}),ed=null===(Z=eu.logging)||void 0===Z?void 0:Z.level;this.logger=new ScopedLogger(new Logger(ed),e0.STAGE),this.strategyWrapper=new StageStrategyWrapper(_,this.logger),this.configManager=new ConfigManager({logger:this.logger.unwrap(),subscribeDefaults:{jitterBuffer:{minDelayWhenPublishing:rs.DEFAULT,minDelayWhenSubscribeOnly:rs.DEFAULT},inBandMessaging:{enabled:!1},simulcast:{initialLayerPreference:t5.LOWEST_QUALITY,layerPollingEnabled:!0,layerPollingIntervalMs:3e3}},videoPublishDefaults:_r(),audioPublishDefaults:yr(),stageDefaults:sr()}),this.configManager.handleStageConfigUpdate(eu,o9.API);let eh=arguments[2];if(void 0!==eh){let p=(p=>{var _,Z,et,el;if(null==p)return tm.err(Error("StageConfiguration is required"));let eu=(0,tm.validateSchema)(p,tk);if(!eu.ok)return tm.err(Error(eu.error));let ed=null===(_=p.connections)||void 0===_?void 0:_.socket;if(void 0!==(null==ed?void 0:ed.pingIntervalMs)&&ed.pingIntervalMs<=0)return tm.err(Error("connections.socket.pingIntervalMs must be > 0"));if(void 0!==(null==ed?void 0:ed.pongTimeoutMs)&&ed.pongTimeoutMs<=0)return tm.err(Error("connections.socket.pongTimeoutMs must be > 0"));if(void 0!==(null==ed?void 0:ed.maxConnectRetries)&&ed.maxConnectRetries<0)return tm.err(Error("connections.socket.maxConnectRetries must be >= 0"));let eh=null===(et=null===(Z=p.signaling)||void 0===Z?void 0:Z.ice)||void 0===et?void 0:et.forceProtocol;return void 0!==eh&&"tcp"!==eh&&"udp"!==eh?tm.err(Error('signaling.ice.forceProtocol must be "tcp", "udp", or undefined')):void 0!==(null===(el=p.analytics)||void 0===el?void 0:el.appLabel)&&p.analytics.appLabel.length>64?tm.err(Error("analytics.appLabel must be <= 64 characters")):tm.ok(p)})(eh);p.ok&&this.configManager.handleStageConfigUpdate(p.value,o9.API,o6.ADDITIVE)}this.analyticsTracker=new AnalyticsTracker(this.configManager.getStageConfigSnapshot()),this.errorManager=new StageErrorManager(this.logger.unwrap());try{this.token=(el=this.analyticsTracker,new StageTokenRefImpl(p,el))}catch(Z){let _=new StageClientError(Object.assign({action:iG.JOIN,token:p,traceId:ns(),tag:n1,location:"Stage.constructor"},n5.MALFORMED_TOKEN));throw Z instanceof Error&&(_.details=Z.message),this.errorManager.handleError(_,iY.JOIN_ERROR)||Z}let ep={customerId:this.token.customerId,sessionId:this.analyticsTracker.getSessionId()};nR.cacheRealTimeContext(ep);let ef=nR.resolveExperimentsForRealTimeContext(ep),eg=this.getRemoteStageConfiguration(ef);eg.ok&&this.configManager.handleStageConfigUpdate(eg.value,o9.REMOTE),this.stageConfig=this.configManager.getStageConfigSnapshot();let ev={token:this.token,logger:this.logger.unwrap(),analyticsTracker:this.analyticsTracker,stageConfig:this.stageConfig};this.stageConnection=this.stageConfig.signaling.connectionImplV2?new StageConnectionV2(ev):new StageConnection(ev),this.setupListeners()}getRemoteStageConfiguration(p){let _=nR.getRemoteStageConfig(Object.assign({customerId:this.token.customerId,sessionId:this.analyticsTracker.getSessionId()},p));return _?tm.ok(_):tm.err("No stage config found")}setupListeners(){this.stageConnection.on(iu,(p,_)=>{this.onConnectionStateChanged(p,_)}),this.stageConnection.on(n6,(p,_)=>{this.onRemoteParticipantJoined(p,_)}),this.stageConnection.on(n8,p=>{this.onRemoteParticipantLeft(p.id)}),this.stageConnection.on(is,p=>{var _;p.id!==(null===(_=this.localParticipant)||void 0===_?void 0:_.info.id)&&this.onRemoteParticipantStateChanged(p)}),this.stageConnection.on(ih,p=>ku(this,void 0,void 0,function*(){yield this.onReassignmentMessage(p)})),this.stageConnection.on(ip,p=>ku(this,void 0,void 0,function*(){yield this.onIncompatibleCodecsMessage(p)})),this.stageConnection.on(ig,p=>
6{this.emit(aM.STAGE_SUBSCRIBER_COUNT_CHANGED,p.count)}),this.stageConnection.on(id,p=>{p instanceof StageClientError&&this.analyticsTracker.trackError(p),this.errorManager.handleError(p,iY.JOIN_ERROR)}),this.errorManager.on(on.ERROR,p=>{this.emit(aM.ERROR,p)})}setupRemoteParticipantStreamEvents(p,_){let Z=_.remote;_.on(aa.ADAPTION_CHANGED,_=>{this.emit(aM.STAGE_STREAM_ADAPTION_CHANGED,p,Z,_)}),_.on(aa.LAYERS_CHANGED,et=>{this.emit(aM.STAGE_STREAM_LAYERS_CHANGED,p,Z,et),this.updateStreamLayerForParticipantInfo(p,[_])}),_.on(aa.LAYER_SELECTED,(_,et)=>{this.emit(aM.STAGE_STREAM_LAYER_SELECTED,p,Z,_,et)}),_.layers.length>0&&(this.emit(aM.STAGE_STREAM_LAYERS_CHANGED,p,Z,Z.getLayers()),this.emit(aM.STAGE_STREAM_LAYER_SELECTED,p,Z,Z.getSelectedLayer(),al.SELECTED))}join(){return ku(this,void 0,void 0,function*(){nR.markSdkUsage(),this.analyticsTracker.start(),this.joinTraceId=ns(),this.analyticsTracker.trackEvent(new JoinEvent({token:this.token,eventEndpoint:this.token.eventsURL,whipEndpoint:this.token.whipURL,traceId:this.joinTraceId}));try{this.token.assertTokenIsUnexpired(ns(),n1,"join")}catch(p){throw this.errorManager.handleError(p,iY.JOIN_ERROR)||p}try{this.joinTraceId=yield this.stageConnection.connect(this.joinTraceId),this.connectionState===oP.CONNECTED&&(this.setupLocalParticipantOnce(),this.updateStreamsToPublishIfNecessary()),window.addEventListener("beforeunload",this.onBeforeUnloadCleanup)}catch(p){throw this.logger.error({err:p,msg:"error joining stage"}),this.errorManager.handleError(p,iY.JOIN_ERROR,!1)||p}})}exchangeToken(p){return ku(this,void 0,void 0,function*(){let _;let Z=new ExchangeTracker(this.analyticsTracker,this.token,this.errorManager).trackExchange(),el=Z.getRequestId(),eu=Z.getTraceId(),ed=Date.now();Z.trackStarted();try{var eh;eh=this.analyticsTracker,_=new StageTokenRefImpl(p,eh)}catch(_){let p=Z.createParseError(_);throw Z.trackValidationFailed(p),p}if(this.token.rawToken===_.rawToken)return void this.logger.warn({msg:"exchangeToken called with identical token"});let ep=((p,_)=>{let Z=[];for(let et of["stageARN","participantID","topic","eventsURL","whipURL","versionFlags"])p[et]!==_[et]&&Z.push(`${et} cannot change during token exchange`);return{valid:0===Z.length,errors:Z}})(this.token,_);if(!ep.valid){let p=Z.createValidationError(ep.errors);throw Z.trackValidationFailed(p),p}let ef=this.token.rawToken;this.latestExchangeRequestId=el;let eg=this.stageConnection.exchangeToken(ef,_.rawToken,el,eu.value);this.applyTokenOptimistically(_);try{yield eg,this.latestExchangeRequestId===el&&Z.trackSucceeded(Date.now()-ed)}catch(p){if(this.latestExchangeRequestId===el){if(Z.trackServerFailed(p,Date.now()-ed),p instanceof StageClientError){let _=this.errorManager.handleError(p,iY.JOIN_ERROR);throw this.cleanup(et.FAILED_EXCHANGE),null!=_?_:p}throw this.cleanup(et.FAILED_EXCHANGE),p}}})}applyTokenOptimistically(p){let{userIdChanged:_,attributesChanged:Z}=Xs(this.token.userID,this.token.claims.attributes,p.userID,p.claims.attributes);this.token.update(p),this.localParticipant&&(this.localParticipant.info=du({token:this.token,videoStopped:this.localParticipant.videoStopped,audioMuted:this.localParticipant.audioMuted,isPublishing:this.localParticipant.publishState===am.PUBLISHED})),this.handleCapabilityChanges(p),this.localParticipant&&(_||Z)&&this.emit(aM.STAGE_PARTICIPANT_METADATA_CHANGED,this.localParticipant.info),this.refreshStrategy()}handleCapabilityChanges(p){var _,Z,et,el;let eu=null!==(Z=null===(_=p.claims.capabilities)||void 0===_?void 0:_.allow_publish)&&void 0!==Z&&Z,ed=null!==(el=null===(et=p.claims.capabilities)||void 0===et?void 0:et.allow_subscribe)&&void 0!==el&⪙if(!eu&&this.localParticipant&&this.localParticipant.unpublish(),!ed)for(let p of this.participants.values())p.unsubscribe()}replaceStrategy(p){this.strategyWrapper.setStrategy(p),this.refreshStrategy()}getInternalSubscribeOverrides(){let p=this.strategyWrapper.hasStrategy("preferredLayerForStream"),_=this.hasListenersFor(aM.STAGE_STREAM_LAYERS_CHANGED)||this.hasListenersFor(aM.STAGE_STREAM_ADAPTION_CHANGED)||this.hasListenersFor(aM.STAGE_STREAM_LAYER_SELECTED);return{simulcast:{layerPollingEnabled:p||_}}}updateStreamLayerForParticipantInfo(p,_){_.forEach(_=>{if("audio"===_.streamType)return;let Z=this.strategyWrapper.preferredLayerForStream(p,_.remote),et=tm.getOk_or(Z,void 0);_.setLayer(et)})}trackReassignmentRequestRejected(p,_){let{token:Z}=this,et=new StageClientError(Object.assign(Object.assign({},p),{token:Z,action:iG.JOIN,traceId:_,tag:n3,location:"publish"}));this.logger.error({err:et,msg:"Reassignment request rejected."}),this.analyticsTracker.trackError(et)}trackReassignmentRequest(p,_){let{token:Z}=this;this.analyticsTracker.trackEvent(new ReassignmentRequestEvent({token:Z,traceId:_,targetLocalParticipantId:p.participantId,targetRemoteParticipantId:p.remoteParticipantId}))}};(_=et||(et={})).UNKNOWN="unknown",_.USER_INITIATED="user-initiated",_.TOKEN_REUSED="token-reused",_.PARTICIPANT_DISCONNECTED="participant-disconnected",_.STAGE_DELETED="stage-deleted",_.FAILED_EXCHANGE="failed-exchange";let aL=ef})(),Z})()}}]);
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.