@flowplayer/player 3.9.0 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/plugins/rts.js CHANGED
@@ -1,7 +1,7 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),n=(n,...i)=>{try{const o=(null==t?void 0:t.debug)||r;o&&e.match(o)&&console.log(`flowplayer/${e} -- ${n}`,...i)}catch(e){console.warn(e)}};return n.log=n,n}function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}var i=r,o=n;function s(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}"function"==typeof e.setTimeout&&(i=setTimeout),"function"==typeof e.clearTimeout&&(o=clearTimeout);var a,c=[],u=!1,l=-1;function d(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(d);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===n||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){this.fun.apply(null,this.array)};function h(){}var m=h,g=h,v=h,y=h,w=h,E=h,T=h;var I=e.performance||{},R=I.now||I.mozNow||I.msNow||I.oNow||I.webkitNow||function(){return(new Date).getTime()};var P=new Date;var k={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||u||s(f)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:m,addListener:g,once:v,off:y,removeListener:w,removeAllListeners:E,emit:T,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*R.call(I),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-P)/1e3}};function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function L(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function D(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){L(o,n,i,s,a,"next",e)}function a(e){L(o,n,i,s,a,"throw",e)}s(void 0)}))}}function M(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return _(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function B(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=j(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function V(e){var t={exports:{}};return e(t,t.exports),t.exports}var F,z,G=function(e){return e&&e.Math==Math&&e},W=G("object"==typeof globalThis&&globalThis)||G("object"==typeof window&&window)||G("object"==typeof self&&self)||G("object"==typeof U&&U)||function(){return this}()||Function("return this")(),q=function(e){try{return!!e()}catch(e){return!0}},H=!q((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),X=!q((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Y=Function.prototype.call,J=X?Y.bind(Y):function(){return Y.apply(Y,arguments)},K={}.propertyIsEnumerable,Z=Object.getOwnPropertyDescriptor,Q={f:Z&&!K.call({1:2},1)?function(e){var t=Z(this,e);return!!t&&t.enumerable}:K},ee=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},te=Function.prototype,re=te.call,ne=X&&te.bind.bind(re,re),ie=X?ne:function(e){return function(){return re.apply(e,arguments)}},oe=ie({}.toString),se=ie("".slice),ae=function(e){return se(oe(e),8,-1)},ce=Object,ue=ie("".split),le=q((function(){return!ce("z").propertyIsEnumerable(0)}))?function(e){return"String"==ae(e)?ue(e,""):ce(e)}:ce,de=function(e){return null==e},fe=TypeError,pe=function(e){if(de(e))throw fe("Can't call method on "+e);return e},he=function(e){return le(pe(e))},me="object"==typeof document&&document.all,ge={all:me,IS_HTMLDDA:void 0===me&&void 0!==me},ve=ge.all,ye=ge.IS_HTMLDDA?function(e){return"function"==typeof e||e===ve}:function(e){return"function"==typeof e},we=ge.all,be=ge.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ye(e)||e===we}:function(e){return"object"==typeof e?null!==e:ye(e)},Se=function(e){return ye(e)?e:void 0},Ce=function(e,t){return arguments.length<2?Se(W[e]):W[e]&&W[e][t]},xe=ie({}.isPrototypeOf),Ee=Ce("navigator","userAgent")||"",Te=W.process,Ie=W.Deno,Re=Te&&Te.versions||Ie&&Ie.version,Pe=Re&&Re.v8;Pe&&(z=(F=Pe.split("."))[0]>0&&F[0]<4?1:+(F[0]+F[1])),!z&&Ee&&(!(F=Ee.match(/Edge\/(\d+)/))||F[1]>=74)&&(F=Ee.match(/Chrome\/(\d+)/))&&(z=+F[1]);var ke=z,Ae=!!Object.getOwnPropertySymbols&&!q((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ke&&ke<41})),Oe=Ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Le=Object,De=Oe?function(e){return"symbol"==typeof e}:function(e){var t=Ce("Symbol");return ye(t)&&xe(t.prototype,Le(e))},Me=String,Ne=function(e){try{return Me(e)}catch(e){return"Object"}},je=TypeError,_e=function(e){if(ye(e))return e;throw je(Ne(e)+" is not a function")},Be=function(e,t){var r=e[t];return de(r)?void 0:_e(r)},Ue=TypeError,Ve=Object.defineProperty,Fe=function(e,t){try{Ve(W,e,{value:t,configurable:!0,writable:!0})}catch(r){W[e]=t}return t},ze="__core-js_shared__",$e=W[ze]||Fe(ze,{}),Ge=V((function(e){(e.exports=function(e,t){return $e[e]||($e[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),We=Object,qe=function(e){return We(pe(e))},He=ie({}.hasOwnProperty),Xe=Object.hasOwn||function(e,t){return He(qe(e),t)},Ye=0,Je=Math.random(),Ke=ie(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ke(++Ye+Je,36)},Qe=Ge("wks"),et=W.Symbol,tt=et&&et.for,rt=Oe?et:et&&et.withoutSetter||Ze,nt=function(e){if(!Xe(Qe,e)||!Ae&&"string"!=typeof Qe[e]){var t="Symbol."+e;Ae&&Xe(et,e)?Qe[e]=et[e]:Qe[e]=Oe&&tt?tt(t):rt(t)}return Qe[e]},it=TypeError,ot=nt("toPrimitive"),st=function(e){var t=function(e,t){if(!be(e)||De(e))return e;var r,n=Be(e,ot);if(n){if(void 0===t&&(t="default"),r=J(n,e,t),!be(r)||De(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var r,n;if("string"===t&&ye(r=e.toString)&&!be(n=J(r,e)))return n;if(ye(r=e.valueOf)&&!be(n=J(r,e)))return n;if("string"!==t&&ye(r=e.toString)&&!be(n=J(r,e)))return n;throw Ue("Can't convert object to primitive value")}(e,t)}(e,"string");return De(t)?t:t+""},at=W.document,ct=be(at)&&be(at.createElement),ut=function(e){return ct?at.createElement(e):{}},lt=!H&&!q((function(){return 7!=Object.defineProperty(ut("div"),"a",{get:function(){return 7}}).a})),dt=Object.getOwnPropertyDescriptor,ft={f:H?dt:function(e,t){if(e=he(e),t=st(t),lt)try{return dt(e,t)}catch(e){}if(Xe(e,t))return ee(!J(Q.f,e,t),e[t])}},pt=H&&q((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ht=String,mt=TypeError,gt=function(e){if(be(e))return e;throw mt(ht(e)+" is not an object")},vt=TypeError,yt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,bt="enumerable",St="configurable",Ct="writable",xt={f:H?pt?function(e,t,r){if(gt(e),t=st(t),gt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ct in r&&!r[Ct]){var n=wt(e,t);n&&n[Ct]&&(e[t]=r.value,r={configurable:St in r?r[St]:n[St],enumerable:bt in r?r[bt]:n[bt],writable:!1})}return yt(e,t,r)}:yt:function(e,t,r){if(gt(e),t=st(t),gt(r),lt)try{return yt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw vt("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},Et=H?function(e,t,r){return xt.f(e,t,ee(1,r))}:function(e,t,r){return e[t]=r,e},Tt=Function.prototype,It=H&&Object.getOwnPropertyDescriptor,Rt=Xe(Tt,"name"),Pt={EXISTS:Rt,PROPER:Rt&&"something"===function(){}.name,CONFIGURABLE:Rt&&(!H||H&&It(Tt,"name").configurable)},kt=ie(Function.toString);ye($e.inspectSource)||($e.inspectSource=function(e){return kt(e)});var At,Ot,Lt,Dt=$e.inspectSource,Mt=W.WeakMap,Nt=ye(Mt)&&/native code/.test(String(Mt)),jt=Ge("keys"),_t=function(e){return jt[e]||(jt[e]=Ze(e))},Bt={},Ut="Object already initialized",Vt=W.TypeError,Ft=W.WeakMap;if(Nt||$e.state){var zt=$e.state||($e.state=new Ft);zt.get=zt.get,zt.has=zt.has,zt.set=zt.set,At=function(e,t){if(zt.has(e))throw Vt(Ut);return t.facade=e,zt.set(e,t),t},Ot=function(e){return zt.get(e)||{}},Lt=function(e){return zt.has(e)}}else{var $t=_t("state");Bt[$t]=!0,At=function(e,t){if(Xe(e,$t))throw Vt(Ut);return t.facade=e,Et(e,$t,t),t},Ot=function(e){return Xe(e,$t)?e[$t]:{}},Lt=function(e){return Xe(e,$t)}}var Gt={set:At,get:Ot,has:Lt,enforce:function(e){return Lt(e)?Ot(e):At(e,{})},getterFor:function(e){return function(t){var r;if(!be(t)||(r=Ot(t)).type!==e)throw Vt("Incompatible receiver, "+e+" required");return r}}},Wt=V((function(e){var t=Pt.CONFIGURABLE,r=Gt.enforce,n=Gt.get,i=Object.defineProperty,o=H&&!q((function(){return 8!==i((function(){}),"length",{value:8}).length})),s=String(String).split("String"),a=e.exports=function(e,n,a){"Symbol("===String(n).slice(0,7)&&(n="["+String(n).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),a&&a.getter&&(n="get "+n),a&&a.setter&&(n="set "+n),(!Xe(e,"name")||t&&e.name!==n)&&(H?i(e,"name",{value:n,configurable:!0}):e.name=n),o&&a&&Xe(a,"arity")&&e.length!==a.arity&&i(e,"length",{value:a.arity});try{a&&Xe(a,"constructor")&&a.constructor?H&&i(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var c=r(e);return Xe(c,"source")||(c.source=s.join("string"==typeof n?n:"")),e};Function.prototype.toString=a((function(){return ye(this)&&n(this).source||Dt(this)}),"toString")})),qt=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(ye(r)&&Wt(r,o,n),n.global)i?e[t]=r:Fe(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:xt.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Ht=Math.ceil,Xt=Math.floor,Yt=Math.trunc||function(e){var t=+e;return(t>0?Xt:Ht)(t)},Jt=function(e){var t=+e;return t!=t||0===t?0:Yt(t)},Kt=Math.max,Zt=Math.min,Qt=function(e,t){var r=Jt(e);return r<0?Kt(r+t,0):Zt(r,t)},er=Math.min,tr=function(e){return e>0?er(Jt(e),9007199254740991):0},rr=function(e){return tr(e.length)},nr=function(e){return function(t,r,n){var i,o=he(t),s=rr(o),a=Qt(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},ir={includes:nr(!0),indexOf:nr(!1)},or=ir.indexOf,sr=ie([].push),ar=function(e,t){var r,n=he(e),i=0,o=[];for(r in n)!Xe(Bt,r)&&Xe(n,r)&&sr(o,r);for(;t.length>i;)Xe(n,r=t[i++])&&(~or(o,r)||sr(o,r));return o},cr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ur=cr.concat("length","prototype"),lr={f:Object.getOwnPropertyNames||function(e){return ar(e,ur)}},dr={f:Object.getOwnPropertySymbols},fr=ie([].concat),pr=Ce("Reflect","ownKeys")||function(e){var t=lr.f(gt(e)),r=dr.f;return r?fr(t,r(e)):t},hr=function(e,t,r){for(var n=pr(t),i=xt.f,o=ft.f,s=0;s<n.length;s++){var a=n[s];Xe(e,a)||r&&Xe(r,a)||i(e,a,o(t,a))}},mr=/#|\.prototype\./,gr=function(e,t){var r=yr[vr(e)];return r==br||r!=wr&&(ye(t)?q(t):!!t)},vr=gr.normalize=function(e){return String(e).replace(mr,".").toLowerCase()},yr=gr.data={},wr=gr.NATIVE="N",br=gr.POLYFILL="P",Sr=gr,Cr=ft.f,xr=function(e,t){var r,n,i,o,s,a=e.target,c=e.global,u=e.stat;if(r=c?W:u?W[a]||Fe(a,{}):(W[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=Cr(r,n))&&s.value:r[n],!Sr(c?n:a+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;hr(o,i)}(e.sham||i&&i.sham)&&Et(o,"sham",!0),qt(r,n,o,e)}},Er=Array.isArray||function(e){return"Array"==ae(e)},Tr=TypeError,Ir=function(e){if(e>9007199254740991)throw Tr("Maximum allowed index exceeded");return e},Rr=function(e,t,r){var n=st(t);n in e?xt.f(e,n,ee(0,r)):e[n]=r},Pr={};Pr[nt("toStringTag")]="z";var kr="[object z]"===String(Pr),Ar=nt("toStringTag"),Or=Object,Lr="Arguments"==ae(function(){return arguments}()),Dr=kr?ae:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Or(e),Ar))?r:Lr?ae(t):"Object"==(n=ae(t))&&ye(t.callee)?"Arguments":n},Mr=function(){},Nr=[],jr=Ce("Reflect","construct"),_r=/^\s*(?:class|function)\b/,Br=ie(_r.exec),Ur=!_r.exec(Mr),Vr=function(e){if(!ye(e))return!1;try{return jr(Mr,Nr,e),!0}catch(e){return!1}},Fr=function(e){if(!ye(e))return!1;switch(Dr(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ur||!!Br(_r,Dt(e))}catch(e){return!0}};Fr.sham=!0;var zr=!jr||q((function(){var e;return Vr(Vr.call)||!Vr(Object)||!Vr((function(){e=!0}))||e}))?Fr:Vr,$r=nt("species"),Gr=Array,Wr=function(e,t){return new(function(e){var t;return Er(e)&&(t=e.constructor,(zr(t)&&(t===Gr||Er(t.prototype))||be(t)&&null===(t=t[$r]))&&(t=void 0)),void 0===t?Gr:t}(e))(0===t?0:t)},qr=nt("species"),Hr=function(e){return ke>=51||!q((function(){var t=[];return(t.constructor={})[qr]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xr=nt("isConcatSpreadable"),Yr=ke>=51||!q((function(){var e=[];return e[Xr]=!1,e.concat()[0]!==e})),Jr=Hr("concat"),Kr=function(e){if(!be(e))return!1;var t=e[Xr];return void 0!==t?!!t:Er(e)};xr({target:"Array",proto:!0,arity:1,forced:!Yr||!Jr},{concat:function(e){var t,r,n,i,o,s=qe(this),a=Wr(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Kr(o=-1===t?s:arguments[t]))for(i=rr(o),Ir(c+i),r=0;r<i;r++,c++)r in o&&Rr(a,c,o[r]);else Ir(c+1),Rr(a,c++,o);return a.length=c,a}});var Zr=ie([].slice),Qr=Hr("slice"),en=nt("species"),tn=Array,rn=Math.max;xr({target:"Array",proto:!0,forced:!Qr},{slice:function(e,t){var r,n,i,o=he(this),s=rr(o),a=Qt(e,s),c=Qt(void 0===t?s:t,s);if(Er(o)&&(r=o.constructor,(zr(r)&&(r===tn||Er(r.prototype))||be(r)&&null===(r=r[en]))&&(r=void 0),r===tn||void 0===r))return Zr(o,a,c);for(n=new(void 0===r?tn:r)(rn(c-a,0)),i=0;a<c;a++,i++)a in o&&Rr(n,i,o[a]);return n.length=i,n}});var nn=function(e){if("Function"===ae(e))return ie(e)},on=nn(nn.bind),sn=function(e,t){return _e(e),void 0===t?e:X?on(e,t):function(){return e.apply(t,arguments)}},an=ie([].push),cn=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,u,l,d){for(var f,p,h=qe(c),m=le(h),g=sn(u,l),v=rr(m),y=0,w=d||Wr,E=t?w(c,v):r||s?w(c,0):void 0;v>y;y++)if((a||y in m)&&(p=g(f=m[y],y,h),e))if(t)E[y]=p;else if(p)switch(e){case 3:return!0;case 5:return f;case 6:return y;case 2:an(E,f)}else switch(e){case 4:return!1;case 7:an(E,f)}return o?-1:n||i?i:E}},un={forEach:cn(0),map:cn(1),filter:cn(2),some:cn(3),every:cn(4),find:cn(5),findIndex:cn(6),filterReject:cn(7)},ln=un.map,dn=Hr("map");xr({target:"Array",proto:!0,forced:!dn},{map:function(e){return ln(this,e,arguments.length>1?arguments[1]:void 0)}});var fn=Function.prototype,pn=fn.apply,hn=fn.call,mn="object"==typeof Reflect&&Reflect.apply||(X?hn.bind(pn):function(){return hn.apply(pn,arguments)}),gn=Ce("JSON","stringify"),vn=ie(/./.exec),yn=ie("".charAt),wn=ie("".charCodeAt),bn=ie("".replace),Sn=ie(1..toString),Cn=/[\uD800-\uDFFF]/g,xn=/^[\uD800-\uDBFF]$/,En=/^[\uDC00-\uDFFF]$/,Tn=!Ae||q((function(){var e=Ce("Symbol")();return"[null]"!=gn([e])||"{}"!=gn({a:e})||"{}"!=gn(Object(e))})),In=q((function(){return'"\\udf06\\ud834"'!==gn("\udf06\ud834")||'"\\udead"'!==gn("\udead")})),Rn=function(e,t){var r=Zr(arguments),n=t;if((be(t)||void 0!==e)&&!De(e))return Er(t)||(t=function(e,t){if(ye(n)&&(t=J(n,this,e,t)),!De(t))return t}),r[1]=t,mn(gn,null,r)},Pn=function(e,t,r){var n=yn(r,t-1),i=yn(r,t+1);return vn(xn,e)&&!vn(En,i)||vn(En,e)&&!vn(xn,n)?"\\u"+Sn(wn(e,0),16):e};gn&&xr({target:"JSON",stat:!0,arity:3,forced:Tn||In},{stringify:function(e,t,r){var n=Zr(arguments),i=mn(Tn?Rn:gn,null,n);return In&&"string"==typeof i?bn(i,Cn,Pn):i}});var kn=V((function(e){!function(t){var r,n={VERSION:"1.6.1"},i={},o=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},a=function(e,t){return{value:e,name:t}};n.TRACE=a(1,"TRACE"),n.DEBUG=a(2,"DEBUG"),n.INFO=a(3,"INFO"),n.TIME=a(4,"TIME"),n.WARN=a(5,"WARN"),n.ERROR=a(8,"ERROR"),n.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,s({level:e},this.context))}};var u,l=new c({filterLevel:n.OFF});(u=n).enabledFor=o(l,l.enabledFor),u.trace=o(l,l.trace),u.debug=o(l,l.debug),u.time=o(l,l.time),u.timeEnd=o(l,l.timeEnd),u.info=o(l,l.info),u.warn=o(l,l.warn),u.error=o(l,l.error),u.log=u.info,n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in l.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return l.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(s({name:e},l.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var s,a=console.log;o.level===n.TIME?(s=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):r(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(o.level===n.WARN&&console.warn?a=console.warn:o.level===n.ERROR&&console.error?a=console.error:o.level===n.INFO&&console.info?a=console.info:o.level===n.DEBUG&&console.debug?a=console.debug:o.level===n.TRACE&&console.trace&&(a=console.trace),e.formatter(i,o),r(a,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(U)}));kn.useDefaults({defaultLevel:kn.TRACE});const An=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},On=(e,t)=>t?e.value>=jn[t].value:e.value>=Nn.value,Ln=kn.createDefaultHandler({formatter:An});kn.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),An(e,t),0!==Dn?(Mn.push(e.join(" ")),Mn.length>=Dn&&(Mn=Mn.slice(-Dn))):Mn=[]})(e,t),On(t.level,t.name)&&Ln(e,t);var r,n=B(_n);try{for(n.s();!(r=n.n()).done;){const n=r.value,i=n.handler,o=n.level;t.level.value>=o.value&&i(e,t)}}catch(e){n.e(e)}finally{n.f()}});let Dn=1e4,Mn=[],Nn=kn.OFF;const jn={},_n=[],Bn=O(O({},kn),{},{enabledFor:On,getHistory:()=>Mn,getHistoryMaxSize:()=>Dn,setHistoryMaxSize:e=>{Dn=e},setLevel:e=>{Nn=e;for(const t in jn)jn[t]=e},getLevel:()=>Nn,get:e=>{jn[e]||(jn[e]=Nn);const t=kn.get(e);return t.setLevel=t=>{jn[e]=t},t.getLevel=()=>jn[e],t},setHandler:(e,t)=>{_n.push({handler:e,level:t})}});var Un,Vn,Fn,zn,$n="process"==ae(W.process),Gn=String,Wn=TypeError,qn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ie(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return gt(r),function(e){if("object"==typeof e||ye(e))return e;throw Wn("Can't set "+Gn(e)+" as a prototype")}(n),t?e(r,n):r.__proto__=n,r}}():void 0),Hn=xt.f,Xn=nt("toStringTag"),Yn=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Xe(e,Xn)&&Hn(e,Xn,{configurable:!0,value:t})},Jn=nt("species"),Kn=function(e){var t=Ce(e),r=xt.f;H&&t&&!t[Jn]&&r(t,Jn,{configurable:!0,get:function(){return this}})},Zn=TypeError,Qn=function(e,t){if(xe(t,e))return e;throw Zn("Incorrect invocation")},ei=TypeError,ti=nt("species"),ri=function(e,t){var r,n=gt(e).constructor;return void 0===n||de(r=gt(n)[ti])?t:function(e){if(zr(e))return e;throw ei(Ne(e)+" is not a constructor")}(r)},ni=Ce("document","documentElement"),ii=TypeError,oi=function(e,t){if(e<t)throw ii("Not enough arguments");return e},si=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ee),ai=W.setImmediate,ci=W.clearImmediate,ui=W.process,li=W.Dispatch,di=W.Function,fi=W.MessageChannel,pi=W.String,hi=0,mi={},gi="onreadystatechange";try{Un=W.location}catch(Lf){}var vi=function(e){if(Xe(mi,e)){var t=mi[e];delete mi[e],t()}},yi=function(e){return function(){vi(e)}},wi=function(e){vi(e.data)},bi=function(e){W.postMessage(pi(e),Un.protocol+"//"+Un.host)};ai&&ci||(ai=function(e){oi(arguments.length,1);var t=ye(e)?e:di(e),r=Zr(arguments,1);return mi[++hi]=function(){mn(t,void 0,r)},Vn(hi),hi},ci=function(e){delete mi[e]},$n?Vn=function(e){ui.nextTick(yi(e))}:li&&li.now?Vn=function(e){li.now(yi(e))}:fi&&!si?(zn=(Fn=new fi).port2,Fn.port1.onmessage=wi,Vn=sn(zn.postMessage,zn)):W.addEventListener&&ye(W.postMessage)&&!W.importScripts&&Un&&"file:"!==Un.protocol&&!q(bi)?(Vn=bi,W.addEventListener("message",wi,!1)):Vn=gi in ut("script")?function(e){ni.appendChild(ut("script"))[gi]=function(){ni.removeChild(this),vi(e)}}:function(e){setTimeout(yi(e),0)});var Si,Ci,xi,Ei,Ti,Ii,Ri,Pi,ki={set:ai,clear:ci},Ai=/ipad|iphone|ipod/i.test(Ee)&&void 0!==W.Pebble,Oi=/web0s(?!.*chrome)/i.test(Ee),Li=ft.f,Di=ki.set,Mi=W.MutationObserver||W.WebKitMutationObserver,Ni=W.document,ji=W.process,_i=W.Promise,Bi=Li(W,"queueMicrotask"),Ui=Bi&&Bi.value;Ui||(Si=function(){var e,t;for($n&&(e=ji.domain)&&e.exit();Ci;){t=Ci.fn,Ci=Ci.next;try{t()}catch(e){throw Ci?Ei():xi=void 0,e}}xi=void 0,e&&e.enter()},si||$n||Oi||!Mi||!Ni?!Ai&&_i&&_i.resolve?((Ri=_i.resolve(void 0)).constructor=_i,Pi=sn(Ri.then,Ri),Ei=function(){Pi(Si)}):$n?Ei=function(){ji.nextTick(Si)}:(Di=sn(Di,W),Ei=function(){Di(Si)}):(Ti=!0,Ii=Ni.createTextNode(""),new Mi(Si).observe(Ii,{characterData:!0}),Ei=function(){Ii.data=Ti=!Ti}));var Vi=Ui||function(e){var t={fn:e,next:void 0};xi&&(xi.next=t),Ci||(Ci=t,Ei()),xi=t},Fi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},zi=function(){this.head=null,this.tail=null};zi.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var $i=zi,Gi=W.Promise,Wi="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,qi=!Wi&&!$n&&"object"==typeof window&&"object"==typeof document;Gi&&Gi.prototype;var Hi,Xi,Yi,Ji=nt("species"),Ki=!1,Zi=ye(W.PromiseRejectionEvent),Qi={CONSTRUCTOR:Sr("Promise",(function(){var e=Dt(Gi),t=e!==String(Gi);if(!t&&66===ke)return!0;if(!ke||ke<51||!/native code/.test(e)){var r=new Gi((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Ji]=n,!(Ki=r.then((function(){}))instanceof n))return!0}return!t&&(qi||Wi)&&!Zi})),REJECTION_EVENT:Zi,SUBCLASSING:Ki},eo=TypeError,to=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw eo("Bad Promise constructor");t=e,r=n})),this.resolve=_e(t),this.reject=_e(r)},ro={f:function(e){return new to(e)}},no=ki.set,io="Promise",oo=Qi.CONSTRUCTOR,so=Qi.REJECTION_EVENT,ao=Qi.SUBCLASSING,co=Gt.getterFor(io),uo=Gt.set,lo=Gi&&Gi.prototype,fo=Gi,po=lo,ho=W.TypeError,mo=W.document,go=W.process,vo=ro.f,yo=vo,wo=!!(mo&&mo.createEvent&&W.dispatchEvent),bo="unhandledrejection",So=function(e){var t;return!(!be(e)||!ye(t=e.then))&&t},Co=function(e,t){var r,n,i,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{a?(s||(2===t.rejection&&Ro(t),t.rejection=1),!0===a?r=o:(l&&l.enter(),r=a(o),l&&(l.exit(),i=!0)),r===e.promise?u(ho("Promise-chain cycle")):(n=So(r))?J(n,r,c,u):c(r)):u(o)}catch(e){l&&!i&&l.exit(),u(e)}},xo=function(e,t){e.notified||(e.notified=!0,Vi((function(){for(var r,n=e.reactions;r=n.get();)Co(r,e);e.notified=!1,t&&!e.rejection&&To(e)})))},Eo=function(e,t,r){var n,i;wo?((n=mo.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),W.dispatchEvent(n)):n={promise:t,reason:r},!so&&(i=W["on"+e])?i(n):e===bo&&function(e,t){var r=W.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}("Unhandled promise rejection",r)},To=function(e){J(no,W,(function(){var t,r=e.facade,n=e.value;if(Io(e)&&(t=Fi((function(){$n?go.emit("unhandledRejection",n,r):Eo(bo,r,n)})),e.rejection=$n||Io(e)?2:1,t.error))throw t.value}))},Io=function(e){return 1!==e.rejection&&!e.parent},Ro=function(e){J(no,W,(function(){var t=e.facade;$n?go.emit("rejectionHandled",t):Eo("rejectionhandled",t,e.value)}))},Po=function(e,t,r){return function(n){e(t,n,r)}},ko=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,xo(e,!0))},Ao=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw ho("Promise can't be resolved itself");var n=So(t);n?Vi((function(){var r={done:!1};try{J(n,t,Po(Ao,r,e),Po(ko,r,e))}catch(t){ko(r,t,e)}})):(e.value=t,e.state=1,xo(e,!1))}catch(t){ko({done:!1},t,e)}}};if(oo&&(po=(fo=function(e){Qn(this,po),_e(e),J(Hi,this);var t=co(this);try{e(Po(Ao,t),Po(ko,t))}catch(e){ko(t,e)}}).prototype,(Hi=function(e){uo(this,{type:io,done:!1,notified:!1,parent:!1,reactions:new $i,rejection:!1,state:0,value:void 0})}).prototype=qt(po,"then",(function(e,t){var r=co(this),n=vo(ri(this,fo));return r.parent=!0,n.ok=!ye(e)||e,n.fail=ye(t)&&t,n.domain=$n?go.domain:void 0,0==r.state?r.reactions.add(n):Vi((function(){Co(n,r)})),n.promise})),Xi=function(){var e=new Hi,t=co(e);this.promise=e,this.resolve=Po(Ao,t),this.reject=Po(ko,t)},ro.f=vo=function(e){return e===fo||void 0===e?new Xi(e):yo(e)},ye(Gi)&&lo!==Object.prototype)){Yi=lo.then,ao||qt(lo,"then",(function(e,t){var r=this;return new fo((function(e,t){J(Yi,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete lo.constructor}catch(Lf){}qn&&qn(lo,po)}xr({global:!0,constructor:!0,wrap:!0,forced:oo},{Promise:fo}),Yn(fo,io,!1),Kn(io);var Oo={},Lo=nt("iterator"),Do=Array.prototype,Mo=function(e){return void 0!==e&&(Oo.Array===e||Do[Lo]===e)},No=nt("iterator"),jo=function(e){if(!de(e))return Be(e,No)||Be(e,"@@iterator")||Oo[Dr(e)]},_o=TypeError,Bo=function(e,t){var r=arguments.length<2?jo(e):t;if(_e(r))return gt(J(r,e));throw _o(Ne(e)+" is not iterable")},Uo=function(e,t,r){var n,i;gt(e);try{if(!(n=Be(e,"return"))){if("throw"===t)throw r;return r}n=J(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return gt(n),r},Vo=TypeError,Fo=function(e,t){this.stopped=e,this.result=t},zo=Fo.prototype,$o=function(e,t,r){var n,i,o,s,a,c,u,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),h=!(!r||!r.INTERRUPTED),m=sn(t,l),g=function(e){return n&&Uo(n,"normal",e),new Fo(!0,e)},v=function(e){return d?(gt(e),h?m(e[0],e[1],g):m(e[0],e[1])):h?m(e,g):m(e)};if(f)n=e.iterator;else if(p)n=e;else{if(!(i=jo(e)))throw Vo(Ne(e)+" is not iterable");if(Mo(i)){for(o=0,s=rr(e);s>o;o++)if((a=v(e[o]))&&xe(zo,a))return a;return new Fo(!1)}n=Bo(e,i)}for(c=f?e.next:n.next;!(u=J(c,n)).done;){try{a=v(u.value)}catch(e){Uo(n,"throw",e)}if("object"==typeof a&&a&&xe(zo,a))return a}return new Fo(!1)},Go=nt("iterator"),Wo=!1;try{var qo=0,Ho={next:function(){return{done:!!qo++}},return:function(){Wo=!0}};Ho[Go]=function(){return this},Array.from(Ho,(function(){throw 2}))}catch(Lf){}var Xo=function(e,t){if(!t&&!Wo)return!1;var r=!1;try{var n={};n[Go]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Yo=Qi.CONSTRUCTOR||!Xo((function(e){Gi.all(e).then(void 0,(function(){}))}));xr({target:"Promise",stat:!0,forced:Yo},{all:function(e){var t=this,r=ro.f(t),n=r.resolve,i=r.reject,o=Fi((function(){var r=_e(t.resolve),o=[],s=0,a=1;$o(e,(function(e){var c=s++,u=!1;a++,J(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var Jo=Qi.CONSTRUCTOR,Ko=Gi&&Gi.prototype;if(xr({target:"Promise",proto:!0,forced:Jo,real:!0},{catch:function(e){return this.then(void 0,e)}}),ye(Gi)){var Zo=Ce("Promise").prototype.catch;Ko.catch!==Zo&&qt(Ko,"catch",Zo,{unsafe:!0})}xr({target:"Promise",stat:!0,forced:Yo},{race:function(e){var t=this,r=ro.f(t),n=r.reject,i=Fi((function(){var i=_e(t.resolve);$o(e,(function(e){J(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}}),xr({target:"Promise",stat:!0,forced:Qi.CONSTRUCTOR},{reject:function(e){var t=ro.f(this);return J(t.reject,void 0,e),t.promise}});var Qo=Qi.CONSTRUCTOR;Ce("Promise"),xr({target:"Promise",stat:!0,forced:Qo},{resolve:function(e){return function(e,t){if(gt(e),be(t)&&t.constructor===e)return t;var r=ro.f(e);return(0,r.resolve)(t),r.promise}(this,e)}});var es=xt.f,ts=function(e,t,r){r in e||es(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},rs=function(e,t,r){var n,i;return qn&&ye(n=t.constructor)&&n!==r&&be(i=n.prototype)&&i!==r.prototype&&qn(e,i),e},ns=String,is=function(e){if("Symbol"===Dr(e))throw TypeError("Cannot convert a Symbol value to a string");return ns(e)},os=function(e,t){return void 0===e?arguments.length<2?"":t:is(e)},ss=function(e,t){be(t)&&"cause"in t&&Et(e,"cause",t.cause)},as=Error,cs=ie("".replace),us=String(as("zxcasd").stack),ls=/\n\s*at [^:]*:[^\n]*/,ds=ls.test(us),fs=function(e,t){if(ds&&"string"==typeof e&&!as.prepareStackTrace)for(;t--;)e=cs(e,ls,"");return e},ps=!q((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",ee(1,7)),7!==e.stack)})),hs=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],c=Ce.apply(null,s);if(c){var u=c.prototype;if(Xe(u,"cause")&&delete u.cause,!r)return c;var l=Ce("Error"),d=t((function(e,t){var r=os(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&Et(i,"message",r),ps&&Et(i,"stack",fs(i.stack,2)),this&&xe(u,this)&&rs(i,this,d),arguments.length>o&&ss(i,arguments[o]),i}));d.prototype=u,"Error"!==a?qn?qn(d,l):hr(d,l,{name:!0}):H&&i in c&&(ts(d,c,i),ts(d,c,"prepareStackTrace")),hr(d,c);try{u.name!==a&&Et(u,"name",a),u.constructor=d}catch(e){}return d}},ms="WebAssembly",gs=W[ms],vs=7!==Error("e",{cause:7}).cause,ys=function(e,t){var r={};r[e]=hs(e,t,vs),xr({global:!0,constructor:!0,arity:1,forced:vs},r)},ws=function(e,t){if(gs&&gs[e]){var r={};r[e]=hs(ms+"."+e,t,vs),xr({target:ms,stat:!0,constructor:!0,arity:1,forced:vs},r)}};ys("Error",(function(e){return function(t){return mn(e,this,arguments)}})),ys("EvalError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("RangeError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("ReferenceError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("SyntaxError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("TypeError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("URIError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("CompileError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("LinkError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("RuntimeError",(function(e){return function(t){return mn(e,this,arguments)}}));var bs=nt("match"),Ss=function(e){var t;return be(e)&&(void 0!==(t=e[bs])?!!t:"RegExp"==ae(e))},Cs=function(){var e=gt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},xs=RegExp.prototype,Es=function(e){var t=e.flags;return void 0!==t||"flags"in xs||Xe(e,"flags")||!xe(xs,e)?t:J(Cs,e)},Ts=W.RegExp,Is=q((function(){var e=Ts("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Rs=Is||q((function(){return!Ts("a","y").sticky})),Ps={BROKEN_CARET:Is||q((function(){var e=Ts("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Rs,UNSUPPORTED_Y:Is},ks=W.RegExp,As=q((function(){var e=ks(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Os=W.RegExp,Ls=q((function(){var e=Os("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Ds=lr.f,Ms=Gt.enforce,Ns=nt("match"),js=W.RegExp,_s=js.prototype,Bs=W.SyntaxError,Us=ie(_s.exec),Vs=ie("".charAt),Fs=ie("".replace),zs=ie("".indexOf),$s=ie("".slice),Gs=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ws=/a/g,qs=/a/g,Hs=new js(Ws)!==Ws,Xs=Ps.MISSED_STICKY,Ys=Ps.UNSUPPORTED_Y,Js=H&&(!Hs||Xs||As||Ls||q((function(){return qs[Ns]=!1,js(Ws)!=Ws||js(qs)==qs||"/a/i"!=js(Ws,"i")})));if(Sr("RegExp",Js)){for(var Ks=function(e,t){var r,n,i,o,s,a,c=xe(_s,this),u=Ss(e),l=void 0===t,d=[],f=e;if(!c&&u&&l&&e.constructor===Ks)return e;if((u||xe(_s,e))&&(e=e.source,l&&(t=Es(f))),e=void 0===e?"":is(e),t=void 0===t?"":is(t),f=e,As&&"dotAll"in Ws&&(n=!!t&&zs(t,"s")>-1)&&(t=Fs(t,/s/g,"")),r=t,Xs&&"sticky"in Ws&&(i=!!t&&zs(t,"y")>-1)&&Ys&&(t=Fs(t,/y/g,"")),Ls&&(e=(o=function(e){for(var t,r=e.length,n=0,i="",o=[],s={},a=!1,c=!1,u=0,l="";n<=r;n++){if("\\"===(t=Vs(e,n)))t+=Vs(e,++n);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:Us(Gs,$s(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===l||Xe(s,l))throw new Bs("Invalid capture group name");s[l]=!0,o[o.length]=[l,u],c=!1,l="";continue}c?l+=t:i+=t}return[i,o]}(e))[0],d=o[1]),s=rs(js(e,t),c?this:_s,Ks),(n||i||d.length)&&(a=Ms(s),n&&(a.dotAll=!0,a.raw=Ks(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=Vs(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+Vs(e,++n);return i}(e),r)),i&&(a.sticky=!0),d.length&&(a.groups=d)),e!==f)try{Et(s,"source",""===f?"(?:)":f)}catch(e){}return s},Zs=Ds(js),Qs=0;Zs.length>Qs;)ts(Ks,js,Zs[Qs++]);_s.constructor=Ks,Ks.prototype=_s,qt(W,"RegExp",Ks,{constructor:!0})}Kn("RegExp");var ea,ta,ra,na=Gt.get,ia=RegExp.prototype,oa=TypeError;H&&As&&(ea=ia,ta="dotAll",(ra={configurable:!0,get:function(){if(this!==ia){if("RegExp"===ae(this))return!!na(this).dotAll;throw oa("Incompatible receiver, RegExp required")}}}).get&&Wt(ra.get,ta,{getter:!0}),ra.set&&Wt(ra.set,ta,{setter:!0}),xt.f(ea,ta,ra));var sa,aa=Object.keys||function(e){return ar(e,cr)},ca={f:H&&!pt?Object.defineProperties:function(e,t){gt(e);for(var r,n=he(t),i=aa(t),o=i.length,s=0;o>s;)xt.f(e,r=i[s++],n[r]);return e}},ua="prototype",la="script",da=_t("IE_PROTO"),fa=function(){},pa=function(e){return"<script>"+e+"</"+la+">"},ha=function(e){e.write(pa("")),e.close();var t=e.parentWindow.Object;return e=null,t},ma=function(){try{sa=new ActiveXObject("htmlfile")}catch(e){}var e,t;ma="undefined"!=typeof document?document.domain&&sa?ha(sa):("javascript:",(t=ut("iframe")).style.display="none",ni.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(pa("document.F=Object")),e.close(),e.F):ha(sa);for(var r=cr.length;r--;)delete ma[ua][cr[r]];return ma()};Bt[da]=!0;var ga=Object.create||function(e,t){var r;return null!==e?(fa[ua]=gt(e),r=new fa,fa[ua]=null,r[da]=e):r=ma(),void 0===t?r:ca.f(r,t)},va=Gt.get,ya=Ge("native-string-replace",String.prototype.replace),wa=RegExp.prototype.exec,ba=wa,Sa=ie("".charAt),Ca=ie("".indexOf),xa=ie("".replace),Ea=ie("".slice),Ta=function(){var e=/a/,t=/b*/g;return J(wa,e,"a"),J(wa,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ia=Ps.BROKEN_CARET,Ra=void 0!==/()??/.exec("")[1];(Ta||Ra||Ia||As||Ls)&&(ba=function(e){var t,r,n,i,o,s,a,c=this,u=va(c),l=is(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=J(ba,d,l),c.lastIndex=d.lastIndex,t;var f=u.groups,p=Ia&&c.sticky,h=J(Cs,c),m=c.source,g=0,v=l;if(p&&(h=xa(h,"y",""),-1===Ca(h,"g")&&(h+="g"),v=Ea(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Sa(l,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),r=new RegExp("^(?:"+m+")",h)),Ra&&(r=new RegExp("^"+m+"$(?!\\s)",h)),Ta&&(n=c.lastIndex),i=J(wa,p?r:c,v),p?i?(i.input=Ea(i.input,g),i[0]=Ea(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Ta&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),Ra&&i&&i.length>1&&J(ya,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&f)for(i.groups=s=ga(null),o=0;o<f.length;o++)s[(a=f[o])[0]]=i[a[1]];return i});var Pa=ba;xr({target:"RegExp",proto:!0,forced:/./.exec!==Pa},{exec:Pa});var ka=ie(Q.f),Aa=ie([].push),Oa=function(e){return function(t){for(var r,n=he(t),i=aa(n),o=i.length,s=0,a=[];o>s;)r=i[s++],H&&!ka(n,r)||Aa(a,e?[r,n[r]]:n[r]);return a}},La=(Oa(!0),Oa(!1));xr({target:"Object",stat:!0},{values:function(e){return La(e)}});var Da=nt("species"),Ma=RegExp.prototype,Na=function(e,t,r,n){var i=nt(e),o=!q((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),s=o&&!q((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Da]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!s||r){var a=nn(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var s=nn(e),c=t.exec;return c===Pa||c===Ma.exec?o&&!i?{done:!0,value:a(t,r,n)}:{done:!0,value:s(r,t,n)}:{done:!1}}));qt(String.prototype,e,c[0]),qt(Ma,i,c[1])}n&&Et(Ma[i],"sham",!0)},ja=ie("".charAt),_a=ie("".charCodeAt),Ba=ie("".slice),Ua=function(e){return function(t,r){var n,i,o=is(pe(t)),s=Jt(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=_a(o,s))<55296||n>56319||s+1===a||(i=_a(o,s+1))<56320||i>57343?e?ja(o,s):n:e?Ba(o,s,s+2):i-56320+(n-55296<<10)+65536}},Va=(Ua(!1),Ua(!0)),Fa=function(e,t,r){return t+(r?Va(e,t).length:1)},za=TypeError,$a=function(e,t){var r=e.exec;if(ye(r)){var n=J(r,e,t);return null!==n&&gt(n),n}if("RegExp"===ae(e))return J(Pa,e,t);throw za("RegExp#exec called on incompatible receiver")};Na("match",(function(e,t,r){return[function(t){var r=pe(this),n=de(t)?void 0:Be(t,e);return n?J(n,t,r):new RegExp(t)[e](is(r))},function(e){var n=gt(this),i=is(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return $a(n,i);var s=n.unicode;n.lastIndex=0;for(var a,c=[],u=0;null!==(a=$a(n,i));){var l=is(a[0]);c[u]=l,""===l&&(n.lastIndex=Fa(i,tr(n.lastIndex),s)),u++}return 0===u?null:c}]}));var Ga=xt.f,Wa=nt("unscopables"),qa=Array.prototype;null==qa[Wa]&&Ga(qa,Wa,{configurable:!0,value:ga(null)});var Ha,Xa,Ya,Ja=function(e){qa[Wa][e]=!0},Ka=!q((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Za=_t("IE_PROTO"),Qa=Object,ec=Qa.prototype,tc=Ka?Qa.getPrototypeOf:function(e){var t=qe(e);if(Xe(t,Za))return t[Za];var r=t.constructor;return ye(r)&&t instanceof r?r.prototype:t instanceof Qa?ec:null},rc=nt("iterator"),nc=!1;[].keys&&("next"in(Ya=[].keys())?(Xa=tc(tc(Ya)))!==Object.prototype&&(Ha=Xa):nc=!0),(!be(Ha)||q((function(){var e={};return Ha[rc].call(e)!==e})))&&(Ha={}),ye(Ha[rc])||qt(Ha,rc,(function(){return this}));var ic={IteratorPrototype:Ha,BUGGY_SAFARI_ITERATORS:nc},oc=ic.IteratorPrototype,sc=function(){return this},ac=function(e,t,r,n){var i=t+" Iterator";return e.prototype=ga(oc,{next:ee(+!n,r)}),Yn(e,i,!1),Oo[i]=sc,e},cc=Pt.PROPER,uc=Pt.CONFIGURABLE,lc=ic.IteratorPrototype,dc=ic.BUGGY_SAFARI_ITERATORS,fc=nt("iterator"),pc="values",hc="entries",mc=function(){return this},gc=function(e,t,r,n,i,o,s){ac(r,t,n);var a,c,u,l=function(e){if(e===i&&m)return m;if(!dc&&e in p)return p[e];switch(e){case"keys":case pc:case hc:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",f=!1,p=e.prototype,h=p[fc]||p["@@iterator"]||i&&p[i],m=!dc&&h||l(i),g="Array"==t&&p.entries||h;if(g&&(a=tc(g.call(new e)))!==Object.prototype&&a.next&&(tc(a)!==lc&&(qn?qn(a,lc):ye(a[fc])||qt(a,fc,mc)),Yn(a,d,!0)),cc&&i==pc&&h&&h.name!==pc&&(uc?Et(p,"name",pc):(f=!0,m=function(){return J(h,this)})),i)if(c={values:l(pc),keys:o?m:l("keys"),entries:l(hc)},s)for(u in c)(dc||f||!(u in p))&&qt(p,u,c[u]);else xr({target:t,proto:!0,forced:dc||f},c);return p[fc]!==m&&qt(p,fc,m,{name:i}),Oo[t]=m,c},vc=function(e,t){return{value:e,done:t}},yc=xt.f,wc="Array Iterator",bc=Gt.set,Sc=Gt.getterFor(wc),Cc=gc(Array,"Array",(function(e,t){bc(this,{type:wc,target:he(e),index:0,kind:t})}),(function(){var e=Sc(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,vc(void 0,!0)):vc("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),xc=Oo.Arguments=Oo.Array;if(Ja("keys"),Ja("values"),Ja("entries"),H&&"values"!==xc.name)try{yc(xc,"name",{value:"values"})}catch(Lf){}var Ec={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Tc=ut("span").classList,Ic=Tc&&Tc.constructor&&Tc.constructor.prototype,Rc=Ic===Object.prototype?void 0:Ic,Pc=nt("iterator"),kc=nt("toStringTag"),Ac=Cc.values,Oc=function(e,t){if(e){if(e[Pc]!==Ac)try{Et(e,Pc,Ac)}catch(t){e[Pc]=Ac}if(e[kc]||Et(e,kc,t),Ec[t])for(var r in Cc)if(e[r]!==Cc[r])try{Et(e,r,Cc[r])}catch(t){e[r]=Cc[r]}}};for(var Lc in Ec)Oc(W[Lc]&&W[Lc].prototype,Lc);Oc(Rc,"DOMTokenList");var Dc=Array,Mc=Math.max,Nc=lr.f,jc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],_c={f:function(e){return jc&&"Window"==ae(e)?function(e){try{return Nc(e)}catch(e){return function(e,t,r){for(var n=rr(e),i=Qt(void 0,n),o=Qt(n,n),s=Dc(Mc(o-i,0)),a=0;i<o;i++,a++)Rr(s,a,e[i]);return s.length=a,s}(jc)}}(e):Nc(he(e))}},Bc=q((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Uc=Object.isExtensible,Vc=q((function(){Uc(1)}))||Bc?function(e){return!!be(e)&&(!Bc||"ArrayBuffer"!=ae(e))&&(!Uc||Uc(e))}:Uc,Fc=!q((function(){return Object.isExtensible(Object.preventExtensions({}))})),zc=V((function(e){var t=xt.f,r=!1,n=Ze("meta"),i=0,o=function(e){t(e,n,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},r=!0;var e=lr.f,t=ie([].splice),i={};i[n]=1,e(i).length&&(lr.f=function(r){for(var i=e(r),o=0,s=i.length;o<s;o++)if(i[o]===n){t(i,o,1);break}return i},xr({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:_c.f}))},fastKey:function(e,t){if(!be(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xe(e,n)){if(!Vc(e))return"F";if(!t)return"E";o(e)}return e[n].objectID},getWeakData:function(e,t){if(!Xe(e,n)){if(!Vc(e))return!0;if(!t)return!1;o(e)}return e[n].weakData},onFreeze:function(e){return Fc&&r&&Vc(e)&&!Xe(e,n)&&o(e),e}};Bt[n]=!0})),$c=function(e,t,r){for(var n in t)qt(e,n,t[n],r);return e},Gc=xt.f,Wc=zc.fastKey,qc=Gt.set,Hc=Gt.getterFor;!function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",s=W.Set,a=s&&s.prototype,c=s,u={},l=function(e){var t=ie(a[e]);qt(a,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!be(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!be(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!be(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Sr(e,!ye(s)||!(i||a.forEach&&!q((function(){(new s).entries().next()})))))c=r.getConstructor(t,e,n,o),zc.enable();else if(Sr(e,!0)){var d=new c,f=d[o](i?{}:-0,1)!=d,p=q((function(){d.has(1)})),h=Xo((function(e){new s(e)})),m=!i&&q((function(){for(var e=new s,t=5;t--;)e[o](t,t);return!e.has(-0)}));h||((c=t((function(e,t){Qn(e,a);var r=rs(new s,e,c);return de(t)||$o(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=a,a.constructor=c),(p||m)&&(l("delete"),l("has"),n&&l("get")),(m||f)&&l(o),i&&a.clear&&delete a.clear}u.Set=c,xr({global:!0,constructor:!0,forced:c!=s},u),Yn(c,e),i||r.setStrong(c,e,n)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,r,n){var i=e((function(e,i){Qn(e,o),qc(e,{type:t,index:ga(null),first:void 0,last:void 0,size:0}),H||(e.size=0),de(i)||$o(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,s=Hc(t),a=function(e,t,r){var n,i,o=s(e),a=c(e,t);return a?a.value=r:(o.last=a={index:i=Wc(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),H?o.size++:e.size++,"F"!==i&&(o.index[i]=a)),e},c=function(e,t){var r,n=s(e),i=Wc(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return $c(o,{clear:function(){for(var e=s(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,H?e.size=0:this.size=0},delete:function(e){var t=this,r=s(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),H?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=s(this),n=sn(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),$c(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),H&&Gc(o,"size",{get:function(){return s(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Hc(t),o=Hc(n);gc(e,t,(function(e,t){qc(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?vc("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,vc(void 0,!0))}),r?"entries":"values",!r,!0),Kn(t)}});var Xc=un.filter,Yc=Hr("filter");xr({target:"Array",proto:!0,forced:!Yc},{filter:function(e){return Xc(this,e,arguments.length>1?arguments[1]:void 0)}});var Jc=ir.includes,Kc=q((function(){return!Array(1).includes()}));xr({target:"Array",proto:!0,forced:Kc},{includes:function(e){return Jc(this,e,arguments.length>1?arguments[1]:void 0)}}),Ja("includes");var Zc=TypeError,Qc=function(e){if(Ss(e))throw Zc("The method doesn't accept regular expressions");return e},eu=nt("match"),tu=ie("".indexOf);xr({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[eu]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~tu(is(pe(this)),is(Qc(e)),arguments.length>1?arguments[1]:void 0)}});var ru,nu="object"==typeof Reflect?Reflect:null,ou=nu&&"function"==typeof nu.apply?nu.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};ru=nu&&"function"==typeof nu.ownKeys?nu.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var su=Number.isNaN||function(e){return e!=e};function au(){au.init.call(this)}var cu=au;au.EventEmitter=au,au.prototype._events=void 0,au.prototype._eventsCount=0,au.prototype._maxListeners=void 0;var uu=10;function lu(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function du(e){return void 0===e._maxListeners?au.defaultMaxListeners:e._maxListeners}function fu(e,t,r,n){var i,o,s,a;if(lu(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=du(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function pu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function hu(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=pu.bind(n);return i.listener=r,n.wrapFn=i,i}function mu(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):vu(i,i.length)}function gu(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function vu(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function yu(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(au,"defaultMaxListeners",{enumerable:!0,get:function(){return uu},set:function(e){if("number"!=typeof e||e<0||su(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");uu=e}}),au.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},au.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||su(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},au.prototype.getMaxListeners=function(){return du(this)},au.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)ou(a,this,t);else{var c=a.length,u=vu(a,c);for(r=0;r<c;++r)ou(u[r],this,t)}return!0},au.prototype.addListener=function(e,t){return fu(this,e,t,!1)},au.prototype.on=au.prototype.addListener,au.prototype.prependListener=function(e,t){return fu(this,e,t,!0)},au.prototype.once=function(e,t){return lu(t),this.on(e,hu(this,e,t)),this},au.prototype.prependOnceListener=function(e,t){return lu(t),this.prependListener(e,hu(this,e,t)),this},au.prototype.removeListener=function(e,t){var r,n,i,o,s;if(lu(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},au.prototype.off=au.prototype.removeListener,au.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},au.prototype.listeners=function(e){return mu(this,e,!0)},au.prototype.rawListeners=function(e){return mu(this,e,!1)},au.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):gu.call(e,t)},au.prototype.listenerCount=gu,au.prototype.eventNames=function(){return this._eventsCount>0?ru(this._events):[]},cu.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}yu(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&yu(e,"error",t,{once:!0})}(e,i)}))};var wu=Su,bu=cu.EventEmitter;function Su(e,t,r){Array.isArray(r)||(r=[r]);var n=[];return r.forEach((function(r){var i=function(){var e=[].slice.call(arguments);e.unshift(r),t.emit.apply(t,e)};n.push(i),e.on(r,i)})),function(){r.forEach((function(t,r){e.removeListener(t,n[r])}))}}wu.filter=function(e,t){var r=new bu;return Su(e,r,t),r};const Cu=Bn.get("PeerConnectionStats");class iu extends cu{constructor(e){super(),this.peer=e,this.stats=null,this.emitInterval=null,this.previousStats=null}init(){var e=this;Cu.info("Initializing peer connection stats"),this.emitInterval=setInterval(D((function*(){const t=yield e.peer.getStats();e.parseStats(t),e.emit("stats",e.stats)})),1e3)}parseStats(e){this.previousStats=this.stats;const t={audio:{inbounds:[],outbounds:[]},video:{inbounds:[],outbounds:[]},raw:e};var r,n=B(e.values());try{for(n.s();!(r=n.n()).done;){const e=r.value;switch(e.type){case"outbound-rtp":xu(e,this.previousStats,t);break;case"inbound-rtp":Eu(e,this.previousStats,t);break;case"candidate-pair":e.nominated&&Tu(e,t)}}}catch(e){n.e(e)}finally{n.f()}this.stats=t}stop(){Cu.info("Stopping peer connection stats"),clearInterval(this.emitInterval)}}const xu=(e,t,r)=>{var n,i;const o=Iu(e),s=Ru(e.codecId,r.raw),a=Pu(e,o);a.totalBytesSent=e.bytesSent,a.id=e.id,a.mid=e.mid;const c=t?null!==(n=null===(i=t[o].outbounds.find(e=>e.id===a.id))||void 0===i?void 0:i.totalBytesSent)&&void 0!==n?n:0:null;a.bitrate=c?8*(e.bytesSent-c):0,"video"===o&&(a.qualityLimitationReason=e.qualityLimitationReason),r[o].outbounds.push(O(O({},s),a))},Eu=(e,t,r)=>{let n=Iu(e);const i=Ru(e.codecId,r.raw);["audio","video"].includes(n)||(n=e.id.includes("Video")?"video":"audio");const o=Pu(e,n);if(o.totalBytesReceived=e.bytesReceived,o.totalPacketsReceived=e.packetsReceived,o.totalPacketsLost=e.packetsLost,o.jitter=e.jitter,o.id=e.id,o.mid=e.mid,o.bitrate=0,o.packetsLostRatioPerSecond=0,o.packetsLostDeltaPerSecond=0,t){const r=t[n].inbounds.find(e=>e.id===o.id);if(r){const t=r.totalBytesReceived;o.bitrate=8*(e.bytesReceived-t),o.packetsLostRatioPerSecond=ku(o,r),o.packetsLostDeltaPerSecond=Au(o,r)}}r[n].inbounds.push(O(O({},i),o))},Tu=(e,t)=>{t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.candidateType=t.raw.get(e.localCandidateId).candidateType},Iu=e=>e.mediaType||e.kind,Ru=(e,t)=>{var r;return{mimeType:(e&&null!==(r=t.get(e))&&void 0!==r?r:{}).mimeType}},Pu=(e,t)=>{const r={};return"video"===t&&(r.framesPerSecond=e.framesPerSecond,r.frameHeight=e.frameHeight,r.frameWidth=e.frameWidth),r.timestamp=e.timestamp,r},ku=(e,t)=>Au(e,t)/(e.totalPacketsReceived-t.totalPacketsReceived),Au=(e,t)=>e.totalPacketsLost-t.totalPacketsLost;var Ou=function(e,t,r,n){try{return n?t(gt(r)[0],r[1]):t(r)}catch(t){Uo(e,"throw",t)}},Lu=Array,Du=!Xo((function(e){Array.from(e)}));xr({target:"Array",stat:!0,forced:Du},{from:function(e){var t=qe(e),r=zr(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=sn(i,n>2?arguments[2]:void 0));var s,a,c,u,l,d,f=jo(t),p=0;if(!f||this===Lu&&Mo(f))for(s=rr(t),a=r?new this(s):Lu(s);s>p;p++)d=o?i(t[p],p):t[p],Rr(a,p,d);else for(l=(u=Bo(t,f)).next,a=r?new this:[];!(c=J(l,u)).done;p++)d=o?Ou(u,i,[c.value,p],!0):c.value,Rr(a,p,d);return a.length=p,a}});var Mu=Math.floor,Nu=ie("".charAt),ju=ie("".replace),_u=ie("".slice),Bu=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Uu=/\$([$&'`]|\d{1,2})/g,Vu=function(e,t,r,n,i,o){var s=r+e.length,a=n.length,c=Uu;return void 0!==i&&(i=qe(i),c=Bu),ju(o,c,(function(o,c){var u;switch(Nu(c,0)){case"$":return"$";case"&":return e;case"`":return _u(t,0,r);case"'":return _u(t,s);case"<":u=i[_u(c,1,-1)];break;default:var l=+c;if(0===l)return o;if(l>a){var d=Mu(l/10);return 0===d?o:d<=a?void 0===n[d-1]?Nu(c,1):n[d-1]+Nu(c,1):o}u=n[l-1]}return void 0===u?"":u}))},Fu=nt("replace"),zu=Math.max,$u=Math.min,Gu=ie([].concat),Wu=ie([].push),qu=ie("".indexOf),Hu=ie("".slice),Xu="$0"==="a".replace(/./,"$0"),Yu=!!/./[Fu]&&""===/./[Fu]("a","$0");Na("replace",(function(e,t,r){var n=Yu?"$":"$0";return[function(e,r){var n=pe(this),i=de(e)?void 0:Be(e,Fu);return i?J(i,e,n,r):J(t,is(n),e,r)},function(e,i){var o=gt(this),s=is(e);if("string"==typeof i&&-1===qu(i,n)&&-1===qu(i,"$<")){var a=r(t,o,s,i);if(a.done)return a.value}var c=ye(i);c||(i=is(i));var u=o.global;if(u){var l=o.unicode;o.lastIndex=0}for(var d=[];;){var f=$a(o,s);if(null===f)break;if(Wu(d,f),!u)break;""===is(f[0])&&(o.lastIndex=Fa(s,tr(o.lastIndex),l))}for(var p,h="",m=0,g=0;g<d.length;g++){for(var v=is((f=d[g])[0]),y=zu($u(Jt(f.index),s.length),0),w=[],E=1;E<f.length;E++)Wu(w,void 0===(p=f[E])?p:String(p));var T=f.groups;if(c){var I=Gu([v],w,y,s);void 0!==T&&Wu(I,T);var R=is(mn(i,void 0,I))}else R=Vu(v,s,y,w,T,i);y>=m&&(h+=Hu(s,m,y)+R,m=y+v.length)}return h+Hu(s,m)}]}),!!q((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Xu||Yu);var Ju,Ku="\t\n\v\f\r                 \u2028\u2029\ufeff",Zu=ie("".replace),Qu="["+Ku+"]",el=RegExp("^"+Qu+Qu+"*"),tl=RegExp(Qu+Qu+"*$"),rl=function(e){return function(t){var r=is(pe(t));return 1&e&&(r=Zu(r,el,"")),2&e&&(r=Zu(r,tl,"")),r}},nl={start:rl(1),end:rl(2),trim:rl(3)},il=Pt.PROPER,ol=nl.trim;xr({target:"String",proto:!0,forced:(Ju="trim",q((function(){return!!Ku[Ju]()||"​…᠎"!=="​…᠎"[Ju]()||il&&Ku[Ju].name!==Ju})))},{trim:function(){return ol(this)}});var sl=nt("matchAll"),al="RegExp String",cl=al+" Iterator",ul=Gt.set,ll=Gt.getterFor(cl),fl=RegExp.prototype,hl=TypeError,ml=nn("".indexOf),vl=nn("".matchAll),yl=!!vl&&!q((function(){vl("a",/./)})),bl=ac((function(e,t,r,n){ul(this,{type:cl,regexp:e,string:t,global:r,unicode:n,done:!1})}),al,(function(){var e=ll(this);if(e.done)return vc(void 0,!0);var t=e.regexp,r=e.string,n=$a(t,r);return null===n?(e.done=!0,vc(void 0,!0)):e.global?(""===is(n[0])&&(t.lastIndex=Fa(r,tr(t.lastIndex),e.unicode)),vc(n,!1)):(e.done=!0,vc(n,!1))}));xr({target:"String",proto:!0,forced:yl},{matchAll:function(e){var t,r,n,i=pe(this);if(de(e)){if(yl)return vl(i,e)}else{if(Ss(e)&&(t=is(pe(Es(e))),!~ml(t,"g")))throw hl("`.matchAll` does not allow non-global regexes");if(yl)return vl(i,e);if(n=Be(e,sl))return J(n,e,i)}return r=is(i),new RegExp(e,"g")[sl](r)}}),sl in fl||qt(fl,sl,(function(e){var t,r,n,i=gt(this),o=is(e),s=ri(i,RegExp),a=is(Es(i));return t=new s(s===RegExp?i.source:i,a),r=!!~ml(a,"g"),n=!!~ml(a,"u"),t.lastIndex=tr(i.lastIndex),new bl(t,o,r,n)}));var Sl=ie([].reverse),xl=[1,2];xr({target:"Array",proto:!0,forced:String(xl)===String(xl.reverse())},{reverse:function(){return Er(this)&&(this.length=this.length),Sl(this)}});var El=V((function(e){var t=e.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(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.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(e){return null!=e.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(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.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(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["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(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{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(e){return null!=e.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(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new 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(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.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"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",(t+=null!=e.rateNumerator?" rate=%s":"")+(null!=e.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(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),Tl=V((function(e,t){var r=function(e){return String(Number(e))===e?Number(e):e},n=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),o=r[r.length-1]);for(var s=0;s<(El[t]||[]).length;s+=1){var a=El[t][s];if(a.reg.test(i))return n(a,o,i)}})),t.media=r,t};var o=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length?e[n[0]]=r(n[1]):1===n.length&&t.length>1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}})),Il=/%[sdv%]/g,Rl=function(e){var t=1,r=arguments,n=r.length;return e.replace(Il,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},Pl=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return Rl.apply(null,n)},kl=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Al=["i","c","b","a"],Ol={write:function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||kl,n=t.innerOrder||Al,i=[];return r.forEach((function(t){El[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Pl(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Pl(t,r,e))}))}))})),e.media.forEach((function(e){i.push(Pl("m",El.m[0],e)),n.forEach((function(t){El[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Pl(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Pl(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:Tl.parse,parseParams:Tl.parseParams,parseFmtpConfig:Tl.parseFmtpConfig,parsePayloads:Tl.parsePayloads,parseRemoteCandidates:Tl.parseRemoteCandidates,parseImageAttributes:Tl.parseImageAttributes,parseSimulcastStreamList:Tl.parseSimulcastStreamList};class dl{constructor(e,t,r,n,i,o,s,a,c){this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.address=i,this.port=o,this.type=s,this.relAddr=a,this.relPort=c}equals(e){return e.foundation===this.foundation&&e.componentId===this.componentId&&e.transport===this.transport&&e.priority===this.priority&&e.address===this.address&&e.port===this.port&&e.type===this.type&&e.relAddr===this.relAddr&&e.relPort===this.relPort}clone(){return new dl(this.foundation,this.componentId,this.transport,this.priority,this.address,this.port,this.type,this.relAddr,this.relPort)}plain(){const e={foundation:this.foundation,componentId:this.componentId,transport:this.transport,priority:this.priority,address:this.address,port:this.port,type:this.type};return this.relAddr&&(e.relAddr=this.relAddr),this.relPort&&(e.relPort=this.relPort),e}getFoundation(){return this.foundation}getComponentId(){return this.componentId}getTransport(){return this.transport}getPriority(){return this.priority}getAddress(){return this.address}getPort(){return this.port}getType(){return this.type}getRelAddr(){return this.relAddr}getRelPort(){return this.relPort}}dl.expand=function(e){return new dl(e.foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)};var Ll=dl;class pl{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new pl(this.id,this.params)}plain(){return this.params.length?{id:this.id,params:this.params}:{id:this.id}}getId(){return this.id}getParams(){return this.params}}pl.expand=function(e){return new pl(e.id,e.params)};var Dl=pl;class gl{constructor(e,t,r){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,r&&this.addParams(r)}clone(){const e=new gl(this.codec,this.type,this.params);this.hasRTX()&&e.setRTX(this.getRTX());for(const t of this.rtcpfbs)e.addRTCPFeedback(t.clone());return this.hasChannels()&&e.setChannels(this.getChannels()),e}plain(){const e={codec:this.codec,type:this.type};this.rtx&&(e.rtx=this.rtx),this.channels&&(e.channels=this.channels),Object.keys(this.params).length&&(e.params=this.params);for(const t of this.rtcpfbs)e.rtcpfbs||(e.rtcpfbs=[]),e.rtcpfbs.push(t.plain());return e}setRTX(e){this.rtx=e}getType(){return this.type}setType(e){this.type=e}getCodec(){return this.codec}getParams(){return this.params}addParams(e){for(const t in e)this.params[t]=e[t]}addParam(e,t){this.params[e]=t}hasParam(e){return this.params.hasOwnProperty(e)}getParam(e,t){return this.hasParam(e)?this.params[e]:""+t}hasRTX(){return this.rtx}getRTX(){return this.rtx}hasChannels(){return this.channels}getChannels(){return this.channels}setChannels(e){this.channels=e}addRTCPFeedback(e){this.rtcpfbs.add(e)}getRTCPFeedbacks(){return this.rtcpfbs}}gl.expand=function(e){const t=new gl(e.codec,e.type,e.params);e.rtx&&t.setRTX(e.rtx),e.channels&&t.setChannels(e.channels);for(let r=0;e.rtcpfbs&&r<e.rtcpfbs.length;++r){const n=Dl.expand(e.rtcpfbs[r]);t.addRTCPFeedback(n)}return t},gl.MapFromNames=function(e,t,r){const n=new Map;let i=96;for(let o=0;o<e.length;++o){let s;const a=e[o].split(";"),c=a[0].toLowerCase().trim();s="pcmu"===c?0:"pcma"===c?8:++i;const u=new gl(c,s);"opus"===c?u.setChannels(2):"multiopus"===c&&u.setChannels(6),t&&"ulpfec"!==c&&"flexfec-03"!==c&&"red"!==c&&u.setRTX(++i);for(let e=0;r&&e<r.length;++e)u.addRTCPFeedback(new Dl(r[e].id,r[e].params));for(let e=1;e<a.length;++e){let t=a[e].split("=");u.addParam(t[0].trim(),t[1].trim())}n.set(u.getCodec().toLowerCase(),u)}return n};var Ml=gl,Nl=function e(){var t=this;if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[null].concat(Array.prototype.slice.call(arguments))));Array.from(arguments).forEach((function(e){t[e]=Symbol.for("MEDOOZE_SEMANTIC_SDP_"+e)}))};const jl=Nl("ACTIVE","PASSIVE","ACTPASS","INACTIVE");jl.byValue=function(e){switch(e){case jl.ACTIVE:case jl.PASSIVE:case jl.ACTPASS:case jl.INACTIVE:return e}return jl[e.toUpperCase()]},jl.toString=function(e){switch(e){case jl.ACTIVE:return"active";case jl.PASSIVE:return"passive";case jl.ACTPASS:return"actpass";case jl.INACTIVE:return"inactive"}},jl.reverse=function(e){switch(e){case jl.ACTIVE:return jl.PASSIVE;case jl.PASSIVE:return jl.ACTIVE;case jl.ACTPASS:return jl.PASSIVE;case jl.INACTIVE:return jl.INACTIVE}};var _l=jl;class wl{constructor(e,t,r){this.setup=e,this.hash=t,this.fingerprint=r}clone(){return new wl(this.setup,this.hash,this.fingerprint)}plain(){return{setup:_l.toString(this.setup),hash:this.hash,fingerprint:this.fingerprint}}getFingerprint(){return this.fingerprint}getHash(){return this.hash}getSetup(){return this.setup}setSetup(e){this.setup=e}}wl.expand=function(e){return new wl(e.setup?_l.byValue(e.setup):_l.ACTPASS,e.hash,e.fingerprint)};var Bl=wl;class Cl{constructor(e,t,r,n){this.tag=e,this.suite=t,this.keyParams=r,this.sessionParams=n}clone(){return new Cl(this.tag,this.suite,this.keyParams,this.sessionParams)}plain(){return{tag:this.tag,suite:this.suite,keyParams:this.keyParams,sessionParams:this.sessionParams}}getSessionParams(){return this.sessionParams}getKeyParams(){return this.keyParams}getSuite(){return this.suite}getTag(){return this.tag}}Cl.expand=function(e){return new Cl(e.tag,e.suite,e.keyParams,e.sessionParams)};for(var Ul=Cl,Fl=[],zl=[],$l="undefined"!=typeof Uint8Array?Uint8Array:Array,Gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wl=0,Hl=Gl.length;Wl<Hl;++Wl)Fl[Wl]=Gl[Wl],zl[Gl.charCodeAt(Wl)]=Wl;function Jl(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function Kl(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(Fl[(i=n)>>18&63]+Fl[i>>12&63]+Fl[i>>6&63]+Fl[63&i]);return o.join("")}zl["-".charCodeAt(0)]=62,zl["_".charCodeAt(0)]=63;var Zl=function(e){var t,r,n=Jl(e),i=n[0],o=n[1],s=new $l(function(e,t,r){return 3*(t+r)/4-r}(0,i,o)),a=0,c=o>0?i-4:i;for(r=0;r<c;r+=4)t=zl[e.charCodeAt(r)]<<18|zl[e.charCodeAt(r+1)]<<12|zl[e.charCodeAt(r+2)]<<6|zl[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===o&&(t=zl[e.charCodeAt(r)]<<2|zl[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=zl[e.charCodeAt(r)]<<10|zl[e.charCodeAt(r+1)]<<4|zl[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},ed=function(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Kl(e,s,s+o>a?a:s+o));return 1===n?(t=e[r-1],i.push(Fl[t>>2]+Fl[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(Fl[t>>10]+Fl[t>>4&63]+Fl[t<<2&63]+"=")),i.join("")},rd=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?i-1:0,f=r?-1:1,p=e[t+d];for(d+=f,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)},id=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=h,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+p]=255&s,p+=h,s/=256,u-=8);e[r+p-h]|=128*m},sd=V((function(e,t){const r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|f(e,t);let n=i(r);const s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return l(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return l(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);const s=function(e){if(o.isBuffer(e)){const t=0|d(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||K(e.length)?i(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return a(e),i(e<0?0:0|d(e))}function u(e){const t=e.length<0?0:0|d(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function l(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function d(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(K(n))return s;e[r+s]=n}return s}function y(e,t,r,n){return Y(H(t,e.length-r),e,r,n)}function w(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return Y(X(t),e,r,n)}function T(e,t,r,n){return Y(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?ed(e):ed(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),J(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=o.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,Uint8Array))i+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)h(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==l[e]){s=u[e],a=l[e];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function k(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function A(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Z[e[n]];return i}function L(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function j(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function _(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,i){return t=+t,r>>>=0,i||_(e,0,r,4),id(e,t,r,n,23,4),r+4}function U(e,t,r,n,i){return t=+t,r>>>=0,i||_(e,0,r,8),id(e,t,r,n,52,8),r+8}o.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),rd(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),rd(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),rd(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),rd(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Q((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Q((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const s=o.isBuffer(e)?e:o.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};const V={};function F(e,t,r){V[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){return Zl(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Q(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}})),cd=V((function(e,t){var r=sd.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=sd:(n(sd,t),t.Buffer=i),n(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return sd.SlowBuffer(e)}})),ld=V((function(e){var t=65536,r=cd.Buffer,n=U.crypto||U.msCrypto;n&&n.getRandomValues?e.exports=function(e,i){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>t)for(var s=0;s<e;s+=t)n.getRandomValues(o.slice(s,s+t));else n.getRandomValues(o);return"function"==typeof i?k.nextTick((function(){i(null,o)})):o}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}));class Vl{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Vl(this.ufrag,this.pwd);return e.setLite(this.lite),e.setEndOfCandidates(this.endOfCandidates),e}plain(){const e={ufrag:this.ufrag,pwd:this.pwd};return this.lite&&(e.lite=this.lite),this.endOfCandidates&&(e.endOfCandidates=this.endOfCandidates),e}getUfrag(){return this.ufrag}getPwd(){return this.pwd}isLite(){return this.lite}setLite(e){this.lite=e}isEndOfCandidates(){return this.endOfCandidates}setEndOfCandidates(e){this.endOfCandidates=e}}Vl.generate=function(e){const t=new Vl,r=ld(8),n=ld(24);return t.ufrag=r.toString("hex"),t.pwd=n.toString("hex"),t.lite=e,t},Vl.expand=function(e){const t=new Vl(e.ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t};var fd=Vl;const hd=Nl("SEND","RECV");hd.byValue=function(e){return hd[e.toUpperCase()]},hd.toString=function(e){switch(e){case hd.SEND:return"send";case hd.RECV:return"recv"}},hd.reverse=function(e){switch(e){case hd.SEND:return hd.RECV;case hd.RECV:return hd.SEND}};var md=hd;class ql{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ql(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:md.toString(this.direction)};for(var[t,r]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=r;return e}getId(){return this.id}getDirection(){return this.direction}setDirection(e){this.direction=e}getFormats(){return this.formats}setFormats(e){this.formats=[];for(let t=0;t<e.length;++t)this.formats.push(parseInt(e[t]))}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}getDirection(){return this.direction}setDirection(e){this.direction=e}}ql.expand=function(e){const t=new ql(e.id,md.byValue(e.direction));for(let r in e.params)t.addParam(r,e.params[r]);return e.formats&&t.setFormats(e.formats),t};var gd=ql;class Xl{constructor(e,t){this.paused=t,this.id=e}clone(){return new Xl(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}}Xl.expand=function(e){return new Xl(e.id,e.paused)};var vd=Xl;class Yl{constructor(){this.send=[],this.recv=[]}clone(){const e=new Yl;for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;t<this.send[e].length;++t)r.push(this.send[t][e].clone());e.addSimulcastAlternativeStreams(md.SEND,r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;t<this.recv[e].length;++t)r.push(this.recv[t][e].clone());e.addSimulcastAlternativeStreams(md.RECV,r)}return e}plain(){const e={send:[],recv:[]};for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;e<this.send[t].length;++e)r.push(this.send[t][e].plain());e.send.push(r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;e<this.recv[t].length;++e)r.push(this.recv[t][e].plain());e.recv.push(r)}return e}addSimulcastAlternativeStreams(e,t){return e===md.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===md.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===md.SEND?this.send:this.recv}}Yl.expand=function(e){const t=new Yl;for(let r=0;r<e.send.length;++r){let n=[];for(let t=0;t<e.send[r].length;++t)n.push(vd.expand(e.send[r][t]));t.addSimulcastAlternativeStreams(md.SEND,n)}for(let r=0;r<e.recv.length;++r){let n=[];for(let t=0;t<e.recv[r].length;++t)n.push(vd.expand(e.recv[r][t]));t.addSimulcastAlternativeStreams(md.RECV,n)}return t};var yd=Yl;const wd=Nl("SENDRECV","SENDONLY","RECVONLY","INACTIVE");wd.byValue=function(e){return wd[e.toUpperCase()]},wd.toString=function(e){switch(e){case wd.SENDRECV:return"sendrecv";case wd.SENDONLY:return"sendonly";case wd.RECVONLY:return"recvonly";case wd.INACTIVE:return"inactive"}},wd.reverse=function(e){switch(e){case wd.SENDRECV:return wd.SENDRECV;case wd.SENDONLY:return wd.RECVONLY;case wd.RECVONLY:return wd.SENDONLY;case wd.INACTIVE:return wd.INACTIVE}};var bd=wd;class Ql{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new Ql(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}}Ql.expand=function(e){return new Ql(e.port,e.maxMessageSize)};var Cd=Ql;class td{constructor(e,t){this.id=e,this.type=t,this.direction=bd.SENDRECV,this.extensions=new Map,this.codecs=new Map,this.rids=new Map,this.simulcast=null,this.bitrate=0,this.control=null,this.dataChannel=null}clone(){const e=new td(this.id,this.type);e.setDirection(this.direction),e.setBitrate(this.bitrate);for(const t of this.codecs.values())e.addCodec(t.clone());for(const[t,r]of this.extensions.entries())e.addExtension(t,r);for(const t of this.rids.values())e.addRID(t.clone());return this.simulcast&&e.setSimulcast(this.simulcast.clone()),this.control&&e.setControl(this.control),this.dataChannel&&e.setDatachannel(this.dataChannel.clone()),e}plain(){const e={id:this.id,type:this.type,direction:bd.toString(this.direction),codecs:[]};this.dataChannel&&(e.dataChannel=this.dataChannel.plain()),this.bitrate&&(e.bitrate=this.bitrate);for(const t of this.codecs.values())e.codecs.push(t.plain());for(const[t,r]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=r;for(const t of this.rids.values())e.rids||(e.rids=[]),e.rids.push(t.plain());return this.simulcast&&(e.simulcast=this.simulcast.plain()),this.control&&(e.control=this.control),e}getType(){return this.type}getId(){return this.id}setId(e){this.id=e}addExtension(e,t){this.extensions.set(e,t)}addRID(e){this.rids.set(e.getId(),e)}addCodec(e){this.codecs.set(e.getType(),e)}setCodecs(e){this.codecs=e}getCodecForType(e){return this.codecs.get(e)}getCodec(e){for(const t of this.codecs.values())if(t.getCodec().toLowerCase()===e.toLowerCase())return t;return null}hasCodec(e){return null!==this.getCodec(e)}getCodecs(){return this.codecs}hasRTX(){for(const e of this.codecs.values())if(e.hasRTX())return!0;return!1}getExtensions(){return this.extensions}getRIDs(){return this.rids}getRID(e){return this.rids.get(e)}getBitrate(){return this.bitrate}setBitrate(e){this.bitrate=e}getDirection(){return this.direction}setDirection(e){this.direction=e}hasControl(){return!!this.control}getControl(){return this.control}setControl(e){this.control=e}hasDataChannel(){return!!this.dataChannel}getDataChannel(){return this.dataChannel}setDataChannel(e){this.dataChannel=e}answer(e){const t=new td(this.id,this.type);if(e){if(t.setDirection(bd.reverse(this.direction)),e.codecs){let r;r=Array.isArray(e.codecs)?Ml.MapFromNames(e.codecs,e.rtx,e.rtcpfbs):e.codecs;for(let e of this.codecs.values())if(r.has(e.getCodec().toLowerCase())){const n=r.get(e.getCodec().toLowerCase());if("h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0"))continue;if("h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id"))continue;if("multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const i=n.clone();i.setType(e.getType()),i.hasRTX()&&i.setRTX(e.getRTX()),e.hasChannels()&&i.setChannels(e.getChannels()),i.addParams(e.getParams()),t.addCodec(i)}}const n=new Set(e.extensions);for(let[e,r]of this.extensions)n.has(r)&&t.addExtension(e,r);if(e.simulcast&&this.simulcast){const e=new yd,n=this.simulcast.getSimulcastStreams(md.SEND);if(n)for(let t=0;t<n.length;++t){var r=[];for(let e=0;e<n[t].length;++e)r.push(n[t][e].clone());e.addSimulcastAlternativeStreams(md.RECV,r)}const i=this.simulcast.getSimulcastStreams(md.RECV);if(i)for(let t=0;t<i.length;++t){r=[];for(let e=0;e<i[t].length;++e)r.push(i[t][e].clone());e.addSimulcastAlternativeStreams(md.SEND,r)}for(const e of this.rids.values()){const r=e.clone();r.setDirection(md.reverse(e.getDirection())),t.addRID(r)}t.setSimulcast(e)}if(e.dataChannel&&this.dataChannel){const r=new Cd(this.dataChannel.getPort(),e.dataChannel.maxMessageSize?e.dataChannel.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(r)}}else t.setDirection(bd.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}}td.create=function(e,t){const r=new td(e,e);return t?t.codecs&&(Array.isArray(t.codecs)?r.setCodecs(Ml.MapFromNames(t.codecs,t.rtx,t.rtcpfbs)):r.setCodecs(t.codecs)):r.setDirection(bd.INACTIVE),r},td.expand=function(e){const t=new td(e.id,e.type);if(e.direction&&t.setDirection(bd.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const r=Cd.expand(e.dataChannel);r&&t.setDataChannel(r)}for(let r in e.extensions)t.addExtension(r,e.extensions[r]);for(let r=0;e.codecs&&r<e.codecs.length;++r){const n=Ml.expand(e.codecs[r]);n&&t.addCodec(n)}for(let r=0;e.rids&&r<e.rids.length;++r){const n=gd.expand(e.rids[r]);t.addRID(n)}return e.simulcast&&t.setSimulcast(yd.expand(e.simulcast)),e.control&&t.setControl(e.control),t};var xd=td;class nd{constructor(e,t){this.semantics=e,this.ssrcs=[];for(let e=0;e<t.length;++e)this.ssrcs.push(parseInt(t[e]))}clone(){return new nd(this.semantics,this.ssrcs)}plain(){const e={semantics:this.semantics,ssrcs:[]};for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);return e}getSemantics(){return this.semantics}getSSRCs(){return this.ssrcs}}nd.expand=function(e){return new nd(e.semantics,e.ssrcs)};var Ed=nd;class od{constructor(e){this.ssrc=e}clone(){const e=new od(this.ssrc);e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId)}plain(){const e={ssrc:this.ssrc};return this.cname&&(e.cname=this.cname),this.streamId&&(e.streamId=this.streamId),this.trackId&&(e.trackid=this.trackId),e}getCName(){return this.cname}setCName(e){this.cname=e}getStreamId(){return this.streamId}setStreamId(e){this.streamId=e}getTrackId(){return this.trackId}setTrackId(e){this.trackId=e}getSSRC(){return this.ssrc}}od.expand=function(e){const t=new od(e.ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t};var Td=od;class ad{constructor(e,t){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ad(this.id,this.paused);for(let t of this.codecs.values())e.addCodec(t.clone());return e.setParams(this.params),e}plain(){var e={id:this.id,paused:this.paused,codecs:{},params:{}};for(var[t,r]of this.codecs.entries())e.codecs[t]=r.plain();for(var[t,n]of this.params.entries())e.params[t]=n;return e}getId(){return this.id}getCodecs(){return this.codecs}addCodec(e){this.codecs.set(e.getType(),e)}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}isPaused(){return this.paused}}ad.expand=function(e){const t=new ad(e.id,e.paused);for(let r in e.codecs)t.addCodec(Ml.expand(e.codecs[r]));for(let r in e.params)t.addParam(r,e.params[r]);return t};var Id=ad;class ud{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new ud(this.media,this.id);this.mediaId&&e.setMediaId(this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.addSSRC(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.addSourceGroup(this.groups[t].clone());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].clone());e.addAlternativeEncodings(r)}return e}plain(){const e={media:this.media,id:this.id,ssrcs:[]};this.mediaId&&(e.mediaId=this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.groups||(e.groups=[]),e.groups.push(this.groups[t].plain());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].plain());r.length&&(e.encodings||(e.encodings=[]),e.encodings.push(r))}return e}getMedia(){return this.media}setMediaId(e){this.mediaId=e}getMediaId(){return this.mediaId}getId(){return this.id}addSSRC(e){this.ssrcs.push(e)}getSSRCs(){return this.ssrcs}addSourceGroup(e){this.groups.push(e)}getSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return t;return null}getSourceGroups(){return this.groups}hasSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return!0;return!1}getEncodings(){return this.encodings}addEncoding(e){this.encodings.push([e])}addAlternativeEncodings(e){this.encodings.push(e)}setEncodings(e){this.encodings=e}}ud.expand=function(e){const t=new ud(e.media,e.id);e.mediaId&&t.setMediaId(e.mediaId);for(let r=0;e.ssrcs&&r<e.ssrcs.length;++r)t.addSSRC(e.ssrcs[r]);for(let r=0;e.groups&&r<e.groups.length;++r)t.addSourceGroup(Ed.expand(e.groups[r]));for(let r=0;e.encodings&&r<e.encodings.length;++r){const n=[];for(let t=0;t<e.encodings[r].length;++t)n.push(Id.expand(e.encodings[r][t]));t.addAlternativeEncodings(n)}return t};var Pd=ud;class dd{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new dd(this.id);for(const t of this.tracks.values())e.addTrack(t.clone());return e}plain(){const e={id:this.id,tracks:[]};for(const t of this.tracks.values())e.tracks.push(t.plain());return e}getId(){return this.id}addTrack(e){this.tracks.set(e.getId(),e)}removeTrack(e){return this.tracks.delete(e.getId())}removeTrackById(e){return this.tracks.delete(e)}getFirstTrack(e){for(let t of this.tracks.values())if(t.getMedia().toLowerCase()===e.toLowerCase())return t;return null}getTracks(){return this.tracks}removeAllTracks(){this.tracks.clear()}getTrack(e){return this.tracks.get(e)}}dd.expand=function(e){const t=new dd(e.id,e.paused);for(let r=0;r<e.tracks.length;++r){const n=Pd.expand(e.tracks[r]);n&&t.addTrack(n)}return t};var kd=dd;class pd{constructor(e){this.version=e||1,this.streams=new Map,this.medias=new Array,this.candidates=new Array,this.ice=null,this.dtls=null,this.crypto=null,this.extmapAllowMixed=!0}clone(){const e=new pd(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());for(const t of this.streams.values())e.addStream(t.clone());for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(let t=0;t<this.medias.length;++t)e.medias.push(this.medias[t].plain());for(const t of this.streams.values())e.streams.push(t.plain());for(let t=0;t<this.candidates.length;++t)e.candidates.push(this.candidates[t].plain());return this.ice&&(e.ice=this.ice.plain()),this.dtls&&(e.dtls=this.dtls.plain()),this.crypto&&(e.crypto=this.crypto.plain()),this.extmapAllowMixed||(e.extmapAllowMixedNotSupported=!this.extmapAllowMixed),e}unify(){const e=new pd(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const r of this.streams.values()){const n=r.clone();for(const r of n.getTracks().values()){let n=t[r.getMedia()].pop();n||(n=this.getMedia(r.getMedia()).clone(),n.setId(r.getId()),e.addMedia(n)),r.setMediaId(n.getId())}e.addStream(n)}for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return this.ice&&e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e}setVersion(e){this.version=e}addMedia(e){this.medias.push(e)}getMedia(e){for(let t in this.medias){let r=this.medias[t];if(r.getType().toLowerCase()===e.toLowerCase())return r}return null}getMediasByType(e){var t=[];for(let r in this.medias){let n=this.medias[r];n.getType().toLowerCase()===e.toLowerCase()&&t.push(n)}return t}getMediaById(e){for(let t in this.medias){let r=this.medias[t];if(r.getId().toLowerCase()===e.toLowerCase())return r}return null}replaceMedia(e){for(let t in this.medias)if(this.medias[t].getId()==e.getId())return this.medias[t]=e,!0;return!1}getMedias(){return this.medias}getVersion(){return this.version}getDTLS(){return this.dtls}setDTLS(e){this.dtls=e}hasCrypto(){return!!this.crypto}getCrypto(){return this.crypto}setCrypto(e){this.crypto=e}hasICE(){return!!this.ice}getICE(){return this.ice}setICE(e){this.ice=e}addCandidate(e){for(let t=0;t<this.candidates.length;++t)if(this.candidates[t].equals(e))return;this.candidates.push(e)}addCandidates(e){for(let t=0;t<e.length;++t)this.addCandidate(e[t])}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(let e of this.streams.values())return e;return null}addStream(e){this.streams.set(e.getId(),e)}removeStream(e){return this.streams.delete(e.getId())}removeAllStreams(){this.streams.clear()}getTrackByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return n;return null}getStreamByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new pd;e.ice&&(e.ice instanceof fd?t.setICE(e.ice.clone()):t.setICE(fd.expand(e.ice))),e.dtls&&(e.dtls instanceof Bl?t.setDTLS(e.dtls):t.setDTLS(Bl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Ul?t.setCrypto(e.crypto):t.setCrypto(Ul.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Ll?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Ll.expand(e.candidates[r]));for(const r of this.medias){const n=e&&e.capabilities&&e.capabilities[r.getType()];t.addMedia(r.answer(n))}return t.setExtmapAllowMixed(this.extmapAllowMixed),t}toString(){let e={version:0,media:[]};e.version=0,e.origin={username:"-",sessionId:(new Date).getTime(),sessionVersion:this.version,netType:"IN",ipVer:4,address:"127.0.0.1"},e.name="semantic-sdp",e.connection={version:4,ip:"0.0.0.0"},e.timing={start:0,stop:0},this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),e.msidSemantic={semantic:"WMS",token:"*"},e.groups=[],this.extmapAllowMixed&&(e.extmapAllowMixed="extmap-allow-mixed");let t={type:"BUNDLE",mids:[]};for(let r in this.medias){let n=this.medias[r],i={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};i.direction=bd.toString(n.getDirection()),this.extmapAllowMixed&&(i.extmapAllowMixed="extmap-allow-mixed"),i.mid=n.getId(),t.mids.push(n.getId()),n.hasControl()&&(i.control=n.getControl()),n.getBitrate()>0&&(i.bandwidth.push({type:"AS",limit:n.getBitrate()}),i.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let o=this.getCandidates();for(let e=0;e<o.length;++e){let t=o[e];i.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()})}if(this.getICE()&&(i.iceUfrag=this.getICE().getUfrag(),i.icePwd=this.getICE().getPwd()),["audio","video"].includes(n.getType().toLowerCase())){i.rtcpMux="rtcp-mux",i.rtcpRsize="rtcp-rsize",this.getDTLS()?(i.protocol="UDP/TLS/RTP/SAVPF",i.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},i.setup=_l.toString(this.getDTLS().getSetup())):this.getCrypto()?(i.protocol="RTP/SAVPF",i.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):i.protocol="RTP/AVP";for(let e of n.getCodecs().values()){"video"===n.getType().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):"opus"===e.getCodec().toLowerCase()||"multiopus"===e.getCodec().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())i.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(i.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),i.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const r={payload:e.getType(),config:""};for(const e in t)r.config.length&&(r.config+=";"),t.hasOwnProperty(e)?r.config+=e+"="+t[e]:r.config+=e;i.fmtp.push(r)}}const e=[];for(let t=0;t<i.rtp.length;++t)e.push(i.rtp[t].payload);i.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())i.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:md.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[r,n]of e.getParams().entries())t.params+=(t.params.length?";":"")+r+"="+n;i.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;i.simulcast={};const r=t.getSimulcastStreams(md.SEND),n=t.getSimulcastStreams(md.RECV);if(r&&r.length){let t="";for(let e=0;e<r.length;++e){let n="";for(let t=0;t<r[e].length;++t)n+=(n.length?",":"")+(r[e][t].isPaused()?"~":"")+r[e][t].getId();t+=(t.length?";":"")+n}i.simulcast["dir"+e]="send",i.simulcast["list"+e]=t,e++}if(n&&n.length){let t=[];for(let e=0;e<n.length;++e){let r="";for(let t=0;t<n[e].length;++t)r+=(r.length?",":"")+(n[e][t].isPaused()?"~":"")+n[e][t].getId();t+=(t.length?";":"")+r}i.simulcast["dir"+e]="recv",i.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){i.protocol="UDP/DTLS/SCTP",i.payloads="webrtc-datachannel";const e=n.getDataChannel();i.sctpPort=e.getPort(),i.maxMessageSize=e.getMaxMessageSize()}e.media.push(i)}for(let t of this.streams.values())for(let r of t.getTracks().values())for(let n in e.media){let i=e.media[n];if(r.getMediaId()){if(r.getMediaId()==i.mid){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});i.msid=t.getId()+" "+r.getId();break}}else if(i.type.toLowerCase()===r.getMedia().toLowerCase()){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});break}}return t.mids=t.mids.join(" "),e.groups.push(t),Ol.write(e)}toIceFragmentString(){let e={version:0,media:[],candidates:[]};this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),this.getICE()&&(e.iceUfrag=this.getICE().getUfrag(),e.icePwd=this.getICE().getPwd());for(const t of this.getCandidates())e.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()});return Ol.write(e).slice(10)}}pd.create=function(e){const t=new pd;e.ice&&(e.ice instanceof fd?t.setICE(e.ice.clone()):t.setICE(fd.expand(e.ice))),e.dtls&&(e.dtls instanceof Bl?t.setDTLS(e.dtls):t.setDTLS(Bl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Ul?t.setCrypto(e.crypto):t.setCrypto(Ul.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Ll?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Ll.expand(e.candidates[r]));let r=96,n=1;for(let i in e.capabilities){const o=xd.create(i,e.capabilities[i]);for(const[e,t]of o.getCodecs())t.getType()>=96&&t.setType(r++),t.getRTX()&&t.setRTX(r++);if(e.capabilities[i].extensions)for(let t of e.capabilities[i].extensions)15===n&&n++,o.addExtension(n++,t);t.addMedia(o)}return t},pd.expand=function(e){const t=new pd(e.version);for(let r=0;e.medias&&r<e.medias.length;++r){const n=xd.expand(e.medias[r]);n&&t.addMedia(n)}for(let r=0;e.streams&&r<e.streams.length;++r){const n=kd.expand(e.streams[r]);n&&t.addStream(n)}for(let r=0;e.candidates&&r<e.candidates.length;++r){const n=Ll.expand(e.candidates[r]);n&&t.addCandidate(n)}return e.ice&&t.setICE(fd.expand(e.ice)),e.dtls&&t.setDTLS(Bl.expand(e.dtls)),e.crypto&&t.setCrypto(Bl.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},pd.process=function(e){return pd.parse(e)},pd.parse=function(e){const t=Ol.parse(e),r=new pd;if(r.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),n=String(t.icePwd),i=new fd(e,n);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),r.setICE(i)}for(let e in t.media){const n=t.media[e],i=n.type,o=n.mid?n.mid.toString():e,s=new xd(o,i);if(n.iceUfrag&&n.icePwd){const e=String(n.iceUfrag),i=String(n.icePwd),o=new fd(e,i);o.setLite("ice-lite"==t.icelite),o.setEndOfCandidates("end-of-candidates"==n.endOfCandidates),r.setICE(o)}for(let e=0;n.candidates&&e<n.candidates.length;++e){const t=n.candidates[e],i=new Ll(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);r.addCandidate(i)}const a=n.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let i=_l.ACTPASS;n.setup&&(i=_l.byValue(n.setup)),r.setDTLS(new Bl(i,e,t))}if(n.crypto){const e=n.crypto[0];r.setCrypto(new Ul(e.id,e.suite,e.config,e.sessionConfig))}let c=bd.SENDRECV;n.direction&&(c=bd.byValue(n.direction),s.setDirection(c)),n.control&&s.setControl(n.control),r.setExtmapAllowMixed("extmap-allow-mixed"==n.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const u=new Map;for(let e in n.rtp){const t=n.rtp[e],r=t.payload,i=t.codec;if("RED"===i.toUpperCase()||"ULPFEC"===i.toUpperCase())continue;let o={};for(let e in n.fmtp){const t=n.fmtp[e];if(t.payload===r){const e=t.config.split(";");for(let t in e){const r=e[t].split("="),n=r[0].trim(),i=r.splice(1).join("=").trim();o[n]=i}}}if("RTX"===i.toUpperCase())u.set(parseInt(o.apt),r);else{const e=new Ml(i,r,o);t.encoding>1&&e.setChannels(t.encoding),s.addCodec(e)}}for(let e of u.entries()){const t=s.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;n.rtcpFb&&e<n.rtcpFb.length;++e){const t=s.getCodecForType(n.rtcpFb[e].payload);if(t){const r=n.rtcpFb[e].type,i=n.rtcpFb[e].subtype?n.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new Dl(r,i))}}const l=n.ext;for(let e in l){const t=l[e];s.addExtension(t.value,t.uri)}const d=n.rids;for(let e in d){const t=d[e],r=new gd(t.id,md.byValue(t.direction));let n=[];const i=new Map;if(t.params){const e=Ol.parseParams(t.params);for(let t in e)"pt"===t?n=e[t].split(","):i.set(t,e[t]);r.setFormats(n),r.setParams(i)}s.addRID(r)}const f=[];if(n.simulcast){const e=new yd;if(n.simulcast.dir1){const t=md.byValue(n.simulcast.dir1),r=Ol.parseSimulcastStreamList(n.simulcast.list1);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new vd(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}if(n.simulcast.dir2){const t=md.byValue(n.simulcast.dir2),r=Ol.parseSimulcastStreamList(n.simulcast.list2);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new vd(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}for(let t of e.getSimulcastStreams(md.SEND)){const e=[];for(let r=0;r<t.length;r++){const n=new Id(t[r].getId(),t[r].isPaused()),i=s.getRID(n.getId());if(i){const t=i.getFormats();for(let e=0;t&&e<t.length;++e){const r=s.getCodecForType(t[e]);r&&n.addCodec(r)}n.setParams(i.getParams()),e.push(n)}}e.length&&f.push(e)}s.setSimulcast(e)}const p=new Map;if(n.ssrcs)for(let e in n.ssrcs){let t=n.ssrcs[e],s=t.id,a=t.attribute,c=t.value,u=p.get(s);if(u||(u=new Td(s),p.set(u.getSSRC(),u)),"cname"===a.toLowerCase())u.setCName(c);else if("msid"===a.toLowerCase()){let e=c.split(" "),t=e[0],n=e[1];u.setStreamId(t),u.setTrackId(n);let a=r.getStream(t);a||(a=new kd(t),r.addStream(a));let l=a.getTrack(n);l||(l=new Pd(i,n),l.setMediaId(o),l.setEncodings(f),a.addTrack(l)),l.addSSRC(s)}}if(n.msid){let e=n.msid.split(" "),t=e[0],s=e[1],a=r.getStream(t);a||(a=new kd(t),r.addStream(a));let c=a.getTrack(s);c||(c=new Pd(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c));for(let[e,r]of p.entries())r.getStreamId()||(r.setStreamId(t),r.setTrackId(s),c.addSSRC(e))}for(let[e,t]of p.entries())if(!t.getStreamId()){let n=t.getCName(),s=o;t.setStreamId(n),t.setTrackId(s);let a=r.getStream(n);a||(a=new kd(n),r.addStream(a));let c=a.getTrack(s);c||(c=new Pd(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c)),c.addSSRC(e)}if(n.ssrcGroups)for(let e in n.ssrcGroups){let t=n.ssrcGroups[e],i=t.ssrcs.split(" "),o=new Ed(t.semantics,i),s=p.get(parseInt(i[0]));s&&r.getStream(s.getStreamId()).getTrack(s.getTrackId()).addSourceGroup(o)}if("application"==n.type&&"webrtc-datachannel"==n.payloads){const e=new Cd(n.sctpPort,n.maxMessageSize);s.setDataChannel(e)}r.addMedia(s)}return r};var Ad,Od,Ld={SDPInfo:pd,CandidateInfo:Ll,CodecInfo:Ml,DTLSInfo:Bl,CryptoInfo:Ul,ICEInfo:fd,MediaInfo:xd,Setup:_l,SourceGroupInfo:Ed,SourceInfo:Td,StreamInfo:kd,TrackInfo:Pd,RTCPFeedbackInfo:Dl,TrackEncodingInfo:Id,Direction:bd},Md=(Ad=!1,(Od=/[ac]/).exec=function(){return Ad=!0,/./.exec.apply(this,arguments)},!0===Od.test("abc")&&Ad),Nd=/./.test;xr({target:"RegExp",proto:!0,forced:!Md},{test:function(e){var t=gt(this),r=is(e),n=t.exec;if(!ye(n))return J(Nd,t,r);var i=J(n,t,r);return null!==i&&(gt(i),!0)}});var jd=V((function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="model",u="name",l="type",d="vendor",f="version",p="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",w="embedded",E="Amazon",T="Apple",I="ASUS",R="BlackBerry",P="Browser",k="Chrome",A="Firefox",O="Google",L="Huawei",D="LG",M="Microsoft",N="Motorola",j="Opera",_="Samsung",B="Sharp",U="Sony",V="Xiaomi",F="Zebra",z="Facebook",$=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},G=function(e,t){return typeof e===a&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,350)},H=function(e,t){for(var r,o,a,c,u,l,d=0;d<t.length&&!u;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!u;)if(u=f[r++].exec(e))for(a=0;a<p.length;a++)l=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):n:this[c[0]]=l?c[1].call(this,l,c[2]):n:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):n):this[c]=l||n;d+=2}},X=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(G(t[r][i],e))return"?"===r?n:r}else if(G(t[r],e))return"?"===r?n:r;return e},Y={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,j+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[u,j]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+P]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+P],f],[/\bfocus\/([\w\.]+)/i],[f,[u,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+P]],[/fxios\/([-\w\.]+)/i],[f,[u,A]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+P]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+P],f],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,z],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,k+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+P]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,X,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,A+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,f]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,W]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",W]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,W]]],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],[c,[d,_],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,_],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[d,T],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,T],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,L],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[d,L],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,V],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,V],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[l,m]],[/\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],[c,[d,N],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,N],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,D],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,D],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[l,m]],[/(pixel c)\b/i],[c,[d,O],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,O],[l,m]],[/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],[c,[d,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,U],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,E],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,E],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,R],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,I],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,I],[l,m]],[/(nexus 9)/i],[c,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[l,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,B],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[l,m]],[/(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],[d,c,[l,g]],[/(surface duo)/i],[c,[d,M],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[l,m]],[/(u304aa)/i],[c,[d,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[l,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[l,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,c,[l,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,M],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,F],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,F],[l,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[l,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[c,[d,U],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,M],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,_],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,D],[l,v]],[/(apple) ?tv/i],[d,[c,T+" TV"],[l,v]],[/crkey/i],[[c,k+"cast"],[d,O],[l,v]],[/droid.+aft(\w)( bui|\))/i],[c,[d,E],[l,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[d,B],[l,v]],[/(bravia[\w ]+)( bui|\))/i],[c,[d,U],[l,v]],[/(mitv-\w{5}) bui/i],[c,[d,V],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,q],[c,q],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[d,c,[l,y]],[/droid.+; (glass) \d/i],[c,[d,O],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,F],[l,y]],[/(quest( 2)?)/i],[c,[d,z],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[f,X,Y]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[f,X,Y]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[u,k+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,f]]},K=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof K))return new K(e,t).getResult();var i=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),h=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e[p]=n,H.call(e,i,h.cpu),e},this.getDevice=function(){var e={};return e[d]=n,e[c]=n,e[l]=n,H.call(e,i,h.device),e},this.getEngine=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.engine),e},this.getOS=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return i},this.setUA=function(e){return i=typeof e===a&&e.length>350?q(e,350):e,this},this.setUA(i),this};K.VERSION="0.7.32",K.BROWSER=$([u,f,"major"]),K.CPU=$([p]),K.DEVICE=$([c,d,l,h,m,v,g,y,w]),K.ENGINE=K.OS=$([u,f]),e.exports&&(t=e.exports=K),t.UAParser=K;var Z=typeof r!==o&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var Q=new K;Z.ua=Q.getResult(),Z.ua.get=function(){return Q.getUA()},Z.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)Z.ua[r]=t[r]}}}("object"==typeof window?window:U)}));const _d=["iOS"];class Sd extends jd{constructor(){super(window.navigator.userAgent)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let r=!0;return r=!new RegExp(_d.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&r}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const Bd=Bn.get("SdpParser"),Ud=Array.from({length:31},(e,t)=>t+35),Vd=Array.from({length:32},(e,t)=>t+96),Fd=Array.from({length:14},(e,t)=>t+1),$d=Array.from({length:240},(e,t)=>t+16);class Rd{static setSimulcast(e,t){if(Bd.info("Setting simulcast. Codec: ",t),!(new Sd).isChrome())return Bd.warn("Simulcast is only available in Google Chrome browser"),e;if("h264"!==t&&"vp8"!==t)return Bd.warn("Simulcast is only available in h264 and vp8 codecs"),e;try{const t=/m=video[\s\S]*?a=ssrc:(\d*) msid:([\s\S]+?)\r\n/,r=/m=video[\s\S]*?a=ssrc:(\d*) cname:([\s\S]+?)\r\n/.exec(e),n=r[1],i=r[2],o=t.exec(e)[2],s=2,a=[n];for(let t=0;t<s;++t){const r=100+2*t,n=r+1;a.push(r),e+="a=ssrc-group:FID "+r+" "+n+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+a.join(" ")+"\r\n",Bd.info("Simulcast setted"),Bd.debug("Simulcast SDP: ",e),e}catch(e){throw Bd.error("Error setting SDP for simulcast: ",e),e}}static setStereo(e){return Bd.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),Bd.info("Replaced SDP response for support stereo"),Bd.debug("New SDP value: ",e),e}static setDTX(e){return Bd.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),Bd.info("Replaced SDP response for support dtx"),Bd.debug("New SDP value: ",e),e}static setAbsoluteCaptureTime(e){const t="a=extmap:"+Rd.getAvailableHeaderExtensionIdRange(e)[0]+" http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),Bd.info("Replaced SDP response for setting absolute capture time"),Bd.debug("New SDP value: ",e),e}static setDependencyDescriptor(e){const t="a=extmap:"+Rd.getAvailableHeaderExtensionIdRange(e)[0]+" https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),Bd.info("Replaced SDP response for setting depency descriptor"),Bd.debug("New SDP value: ",e),e}static setVideoBitrate(e,t){if(t<1)Bd.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const r=Ld.SDPInfo.parse(e),n=r.getMedia("video");Bd.info("Setting video bitrate"),n.setBitrate(t),e=r.toString()}return e}static removeSdpLine(e,t){return Bd.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),Bd.debug("SDP trimmed result: ",e),e}static adaptCodecName(e,t,r){if(!e)return e;const n=new RegExp("".concat(t),"i");return e.replace(n,r)}static setMultiopus(e,t){if(!(new Sd).isFirefox()&&(!t||Gd(t)))if(e.includes("multiopus/48000/6"))Bd.info("Multiopus already setted");else{Bd.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],r=Rd.getAvailablePayloadTypeRange(e)[0],n=t.replace("\r\n"," ")+r+"\r\na=rtpmap:"+r+" multiopus/48000/6\r\na=fmtp:"+r+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,n),Bd.info("Multiopus offer created"),Bd.debug("SDP parsed for multioups: ",e)}return e}static getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let r=Vd.concat(Ud);var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let r=Fd.concat($d);var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static renegotiate(e,t){const r=Ld.SDPInfo.parse(e),n=Ld.SDPInfo.parse(t);var i,o=B(r.getMedias());try{for(o.s();!(i=o.n()).done;){const t=i.value;let r=n.getMediaById(t.getId());if(!r){r=new Ld.MediaInfo(t.getId(),t.getType()),r.setDirection(Ld.Direction.reverse(t.getDirection()));const i=n.getMedia(t.getType());if(i){r.setCodecs(i.getCodecs());var s,a=B(i.getExtensions());try{for(a.s();!(s=a.n()).done;){const e=N(s.value,2),t=e[0],n=e[1];r.addExtension(t,n)}}catch(e){a.e(e)}finally{a.f()}}n.addMedia(r)}}}catch(e){o.e(e)}finally{o.f()}return n.toString()}static updateMissingVideoExtensions(e,t){var r;const n=Ld.SDPInfo.parse(e),i=null===(r=Ld.SDPInfo.parse(t).getMediasByType("video")[0])||void 0===r?void 0:r.getExtensions();if(i||i.length){var o,s=B(n.getMediasByType("video"));try{for(s.s();!(o=s.n()).done;){const t=o.value,r=t.getExtensions();i.forEach((n,i)=>{if(!r.get(i)){const r=t.getId(),o="a=extmap:"+i+" "+n+"\r\n",s=new RegExp("(a=mid:"+r+"\r\n(?:.*\r\n)*?)","g");e=e.replace(s,(e,t,r)=>t+o)}})}}catch(e){s.e(e)}finally{s.f()}return e}}}const Gd=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2);var Wd=ir.indexOf,qd=nn([].indexOf),Xd=!!qd&&1/qd([1],1,-0)<0,Yd=function(e,t){var r=[].indexOf;return!!r&&q((function(){r.call(null,(function(){return 1}),1)}))}();xr({target:"Array",proto:!0,forced:Xd||!Yd},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Xd?qd(this,e,t)||0:Wd(this,e,t)}});class Dd extends cu{constructor(e,t){super(),this.namespace=e,this.tm=t}cmd(e,t){return this.tm.cmd(e,t,this.namespace)}event(e,t){return this.tm.event(e,t,this.namespace)}close(){return this.tm.namespaces.delete(this.namespace)}}var Jd=class extends cu{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=t=>{let r;try{r=JSON.parse(t.utf8Data||t.data||t)}catch(e){return}switch(r.type){case"cmd":const t={name:r.name,data:r.data,namespace:r.namespace,accept:t=>{e.send(JSON.stringify({type:"response",transId:r.transId,data:t}))},reject:t=>{e.send(JSON.stringify({type:"error",transId:r.transId,data:t}))}};if(t.namespace){const e=this.namespaces.get(t.namespace);e?e.emit("cmd",t):this.emit("cmd",t)}else this.emit("cmd",t);break;case"response":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.resolve(r.data);break}case"error":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.reject(r.data);break}case"event":const i={name:r.name,data:r.data,namespace:r.namespace};if(i.namespace){var n=this.namespaces.get(i.namespace);n?n.emit("event",i):this.emit("event",i)}else this.emit("event",i)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}cmd(e,t,r){return new Promise((n,i)=>{if(!e||0===e.length)throw new Error("Bad command name");const o={type:"cmd",transId:this.maxId++,name:e,data:t};r&&(o.namespace=r);const s=JSON.stringify(o);o.resolve=n,o.reject=i,this.transactions.set(o.transId,o);try{this.transport.send(s)}catch(e){throw this.transactions.delete(o.transId),e}})}event(e,t,r){if(!e||0===e.length)throw new Error("Bad event name");const n={type:"event",name:e,data:t};r&&(n.namespace=r);const i=JSON.stringify(n);this.transport.send(i)}namespace(e){let t=this.namespaces.get(e);return t||(t=new Dd(e,this),this.namespaces.set(e,t),t)}close(){for(const e of this.namespaces.values())e.close();this.transport.removeListener?this.transport.removeListener("message",this.listener):this.transport.removeEventListener("message",this.listener)}};const Kd=Bn.get("Signaling"),Zd="wsConnectionSuccess",Qd="wsConnectionError",ef="broadcastEvent",tf={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1"},rf={OPUS:"opus",MULTIOPUS:"multiopus"};class zd extends cu{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{streamName:null,url:"ws://localhost:8080/"};super(),this.streamName=e.streamName,this.wsUrl=e.url,this.webSocket=null,this.transactionManager=null,this.serverId=null,this.clusterId=null,(new Sd).isSafari()&&(tf.H265="h265")}connect(){var e=this;return D((function*(){var t;return Kd.info("Connecting to Signaling Server"),e.transactionManager&&(null===(t=e.webSocket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN?(Kd.info("Connected to server: ",e.webSocket.url),Kd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Zd,{ws:e.webSocket,tm:e.transactionManager}),e.webSocket):new Promise((t,r)=>{e.webSocket=new WebSocket(e.wsUrl),e.transactionManager=new Jd(e.webSocket),e.webSocket.onopen=()=>{Kd.info("WebSocket opened"),e.transactionManager.on("event",t=>{e.emit(ef,t)}),Kd.info("Connected to server: ",e.webSocket.url),Kd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Zd,{ws:e.webSocket,tm:e.transactionManager}),t(e.webSocket)},e.webSocket.onerror=()=>{Kd.error("WebSocket not connected: ",e.webSocket.url),e.emit(Qd,e.webSocket.url),r(e.webSocket.url)},e.webSocket.onclose=()=>{e.webSocket=null,e.transactionManager=null,Kd.info("Connection closed with Signaling Server."),e.emit("wsConnectionClose")}})}))()}close(){var e;Kd.info("Closing connection with Signaling Server."),null===(e=this.webSocket)||void 0===e||e.close()}subscribe(e,t){var r=arguments,n=this;return D((function*(){let i=r.length>2&&void 0!==r[2]?r[2]:null,o=r.length>3&&void 0!==r[3]?r[3]:null;Kd.info("Starting subscription to streamName: ",n.streamName),Kd.debug("Subcription local description: ",e);const s=nf(t,i,o),a={sdp:e=Rd.adaptCodecName(e,"AV1X",tf.AV1),streamId:n.streamName,pinnedSourceId:s.pinnedSourceId,excludedSourceIds:s.excludedSourceIds};s.vad&&(a.vad=!0),Array.isArray(s.events)&&(a.events=s.events),s.forcePlayoutDelay&&(a.forcePlayoutDelay=s.forcePlayoutDelay);try{var c,u,l,d,f;yield n.connect(),Kd.info("Sending view command");const e=yield n.transactionManager.cmd("view",a),t=null===(c=(u=RTCRtpReceiver).getCapabilities)||void 0===c||null===(l=c.call(u,"video"))||void 0===l||null===(d=l.codecs)||void 0===d||null===(f=d.find)||void 0===f?void 0:f.call(d,e=>"video/AV1X"===e.mimeType);return e.sdp=t?Rd.adaptCodecName(e.sdp,tf.AV1,"AV1X"):e.sdp,Kd.info("Command sent, subscriberId: ",e.subscriberId),Kd.debug("Command result: ",e),n.serverId=e.subscriberId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Kd.error("Error sending view command, error: ",e),e}}))()}publish(e,t){var r=arguments,n=this;return D((function*(){const i=of(t,r.length>2&&void 0!==r[2]?r[2]:null,r.length>3&&void 0!==r[3]?r[3]:null);Kd.info("Starting publishing to streamName: ".concat(n.streamName,", codec: ").concat(i.codec)),Kd.debug("Publishing local description: ",e);const o=Object.values(tf);if(-1===o.indexOf(i.codec))throw Kd.error("Invalid codec. Possible values are: ",o),new Error("Invalid codec. Possible values are: ".concat(o));i.codec===tf.AV1&&(e=Rd.adaptCodecName(e,"AV1X",tf.AV1));const s={name:n.streamName,sdp:e,codec:i.codec,sourceId:i.sourceId};null!==i.record&&(s.record=i.record),Array.isArray(i.events)&&(s.events=i.events);try{yield n.connect(),Kd.info("Sending publish command");const e=yield n.transactionManager.cmd("publish",s);if(i.codec===tf.AV1){var a,c,u,l,d;const t=null===(a=(c=RTCRtpSender).getCapabilities)||void 0===a||null===(u=a.call(c,"video"))||void 0===u||null===(l=u.codecs)||void 0===l||null===(d=l.find)||void 0===d?void 0:d.call(l,e=>"video/AV1X"===e.mimeType);e.sdp=t?Rd.adaptCodecName(e.sdp,tf.AV1,"AV1X"):e.sdp}return Kd.info("Command sent, publisherId: ",e.publisherId),Kd.debug("Command result: ",e),n.serverId=e.publisherId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Kd.error("Error sending publish command, error: ",e),e}}))()}cmd(e,t){var r=this;return D((function*(){return Kd.info("Sending cmd: ".concat(e)),r.transactionManager.cmd(e,t)}))()}}const nf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={vad:e,pinnedSourceId:t,excludedSourceIds:r}),n},of=(e,t,r)=>{let n="object"==typeof e?e:{};if(0===Object.keys(n).length){const i=tf.H264;n={codec:null!=e?e:i,record:t,sourceId:r}}return n},sf=Bn.get("PeerConnection"),cf={track:"track",connectionStateChange:"connectionStateChange"},uf={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class Hd extends cu{constructor(){super(),this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null}createRTCPeer(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:null;sf.info("Creating new RTCPeerConnection"),sf.debug("RTC configuration provided by user: ",r),t.peer=ff(t,r)}))()}getRTCPeer(){return sf.info("Getting RTC Peer"),this.peer}closeRTCPeer(){var e=this;return D((function*(){var t;sf.info("Closing RTCPeerConnection"),null===(t=e.peer)||void 0===t||t.close(),e.peer=null,e.stopStats(),e.emit(cf.connectionStateChange,"closed")}))()}setRTCRemoteSDP(e){var t=this;return D((function*(){sf.info("Setting RTC Remote SDP");const r={type:"answer",sdp:e};try{yield t.peer.setRemoteDescription(r),sf.info("RTC Remote SDP was set successfully."),sf.debug("RTC Remote SDP new value: ",e)}catch(e){throw sf.error("Error while setting RTC Remote SDP: ",e),e}}))()}getRTCLocalSDP(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:uf;sf.info("Getting RTC Local SDP"),r=O(O({},uf),r),sf.debug("Options: ",r);const n=df(r.mediaStream);n?hf(t.peer,n,r):mf(t.peer,r),sf.info("Creating peer offer");const i=yield t.peer.createOffer();return sf.info("Peer offer created"),sf.debug("Peer offer response: ",i.sdp),t.sessionDescription=i,r.disableAudio||(r.stereo&&(t.sessionDescription.sdp=Rd.setStereo(t.sessionDescription.sdp)),r.dtx&&(t.sessionDescription.sdp=Rd.setDTX(t.sessionDescription.sdp)),t.sessionDescription.sdp=Rd.setMultiopus(t.sessionDescription.sdp,n)),!r.disableVideo&&r.simulcast&&(t.sessionDescription.sdp=Rd.setSimulcast(t.sessionDescription.sdp,r.codec)),r.absCaptureTime&&(t.sessionDescription.sdp=Rd.setAbsoluteCaptureTime(t.sessionDescription.sdp)),r.dependencyDescriptor&&(t.sessionDescription.sdp=Rd.setDependencyDescriptor(t.sessionDescription.sdp)),r.setSDPToPeer&&(yield t.peer.setLocalDescription(t.sessionDescription),sf.info("Peer local description set")),t.sessionDescription.sdp}))()}addRemoteTrack(e,t){var r=this;return D((function*(){const n=yield new Promise((n,i)=>{try{const i=r.peer.addTransceiver(e,{direction:"recvonly"});i.resolve=n,i.streams=t}catch(e){i(e)}});var i,o=B(t);try{for(o.s();!(i=o.n()).done;)i.value.addTrack(n.receiver.track)}catch(e){o.e(e)}finally{o.f()}return n}))()}updateBandwidthRestriction(e,t){return sf.info("Updating bandwidth restriction, bitrate value: ",t),sf.debug("SDP value: ",e),Rd.setVideoBitrate(e,t)}updateBitrate(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:0;if(!t.peer)throw sf.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");sf.info("Updating bitrate to value: ",r),t.sessionDescription=yield t.peer.createOffer(),yield t.peer.setLocalDescription(t.sessionDescription);const n=t.updateBandwidthRestriction(t.peer.remoteDescription.sdp,r);yield t.setRTCRemoteSDP(n),sf.info("Bitrate restirctions updated: ","".concat(r>0?r:"unlimited"," kbps"))}))()}getRTCPeerStatus(){if(sf.info("Getting RTC peer status"),!this.peer)return null;const e=gf(this.peer);return sf.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void sf.error("Could not change track if there is not an active connection.");const t=this.peer.getSenders().find(t=>t.track.kind===e.kind);t?t.replaceTrack(e):sf.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Sd;if(t.isFirefox())return(e=>"video"===e?{codecs:[{codec:"vp8",mimeType:"video/VP8"},{codec:"vp9",mimeType:"video/VP9"},{codec:"h264",mimeType:"video/H264"}],headerExtensions:[]}:"audio"===e?{codecs:[{codec:"opus",mimeType:"audio/opus",channels:2}],headerExtensions:[]}:null)(e);const r=RTCRtpSender.getCapabilities(e);if(r){const o={};let s=new RegExp("^video/(".concat(Object.values(tf).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(rf).join("|"),")$"),"i"),t.isChrome()&&(o.multiopus={mimeType:"audio/multiopus",channels:6}));var n,i=B(r.codecs);try{for(i.s();!(n=i.n()).done;){const e=n.value,t=e.mimeType.match(s);if(t){const r=t[1].toLowerCase();if(o[r]=O(O({},o[r]),{},{mimeType:e.mimeType}),e.scalabilityModes){let t=o[r].scalabilityModes||[];t=[...t,...e.scalabilityModes],o[r].scalabilityModes=[...new Set(t)]}e.channels&&(o[r].channels=e.channels)}}}catch(e){i.e(e)}finally{i.f()}r.codecs=Object.keys(o).map(e=>O({codec:e},o[e]))}return r}getTracks(){var e,t;return null===(e=this.peer)||void 0===e||null===(t=e.getSenders())||void 0===t?void 0:t.map(e=>e.track)}initStats(){this.peerConnectionStats?sf.warn("Cannot init peer stats: Already initialized"):this.peer?(this.peerConnectionStats=new iu(this.peer),this.peerConnectionStats.init(),wu(this.peerConnectionStats,this,["stats"])):sf.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null===(e=this.peerConnectionStats)||void 0===e||e.stop(),this.peerConnectionStats=null}}const lf=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,df=e=>{if(!e)return null;if(e instanceof MediaStream&&lf(e))return e;if(!(e instanceof MediaStream)){sf.info("Creating MediaStream to add received tracks.");const n=new MediaStream;var t,r=B(e);try{for(r.s();!(t=r.n()).done;){const e=t.value;n.addTrack(e)}}catch(e){r.e(e)}finally{r.f()}if(lf(n))return n}throw sf.error("MediaStream must have 1 audio track and 1 video track, or at least one of them."),new Error("MediaStream must have 1 audio track and 1 video track, or at least one of them.")},ff=(e,t)=>{const r=new RTCPeerConnection(t);return pf(e,r),r},pf=(e,t)=>{var r;t.ontrack=t=>{var r;if(sf.info("New track from peer."),sf.debug("Track event value: ",t),null!=t&&null!==(r=t.transceiver)&&void 0!==r&&r.resolve){const e=t.transceiver.resolve;delete t.transceiver.resolve,e(t.transceiver)}e.emit(cf.track,t)},t.connectionState?t.onconnectionstatechange=r=>{sf.info("Peer connection state change: ",t.connectionState),e.emit(cf.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=r=>{sf.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(cf.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=(r=D((function*(e){if(!t.remoteDescription)return;sf.info("Peer onnegotiationneeded, updating local description");const r=yield t.createOffer();sf.info("Peer onnegotiationneeded, got local offer",r.sdp),r.sdp=Rd.updateMissingVideoExtensions(r.sdp,t.remoteDescription.sdp),yield t.setLocalDescription(r);const n=Rd.renegotiate(r.sdp,t.remoteDescription.sdp);sf.info("Peer onnegotiationneeded, updating remote description",n),yield t.setRemoteDescription({type:"answer",sdp:n}),sf.info("Peer onnegotiationneeded, renegotiation done")})),function(e){return r.apply(this,arguments)})},hf=(e,t,r)=>{sf.info("Adding mediaStream tracks to RTCPeerConnection");var n,i=B(t.getTracks());try{for(i.s();!(n=i.n()).done;){const i=n.value,o={streams:[t]};"audio"===i.kind&&(o.direction=r.disableAudio?"inactive":"sendonly"),"video"===i.kind&&(o.direction=r.disableVideo?"inactive":"sendonly",r.scalabilityMode&&(new Sd).isChrome()?(sf.debug("Video track with scalability mode: ".concat(r.scalabilityMode,".")),o.sendEncodings=[{scalabilityMode:r.scalabilityMode}]):r.scalabilityMode&&sf.warn("SVC is only supported in Google Chrome")),e.addTransceiver(i,o),sf.info("Track '".concat(i.label,"' added: "),"id: ".concat(i.id),"kind: ".concat(i.kind))}}catch(e){i.e(e)}finally{i.f()}},mf=(e,t)=>{const r=new Sd;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});r.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let r=0;r<t.multiplexedAudioTracks;r++)e.addTransceiver("audio",{direction:"recvonly"})},gf=e=>{var t;const r=null!==(t=e.connectionState)&&void 0!==t?t:e.iceConnectionState;switch(r){case"checking":return"connecting";case"completed":return"connected";default:return r}},yf=Bn.get("Director");let wf="",bf="https://director.millicast.com";class af{static setEndpoint(e){bf=e.replace(/\/$/,"")}static getEndpoint(){return bf}static setLiveDomain(e){wf=e.replace(/\/$/,"")}static getLiveDomain(){return wf}static getPublisher(e){var t=arguments,r=this;return D((function*(){const n=Sf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:"WebRtc");yf.info("Getting publisher connection path for stream name: ",n.streamName);const i={streamName:n.streamName,streamType:n.streamType},o={"Content-Type":"application/json",Authorization:"Bearer ".concat(n.token)},s="".concat(r.getEndpoint(),"/api/director/publish");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=xf(e),yf.debug("Getting publisher response: ",e),e.data}catch(e){throw yf.error("Error while getting publisher connection path. ",e),e}}))()}static getSubscriber(e){var t=arguments,r=this;return D((function*(){const n=Cf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:null);yf.info("Getting subscriber connection data for stream name: ".concat(n.streamName," and account id: ").concat(n.streamAccountId));const i={streamAccountId:n.streamAccountId,streamName:n.streamName};let o={"Content-Type":"application/json"};n.subscriberToken&&(o=O(O({},o),{},{Authorization:"Bearer ".concat(n.subscriberToken)}));const s="".concat(r.getEndpoint(),"/api/director/subscribe");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=xf(e),yf.debug("Getting subscriber response: ",e),e.data}catch(e){throw yf.error("Error while getting subscriber connection path. ",e),e}}))()}}const Sf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={token:e,streamName:t,streamType:r}),n},Cf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={streamName:e,streamAccountId:t,subscriberToken:r}),n},xf=e=>{if(af.getLiveDomain()){const t=/\/\/(.*?)\//,r=e.data.urls.map(e=>{const r=t.exec(e);return e.replace(r[1],af.getLiveDomain())});e.data.urls=r}return e};function Tf(e){this.message=e}function If(e){this.message=e}let Rf;Tf.prototype=new Error,Tf.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),If.prototype=new Error,If.prototype.name="InvalidTokenError",V((function(e,t){!function(r){if(null!=t&&"number"!=typeof t.nodeType)e.exports=r();else{var n=r(),i="undefined"!=typeof self?self:$.global;"function"!=typeof i.btoa&&(i.btoa=n.btoa),"function"!=typeof i.atob&&(i.atob=n.atob)}}((function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(r){for(var n,i,o=String(r),s=0,a=e,c="";o.charAt(0|s)||(a="=",s%1);c+=a.charAt(63&n>>8-s%1*8)){if((i=o.charCodeAt(s+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|i}return c},atob:function(r){var n=String(r).replace(/[=]+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,s=0,a=0,c="";o=n.charAt(a++);~o&&(i=s%4?64*i+o:o,s++%4)?c+=String.fromCharCode(255&i>>(-2*s&6)):0)o=e.indexOf(o);return c}}}))}));class vf extends cu{constructor(e,t,r,n){if(super(),Rf=r,!e)throw Rf.error("Stream Name is required to construct this module."),new Error("Stream Name is required to construct this module.");if(!t)throw Rf.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new Hd,this.signaling=null,this.streamName=e,this.autoReconnect=n,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;Rf.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null===(e=this.signaling)||void 0===e||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new Hd}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return Rf.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Qd,()=>{!this.firstReconnection&&this.alreadyDisconnected||(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(cf.connectionStateChange,e=>{("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}reconnect(e){var t=this;return D((function*(){try{t.isActive()||t.stopReconnection||(t.stop(),t.emit("reconnect",{timeout:Pf(t.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),yield t.connect(t.options),t.alreadyDisconnected=!1,t.reconnectionInterval=1e3,t.firstReconnection=!0)}catch(e){t.reconnectionInterval=Pf(t.reconnectionInterval),Rf.error("Reconnection failed, retrying in ".concat(t.reconnectionInterval,"ms. "),e),setTimeout(()=>t.reconnect({error:e}),t.reconnectionInterval)}}))()}}const Pf=e=>e<32e3?2*e:e;Bn.get("Publish"),tf.H264;const kf=Bn.get("View"),Af={disableVideo:!1,disableAudio:!1,peerConfig:{}};class Ef extends vf{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super(e,t,kf,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]),r&&this.on(cf.track,e=>{r.srcObject=e.streams[0]})}connect(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:Af;t.options=O(O(O({},Af),r),{},{setSDPToPeer:!1}),yield t.initConnection({migrate:!1})}))()}select(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:{};kf.debug("Viewer select layer values: ",r),yield t.signaling.cmd("select",{layer:r}),kf.info("Connected to streamName: ",t.streamName)}))()}addRemoteTrack(e,t){var r=this;return D((function*(){return kf.info("Viewer adding remote % track",e),r.webRTCPeer.addRemoteTrack(e,t)}))()}project(e,t){var r=this;return D((function*(){var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value;if(!e.trackId&&!e.media)throw kf.error("Error in projection mapping, trackId or mediaId must be set"),new Error("Error in projection mapping, trackId or mediaId must be set");const t=r.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw kf.error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers")),new Error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers"))}}catch(e){i.e(e)}finally{i.f()}kf.debug("Viewer project source: layer mappings: ",e,t),yield r.signaling.cmd("project",{sourceId:e,mapping:t}),kf.info("Projection done")}))()}unproject(e){var t=this;return D((function*(){kf.debug("Viewer unproject mediaIds: ",e),yield t.signaling.cmd("unproject",{mediaIds:e}),kf.info("Unprojection done")}))()}replaceConnection(){var e=this;return D((function*(){kf.info("Migrating current connection"),yield e.initConnection({migrate:!0})}))()}initConnection(e){var t=this;return D((function*(){var r,n;let i,o;if(kf.debug("Viewer connect options values: ",t.options),t.stopReconnection=!1,!e.migrate&&t.isActive())throw kf.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{var s;o=yield t.tokenGenerator(),t.options.peerConfig.iceServers=null===(s=o)||void 0===s?void 0:s.iceServers}catch(e){throw kf.error("Error generating token."),e}if(!o)throw kf.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const a=new zd({streamName:t.streamName,url:"".concat(o.urls[0],"?token=").concat(o.jwt)}),c=e.migrate?new Hd:t.webRTCPeer;yield c.createRTCPeer(t.options.peerConfig),null===(r=t.stopReemitingWebRTCPeerInstanceEvents)||void 0===r||r.call(t),null===(n=t.stopReemitingSignalingInstanceEvents)||void 0===n||n.call(t),t.stopReemitingWebRTCPeerInstanceEvents=wu(c,t,Object.values(cf)),t.stopReemitingSignalingInstanceEvents=wu(a,t,[ef]);const u=c.getRTCLocalSDP(O(O({},t.options),{},{stereo:!0})),l=a.connect();i=yield Promise.all([u,l]);const d=i[0];let f=t.signaling;t.signaling=a;const p=t.signaling.subscribe(d,O(O({},t.options),{},{vad:t.options.multiplexedAudioTracks>0})),h=c.peer.setLocalDescription(c.sessionDescription);i=yield Promise.all([p,h]);const m=i[0];yield c.setRTCRemoteSDP(m),kf.info("Connected to streamName: ",t.streamName);let g=t.webRTCPeer;t.webRTCPeer=c,t.setReconnect(),e.migrate&&t.webRTCPeer.on(cf.connectionStateChange,e=>{if("connected"===e)setTimeout(()=>{var e,t,r,n;null===(e=f)||void 0===e||null===(t=e.close)||void 0===t||t.call(e),null===(r=g)||void 0===r||null===(n=r.closeRTCPeer)||void 0===n||n.call(r),f=g=null,kf.info("Current connection migrated")},1e3);else if(["disconnected","failed","closed"].includes(e)){var t,r,n,i;null===(t=f)||void 0===t||null===(r=t.close)||void 0===r||r.call(t),null===(n=g)||void 0===n||null===(i=n.closeRTCPeer)||void 0===i||i.call(n),f=g=null}})}))()}}var Of;!function(e){e[e.Err=0]="Err",e[e.Idle=1]="Idle",e[e.Receiving=2]="Receiving",e[e.Broadcasting=3]="Broadcasting"}(Of||(Of={}));class MillicastAdapter{constructor(e,r,n=t("rts/millicast")){this.player=e,this.src=r,this.log=n,af.setEndpoint("https://realtime1.wowza.com"),this.player.on("tracks:video:select",e=>{var t;if(!this.engine||!this.engine.isActive())return;const r=e.detail.track,n=null===(t=this.player.tracks)||void 0===t?void 0:t.find(e=>e.selected&&e!==r);n&&(n.selected=!1),this.engine.project("Main"===r.name?"":r.name,r.data.tracks)})}static wants(e){return e.type==MillicastAdapter.Type}async load(){this.log("loading",this.src.streamName);const e=this.engine=new Ef(this.src.streamName,()=>af.getSubscriber(Object.assign(Object.assign({},this.src),{streamAccountId:"dev"in this.src?"3caeCP":"bUEzT6"})),this.player);this.player.original_src=MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT,e.on("broadcastEvent",e=>{switch(e.name){case"active":return this.handleActive(e);case"inactive":return this.handleInactive(e)}}),await this.connect()}handleActive(e){return this.player.hasState("is-error")&&this.player.emit("recover"),this.player.emit("rts/status",{status:Of.Receiving,data:e.data})}handleInactive(e){const t={status:Of.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit("rts/status",t),this.player.emit("error",Object.assign({fatal:!1},t))}async connect(){try{await this._connect()}catch(e){this.log("Connection failed",e),this.player.emit("error",e),setTimeout(()=>{0==this.player.reaper||this.player.currentSrc||(this.player.emit("recover"),this.connect())},3e3)}}async _connect(){var e;const t=this.engine;t&&(await t.connect(),null===(e=t.webRTCPeer)||void 0===e||e.initStats())}stop(){var e;null===(e=this.engine)||void 0===e||e.stop()}}
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.rts=t())}(this,(function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function t(e,t){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),n=(n,...i)=>{try{const o=(null==t?void 0:t.debug)||r;o&&e.match(o)&&console.log(`flowplayer/${e} -- ${n}`,...i)}catch(e){console.warn(e)}};return n.log=n,n}function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}var i=r,o=n;function s(e){if(i===setTimeout)return setTimeout(e,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}"function"==typeof e.setTimeout&&(i=setTimeout),"function"==typeof e.clearTimeout&&(o=clearTimeout);var a,c=[],u=!1,l=-1;function d(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(d);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===n||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}p.prototype.run=function(){this.fun.apply(null,this.array)};function h(){}var m=h,g=h,v=h,y=h,w=h,E=h,T=h;var I=e.performance||{},R=I.now||I.mozNow||I.msNow||I.oNow||I.webkitNow||function(){return(new Date).getTime()};var P=new Date;var k={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||u||s(f)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:m,addListener:g,once:v,off:y,removeListener:w,removeAllListeners:E,emit:T,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*R.call(I),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-P)/1e3}};function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function L(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function D(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){L(o,n,i,s,a,"next",e)}function a(e){L(o,n,i,s,a,"throw",e)}s(void 0)}))}}function M(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||j(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return _(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function B(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=j(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};function V(e){var t={exports:{}};return e(t,t.exports),t.exports}var F,z,G=function(e){return e&&e.Math==Math&&e},W=G("object"==typeof globalThis&&globalThis)||G("object"==typeof window&&window)||G("object"==typeof self&&self)||G("object"==typeof U&&U)||function(){return this}()||Function("return this")(),q=function(e){try{return!!e()}catch(e){return!0}},H=!q((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),X=!q((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Y=Function.prototype.call,J=X?Y.bind(Y):function(){return Y.apply(Y,arguments)},K={}.propertyIsEnumerable,Z=Object.getOwnPropertyDescriptor,Q={f:Z&&!K.call({1:2},1)?function(e){var t=Z(this,e);return!!t&&t.enumerable}:K},ee=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},te=Function.prototype,re=te.call,ne=X&&te.bind.bind(re,re),ie=X?ne:function(e){return function(){return re.apply(e,arguments)}},oe=ie({}.toString),se=ie("".slice),ae=function(e){return se(oe(e),8,-1)},ce=Object,ue=ie("".split),le=q((function(){return!ce("z").propertyIsEnumerable(0)}))?function(e){return"String"==ae(e)?ue(e,""):ce(e)}:ce,de=function(e){return null==e},fe=TypeError,pe=function(e){if(de(e))throw fe("Can't call method on "+e);return e},he=function(e){return le(pe(e))},me="object"==typeof document&&document.all,ge={all:me,IS_HTMLDDA:void 0===me&&void 0!==me},ve=ge.all,ye=ge.IS_HTMLDDA?function(e){return"function"==typeof e||e===ve}:function(e){return"function"==typeof e},we=ge.all,be=ge.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:ye(e)||e===we}:function(e){return"object"==typeof e?null!==e:ye(e)},Se=function(e){return ye(e)?e:void 0},Ce=function(e,t){return arguments.length<2?Se(W[e]):W[e]&&W[e][t]},xe=ie({}.isPrototypeOf),Ee=Ce("navigator","userAgent")||"",Te=W.process,Ie=W.Deno,Re=Te&&Te.versions||Ie&&Ie.version,Pe=Re&&Re.v8;Pe&&(z=(F=Pe.split("."))[0]>0&&F[0]<4?1:+(F[0]+F[1])),!z&&Ee&&(!(F=Ee.match(/Edge\/(\d+)/))||F[1]>=74)&&(F=Ee.match(/Chrome\/(\d+)/))&&(z=+F[1]);var ke=z,Ae=!!Object.getOwnPropertySymbols&&!q((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ke&&ke<41})),Oe=Ae&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Le=Object,De=Oe?function(e){return"symbol"==typeof e}:function(e){var t=Ce("Symbol");return ye(t)&&xe(t.prototype,Le(e))},Me=String,Ne=function(e){try{return Me(e)}catch(e){return"Object"}},je=TypeError,_e=function(e){if(ye(e))return e;throw je(Ne(e)+" is not a function")},Be=function(e,t){var r=e[t];return de(r)?void 0:_e(r)},Ue=TypeError,Ve=Object.defineProperty,Fe=function(e,t){try{Ve(W,e,{value:t,configurable:!0,writable:!0})}catch(r){W[e]=t}return t},ze="__core-js_shared__",$e=W[ze]||Fe(ze,{}),Ge=V((function(e){(e.exports=function(e,t){return $e[e]||($e[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"})})),We=Object,qe=function(e){return We(pe(e))},He=ie({}.hasOwnProperty),Xe=Object.hasOwn||function(e,t){return He(qe(e),t)},Ye=0,Je=Math.random(),Ke=ie(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ke(++Ye+Je,36)},Qe=Ge("wks"),et=W.Symbol,tt=et&&et.for,rt=Oe?et:et&&et.withoutSetter||Ze,nt=function(e){if(!Xe(Qe,e)||!Ae&&"string"!=typeof Qe[e]){var t="Symbol."+e;Ae&&Xe(et,e)?Qe[e]=et[e]:Qe[e]=Oe&&tt?tt(t):rt(t)}return Qe[e]},it=TypeError,ot=nt("toPrimitive"),st=function(e){var t=function(e,t){if(!be(e)||De(e))return e;var r,n=Be(e,ot);if(n){if(void 0===t&&(t="default"),r=J(n,e,t),!be(r)||De(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var r,n;if("string"===t&&ye(r=e.toString)&&!be(n=J(r,e)))return n;if(ye(r=e.valueOf)&&!be(n=J(r,e)))return n;if("string"!==t&&ye(r=e.toString)&&!be(n=J(r,e)))return n;throw Ue("Can't convert object to primitive value")}(e,t)}(e,"string");return De(t)?t:t+""},at=W.document,ct=be(at)&&be(at.createElement),ut=function(e){return ct?at.createElement(e):{}},lt=!H&&!q((function(){return 7!=Object.defineProperty(ut("div"),"a",{get:function(){return 7}}).a})),dt=Object.getOwnPropertyDescriptor,ft={f:H?dt:function(e,t){if(e=he(e),t=st(t),lt)try{return dt(e,t)}catch(e){}if(Xe(e,t))return ee(!J(Q.f,e,t),e[t])}},pt=H&&q((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ht=String,mt=TypeError,gt=function(e){if(be(e))return e;throw mt(ht(e)+" is not an object")},vt=TypeError,yt=Object.defineProperty,wt=Object.getOwnPropertyDescriptor,bt="enumerable",St="configurable",Ct="writable",xt={f:H?pt?function(e,t,r){if(gt(e),t=st(t),gt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ct in r&&!r[Ct]){var n=wt(e,t);n&&n[Ct]&&(e[t]=r.value,r={configurable:St in r?r[St]:n[St],enumerable:bt in r?r[bt]:n[bt],writable:!1})}return yt(e,t,r)}:yt:function(e,t,r){if(gt(e),t=st(t),gt(r),lt)try{return yt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw vt("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},Et=H?function(e,t,r){return xt.f(e,t,ee(1,r))}:function(e,t,r){return e[t]=r,e},Tt=Function.prototype,It=H&&Object.getOwnPropertyDescriptor,Rt=Xe(Tt,"name"),Pt={EXISTS:Rt,PROPER:Rt&&"something"===function(){}.name,CONFIGURABLE:Rt&&(!H||H&&It(Tt,"name").configurable)},kt=ie(Function.toString);ye($e.inspectSource)||($e.inspectSource=function(e){return kt(e)});var At,Ot,Lt,Dt=$e.inspectSource,Mt=W.WeakMap,Nt=ye(Mt)&&/native code/.test(String(Mt)),jt=Ge("keys"),_t=function(e){return jt[e]||(jt[e]=Ze(e))},Bt={},Ut="Object already initialized",Vt=W.TypeError,Ft=W.WeakMap;if(Nt||$e.state){var zt=$e.state||($e.state=new Ft);zt.get=zt.get,zt.has=zt.has,zt.set=zt.set,At=function(e,t){if(zt.has(e))throw Vt(Ut);return t.facade=e,zt.set(e,t),t},Ot=function(e){return zt.get(e)||{}},Lt=function(e){return zt.has(e)}}else{var $t=_t("state");Bt[$t]=!0,At=function(e,t){if(Xe(e,$t))throw Vt(Ut);return t.facade=e,Et(e,$t,t),t},Ot=function(e){return Xe(e,$t)?e[$t]:{}},Lt=function(e){return Xe(e,$t)}}var Gt={set:At,get:Ot,has:Lt,enforce:function(e){return Lt(e)?Ot(e):At(e,{})},getterFor:function(e){return function(t){var r;if(!be(t)||(r=Ot(t)).type!==e)throw Vt("Incompatible receiver, "+e+" required");return r}}},Wt=V((function(e){var t=Pt.CONFIGURABLE,r=Gt.enforce,n=Gt.get,i=Object.defineProperty,o=H&&!q((function(){return 8!==i((function(){}),"length",{value:8}).length})),s=String(String).split("String"),a=e.exports=function(e,n,a){"Symbol("===String(n).slice(0,7)&&(n="["+String(n).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),a&&a.getter&&(n="get "+n),a&&a.setter&&(n="set "+n),(!Xe(e,"name")||t&&e.name!==n)&&(H?i(e,"name",{value:n,configurable:!0}):e.name=n),o&&a&&Xe(a,"arity")&&e.length!==a.arity&&i(e,"length",{value:a.arity});try{a&&Xe(a,"constructor")&&a.constructor?H&&i(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var c=r(e);return Xe(c,"source")||(c.source=s.join("string"==typeof n?n:"")),e};Function.prototype.toString=a((function(){return ye(this)&&n(this).source||Dt(this)}),"toString")})),qt=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(ye(r)&&Wt(r,o,n),n.global)i?e[t]=r:Fe(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:xt.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},Ht=Math.ceil,Xt=Math.floor,Yt=Math.trunc||function(e){var t=+e;return(t>0?Xt:Ht)(t)},Jt=function(e){var t=+e;return t!=t||0===t?0:Yt(t)},Kt=Math.max,Zt=Math.min,Qt=function(e,t){var r=Jt(e);return r<0?Kt(r+t,0):Zt(r,t)},er=Math.min,tr=function(e){return e>0?er(Jt(e),9007199254740991):0},rr=function(e){return tr(e.length)},nr=function(e){return function(t,r,n){var i,o=he(t),s=rr(o),a=Qt(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},ir={includes:nr(!0),indexOf:nr(!1)},or=ir.indexOf,sr=ie([].push),ar=function(e,t){var r,n=he(e),i=0,o=[];for(r in n)!Xe(Bt,r)&&Xe(n,r)&&sr(o,r);for(;t.length>i;)Xe(n,r=t[i++])&&(~or(o,r)||sr(o,r));return o},cr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ur=cr.concat("length","prototype"),lr={f:Object.getOwnPropertyNames||function(e){return ar(e,ur)}},dr={f:Object.getOwnPropertySymbols},fr=ie([].concat),pr=Ce("Reflect","ownKeys")||function(e){var t=lr.f(gt(e)),r=dr.f;return r?fr(t,r(e)):t},hr=function(e,t,r){for(var n=pr(t),i=xt.f,o=ft.f,s=0;s<n.length;s++){var a=n[s];Xe(e,a)||r&&Xe(r,a)||i(e,a,o(t,a))}},mr=/#|\.prototype\./,gr=function(e,t){var r=yr[vr(e)];return r==br||r!=wr&&(ye(t)?q(t):!!t)},vr=gr.normalize=function(e){return String(e).replace(mr,".").toLowerCase()},yr=gr.data={},wr=gr.NATIVE="N",br=gr.POLYFILL="P",Sr=gr,Cr=ft.f,xr=function(e,t){var r,n,i,o,s,a=e.target,c=e.global,u=e.stat;if(r=c?W:u?W[a]||Fe(a,{}):(W[a]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(s=Cr(r,n))&&s.value:r[n],!Sr(c?n:a+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;hr(o,i)}(e.sham||i&&i.sham)&&Et(o,"sham",!0),qt(r,n,o,e)}},Er=Array.isArray||function(e){return"Array"==ae(e)},Tr=TypeError,Ir=function(e){if(e>9007199254740991)throw Tr("Maximum allowed index exceeded");return e},Rr=function(e,t,r){var n=st(t);n in e?xt.f(e,n,ee(0,r)):e[n]=r},Pr={};Pr[nt("toStringTag")]="z";var kr="[object z]"===String(Pr),Ar=nt("toStringTag"),Or=Object,Lr="Arguments"==ae(function(){return arguments}()),Dr=kr?ae:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Or(e),Ar))?r:Lr?ae(t):"Object"==(n=ae(t))&&ye(t.callee)?"Arguments":n},Mr=function(){},Nr=[],jr=Ce("Reflect","construct"),_r=/^\s*(?:class|function)\b/,Br=ie(_r.exec),Ur=!_r.exec(Mr),Vr=function(e){if(!ye(e))return!1;try{return jr(Mr,Nr,e),!0}catch(e){return!1}},Fr=function(e){if(!ye(e))return!1;switch(Dr(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ur||!!Br(_r,Dt(e))}catch(e){return!0}};Fr.sham=!0;var zr=!jr||q((function(){var e;return Vr(Vr.call)||!Vr(Object)||!Vr((function(){e=!0}))||e}))?Fr:Vr,$r=nt("species"),Gr=Array,Wr=function(e,t){return new(function(e){var t;return Er(e)&&(t=e.constructor,(zr(t)&&(t===Gr||Er(t.prototype))||be(t)&&null===(t=t[$r]))&&(t=void 0)),void 0===t?Gr:t}(e))(0===t?0:t)},qr=nt("species"),Hr=function(e){return ke>=51||!q((function(){var t=[];return(t.constructor={})[qr]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Xr=nt("isConcatSpreadable"),Yr=ke>=51||!q((function(){var e=[];return e[Xr]=!1,e.concat()[0]!==e})),Jr=Hr("concat"),Kr=function(e){if(!be(e))return!1;var t=e[Xr];return void 0!==t?!!t:Er(e)};xr({target:"Array",proto:!0,arity:1,forced:!Yr||!Jr},{concat:function(e){var t,r,n,i,o,s=qe(this),a=Wr(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Kr(o=-1===t?s:arguments[t]))for(i=rr(o),Ir(c+i),r=0;r<i;r++,c++)r in o&&Rr(a,c,o[r]);else Ir(c+1),Rr(a,c++,o);return a.length=c,a}});var Zr=ie([].slice),Qr=Hr("slice"),en=nt("species"),tn=Array,rn=Math.max;xr({target:"Array",proto:!0,forced:!Qr},{slice:function(e,t){var r,n,i,o=he(this),s=rr(o),a=Qt(e,s),c=Qt(void 0===t?s:t,s);if(Er(o)&&(r=o.constructor,(zr(r)&&(r===tn||Er(r.prototype))||be(r)&&null===(r=r[en]))&&(r=void 0),r===tn||void 0===r))return Zr(o,a,c);for(n=new(void 0===r?tn:r)(rn(c-a,0)),i=0;a<c;a++,i++)a in o&&Rr(n,i,o[a]);return n.length=i,n}});var nn=function(e){if("Function"===ae(e))return ie(e)},on=nn(nn.bind),sn=function(e,t){return _e(e),void 0===t?e:X?on(e,t):function(){return e.apply(t,arguments)}},an=ie([].push),cn=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,u,l,d){for(var f,p,h=qe(c),m=le(h),g=sn(u,l),v=rr(m),y=0,w=d||Wr,E=t?w(c,v):r||s?w(c,0):void 0;v>y;y++)if((a||y in m)&&(p=g(f=m[y],y,h),e))if(t)E[y]=p;else if(p)switch(e){case 3:return!0;case 5:return f;case 6:return y;case 2:an(E,f)}else switch(e){case 4:return!1;case 7:an(E,f)}return o?-1:n||i?i:E}},un={forEach:cn(0),map:cn(1),filter:cn(2),some:cn(3),every:cn(4),find:cn(5),findIndex:cn(6),filterReject:cn(7)},ln=un.map,dn=Hr("map");xr({target:"Array",proto:!0,forced:!dn},{map:function(e){return ln(this,e,arguments.length>1?arguments[1]:void 0)}});var fn=Function.prototype,pn=fn.apply,hn=fn.call,mn="object"==typeof Reflect&&Reflect.apply||(X?hn.bind(pn):function(){return hn.apply(pn,arguments)}),gn=Ce("JSON","stringify"),vn=ie(/./.exec),yn=ie("".charAt),wn=ie("".charCodeAt),bn=ie("".replace),Sn=ie(1..toString),Cn=/[\uD800-\uDFFF]/g,xn=/^[\uD800-\uDBFF]$/,En=/^[\uDC00-\uDFFF]$/,Tn=!Ae||q((function(){var e=Ce("Symbol")();return"[null]"!=gn([e])||"{}"!=gn({a:e})||"{}"!=gn(Object(e))})),In=q((function(){return'"\\udf06\\ud834"'!==gn("\udf06\ud834")||'"\\udead"'!==gn("\udead")})),Rn=function(e,t){var r=Zr(arguments),n=t;if((be(t)||void 0!==e)&&!De(e))return Er(t)||(t=function(e,t){if(ye(n)&&(t=J(n,this,e,t)),!De(t))return t}),r[1]=t,mn(gn,null,r)},Pn=function(e,t,r){var n=yn(r,t-1),i=yn(r,t+1);return vn(xn,e)&&!vn(En,i)||vn(En,e)&&!vn(xn,n)?"\\u"+Sn(wn(e,0),16):e};gn&&xr({target:"JSON",stat:!0,arity:3,forced:Tn||In},{stringify:function(e,t,r){var n=Zr(arguments),i=mn(Tn?Rn:gn,null,n);return In&&"string"==typeof i?bn(i,Cn,Pn):i}});var kn=V((function(e){!function(t){var r,n={VERSION:"1.6.1"},i={},o=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,r=arguments,n=r[0];for(t=1;t<r.length;t++)for(e in r[t])!(e in n)&&r[t].hasOwnProperty(e)&&(n[e]=r[t][e]);return n},a=function(e,t){return{value:e,name:t}};n.TRACE=a(1,"TRACE"),n.DEBUG=a(2,"DEBUG"),n.INFO=a(3,"INFO"),n.TIME=a(4,"TIME"),n.WARN=a(5,"WARN"),n.ERROR=a(8,"ERROR"),n.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(n.TRACE,arguments)},debug:function(){this.invoke(n.DEBUG,arguments)},info:function(){this.invoke(n.INFO,arguments)},warn:function(){this.invoke(n.WARN,arguments)},error:function(){this.invoke(n.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(n.TIME,[e,"end"])},invoke:function(e,t){r&&this.enabledFor(e)&&r(t,s({level:e},this.context))}};var u,l=new c({filterLevel:n.OFF});(u=n).enabledFor=o(l,l.enabledFor),u.trace=o(l,l.trace),u.debug=o(l,l.debug),u.time=o(l,l.time),u.timeEnd=o(l,l.timeEnd),u.info=o(l,l.info),u.warn=o(l,l.warn),u.error=o(l,l.error),u.log=u.info,n.setHandler=function(e){r=e},n.setLevel=function(e){for(var t in l.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},n.getLevel=function(){return l.getLevel()},n.get=function(e){return i[e]||(i[e]=new c(s({name:e},l.context)))},n.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},r=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var s,a=console.log;o.level===n.TIME?(s=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):r(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(o.level===n.WARN&&console.warn?a=console.warn:o.level===n.ERROR&&console.error?a=console.error:o.level===n.INFO&&console.info?a=console.info:o.level===n.DEBUG&&console.debug?a=console.debug:o.level===n.TRACE&&console.trace&&(a=console.trace),e.formatter(i,o),r(a,i))}},n.useDefaults=function(e){n.setLevel(e&&e.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(e))},n.setDefaults=n.useDefaults,e.exports?e.exports=n:(n._prevLogger=t.Logger,n.noConflict=function(){return t.Logger=n._prevLogger,n},t.Logger=n)}(U)}));kn.useDefaults({defaultLevel:kn.TRACE});const An=(e,t)=>{e.unshift("[".concat(t.name||"Global","] ").concat((new Date).toISOString()," - ").concat(t.level.name," -"))},On=(e,t)=>t?e.value>=jn[t].value:e.value>=Nn.value,Ln=kn.createDefaultHandler({formatter:An});kn.setHandler((e,t)=>{((e,t)=>{e=(e=Array.prototype.slice.call(e)).map(e=>"object"==typeof e?JSON.stringify(e):e),An(e,t),0!==Dn?(Mn.push(e.join(" ")),Mn.length>=Dn&&(Mn=Mn.slice(-Dn))):Mn=[]})(e,t),On(t.level,t.name)&&Ln(e,t);var r,n=B(_n);try{for(n.s();!(r=n.n()).done;){const n=r.value,i=n.handler,o=n.level;t.level.value>=o.value&&i(e,t)}}catch(e){n.e(e)}finally{n.f()}});let Dn=1e4,Mn=[],Nn=kn.OFF;const jn={},_n=[],Bn=O(O({},kn),{},{enabledFor:On,getHistory:()=>Mn,getHistoryMaxSize:()=>Dn,setHistoryMaxSize:e=>{Dn=e},setLevel:e=>{Nn=e;for(const t in jn)jn[t]=e},getLevel:()=>Nn,get:e=>{jn[e]||(jn[e]=Nn);const t=kn.get(e);return t.setLevel=t=>{jn[e]=t},t.getLevel=()=>jn[e],t},setHandler:(e,t)=>{_n.push({handler:e,level:t})}});var Un,Vn,Fn,zn,$n="process"==ae(W.process),Gn=String,Wn=TypeError,qn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ie(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return gt(r),function(e){if("object"==typeof e||ye(e))return e;throw Wn("Can't set "+Gn(e)+" as a prototype")}(n),t?e(r,n):r.__proto__=n,r}}():void 0),Hn=xt.f,Xn=nt("toStringTag"),Yn=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Xe(e,Xn)&&Hn(e,Xn,{configurable:!0,value:t})},Jn=nt("species"),Kn=function(e){var t=Ce(e),r=xt.f;H&&t&&!t[Jn]&&r(t,Jn,{configurable:!0,get:function(){return this}})},Zn=TypeError,Qn=function(e,t){if(xe(t,e))return e;throw Zn("Incorrect invocation")},ei=TypeError,ti=nt("species"),ri=function(e,t){var r,n=gt(e).constructor;return void 0===n||de(r=gt(n)[ti])?t:function(e){if(zr(e))return e;throw ei(Ne(e)+" is not a constructor")}(r)},ni=Ce("document","documentElement"),ii=TypeError,oi=function(e,t){if(e<t)throw ii("Not enough arguments");return e},si=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ee),ai=W.setImmediate,ci=W.clearImmediate,ui=W.process,li=W.Dispatch,di=W.Function,fi=W.MessageChannel,pi=W.String,hi=0,mi={},gi="onreadystatechange";try{Un=W.location}catch(Df){}var vi=function(e){if(Xe(mi,e)){var t=mi[e];delete mi[e],t()}},yi=function(e){return function(){vi(e)}},wi=function(e){vi(e.data)},bi=function(e){W.postMessage(pi(e),Un.protocol+"//"+Un.host)};ai&&ci||(ai=function(e){oi(arguments.length,1);var t=ye(e)?e:di(e),r=Zr(arguments,1);return mi[++hi]=function(){mn(t,void 0,r)},Vn(hi),hi},ci=function(e){delete mi[e]},$n?Vn=function(e){ui.nextTick(yi(e))}:li&&li.now?Vn=function(e){li.now(yi(e))}:fi&&!si?(zn=(Fn=new fi).port2,Fn.port1.onmessage=wi,Vn=sn(zn.postMessage,zn)):W.addEventListener&&ye(W.postMessage)&&!W.importScripts&&Un&&"file:"!==Un.protocol&&!q(bi)?(Vn=bi,W.addEventListener("message",wi,!1)):Vn=gi in ut("script")?function(e){ni.appendChild(ut("script"))[gi]=function(){ni.removeChild(this),vi(e)}}:function(e){setTimeout(yi(e),0)});var Si,Ci,xi,Ei,Ti,Ii,Ri,Pi,ki={set:ai,clear:ci},Ai=/ipad|iphone|ipod/i.test(Ee)&&void 0!==W.Pebble,Oi=/web0s(?!.*chrome)/i.test(Ee),Li=ft.f,Di=ki.set,Mi=W.MutationObserver||W.WebKitMutationObserver,Ni=W.document,ji=W.process,_i=W.Promise,Bi=Li(W,"queueMicrotask"),Ui=Bi&&Bi.value;Ui||(Si=function(){var e,t;for($n&&(e=ji.domain)&&e.exit();Ci;){t=Ci.fn,Ci=Ci.next;try{t()}catch(e){throw Ci?Ei():xi=void 0,e}}xi=void 0,e&&e.enter()},si||$n||Oi||!Mi||!Ni?!Ai&&_i&&_i.resolve?((Ri=_i.resolve(void 0)).constructor=_i,Pi=sn(Ri.then,Ri),Ei=function(){Pi(Si)}):$n?Ei=function(){ji.nextTick(Si)}:(Di=sn(Di,W),Ei=function(){Di(Si)}):(Ti=!0,Ii=Ni.createTextNode(""),new Mi(Si).observe(Ii,{characterData:!0}),Ei=function(){Ii.data=Ti=!Ti}));var Vi=Ui||function(e){var t={fn:e,next:void 0};xi&&(xi.next=t),Ci||(Ci=t,Ei()),xi=t},Fi=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},zi=function(){this.head=null,this.tail=null};zi.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var $i=zi,Gi=W.Promise,Wi="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,qi=!Wi&&!$n&&"object"==typeof window&&"object"==typeof document;Gi&&Gi.prototype;var Hi,Xi,Yi,Ji=nt("species"),Ki=!1,Zi=ye(W.PromiseRejectionEvent),Qi={CONSTRUCTOR:Sr("Promise",(function(){var e=Dt(Gi),t=e!==String(Gi);if(!t&&66===ke)return!0;if(!ke||ke<51||!/native code/.test(e)){var r=new Gi((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Ji]=n,!(Ki=r.then((function(){}))instanceof n))return!0}return!t&&(qi||Wi)&&!Zi})),REJECTION_EVENT:Zi,SUBCLASSING:Ki},eo=TypeError,to=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw eo("Bad Promise constructor");t=e,r=n})),this.resolve=_e(t),this.reject=_e(r)},ro={f:function(e){return new to(e)}},no=ki.set,io="Promise",oo=Qi.CONSTRUCTOR,so=Qi.REJECTION_EVENT,ao=Qi.SUBCLASSING,co=Gt.getterFor(io),uo=Gt.set,lo=Gi&&Gi.prototype,fo=Gi,po=lo,ho=W.TypeError,mo=W.document,go=W.process,vo=ro.f,yo=vo,wo=!!(mo&&mo.createEvent&&W.dispatchEvent),bo="unhandledrejection",So=function(e){var t;return!(!be(e)||!ye(t=e.then))&&t},Co=function(e,t){var r,n,i,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{a?(s||(2===t.rejection&&Ro(t),t.rejection=1),!0===a?r=o:(l&&l.enter(),r=a(o),l&&(l.exit(),i=!0)),r===e.promise?u(ho("Promise-chain cycle")):(n=So(r))?J(n,r,c,u):c(r)):u(o)}catch(e){l&&!i&&l.exit(),u(e)}},xo=function(e,t){e.notified||(e.notified=!0,Vi((function(){for(var r,n=e.reactions;r=n.get();)Co(r,e);e.notified=!1,t&&!e.rejection&&To(e)})))},Eo=function(e,t,r){var n,i;wo?((n=mo.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),W.dispatchEvent(n)):n={promise:t,reason:r},!so&&(i=W["on"+e])?i(n):e===bo&&function(e,t){var r=W.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}("Unhandled promise rejection",r)},To=function(e){J(no,W,(function(){var t,r=e.facade,n=e.value;if(Io(e)&&(t=Fi((function(){$n?go.emit("unhandledRejection",n,r):Eo(bo,r,n)})),e.rejection=$n||Io(e)?2:1,t.error))throw t.value}))},Io=function(e){return 1!==e.rejection&&!e.parent},Ro=function(e){J(no,W,(function(){var t=e.facade;$n?go.emit("rejectionHandled",t):Eo("rejectionhandled",t,e.value)}))},Po=function(e,t,r){return function(n){e(t,n,r)}},ko=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,xo(e,!0))},Ao=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw ho("Promise can't be resolved itself");var n=So(t);n?Vi((function(){var r={done:!1};try{J(n,t,Po(Ao,r,e),Po(ko,r,e))}catch(t){ko(r,t,e)}})):(e.value=t,e.state=1,xo(e,!1))}catch(t){ko({done:!1},t,e)}}};if(oo&&(po=(fo=function(e){Qn(this,po),_e(e),J(Hi,this);var t=co(this);try{e(Po(Ao,t),Po(ko,t))}catch(e){ko(t,e)}}).prototype,(Hi=function(e){uo(this,{type:io,done:!1,notified:!1,parent:!1,reactions:new $i,rejection:!1,state:0,value:void 0})}).prototype=qt(po,"then",(function(e,t){var r=co(this),n=vo(ri(this,fo));return r.parent=!0,n.ok=!ye(e)||e,n.fail=ye(t)&&t,n.domain=$n?go.domain:void 0,0==r.state?r.reactions.add(n):Vi((function(){Co(n,r)})),n.promise})),Xi=function(){var e=new Hi,t=co(e);this.promise=e,this.resolve=Po(Ao,t),this.reject=Po(ko,t)},ro.f=vo=function(e){return e===fo||void 0===e?new Xi(e):yo(e)},ye(Gi)&&lo!==Object.prototype)){Yi=lo.then,ao||qt(lo,"then",(function(e,t){var r=this;return new fo((function(e,t){J(Yi,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete lo.constructor}catch(Df){}qn&&qn(lo,po)}xr({global:!0,constructor:!0,wrap:!0,forced:oo},{Promise:fo}),Yn(fo,io,!1),Kn(io);var Oo={},Lo=nt("iterator"),Do=Array.prototype,Mo=function(e){return void 0!==e&&(Oo.Array===e||Do[Lo]===e)},No=nt("iterator"),jo=function(e){if(!de(e))return Be(e,No)||Be(e,"@@iterator")||Oo[Dr(e)]},_o=TypeError,Bo=function(e,t){var r=arguments.length<2?jo(e):t;if(_e(r))return gt(J(r,e));throw _o(Ne(e)+" is not iterable")},Uo=function(e,t,r){var n,i;gt(e);try{if(!(n=Be(e,"return"))){if("throw"===t)throw r;return r}n=J(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return gt(n),r},Vo=TypeError,Fo=function(e,t){this.stopped=e,this.result=t},zo=Fo.prototype,$o=function(e,t,r){var n,i,o,s,a,c,u,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),h=!(!r||!r.INTERRUPTED),m=sn(t,l),g=function(e){return n&&Uo(n,"normal",e),new Fo(!0,e)},v=function(e){return d?(gt(e),h?m(e[0],e[1],g):m(e[0],e[1])):h?m(e,g):m(e)};if(f)n=e.iterator;else if(p)n=e;else{if(!(i=jo(e)))throw Vo(Ne(e)+" is not iterable");if(Mo(i)){for(o=0,s=rr(e);s>o;o++)if((a=v(e[o]))&&xe(zo,a))return a;return new Fo(!1)}n=Bo(e,i)}for(c=f?e.next:n.next;!(u=J(c,n)).done;){try{a=v(u.value)}catch(e){Uo(n,"throw",e)}if("object"==typeof a&&a&&xe(zo,a))return a}return new Fo(!1)},Go=nt("iterator"),Wo=!1;try{var qo=0,Ho={next:function(){return{done:!!qo++}},return:function(){Wo=!0}};Ho[Go]=function(){return this},Array.from(Ho,(function(){throw 2}))}catch(Df){}var Xo=function(e,t){if(!t&&!Wo)return!1;var r=!1;try{var n={};n[Go]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Yo=Qi.CONSTRUCTOR||!Xo((function(e){Gi.all(e).then(void 0,(function(){}))}));xr({target:"Promise",stat:!0,forced:Yo},{all:function(e){var t=this,r=ro.f(t),n=r.resolve,i=r.reject,o=Fi((function(){var r=_e(t.resolve),o=[],s=0,a=1;$o(e,(function(e){var c=s++,u=!1;a++,J(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var Jo=Qi.CONSTRUCTOR,Ko=Gi&&Gi.prototype;if(xr({target:"Promise",proto:!0,forced:Jo,real:!0},{catch:function(e){return this.then(void 0,e)}}),ye(Gi)){var Zo=Ce("Promise").prototype.catch;Ko.catch!==Zo&&qt(Ko,"catch",Zo,{unsafe:!0})}xr({target:"Promise",stat:!0,forced:Yo},{race:function(e){var t=this,r=ro.f(t),n=r.reject,i=Fi((function(){var i=_e(t.resolve);$o(e,(function(e){J(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}}),xr({target:"Promise",stat:!0,forced:Qi.CONSTRUCTOR},{reject:function(e){var t=ro.f(this);return J(t.reject,void 0,e),t.promise}});var Qo=Qi.CONSTRUCTOR;Ce("Promise"),xr({target:"Promise",stat:!0,forced:Qo},{resolve:function(e){return function(e,t){if(gt(e),be(t)&&t.constructor===e)return t;var r=ro.f(e);return(0,r.resolve)(t),r.promise}(this,e)}});var es=xt.f,ts=function(e,t,r){r in e||es(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},rs=function(e,t,r){var n,i;return qn&&ye(n=t.constructor)&&n!==r&&be(i=n.prototype)&&i!==r.prototype&&qn(e,i),e},ns=String,is=function(e){if("Symbol"===Dr(e))throw TypeError("Cannot convert a Symbol value to a string");return ns(e)},os=function(e,t){return void 0===e?arguments.length<2?"":t:is(e)},ss=function(e,t){be(t)&&"cause"in t&&Et(e,"cause",t.cause)},as=Error,cs=ie("".replace),us=String(as("zxcasd").stack),ls=/\n\s*at [^:]*:[^\n]*/,ds=ls.test(us),fs=function(e,t){if(ds&&"string"==typeof e&&!as.prepareStackTrace)for(;t--;)e=cs(e,ls,"");return e},ps=!q((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",ee(1,7)),7!==e.stack)})),hs=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,s=e.split("."),a=s[s.length-1],c=Ce.apply(null,s);if(c){var u=c.prototype;if(Xe(u,"cause")&&delete u.cause,!r)return c;var l=Ce("Error"),d=t((function(e,t){var r=os(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&Et(i,"message",r),ps&&Et(i,"stack",fs(i.stack,2)),this&&xe(u,this)&&rs(i,this,d),arguments.length>o&&ss(i,arguments[o]),i}));d.prototype=u,"Error"!==a?qn?qn(d,l):hr(d,l,{name:!0}):H&&i in c&&(ts(d,c,i),ts(d,c,"prepareStackTrace")),hr(d,c);try{u.name!==a&&Et(u,"name",a),u.constructor=d}catch(e){}return d}},ms="WebAssembly",gs=W[ms],vs=7!==Error("e",{cause:7}).cause,ys=function(e,t){var r={};r[e]=hs(e,t,vs),xr({global:!0,constructor:!0,arity:1,forced:vs},r)},ws=function(e,t){if(gs&&gs[e]){var r={};r[e]=hs(ms+"."+e,t,vs),xr({target:ms,stat:!0,constructor:!0,arity:1,forced:vs},r)}};ys("Error",(function(e){return function(t){return mn(e,this,arguments)}})),ys("EvalError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("RangeError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("ReferenceError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("SyntaxError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("TypeError",(function(e){return function(t){return mn(e,this,arguments)}})),ys("URIError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("CompileError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("LinkError",(function(e){return function(t){return mn(e,this,arguments)}})),ws("RuntimeError",(function(e){return function(t){return mn(e,this,arguments)}}));var bs=nt("match"),Ss=function(e){var t;return be(e)&&(void 0!==(t=e[bs])?!!t:"RegExp"==ae(e))},Cs=function(){var e=gt(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},xs=RegExp.prototype,Es=function(e){var t=e.flags;return void 0!==t||"flags"in xs||Xe(e,"flags")||!xe(xs,e)?t:J(Cs,e)},Ts=W.RegExp,Is=q((function(){var e=Ts("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Rs=Is||q((function(){return!Ts("a","y").sticky})),Ps={BROKEN_CARET:Is||q((function(){var e=Ts("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Rs,UNSUPPORTED_Y:Is},ks=W.RegExp,As=q((function(){var e=ks(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),Os=W.RegExp,Ls=q((function(){var e=Os("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Ds=lr.f,Ms=Gt.enforce,Ns=nt("match"),js=W.RegExp,_s=js.prototype,Bs=W.SyntaxError,Us=ie(_s.exec),Vs=ie("".charAt),Fs=ie("".replace),zs=ie("".indexOf),$s=ie("".slice),Gs=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Ws=/a/g,qs=/a/g,Hs=new js(Ws)!==Ws,Xs=Ps.MISSED_STICKY,Ys=Ps.UNSUPPORTED_Y,Js=H&&(!Hs||Xs||As||Ls||q((function(){return qs[Ns]=!1,js(Ws)!=Ws||js(qs)==qs||"/a/i"!=js(Ws,"i")})));if(Sr("RegExp",Js)){for(var Ks=function(e,t){var r,n,i,o,s,a,c=xe(_s,this),u=Ss(e),l=void 0===t,d=[],f=e;if(!c&&u&&l&&e.constructor===Ks)return e;if((u||xe(_s,e))&&(e=e.source,l&&(t=Es(f))),e=void 0===e?"":is(e),t=void 0===t?"":is(t),f=e,As&&"dotAll"in Ws&&(n=!!t&&zs(t,"s")>-1)&&(t=Fs(t,/s/g,"")),r=t,Xs&&"sticky"in Ws&&(i=!!t&&zs(t,"y")>-1)&&Ys&&(t=Fs(t,/y/g,"")),Ls&&(e=(o=function(e){for(var t,r=e.length,n=0,i="",o=[],s={},a=!1,c=!1,u=0,l="";n<=r;n++){if("\\"===(t=Vs(e,n)))t+=Vs(e,++n);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:Us(Gs,$s(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===l||Xe(s,l))throw new Bs("Invalid capture group name");s[l]=!0,o[o.length]=[l,u],c=!1,l="";continue}c?l+=t:i+=t}return[i,o]}(e))[0],d=o[1]),s=rs(js(e,t),c?this:_s,Ks),(n||i||d.length)&&(a=Ms(s),n&&(a.dotAll=!0,a.raw=Ks(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=Vs(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+Vs(e,++n);return i}(e),r)),i&&(a.sticky=!0),d.length&&(a.groups=d)),e!==f)try{Et(s,"source",""===f?"(?:)":f)}catch(e){}return s},Zs=Ds(js),Qs=0;Zs.length>Qs;)ts(Ks,js,Zs[Qs++]);_s.constructor=Ks,Ks.prototype=_s,qt(W,"RegExp",Ks,{constructor:!0})}Kn("RegExp");var ea,ta,ra,na=Gt.get,ia=RegExp.prototype,oa=TypeError;H&&As&&(ea=ia,ta="dotAll",(ra={configurable:!0,get:function(){if(this!==ia){if("RegExp"===ae(this))return!!na(this).dotAll;throw oa("Incompatible receiver, RegExp required")}}}).get&&Wt(ra.get,ta,{getter:!0}),ra.set&&Wt(ra.set,ta,{setter:!0}),xt.f(ea,ta,ra));var sa,aa=Object.keys||function(e){return ar(e,cr)},ca={f:H&&!pt?Object.defineProperties:function(e,t){gt(e);for(var r,n=he(t),i=aa(t),o=i.length,s=0;o>s;)xt.f(e,r=i[s++],n[r]);return e}},ua="prototype",la="script",da=_t("IE_PROTO"),fa=function(){},pa=function(e){return"<script>"+e+"</"+la+">"},ha=function(e){e.write(pa("")),e.close();var t=e.parentWindow.Object;return e=null,t},ma=function(){try{sa=new ActiveXObject("htmlfile")}catch(e){}var e,t;ma="undefined"!=typeof document?document.domain&&sa?ha(sa):("javascript:",(t=ut("iframe")).style.display="none",ni.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(pa("document.F=Object")),e.close(),e.F):ha(sa);for(var r=cr.length;r--;)delete ma[ua][cr[r]];return ma()};Bt[da]=!0;var ga=Object.create||function(e,t){var r;return null!==e?(fa[ua]=gt(e),r=new fa,fa[ua]=null,r[da]=e):r=ma(),void 0===t?r:ca.f(r,t)},va=Gt.get,ya=Ge("native-string-replace",String.prototype.replace),wa=RegExp.prototype.exec,ba=wa,Sa=ie("".charAt),Ca=ie("".indexOf),xa=ie("".replace),Ea=ie("".slice),Ta=function(){var e=/a/,t=/b*/g;return J(wa,e,"a"),J(wa,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ia=Ps.BROKEN_CARET,Ra=void 0!==/()??/.exec("")[1];(Ta||Ra||Ia||As||Ls)&&(ba=function(e){var t,r,n,i,o,s,a,c=this,u=va(c),l=is(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=J(ba,d,l),c.lastIndex=d.lastIndex,t;var f=u.groups,p=Ia&&c.sticky,h=J(Cs,c),m=c.source,g=0,v=l;if(p&&(h=xa(h,"y",""),-1===Ca(h,"g")&&(h+="g"),v=Ea(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Sa(l,c.lastIndex-1))&&(m="(?: "+m+")",v=" "+v,g++),r=new RegExp("^(?:"+m+")",h)),Ra&&(r=new RegExp("^"+m+"$(?!\\s)",h)),Ta&&(n=c.lastIndex),i=J(wa,p?r:c,v),p?i?(i.input=Ea(i.input,g),i[0]=Ea(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Ta&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),Ra&&i&&i.length>1&&J(ya,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&f)for(i.groups=s=ga(null),o=0;o<f.length;o++)s[(a=f[o])[0]]=i[a[1]];return i});var Pa=ba;xr({target:"RegExp",proto:!0,forced:/./.exec!==Pa},{exec:Pa});var ka=ie(Q.f),Aa=ie([].push),Oa=function(e){return function(t){for(var r,n=he(t),i=aa(n),o=i.length,s=0,a=[];o>s;)r=i[s++],H&&!ka(n,r)||Aa(a,e?[r,n[r]]:n[r]);return a}},La=(Oa(!0),Oa(!1));xr({target:"Object",stat:!0},{values:function(e){return La(e)}});var Da=nt("species"),Ma=RegExp.prototype,Na=function(e,t,r,n){var i=nt(e),o=!q((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),s=o&&!q((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Da]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!s||r){var a=nn(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var s=nn(e),c=t.exec;return c===Pa||c===Ma.exec?o&&!i?{done:!0,value:a(t,r,n)}:{done:!0,value:s(r,t,n)}:{done:!1}}));qt(String.prototype,e,c[0]),qt(Ma,i,c[1])}n&&Et(Ma[i],"sham",!0)},ja=ie("".charAt),_a=ie("".charCodeAt),Ba=ie("".slice),Ua=function(e){return function(t,r){var n,i,o=is(pe(t)),s=Jt(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=_a(o,s))<55296||n>56319||s+1===a||(i=_a(o,s+1))<56320||i>57343?e?ja(o,s):n:e?Ba(o,s,s+2):i-56320+(n-55296<<10)+65536}},Va=(Ua(!1),Ua(!0)),Fa=function(e,t,r){return t+(r?Va(e,t).length:1)},za=TypeError,$a=function(e,t){var r=e.exec;if(ye(r)){var n=J(r,e,t);return null!==n&&gt(n),n}if("RegExp"===ae(e))return J(Pa,e,t);throw za("RegExp#exec called on incompatible receiver")};Na("match",(function(e,t,r){return[function(t){var r=pe(this),n=de(t)?void 0:Be(t,e);return n?J(n,t,r):new RegExp(t)[e](is(r))},function(e){var n=gt(this),i=is(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return $a(n,i);var s=n.unicode;n.lastIndex=0;for(var a,c=[],u=0;null!==(a=$a(n,i));){var l=is(a[0]);c[u]=l,""===l&&(n.lastIndex=Fa(i,tr(n.lastIndex),s)),u++}return 0===u?null:c}]}));var Ga=xt.f,Wa=nt("unscopables"),qa=Array.prototype;null==qa[Wa]&&Ga(qa,Wa,{configurable:!0,value:ga(null)});var Ha,Xa,Ya,Ja=function(e){qa[Wa][e]=!0},Ka=!q((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Za=_t("IE_PROTO"),Qa=Object,ec=Qa.prototype,tc=Ka?Qa.getPrototypeOf:function(e){var t=qe(e);if(Xe(t,Za))return t[Za];var r=t.constructor;return ye(r)&&t instanceof r?r.prototype:t instanceof Qa?ec:null},rc=nt("iterator"),nc=!1;[].keys&&("next"in(Ya=[].keys())?(Xa=tc(tc(Ya)))!==Object.prototype&&(Ha=Xa):nc=!0),(!be(Ha)||q((function(){var e={};return Ha[rc].call(e)!==e})))&&(Ha={}),ye(Ha[rc])||qt(Ha,rc,(function(){return this}));var ic={IteratorPrototype:Ha,BUGGY_SAFARI_ITERATORS:nc},oc=ic.IteratorPrototype,sc=function(){return this},ac=function(e,t,r,n){var i=t+" Iterator";return e.prototype=ga(oc,{next:ee(+!n,r)}),Yn(e,i,!1),Oo[i]=sc,e},cc=Pt.PROPER,uc=Pt.CONFIGURABLE,lc=ic.IteratorPrototype,dc=ic.BUGGY_SAFARI_ITERATORS,fc=nt("iterator"),pc="values",hc="entries",mc=function(){return this},gc=function(e,t,r,n,i,o,s){ac(r,t,n);var a,c,u,l=function(e){if(e===i&&m)return m;if(!dc&&e in p)return p[e];switch(e){case"keys":case pc:case hc:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",f=!1,p=e.prototype,h=p[fc]||p["@@iterator"]||i&&p[i],m=!dc&&h||l(i),g="Array"==t&&p.entries||h;if(g&&(a=tc(g.call(new e)))!==Object.prototype&&a.next&&(tc(a)!==lc&&(qn?qn(a,lc):ye(a[fc])||qt(a,fc,mc)),Yn(a,d,!0)),cc&&i==pc&&h&&h.name!==pc&&(uc?Et(p,"name",pc):(f=!0,m=function(){return J(h,this)})),i)if(c={values:l(pc),keys:o?m:l("keys"),entries:l(hc)},s)for(u in c)(dc||f||!(u in p))&&qt(p,u,c[u]);else xr({target:t,proto:!0,forced:dc||f},c);return p[fc]!==m&&qt(p,fc,m,{name:i}),Oo[t]=m,c},vc=function(e,t){return{value:e,done:t}},yc=xt.f,wc="Array Iterator",bc=Gt.set,Sc=Gt.getterFor(wc),Cc=gc(Array,"Array",(function(e,t){bc(this,{type:wc,target:he(e),index:0,kind:t})}),(function(){var e=Sc(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,vc(void 0,!0)):vc("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),xc=Oo.Arguments=Oo.Array;if(Ja("keys"),Ja("values"),Ja("entries"),H&&"values"!==xc.name)try{yc(xc,"name",{value:"values"})}catch(Df){}var Ec={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Tc=ut("span").classList,Ic=Tc&&Tc.constructor&&Tc.constructor.prototype,Rc=Ic===Object.prototype?void 0:Ic,Pc=nt("iterator"),kc=nt("toStringTag"),Ac=Cc.values,Oc=function(e,t){if(e){if(e[Pc]!==Ac)try{Et(e,Pc,Ac)}catch(t){e[Pc]=Ac}if(e[kc]||Et(e,kc,t),Ec[t])for(var r in Cc)if(e[r]!==Cc[r])try{Et(e,r,Cc[r])}catch(t){e[r]=Cc[r]}}};for(var Lc in Ec)Oc(W[Lc]&&W[Lc].prototype,Lc);Oc(Rc,"DOMTokenList");var Dc=Array,Mc=Math.max,Nc=lr.f,jc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],_c={f:function(e){return jc&&"Window"==ae(e)?function(e){try{return Nc(e)}catch(e){return function(e,t,r){for(var n=rr(e),i=Qt(void 0,n),o=Qt(n,n),s=Dc(Mc(o-i,0)),a=0;i<o;i++,a++)Rr(s,a,e[i]);return s.length=a,s}(jc)}}(e):Nc(he(e))}},Bc=q((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Uc=Object.isExtensible,Vc=q((function(){Uc(1)}))||Bc?function(e){return!!be(e)&&(!Bc||"ArrayBuffer"!=ae(e))&&(!Uc||Uc(e))}:Uc,Fc=!q((function(){return Object.isExtensible(Object.preventExtensions({}))})),zc=V((function(e){var t=xt.f,r=!1,n=Ze("meta"),i=0,o=function(e){t(e,n,{value:{objectID:"O"+i++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},r=!0;var e=lr.f,t=ie([].splice),i={};i[n]=1,e(i).length&&(lr.f=function(r){for(var i=e(r),o=0,s=i.length;o<s;o++)if(i[o]===n){t(i,o,1);break}return i},xr({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:_c.f}))},fastKey:function(e,t){if(!be(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xe(e,n)){if(!Vc(e))return"F";if(!t)return"E";o(e)}return e[n].objectID},getWeakData:function(e,t){if(!Xe(e,n)){if(!Vc(e))return!0;if(!t)return!1;o(e)}return e[n].weakData},onFreeze:function(e){return Fc&&r&&Vc(e)&&!Xe(e,n)&&o(e),e}};Bt[n]=!0})),$c=function(e,t,r){for(var n in t)qt(e,n,t[n],r);return e},Gc=xt.f,Wc=zc.fastKey,qc=Gt.set,Hc=Gt.getterFor;!function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",s=W.Set,a=s&&s.prototype,c=s,u={},l=function(e){var t=ie(a[e]);qt(a,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!be(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!be(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!be(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(Sr(e,!ye(s)||!(i||a.forEach&&!q((function(){(new s).entries().next()})))))c=r.getConstructor(t,e,n,o),zc.enable();else if(Sr(e,!0)){var d=new c,f=d[o](i?{}:-0,1)!=d,p=q((function(){d.has(1)})),h=Xo((function(e){new s(e)})),m=!i&&q((function(){for(var e=new s,t=5;t--;)e[o](t,t);return!e.has(-0)}));h||((c=t((function(e,t){Qn(e,a);var r=rs(new s,e,c);return de(t)||$o(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=a,a.constructor=c),(p||m)&&(l("delete"),l("has"),n&&l("get")),(m||f)&&l(o),i&&a.clear&&delete a.clear}u.Set=c,xr({global:!0,constructor:!0,forced:c!=s},u),Yn(c,e),i||r.setStrong(c,e,n)}("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,r,n){var i=e((function(e,i){Qn(e,o),qc(e,{type:t,index:ga(null),first:void 0,last:void 0,size:0}),H||(e.size=0),de(i)||$o(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,s=Hc(t),a=function(e,t,r){var n,i,o=s(e),a=c(e,t);return a?a.value=r:(o.last=a={index:i=Wc(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=a),n&&(n.next=a),H?o.size++:e.size++,"F"!==i&&(o.index[i]=a)),e},c=function(e,t){var r,n=s(e),i=Wc(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return $c(o,{clear:function(){for(var e=s(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,H?e.size=0:this.size=0},delete:function(e){var t=this,r=s(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),H?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=s(this),n=sn(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),$c(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return a(this,0===e?0:e,t)}}:{add:function(e){return a(this,e=0===e?0:e,e)}}),H&&Gc(o,"size",{get:function(){return s(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Hc(t),o=Hc(n);gc(e,t,(function(e,t){qc(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?vc("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,vc(void 0,!0))}),r?"entries":"values",!r,!0),Kn(t)}});var Xc=un.filter,Yc=Hr("filter");xr({target:"Array",proto:!0,forced:!Yc},{filter:function(e){return Xc(this,e,arguments.length>1?arguments[1]:void 0)}});var Jc=ir.includes,Kc=q((function(){return!Array(1).includes()}));xr({target:"Array",proto:!0,forced:Kc},{includes:function(e){return Jc(this,e,arguments.length>1?arguments[1]:void 0)}}),Ja("includes");var Zc=TypeError,Qc=function(e){if(Ss(e))throw Zc("The method doesn't accept regular expressions");return e},eu=nt("match"),tu=ie("".indexOf);xr({target:"String",proto:!0,forced:!function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[eu]=!1,"/./"[e](t)}catch(e){}}return!1}("includes")},{includes:function(e){return!!~tu(is(pe(this)),is(Qc(e)),arguments.length>1?arguments[1]:void 0)}});var ru,nu="object"==typeof Reflect?Reflect:null,ou=nu&&"function"==typeof nu.apply?nu.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};ru=nu&&"function"==typeof nu.ownKeys?nu.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var su=Number.isNaN||function(e){return e!=e};function au(){au.init.call(this)}var cu=au;au.EventEmitter=au,au.prototype._events=void 0,au.prototype._eventsCount=0,au.prototype._maxListeners=void 0;var uu=10;function lu(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function du(e){return void 0===e._maxListeners?au.defaultMaxListeners:e._maxListeners}function fu(e,t,r,n){var i,o,s,a;if(lu(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=du(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function pu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function hu(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=pu.bind(n);return i.listener=r,n.wrapFn=i,i}function mu(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):vu(i,i.length)}function gu(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function vu(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function yu(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(au,"defaultMaxListeners",{enumerable:!0,get:function(){return uu},set:function(e){if("number"!=typeof e||e<0||su(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");uu=e}}),au.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},au.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||su(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},au.prototype.getMaxListeners=function(){return du(this)},au.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)ou(a,this,t);else{var c=a.length,u=vu(a,c);for(r=0;r<c;++r)ou(u[r],this,t)}return!0},au.prototype.addListener=function(e,t){return fu(this,e,t,!1)},au.prototype.on=au.prototype.addListener,au.prototype.prependListener=function(e,t){return fu(this,e,t,!0)},au.prototype.once=function(e,t){return lu(t),this.on(e,hu(this,e,t)),this},au.prototype.prependOnceListener=function(e,t){return lu(t),this.prependListener(e,hu(this,e,t)),this},au.prototype.removeListener=function(e,t){var r,n,i,o,s;if(lu(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},au.prototype.off=au.prototype.removeListener,au.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},au.prototype.listeners=function(e){return mu(this,e,!0)},au.prototype.rawListeners=function(e){return mu(this,e,!1)},au.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):gu.call(e,t)},au.prototype.listenerCount=gu,au.prototype.eventNames=function(){return this._eventsCount>0?ru(this._events):[]},cu.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}yu(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&yu(e,"error",t,{once:!0})}(e,i)}))};var wu=Su,bu=cu.EventEmitter;function Su(e,t,r){Array.isArray(r)||(r=[r]);var n=[];return r.forEach((function(r){var i=function(){var e=[].slice.call(arguments);e.unshift(r),t.emit.apply(t,e)};n.push(i),e.on(r,i)})),function(){r.forEach((function(t,r){e.removeListener(t,n[r])}))}}wu.filter=function(e,t){var r=new bu;return Su(e,r,t),r};const Cu=Bn.get("PeerConnectionStats");class iu extends cu{constructor(e){super(),this.peer=e,this.stats=null,this.emitInterval=null,this.previousStats=null}init(){var e=this;Cu.info("Initializing peer connection stats"),this.emitInterval=setInterval(D((function*(){const t=yield e.peer.getStats();e.parseStats(t),e.emit("stats",e.stats)})),1e3)}parseStats(e){this.previousStats=this.stats;const t={audio:{inbounds:[],outbounds:[]},video:{inbounds:[],outbounds:[]},raw:e};var r,n=B(e.values());try{for(n.s();!(r=n.n()).done;){const e=r.value;switch(e.type){case"outbound-rtp":xu(e,this.previousStats,t);break;case"inbound-rtp":Eu(e,this.previousStats,t);break;case"candidate-pair":e.nominated&&Tu(e,t)}}}catch(e){n.e(e)}finally{n.f()}this.stats=t}stop(){Cu.info("Stopping peer connection stats"),clearInterval(this.emitInterval)}}const xu=(e,t,r)=>{var n,i;const o=Iu(e),s=Ru(e.codecId,r.raw),a=Pu(e,o);a.totalBytesSent=e.bytesSent,a.id=e.id,a.mid=e.mid;const c=t?null!==(n=null===(i=t[o].outbounds.find(e=>e.id===a.id))||void 0===i?void 0:i.totalBytesSent)&&void 0!==n?n:0:null;a.bitrate=c?8*(e.bytesSent-c):0,"video"===o&&(a.qualityLimitationReason=e.qualityLimitationReason),r[o].outbounds.push(O(O({},s),a))},Eu=(e,t,r)=>{let n=Iu(e);const i=Ru(e.codecId,r.raw);["audio","video"].includes(n)||(n=e.id.includes("Video")?"video":"audio");const o=Pu(e,n);if(o.totalBytesReceived=e.bytesReceived,o.totalPacketsReceived=e.packetsReceived,o.totalPacketsLost=e.packetsLost,o.jitter=e.jitter,o.id=e.id,o.mid=e.mid,o.bitrate=0,o.packetsLostRatioPerSecond=0,o.packetsLostDeltaPerSecond=0,t){const r=t[n].inbounds.find(e=>e.id===o.id);if(r){const t=r.totalBytesReceived;o.bitrate=8*(e.bytesReceived-t),o.packetsLostRatioPerSecond=ku(o,r),o.packetsLostDeltaPerSecond=Au(o,r)}}r[n].inbounds.push(O(O({},i),o))},Tu=(e,t)=>{t.totalRoundTripTime=e.totalRoundTripTime,t.currentRoundTripTime=e.currentRoundTripTime,t.availableOutgoingBitrate=e.availableOutgoingBitrate,t.candidateType=t.raw.get(e.localCandidateId).candidateType},Iu=e=>e.mediaType||e.kind,Ru=(e,t)=>{var r;return{mimeType:(e&&null!==(r=t.get(e))&&void 0!==r?r:{}).mimeType}},Pu=(e,t)=>{const r={};return"video"===t&&(r.framesPerSecond=e.framesPerSecond,r.frameHeight=e.frameHeight,r.frameWidth=e.frameWidth),r.timestamp=e.timestamp,r},ku=(e,t)=>Au(e,t)/(e.totalPacketsReceived-t.totalPacketsReceived),Au=(e,t)=>e.totalPacketsLost-t.totalPacketsLost;var Ou=function(e,t,r,n){try{return n?t(gt(r)[0],r[1]):t(r)}catch(t){Uo(e,"throw",t)}},Lu=Array,Du=!Xo((function(e){Array.from(e)}));xr({target:"Array",stat:!0,forced:Du},{from:function(e){var t=qe(e),r=zr(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=sn(i,n>2?arguments[2]:void 0));var s,a,c,u,l,d,f=jo(t),p=0;if(!f||this===Lu&&Mo(f))for(s=rr(t),a=r?new this(s):Lu(s);s>p;p++)d=o?i(t[p],p):t[p],Rr(a,p,d);else for(l=(u=Bo(t,f)).next,a=r?new this:[];!(c=J(l,u)).done;p++)d=o?Ou(u,i,[c.value,p],!0):c.value,Rr(a,p,d);return a.length=p,a}});var Mu=Math.floor,Nu=ie("".charAt),ju=ie("".replace),_u=ie("".slice),Bu=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Uu=/\$([$&'`]|\d{1,2})/g,Vu=function(e,t,r,n,i,o){var s=r+e.length,a=n.length,c=Uu;return void 0!==i&&(i=qe(i),c=Bu),ju(o,c,(function(o,c){var u;switch(Nu(c,0)){case"$":return"$";case"&":return e;case"`":return _u(t,0,r);case"'":return _u(t,s);case"<":u=i[_u(c,1,-1)];break;default:var l=+c;if(0===l)return o;if(l>a){var d=Mu(l/10);return 0===d?o:d<=a?void 0===n[d-1]?Nu(c,1):n[d-1]+Nu(c,1):o}u=n[l-1]}return void 0===u?"":u}))},Fu=nt("replace"),zu=Math.max,$u=Math.min,Gu=ie([].concat),Wu=ie([].push),qu=ie("".indexOf),Hu=ie("".slice),Xu="$0"==="a".replace(/./,"$0"),Yu=!!/./[Fu]&&""===/./[Fu]("a","$0");Na("replace",(function(e,t,r){var n=Yu?"$":"$0";return[function(e,r){var n=pe(this),i=de(e)?void 0:Be(e,Fu);return i?J(i,e,n,r):J(t,is(n),e,r)},function(e,i){var o=gt(this),s=is(e);if("string"==typeof i&&-1===qu(i,n)&&-1===qu(i,"$<")){var a=r(t,o,s,i);if(a.done)return a.value}var c=ye(i);c||(i=is(i));var u=o.global;if(u){var l=o.unicode;o.lastIndex=0}for(var d=[];;){var f=$a(o,s);if(null===f)break;if(Wu(d,f),!u)break;""===is(f[0])&&(o.lastIndex=Fa(s,tr(o.lastIndex),l))}for(var p,h="",m=0,g=0;g<d.length;g++){for(var v=is((f=d[g])[0]),y=zu($u(Jt(f.index),s.length),0),w=[],E=1;E<f.length;E++)Wu(w,void 0===(p=f[E])?p:String(p));var T=f.groups;if(c){var I=Gu([v],w,y,s);void 0!==T&&Wu(I,T);var R=is(mn(i,void 0,I))}else R=Vu(v,s,y,w,T,i);y>=m&&(h+=Hu(s,m,y)+R,m=y+v.length)}return h+Hu(s,m)}]}),!!q((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Xu||Yu);var Ju,Ku="\t\n\v\f\r                 \u2028\u2029\ufeff",Zu=ie("".replace),Qu="["+Ku+"]",el=RegExp("^"+Qu+Qu+"*"),tl=RegExp(Qu+Qu+"*$"),rl=function(e){return function(t){var r=is(pe(t));return 1&e&&(r=Zu(r,el,"")),2&e&&(r=Zu(r,tl,"")),r}},nl={start:rl(1),end:rl(2),trim:rl(3)},il=Pt.PROPER,ol=nl.trim;xr({target:"String",proto:!0,forced:(Ju="trim",q((function(){return!!Ku[Ju]()||"​…᠎"!=="​…᠎"[Ju]()||il&&Ku[Ju].name!==Ju})))},{trim:function(){return ol(this)}});var sl=nt("matchAll"),al="RegExp String",cl=al+" Iterator",ul=Gt.set,ll=Gt.getterFor(cl),fl=RegExp.prototype,hl=TypeError,ml=nn("".indexOf),vl=nn("".matchAll),yl=!!vl&&!q((function(){vl("a",/./)})),bl=ac((function(e,t,r,n){ul(this,{type:cl,regexp:e,string:t,global:r,unicode:n,done:!1})}),al,(function(){var e=ll(this);if(e.done)return vc(void 0,!0);var t=e.regexp,r=e.string,n=$a(t,r);return null===n?(e.done=!0,vc(void 0,!0)):e.global?(""===is(n[0])&&(t.lastIndex=Fa(r,tr(t.lastIndex),e.unicode)),vc(n,!1)):(e.done=!0,vc(n,!1))}));xr({target:"String",proto:!0,forced:yl},{matchAll:function(e){var t,r,n,i=pe(this);if(de(e)){if(yl)return vl(i,e)}else{if(Ss(e)&&(t=is(pe(Es(e))),!~ml(t,"g")))throw hl("`.matchAll` does not allow non-global regexes");if(yl)return vl(i,e);if(n=Be(e,sl))return J(n,e,i)}return r=is(i),new RegExp(e,"g")[sl](r)}}),sl in fl||qt(fl,sl,(function(e){var t,r,n,i=gt(this),o=is(e),s=ri(i,RegExp),a=is(Es(i));return t=new s(s===RegExp?i.source:i,a),r=!!~ml(a,"g"),n=!!~ml(a,"u"),t.lastIndex=tr(i.lastIndex),new bl(t,o,r,n)}));var Sl=ie([].reverse),xl=[1,2];xr({target:"Array",proto:!0,forced:String(xl)===String(xl.reverse())},{reverse:function(){return Er(this)&&(this.length=this.length),Sl(this)}});var El=V((function(e){var t=e.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(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.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(e){return null!=e.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(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.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(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["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(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{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(e){return null!=e.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(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new 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(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.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"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",(t+=null!=e.rateNumerator?" rate=%s":"")+(null!=e.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(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),Tl=V((function(e,t){var r=function(e){return String(Number(e))===e?Number(e):e},n=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),o=r[r.length-1]);for(var s=0;s<(El[t]||[]).length;s+=1){var a=El[t][s];if(a.reg.test(i))return n(a,o,i)}})),t.media=r,t};var o=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length?e[n[0]]=r(n[1]):1===n.length&&t.length>1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}})),Il=/%[sdv%]/g,Rl=function(e){var t=1,r=arguments,n=r.length;return e.replace(Il,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},Pl=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return Rl.apply(null,n)},kl=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Al=["i","c","b","a"],Ol={write:function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||kl,n=t.innerOrder||Al,i=[];return r.forEach((function(t){El[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Pl(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Pl(t,r,e))}))}))})),e.media.forEach((function(e){i.push(Pl("m",El.m[0],e)),n.forEach((function(t){El[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Pl(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Pl(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:Tl.parse,parseParams:Tl.parseParams,parseFmtpConfig:Tl.parseFmtpConfig,parsePayloads:Tl.parsePayloads,parseRemoteCandidates:Tl.parseRemoteCandidates,parseImageAttributes:Tl.parseImageAttributes,parseSimulcastStreamList:Tl.parseSimulcastStreamList};class dl{constructor(e,t,r,n,i,o,s,a,c){this.foundation=e,this.componentId=t,this.transport=r,this.priority=n,this.address=i,this.port=o,this.type=s,this.relAddr=a,this.relPort=c}equals(e){return e.foundation===this.foundation&&e.componentId===this.componentId&&e.transport===this.transport&&e.priority===this.priority&&e.address===this.address&&e.port===this.port&&e.type===this.type&&e.relAddr===this.relAddr&&e.relPort===this.relPort}clone(){return new dl(this.foundation,this.componentId,this.transport,this.priority,this.address,this.port,this.type,this.relAddr,this.relPort)}plain(){const e={foundation:this.foundation,componentId:this.componentId,transport:this.transport,priority:this.priority,address:this.address,port:this.port,type:this.type};return this.relAddr&&(e.relAddr=this.relAddr),this.relPort&&(e.relPort=this.relPort),e}getFoundation(){return this.foundation}getComponentId(){return this.componentId}getTransport(){return this.transport}getPriority(){return this.priority}getAddress(){return this.address}getPort(){return this.port}getType(){return this.type}getRelAddr(){return this.relAddr}getRelPort(){return this.relPort}}dl.expand=function(e){return new dl(e.foundation,e.componentId,e.transport,e.priority,e.address,e.port,e.type,e.relAddr,e.relPort)};var Ll=dl;class pl{constructor(e,t){this.id=e,this.params=t||[]}clone(){return new pl(this.id,this.params)}plain(){return this.params.length?{id:this.id,params:this.params}:{id:this.id}}getId(){return this.id}getParams(){return this.params}}pl.expand=function(e){return new pl(e.id,e.params)};var Dl=pl;class gl{constructor(e,t,r){this.codec=e,this.type=t,this.params={},this.rtcpfbs=new Set,r&&this.addParams(r)}clone(){const e=new gl(this.codec,this.type,this.params);this.hasRTX()&&e.setRTX(this.getRTX());for(const t of this.rtcpfbs)e.addRTCPFeedback(t.clone());return this.hasChannels()&&e.setChannels(this.getChannels()),e}plain(){const e={codec:this.codec,type:this.type};this.rtx&&(e.rtx=this.rtx),this.channels&&(e.channels=this.channels),Object.keys(this.params).length&&(e.params=this.params);for(const t of this.rtcpfbs)e.rtcpfbs||(e.rtcpfbs=[]),e.rtcpfbs.push(t.plain());return e}setRTX(e){this.rtx=e}getType(){return this.type}setType(e){this.type=e}getCodec(){return this.codec}getParams(){return this.params}addParams(e){for(const t in e)this.params[t]=e[t]}addParam(e,t){this.params[e]=t}hasParam(e){return this.params.hasOwnProperty(e)}getParam(e,t){return this.hasParam(e)?this.params[e]:""+t}hasRTX(){return this.rtx}getRTX(){return this.rtx}hasChannels(){return this.channels}getChannels(){return this.channels}setChannels(e){this.channels=e}addRTCPFeedback(e){this.rtcpfbs.add(e)}getRTCPFeedbacks(){return this.rtcpfbs}}gl.expand=function(e){const t=new gl(e.codec,e.type,e.params);e.rtx&&t.setRTX(e.rtx),e.channels&&t.setChannels(e.channels);for(let r=0;e.rtcpfbs&&r<e.rtcpfbs.length;++r){const n=Dl.expand(e.rtcpfbs[r]);t.addRTCPFeedback(n)}return t},gl.MapFromNames=function(e,t,r){const n=new Map;let i=96;for(let o=0;o<e.length;++o){let s;const a=e[o].split(";"),c=a[0].toLowerCase().trim();s="pcmu"===c?0:"pcma"===c?8:++i;const u=new gl(c,s);"opus"===c?u.setChannels(2):"multiopus"===c&&u.setChannels(6),t&&"ulpfec"!==c&&"flexfec-03"!==c&&"red"!==c&&u.setRTX(++i);for(let e=0;r&&e<r.length;++e)u.addRTCPFeedback(new Dl(r[e].id,r[e].params));for(let e=1;e<a.length;++e){let t=a[e].split("=");u.addParam(t[0].trim(),t[1].trim())}n.set(u.getCodec().toLowerCase(),u)}return n};var Ml=gl,Nl=function e(){var t=this;if(!(this instanceof e))return new(Function.prototype.bind.apply(e,[null].concat(Array.prototype.slice.call(arguments))));Array.from(arguments).forEach((function(e){t[e]=Symbol.for("MEDOOZE_SEMANTIC_SDP_"+e)}))};const jl=Nl("ACTIVE","PASSIVE","ACTPASS","INACTIVE");jl.byValue=function(e){switch(e){case jl.ACTIVE:case jl.PASSIVE:case jl.ACTPASS:case jl.INACTIVE:return e}return jl[e.toUpperCase()]},jl.toString=function(e){switch(e){case jl.ACTIVE:return"active";case jl.PASSIVE:return"passive";case jl.ACTPASS:return"actpass";case jl.INACTIVE:return"inactive"}},jl.reverse=function(e){switch(e){case jl.ACTIVE:return jl.PASSIVE;case jl.PASSIVE:return jl.ACTIVE;case jl.ACTPASS:return jl.PASSIVE;case jl.INACTIVE:return jl.INACTIVE}};var _l=jl;class wl{constructor(e,t,r){this.setup=e,this.hash=t,this.fingerprint=r}clone(){return new wl(this.setup,this.hash,this.fingerprint)}plain(){return{setup:_l.toString(this.setup),hash:this.hash,fingerprint:this.fingerprint}}getFingerprint(){return this.fingerprint}getHash(){return this.hash}getSetup(){return this.setup}setSetup(e){this.setup=e}}wl.expand=function(e){return new wl(e.setup?_l.byValue(e.setup):_l.ACTPASS,e.hash,e.fingerprint)};var Bl=wl;class Cl{constructor(e,t,r,n){this.tag=e,this.suite=t,this.keyParams=r,this.sessionParams=n}clone(){return new Cl(this.tag,this.suite,this.keyParams,this.sessionParams)}plain(){return{tag:this.tag,suite:this.suite,keyParams:this.keyParams,sessionParams:this.sessionParams}}getSessionParams(){return this.sessionParams}getKeyParams(){return this.keyParams}getSuite(){return this.suite}getTag(){return this.tag}}Cl.expand=function(e){return new Cl(e.tag,e.suite,e.keyParams,e.sessionParams)};for(var Ul=Cl,Fl=[],zl=[],$l="undefined"!=typeof Uint8Array?Uint8Array:Array,Gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wl=0,Hl=Gl.length;Wl<Hl;++Wl)Fl[Wl]=Gl[Wl],zl[Gl.charCodeAt(Wl)]=Wl;function Jl(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function Kl(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(Fl[(i=n)>>18&63]+Fl[i>>12&63]+Fl[i>>6&63]+Fl[63&i]);return o.join("")}zl["-".charCodeAt(0)]=62,zl["_".charCodeAt(0)]=63;var Zl=function(e){var t,r,n=Jl(e),i=n[0],o=n[1],s=new $l(function(e,t,r){return 3*(t+r)/4-r}(0,i,o)),a=0,c=o>0?i-4:i;for(r=0;r<c;r+=4)t=zl[e.charCodeAt(r)]<<18|zl[e.charCodeAt(r+1)]<<12|zl[e.charCodeAt(r+2)]<<6|zl[e.charCodeAt(r+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===o&&(t=zl[e.charCodeAt(r)]<<2|zl[e.charCodeAt(r+1)]>>4,s[a++]=255&t),1===o&&(t=zl[e.charCodeAt(r)]<<10|zl[e.charCodeAt(r+1)]<<4|zl[e.charCodeAt(r+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},ed=function(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Kl(e,s,s+o>a?a:s+o));return 1===n?(t=e[r-1],i.push(Fl[t>>2]+Fl[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(Fl[t>>10]+Fl[t>>4&63]+Fl[t<<2&63]+"=")),i.join("")},rd=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?i-1:0,f=r?-1:1,p=e[t+d];for(d+=f,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=f,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+d],d+=f,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)},id=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,h=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=h,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+p]=255&s,p+=h,s/=256,u-=8);e[r+p-h]|=128*m},sd=V((function(e,t){const r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|f(e,t);let n=i(r);const s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return l(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return l(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);const s=function(e){if(o.isBuffer(e)){const t=0|d(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||K(e.length)?i(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return a(e),i(e<0?0:0|d(e))}function u(e){const t=e.length<0?0:0|d(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function l(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function d(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}return-1}function v(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(K(n))return s;e[r+s]=n}return s}function y(e,t,r,n){return Y(H(t,e.length-r),e,r,n)}function w(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return Y(X(t),e,r,n)}function T(e,t,r,n){return Y(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function I(e,t,r){return 0===t&&r===e.length?ed(e):ed(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return a(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),J(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=o.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,Uint8Array))i+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)h(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e<c;++e)if(u[e]!==l[e]){s=u[e],a=l[e];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function k(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function A(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function O(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Z[e[n]];return i}function L(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function j(e,t,r,n,i){$(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function _(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,n,i){return t=+t,r>>>=0,i||_(e,0,r,4),id(e,t,r,n,23,4),r+4}function U(e,t,r,n,i){return t=+t,r>>>=0,i||_(e,0,r,8),id(e,t,r,n,52,8),r+8}o.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Q((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),rd(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),rd(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),rd(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),rd(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Q((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Q((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Q((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Q((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const s=o.isBuffer(e)?e:o.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};const V={};function F(e,t,r){V[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function z(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?e+" is outside of buffer bounds":"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function H(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){return Zl(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Q(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}})),cd=V((function(e,t){var r=sd.Buffer;function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=sd:(n(sd,t),t.Buffer=i),n(r,i),i.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},i.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return sd.SlowBuffer(e)}})),ld=V((function(e){var t=65536,r=cd.Buffer,n=U.crypto||U.msCrypto;n&&n.getRandomValues?e.exports=function(e,i){if(e>4294967295)throw new RangeError("requested too many random bytes");var o=r.allocUnsafe(e);if(e>0)if(e>t)for(var s=0;s<e;s+=t)n.getRandomValues(o.slice(s,s+t));else n.getRandomValues(o);return"function"==typeof i?k.nextTick((function(){i(null,o)})):o}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}));class Vl{constructor(e,t){this.ufrag=e,this.pwd=t,this.lite=!1,this.endOfCandidates=!1}clone(){const e=new Vl(this.ufrag,this.pwd);return e.setLite(this.lite),e.setEndOfCandidates(this.endOfCandidates),e}plain(){const e={ufrag:this.ufrag,pwd:this.pwd};return this.lite&&(e.lite=this.lite),this.endOfCandidates&&(e.endOfCandidates=this.endOfCandidates),e}getUfrag(){return this.ufrag}getPwd(){return this.pwd}isLite(){return this.lite}setLite(e){this.lite=e}isEndOfCandidates(){return this.endOfCandidates}setEndOfCandidates(e){this.endOfCandidates=e}}Vl.generate=function(e){const t=new Vl,r=ld(8),n=ld(24);return t.ufrag=r.toString("hex"),t.pwd=n.toString("hex"),t.lite=e,t},Vl.expand=function(e){const t=new Vl(e.ufrag,e.pwd);return t.setLite(e.lite),t.setEndOfCandidates(e.endOfCandidates),t};var fd=Vl;const hd=Nl("SEND","RECV");hd.byValue=function(e){return hd[e.toUpperCase()]},hd.toString=function(e){switch(e){case hd.SEND:return"send";case hd.RECV:return"recv"}},hd.reverse=function(e){switch(e){case hd.SEND:return hd.RECV;case hd.RECV:return hd.SEND}};var md=hd;class ql{constructor(e,t){this.id=e,this.direction=t,this.formats=[],this.params=new Map}clone(){var e=new ql(this.id,this.direction);return e.setFormats(this.formats),e.setParams(this.params),e}plain(){var e={id:this.id,direction:md.toString(this.direction)};for(var[t,r]of(this.formats&&(e.formats=this.formats),this.params.entries()))e.params||(e.params={}),e.params[t]=r;return e}getId(){return this.id}getDirection(){return this.direction}setDirection(e){this.direction=e}getFormats(){return this.formats}setFormats(e){this.formats=[];for(let t=0;t<e.length;++t)this.formats.push(parseInt(e[t]))}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}getDirection(){return this.direction}setDirection(e){this.direction=e}}ql.expand=function(e){const t=new ql(e.id,md.byValue(e.direction));for(let r in e.params)t.addParam(r,e.params[r]);return e.formats&&t.setFormats(e.formats),t};var gd=ql;class Xl{constructor(e,t){this.paused=t,this.id=e}clone(){return new Xl(this.id,this.paused)}plain(){return{id:this.id,paused:this.paused}}isPaused(){return this.paused}getId(){return this.id}}Xl.expand=function(e){return new Xl(e.id,e.paused)};var vd=Xl;class Yl{constructor(){this.send=[],this.recv=[]}clone(){const e=new Yl;for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;t<this.send[e].length;++t)r.push(this.send[t][e].clone());e.addSimulcastAlternativeStreams(md.SEND,r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;t<this.recv[e].length;++t)r.push(this.recv[t][e].clone());e.addSimulcastAlternativeStreams(md.RECV,r)}return e}plain(){const e={send:[],recv:[]};for(let t=0;t<this.send.length;++t){let r=[];for(let e=0;e<this.send[t].length;++e)r.push(this.send[t][e].plain());e.send.push(r)}for(let t=0;t<this.recv.length;++t){let r=[];for(let e=0;e<this.recv[t].length;++e)r.push(this.recv[t][e].plain());e.recv.push(r)}return e}addSimulcastAlternativeStreams(e,t){return e===md.SEND?this.send.push(t):this.recv.push(t)}addSimulcastStream(e,t){return e===md.SEND?this.send.push([t]):this.recv.push([t])}getSimulcastStreams(e){return e===md.SEND?this.send:this.recv}}Yl.expand=function(e){const t=new Yl;for(let r=0;r<e.send.length;++r){let n=[];for(let t=0;t<e.send[r].length;++t)n.push(vd.expand(e.send[r][t]));t.addSimulcastAlternativeStreams(md.SEND,n)}for(let r=0;r<e.recv.length;++r){let n=[];for(let t=0;t<e.recv[r].length;++t)n.push(vd.expand(e.recv[r][t]));t.addSimulcastAlternativeStreams(md.RECV,n)}return t};var yd=Yl;const wd=Nl("SENDRECV","SENDONLY","RECVONLY","INACTIVE");wd.byValue=function(e){return wd[e.toUpperCase()]},wd.toString=function(e){switch(e){case wd.SENDRECV:return"sendrecv";case wd.SENDONLY:return"sendonly";case wd.RECVONLY:return"recvonly";case wd.INACTIVE:return"inactive"}},wd.reverse=function(e){switch(e){case wd.SENDRECV:return wd.SENDRECV;case wd.SENDONLY:return wd.RECVONLY;case wd.RECVONLY:return wd.SENDONLY;case wd.INACTIVE:return wd.INACTIVE}};var bd=wd;class Ql{constructor(e,t){this.port=e,this.maxMessageSize=t}clone(){return new Ql(this.port,this.maxMessageSize)}plain(){return{port:this.port,maxMessageSize:this.maxMessageSize}}getPort(){return this.port}getMaxMessageSize(){return this.maxMessageSize}}Ql.expand=function(e){return new Ql(e.port,e.maxMessageSize)};var Cd=Ql;class td{constructor(e,t){this.id=e,this.type=t,this.direction=bd.SENDRECV,this.extensions=new Map,this.codecs=new Map,this.rids=new Map,this.simulcast=null,this.bitrate=0,this.control=null,this.dataChannel=null}clone(){const e=new td(this.id,this.type);e.setDirection(this.direction),e.setBitrate(this.bitrate);for(const t of this.codecs.values())e.addCodec(t.clone());for(const[t,r]of this.extensions.entries())e.addExtension(t,r);for(const t of this.rids.values())e.addRID(t.clone());return this.simulcast&&e.setSimulcast(this.simulcast.clone()),this.control&&e.setControl(this.control),this.dataChannel&&e.setDatachannel(this.dataChannel.clone()),e}plain(){const e={id:this.id,type:this.type,direction:bd.toString(this.direction),codecs:[]};this.dataChannel&&(e.dataChannel=this.dataChannel.plain()),this.bitrate&&(e.bitrate=this.bitrate);for(const t of this.codecs.values())e.codecs.push(t.plain());for(const[t,r]of this.extensions.entries())e.extensions||(e.extensions={}),e.extensions[t]=r;for(const t of this.rids.values())e.rids||(e.rids=[]),e.rids.push(t.plain());return this.simulcast&&(e.simulcast=this.simulcast.plain()),this.control&&(e.control=this.control),e}getType(){return this.type}getId(){return this.id}setId(e){this.id=e}addExtension(e,t){this.extensions.set(e,t)}addRID(e){this.rids.set(e.getId(),e)}addCodec(e){this.codecs.set(e.getType(),e)}setCodecs(e){this.codecs=e}getCodecForType(e){return this.codecs.get(e)}getCodec(e){for(const t of this.codecs.values())if(t.getCodec().toLowerCase()===e.toLowerCase())return t;return null}hasCodec(e){return null!==this.getCodec(e)}getCodecs(){return this.codecs}hasRTX(){for(const e of this.codecs.values())if(e.hasRTX())return!0;return!1}getExtensions(){return this.extensions}getRIDs(){return this.rids}getRID(e){return this.rids.get(e)}getBitrate(){return this.bitrate}setBitrate(e){this.bitrate=e}getDirection(){return this.direction}setDirection(e){this.direction=e}hasControl(){return!!this.control}getControl(){return this.control}setControl(e){this.control=e}hasDataChannel(){return!!this.dataChannel}getDataChannel(){return this.dataChannel}setDataChannel(e){this.dataChannel=e}answer(e){const t=new td(this.id,this.type);if(e){if(t.setDirection(bd.reverse(this.direction)),e.codecs){let r;r=Array.isArray(e.codecs)?Ml.MapFromNames(e.codecs,e.rtx,e.rtcpfbs):e.codecs;for(let e of this.codecs.values())if(r.has(e.getCodec().toLowerCase())){const n=r.get(e.getCodec().toLowerCase());if("h264"===n.getCodec()&&n.hasParam("packetization-mode")&&n.getParam("packetization-mode")!=e.getParam("packetization-mode","0"))continue;if("h264"===n.getCodec()&&n.hasParam("profile-level-id")&&e.hasParam("profile-level-id")&&n.getParam("profile-level-id")!=e.getParam("profile-level-id"))continue;if("multiopus"===n.getCodec()&&n.hasParam("num_streams")&&e.hasParam("num_streams")&&n.getParam("num_streams")!=e.getParam("num_streams"))continue;const i=n.clone();i.setType(e.getType()),i.hasRTX()&&i.setRTX(e.getRTX()),e.hasChannels()&&i.setChannels(e.getChannels()),i.addParams(e.getParams()),t.addCodec(i)}}const n=new Set(e.extensions);for(let[e,r]of this.extensions)n.has(r)&&t.addExtension(e,r);if(e.simulcast&&this.simulcast){const e=new yd,n=this.simulcast.getSimulcastStreams(md.SEND);if(n)for(let t=0;t<n.length;++t){var r=[];for(let e=0;e<n[t].length;++e)r.push(n[t][e].clone());e.addSimulcastAlternativeStreams(md.RECV,r)}const i=this.simulcast.getSimulcastStreams(md.RECV);if(i)for(let t=0;t<i.length;++t){r=[];for(let e=0;e<i[t].length;++e)r.push(i[t][e].clone());e.addSimulcastAlternativeStreams(md.SEND,r)}for(const e of this.rids.values()){const r=e.clone();r.setDirection(md.reverse(e.getDirection())),t.addRID(r)}t.setSimulcast(e)}if(e.dataChannel&&this.dataChannel){const r=new Cd(this.dataChannel.getPort(),e.dataChannel.maxMessageSize?e.dataChannel.maxMessageSize:this.dataChannel.getMaxMessageSize());t.setDataChannel(r)}}else t.setDirection(bd.INACTIVE);return t}getSimulcast(){return this.simulcast}setSimulcast(e){this.simulcast=e}}td.create=function(e,t){const r=new td(e,e);return t?t.codecs&&(Array.isArray(t.codecs)?r.setCodecs(Ml.MapFromNames(t.codecs,t.rtx,t.rtcpfbs)):r.setCodecs(t.codecs)):r.setDirection(bd.INACTIVE),r},td.expand=function(e){const t=new td(e.id,e.type);if(e.direction&&t.setDirection(bd.byValue(e.direction)),t.setBitrate(e.bitrate),e.dataChannel){const r=Cd.expand(e.dataChannel);r&&t.setDataChannel(r)}for(let r in e.extensions)t.addExtension(r,e.extensions[r]);for(let r=0;e.codecs&&r<e.codecs.length;++r){const n=Ml.expand(e.codecs[r]);n&&t.addCodec(n)}for(let r=0;e.rids&&r<e.rids.length;++r){const n=gd.expand(e.rids[r]);t.addRID(n)}return e.simulcast&&t.setSimulcast(yd.expand(e.simulcast)),e.control&&t.setControl(e.control),t};var xd=td;class nd{constructor(e,t){this.semantics=e,this.ssrcs=[];for(let e=0;e<t.length;++e)this.ssrcs.push(parseInt(t[e]))}clone(){return new nd(this.semantics,this.ssrcs)}plain(){const e={semantics:this.semantics,ssrcs:[]};for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);return e}getSemantics(){return this.semantics}getSSRCs(){return this.ssrcs}}nd.expand=function(e){return new nd(e.semantics,e.ssrcs)};var Ed=nd;class od{constructor(e){this.ssrc=e}clone(){const e=new od(this.ssrc);e.setCName(this.cname),e.setStreamId(this.streamId),e.setTrackId(this.trackId)}plain(){const e={ssrc:this.ssrc};return this.cname&&(e.cname=this.cname),this.streamId&&(e.streamId=this.streamId),this.trackId&&(e.trackid=this.trackId),e}getCName(){return this.cname}setCName(e){this.cname=e}getStreamId(){return this.streamId}setStreamId(e){this.streamId=e}getTrackId(){return this.trackId}setTrackId(e){this.trackId=e}getSSRC(){return this.ssrc}}od.expand=function(e){const t=new od(e.ssrc);return t.setCName(e.cname),t.setStreamId(e.streamId),t.setTrackId(e.trackId),t};var Td=od;class ad{constructor(e,t){this.id=e,this.paused=t,this.codecs=new Map,this.params=new Map}clone(){var e=new ad(this.id,this.paused);for(let t of this.codecs.values())e.addCodec(t.clone());return e.setParams(this.params),e}plain(){var e={id:this.id,paused:this.paused,codecs:{},params:{}};for(var[t,r]of this.codecs.entries())e.codecs[t]=r.plain();for(var[t,n]of this.params.entries())e.params[t]=n;return e}getId(){return this.id}getCodecs(){return this.codecs}addCodec(e){this.codecs.set(e.getType(),e)}getParams(){return this.params}setParams(e){this.params=new Map(e)}addParam(e,t){this.params.set(e,t)}isPaused(){return this.paused}}ad.expand=function(e){const t=new ad(e.id,e.paused);for(let r in e.codecs)t.addCodec(Ml.expand(e.codecs[r]));for(let r in e.params)t.addParam(r,e.params[r]);return t};var Id=ad;class ud{constructor(e,t){this.media=e,this.id=t,this.ssrcs=[],this.groups=[],this.encodings=[]}clone(){const e=new ud(this.media,this.id);this.mediaId&&e.setMediaId(this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.addSSRC(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.addSourceGroup(this.groups[t].clone());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].clone());e.addAlternativeEncodings(r)}return e}plain(){const e={media:this.media,id:this.id,ssrcs:[]};this.mediaId&&(e.mediaId=this.mediaId);for(let t=0;t<this.ssrcs.length;++t)e.ssrcs.push(this.ssrcs[t]);for(let t=0;t<this.groups.length;++t)e.groups||(e.groups=[]),e.groups.push(this.groups[t].plain());for(let t=0;t<this.encodings.length;++t){const r=[];for(let e=0;e<this.encodings[t].length;++e)r.push(this.encodings[t][e].plain());r.length&&(e.encodings||(e.encodings=[]),e.encodings.push(r))}return e}getMedia(){return this.media}setMediaId(e){this.mediaId=e}getMediaId(){return this.mediaId}getId(){return this.id}addSSRC(e){this.ssrcs.push(e)}getSSRCs(){return this.ssrcs}addSourceGroup(e){this.groups.push(e)}getSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return t;return null}getSourceGroups(){return this.groups}hasSourceGroup(e){for(const t of this.groups)if(t.getSemantics().toLowerCase()===e.toLowerCase())return!0;return!1}getEncodings(){return this.encodings}addEncoding(e){this.encodings.push([e])}addAlternativeEncodings(e){this.encodings.push(e)}setEncodings(e){this.encodings=e}}ud.expand=function(e){const t=new ud(e.media,e.id);e.mediaId&&t.setMediaId(e.mediaId);for(let r=0;e.ssrcs&&r<e.ssrcs.length;++r)t.addSSRC(e.ssrcs[r]);for(let r=0;e.groups&&r<e.groups.length;++r)t.addSourceGroup(Ed.expand(e.groups[r]));for(let r=0;e.encodings&&r<e.encodings.length;++r){const n=[];for(let t=0;t<e.encodings[r].length;++t)n.push(Id.expand(e.encodings[r][t]));t.addAlternativeEncodings(n)}return t};var Pd=ud;class dd{constructor(e){this.id=e,this.tracks=new Map}clone(){const e=new dd(this.id);for(const t of this.tracks.values())e.addTrack(t.clone());return e}plain(){const e={id:this.id,tracks:[]};for(const t of this.tracks.values())e.tracks.push(t.plain());return e}getId(){return this.id}addTrack(e){this.tracks.set(e.getId(),e)}removeTrack(e){return this.tracks.delete(e.getId())}removeTrackById(e){return this.tracks.delete(e)}getFirstTrack(e){for(let t of this.tracks.values())if(t.getMedia().toLowerCase()===e.toLowerCase())return t;return null}getTracks(){return this.tracks}removeAllTracks(){this.tracks.clear()}getTrack(e){return this.tracks.get(e)}}dd.expand=function(e){const t=new dd(e.id,e.paused);for(let r=0;r<e.tracks.length;++r){const n=Pd.expand(e.tracks[r]);n&&t.addTrack(n)}return t};var kd=dd;class pd{constructor(e){this.version=e||1,this.streams=new Map,this.medias=new Array,this.candidates=new Array,this.ice=null,this.dtls=null,this.crypto=null,this.extmapAllowMixed=!0}clone(){const e=new pd(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());for(const t of this.streams.values())e.addStream(t.clone());for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e.setExmapAllowMixed(this.extmapAllowMixed),e}plain(){const e={version:this.version,streams:[],medias:[],candidates:[]};for(let t=0;t<this.medias.length;++t)e.medias.push(this.medias[t].plain());for(const t of this.streams.values())e.streams.push(t.plain());for(let t=0;t<this.candidates.length;++t)e.candidates.push(this.candidates[t].plain());return this.ice&&(e.ice=this.ice.plain()),this.dtls&&(e.dtls=this.dtls.plain()),this.crypto&&(e.crypto=this.crypto.plain()),this.extmapAllowMixed||(e.extmapAllowMixedNotSupported=!this.extmapAllowMixed),e}unify(){const e=new pd(this.version);for(let t=0;t<this.medias.length;++t)e.addMedia(this.medias[t].clone());const t={audio:e.getMediasByType("audio"),video:e.getMediasByType("video")};for(const r of this.streams.values()){const n=r.clone();for(const r of n.getTracks().values()){let n=t[r.getMedia()].pop();n||(n=this.getMedia(r.getMedia()).clone(),n.setId(r.getId()),e.addMedia(n)),r.setMediaId(n.getId())}e.addStream(n)}for(let t=0;t<this.candidates.length;++t)e.addCandidate(this.candidates[t].clone());return this.ice&&e.setICE(this.ice.clone()),this.dtls&&e.setDTLS(this.dtls.clone()),this.crypto&&e.setCrypto(this.crypto.clone()),e}setVersion(e){this.version=e}addMedia(e){this.medias.push(e)}getMedia(e){for(let t in this.medias){let r=this.medias[t];if(r.getType().toLowerCase()===e.toLowerCase())return r}return null}getMediasByType(e){var t=[];for(let r in this.medias){let n=this.medias[r];n.getType().toLowerCase()===e.toLowerCase()&&t.push(n)}return t}getMediaById(e){for(let t in this.medias){let r=this.medias[t];if(r.getId().toLowerCase()===e.toLowerCase())return r}return null}replaceMedia(e){for(let t in this.medias)if(this.medias[t].getId()==e.getId())return this.medias[t]=e,!0;return!1}getMedias(){return this.medias}getVersion(){return this.version}getDTLS(){return this.dtls}setDTLS(e){this.dtls=e}hasCrypto(){return!!this.crypto}getCrypto(){return this.crypto}setCrypto(e){this.crypto=e}hasICE(){return!!this.ice}getICE(){return this.ice}setICE(e){this.ice=e}addCandidate(e){for(let t=0;t<this.candidates.length;++t)if(this.candidates[t].equals(e))return;this.candidates.push(e)}addCandidates(e){for(let t=0;t<e.length;++t)this.addCandidate(e[t])}getCandidates(){return this.candidates}getStream(e){return this.streams.get(e)}getStreams(){return this.streams}getFirstStream(){for(let e of this.streams.values())return e;return null}addStream(e){this.streams.set(e.getId(),e)}removeStream(e){return this.streams.delete(e.getId())}removeAllStreams(){this.streams.clear()}getTrackByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return n;return null}getStreamByMediaId(e){for(let t of this.streams.values())for(let[r,n]of t.getTracks())if(n.getMediaId()==e)return t;return null}getExtmapAllowMixed(){return this.extmapAllowMixed}setExtmapAllowMixed(e){this.extmapAllowMixed=e}answer(e){const t=new pd;e.ice&&(e.ice instanceof fd?t.setICE(e.ice.clone()):t.setICE(fd.expand(e.ice))),e.dtls&&(e.dtls instanceof Bl?t.setDTLS(e.dtls):t.setDTLS(Bl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Ul?t.setCrypto(e.crypto):t.setCrypto(Ul.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Ll?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Ll.expand(e.candidates[r]));for(const r of this.medias){const n=e&&e.capabilities&&e.capabilities[r.getType()];t.addMedia(r.answer(n))}return t.setExtmapAllowMixed(this.extmapAllowMixed),t}toString(){let e={version:0,media:[]};e.version=0,e.origin={username:"-",sessionId:(new Date).getTime(),sessionVersion:this.version,netType:"IN",ipVer:4,address:"127.0.0.1"},e.name="semantic-sdp",e.connection={version:4,ip:"0.0.0.0"},e.timing={start:0,stop:0},this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),e.msidSemantic={semantic:"WMS",token:"*"},e.groups=[],this.extmapAllowMixed&&(e.extmapAllowMixed="extmap-allow-mixed");let t={type:"BUNDLE",mids:[]};for(let r in this.medias){let n=this.medias[r],i={type:n.getType(),port:9,protocol:"",fmtp:[],rtp:[],rtcpFb:[],ext:[],bandwidth:[],candidates:[],ssrcGroups:[],ssrcs:[],rids:[]};i.direction=bd.toString(n.getDirection()),this.extmapAllowMixed&&(i.extmapAllowMixed="extmap-allow-mixed"),i.mid=n.getId(),t.mids.push(n.getId()),n.hasControl()&&(i.control=n.getControl()),n.getBitrate()>0&&(i.bandwidth.push({type:"AS",limit:n.getBitrate()}),i.bandwidth.push({type:"TIAS",limit:1e3*n.getBitrate()}));let o=this.getCandidates();for(let e=0;e<o.length;++e){let t=o[e];i.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()})}if(this.getICE()&&(i.iceUfrag=this.getICE().getUfrag(),i.icePwd=this.getICE().getPwd()),["audio","video"].includes(n.getType().toLowerCase())){i.rtcpMux="rtcp-mux",i.rtcpRsize="rtcp-rsize",this.getDTLS()?(i.protocol="UDP/TLS/RTP/SAVPF",i.fingerprint={type:this.getDTLS().getHash(),hash:this.getDTLS().getFingerprint()},i.setup=_l.toString(this.getDTLS().getSetup())):this.getCrypto()?(i.protocol="RTP/SAVPF",i.crypto=[{id:this.getCrypto().getTag(),suite:this.getCrypto().getSuite(),config:this.getCrypto().getKeyParams()}]):i.protocol="RTP/AVP";for(let e of n.getCodecs().values()){"video"===n.getType().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec().toUpperCase(),rate:9e4}):"opus"===e.getCodec().toLowerCase()||"multiopus"===e.getCodec().toLowerCase()?i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:48e3,encoding:e.getChannels()}):i.rtp.push({payload:e.getType(),codec:e.getCodec(),rate:8e3});for(const t of e.getRTCPFeedbacks())i.rtcpFb.push({payload:e.getType(),type:t.getId(),subtype:t.getParams().join(" ")});e.hasRTX()&&(i.rtp.push({payload:e.getRTX(),codec:"rtx",rate:9e4}),i.fmtp.push({payload:e.getRTX(),config:"apt="+e.getType()}));const t=e.getParams();if(Object.keys(t).length){const r={payload:e.getType(),config:""};for(const e in t)r.config.length&&(r.config+=";"),t.hasOwnProperty(e)?r.config+=e+"="+t[e]:r.config+=e;i.fmtp.push(r)}}const e=[];for(let t=0;t<i.rtp.length;++t)e.push(i.rtp[t].payload);i.payloads=e.join(" ");for(let[e,t]of n.getExtensions().entries())i.ext.push({value:e,uri:t});for(let e of n.getRIDs().values()){let t={id:e.getId(),direction:md.toString(e.getDirection()),params:""};e.getFormats().length&&(t.params="pt="+e.getFormats().join(","));for(let[r,n]of e.getParams().entries())t.params+=(t.params.length?";":"")+r+"="+n;i.rids.push(t)}const t=n.getSimulcast();if(t){let e=1;i.simulcast={};const r=t.getSimulcastStreams(md.SEND),n=t.getSimulcastStreams(md.RECV);if(r&&r.length){let t="";for(let e=0;e<r.length;++e){let n="";for(let t=0;t<r[e].length;++t)n+=(n.length?",":"")+(r[e][t].isPaused()?"~":"")+r[e][t].getId();t+=(t.length?";":"")+n}i.simulcast["dir"+e]="send",i.simulcast["list"+e]=t,e++}if(n&&n.length){let t=[];for(let e=0;e<n.length;++e){let r="";for(let t=0;t<n[e].length;++t)r+=(r.length?",":"")+(n[e][t].isPaused()?"~":"")+n[e][t].getId();t+=(t.length?";":"")+r}i.simulcast["dir"+e]="recv",i.simulcast["list"+e]=t,e++}}}else if(n.hasDataChannel()){i.protocol="UDP/DTLS/SCTP",i.payloads="webrtc-datachannel";const e=n.getDataChannel();i.sctpPort=e.getPort(),i.maxMessageSize=e.getMaxMessageSize()}e.media.push(i)}for(let t of this.streams.values())for(let r of t.getTracks().values())for(let n in e.media){let i=e.media[n];if(r.getMediaId()){if(r.getMediaId()==i.mid){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});i.msid=t.getId()+" "+r.getId();break}}else if(i.type.toLowerCase()===r.getMedia().toLowerCase()){let e=r.getSourceGroups();for(let t in e){let r=e[t];i.ssrcGroups.push({semantics:r.getSemantics(),ssrcs:r.getSSRCs().join(" ")})}let n=r.getSSRCs();for(let e in n)i.ssrcs.push({id:n[e],attribute:"cname",value:t.getId()}),i.ssrcs.push({id:n[e],attribute:"msid",value:t.getId()+" "+r.getId()});break}}return t.mids=t.mids.join(" "),e.groups.push(t),Ol.write(e)}toIceFragmentString(){let e={version:0,media:[],candidates:[]};this.hasICE()&&this.getICE().isLite()&&(e.icelite="ice-lite"),this.getICE()&&(e.iceUfrag=this.getICE().getUfrag(),e.icePwd=this.getICE().getPwd());for(const t of this.getCandidates())e.candidates.push({foundation:t.getFoundation(),component:t.getComponentId(),transport:t.getTransport(),priority:t.getPriority(),ip:t.getAddress(),port:t.getPort(),type:t.getType(),raddr:t.getRelAddr(),rport:t.getRelPort()});return Ol.write(e).slice(10)}}pd.create=function(e){const t=new pd;e.ice&&(e.ice instanceof fd?t.setICE(e.ice.clone()):t.setICE(fd.expand(e.ice))),e.dtls&&(e.dtls instanceof Bl?t.setDTLS(e.dtls):t.setDTLS(Bl.expand(e.dtls))),e.crypto&&(e.crypto instanceof Ul?t.setCrypto(e.crypto):t.setCrypto(Ul.expand(e.crypto)));for(let r=0;e.candidates&&r<e.candidates.length;++r)e.candidates[r]instanceof Ll?t.addCandidate(e.candidates[r].clone()):t.addCandidate(Ll.expand(e.candidates[r]));let r=96,n=1;for(let i in e.capabilities){const o=xd.create(i,e.capabilities[i]);for(const[e,t]of o.getCodecs())t.getType()>=96&&t.setType(r++),t.getRTX()&&t.setRTX(r++);if(e.capabilities[i].extensions)for(let t of e.capabilities[i].extensions)15===n&&n++,o.addExtension(n++,t);t.addMedia(o)}return t},pd.expand=function(e){const t=new pd(e.version);for(let r=0;e.medias&&r<e.medias.length;++r){const n=xd.expand(e.medias[r]);n&&t.addMedia(n)}for(let r=0;e.streams&&r<e.streams.length;++r){const n=kd.expand(e.streams[r]);n&&t.addStream(n)}for(let r=0;e.candidates&&r<e.candidates.length;++r){const n=Ll.expand(e.candidates[r]);n&&t.addCandidate(n)}return e.ice&&t.setICE(fd.expand(e.ice)),e.dtls&&t.setDTLS(Bl.expand(e.dtls)),e.crypto&&t.setCrypto(Bl.expand(e.crypto)),e.extmapAllowMixedNotSupported&&(this.extmapAllowMixed=!e.extmapAllowMixedNotSupported),t},pd.process=function(e){return pd.parse(e)},pd.parse=function(e){const t=Ol.parse(e),r=new pd;if(r.setVersion(t.version),t.iceUfrag&&t.icePwd){const e=String(t.iceUfrag),n=String(t.icePwd),i=new fd(e,n);i.setLite("ice-lite"==t.icelite),i.setEndOfCandidates("end-of-candidates"==t.endOfCandidates),r.setICE(i)}for(let e in t.media){const n=t.media[e],i=n.type,o=n.mid?n.mid.toString():e,s=new xd(o,i);if(n.iceUfrag&&n.icePwd){const e=String(n.iceUfrag),i=String(n.icePwd),o=new fd(e,i);o.setLite("ice-lite"==t.icelite),o.setEndOfCandidates("end-of-candidates"==n.endOfCandidates),r.setICE(o)}for(let e=0;n.candidates&&e<n.candidates.length;++e){const t=n.candidates[e],i=new Ll(t.foundation,t.component,t.transport,t.priority,t.ip,t.port,t.type,t.raddr,t.rport);r.addCandidate(i)}const a=n.fingerprint||t.fingerprint;if(a){const e=a.type,t=a.hash;let i=_l.ACTPASS;n.setup&&(i=_l.byValue(n.setup)),r.setDTLS(new Bl(i,e,t))}if(n.crypto){const e=n.crypto[0];r.setCrypto(new Ul(e.id,e.suite,e.config,e.sessionConfig))}let c=bd.SENDRECV;n.direction&&(c=bd.byValue(n.direction),s.setDirection(c)),n.control&&s.setControl(n.control),r.setExtmapAllowMixed("extmap-allow-mixed"==n.extmapAllowMixed||"extmap-allow-mixed"==t.extmapAllowMixed);const u=new Map;for(let e in n.rtp){const t=n.rtp[e],r=t.payload,i=t.codec;if("RED"===i.toUpperCase()||"ULPFEC"===i.toUpperCase())continue;let o={};for(let e in n.fmtp){const t=n.fmtp[e];if(t.payload===r){const e=t.config.split(";");for(let t in e){const r=e[t].split("="),n=r[0].trim(),i=r.splice(1).join("=").trim();o[n]=i}}}if("RTX"===i.toUpperCase())u.set(parseInt(o.apt),r);else{const e=new Ml(i,r,o);t.encoding>1&&e.setChannels(t.encoding),s.addCodec(e)}}for(let e of u.entries()){const t=s.getCodecForType(e[0]);t&&t.setRTX(e[1])}for(let e=0;n.rtcpFb&&e<n.rtcpFb.length;++e){const t=s.getCodecForType(n.rtcpFb[e].payload);if(t){const r=n.rtcpFb[e].type,i=n.rtcpFb[e].subtype?n.rtcpFb[e].subtype.split(" "):null;t.addRTCPFeedback(new Dl(r,i))}}const l=n.ext;for(let e in l){const t=l[e];s.addExtension(t.value,t.uri)}const d=n.rids;for(let e in d){const t=d[e],r=new gd(t.id,md.byValue(t.direction));let n=[];const i=new Map;if(t.params){const e=Ol.parseParams(t.params);for(let t in e)"pt"===t?n=e[t].split(","):i.set(t,e[t]);r.setFormats(n),r.setParams(i)}s.addRID(r)}const f=[];if(n.simulcast){const e=new yd;if(n.simulcast.dir1){const t=md.byValue(n.simulcast.dir1),r=Ol.parseSimulcastStreamList(n.simulcast.list1);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new vd(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}if(n.simulcast.dir2){const t=md.byValue(n.simulcast.dir2),r=Ol.parseSimulcastStreamList(n.simulcast.list2);for(let n=0;n<r.length;++n){const i=[];for(let e=0;e<r[n].length;++e)i.push(new vd(r[n][e].scid,r[n][e].paused));e.addSimulcastAlternativeStreams(t,i)}}for(let t of e.getSimulcastStreams(md.SEND)){const e=[];for(let r=0;r<t.length;r++){const n=new Id(t[r].getId(),t[r].isPaused()),i=s.getRID(n.getId());if(i){const t=i.getFormats();for(let e=0;t&&e<t.length;++e){const r=s.getCodecForType(t[e]);r&&n.addCodec(r)}n.setParams(i.getParams()),e.push(n)}}e.length&&f.push(e)}s.setSimulcast(e)}const p=new Map;if(n.ssrcs)for(let e in n.ssrcs){let t=n.ssrcs[e],s=t.id,a=t.attribute,c=t.value,u=p.get(s);if(u||(u=new Td(s),p.set(u.getSSRC(),u)),"cname"===a.toLowerCase())u.setCName(c);else if("msid"===a.toLowerCase()){let e=c.split(" "),t=e[0],n=e[1];u.setStreamId(t),u.setTrackId(n);let a=r.getStream(t);a||(a=new kd(t),r.addStream(a));let l=a.getTrack(n);l||(l=new Pd(i,n),l.setMediaId(o),l.setEncodings(f),a.addTrack(l)),l.addSSRC(s)}}if(n.msid){let e=n.msid.split(" "),t=e[0],s=e[1],a=r.getStream(t);a||(a=new kd(t),r.addStream(a));let c=a.getTrack(s);c||(c=new Pd(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c));for(let[e,r]of p.entries())r.getStreamId()||(r.setStreamId(t),r.setTrackId(s),c.addSSRC(e))}for(let[e,t]of p.entries())if(!t.getStreamId()){let n=t.getCName(),s=o;t.setStreamId(n),t.setTrackId(s);let a=r.getStream(n);a||(a=new kd(n),r.addStream(a));let c=a.getTrack(s);c||(c=new Pd(i,s),c.setMediaId(o),c.setEncodings(f),a.addTrack(c)),c.addSSRC(e)}if(n.ssrcGroups)for(let e in n.ssrcGroups){let t=n.ssrcGroups[e],i=t.ssrcs.split(" "),o=new Ed(t.semantics,i),s=p.get(parseInt(i[0]));s&&r.getStream(s.getStreamId()).getTrack(s.getTrackId()).addSourceGroup(o)}if("application"==n.type&&"webrtc-datachannel"==n.payloads){const e=new Cd(n.sctpPort,n.maxMessageSize);s.setDataChannel(e)}r.addMedia(s)}return r};var Ad,Od,Ld={SDPInfo:pd,CandidateInfo:Ll,CodecInfo:Ml,DTLSInfo:Bl,CryptoInfo:Ul,ICEInfo:fd,MediaInfo:xd,Setup:_l,SourceGroupInfo:Ed,SourceInfo:Td,StreamInfo:kd,TrackInfo:Pd,RTCPFeedbackInfo:Dl,TrackEncodingInfo:Id,Direction:bd},Md=(Ad=!1,(Od=/[ac]/).exec=function(){return Ad=!0,/./.exec.apply(this,arguments)},!0===Od.test("abc")&&Ad),Nd=/./.test;xr({target:"RegExp",proto:!0,forced:!Md},{test:function(e){var t=gt(this),r=is(e),n=t.exec;if(!ye(n))return J(Nd,t,r);var i=J(n,t,r);return null!==i&&(gt(i),!0)}});var jd=V((function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="model",u="name",l="type",d="vendor",f="version",p="architecture",h="console",m="mobile",g="tablet",v="smarttv",y="wearable",w="embedded",E="Amazon",T="Apple",I="ASUS",R="BlackBerry",P="Browser",k="Chrome",A="Firefox",O="Google",L="Huawei",D="LG",M="Microsoft",N="Motorola",j="Opera",_="Samsung",B="Sharp",U="Sony",V="Xiaomi",F="Zebra",z="Facebook",$=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},G=function(e,t){return typeof e===a&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},q=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,350)},H=function(e,t){for(var r,o,a,c,u,l,d=0;d<t.length&&!u;){var f=t[d],p=t[d+1];for(r=o=0;r<f.length&&!u;)if(u=f[r++].exec(e))for(a=0;a<p.length;a++)l=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):n:this[c[0]]=l?c[1].call(this,l,c[2]):n:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):n):this[c]=l||n;d+=2}},X=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(G(t[r][i],e))return"?"===r?n:r}else if(G(t[r],e))return"?"===r?n:r;return e},Y={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,j+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[u,j]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+P]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+P],f],[/\bfocus\/([\w\.]+)/i],[f,[u,A+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+P]],[/fxios\/([-\w\.]+)/i],[f,[u,A]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+P]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+P],f],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,z],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,k+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+P]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,X,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,A+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,f]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,W]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",W]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,W]]],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],[c,[d,_],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[d,_],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[d,T],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[d,T],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[d,L],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[d,L],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[d,V],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[d,V],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[d,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[d,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[d,"Realme"],[l,m]],[/\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],[c,[d,N],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[d,N],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[d,D],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[d,D],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[d,"Nokia"],[l,m]],[/(pixel c)\b/i],[c,[d,O],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[d,O],[l,m]],[/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],[c,[d,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[d,U],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[d,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[d,E],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[d,E],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[d,R],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[d,I],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[d,I],[l,m]],[/(nexus 9)/i],[c,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[c,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[d,"Meizu"],[l,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[d,B],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,c,[l,m]],[/(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],[d,c,[l,g]],[/(surface duo)/i],[c,[d,M],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[d,"Fairphone"],[l,m]],[/(u304aa)/i],[c,[d,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[c,[d,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[c,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[c,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[c,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[c,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[c,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[c,[d,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[c,[d,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[c,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[c,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],c,[l,g]],[/\b(ns-?\w{0,9}) b/i],[c,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],c,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],c,[l,m]],[/\b(ph-1) /i],[c,[d,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[c,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[c,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[c,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,c,[l,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[d,M],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[d,F],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[d,F],[l,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,c,[l,h]],[/droid.+; (shield) bui/i],[c,[d,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[c,[d,U],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[d,M],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[d,_],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,D],[l,v]],[/(apple) ?tv/i],[d,[c,T+" TV"],[l,v]],[/crkey/i],[[c,k+"cast"],[d,O],[l,v]],[/droid.+aft(\w)( bui|\))/i],[c,[d,E],[l,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[d,B],[l,v]],[/(bravia[\w ]+)( bui|\))/i],[c,[d,U],[l,v]],[/(mitv-\w{5}) bui/i],[c,[d,V],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,q],[c,q],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[d,c,[l,y]],[/droid.+; (glass) \d/i],[c,[d,O],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[d,F],[l,y]],[/(quest( 2)?)/i],[c,[d,z],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[f,X,Y]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[f,X,Y]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,A+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[u,k+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,f]]},K=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof K))return new K(e,t).getResult();var i=e||(typeof r!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),h=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.browser),e.major=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e[p]=n,H.call(e,i,h.cpu),e},this.getDevice=function(){var e={};return e[d]=n,e[c]=n,e[l]=n,H.call(e,i,h.device),e},this.getEngine=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.engine),e},this.getOS=function(){var e={};return e[u]=n,e[f]=n,H.call(e,i,h.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return i},this.setUA=function(e){return i=typeof e===a&&e.length>350?q(e,350):e,this},this.setUA(i),this};K.VERSION="0.7.32",K.BROWSER=$([u,f,"major"]),K.CPU=$([p]),K.DEVICE=$([c,d,l,h,m,v,g,y,w]),K.ENGINE=K.OS=$([u,f]),e.exports&&(t=e.exports=K),t.UAParser=K;var Z=typeof r!==o&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var Q=new K;Z.ua=Q.getResult(),Z.ua.get=function(){return Q.getUA()},Z.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)Z.ua[r]=t[r]}}}("object"==typeof window?window:U)}));const _d=["iOS"];class Sd extends jd{constructor(){super(window.navigator.userAgent)}isChrome(){const e=this.getBrowser();if(!e.name)return!1;const t=this.getOS();let r=!0;return r=!new RegExp(_d.join("|"),"i").test(t.name),e.name.match(/Chrome/i)&&r}isFirefox(){const e=this.getBrowser();return!!e.name&&e.name.match(/Firefox/i)}isOpera(){const e=this.getBrowser();return!!e.name&&e.name.match(/Opera/i)}isSafari(){const e=this.getBrowser();return!!e.name&&e.name.match(/Safari/i)}}const Bd=Bn.get("SdpParser"),Ud=Array.from({length:31},(e,t)=>t+35),Vd=Array.from({length:32},(e,t)=>t+96),Fd=Array.from({length:14},(e,t)=>t+1),$d=Array.from({length:240},(e,t)=>t+16);class Rd{static setSimulcast(e,t){if(Bd.info("Setting simulcast. Codec: ",t),!(new Sd).isChrome())return Bd.warn("Simulcast is only available in Google Chrome browser"),e;if("h264"!==t&&"vp8"!==t)return Bd.warn("Simulcast is only available in h264 and vp8 codecs"),e;try{const t=/m=video[\s\S]*?a=ssrc:(\d*) msid:([\s\S]+?)\r\n/,r=/m=video[\s\S]*?a=ssrc:(\d*) cname:([\s\S]+?)\r\n/.exec(e),n=r[1],i=r[2],o=t.exec(e)[2],s=2,a=[n];for(let t=0;t<s;++t){const r=100+2*t,n=r+1;a.push(r),e+="a=ssrc-group:FID "+r+" "+n+"\r\na=ssrc:"+r+" cname:"+i+"\r\na=ssrc:"+r+" msid:"+o+"\r\na=ssrc:"+n+" cname:"+i+"\r\na=ssrc:"+n+" msid:"+o+"\r\n"}return e+="a=ssrc-group:SIM "+a.join(" ")+"\r\n",Bd.info("Simulcast setted"),Bd.debug("Simulcast SDP: ",e),e}catch(e){throw Bd.error("Error setting SDP for simulcast: ",e),e}}static setStereo(e){return Bd.info("Replacing SDP response for support stereo"),e=e.replace(/useinbandfec=1/g,"useinbandfec=1; stereo=1"),Bd.info("Replaced SDP response for support stereo"),Bd.debug("New SDP value: ",e),e}static setDTX(e){return Bd.info("Replacing SDP response for support dtx"),e=e.replace("useinbandfec=1","useinbandfec=1; usedtx=1"),Bd.info("Replaced SDP response for support dtx"),Bd.debug("New SDP value: ",e),e}static setAbsoluteCaptureTime(e){const t="a=extmap:"+Rd.getAvailableHeaderExtensionIdRange(e)[0]+" http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),Bd.info("Replaced SDP response for setting absolute capture time"),Bd.debug("New SDP value: ",e),e}static setDependencyDescriptor(e){const t="a=extmap:"+Rd.getAvailableHeaderExtensionIdRange(e)[0]+" https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension\r\n";return e=e.replace(/(m=.*\r\n(?:.*\r\n)*?)(a=extmap.*\r\n)/gm,(e,r,n)=>r+t+n),Bd.info("Replaced SDP response for setting depency descriptor"),Bd.debug("New SDP value: ",e),e}static setVideoBitrate(e,t){if(t<1)Bd.info("Remove bitrate restrictions"),e=e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"");else{const r=Ld.SDPInfo.parse(e),n=r.getMedia("video");Bd.info("Setting video bitrate"),n.setBitrate(t),e=r.toString()}return e}static removeSdpLine(e,t){return Bd.debug("SDP before trimming: ",e),e=e.split("\n").filter(e=>e.trim()!==t).join("\n"),Bd.debug("SDP trimmed result: ",e),e}static adaptCodecName(e,t,r){if(!e)return e;const n=new RegExp("".concat(t),"i");return e.replace(n,r)}static setMultiopus(e,t){if(!(new Sd).isFirefox()&&(!t||Gd(t)))if(e.includes("multiopus/48000/6"))Bd.info("Multiopus already setted");else{Bd.info("Setting multiopus");const t=/m=audio 9 UDP\/TLS\/RTP\/SAVPF (.*)\r\n/.exec(e)[0],r=Rd.getAvailablePayloadTypeRange(e)[0],n=t.replace("\r\n"," ")+r+"\r\na=rtpmap:"+r+" multiopus/48000/6\r\na=fmtp:"+r+" channel_mapping=0,4,1,2,3,5;coupled_streams=2;minptime=10;num_streams=4;useinbandfec=1\r\n";e=e.replace(t,n),Bd.info("Multiopus offer created"),Bd.debug("SDP parsed for multioups: ",e)}return e}static getAvailablePayloadTypeRange(e){const t=e.matchAll(/m=(?:.*) (?:.*) UDP\/TLS\/RTP\/SAVPF (.*)\r\n/gm);let r=Vd.concat(Ud);var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static getAvailableHeaderExtensionIdRange(e){const t=e.matchAll(/a=extmap:(\d+)(?:.*)\r\n/gm);let r=Fd.concat($d);var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value[1].split(" ").map(e=>parseInt(e));r=r.filter(t=>!e.includes(t))}}catch(e){i.e(e)}finally{i.f()}return r}static renegotiate(e,t){const r=Ld.SDPInfo.parse(e),n=Ld.SDPInfo.parse(t);var i,o=B(r.getMedias());try{for(o.s();!(i=o.n()).done;){const t=i.value;let r=n.getMediaById(t.getId());if(!r){r=new Ld.MediaInfo(t.getId(),t.getType()),r.setDirection(Ld.Direction.reverse(t.getDirection()));const i=n.getMedia(t.getType());if(i){r.setCodecs(i.getCodecs());var s,a=B(i.getExtensions());try{for(a.s();!(s=a.n()).done;){const e=N(s.value,2),t=e[0],n=e[1];r.addExtension(t,n)}}catch(e){a.e(e)}finally{a.f()}}n.addMedia(r)}}}catch(e){o.e(e)}finally{o.f()}return n.toString()}static updateMissingVideoExtensions(e,t){var r;const n=Ld.SDPInfo.parse(e),i=null===(r=Ld.SDPInfo.parse(t).getMediasByType("video")[0])||void 0===r?void 0:r.getExtensions();if(i||i.length){var o,s=B(n.getMediasByType("video"));try{for(s.s();!(o=s.n()).done;){const t=o.value,r=t.getExtensions();i.forEach((n,i)=>{if(!r.get(i)){const r=t.getId(),o="a=extmap:"+i+" "+n+"\r\n",s=new RegExp("(a=mid:"+r+"\r\n(?:.*\r\n)*?)","g");e=e.replace(s,(e,t,r)=>t+o)}})}}catch(e){s.e(e)}finally{s.f()}return e}}}const Gd=e=>e.getAudioTracks().some(e=>e.getSettings().channelCount>2);var Wd=ir.indexOf,qd=nn([].indexOf),Xd=!!qd&&1/qd([1],1,-0)<0,Yd=function(e,t){var r=[].indexOf;return!!r&&q((function(){r.call(null,(function(){return 1}),1)}))}();xr({target:"Array",proto:!0,forced:Xd||!Yd},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Xd?qd(this,e,t)||0:Wd(this,e,t)}});class Dd extends cu{constructor(e,t){super(),this.namespace=e,this.tm=t}cmd(e,t){return this.tm.cmd(e,t,this.namespace)}event(e,t){return this.tm.event(e,t,this.namespace)}close(){return this.tm.namespaces.delete(this.namespace)}}var Jd=class extends cu{constructor(e){super(),this.maxId=0,this.namespaces=new Map,this.transactions=new Map,this.transport=e,this.listener=t=>{let r;try{r=JSON.parse(t.utf8Data||t.data||t)}catch(e){return}switch(r.type){case"cmd":const t={name:r.name,data:r.data,namespace:r.namespace,accept:t=>{e.send(JSON.stringify({type:"response",transId:r.transId,data:t}))},reject:t=>{e.send(JSON.stringify({type:"error",transId:r.transId,data:t}))}};if(t.namespace){const e=this.namespaces.get(t.namespace);e?e.emit("cmd",t):this.emit("cmd",t)}else this.emit("cmd",t);break;case"response":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.resolve(r.data);break}case"error":{const e=this.transactions.get(r.transId);if(!e)return;this.transactions.delete(r.transId),e.reject(r.data);break}case"event":const i={name:r.name,data:r.data,namespace:r.namespace};if(i.namespace){var n=this.namespaces.get(i.namespace);n?n.emit("event",i):this.emit("event",i)}else this.emit("event",i)}},this.transport.addListener?this.transport.addListener("message",this.listener):this.transport.addEventListener("message",this.listener)}cmd(e,t,r){return new Promise((n,i)=>{if(!e||0===e.length)throw new Error("Bad command name");const o={type:"cmd",transId:this.maxId++,name:e,data:t};r&&(o.namespace=r);const s=JSON.stringify(o);o.resolve=n,o.reject=i,this.transactions.set(o.transId,o);try{this.transport.send(s)}catch(e){throw this.transactions.delete(o.transId),e}})}event(e,t,r){if(!e||0===e.length)throw new Error("Bad event name");const n={type:"event",name:e,data:t};r&&(n.namespace=r);const i=JSON.stringify(n);this.transport.send(i)}namespace(e){let t=this.namespaces.get(e);return t||(t=new Dd(e,this),this.namespaces.set(e,t),t)}close(){for(const e of this.namespaces.values())e.close();this.transport.removeListener?this.transport.removeListener("message",this.listener):this.transport.removeEventListener("message",this.listener)}};const Kd=Bn.get("Signaling"),Zd="wsConnectionSuccess",Qd="wsConnectionError",ef="broadcastEvent",tf={VP8:"vp8",VP9:"vp9",H264:"h264",AV1:"av1"},rf={OPUS:"opus",MULTIOPUS:"multiopus"};class zd extends cu{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{streamName:null,url:"ws://localhost:8080/"};super(),this.streamName=e.streamName,this.wsUrl=e.url,this.webSocket=null,this.transactionManager=null,this.serverId=null,this.clusterId=null,(new Sd).isSafari()&&(tf.H265="h265")}connect(){var e=this;return D((function*(){var t;return Kd.info("Connecting to Signaling Server"),e.transactionManager&&(null===(t=e.webSocket)||void 0===t?void 0:t.readyState)===WebSocket.OPEN?(Kd.info("Connected to server: ",e.webSocket.url),Kd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Zd,{ws:e.webSocket,tm:e.transactionManager}),e.webSocket):new Promise((t,r)=>{e.webSocket=new WebSocket(e.wsUrl),e.transactionManager=new Jd(e.webSocket),e.webSocket.onopen=()=>{Kd.info("WebSocket opened"),e.transactionManager.on("event",t=>{e.emit(ef,t)}),Kd.info("Connected to server: ",e.webSocket.url),Kd.debug("WebSocket value: ",{url:e.webSocket.url,protocol:e.webSocket.protocol,readyState:e.webSocket.readyState,binaryType:e.webSocket.binaryType,extensions:e.webSocket.extensions}),e.emit(Zd,{ws:e.webSocket,tm:e.transactionManager}),t(e.webSocket)},e.webSocket.onerror=()=>{Kd.error("WebSocket not connected: ",e.webSocket.url),e.emit(Qd,e.webSocket.url),r(e.webSocket.url)},e.webSocket.onclose=()=>{e.webSocket=null,e.transactionManager=null,Kd.info("Connection closed with Signaling Server."),e.emit("wsConnectionClose")}})}))()}close(){var e;Kd.info("Closing connection with Signaling Server."),null===(e=this.webSocket)||void 0===e||e.close()}subscribe(e,t){var r=arguments,n=this;return D((function*(){let i=r.length>2&&void 0!==r[2]?r[2]:null,o=r.length>3&&void 0!==r[3]?r[3]:null;Kd.info("Starting subscription to streamName: ",n.streamName),Kd.debug("Subcription local description: ",e);const s=nf(t,i,o),a={sdp:e=Rd.adaptCodecName(e,"AV1X",tf.AV1),streamId:n.streamName,pinnedSourceId:s.pinnedSourceId,excludedSourceIds:s.excludedSourceIds};s.vad&&(a.vad=!0),Array.isArray(s.events)&&(a.events=s.events),s.forcePlayoutDelay&&(a.forcePlayoutDelay=s.forcePlayoutDelay);try{var c,u,l,d,f;yield n.connect(),Kd.info("Sending view command");const e=yield n.transactionManager.cmd("view",a),t=null===(c=(u=RTCRtpReceiver).getCapabilities)||void 0===c||null===(l=c.call(u,"video"))||void 0===l||null===(d=l.codecs)||void 0===d||null===(f=d.find)||void 0===f?void 0:f.call(d,e=>"video/AV1X"===e.mimeType);return e.sdp=t?Rd.adaptCodecName(e.sdp,tf.AV1,"AV1X"):e.sdp,Kd.info("Command sent, subscriberId: ",e.subscriberId),Kd.debug("Command result: ",e),n.serverId=e.subscriberId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Kd.error("Error sending view command, error: ",e),e}}))()}publish(e,t){var r=arguments,n=this;return D((function*(){const i=of(t,r.length>2&&void 0!==r[2]?r[2]:null,r.length>3&&void 0!==r[3]?r[3]:null);Kd.info("Starting publishing to streamName: ".concat(n.streamName,", codec: ").concat(i.codec)),Kd.debug("Publishing local description: ",e);const o=Object.values(tf);if(-1===o.indexOf(i.codec))throw Kd.error("Invalid codec. Possible values are: ",o),new Error("Invalid codec. Possible values are: ".concat(o));i.codec===tf.AV1&&(e=Rd.adaptCodecName(e,"AV1X",tf.AV1));const s={name:n.streamName,sdp:e,codec:i.codec,sourceId:i.sourceId};null!==i.record&&(s.record=i.record),Array.isArray(i.events)&&(s.events=i.events);try{yield n.connect(),Kd.info("Sending publish command");const e=yield n.transactionManager.cmd("publish",s);if(i.codec===tf.AV1){var a,c,u,l,d;const t=null===(a=(c=RTCRtpSender).getCapabilities)||void 0===a||null===(u=a.call(c,"video"))||void 0===u||null===(l=u.codecs)||void 0===l||null===(d=l.find)||void 0===d?void 0:d.call(l,e=>"video/AV1X"===e.mimeType);e.sdp=t?Rd.adaptCodecName(e.sdp,tf.AV1,"AV1X"):e.sdp}return Kd.info("Command sent, publisherId: ",e.publisherId),Kd.debug("Command result: ",e),n.serverId=e.publisherId,n.clusterId=e.clusterId,e.sdp}catch(e){throw Kd.error("Error sending publish command, error: ",e),e}}))()}cmd(e,t){var r=this;return D((function*(){return Kd.info("Sending cmd: ".concat(e)),r.transactionManager.cmd(e,t)}))()}}const nf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={vad:e,pinnedSourceId:t,excludedSourceIds:r}),n},of=(e,t,r)=>{let n="object"==typeof e?e:{};if(0===Object.keys(n).length){const i=tf.H264;n={codec:null!=e?e:i,record:t,sourceId:r}}return n},sf=Bn.get("PeerConnection"),cf={track:"track",connectionStateChange:"connectionStateChange"},uf={stereo:!1,mediaStream:null,codec:"h264",simulcast:!1,scalabilityMode:null,disableAudio:!1,disableVideo:!1,setSDPToPeer:!0};class Hd extends cu{constructor(){super(),this.sessionDescription=null,this.peer=null,this.peerConnectionStats=null}createRTCPeer(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:null;sf.info("Creating new RTCPeerConnection"),sf.debug("RTC configuration provided by user: ",r),t.peer=ff(t,r)}))()}getRTCPeer(){return sf.info("Getting RTC Peer"),this.peer}closeRTCPeer(){var e=this;return D((function*(){var t;sf.info("Closing RTCPeerConnection"),null===(t=e.peer)||void 0===t||t.close(),e.peer=null,e.stopStats(),e.emit(cf.connectionStateChange,"closed")}))()}setRTCRemoteSDP(e){var t=this;return D((function*(){sf.info("Setting RTC Remote SDP");const r={type:"answer",sdp:e};try{yield t.peer.setRemoteDescription(r),sf.info("RTC Remote SDP was set successfully."),sf.debug("RTC Remote SDP new value: ",e)}catch(e){throw sf.error("Error while setting RTC Remote SDP: ",e),e}}))()}getRTCLocalSDP(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:uf;sf.info("Getting RTC Local SDP"),r=O(O({},uf),r),sf.debug("Options: ",r);const n=df(r.mediaStream);n?hf(t.peer,n,r):mf(t.peer,r),sf.info("Creating peer offer");const i=yield t.peer.createOffer();return sf.info("Peer offer created"),sf.debug("Peer offer response: ",i.sdp),t.sessionDescription=i,r.disableAudio||(r.stereo&&(t.sessionDescription.sdp=Rd.setStereo(t.sessionDescription.sdp)),r.dtx&&(t.sessionDescription.sdp=Rd.setDTX(t.sessionDescription.sdp)),t.sessionDescription.sdp=Rd.setMultiopus(t.sessionDescription.sdp,n)),!r.disableVideo&&r.simulcast&&(t.sessionDescription.sdp=Rd.setSimulcast(t.sessionDescription.sdp,r.codec)),r.absCaptureTime&&(t.sessionDescription.sdp=Rd.setAbsoluteCaptureTime(t.sessionDescription.sdp)),r.dependencyDescriptor&&(t.sessionDescription.sdp=Rd.setDependencyDescriptor(t.sessionDescription.sdp)),r.setSDPToPeer&&(yield t.peer.setLocalDescription(t.sessionDescription),sf.info("Peer local description set")),t.sessionDescription.sdp}))()}addRemoteTrack(e,t){var r=this;return D((function*(){const n=yield new Promise((n,i)=>{try{const i=r.peer.addTransceiver(e,{direction:"recvonly"});i.resolve=n,i.streams=t}catch(e){i(e)}});var i,o=B(t);try{for(o.s();!(i=o.n()).done;)i.value.addTrack(n.receiver.track)}catch(e){o.e(e)}finally{o.f()}return n}))()}updateBandwidthRestriction(e,t){return sf.info("Updating bandwidth restriction, bitrate value: ",t),sf.debug("SDP value: ",e),Rd.setVideoBitrate(e,t)}updateBitrate(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:0;if(!t.peer)throw sf.error("Cannot update bitrate. No peer found."),new Error("Cannot update bitrate. No peer found.");sf.info("Updating bitrate to value: ",r),t.sessionDescription=yield t.peer.createOffer(),yield t.peer.setLocalDescription(t.sessionDescription);const n=t.updateBandwidthRestriction(t.peer.remoteDescription.sdp,r);yield t.setRTCRemoteSDP(n),sf.info("Bitrate restirctions updated: ","".concat(r>0?r:"unlimited"," kbps"))}))()}getRTCPeerStatus(){if(sf.info("Getting RTC peer status"),!this.peer)return null;const e=gf(this.peer);return sf.info("RTC peer status getted, value: ",e),e}replaceTrack(e){if(!this.peer)return void sf.error("Could not change track if there is not an active connection.");const t=this.peer.getSenders().find(t=>t.track.kind===e.kind);t?t.replaceTrack(e):sf.error("There is no ".concat(e.kind," track in active broadcast."))}static getCapabilities(e){const t=new Sd;if(t.isFirefox())return(e=>"video"===e?{codecs:[{codec:"vp8",mimeType:"video/VP8"},{codec:"vp9",mimeType:"video/VP9"},{codec:"h264",mimeType:"video/H264"}],headerExtensions:[]}:"audio"===e?{codecs:[{codec:"opus",mimeType:"audio/opus",channels:2}],headerExtensions:[]}:null)(e);const r=RTCRtpSender.getCapabilities(e);if(r){const o={};let s=new RegExp("^video/(".concat(Object.values(tf).join("|"),")x?$"),"i");"audio"===e&&(s=new RegExp("^audio/(".concat(Object.values(rf).join("|"),")$"),"i"),t.isChrome()&&(o.multiopus={mimeType:"audio/multiopus",channels:6}));var n,i=B(r.codecs);try{for(i.s();!(n=i.n()).done;){const e=n.value,t=e.mimeType.match(s);if(t){const r=t[1].toLowerCase();if(o[r]=O(O({},o[r]),{},{mimeType:e.mimeType}),e.scalabilityModes){let t=o[r].scalabilityModes||[];t=[...t,...e.scalabilityModes],o[r].scalabilityModes=[...new Set(t)]}e.channels&&(o[r].channels=e.channels)}}}catch(e){i.e(e)}finally{i.f()}r.codecs=Object.keys(o).map(e=>O({codec:e},o[e]))}return r}getTracks(){var e,t;return null===(e=this.peer)||void 0===e||null===(t=e.getSenders())||void 0===t?void 0:t.map(e=>e.track)}initStats(){this.peerConnectionStats?sf.warn("Cannot init peer stats: Already initialized"):this.peer?(this.peerConnectionStats=new iu(this.peer),this.peerConnectionStats.init(),wu(this.peerConnectionStats,this,["stats"])):sf.warn("Cannot init peer stats: RTCPeerConnection not initialized")}stopStats(){var e;null===(e=this.peerConnectionStats)||void 0===e||e.stop(),this.peerConnectionStats=null}}const lf=e=>(null==e?void 0:e.getAudioTracks().length)<=1&&(null==e?void 0:e.getVideoTracks().length)<=1,df=e=>{if(!e)return null;if(e instanceof MediaStream&&lf(e))return e;if(!(e instanceof MediaStream)){sf.info("Creating MediaStream to add received tracks.");const n=new MediaStream;var t,r=B(e);try{for(r.s();!(t=r.n()).done;){const e=t.value;n.addTrack(e)}}catch(e){r.e(e)}finally{r.f()}if(lf(n))return n}throw sf.error("MediaStream must have 1 audio track and 1 video track, or at least one of them."),new Error("MediaStream must have 1 audio track and 1 video track, or at least one of them.")},ff=(e,t)=>{const r=new RTCPeerConnection(t);return pf(e,r),r},pf=(e,t)=>{var r;t.ontrack=t=>{var r;if(sf.info("New track from peer."),sf.debug("Track event value: ",t),null!=t&&null!==(r=t.transceiver)&&void 0!==r&&r.resolve){const e=t.transceiver.resolve;delete t.transceiver.resolve,e(t.transceiver)}e.emit(cf.track,t)},t.connectionState?t.onconnectionstatechange=r=>{sf.info("Peer connection state change: ",t.connectionState),e.emit(cf.connectionStateChange,t.connectionState)}:t.oniceconnectionstatechange=r=>{sf.info("Peer ICE connection state change: ",t.iceConnectionState),e.emit(cf.connectionStateChange,t.iceConnectionState)},t.onnegotiationneeded=(r=D((function*(e){if(!t.remoteDescription)return;sf.info("Peer onnegotiationneeded, updating local description");const r=yield t.createOffer();sf.info("Peer onnegotiationneeded, got local offer",r.sdp),r.sdp=Rd.updateMissingVideoExtensions(r.sdp,t.remoteDescription.sdp),yield t.setLocalDescription(r);const n=Rd.renegotiate(r.sdp,t.remoteDescription.sdp);sf.info("Peer onnegotiationneeded, updating remote description",n),yield t.setRemoteDescription({type:"answer",sdp:n}),sf.info("Peer onnegotiationneeded, renegotiation done")})),function(e){return r.apply(this,arguments)})},hf=(e,t,r)=>{sf.info("Adding mediaStream tracks to RTCPeerConnection");var n,i=B(t.getTracks());try{for(i.s();!(n=i.n()).done;){const i=n.value,o={streams:[t]};"audio"===i.kind&&(o.direction=r.disableAudio?"inactive":"sendonly"),"video"===i.kind&&(o.direction=r.disableVideo?"inactive":"sendonly",r.scalabilityMode&&(new Sd).isChrome()?(sf.debug("Video track with scalability mode: ".concat(r.scalabilityMode,".")),o.sendEncodings=[{scalabilityMode:r.scalabilityMode}]):r.scalabilityMode&&sf.warn("SVC is only supported in Google Chrome")),e.addTransceiver(i,o),sf.info("Track '".concat(i.label,"' added: "),"id: ".concat(i.id),"kind: ".concat(i.kind))}}catch(e){i.e(e)}finally{i.f()}},mf=(e,t)=>{const r=new Sd;if(!t.disableVideo){const t=e.addTransceiver("video",{direction:"recvonly"});r.isOpera()&&t.setCodecPreferences(RTCRtpReceiver.getCapabilities("video").codecs.filter(e=>"video/H264"!==e.mimeType||e.sdpFmtpLine.includes("profile-level-id=4")))}t.disableAudio||e.addTransceiver("audio",{direction:"recvonly"});for(let r=0;r<t.multiplexedAudioTracks;r++)e.addTransceiver("audio",{direction:"recvonly"})},gf=e=>{var t;const r=null!==(t=e.connectionState)&&void 0!==t?t:e.iceConnectionState;switch(r){case"checking":return"connecting";case"completed":return"connected";default:return r}},yf=Bn.get("Director");let wf="",bf="https://director.millicast.com";class af{static setEndpoint(e){bf=e.replace(/\/$/,"")}static getEndpoint(){return bf}static setLiveDomain(e){wf=e.replace(/\/$/,"")}static getLiveDomain(){return wf}static getPublisher(e){var t=arguments,r=this;return D((function*(){const n=Sf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:"WebRtc");yf.info("Getting publisher connection path for stream name: ",n.streamName);const i={streamName:n.streamName,streamType:n.streamType},o={"Content-Type":"application/json",Authorization:"Bearer ".concat(n.token)},s="".concat(r.getEndpoint(),"/api/director/publish");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=xf(e),yf.debug("Getting publisher response: ",e),e.data}catch(e){throw yf.error("Error while getting publisher connection path. ",e),e}}))()}static getSubscriber(e){var t=arguments,r=this;return D((function*(){const n=Cf(e,t.length>1&&void 0!==t[1]?t[1]:null,t.length>2&&void 0!==t[2]?t[2]:null);yf.info("Getting subscriber connection data for stream name: ".concat(n.streamName," and account id: ").concat(n.streamAccountId));const i={streamAccountId:n.streamAccountId,streamName:n.streamName};let o={"Content-Type":"application/json"};n.subscriberToken&&(o=O(O({},o),{},{Authorization:"Bearer ".concat(n.subscriberToken)}));const s="".concat(r.getEndpoint(),"/api/director/subscribe");try{let e=yield fetch(s,{method:"POST",headers:o,body:JSON.stringify(i)});if(e=yield e.json(),"fail"===e.status)throw new Error(e.data.message);return e=xf(e),yf.debug("Getting subscriber response: ",e),e.data}catch(e){throw yf.error("Error while getting subscriber connection path. ",e),e}}))()}}const Sf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={token:e,streamName:t,streamType:r}),n},Cf=(e,t,r)=>{let n="object"==typeof e?e:{};return 0===Object.keys(n).length&&(n={streamName:e,streamAccountId:t,subscriberToken:r}),n},xf=e=>{if(af.getLiveDomain()){const t=/\/\/(.*?)\//,r=e.data.urls.map(e=>{const r=t.exec(e);return e.replace(r[1],af.getLiveDomain())});e.data.urls=r}return e};function Tf(e){this.message=e}function If(e){this.message=e}let Rf;Tf.prototype=new Error,Tf.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),If.prototype=new Error,If.prototype.name="InvalidTokenError",V((function(e,t){!function(r){if(null!=t&&"number"!=typeof t.nodeType)e.exports=r();else{var n=r(),i="undefined"!=typeof self?self:$.global;"function"!=typeof i.btoa&&(i.btoa=n.btoa),"function"!=typeof i.atob&&(i.atob=n.atob)}}((function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function t(e){this.message=e}return t.prototype=new Error,t.prototype.name="InvalidCharacterError",{btoa:function(r){for(var n,i,o=String(r),s=0,a=e,c="";o.charAt(0|s)||(a="=",s%1);c+=a.charAt(63&n>>8-s%1*8)){if((i=o.charCodeAt(s+=3/4))>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|i}return c},atob:function(r){var n=String(r).replace(/[=]+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,o,s=0,a=0,c="";o=n.charAt(a++);~o&&(i=s%4?64*i+o:o,s++%4)?c+=String.fromCharCode(255&i>>(-2*s&6)):0)o=e.indexOf(o);return c}}}))}));class vf extends cu{constructor(e,t,r,n){if(super(),Rf=r,!e)throw Rf.error("Stream Name is required to construct this module."),new Error("Stream Name is required to construct this module.");if(!t)throw Rf.error("Token generator is required to construct this module."),new Error("Token generator is required to construct this module.");this.webRTCPeer=new Hd,this.signaling=null,this.streamName=e,this.autoReconnect=n,this.reconnectionInterval=1e3,this.alreadyDisconnected=!1,this.firstReconnection=!0,this.stopReconnection=!1,this.tokenGenerator=t,this.options=null}getRTCPeerConnection(){return this.webRTCPeer?this.webRTCPeer.getRTCPeer():null}stop(){var e;Rf.info("Stopping"),this.webRTCPeer.closeRTCPeer(),null===(e=this.signaling)||void 0===e||e.close(),this.signaling=null,this.stopReconnection=!0,this.webRTCPeer=new Hd}isActive(){const e=this.webRTCPeer.getRTCPeerStatus();return Rf.info("Broadcast status: ",e||"not_established"),"connected"===e}setReconnect(){this.signaling.on("migrate",()=>this.replaceConnection()),this.autoReconnect&&(this.signaling.on(Qd,()=>{!this.firstReconnection&&this.alreadyDisconnected||(this.firstReconnection=!1,this.reconnect({error:new Error("Signaling error: wsConnectionError")}))}),this.webRTCPeer.on(cf.connectionStateChange,e=>{("failed"===e||"disconnected"===e&&this.alreadyDisconnected)&&this.firstReconnection?(this.firstReconnection=!1,this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")})):"disconnected"===e?(this.alreadyDisconnected=!0,setTimeout(()=>this.reconnect({error:new Error("Connection state change: RTCPeerConnectionState disconnected")}),1500)):this.alreadyDisconnected=!1}))}reconnect(e){var t=this;return D((function*(){try{t.isActive()||t.stopReconnection||(t.stop(),t.emit("reconnect",{timeout:Pf(t.reconnectionInterval),error:null!=e&&e.error?null==e?void 0:e.error:new Error("Attempting to reconnect")}),yield t.connect(t.options),t.alreadyDisconnected=!1,t.reconnectionInterval=1e3,t.firstReconnection=!0)}catch(e){t.reconnectionInterval=Pf(t.reconnectionInterval),Rf.error("Reconnection failed, retrying in ".concat(t.reconnectionInterval,"ms. "),e),setTimeout(()=>t.reconnect({error:e}),t.reconnectionInterval)}}))()}}const Pf=e=>e<32e3?2*e:e;Bn.get("Publish"),tf.H264;const kf=Bn.get("View"),Af={disableVideo:!1,disableAudio:!1,peerConfig:{}};class Ef extends vf{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super(e,t,kf,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]),r&&this.on(cf.track,e=>{r.srcObject=e.streams[0]})}connect(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:Af;t.options=O(O(O({},Af),r),{},{setSDPToPeer:!1}),yield t.initConnection({migrate:!1})}))()}select(){var e=arguments,t=this;return D((function*(){let r=e.length>0&&void 0!==e[0]?e[0]:{};kf.debug("Viewer select layer values: ",r),yield t.signaling.cmd("select",{layer:r}),kf.info("Connected to streamName: ",t.streamName)}))()}addRemoteTrack(e,t){var r=this;return D((function*(){return kf.info("Viewer adding remote % track",e),r.webRTCPeer.addRemoteTrack(e,t)}))()}project(e,t){var r=this;return D((function*(){var n,i=B(t);try{for(i.s();!(n=i.n()).done;){const e=n.value;if(!e.trackId&&!e.media)throw kf.error("Error in projection mapping, trackId or mediaId must be set"),new Error("Error in projection mapping, trackId or mediaId must be set");const t=r.webRTCPeer.getRTCPeer();if(e.mediaId&&!t.getTransceivers().find(t=>t.mid===e.mediaId.toString()))throw kf.error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers")),new Error("Error in projection mapping, ".concat(e.mediaId," mid not found in local transceivers"))}}catch(e){i.e(e)}finally{i.f()}kf.debug("Viewer project source: layer mappings: ",e,t),yield r.signaling.cmd("project",{sourceId:e,mapping:t}),kf.info("Projection done")}))()}unproject(e){var t=this;return D((function*(){kf.debug("Viewer unproject mediaIds: ",e),yield t.signaling.cmd("unproject",{mediaIds:e}),kf.info("Unprojection done")}))()}replaceConnection(){var e=this;return D((function*(){kf.info("Migrating current connection"),yield e.initConnection({migrate:!0})}))()}initConnection(e){var t=this;return D((function*(){var r,n;let i,o;if(kf.debug("Viewer connect options values: ",t.options),t.stopReconnection=!1,!e.migrate&&t.isActive())throw kf.warn("Viewer currently subscribed"),new Error("Viewer currently subscribed");try{var s;o=yield t.tokenGenerator(),t.options.peerConfig.iceServers=null===(s=o)||void 0===s?void 0:s.iceServers}catch(e){throw kf.error("Error generating token."),e}if(!o)throw kf.error("Error while subscribing. Subscriber data required"),new Error("Subscriber data required");const a=new zd({streamName:t.streamName,url:"".concat(o.urls[0],"?token=").concat(o.jwt)}),c=e.migrate?new Hd:t.webRTCPeer;yield c.createRTCPeer(t.options.peerConfig),null===(r=t.stopReemitingWebRTCPeerInstanceEvents)||void 0===r||r.call(t),null===(n=t.stopReemitingSignalingInstanceEvents)||void 0===n||n.call(t),t.stopReemitingWebRTCPeerInstanceEvents=wu(c,t,Object.values(cf)),t.stopReemitingSignalingInstanceEvents=wu(a,t,[ef]);const u=c.getRTCLocalSDP(O(O({},t.options),{},{stereo:!0})),l=a.connect();i=yield Promise.all([u,l]);const d=i[0];let f=t.signaling;t.signaling=a;const p=t.signaling.subscribe(d,O(O({},t.options),{},{vad:t.options.multiplexedAudioTracks>0})),h=c.peer.setLocalDescription(c.sessionDescription);i=yield Promise.all([p,h]);const m=i[0];yield c.setRTCRemoteSDP(m),kf.info("Connected to streamName: ",t.streamName);let g=t.webRTCPeer;t.webRTCPeer=c,t.setReconnect(),e.migrate&&t.webRTCPeer.on(cf.connectionStateChange,e=>{if("connected"===e)setTimeout(()=>{var e,t,r,n;null===(e=f)||void 0===e||null===(t=e.close)||void 0===t||t.call(e),null===(r=g)||void 0===r||null===(n=r.closeRTCPeer)||void 0===n||n.call(r),f=g=null,kf.info("Current connection migrated")},1e3);else if(["disconnected","failed","closed"].includes(e)){var t,r,n,i;null===(t=f)||void 0===t||null===(r=t.close)||void 0===r||r.call(t),null===(n=g)||void 0===n||null===(i=n.closeRTCPeer)||void 0===i||i.call(n),f=g=null}})}))()}}var Of,Lf=Object.freeze({__proto__:null,STATUS:"rts/status",VIEWER_COUNT:"rts/viewer-count"});!function(e){e[e.Err=0]="Err",e[e.Idle=1]="Idle",e[e.Receiving=2]="Receiving",e[e.Broadcasting=3]="Broadcasting"}(Of||(Of={}));class MillicastAdapter{constructor(e,r,n=t("rts/millicast")){this.player=e,this.src=r,this.log=n,af.setEndpoint("https://realtime1.wowza.com"),this.player.on("tracks:video:select",e=>{var t;if(!this.engine||!this.engine.isActive())return;const r=e.detail.track,n=null===(t=this.player.tracks)||void 0===t?void 0:t.find(e=>e.selected&&e!==r);n&&(n.selected=!1),this.engine.project("Main"===r.name?"":r.name,r.data.tracks)})}static wants(e){return e.type==MillicastAdapter.Type}async load(){this.log("loading",this.src.streamName),this.engine=new Ef(this.src.streamName,()=>af.getSubscriber(Object.assign(Object.assign({},this.src),{streamAccountId:"dev"in this.src?"3caeCP":"bUEzT6"})),this.player),this.player.original_src=MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT,this._observe(),await this.connect()}async connect(){try{await this._connect()}catch(e){this.log("Connection failed",e),this.player.emit("error",e),setTimeout(()=>{0==this.player.reaper||this.player.currentSrc||(this.player.emit("recover"),this.connect())},3e3)}}stop(){var e;null===(e=this.engine)||void 0===e||e.stop()}_handleViewerCount(e){"number"==typeof e&&this.player.emit("rts/viewer-count",{viewerCount:e})}_handleActive(e){this.player.hasState("is-error")&&this.player.emit("recover"),this.player.emit("rts/status",{status:Of.Receiving,data:e})}_handleInactive(){const e={status:Of.Idle,message:this.player.i18n("rts.millicast.inactive","broadcast has become inactive")};this.player.emit("rts/status",e),this.player.emit("error",Object.assign({fatal:!1},e))}_observe(){var e;null===(e=this.engine)||void 0===e||e.on("broadcastEvent",e=>{const{name:t,data:r}=e;switch(t){case"active":return this._handleActive(r);case"viewercount":return this._handleViewerCount(r.viewercount);case"inactive":return this._handleInactive()}})}async _connect(){var e;const t=this.engine;t&&(await t.connect(MillicastAdapter.Options),null===(e=t.webRTCPeer)||void 0===e||e.initStats())}}
2
2
  /**
3
3
  * @license wowza-webrtc-player 1.0.5
4
4
  * Copyright (c) 2018-2022 Koala Interactive, Inc.
5
5
  * License: MIT
6
6
  */
7
- function Lf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Df(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lf(Object(r),!0).forEach((function(t){jf(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lf(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mf(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function Nf(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){Mf(o,n,i,s,a,"next",e)}function a(e){Mf(o,n,i,s,a,"throw",e)}s(void 0)}))}}function jf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _f(){}function Bf(){Bf.init.call(this)}function Uf(e){return void 0===e._maxListeners?Bf.defaultMaxListeners:e._maxListeners}function Vf(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Xf(e,n),o=0;o<n;++o)i[o].call(r)}function Ff(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=Xf(e,i),s=0;s<i;++s)o[s].call(r,n)}function zf(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=Xf(e,o),a=0;a<o;++a)s[a].call(r,n,i)}function $f(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=Xf(e,s),c=0;c<s;++c)a[c].call(r,n,i,o)}function Gf(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=Xf(e,i),s=0;s<i;++s)o[s].apply(r,n)}function Wf(e,t,r,n){var i,o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]):(o=e._events=new _f,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(i=Uf(e))&&i>0&&s.length>i){s.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=o[t]=r,++e._eventsCount;return e}function qf(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Hf(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Xf(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}MillicastAdapter.Events={ACTIVE:"rts/millicast/active",INACTIVE:"rts/millicast/inactive"},MillicastAdapter.Type="wowza/rts",MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT="https://realtime1.wowza.com",_f.prototype=Object.create(null),Bf.EventEmitter=Bf,Bf.usingDomains=!1,Bf.prototype.domain=void 0,Bf.prototype._events=void 0,Bf.prototype._maxListeners=void 0,Bf.defaultMaxListeners=10,Bf.init=function(){this.domain=null,Bf.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new _f,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Bf.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Bf.prototype.getMaxListeners=function(){return Uf(this)},Bf.prototype.emit=function(e){var t,r,n,i,o,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=s[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:Vf(r,l,this);break;case 2:Ff(r,l,this,arguments[1]);break;case 3:zf(r,l,this,arguments[1],arguments[2]);break;case 4:$f(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];Gf(r,l,this,i)}return!0},Bf.prototype.addListener=function(e,t){return Wf(this,e,t,!1)},Bf.prototype.on=Bf.prototype.addListener,Bf.prototype.prependListener=function(e,t){return Wf(this,e,t,!0)},Bf.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,qf(this,e,t)),this},Bf.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,qf(this,e,t)),this},Bf.prototype.removeListener=function(e,t){var r,n,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new _f:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new _f,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,s||t)}return this},Bf.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new _f,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new _f:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new _f,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Bf.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},Bf.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Hf.call(e,t)},Bf.prototype.listenerCount=Hf,Bf.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Yf=window.RTCPeerConnection,Jf=window.RTCIceCandidate,Kf=window.RTCSessionDescription;class b extends Bf{constructor(e){super(),jf(this,"pc",void 0),this.pc=new Yf({iceServers:e}),"ontrack"in this.pc?this.pc.ontrack=this.handleTrackEvent.bind(this):this.pc.onaddstream=this.handleNewStreamEvent.bind(this)}getPeerConnection(){return this.pc}close(){this.pc.close()}setRemoteDescription(e){return this.pc.setRemoteDescription(new Kf(e))}setLocalDescription(e){return this.pc.setLocalDescription(new Kf(e))}createAnswer(){var e=this;return Nf((function*(){return e.pc.createAnswer()}))()}createOffer(){var e=this;return Nf((function*(){return e.pc.createOffer()}))()}attachIceCandidate(e){return this.pc.addIceCandidate(new Jf(e))}attachMediaStream(e){var t=this.pc,r=t.getSenders(),n=e.getTracks();r.length?n.forEach(e=>{r.filter(t=>{var r;return(null===(r=t.track)||void 0===r?void 0:r.kind)===e.kind}).forEach(t=>{t.replaceTrack(e)})}):n.forEach(r=>{t.addTrack(r,e)})}handleNewStreamEvent(e){var{stream:t}=e;this.emit("addstream",t)}handleTrackEvent(e){e.streams.forEach(e=>{this.emit("addstream",e)})}}class C{constructor(e,t,r){this.url=e,this.streamInfo=t,this.userData=r,jf(this,"ws",null),jf(this,"pendingCommands",new Map)}connect(){return this.ws?Promise.resolve(this.ws):new Promise((e,t)=>{var r=new WebSocket(this.url);r.binaryType="arraybuffer",r.onopen=()=>e(r),r.onerror=()=>t(),r.onclose=()=>t(),r.onmessage=this.handleSocketData.bind(this),this.ws=r})}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}getOffer(){var e={direction:"play",command:"getOffer"};return this.streamInfo.secureToken&&(e.secureToken=this.streamInfo.secureToken),this.send(e)}sendOffer(e){return this.send({direction:"publish",command:"sendOffer",sdp:e})}sendResponse(e){return this.send({direction:"play",command:"sendResponse",sdp:e})}getAvailableStreams(){return this.send({direction:"play",command:"getAvailableStreams"})}send(e){var t=this;return Nf((function*(){var r,n=t.ws||(yield t.connect());return t.pendingCommands.has(e.command)||t.pendingCommands.set(e.command,((r={}).promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r)),n.send(JSON.stringify(Df(Df({},e),{},{streamInfo:t.streamInfo,userData:t.userData}))),t.pendingCommands.get(e.command).promise}))()}handleSocketData(e){var t,r=JSON.parse(e.data);200===r.status?(null!==(t=r.streamInfo)&&void 0!==t&&t.sessionId&&(this.streamInfo.sessionId=r.streamInfo.sessionId),this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).resolve(r),this.pendingCommands.delete(r.command))):this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).reject(r),this.pendingCommands.delete(r.command))}}var Zf="mozGetUserMedia"in navigator?"firefox":"webkitGetUserMedia"in navigator||!1===window.isSecureContext&&"webkitRTCPeerConnection"in window&&!("RTCIceGatherer"in window)?"chrome":navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?"edge":window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)?"safari":"unknown",Qf=["vp9","vp8","h264","red","ulpfec","rtx"],ep=["opus","isac","g722","pcmu","pcma","cn"];class S{constructor(e,t){this.videoOptions=e,this.audioOptions=t,jf(this,"audioIndex",-1),jf(this,"videoIndex",-1)}transformPlay(e){return e.sdp?(e.sdp=e.sdp.replace(/profile-level-id=(\w+)/gi,(e,t)=>{var r=parseInt(t,16),n=r>>16&255,i=r>>8&255,o=255&r;return n>66?(n=66,i=224,o=31):0===i&&(i=224),"profile-level-id=".concat((n<<16|i<<8|o).toString(16))}),e):e}transformPublish(e){var t=this.prepareSDP(e),r=this.videoOptions,n=this.audioOptions,i=null,o=()=>"m=audio"===i?n:"m=video"===i?r:null,s=t.filter(Boolean).map(e=>{var[t]=e.split(/\s|:/,1);switch(t){case"m=audio":case"m=video":var s="m=audio"===t?this.audioIndex:this.videoIndex;if(-1!==s&&"chrome"===Zf){var[a,c,u]=e.split(" ");return"".concat(a," ").concat(c," ").concat(u," ").concat(s)}i=t;break;case"a=rtpmap":var l=/^a=rtpmap:(\d+)\s+(\w+)\/(\d+)/.exec(e);if(!l||"chrome"!==Zf)break;var d=l[2].toLowerCase();r.bitRate&&Qf.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(r.bitRate,";x-google-max-bitrate=").concat(r.bitRate)),n.bitRate&&ep.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(n.bitRate,";x-google-max-bitrate=").concat(n.bitRate));break;case"c=IN":var f=o();if(null!=f&&f.bitRate&&["firefox","safari"].includes(Zf)){var p=1e3*f.bitRate;e+="\r\nb=TIAS:".concat(.95*p-16e3),e+="\r\nb=AS:".concat(p),e+="\r\nb=CT:".concat(p)}break;case"a=mid":var h=o();h&&"chrome"===Zf&&(h.bitRate&&(e+="\r\nb=CT:".concat(h.bitRate),e+="\r\nb=AS:".concat(h.bitRate),"frameRate"in h&&h.frameRate&&(e+="\r\na=framerate:".concat(h.frameRate.toFixed(2)))),i=null)}return e}).join("\r\n")+"\r\n";return{type:e.type,sdp:s}}checkLine(e,t){if(/^a=(rtpmap|rtcp-fb|fmtp)/.test(e)){var r=e.split(":");if(r.length>1){var[n,i]=r[1].split(" ");if(!i.startsWith("http")&&!i.startsWith("ur")){var o=parseInt(n,10),s=t.get(o)||[];return s.push(e),t.set(o,s),!1}}}return!0}deliverCheckLine(e,t,r){var n=Array.from(r).find(t=>{var[,r]=t;return r.join("\r\n").includes(e)});if(!n)return[];var[i,o]=n;return"audio"===t?this.audioIndex=i:this.videoIndex=i,"VP8"!==e&&"VP9"!==e?o:o.filter(e=>!e.includes("transport-cc")&&!e.includes("goog-remb")&&!e.includes("nack"))}addAudio(e,t){for(var r="",n=0,i=e.length;n<i;++n){var o=e[n];if(o.startsWith("m=audio"))r="audio";else if(o.startsWith("m=video"))r="video";else if("a=rtcp-mux"===o&&"audio"===r){var s=this.deliverCheckLine(this.audioOptions.codec,"audio",t);e.splice(n+1,0,...s);break}}return e}addVideo(e,t){var r=e.includes("a=rtcp-rsize"),n=e.includes("a=rtcp-mux"),i=!1;if(!r&&!n)return e;var o=this.deliverCheckLine(this.videoOptions.codec,"video",t);return e.map(e=>{if(r){if(!i&&"a=rtcp-rsize"===e)return i=!0,[e].concat(o).join("\r\n")}else if("a=rtcp-mux"===e){if(i)return[e].concat(o).join("\r\n");i=!0}return e})}flattenLines(e){return e.join("\r\n").split("\r\n")}prepareSDP(e){var t=new Map,r=(e.sdp||"").split(/\r\n/);return r=r.filter(e=>e&&this.checkLine(e,t)),r=this.flattenLines(this.addAudio(r,t)),this.flattenLines(this.addVideo(r,t))}}class x extends Bf{constructor(e,t){super(),this.video=e,jf(this,"sdpUrl",""),jf(this,"applicationName",""),jf(this,"streamName",""),jf(this,"userData",null),jf(this,"sdpHandler",void 0),jf(this,"secureToken",void 0),jf(this,"constraints",{audio:!0,video:!0}),jf(this,"videoConfigs",{bitRate:360,codec:"42e01f",frameRate:29.97}),jf(this,"audioConfigs",{codec:"opus",bitRate:64}),jf(this,"iceServers",[]),jf(this,"mediaStream",null),jf(this,"pc",null),t&&this.setConfigurations(t)}setConfigurations(e){e.constraints&&(this.constraints=e.constraints),e.videoConfigs&&(this.videoConfigs=e.videoConfigs),e.audioConfigs&&(this.audioConfigs=e.audioConfigs),e.applicationName&&(this.applicationName=e.applicationName),e.streamName&&(this.streamName=e.streamName),e.sdpUrl&&(this.sdpUrl=e.sdpUrl),void 0!==e.userData&&(this.userData=e.userData),e.iceServers&&(this.iceServers=e.iceServers),e.sdpHandler&&(this.sdpHandler=e.sdpHandler),e.secureToken&&(this.secureToken=e.secureToken)}stop(){this.pc&&(this.pc.close(),this.pc=null)}getMediaStream(){return this.mediaStream}getPeerConnection(){return this.pc?this.pc.getPeerConnection():null}playLocal(e){var t=this;return Nf((function*(){e&&(t.constraints=e);var r=yield function(e){var t;return null!==(t=navigator.mediaDevices)&&void 0!==t&&t.getUserMedia?navigator.mediaDevices.getUserMedia(e):"getUserMedia"in navigator?new Promise((t,r)=>{navigator.getUserMedia(e,t,r)}):Promise.reject("Your browser does not support getUserMedia API")}(t.constraints);return t.attachStream(r),r}))()}stopLocal(){this.stop(),this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}playRemote(e){var t=this;return Nf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var{sdp:n}=yield r.getOffer(),i=t.createPeerConnection();i.on("addstream",t.attachStream.bind(t)),yield i.setRemoteDescription(n);var o=yield i.createAnswer(),s=new S(t.videoConfigs,t.audioConfigs),a=t.sdpHandler?t.sdpHandler(o,e=>s.transformPlay(e),"play"):s.transformPlay(o);yield i.setLocalDescription(a);var{iceCandidates:c}=yield r.sendResponse(a);c.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}publish(e){var t=this;return Nf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var n=t.mediaStream||(yield t.playLocal()),i=t.createPeerConnection();i.attachMediaStream(n);var o=new S(t.videoConfigs,t.audioConfigs),s=yield i.createOffer(),a=t.sdpHandler?t.sdpHandler(s,e=>o.transformPublish(e),"publish"):o.transformPublish(s);yield i.setLocalDescription(a);var{sdp:c,iceCandidates:u}=yield r.sendOffer(a);yield i.setRemoteDescription(c),u.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}getAvailableStreams(){var e=this;return Nf((function*(){var t=e.createWowzaInstance();try{var{availableStreams:r}=yield t.getAvailableStreams();return r||[]}catch(e){return[]}finally{t.disconnect()}}))()}createWowzaInstance(){return new C(this.sdpUrl,{applicationName:this.applicationName,sessionId:"[empty]",streamName:this.streamName,secureToken:this.secureToken},this.userData)}createPeerConnection(){return this.pc=new b(this.iceServers),this.pc}attachStream(e){this.mediaStream=e;try{var t=this.video.srcObject instanceof MediaStream&&this.video.srcObject;t&&t.id===e.id||(this.video.srcObject=e)}catch(t){this.video.src=window.URL.createObjectURL(e)}this.pc&&this.pc.attachMediaStream(e),this.video.play()}}class WowzaWebRTCAdapter{constructor(e,r,n=t("rts/webrtc")){this.player=e,this.src=r,this.log=n}static wants(e){return e.type==WowzaWebRTCAdapter.Type}async load(){this.log("loading",this.src.streamName),this.player.original_src=this.src.sdpUrl,this.engine=new x(this.player,this.src),await this.engine.playRemote()}async stop(){var e;await(null===(e=this.engine)||void 0===e?void 0:e.stop())}}WowzaWebRTCAdapter.Events={ACTIVE:"rts/wowza-webrtc/active",INACTIVE:"rts/webrtc/inactive"},WowzaWebRTCAdapter.Type="wowza/webrtc";class RTSLoader{constructor(){this.log=t("rts"),console.log("warning / the realtime plugin is in beta release")}init(e,t,r){r.on("reap",()=>{var e;return null===(e=this.engine)||void 0===e?void 0:e.stop()})}onload(e,t,r,n){var i;switch(n.type){case MillicastAdapter.Type:this.engine=new MillicastAdapter(r,n);break;case WowzaWebRTCAdapter.Type:this.engine=new WowzaWebRTCAdapter(r,n)}null===(i=this.engine)||void 0===i||i.load()}wants(e,t,r){return"string"==typeof t.type&&(MillicastAdapter.wants(t)||WowzaWebRTCAdapter.wants(t))}}return RTSLoader.events={},function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;"function"==typeof r?r(t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t))}(window,RTSLoader),RTSLoader}));
7
+ function Df(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Df(Object(r),!0).forEach((function(t){_f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Df(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Nf(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function jf(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){Nf(o,n,i,s,a,"next",e)}function a(e){Nf(o,n,i,s,a,"throw",e)}s(void 0)}))}}function _f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bf(){}function Uf(){Uf.init.call(this)}function Vf(e){return void 0===e._maxListeners?Uf.defaultMaxListeners:e._maxListeners}function Ff(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Yf(e,n),o=0;o<n;++o)i[o].call(r)}function zf(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=Yf(e,i),s=0;s<i;++s)o[s].call(r,n)}function $f(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=Yf(e,o),a=0;a<o;++a)s[a].call(r,n,i)}function Gf(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=Yf(e,s),c=0;c<s;++c)a[c].call(r,n,i,o)}function Wf(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=Yf(e,i),s=0;s<i;++s)o[s].apply(r,n)}function qf(e,t,r,n){var i,o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]):(o=e._events=new Bf,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(i=Vf(e))&&i>0&&s.length>i){s.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=o[t]=r,++e._eventsCount;return e}function Hf(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Xf(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Yf(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}MillicastAdapter.Events={ACTIVE:"rts/millicast/active",INACTIVE:"rts/millicast/inactive"},MillicastAdapter.Type="wowza/rts",MillicastAdapter.Options={events:["active","inactive","viewercount"]},MillicastAdapter.WOWZA_DIRECTOR_ENDPOINT="https://realtime1.wowza.com",Bf.prototype=Object.create(null),Uf.EventEmitter=Uf,Uf.usingDomains=!1,Uf.prototype.domain=void 0,Uf.prototype._events=void 0,Uf.prototype._maxListeners=void 0,Uf.defaultMaxListeners=10,Uf.init=function(){this.domain=null,Uf.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Bf,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Uf.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Uf.prototype.getMaxListeners=function(){return Vf(this)},Uf.prototype.emit=function(e){var t,r,n,i,o,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=s[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:Ff(r,l,this);break;case 2:zf(r,l,this,arguments[1]);break;case 3:$f(r,l,this,arguments[1],arguments[2]);break;case 4:Gf(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];Wf(r,l,this,i)}return!0},Uf.prototype.addListener=function(e,t){return qf(this,e,t,!1)},Uf.prototype.on=Uf.prototype.addListener,Uf.prototype.prependListener=function(e,t){return qf(this,e,t,!0)},Uf.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Hf(this,e,t)),this},Uf.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Hf(this,e,t)),this},Uf.prototype.removeListener=function(e,t){var r,n,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Bf:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new Bf,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,s||t)}return this},Uf.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Bf,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Bf:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Bf,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Uf.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},Uf.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Xf.call(e,t)},Uf.prototype.listenerCount=Xf,Uf.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Jf=window.RTCPeerConnection,Kf=window.RTCIceCandidate,Zf=window.RTCSessionDescription;class b extends Uf{constructor(e){super(),_f(this,"pc",void 0),this.pc=new Jf({iceServers:e}),"ontrack"in this.pc?this.pc.ontrack=this.handleTrackEvent.bind(this):this.pc.onaddstream=this.handleNewStreamEvent.bind(this)}getPeerConnection(){return this.pc}close(){this.pc.close()}setRemoteDescription(e){return this.pc.setRemoteDescription(new Zf(e))}setLocalDescription(e){return this.pc.setLocalDescription(new Zf(e))}createAnswer(){var e=this;return jf((function*(){return e.pc.createAnswer()}))()}createOffer(){var e=this;return jf((function*(){return e.pc.createOffer()}))()}attachIceCandidate(e){return this.pc.addIceCandidate(new Kf(e))}attachMediaStream(e){var t=this.pc,r=t.getSenders(),n=e.getTracks();r.length?n.forEach(e=>{r.filter(t=>{var r;return(null===(r=t.track)||void 0===r?void 0:r.kind)===e.kind}).forEach(t=>{t.replaceTrack(e)})}):n.forEach(r=>{t.addTrack(r,e)})}handleNewStreamEvent(e){var{stream:t}=e;this.emit("addstream",t)}handleTrackEvent(e){e.streams.forEach(e=>{this.emit("addstream",e)})}}class C{constructor(e,t,r){this.url=e,this.streamInfo=t,this.userData=r,_f(this,"ws",null),_f(this,"pendingCommands",new Map)}connect(){return this.ws?Promise.resolve(this.ws):new Promise((e,t)=>{var r=new WebSocket(this.url);r.binaryType="arraybuffer",r.onopen=()=>e(r),r.onerror=()=>t(),r.onclose=()=>t(),r.onmessage=this.handleSocketData.bind(this),this.ws=r})}disconnect(){this.ws&&(this.ws.close(),this.ws=null)}getOffer(){var e={direction:"play",command:"getOffer"};return this.streamInfo.secureToken&&(e.secureToken=this.streamInfo.secureToken),this.send(e)}sendOffer(e){return this.send({direction:"publish",command:"sendOffer",sdp:e})}sendResponse(e){return this.send({direction:"play",command:"sendResponse",sdp:e})}getAvailableStreams(){return this.send({direction:"play",command:"getAvailableStreams"})}send(e){var t=this;return jf((function*(){var r,n=t.ws||(yield t.connect());return t.pendingCommands.has(e.command)||t.pendingCommands.set(e.command,((r={}).promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r)),n.send(JSON.stringify(Mf(Mf({},e),{},{streamInfo:t.streamInfo,userData:t.userData}))),t.pendingCommands.get(e.command).promise}))()}handleSocketData(e){var t,r=JSON.parse(e.data);200===r.status?(null!==(t=r.streamInfo)&&void 0!==t&&t.sessionId&&(this.streamInfo.sessionId=r.streamInfo.sessionId),this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).resolve(r),this.pendingCommands.delete(r.command))):this.pendingCommands.has(r.command)&&(this.pendingCommands.get(r.command).reject(r),this.pendingCommands.delete(r.command))}}var Qf="mozGetUserMedia"in navigator?"firefox":"webkitGetUserMedia"in navigator||!1===window.isSecureContext&&"webkitRTCPeerConnection"in window&&!("RTCIceGatherer"in window)?"chrome":navigator.mediaDevices&&navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)?"edge":window.RTCPeerConnection&&navigator.userAgent.match(/AppleWebKit\/(\d+)\./)?"safari":"unknown",ep=["vp9","vp8","h264","red","ulpfec","rtx"],tp=["opus","isac","g722","pcmu","pcma","cn"];class S{constructor(e,t){this.videoOptions=e,this.audioOptions=t,_f(this,"audioIndex",-1),_f(this,"videoIndex",-1)}transformPlay(e){return e.sdp?(e.sdp=e.sdp.replace(/profile-level-id=(\w+)/gi,(e,t)=>{var r=parseInt(t,16),n=r>>16&255,i=r>>8&255,o=255&r;return n>66?(n=66,i=224,o=31):0===i&&(i=224),"profile-level-id=".concat((n<<16|i<<8|o).toString(16))}),e):e}transformPublish(e){var t=this.prepareSDP(e),r=this.videoOptions,n=this.audioOptions,i=null,o=()=>"m=audio"===i?n:"m=video"===i?r:null,s=t.filter(Boolean).map(e=>{var[t]=e.split(/\s|:/,1);switch(t){case"m=audio":case"m=video":var s="m=audio"===t?this.audioIndex:this.videoIndex;if(-1!==s&&"chrome"===Qf){var[a,c,u]=e.split(" ");return"".concat(a," ").concat(c," ").concat(u," ").concat(s)}i=t;break;case"a=rtpmap":var l=/^a=rtpmap:(\d+)\s+(\w+)\/(\d+)/.exec(e);if(!l||"chrome"!==Qf)break;var d=l[2].toLowerCase();r.bitRate&&ep.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(r.bitRate,";x-google-max-bitrate=").concat(r.bitRate)),n.bitRate&&tp.includes(d)&&(e+="\r\na=fmtp:".concat(l[1]," x-google-min-bitrate=").concat(n.bitRate,";x-google-max-bitrate=").concat(n.bitRate));break;case"c=IN":var f=o();if(null!=f&&f.bitRate&&["firefox","safari"].includes(Qf)){var p=1e3*f.bitRate;e+="\r\nb=TIAS:".concat(.95*p-16e3),e+="\r\nb=AS:".concat(p),e+="\r\nb=CT:".concat(p)}break;case"a=mid":var h=o();h&&"chrome"===Qf&&(h.bitRate&&(e+="\r\nb=CT:".concat(h.bitRate),e+="\r\nb=AS:".concat(h.bitRate),"frameRate"in h&&h.frameRate&&(e+="\r\na=framerate:".concat(h.frameRate.toFixed(2)))),i=null)}return e}).join("\r\n")+"\r\n";return{type:e.type,sdp:s}}checkLine(e,t){if(/^a=(rtpmap|rtcp-fb|fmtp)/.test(e)){var r=e.split(":");if(r.length>1){var[n,i]=r[1].split(" ");if(!i.startsWith("http")&&!i.startsWith("ur")){var o=parseInt(n,10),s=t.get(o)||[];return s.push(e),t.set(o,s),!1}}}return!0}deliverCheckLine(e,t,r){var n=Array.from(r).find(t=>{var[,r]=t;return r.join("\r\n").includes(e)});if(!n)return[];var[i,o]=n;return"audio"===t?this.audioIndex=i:this.videoIndex=i,"VP8"!==e&&"VP9"!==e?o:o.filter(e=>!e.includes("transport-cc")&&!e.includes("goog-remb")&&!e.includes("nack"))}addAudio(e,t){for(var r="",n=0,i=e.length;n<i;++n){var o=e[n];if(o.startsWith("m=audio"))r="audio";else if(o.startsWith("m=video"))r="video";else if("a=rtcp-mux"===o&&"audio"===r){var s=this.deliverCheckLine(this.audioOptions.codec,"audio",t);e.splice(n+1,0,...s);break}}return e}addVideo(e,t){var r=e.includes("a=rtcp-rsize"),n=e.includes("a=rtcp-mux"),i=!1;if(!r&&!n)return e;var o=this.deliverCheckLine(this.videoOptions.codec,"video",t);return e.map(e=>{if(r){if(!i&&"a=rtcp-rsize"===e)return i=!0,[e].concat(o).join("\r\n")}else if("a=rtcp-mux"===e){if(i)return[e].concat(o).join("\r\n");i=!0}return e})}flattenLines(e){return e.join("\r\n").split("\r\n")}prepareSDP(e){var t=new Map,r=(e.sdp||"").split(/\r\n/);return r=r.filter(e=>e&&this.checkLine(e,t)),r=this.flattenLines(this.addAudio(r,t)),this.flattenLines(this.addVideo(r,t))}}class x extends Uf{constructor(e,t){super(),this.video=e,_f(this,"sdpUrl",""),_f(this,"applicationName",""),_f(this,"streamName",""),_f(this,"userData",null),_f(this,"sdpHandler",void 0),_f(this,"secureToken",void 0),_f(this,"constraints",{audio:!0,video:!0}),_f(this,"videoConfigs",{bitRate:360,codec:"42e01f",frameRate:29.97}),_f(this,"audioConfigs",{codec:"opus",bitRate:64}),_f(this,"iceServers",[]),_f(this,"mediaStream",null),_f(this,"pc",null),t&&this.setConfigurations(t)}setConfigurations(e){e.constraints&&(this.constraints=e.constraints),e.videoConfigs&&(this.videoConfigs=e.videoConfigs),e.audioConfigs&&(this.audioConfigs=e.audioConfigs),e.applicationName&&(this.applicationName=e.applicationName),e.streamName&&(this.streamName=e.streamName),e.sdpUrl&&(this.sdpUrl=e.sdpUrl),void 0!==e.userData&&(this.userData=e.userData),e.iceServers&&(this.iceServers=e.iceServers),e.sdpHandler&&(this.sdpHandler=e.sdpHandler),e.secureToken&&(this.secureToken=e.secureToken)}stop(){this.pc&&(this.pc.close(),this.pc=null)}getMediaStream(){return this.mediaStream}getPeerConnection(){return this.pc?this.pc.getPeerConnection():null}playLocal(e){var t=this;return jf((function*(){e&&(t.constraints=e);var r=yield function(e){var t;return null!==(t=navigator.mediaDevices)&&void 0!==t&&t.getUserMedia?navigator.mediaDevices.getUserMedia(e):"getUserMedia"in navigator?new Promise((t,r)=>{navigator.getUserMedia(e,t,r)}):Promise.reject("Your browser does not support getUserMedia API")}(t.constraints);return t.attachStream(r),r}))()}stopLocal(){this.stop(),this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}playRemote(e){var t=this;return jf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var{sdp:n}=yield r.getOffer(),i=t.createPeerConnection();i.on("addstream",t.attachStream.bind(t)),yield i.setRemoteDescription(n);var o=yield i.createAnswer(),s=new S(t.videoConfigs,t.audioConfigs),a=t.sdpHandler?t.sdpHandler(o,e=>s.transformPlay(e),"play"):s.transformPlay(o);yield i.setLocalDescription(a);var{iceCandidates:c}=yield r.sendResponse(a);c.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}publish(e){var t=this;return jf((function*(){e&&t.setConfigurations(e);var r=t.createWowzaInstance();try{var n=t.mediaStream||(yield t.playLocal()),i=t.createPeerConnection();i.attachMediaStream(n);var o=new S(t.videoConfigs,t.audioConfigs),s=yield i.createOffer(),a=t.sdpHandler?t.sdpHandler(s,e=>o.transformPublish(e),"publish"):o.transformPublish(s);yield i.setLocalDescription(a);var{sdp:c,iceCandidates:u}=yield r.sendOffer(a);yield i.setRemoteDescription(c),u.forEach(e=>{i.attachIceCandidate(e)})}finally{r.disconnect()}}))()}getAvailableStreams(){var e=this;return jf((function*(){var t=e.createWowzaInstance();try{var{availableStreams:r}=yield t.getAvailableStreams();return r||[]}catch(e){return[]}finally{t.disconnect()}}))()}createWowzaInstance(){return new C(this.sdpUrl,{applicationName:this.applicationName,sessionId:"[empty]",streamName:this.streamName,secureToken:this.secureToken},this.userData)}createPeerConnection(){return this.pc=new b(this.iceServers),this.pc}attachStream(e){this.mediaStream=e;try{var t=this.video.srcObject instanceof MediaStream&&this.video.srcObject;t&&t.id===e.id||(this.video.srcObject=e)}catch(t){this.video.src=window.URL.createObjectURL(e)}this.pc&&this.pc.attachMediaStream(e),this.video.play()}}class WowzaWebRTCAdapter{constructor(e,r,n=t("rts/webrtc")){this.player=e,this.src=r,this.log=n}static wants(e){return e.type==WowzaWebRTCAdapter.Type}async load(){this.log("loading",this.src.streamName),this.player.original_src=this.src.sdpUrl,this.engine=new x(this.player,this.src),await this.engine.playRemote()}async stop(){var e;await(null===(e=this.engine)||void 0===e?void 0:e.stop())}}WowzaWebRTCAdapter.Events={ACTIVE:"rts/wowza-webrtc/active",INACTIVE:"rts/webrtc/inactive"},WowzaWebRTCAdapter.Type="wowza/webrtc";class RTSLoader{constructor(){this.log=t("rts"),console.log("warning / the realtime plugin is in beta release")}init(e,t,r){r.on("reap",()=>{var e;return null===(e=this.engine)||void 0===e?void 0:e.stop()})}onload(e,t,r,n){var i;switch(n.type){case MillicastAdapter.Type:this.engine=new MillicastAdapter(r,n);break;case WowzaWebRTCAdapter.Type:this.engine=new WowzaWebRTCAdapter(r,n)}null===(i=this.engine)||void 0===i||i.load()}wants(e,t,r){return"string"==typeof t.type&&(MillicastAdapter.wants(t)||WowzaWebRTCAdapter.wants(t))}}return RTSLoader.events=Lf,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;"function"==typeof r?r(t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t))}(window,RTSLoader),RTSLoader}));