aliyun-rtc-sdk 7.1.7 → 7.1.8
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.
|
@@ -19,7 +19,7 @@ import{o as $r,k as Jr,A as Zr}from"./index-BvRi8Pnp.js";import"eventemitter3";c
|
|
|
19
19
|
`+_+`
|
|
20
20
|
`;const m=(s,i)=>s[0].localeCompare(i[0]),h=s=>s[0].startsWith("x-log-")||s[0].startsWith("x-acs-");try{const s=[...H.entries()].filter(h).sort(m).map(i=>i[0]+":"+i[1]+`
|
|
21
21
|
`).join("");l+=s}catch{}l+=L,$.size>0&&(l+="?");try{l+=[...$.entries()].sort(m).map(s=>s[0]+"="+s[1]).join("&")}catch{}const v=et.HmacSHA1(l,F).toString(et.enc.Base64),u="LOG "+B+":"+v;return H.set("Authorization",u),H.set("x-log-date",_),u}var Fn=(Y,L,B)=>new Promise((F,$)=>{var H=f=>{try{_(B.next(f))}catch(l){$(l)}},T=f=>{try{_(B.throw(f))}catch(l){$(l)}},_=f=>f.done?F(f.value):Promise.resolve(f.value).then(H,T);_((B=B.apply(Y,L)).next())});function Vn(Y){return Fn(this,null,function*(){const L=new Date;if(Y.refreshSTSTokenInterval||(Y.refreshSTSTokenInterval=3e5),!Y.stsTokenFreshTime||+L-Y.stsTokenFreshTime>=Y.refreshSTSTokenInterval){Y.stsTokenFreshTime=L;try{yield Y.refreshSTSToken()}catch(B){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
|
|
22
|
-
`+B)}}return null})}var Hn=(Y,L,B)=>new Promise((F,$)=>{var H=f=>{try{_(B.next(f))}catch(l){$(l)}},T=f=>{try{_(B.throw(f))}catch(l){$(l)}},_=f=>f.done?F(f.value):Promise.resolve(f.value).then(H,T);_((B=B.apply(Y,L)).next())});function Fr(Y){return{transString:function(L){let B={},F=0,$=!1;for(let H in L){if((H==="time"||H==="__time__")&&typeof L[H]=="number"){F=L[H],$=!0;continue}typeof L[H]=="object"?B[H]=JSON.stringify(L[H]):B[H]=String(L[H])}return B.__time__=$?F:Math.floor(new Date().getTime()/1e3),B},process:function(L,B){return Hn(this,null,function*(){yield Vn(Y);let F=L.slice(L.indexOf("/logstores")),$=B.length,H=Ln(B),T=new Date().toUTCString(),_=new Map,f=new Map([["Content-Type","application/json"],["Content-MD5",H],["x-log-bodyrawsize",$.toString()]]);Y.securityToken&&f.set("x-acs-security-token",Y.securityToken),Un("POST",F,Y.accessKeyId,Y.accessKeySecret,_,f,H,T);let l=Object.fromEntries(f);return{data:B,header:l}})}}}typeof window<"u"&&Jt(window,"stsPlugin",Fr);var Vr={exports:{}};/*! aliyun rts sdk - ver2.13.2 created:2025/10/14 11:48:41 */(function(Y,L){(function(B,F){Y.exports=F()})(self,()=>(()=>{var B={280:H=>{var T;T=()=>(()=>{var _={775:h=>{var v=Object.prototype.hasOwnProperty;function u(i){return"[Throws: "+(i?i.message:"?")+"]"}function s(i){var e=[];return function o(r){if(r===null||typeof r!="object")return r;if(e.indexOf(r)!==-1)return"[Circular]";if(e.push(r),typeof r.toJSON=="function")try{var a=o(r.toJSON());return e.pop(),a}catch(c){return u(c)}if(Array.isArray(r)){var t=r.map(o);return e.pop(),t}var n=Object.keys(r).reduce(function(c,p){return c[p]=o(function(C,x){if(v.call(C,x))try{return C[x]}catch(y){return u(y)}return C[x]}(r,p)),c},{});return e.pop(),n}(i)}h.exports=function(i,e,o){return JSON.stringify(s(i),e,o)},h.exports.ensureProperties=s},692:h=>{var v=h.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(u){return u.encoding?"rtpmap:%d %s/%s/%s":u.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(u){return u.address!=null?"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(u){return u.subtype!=null?"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(u){return"extmap:%d"+(u.direction?"/%s":"%v")+(u["encrypt-uri"]?" %s":"%v")+" %s"+(u.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(u){return u.sessionConfig!=null?"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(u){var s="candidate:%s %d %s %d %s %d typ %s";return s+=u.raddr!=null?" raddr %s rport %d":"%v%v",s+=u.tcptype!=null?" tcptype %s":"%v",u.generation!=null&&(s+=" generation %d"),(s+=u["network-id"]!=null?" network-id %d":"%v")+(u["network-cost"]!=null?" 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(u){var s="ssrc:%d";return u.attribute!=null&&(s+=" %s",u.value!=null&&(s+=":%s")),s}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(u){return u.maxMessageSize!=null?"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(u){return u.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(u){return"imageattr:%s %s %s"+(u.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(u){return"simulcast:%s %s"+(u.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(u){return"ts-refclk:%s"+(u.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(u){var s="mediaclk:";return s+=u.id!=null?"id=%s %s":"%v%s",s+=u.mediaClockValue!=null?"=%s":"",(s+=u.rateNumerator!=null?" rate=%s":"")+(u.rateDenominator!=null?"/%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(v).forEach(function(u){v[u].forEach(function(s){s.reg||(s.reg=/(.*)/),s.format||(s.format="%s")})})},766:(h,v,u)=>{var s=u(962),i=u(627);v.write=i,v.parse=s.parse,v.parseParams=s.parseParams,v.parseFmtpConfig=s.parseFmtpConfig,v.parsePayloads=s.parsePayloads,v.parseRemoteCandidates=s.parseRemoteCandidates,v.parseImageAttributes=s.parseImageAttributes,v.parseSimulcastStreamList=s.parseSimulcastStreamList},962:(h,v,u)=>{var s=function(a){return String(Number(a))===a?Number(a):a},i=function(a,t,n){var c=a.name&&a.names;a.push&&!t[a.push]?t[a.push]=[]:c&&!t[a.name]&&(t[a.name]={});var p=a.push?{}:c?t[a.name]:t;(function(C,x,y,E){if(E&&!y)x[E]=s(C[1]);else for(var S=0;S<y.length;S+=1)C[S+1]!=null&&(x[y[S]]=s(C[S+1]))})(n.match(a.reg),p,a.names,a.name),a.push&&t[a.push].push(p)},e=u(692),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);v.parse=function(a){var t={},n=[],c=t;return a.split(/(\r\n|\r|\n)/).filter(o).forEach(function(p){var C=p[0],x=p.slice(2);C==="m"&&(n.push({rtp:[],fmtp:[]}),c=n[n.length-1]);for(var y=0;y<(e[C]||[]).length;y+=1){var E=e[C][y];if(E.reg.test(x))return i(E,c,x)}}),t.media=n,t};var r=function(a,t){var n=t.split(/=(.+)/,2);return n.length===2?a[n[0]]=s(n[1]):n.length===1&&t.length>1&&(a[n[0]]=void 0),a};v.parseParams=function(a){return a.split(/;\s?/).reduce(r,{})},v.parseFmtpConfig=v.parseParams,v.parsePayloads=function(a){return a.toString().split(" ").map(Number)},v.parseRemoteCandidates=function(a){for(var t=[],n=a.split(" ").map(s),c=0;c<n.length;c+=3)t.push({component:n[c],ip:n[c+1],port:n[c+2]});return t},v.parseImageAttributes=function(a){return a.split(" ").map(function(t){return t.substring(1,t.length-1).split(",").reduce(r,{})})},v.parseSimulcastStreamList=function(a){return a.split(";").map(function(t){return t.split(",").map(function(n){var c,p=!1;return n[0]!=="~"?c=s(n):(c=s(n.substring(1,n.length)),p=!0),{scid:c,paused:p}})})}},627:(h,v,u)=>{var s=u(692),i=/%[sdv%]/g,e=function(t){var n=1,c=arguments,p=c.length;return t.replace(i,function(C){if(n>=p)return C;var x=c[n];switch(n+=1,C){case"%%":return"%";case"%s":return String(x);case"%d":return Number(x);case"%v":return""}})},o=function(t,n,c){var p=[t+"="+(n.format instanceof Function?n.format(n.push?c:c[n.name]):n.format)];if(n.names)for(var C=0;C<n.names.length;C+=1){var x=n.names[C];n.name?p.push(c[n.name][x]):p.push(c[n.names[C]])}else p.push(c[n.name]);return e.apply(null,p)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],a=["i","c","b","a"];h.exports=function(t,n){n=n||{},t.version==null&&(t.version=0),t.name==null&&(t.name=" "),t.media.forEach(function(x){x.payloads==null&&(x.payloads="")});var c=n.outerOrder||r,p=n.innerOrder||a,C=[];return c.forEach(function(x){s[x].forEach(function(y){y.name in t&&t[y.name]!=null?C.push(o(x,y,t)):y.push in t&&t[y.push]!=null&&t[y.push].forEach(function(E){C.push(o(x,y,E))})})}),t.media.forEach(function(x){C.push(o("m",s.m[0],x)),p.forEach(function(y){s[y].forEach(function(E){E.name in x&&x[E.name]!=null?C.push(o(y,E,x)):E.push in x&&x[E.push]!=null&&x[E.push].forEach(function(S){C.push(o(y,E,S))})})})}),C.join(`\r
|
|
22
|
+
`+B)}}return null})}var Hn=(Y,L,B)=>new Promise((F,$)=>{var H=f=>{try{_(B.next(f))}catch(l){$(l)}},T=f=>{try{_(B.throw(f))}catch(l){$(l)}},_=f=>f.done?F(f.value):Promise.resolve(f.value).then(H,T);_((B=B.apply(Y,L)).next())});function Fr(Y){return{transString:function(L){let B={},F=0,$=!1;for(let H in L){if((H==="time"||H==="__time__")&&typeof L[H]=="number"){F=L[H],$=!0;continue}typeof L[H]=="object"?B[H]=JSON.stringify(L[H]):B[H]=String(L[H])}return B.__time__=$?F:Math.floor(new Date().getTime()/1e3),B},process:function(L,B){return Hn(this,null,function*(){yield Vn(Y);let F=L.slice(L.indexOf("/logstores")),$=B.length,H=Ln(B),T=new Date().toUTCString(),_=new Map,f=new Map([["Content-Type","application/json"],["Content-MD5",H],["x-log-bodyrawsize",$.toString()]]);Y.securityToken&&f.set("x-acs-security-token",Y.securityToken),Un("POST",F,Y.accessKeyId,Y.accessKeySecret,_,f,H,T);let l=Object.fromEntries(f);return{data:B,header:l}})}}}typeof window<"u"&&Jt(window,"stsPlugin",Fr);var Vr={exports:{}};/*! aliyun rts sdk - ver2.13.3 created:2025/10/21 10:50:31 */(function(Y,L){(function(B,F){Y.exports=F()})(self,()=>(()=>{var B={280:H=>{var T;T=()=>(()=>{var _={775:h=>{var v=Object.prototype.hasOwnProperty;function u(i){return"[Throws: "+(i?i.message:"?")+"]"}function s(i){var e=[];return function o(r){if(r===null||typeof r!="object")return r;if(e.indexOf(r)!==-1)return"[Circular]";if(e.push(r),typeof r.toJSON=="function")try{var a=o(r.toJSON());return e.pop(),a}catch(c){return u(c)}if(Array.isArray(r)){var t=r.map(o);return e.pop(),t}var n=Object.keys(r).reduce(function(c,p){return c[p]=o(function(C,x){if(v.call(C,x))try{return C[x]}catch(y){return u(y)}return C[x]}(r,p)),c},{});return e.pop(),n}(i)}h.exports=function(i,e,o){return JSON.stringify(s(i),e,o)},h.exports.ensureProperties=s},692:h=>{var v=h.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(u){return u.encoding?"rtpmap:%d %s/%s/%s":u.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(u){return u.address!=null?"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(u){return u.subtype!=null?"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(u){return"extmap:%d"+(u.direction?"/%s":"%v")+(u["encrypt-uri"]?" %s":"%v")+" %s"+(u.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(u){return u.sessionConfig!=null?"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(u){var s="candidate:%s %d %s %d %s %d typ %s";return s+=u.raddr!=null?" raddr %s rport %d":"%v%v",s+=u.tcptype!=null?" tcptype %s":"%v",u.generation!=null&&(s+=" generation %d"),(s+=u["network-id"]!=null?" network-id %d":"%v")+(u["network-cost"]!=null?" 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(u){var s="ssrc:%d";return u.attribute!=null&&(s+=" %s",u.value!=null&&(s+=":%s")),s}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(u){return u.maxMessageSize!=null?"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(u){return u.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(u){return"imageattr:%s %s %s"+(u.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(u){return"simulcast:%s %s"+(u.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(u){return"ts-refclk:%s"+(u.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(u){var s="mediaclk:";return s+=u.id!=null?"id=%s %s":"%v%s",s+=u.mediaClockValue!=null?"=%s":"",(s+=u.rateNumerator!=null?" rate=%s":"")+(u.rateDenominator!=null?"/%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(v).forEach(function(u){v[u].forEach(function(s){s.reg||(s.reg=/(.*)/),s.format||(s.format="%s")})})},766:(h,v,u)=>{var s=u(962),i=u(627);v.write=i,v.parse=s.parse,v.parseParams=s.parseParams,v.parseFmtpConfig=s.parseFmtpConfig,v.parsePayloads=s.parsePayloads,v.parseRemoteCandidates=s.parseRemoteCandidates,v.parseImageAttributes=s.parseImageAttributes,v.parseSimulcastStreamList=s.parseSimulcastStreamList},962:(h,v,u)=>{var s=function(a){return String(Number(a))===a?Number(a):a},i=function(a,t,n){var c=a.name&&a.names;a.push&&!t[a.push]?t[a.push]=[]:c&&!t[a.name]&&(t[a.name]={});var p=a.push?{}:c?t[a.name]:t;(function(C,x,y,E){if(E&&!y)x[E]=s(C[1]);else for(var S=0;S<y.length;S+=1)C[S+1]!=null&&(x[y[S]]=s(C[S+1]))})(n.match(a.reg),p,a.names,a.name),a.push&&t[a.push].push(p)},e=u(692),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);v.parse=function(a){var t={},n=[],c=t;return a.split(/(\r\n|\r|\n)/).filter(o).forEach(function(p){var C=p[0],x=p.slice(2);C==="m"&&(n.push({rtp:[],fmtp:[]}),c=n[n.length-1]);for(var y=0;y<(e[C]||[]).length;y+=1){var E=e[C][y];if(E.reg.test(x))return i(E,c,x)}}),t.media=n,t};var r=function(a,t){var n=t.split(/=(.+)/,2);return n.length===2?a[n[0]]=s(n[1]):n.length===1&&t.length>1&&(a[n[0]]=void 0),a};v.parseParams=function(a){return a.split(/;\s?/).reduce(r,{})},v.parseFmtpConfig=v.parseParams,v.parsePayloads=function(a){return a.toString().split(" ").map(Number)},v.parseRemoteCandidates=function(a){for(var t=[],n=a.split(" ").map(s),c=0;c<n.length;c+=3)t.push({component:n[c],ip:n[c+1],port:n[c+2]});return t},v.parseImageAttributes=function(a){return a.split(" ").map(function(t){return t.substring(1,t.length-1).split(",").reduce(r,{})})},v.parseSimulcastStreamList=function(a){return a.split(";").map(function(t){return t.split(",").map(function(n){var c,p=!1;return n[0]!=="~"?c=s(n):(c=s(n.substring(1,n.length)),p=!0),{scid:c,paused:p}})})}},627:(h,v,u)=>{var s=u(692),i=/%[sdv%]/g,e=function(t){var n=1,c=arguments,p=c.length;return t.replace(i,function(C){if(n>=p)return C;var x=c[n];switch(n+=1,C){case"%%":return"%";case"%s":return String(x);case"%d":return Number(x);case"%v":return""}})},o=function(t,n,c){var p=[t+"="+(n.format instanceof Function?n.format(n.push?c:c[n.name]):n.format)];if(n.names)for(var C=0;C<n.names.length;C+=1){var x=n.names[C];n.name?p.push(c[n.name][x]):p.push(c[n.names[C]])}else p.push(c[n.name]);return e.apply(null,p)},r=["v","o","s","i","u","e","p","c","b","t","r","z","a"],a=["i","c","b","a"];h.exports=function(t,n){n=n||{},t.version==null&&(t.version=0),t.name==null&&(t.name=" "),t.media.forEach(function(x){x.payloads==null&&(x.payloads="")});var c=n.outerOrder||r,p=n.innerOrder||a,C=[];return c.forEach(function(x){s[x].forEach(function(y){y.name in t&&t[y.name]!=null?C.push(o(x,y,t)):y.push in t&&t[y.push]!=null&&t[y.push].forEach(function(E){C.push(o(x,y,E))})})}),t.media.forEach(function(x){C.push(o("m",s.m[0],x)),p.forEach(function(y){s[y].forEach(function(E){E.name in x&&x[E.name]!=null?C.push(o(y,E,x)):E.push in x&&x[E.push]!=null&&x[E.push].forEach(function(S){C.push(o(y,E,S))})})})}),C.join(`\r
|
|
23
23
|
`)+`\r
|
|
24
24
|
`}},776:function(h,v,u){var s,i=this&&this.__extends||(s=function(W,M){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(N,P){N.__proto__=P}||function(N,P){for(var V in P)Object.prototype.hasOwnProperty.call(P,V)&&(N[V]=P[V])},s(W,M)},function(W,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");function N(){this.constructor=W}s(W,M),W.prototype=M===null?Object.create(M):(N.prototype=M.prototype,new N)}),e=this&&this.__assign||function(){return e=Object.assign||function(W){for(var M,N=1,P=arguments.length;N<P;N++)for(var V in M=arguments[N])Object.prototype.hasOwnProperty.call(M,V)&&(W[V]=M[V]);return W},e.apply(this,arguments)},o=this&&this.__awaiter||function(W,M,N,P){return new(N||(N=Promise))(function(V,j){function z(re){try{X(P.next(re))}catch(te){j(te)}}function G(re){try{X(P.throw(re))}catch(te){j(te)}}function X(re){var te;re.done?V(re.value):(te=re.value,te instanceof N?te:new N(function(oe){oe(te)})).then(z,G)}X((P=P.apply(W,M||[])).next())})},r=this&&this.__generator||function(W,M){var N,P,V,j,z={label:0,sent:function(){if(1&V[0])throw V[1];return V[1]},trys:[],ops:[]};return j={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&(j[Symbol.iterator]=function(){return this}),j;function G(X){return function(re){return function(te){if(N)throw new TypeError("Generator is already executing.");for(;j&&(j=0,te[0]&&(z=0)),z;)try{if(N=1,P&&(V=2&te[0]?P.return:te[0]?P.throw||((V=P.return)&&V.call(P),0):P.next)&&!(V=V.call(P,te[1])).done)return V;switch(P=0,V&&(te=[2&te[0],V.value]),te[0]){case 0:case 1:V=te;break;case 4:return z.label++,{value:te[1],done:!1};case 5:z.label++,P=te[1],te=[0];continue;case 7:te=z.ops.pop(),z.trys.pop();continue;default:if(!((V=(V=z.trys).length>0&&V[V.length-1])||te[0]!==6&&te[0]!==2)){z=0;continue}if(te[0]===3&&(!V||te[1]>V[0]&&te[1]<V[3])){z.label=te[1];break}if(te[0]===6&&z.label<V[1]){z.label=V[1],V=te;break}if(V&&z.label<V[2]){z.label=V[2],z.ops.push(te);break}V[2]&&z.ops.pop(),z.trys.pop();continue}te=M.call(W,z)}catch(oe){te=[6,oe],P=0}finally{N=V=0}if(5&te[0])throw te[1];return{value:te[0]?te[1]:void 0,done:!0}}([X,re])}}},a=this&&this.__spreadArray||function(W,M,N){if(N||arguments.length===2)for(var P,V=0,j=M.length;V<j;V++)!P&&V in M||(P||(P=Array.prototype.slice.call(M,0,V)),P[V]=M[V]);return W.concat(P||Array.prototype.slice.call(M))},t=this&&this.__importDefault||function(W){return W&&W.__esModule?W:{default:W}};Object.defineProperty(v,"__esModule",{value:!0}),v.PeerConnectionCore=v.DEFAULT_HEARTBEAT_INTERVAL=v.EDatachannelStatus=void 0;var n=u(887),c=u(248),p=u(237),C=u(619),x=u(628),y=u(961),E=u(844),S=u(651);Object.defineProperty(v,"EDatachannelStatus",{enumerable:!0,get:function(){return S.EDatachannelStatus}});var d,R=u(854),D=t(u(885)),A=u(132),b=t(u(123)),g=u(125),O="rts video",k="rts audio";v.DEFAULT_HEARTBEAT_INTERVAL=2500,function(W){W.SUB_ADD="subsribe add",W.SUB_DELETE="subscribe delete",W.SUB_ACTIVE="subscribe active",W.SUB_STOP="subscribe stop",W.PUB_ADD="publish add",W.PUB_DELETE="publish delete",W.PUB_REPLACE="publish replace",W.PUB_STOP="publish stop",W.DATACHANNEL_SUB_ADD="sub add datachannel",W.DATACHANNEL_SUB_ACTIVE="sub active datachannel",W.DATACHANNEL_SUB_STOP="sub delete datachannel",W.DATACHANNEL_PUB_ADD="pub add datachannel",W.DATACHANNEL_PUB_STOP="pub delete datachannel"}(d||(d={}));var U=function(W){function M(N){var P=W.call(this)||this;return P.PCCore=N,P}return i(M,W),M.prototype.excuteSignal=function(N,P,V,j){var z=this;switch(N){case d.SUB_ADD:this.PCCore.proceedSubscribeAdd(j.configList,j.reconnecting).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.SUB_DELETE:this.PCCore.proceedSubscribeDeleteTracks(j.configList,j.skipError).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.SUB_ACTIVE:break;case d.SUB_STOP:this.PCCore.proceedSubscribeStop(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_ADD:this.PCCore.proceedPublishAdd(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_REPLACE:this.PCCore.proceedPublishReplaceTracks(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_DELETE:this.PCCore.proceedPublishDeleteTracks(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.PUB_STOP:this.PCCore.proceedPublishStop(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_SUB_ADD:this.PCCore.proceedSubscribeAddDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_SUB_STOP:this.PCCore.proceedSubscribeStopDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_PUB_ADD:this.PCCore.proceedPublishAddDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")});break;case d.DATACHANNEL_PUB_STOP:this.PCCore.proceedPublishStopDatachannel(j.configList).then(function(G){P(G)}).catch(function(G){V(G)}).finally(function(){z.emit("onSignalDone")})}},M}(D.default),w=function(W){function M(N){var P=W.call(this)||this;return P.heartbeatTimelineMap=new Map,P.removeTwcc=!1,P.mutex=!1,P.eventQueue=new R.CacheBuffer("signal queue"),P.signalTimer=null,P.rollbackController=new A.PeerConnectionRollbackController(P),P.onInnerSubscribeDelete=function(){},P.receiverCodecPreferences={},P.senderCodecPreferences={},P.removeTrackListener=function(){},P.heartbeatTimerHandle=null,P.heartbeatTokenRing=0,P.streamManager=new x.StreamManager,N.pc?(P.pc=N.pc,P.signal=new C.Signal({pc:N.pc,onDatachannelEvent:N.onDatachannelEvent,delayOpen:N.delayOpen}),P.heartbeatProcessor=new b.default(P.signal.getDatachannelCore().getWebrtcDatachannel(),P.streamManager),P.initHeartbeatListener(),P.notifyProcessor=new g.NotifyProcessor,P.initNotifyListener(),P.onInnerSubscribeDelete=N.onInnerSubscribeDelete||function(){},P.offerSdpHook=N.offerSdpHook,P.answerSdpHook=N.answerSdpHook,P):(console.error("peerconnetion is required"),P)}return i(M,W),M.prototype.getStreamManager=function(){return this.streamManager},M.prototype.getSignal=function(){return this.signal},M.prototype.setPrevOfferSdp=function(N){this.prevOfferSdp=N},M.prototype.setPrevAnswerSdp=function(N){this.prevAnswerSdp=N},M.prototype.setStreamManager=function(N){this.streamManager=N},M.prototype.getTrackIds=function(N){return N.reduce(function(P,V){return a(a([],P,!0),[V.id],!1)},[])},M.prototype.setRemoveTwcc=function(N){this.removeTwcc=N},M.prototype.setReceiverCodecPreferences=function(N){this.receiverCodecPreferences=e({},N)},M.prototype.setSenderCodecPreferences=function(N){this.senderCodecPreferences=e({},N)},M.prototype.subscribeAdd=function(N,P){var V=this;return new Promise(function(j,z){var G=new U(V);if(V.mutex){var X={type:d.SUB_ADD,excuter:G,res:j,rej:z,data:{configList:N}};V.eventQueue.cache(X)}else V.atomSignalExec(d.SUB_ADD,G,j,z,{configList:N,reconnecting:P})})},M.prototype.subscribeDeleteTracks=function(N,P){var V=this;return new Promise(function(j,z){var G=new U(V);if(V.mutex){var X={type:d.SUB_DELETE,excuter:G,res:j,rej:z,data:{configList:N,skipError:P}};V.eventQueue.cache(X)}else V.atomSignalExec(d.SUB_DELETE,G,j,z,{configList:N,skipError:P})})},M.prototype.subscribeStop=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.SUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.SUB_STOP,z,V,j,{configList:N})})},M.prototype.publishAdd=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_ADD,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_ADD,z,V,j,{configList:N})})},M.prototype.publishReplaceTracks=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_REPLACE,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_REPLACE,z,V,j,{configList:N})})},M.prototype.publishDeleteTracks=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_DELETE,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_DELETE,z,V,j,{configList:N})})},M.prototype.publishStop=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.PUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.PUB_STOP,z,V,j,{configList:N})})},M.prototype.subscribeAddDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_SUB_ADD,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_SUB_ADD,z,V,j,{configList:N})})},M.prototype.subscribeStopDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_SUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_SUB_STOP,z,V,j,{configList:N})})},M.prototype.publishAddDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_PUB_ADD,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_PUB_ADD,z,V,j,{configList:N})})},M.prototype.publishStopDatachannel=function(N){var P=this;return new Promise(function(V,j){var z=new U(P);if(P.mutex){var G={type:d.DATACHANNEL_PUB_STOP,excuter:z,res:V,rej:j,data:{configList:N}};P.eventQueue.cache(G)}else P.atomSignalExec(d.DATACHANNEL_PUB_STOP,z,V,j,{configList:N})})},M.prototype.atomSignalExec=function(N,P,V,j,z){var G=this;this.mutex=!0,P.once("onSignalDone",function(){G.eventQueue.isEmpty()?G.mutex=!1:setTimeout(function(){var X=G.eventQueue.getFirst();G.atomSignalExec(X.type,X.excuter,X.res,X.rej,X.data)})}),P.excuteSignal(N,V,j,z)},M.prototype.proceedSubscribeAdd=function(N,P){return o(this,void 0,void 0,function(){var V,j,z,G,X,re,te,oe,ue,se=this;return r(this,function(ce){switch(ce.label){case 0:if(this.log("SUB LIST: ",N),V=new Date().getTime(),j=new Date().getTime(),z=new Date().getTime(),G=this,X=this.extendUrl(N),re=X.map(function(de){var pe=de.urlData,he=de.vMsid,Ee=de.aMsid;if(se.streamManager.has(pe.url)){var fe=se.streamManager.get(pe.url),me=fe.videoInfoList.map(function(Te){return Te.msid}),ge=fe.audioInfoList.map(function(Te){return Te.msid}),be=(0,n.intersection)(me,he),Re=(0,n.intersection)(ge,Ee);if(Re.length||be.length)return{url:pe.url,vMsid:be,aMsid:Re}}}).filter(function(de){return de}),this.log("DELETE LIST: ",re),te=[],!re?.length)return[3,4];ce.label=1;case 1:return ce.trys.push([1,3,,4]),[4,this.proceedSubscribeDeleteTracks(re,!0,P)];case 2:return te=ce.sent(),this.onInnerSubscribeDelete&&this.onInnerSubscribeDelete(re),[3,4];case 3:throw oe=ce.sent(),(ue=oe).extraInfo=e(e({},ue.extraInfo),{api:"subscribeAdd",signal_api:"subscribeDeleteTracks",configList:N}),ue;case 4:return V=new Date().getTime(),[2,new Promise(function(de,pe){return o(se,void 0,void 0,function(){function he(){return o(this,void 0,void 0,function(){var K,q;return r(this,function(Q){switch(Q.label){case 0:G.removeTrackListener(),K=G.buildUrlStreamMap(X),Q.label=1;case 1:return Q.trys.push([1,3,,4]),[4,G.subscribeActive(N)];case 2:return Q.sent(),[3,4];case 3:return(q=Q.sent()).extraInfo=e(e({},q.extraInfo),{api:"subscribeAdd",signal_api:"subscribeActive"}),G.rollbackController.rollback({pcTransceiversRollback:!0,streamManagerRollback:!0}),[2,pe(q)];case 4:return j=new Date().getTime(),de({deleteRspTime:V,subAddRspTime:z,activeRspTime:j,streamList:K}),[2]}})})}var Ee,fe,me,ge,be,Re,Te,Pe,Oe,Ae,_e,xe,Me,Ie,ke,Ue,De,I=this;return r(this,function(K){switch(K.label){case 0:if(!this.pc)return[2,pe(new y.RtsError(E.ErrorCode.CORE_NO_PC_ERROR,"subscribeAdd: no peerconnection",""))];this.pc.addEventListener("track",he),this.removeTrackListener=function(){var q;(q=I.pc)===null||q===void 0||q.removeEventListener("track",he)},this.rollbackController.saveStreamManager(this.streamManager),Ee=[],X.forEach(function(q){var Q,Z,ee=q.urlData,J=q.vMsid,ie=q.aMsid;if(I.pc){if(I.streamManager.init(ee.url),ee.subVideo&&!I.streamManager.isMsidSubPubDone(ee.url,{vMsid:J[0]})){var ne=I.pc.addTransceiver("video",{direction:"recvonly"});Ee.push({type:"video",msid:J[0],trans:ne});var ae=(Q=te.find(function(ve){return ve.vMsid===J[0]}))===null||Q===void 0?void 0:Q.vStream;I.streamManager.update(ee.url,{vMsid:J[0],vTransceiver:ne,stream:ae,cumuDelay:I.cumuDelay}),I.setCodecPreferences(ne,I.receiverCodecPreferences.video)}if(ee.subAudio&&!I.streamManager.isMsidSubPubDone(ee.url,{aMsid:ie[0]})){var le=I.pc.addTransceiver("audio",{direction:"recvonly"});Ee.push({type:"audio",msid:ie[0],trans:le}),ae=(Z=te.find(function(ve){return ve.aMsid===ie[0]}))===null||Z===void 0?void 0:Z.aStream,I.streamManager.update(ee.url,{aMsid:ie[0],aTransceiver:le,stream:ae}),I.setCodecPreferences(le,I.receiverCodecPreferences.audio)}}}),this.rollbackController.setFakeSdpMedias(Ee,"sub"),K.label=1;case 1:return K.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return fe=K.sent(),[3,4];case 3:return me=K.sent(),[2,pe(new y.RtsError(E.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(me),"",{api:"subscribeAdd",err:me}))];case 4:if(ge=new c.SdpUtil({sdp:fe.sdp||""}),this.restorePublishedSsrc(ge),ge.addNack(),ge.updateBundle(),fe=new RTCSessionDescription({type:"offer",sdp:ge.generate()}),be=this.findNewSubPubMids(fe?.sdp||"",this.prevOfferSdp||""),this.setPrevOfferSdp(fe.sdp||""),this.rollbackController.setFakeSdpMids(be),Re=this.avoidMsidConflict(fe.sdp),this.offerSdpHook)try{Re=this.offerSdpHook(Re)}catch(q){console.log("offerSdpHook error: ",q)}K.label=5;case 5:return K.trys.push([5,7,,9]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:Re}))];case 6:return K.sent(),[3,9];case 7:return Te=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 8:return K.sent(),[2,pe(new y.RtsError(E.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(Te),"",{api:"subscribeAdd",sdp:fe}))];case 9:if(Pe=[],Oe=[],X.forEach(function(q){var Q=new c.SdpUtil({sdp:fe?.sdp||""}),Z=[],ee=q.vMsid.length!==0,J=q.aMsid.length!==0,ie=!1,ne=!1;Q.detail.media.forEach(function(le){var ve=String(le.mid);be.includes(ve)&&(Oe.includes(ve)||(le.type==="video"&&ee&&!ie?(Z.push(String(le.mid)),ie=!0):le.type==="audio"&&J&&!ne&&(Z.push(String(le.mid)),ne=!0)))}),Oe=a(a([],Oe,!0),Z,!0),Q.keepMedia(Z);var ae=Q.generate();I.cumuDelay&&(ae=ae.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
|
|
25
25
|
`)),Pe.push(ae)}),this.log("ADD LIST: ",X),this.offerSdpHook)try{Pe=Pe.map(function(q){return I.offerSdpHook(q)})}catch(q){console.log("offerSdpHook error: ",q)}K.label=10;case 10:return K.trys.push([10,12,,14]),[4,(De=this.signal)===null||De===void 0?void 0:De.subscribeAdd(X,Pe,this.streamManager)];case 11:return Ae=K.sent(),[3,14];case 12:return _e=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 13:return K.sent(),_e.extraInfo=e({api:"subscribeAdd",signal_api:"subscribeAdd"},_e.extraInfo),[2,pe(_e)];case 14:if(xe=[],Ae.streams.forEach(function(q,Q){I.log("Sub TraceId[".concat(Q,"]: "),q.traceid);var Z=new c.SdpUtil({sdp:q.sdp});xe=a(a([],xe,!0),Z.detail.media,!0);var ee=X.find(function(J){return J.urlData.url===q.url});ee&&(ee.traceId=q.traceid,ee.urlTraceId=q.url_traceid)}),(Me=new c.SdpUtil({sdp:this.prevAnswerSdp||""})).addOrUpdateMedia(xe),this.alignAnswerMidsWithOffer(Me),Ie=Me.generate(),this.setPrevAnswerSdp(Ie),ke=this.avoidMsidConflict(Ie),this.answerSdpHook)try{ke=this.answerSdpHook(ke)}catch(q){console.log("answerSdpHook error: ",q)}K.label=15;case 15:return K.trys.push([15,17,,19]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:ke}))];case 16:return K.sent(),X.forEach(function(q){I.streamManager.markAlreadySubPub(q.urlData.url,{vMsid:q.vMsid[0],aMsid:q.aMsid[0]})}),[3,19];case 17:return Ue=K.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0})];case 18:return K.sent(),[2,pe(new y.RtsError(E.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(Ue),"",{api:"subscribeAdd",sdp:Ie}))];case 19:return z=new Date().getTime(),[2]}})})})]}})})},M.prototype.subscribeActive=function(N){var P;return o(this,void 0,void 0,function(){return r(this,function(V){return[2,(P=this.signal)===null||P===void 0?void 0:P.subscribeActive(this.extendUrl(N))]})})},M.prototype.proceedSubscribeDeleteTracks=function(N,P,V){var j,z,G,X;return o(this,void 0,void 0,function(){var re,te,oe,ue,se,ce,de,pe=this;return r(this,function(he){switch(he.label){case 0:N.forEach(function(Ee){Ee.rawUrl=Ee.url,Ee.url=pe.streamManager.getOriginUrl(Ee.url)}),re=!1,te=!!P,oe=void 0,he.label=1;case 1:return he.trys.push([1,3,,4]),[4,(j=this.signal)===null||j===void 0?void 0:j.subscribeDelete(N)];case 2:return he.sent(),[3,4];case 3:return ue=he.sent(),re=(oe=ue).errorCode===E.ErrorCode.DATACHANNEL_RESPONSE_ERROR&&((G=(z=oe.extraInfo)===null||z===void 0?void 0:z.parsedData)===null||G===void 0?void 0:G.streams)&&((X=oe.extraInfo.parsedData.streams[0])===null||X===void 0?void 0:X.res_code)===404,[3,4];case 4:if(oe&&!re)throw oe.extraInfo=e({api:"subscribeDeleteTracks"},oe.extraInfo),oe;return se=te&&re,ce=[],de=N.map(function(Ee){var fe=Ee.url,me=Ee.vMsid,ge=Ee.aMsid,be=Ee.rawUrl;return o(pe,void 0,void 0,function(){var Re,Te,Pe,Oe,Ae,_e,xe,Me,Ie,ke;return r(this,function(Ue){switch(Ue.label){case 0:fe=(0,n.pruneSubUrl)(fe),this.streamManager.has(fe)&&(me&&(Pe=this.streamManager.getTransceiver(fe,{vMsid:me[0]}))&&(Te=Pe.receiver.track).stop(),ge&&(Oe=this.streamManager.getTransceiver(fe,{aMsid:ge[0]}))&&(Re=Oe.receiver.track).stop()),Ue.label=1;case 1:return Ue.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return Ue.sent(),[3,4];case 3:throw(Ae=Ue.sent()).extraInfo=e({api:"subscribeDeleteTracks"},Ae.extraInfo),Ae;case 4:return Te&&(_e=this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0]}),(Ie=_e?.mediastream)===null||Ie===void 0||Ie.removeTrack(Te)),Re&&(xe=this.streamManager.getStreamByMsid({url:fe,aMsid:ge?.[0]}),(ke=xe?.mediastream)===null||ke===void 0||ke.removeTrack(Re)),V||this.streamManager.pruneStreamList(fe),this.streamManager.removeMsid(fe,{vMsid:me?.length?this.unifyMsid(me,"video"):void 0,aMsid:ge?.length?this.unifyMsid(ge,"audio"):void 0}),Me={url:be||"",stream:this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0],aMsid:ge?.[0]})},V&&(Me=e(e({},Me),{vStream:_e,aStream:xe,vMsid:me?.[0],aMsid:ge?.[0]})),ce.push(Me),[2]}})})}),[4,Promise.all(de)];case 5:if(he.sent(),!se&&oe)throw oe.extraInfo=e({api:"subscribeDeleteTracks"},oe.extraInfo),oe;return[2,ce]}})})},M.prototype.proceedSubscribeStop=function(N){var P;return o(this,void 0,void 0,function(){var V,j,z=this;return r(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,3]),[4,(P=this.signal)===null||P===void 0?void 0:P.subscribeStop(this.extendUrl(N))];case 1:return G.sent(),[3,3];case 2:throw(V=G.sent()).extraInfo=e({api:"subscribeStop"},V.extraInfo),V;case 3:return N.forEach(function(X){X.rawUrl=X.url,X.url=z.streamManager.getOriginUrl(X.url)}),j=N.map(function(X){var re=X.url;return X.rawUrl,X.targetStreams,o(z,void 0,void 0,function(){var te;return r(this,function(oe){switch(oe.label){case 0:re=(0,n.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(ue){var se;(se=ue?.receiver.track)===null||se===void 0||se.stop()}),this.streamManager.get(re).streamList.forEach(function(ue){return ue.release()}),this.streamManager.remove(re),oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return oe.sent(),[3,4];case 3:throw(te=oe.sent()).extraInfo=e({api:"subscribeStop"},te.extraInfo),te;case 4:return[2]}})})}),[4,Promise.all(j)];case 4:return G.sent(),[2]}})})},M.prototype.proceedPublishAdd=function(N){var P;return o(this,void 0,void 0,function(){var V,j,z,G,X,re,te,oe,ue,se,ce,de,pe,he,Ee,fe,me,ge,be,Re,Te,Pe,Oe,Ae,_e,xe,Me,Ie,ke,Ue=this;return r(this,function(De){switch(De.label){case 0:if(N.length>1)throw console.error("Only one stream is supported."),new y.RtsError(E.ErrorCode.CORE_PUBLIST_EXCEED_ERROR,"publishAdd: publishList exceed limit","",{api:"publishAdd"});if(!this.pc)throw new y.RtsError(E.ErrorCode.CORE_NO_PC_ERROR,"publishAdd: no peerconnection","",{api:"publishAdd"});V=N[0],j=V.stream,z=this.unifyMsid(V.aMsid,"audio"),G=this.unifyMsid(V.vMsid,"video"),V.rawUrl=V.url,V.url=this.streamManager.getOriginUrl(V.url),typeof V.updateSourceStream!="boolean"&&(V.updateSourceStream=!0),X=j.videoTrack,re=j.audioTrack,this.rollbackController.saveStreamManager(this.streamManager),te=[],oe=this.streamManager.getStreamByMsid({url:V.url,vMsid:G,aMsid:z}),this.streamManager.init(V.url,x.EStreamType.Publish),X&&(ue=this.pc.addTransceiver(j.videoTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{vMsid:G,vTransceiver:ue,stream:j,cumuDelay:this.cumuDelay}),te.push({type:"video",trans:ue,msid:G}),this.setCodecPreferences(ue,this.senderCodecPreferences.video)),re&&(ue=this.pc.addTransceiver(j.audioTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{aMsid:z,aTransceiver:ue,stream:j}),te.push({type:"audio",trans:ue,msid:z}),this.setCodecPreferences(ue,this.senderCodecPreferences.audio)),this.rollbackController.setFakeSdpMedias(te,"pub"),De.label=1;case 1:return De.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return se=De.sent(),[3,4];case 3:throw ce=De.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(ce),"",{api:"publishAdd",err:ce});case 4:if(de=new c.SdpUtil({sdp:se.sdp||""}),pe=this.parseMsidString(G),he=this.parseMsidString(z),Ee=this.findNewSubPubMids(se.sdp||"",this.prevOfferSdp||""),this.rollbackController.setFakeSdpMids(Ee),pe.stream&&de.detail.msidSemantic&&(de.detail.msidSemantic.token=pe.stream),fe=de.detail.media.reduce(function(I,K){return K.direction==="inactive"?a(a([],I,!0),[String(K.mid)],!1):I},[]),de.detail.media.forEach(function(I){var K;if(I.direction!=="recvonly"&&I.type!=="application"&&Ee.includes(String(I.mid))){var q=I.type==="video"?pe:he,Q=Ue.parseMsidString(I.msid);Q.stream=q.stream||Q.stream,Q.track=q.track||Q.track;var Z=Ue.stringifyMsid(Q);I.msid=Z,(K=I.ssrcs)===null||K===void 0||K.forEach(function(ee){switch(ee.attribute){case"cname":case"label":ee.value=q.track||ee.value;break;case"msid":ee.value=Z;break;case"mslabel":ee.value=q.stream||ee.value}})}}),this.restorePublishedSsrc(de),this.restorePublishMsid(de),de.addNack(),me=de.generate(),this.setPrevOfferSdp(me),ge=this.avoidMsidConflict(me),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(I){console.log("offerSdoHook error: ",I)}De.label=5;case 5:return De.trys.push([5,7,,8]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:ge}))];case 6:return De.sent(),[3,8];case 7:throw be=De.sent(),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(be),"",{api:"publishAdd",sdp:me});case 8:if(de.keepMedia(Ee),this.updateTrackInfoList({url:V.rawUrl,stream:V.stream,vMsid:G,aMsid:z,sdpMediaList:de.detail.media}),ge=de.generate(),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(I){console.log("offerSdpHook error: ",I)}De.label=9;case 9:return De.trys.push([9,11,,12]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishAdd([V.url],[ge],[X?[this.stringifyMsid(pe)]:[]],[re?[this.stringifyMsid(he)]:[]])];case 10:return Re=De.sent(),[3,12];case 11:throw Te=De.sent(),(Pe=Te).extraInfo=e({api:"publishAdd"},Pe.extraInfo),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),Pe;case 12:if(Oe=Re.streams[0],V.traceId=Oe.traceid,V.urlTraceId=Oe.url_traceid,this.log("Pub TraceId: ",V.traceId),(Ae=new c.SdpUtil({sdp:Oe.sdp})).detail.media.forEach(function(I){I.type!=="application"&&I.direction==="sendrecv"&&(I.direction="recvonly")}),(_e=new c.SdpUtil({sdp:this.prevAnswerSdp||""})).detail.media.forEach(function(I){I.type==="application"&&(delete I.candidates,delete I.endOfCandidates)}),_e.setMediaInactive(fe),_e.addOrUpdateMedia(Ae.detail.media,{isPublish:!0}),this.alignAnswerMidsWithOffer(_e),this.removeTwcc&&(xe=["http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"],_e.detail.media.forEach(function(I){var K;I.ext=(K=I.ext)===null||K===void 0?void 0:K.filter(function(q){return!xe.includes(q.uri)})})),Me=_e.generate(),this.setPrevAnswerSdp(Me),Ie=this.avoidMsidConflict(Me),this.answerSdpHook)try{Ie=this.answerSdpHook(Ie)}catch(I){console.log("answerSdpHook error: ",I)}De.label=13;case 13:return De.trys.push([13,15,,16]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Ie}))];case 14:return De.sent(),this.streamManager.markAlreadySubPub(V.url,{vMsid:G,aMsid:z,isPub:!0}),[3,16];case 15:throw ke=De.sent(),this.rollbackController.rollback({streamManagerRollback:!0}),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(ke),"",{api:"publishAdd",sdp:Me});case 16:return oe&&V.updateSourceStream&&oe.mergeStream(j),[2,N.map(function(I){return{url:I.rawUrl,trackInfoList:Ue.streamManager.getAllMediaInfoList(V.url),traceId:I.traceId,urlTraceId:I.urlTraceId}})]}})})},M.prototype.proceedPublishDeleteTracks=function(N){var P,V,j,z,G,X,re;return o(this,void 0,void 0,function(){var te,oe,ue,se,ce,de,pe,he,Ee,fe,me=this;return r(this,function(ge){switch(ge.label){case 0:N.forEach(function(be){be.rawUrl=be.url,be.url=me.streamManager.getOriginUrl(be.url)}),ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishDelete(N)];case 2:return ge.sent(),[3,4];case 3:throw(te=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},te.extraInfo),te;case 4:if(oe=N[0],ue=(0,n.pruneSubUrl)(oe.url),typeof oe.updateSourceStream!="boolean"&&(oe.updateSourceStream=!0),se=!1,ce=!1,!this.streamManager.has(ue))return[3,9];!((V=oe.vMsid)===null||V===void 0)&&V.length&&((de=this.streamManager.getTransceiver(ue,{vMsid:oe.vMsid[0]}))!=null&&de.sender&&((j=this.pc)===null||j===void 0||j.removeTrack(de?.sender)),se=!0),!((z=oe.aMsid)===null||z===void 0)&&z.length&&((pe=this.streamManager.getTransceiver(ue,{aMsid:oe.aMsid[0]}))!=null&&pe.sender&&((G=this.pc)===null||G===void 0||G.removeTrack(pe?.sender)),ce=!0),ge.label=5;case 5:return ge.trys.push([5,7,,8]),[4,this.simulateOfferAnswer()];case 6:return ge.sent(),[3,8];case 7:throw(he=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},he.extraInfo),he;case 8:return(Ee=this.streamManager.getStreamByMsid({url:ue,vMsid:(X=oe.vMsid)===null||X===void 0?void 0:X[0],aMsid:(re=oe.aMsid)===null||re===void 0?void 0:re[0]}))&&oe.updateSourceStream&&Ee.deleteTracks({video:se,audio:ce}),this.streamManager.removeMsid(ue,{vMsid:se?this.unifyMsid(oe.vMsid,"video"):void 0,aMsid:ce?this.unifyMsid(oe.aMsid,"audio"):void 0}),this.streamManager.pruneStreamList(ue),fe=this.streamManager.getAllMediaInfoList(oe.url),[2,N.map(function(be){return{url:be.rawUrl,trackInfoList:fe}})];case 9:return[2]}})})},M.prototype.proceedPublishReplaceTracks=function(N){var P,V,j,z,G;return o(this,void 0,void 0,function(){var X,re,te,oe,ue,se,ce,de,pe,he,Ee=this;return r(this,function(fe){switch(fe.label){case 0:if(X=N[0],re=X.stream,te=X.vMsid,oe=X.aMsid,X.rawUrl=X.url,X.url=this.streamManager.getOriginUrl(X.url),!this.streamManager.has(X.url))throw new y.RtsError(E.ErrorCode.CORE_PUB_REPLACE_URL_NOT_FOUND,"No stream found for this url: ".concat(X.url),"",{api:"publishReplaceTracks",configList:N});return typeof X.updateSourceStream!="boolean"&&(X.updateSourceStream=!0),ue=re.audioTrack,se=re.videoTrack,ce=this.streamManager.getAllMediaInfoList(X.url,!0),ue&&(pe=(P=ce.find(function(me){return me.type==="audio"&&(!oe||me.msid===oe)}))===null||P===void 0?void 0:P.transceiver)&&ue.id!==((j=(V=pe.sender)===null||V===void 0?void 0:V.track)===null||j===void 0?void 0:j.id)?[4,pe.sender.replaceTrack(ue)]:[3,2];case 1:fe.sent(),fe.label=2;case 2:return se?(de=ce.find(function(me){return me.type==="video"&&(!te||me.msid===te)}),(pe=de?.transceiver)&&se.id!==((G=(z=pe.sender)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.id)?[4,pe.sender.replaceTrack(se)]:[3,4]):[3,4];case 3:fe.sent(),re.isCustomStream||(de.from=re.hasScreen?"screen":"camera"),fe.label=4;case 4:return(he=this.streamManager.getStreamByMsid({url:X.url,vMsid:te,aMsid:oe}))&&X.updateSourceStream&&he.mergeStream(re),[2,N.map(function(me){return{url:me.rawUrl,trackInfoList:Ee.streamManager.getAllMediaInfoList(X.url)}})]}})})},M.prototype.proceedPublishStop=function(N){var P;return o(this,void 0,void 0,function(){var V,j,z=this;return r(this,function(G){switch(G.label){case 0:return G.trys.push([0,2,,3]),[4,(P=this.signal)===null||P===void 0?void 0:P.publishStop(N.map(function(X){return z.streamManager.getOriginUrl(X.url)}))];case 1:return G.sent(),[3,3];case 2:throw(V=G.sent()).extraInfo=e({api:"publishStop"},V.extraInfo),V;case 3:return j=N.map(function(X){var re=X.url;return o(z,void 0,void 0,function(){var te,oe=this;return r(this,function(ue){switch(ue.label){case 0:re=(0,n.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(se){var ce;se?.sender&&((ce=oe.pc)===null||ce===void 0||ce.removeTrack(se?.sender))}),this.streamManager.get(re).streamList.forEach(function(se){return se.deleteTracks({video:!0,audio:!0})}),this.streamManager.remove(re),ue.label=1;case 1:return ue.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return ue.sent(),[3,4];case 3:throw(te=ue.sent()).extraInfo=e({api:"publishStop"},te.extraInfo),te;case 4:return[2]}})})}),[4,Promise.all(j)];case 4:return G.sent(),[2]}})})},M.prototype.proceedSubscribeAddDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re,te,oe,ue=this;return r(this,function(se){switch(se.label){case 0:return se.trys.push([0,2,,3]),[4,(te=this.signal)===null||te===void 0?void 0:te.subscribeAddDatachannel(N)];case 1:return se.sent(),[3,3];case 2:return(G=se.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeAddDatachannel"},G.extraInfo),[2,z(G)];case 3:X={},se.label=4;case 4:return se.trys.push([4,6,,7]),[4,(oe=this.signal)===null||oe===void 0?void 0:oe.subscribeActiveDatachannel(N)];case 5:return X=se.sent(),[3,7];case 6:return(re=se.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeActiveDatachannel"},re.extraInfo),[2,z(re)];case 7:return N.forEach(function(ce){ue.streamManager.addOrUpdateDatachannelItem({type:"sub-data",url:(0,n.pruneSubUrl)(ce.url,!0),msids:[{name:ce.msid,id:ce.datachannelId,type:"data",label:ce.label,datachannel:ce.datachannel}],originUrl:ce.url,streams:[]})}),j(X),[2]}})})})]})})},M.prototype.proceedSubscribeStopDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re,te,oe,ue,se,ce=this;return r(this,function(de){switch(de.label){case 0:return de.trys.push([0,2,,3]),[4,(re=this.signal)===null||re===void 0?void 0:re.subscribeStopDatachannel(N)];case 1:return de.sent(),[3,3];case 2:return G=de.sent(),((se=(ue=(oe=(te=(X=G)==null?void 0:X.extraInfo)===null||te===void 0?void 0:te.parsedData)===null||oe===void 0?void 0:oe.streams)===null||ue===void 0?void 0:ue[0])===null||se===void 0?void 0:se.res_code)===404?[3,3]:(X.extraInfo=e({api:"subscribeStopDatachannel",signal_api:"subscribeStopDatachannel"},X.extraInfo),[2,z(G)]);case 3:return N.forEach(function(pe){ce.streamManager.deleteDatachannelItem({url:(0,n.pruneSubUrl)(pe.url,!0)})}),j(),[2]}})})})]})})},M.prototype.proceedPublishAddDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re,te=this;return r(this,function(oe){switch(oe.label){case 0:G={},oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,(re=this.signal)===null||re===void 0?void 0:re.publishAddDatachannel(N)];case 2:return G=oe.sent(),[3,4];case 3:return(X=oe.sent()).extraInfo=e({api:"publishAddDatachannel",signal_api:"publishAddDatachannel"},X.extraInfo),[2,z(X)];case 4:return N.forEach(function(ue){te.streamManager.addOrUpdateDatachannelItem({type:"pub-data",url:(0,n.pruneSubUrl)(ue.url,!0),msids:[{name:ue.msid,id:ue.datachannelId,type:"data",label:ue.label,datachannel:ue.datachannel}],originUrl:ue.url,streams:[]})}),j(G),[2]}})})})]})})},M.prototype.proceedPublishStopDatachannel=function(N){return o(this,void 0,void 0,function(){var P=this;return r(this,function(V){return[2,new Promise(function(j,z){return o(P,void 0,void 0,function(){var G,X,re=this;return r(this,function(te){switch(te.label){case 0:return te.trys.push([0,2,,3]),[4,(X=this.signal)===null||X===void 0?void 0:X.publishStopDatachannel(N)];case 1:return te.sent(),[3,3];case 2:return(G=te.sent()).extraInfo=e({api:"publishStopDatachannel",signal_api:"publishStopDatachannel"},G.extraInfo),[2,z(G)];case 3:return N.forEach(function(oe){re.streamManager.deleteDatachannelItem({url:(0,n.pruneSubUrl)(oe.url,!0)})}),j(),[2]}})})})]})})},M.prototype.buildUrlStreamMap=function(N){var P=this,V=[];return N.forEach(function(j){var z=j.urlData,G=j.traceId,X=j.urlTraceId,re=j.url,te=j.vMsid,oe=j.aMsid,ue=z.url,se=new MediaStream;P.streamManager.getAllMediaInfoList(ue,!0).forEach(function(ce){var de,pe;if(ce.type==="video"&&ce.msid===te[0]||ce.type==="audio"&&ce.msid===oe[0]){var he=(pe=(de=ce.transceiver)===null||de===void 0?void 0:de.receiver)===null||pe===void 0?void 0:pe.track;he&&se.addTrack(he)}}),V.push({url:re,stream:se,traceId:G,urlTraceId:X})}),V},M.prototype.extendUrl=function(N){var P=this;return N.map(function(V){var j=V.url,z=V.subAudio,G=V.subVideo,X=V.aMsid,re=V.vMsid,te=P.streamManager.getOriginUrl(j),oe=new p.UrlData({url:te,subAudio:z,subVideo:G});return e(e({},V),{urlData:oe,aMsid:oe.subAudio?X||[k]:[],vMsid:oe.subVideo?re||[O]:[]})})},M.prototype.parseSdp=function(N){return new c.SdpUtil({sdp:N})},M.prototype.getTrackInfoList=function(N,P,V){N===void 0&&(N=[]);var j=[];return N.forEach(function(z){var G,X,re,te;if(z.type!=="application"){var oe,ue=Number(z.ssrcs&&((G=z.ssrcs[0])===null||G===void 0?void 0:G.id))||-1,se=z.rtp.find(function(fe){var me;return["opus","h264"].includes((me=fe.codec)===null||me===void 0?void 0:me.toLowerCase())}),ce=se?.codec||"",de=se?.payload||0;P.isCustomStream||z.type==="video"&&(oe=P.hasScreen?"screen":"camera");var pe=z.msid;if(V?.aMsid||V?.vMsid){var he=(z.type==="video"?V.vMsid:V.aMsid)||"";he?.trim().includes(" ")||(pe=(X=z.msid)===null||X===void 0?void 0:X.split(" ")[1])}var Ee=z.type==="video"?(re=P.videoTrack)===null||re===void 0?void 0:re.id:(te=P.audioTrack)===null||te===void 0?void 0:te.id;j.push({ssrc:ue,codec:ce,type:z.type,pt:de,msid:pe,from:oe,trackId:Ee})}}),j},M.prototype.patchSubscribeStreamManagerRecord=function(N,P){var V=this;this.extendUrl([{url:N,vMsid:P.vMsid,aMsid:P.aMsid}]).forEach(function(j){var z=j.urlData,G=j.vMsid,X=j.aMsid;if(V.pc&&(V.cumuDelay=P.cumuDelay,V.streamManager.remove(z.url),V.streamManager.init(z.url),V.pc.getTransceivers)){var re=V.pc.getTransceivers()||[];if(z.subVideo){var te=re.find(function(ue){return ue.receiver.track.kind==="video"});V.streamManager.update(z.url,{vMsid:G[0],vTransceiver:te,stream:P.stream,cumuDelay:P.cumuDelay})}if(z.subAudio){var oe=re.find(function(ue){return ue.receiver.track.kind==="audio"});V.streamManager.update(z.url,{aMsid:X[0],aTransceiver:oe,stream:P.stream})}V.streamManager.markAlreadySubPub(N,{vMsid:G[0],aMsid:X[0],isPub:!1})}})},M.prototype.patchPublishStreamManagerRecord=function(N,P){if(this.pc){var V=P.stream,j=V.videoTrack,z=V.audioTrack,G=this.unifyMsid(P.aMsid,"audio"),X=this.unifyMsid(P.vMsid,"video");if(this.streamManager.init(N,x.EStreamType.Publish),this.cumuDelay=P.cumuDelay,this.pc.getTransceivers){var re=this.pc.getTransceivers()||[];if(j){var te=re.find(function(ue){var se,ce;return((ce=(se=ue.sender)===null||se===void 0?void 0:se.track)===null||ce===void 0?void 0:ce.id)===j.id});te&&this.streamManager.update(N,{vMsid:X,vTransceiver:te,stream:P.stream,cumuDelay:P.cumuDelay})}if(z){var oe=re.find(function(ue){var se,ce;return((ce=(se=ue.sender)===null||se===void 0?void 0:se.track)===null||ce===void 0?void 0:ce.id)===z.id});oe&&this.streamManager.update(N,{aMsid:G,aTransceiver:oe,stream:P.stream})}this.streamManager.markAlreadySubPub(N,{vMsid:X,aMsid:G,isPub:!0})}}},M.prototype.updateTrackInfoList=function(N){var P=N.url,V=N.stream,j=N.vMsid,z=N.aMsid,G=N.sdpMediaList;P||console.error("[updateTrackInfoList] url is required");var X=this.getTrackInfoList(G,V,{vMsid:j,aMsid:z}),re=X.find(function(oe){return oe.type==="video"}),te=X.find(function(oe){return oe.type==="audio"});return j&&re&&this.streamManager.updateSdpInfo(P,e({vMsid:j},re)),z&&te&&this.streamManager.updateSdpInfo(P,e({aMsid:z},te)),X},M.prototype.unifyMsid=function(N,P){var V=P==="video"?O:k;return N?.[0]||V},M.prototype.startSignalHeartbeatTimer=function(N){var P=this;N&&N<200?console.warn("PEER CORE: heartbeat interval ".concat(N," is too small and will not take effect. At least 200ms")):(this.stopSignalHeartbeatTimer(),this.heartbeatTimerHandle=setInterval(function(){var V=void 0,j=P.streamManager.getSize(),z=P.streamManager.getSubOrPubDoneMediaMapSize();if(P.heartbeatTokenRing%=j,P.heartbeatTokenRing<z){var G=P.heartbeatTokenRing,X=P.streamManager.getPubOrSubDoneMediaUrlByIndex(G);X&&(V=[]).push({url:X})}else if(P.heartbeatTokenRing<j){G=P.heartbeatTokenRing-z;var re=P.streamManager.getDcUrlByIndex(G);re&&(V=[]).push(re)}P.heartbeatTokenRing++,P.heartbeatTokenRing%=j,P.sendOnceHeartbeat(V)},N||v.DEFAULT_HEARTBEAT_INTERVAL))},M.prototype.stopSignalHeartbeatTimer=function(){this.heartbeatTimerHandle!==null&&clearInterval(this.heartbeatTimerHandle),this.heartbeatTimerHandle=null},M.prototype.sendOnceHeartbeat=function(N){var P,V=(P=this.signal)===null||P===void 0?void 0:P.sendHeartbeat(N);V&&(this.hebtLog(">>> Send: heartbeat",V),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},M.prototype.sendFalseHeartbeat=function(N){var P,V=(P=this.signal)===null||P===void 0?void 0:P.sendFalseHeartbeat(N);V&&(this.hebtLog(">>> Send: false heartbeat",N),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},M.prototype.dispose=function(){var N,P;this.pc=void 0,this.prevOfferSdp=void 0,this.prevAnswerSdp=void 0,(N=this.signal)===null||N===void 0||N.dispose(),(P=this.streamManager)===null||P===void 0||P.dispose(),this.stopSignalHeartbeatTimer()},M.prototype.initHeartbeatListener=function(){var N,P,V,j,z,G,X,re=this;(N=this.heartbeatProcessor)===null||N===void 0||N.on("pcReconnect",function(te){re.emit("pcReconnect",te)}),(P=this.heartbeatProcessor)===null||P===void 0||P.on("streamError",function(te){re.emit("streamError",te)}),(V=this.heartbeatProcessor)===null||V===void 0||V.on("streamReconnect",function(te){re.emit("streamReconnect",te)}),(j=this.heartbeatProcessor)===null||j===void 0||j.on("traceIdUpdate",function(te){re.emit("traceIdUpdate",te)}),(z=this.heartbeatProcessor)===null||z===void 0||z.on("hebtReceived",function(te){if(te){var oe=re.heartbeatTimelineMap.get(te.msg_id)||0;re.heartbeatTimelineMap.delete(te.msg_id),re.hebtLog("<<< Received: heartbeat","".concat(Math.ceil(performance.now()-oe),"ms"),te)}re.emit("hebtReceived",te)}),(G=this.heartbeatProcessor)===null||G===void 0||G.on("datachannelNotEnabled",function(){re.emit("datachannelNotEnabled")}),(X=this.signal)===null||X===void 0||X.getDatachannelCore().on("message",function(te){var oe;(oe=re.heartbeatProcessor)===null||oe===void 0||oe.process(te)})},M.prototype.initNotifyListener=function(){var N,P,V,j=this;(N=this.notifyProcessor)===null||N===void 0||N.on("pcReconnect",function(z){j.emit("pcReconnect",z)}),(P=this.notifyProcessor)===null||P===void 0||P.on("message",function(z){j.emit("message",z)}),(V=this.signal)===null||V===void 0||V.getDatachannelCore().on("message",function(z){var G,X;(G=j.notifyProcessor)===null||G===void 0||G.processIpMigration(z),(X=j.notifyProcessor)===null||X===void 0||X.processInternalException(z)})},M.prototype.findNewSubPubMids=function(N,P){var V=new c.SdpUtil({sdp:N}),j=new c.SdpUtil({sdp:P}),z=V.detail.media.filter(function(X){return X.direction!=="inactive"}).map(function(X){return X.mid}),G=j.detail.media.map(function(X){return X.mid});return this.findDiff(z,G).map(function(X){return String(X)})},M.prototype.findDiff=function(N,P){return Array.from(new Set(a([],N,!0).filter(function(V){return!P.includes(V)})))},M.prototype.parseMsidString=function(N){var P={stream:"",track:""};if(!N)return P;var V=N.trim().split(" "),j=V[0],z=V[1];return z?(P.stream=j,P.track=z):P.track=j,P},M.prototype.stringifyMsid=function(N){var P=N.stream,V=N.track;return"".concat(P).concat(P?" ":"").concat(V)},M.prototype.restorePublishedSsrc=function(N){var P=new c.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishSsrcs();N.detail.media.forEach(function(V){var j;V.direction!=="recvonly"&&((j=V.ssrcs)===null||j===void 0||j.forEach(function(z){var G,X=(G=P.find(function(re){return re.mid===String(V.mid)}))===null||G===void 0?void 0:G.ssrc;X&&(z.id=String(X))}))})},M.prototype.restorePublishMsid=function(N){var P=this,V=new c.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishMsids();V?.length&&N.detail.media.forEach(function(j){var z,G;if(j.direction!=="recvonly"){var X=(z=V.find(function(te){return te.mid===String(j.mid)}))===null||z===void 0?void 0:z.msid;if(!X)return;var re=P.parseMsidString(X);j.msid=X||j.msid,(G=j.ssrcs)===null||G===void 0||G.forEach(function(te){switch(te.attribute){case"cname":te.value=re.track||te.value;break;case"msid":te.value=X||te.value}})}})},M.prototype.alignAnswerMidsWithOffer=function(N){var P=new c.SdpUtil({sdp:this.prevOfferSdp||""}).detail.media.map(function(G){return String(G.mid)}),V=N.detail.media.map(function(G){return String(G.mid)}),j=this.findDiff(V,P);N.removeMedia(j);var z=[];P.forEach(function(G){var X=N.detail.media.find(function(re){return String(re.mid)===G});X&&z.push(X)}),N.detail.media=z.filter(function(G){return G})},M.prototype.simulateOfferAnswer=function(N){var P,V,j;return o(this,void 0,void 0,function(){var z,G,X,re,te,oe,ue,se,ce,de,pe,he,Ee;return r(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,2,,3]),[4,(P=this.pc)===null||P===void 0?void 0:P.createOffer()];case 1:return z=fe.sent(),G=new c.SdpUtil({sdp:z?.sdp||""}),X=G.detail.media.filter(function(me){return me.direction==="inactive"}).map(function(me){return String(me.mid)}),this.restorePublishedSsrc(G),this.restorePublishMsid(G),this.prevOfferSdp=G.generate(),(re=new c.SdpUtil({sdp:this.prevAnswerSdp||""})).setMediaInactive(X),N&&(te=(0,c.generateFakeMediaSdpAnswer)(N))&&(oe=new c.SdpUtil({sdp:te}),ue=a([],oe.detail.media,!0),re.addOrUpdateMedia(ue),this.alignAnswerMidsWithOffer(re)),se=re.generate(),this.setPrevAnswerSdp(se),[3,3];case 2:throw ce=fe.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer error: ".concat(ce),"",{pc:this.pc});case 3:if(de=this.avoidMsidConflict(this.prevOfferSdp),this.offerSdpHook)try{de=this.offerSdpHook(de)}catch(me){console.log("offerSdoHook error: ",me)}fe.label=4;case 4:return fe.trys.push([4,6,,7]),[4,(V=this.pc)===null||V===void 0?void 0:V.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:de}))];case 5:return fe.sent(),[3,7];case 6:throw pe=fe.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(pe),"",{sdp:this.prevOfferSdp});case 7:if(fe.trys.push([7,10,,11]),!this.prevAnswerSdp)return[3,9];if(he=this.avoidMsidConflict(this.prevAnswerSdp),this.answerSdpHook)try{he=this.answerSdpHook(he)}catch(me){console.log("answerSdpHook error: ",me)}return[4,(j=this.pc)===null||j===void 0?void 0:j.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:he}))];case 8:fe.sent(),fe.label=9;case 9:return[3,11];case 10:throw Ee=fe.sent(),new y.RtsError(E.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(Ee),"",{sdp:this.prevAnswerSdp});case 11:return[2]}})})},M.prototype.avoidMsidConflict=function(N){var P=new c.SdpUtil({sdp:N});return P.mungleMsid(),P.generate()},M.prototype.setCodecPreferences=function(N,P){if(P)try{N.setCodecPreferences(P)}catch(V){console.warn("setCodecPreferences error",V)}},M.prototype.log=function(){for(var N=[],P=0;P<arguments.length;P++)N[P]=arguments[P];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,a(["[PC-Core]"],N,!1))},M.prototype.hebtLog=function(){for(var N,P,V=[],j=0;j<arguments.length;j++)V[j]=arguments[j];window.RTS_HEBT_DEBUG&&console.log.apply(console,a(["".concat(this.now()," [datachannel|").concat((N=this.signal)===null||N===void 0?void 0:N.getDatachannelCore().label,"|").concat((P=this.signal)===null||P===void 0?void 0:P.getDatachannelCore().id,"]")],V,!1))},M.prototype.now=function(){var N=new Date;return"".concat(N.getHours(),":").concat(N.getMinutes(),":").concat(N.getSeconds(),".").concat(String(N.getMilliseconds()).padStart(3,"0"))},M}(D.default);v.PeerConnectionCore=w},651:function(h,v,u){var s,i=this&&this.__extends||(s=function(y,E){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,d){S.__proto__=d}||function(S,d){for(var R in d)Object.prototype.hasOwnProperty.call(d,R)&&(S[R]=d[R])},s(y,E)},function(y,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function S(){this.constructor=y}s(y,E),y.prototype=E===null?Object.create(E):(S.prototype=E.prototype,new S)}),e=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(v,"__esModule",{value:!0}),v.DataChannelCore=v.EDatachannelStatus=void 0;var o,r=u(844),a=u(961),t=u(854),n=e(u(885)),c=e(u(973)),p=e(u(775));function C(){}(function(y){y[y.DATACHANNEL_STATUS_CLOSE=0]="DATACHANNEL_STATUS_CLOSE",y[y.DATACHANNEL_STATUS_OPEN=1]="DATACHANNEL_STATUS_OPEN"})(o=v.EDatachannelStatus||(v.EDatachannelStatus={}));var x=function(y){function E(S){var d=y.call(this)||this;return d.pendingPromiseMap=new Map,d.mutexSendData=!1,d.timerSendData=null,d.eventQueue=new t.CacheBuffer("send tasks"),d.datachannelList=[],d.pc=S.pc,d.eventHandler=S.onDatachannelEvent||C,d.datachannelList=S.datachannelList||[],d.createDatachannel(S.label,S.assignId,S.delayOpen),d}return i(E,y),E.prototype.getWebrtcDatachannel=function(){return this.datachannel},E.prototype.getNextId=function(){var S=0,d=this.datachannelList.reduce(function(R,D){return D.readyState==="open"?R+1:(S||(S=D.id),R)},0);return S||2*(d+1)},E.prototype.createDatachannel=function(S,d,R){var D=this,A={ordered:!0};d&&this.pc.connectionState==="connected"&&(A.id=this.getNextId()),this.datachannel=this.pc.createDataChannel(S||"GRTN_RTC_DATACHANNEL"+"_".concat(Date.now()),A),this.datachannel.addEventListener("open",function(){R?setTimeout(function(){D.eventHandler(o.DATACHANNEL_STATUS_OPEN),D.emit("statusChange",o.DATACHANNEL_STATUS_OPEN)},200):(D.eventHandler(o.DATACHANNEL_STATUS_OPEN),D.emit("statusChange",o.DATACHANNEL_STATUS_OPEN))}),this.datachannel.addEventListener("close",function(){D.eventHandler(o.DATACHANNEL_STATUS_CLOSE),D.emit("statusChange",o.DATACHANNEL_STATUS_CLOSE)}),this.datachannel.addEventListener("closing",function(){}),this.datachannel.addEventListener("error",function(b){console.log(">> error",b),D.emit("error",b)}),this.datachannel.addEventListener("bufferedamountlow",function(){}),this.datachannel.addEventListener("message",function(b){D.emit("message",b.data)})},Object.defineProperty(E.prototype,"id",{get:function(){return this.datachannel.id},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"label",{get:function(){return this.datachannel.label},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"readyState",{get:function(){return this.datachannel.readyState},enumerable:!1,configurable:!0}),E.prototype.send=function(S){if(this.datachannel.readyState!=="open")throw new Error("Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."));return this.datachannel.send(S)},E.prototype.sendAsync=function(S){if(this.datachannel.readyState==="open")return this.datachannel.send((0,p.default)(S)),!0;console.log("Async signal message failed. Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."))},E.prototype.sendData=function(S){var d=this;return new Promise(function(R,D){var A=new c.default(d.datachannel);if(d.mutexSendData){var b={sender:A,res:R,rej:D,data:S};d.eventQueue.cache(b)}else d.atomSend(A,R,D,S)})},E.prototype.dispose=function(){var S;this.emit("dispose"),this.mutexSendData=!1,this.timerSendData!==null&&clearTimeout(this.timerSendData),this.timerSendData=null,this.eventQueue=new t.CacheBuffer("send tasks"),(S=this.datachannel)===null||S===void 0||S.close()},E.prototype.atomSend=function(S,d,R,D){var A=this;this.mutexSendData=!0,S.on("onSendDataDone",function(){if(A.timerSendData!==null&&clearTimeout(A.timerSendData),A.timerSendData=null,A.mutexSendData=!1,!A.eventQueue.isEmpty()){var b=A.eventQueue.getFirst();A.atomSend(b.sender,b.res,b.rej,b.data)}}),this.timerSendData=setTimeout(function(){R(new a.RtsError(r.ErrorCode.DATACHANNEL_TIMEOUT_ERROR,"request timeout after ".concat(E.REQUEST_TIMEOUT,"ms"),"",D)),A.timerSendData=null,A.mutexSendData=!1,S.emit("onSendDataDone")},E.REQUEST_TIMEOUT),S.sendingProcess(d,R,D)},E.REQUEST_TIMEOUT=5e3,E}(n.default);v.DataChannelCore=x},973:function(h,v,u){var s,i=this&&this.__extends||(s=function(x,y){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var d in S)Object.prototype.hasOwnProperty.call(S,d)&&(E[d]=S[d])},s(x,y)},function(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function E(){this.constructor=x}s(x,y),x.prototype=y===null?Object.create(y):(E.prototype=y.prototype,new E)}),e=this&&this.__spreadArray||function(x,y,E){if(E||arguments.length===2)for(var S,d=0,R=y.length;d<R;d++)!S&&d in y||(S||(S=Array.prototype.slice.call(y,0,d)),S[d]=y[d]);return x.concat(S||Array.prototype.slice.call(y))},o=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(v,"__esModule",{value:!0}),v.EDatachannelSignalResCode=v.EMessageType=void 0;var r,a,t=u(844),n=u(961),c=o(u(885)),p=o(u(775));(function(x){x.HEBT="hebt",x.NOTI="NOTI"})(r=v.EMessageType||(v.EMessageType={})),function(x){x[x.NGX_RTC_PUBLISH_ALREADY=402]="NGX_RTC_PUBLISH_ALREADY",x[x.NGX_RTC_REQUEST_FORBIDDEN=403]="NGX_RTC_REQUEST_FORBIDDEN",x[x.NGX_RTC_STREAM_NO_FOUND=404]="NGX_RTC_STREAM_NO_FOUND",x[x.NGX_RTC_SUBSCRIBE_ALREADY=410]="NGX_RTC_SUBSCRIBE_ALREADY",x[x.NGX_RTC_NORMAL_CLOSED=200]="NGX_RTC_NORMAL_CLOSED",x[x.NGX_RTC_LIMITED=508]="NGX_RTC_LIMITED",x[x.NGX_RTC_INTERNAL_SERVER_ERROR=500]="NGX_RTC_INTERNAL_SERVER_ERROR",x[x.NGX_RTC_BAD_REQUEST=400]="NGX_RTC_BAD_REQUEST",x[x.NGX_RTC_NEED_RETRY=213]="NGX_RTC_NEED_RETRY",x[x.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND=130]="NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND"}(a=v.EDatachannelSignalResCode||(v.EDatachannelSignalResCode={}));var C=function(x){function y(E){var S=x.call(this)||this;return S.datachannel=E,S}return i(y,x),y.prototype.sendingProcess=function(E,S,d){var R,D=this,A=performance.now();this.datachannel.onmessage=function(b){try{var g=JSON.parse(b.data),O=D.checkResponse(g);if(O.ignore)return;if(D.log("<<< Received:","".concat(Math.ceil(performance.now()-A),"ms"),g),O.pass)E(g);else{if(O.code===a.NGX_RTC_NEED_RETRY)return void setTimeout(function(){D.log(">>> Send:",d),D.datachannel.send((0,p.default)(d))},200);S(new n.RtsError(t.ErrorCode.DATACHANNEL_RESPONSE_ERROR,"[code]".concat(O.code,"; [msg]").concat(O.msg),O.traceId,{parsedData:g}))}}catch(k){S(new n.RtsError(t.ErrorCode.DATACHANNEL_PARSE_ERROR,"datachannel message parse error","",{data:b.data,err:k}))}D.emit("onSendDataDone")};try{this.log(">>> Sent:","".concat(d.type,"-").concat(!((R=d.streams)===null||R===void 0)&&R.length?d.streams[0].method:"-"),d)}catch{}this.datachannel.send((0,p.default)(d))},y.prototype.checkResponse=function(E){var S={pass:!0,ignore:!1,code:0,msg:"",traceId:""};if([r.HEBT,r.NOTI].includes(E.type))return S.ignore=!0,S.pass=!1,S;E.recode!==0&&(S.pass=!1,S.code=E.recode,S.msg=E.msg);var d=E.streams;return d&&d.length>0&&d.forEach(function(R){R.res_code!==200&&(S.pass=!1,S.code=R.res_code,S.msg=R.res_msg,S.traceId=R.traceid)}),S},y.prototype.log=function(){for(var E=[],S=0;S<arguments.length;S++)E[S]=arguments[S];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["".concat(this.now()," [datachannel|").concat(this.datachannel.label,"|").concat(this.datachannel.id,"]")],E,!1))},y.prototype.now=function(){var E=new Date;return"".concat(E.getHours(),":").concat(E.getMinutes(),":").concat(E.getSeconds(),".").concat(String(E.getMilliseconds()).padStart(3,"0"))},y}(c.default);v.default=C},844:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.ErrorCode=void 0,function(u){u[u.DATACHANNEL_SIGNAL_ERROR=15e3]="DATACHANNEL_SIGNAL_ERROR",u[u.DATACHANNEL_SET_OFFER_ERROR=15001]="DATACHANNEL_SET_OFFER_ERROR",u[u.DATACHANNEL_SET_ANSWER_ERROR=15002]="DATACHANNEL_SET_ANSWER_ERROR",u[u.DATACHANNEL_CREATE_OFFER_ERROR=15003]="DATACHANNEL_CREATE_OFFER_ERROR",u[u.DATACHANNEL_RESPONSE_ERROR=15004]="DATACHANNEL_RESPONSE_ERROR",u[u.DATACHANNEL_PARSE_ERROR=15005]="DATACHANNEL_PARSE_ERROR",u[u.DATACHANNEL_TIMEOUT_ERROR=15006]="DATACHANNEL_TIMEOUT_ERROR",u[u.CORE_NO_PC_ERROR=15007]="CORE_NO_PC_ERROR",u[u.CORE_PUBLIST_EXCEED_ERROR=15008]="CORE_PUBLIST_EXCEED_ERROR",u[u.CORE_PUB_REPLACE_URL_NOT_FOUND=15009]="CORE_PUB_REPLACE_URL_NOT_FOUND",u[u.CORE_TRANSCEIVERS_NOT_FOUND=15010]="CORE_TRANSCEIVERS_NOT_FOUND"}(v.ErrorCode||(v.ErrorCode={}))},961:(h,v,u)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.RtsError=void 0;var s=u(844);v.RtsError=function(i,e,o,r){this.errorCode=i,this.errorCodeName=s.ErrorCode[i],this.message=e,this.traceId=o,r&&(this.extraInfo=r)}},854:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.CacheBuffer=void 0;var u=function(){function s(i){this.data=[],this.tag=i||"unknown",this.maxBufferLength=90}return s.prototype.setMaxCapacity=function(i){this.maxBufferLength=90,i>=0&&(this.maxBufferLength=i),this.maxBufferLength>200&&(this.maxBufferLength=200)},s.prototype.cache=function(i){this.data.length>this.maxBufferLength&&(this.data.shift(),console.log(this.tag+" CACHE: Reach Max Capacity")),this.data.push(i)},s.prototype.getFirst=function(){return this.data.shift()},s.prototype.isEmpty=function(){return this.data.length<=0},s}();v.CacheBuffer=u},885:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0});var u=function(){function s(){this._eventMap={}}return s.prototype.listeners=function(i){return this._eventMap[i]||[]},s.prototype.emit=function(i){for(var e=this,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];var a=this._eventMap[i];return!!Array.isArray(a)&&(a.forEach(function(t){return t.apply(e,o)}),!0)},s.prototype.off=function(i,e){var o=this._eventMap[i];return Array.isArray(o)&&(this._eventMap[i]=o.filter(function(r){return r!==e})),this},s.prototype.removeAllListeners=function(i){return i===void 0?this._eventMap={}:this._eventMap[i]&&(this._eventMap[i]=[]),this},s.prototype.on=function(i,e){return this._eventMap[i]?this._eventMap[i].push(e):this._eventMap[i]=[e],this},s.prototype.once=function(i,e){var o=this,r=function(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];o.off(i,r),e.apply(o,a)};return this.on(i,r),this},s}();v.default=u},887:(h,v)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.intersection=v.pruneSubUrl=v.parseUrlSubParams=void 0,v.parseUrlSubParams=function(u){var s={subVideo:!0,subAudio:!0};return u&&(u.includes("@subvideo=no")&&(s.subVideo=!1),u.includes("@subaudio=no")&&(s.subAudio=!1)),s},v.pruneSubUrl=function(u,s){var i=u||"";return i=i.replace("@subaudio=no","").replace("@subvideo=no",""),s&&(i=i.split("?")[0]),i},v.intersection=function(u,s){return u.filter(function(i){return s.includes(i)})}},390:function(h,v){var u=this&&this.__spreadArray||function(i,e,o){if(o||arguments.length===2)for(var r,a=0,t=e.length;a<t;a++)!r&&a in e||(r||(r=Array.prototype.slice.call(e,0,a)),r[a]=e[a]);return i.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(v,"__esModule",{value:!0}),v.Logger=void 0;var s=function(){function i(e){this.switchName=e.switchName,this.displayName=e.displayName}return i.prototype.log=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];window[this.switchName||Math.random()]&&console.log.apply(console,u(["".concat(this.now()," [").concat(this.displayName,"]")],e,!1))},i.prototype.now=function(){var e=new Date;return"".concat(this.padStart(e.getHours()),":").concat(this.padStart(e.getMinutes()),":").concat(this.padStart(e.getSeconds()),".").concat(this.padStart(e.getMilliseconds(),3))},i.prototype.padStart=function(e,o,r){return o===void 0&&(o=2),r===void 0&&(r="0"),String(e).padStart(o,r)},i}();v.Logger=s},248:function(h,v,u){var s=this&&this.__assign||function(){return s=Object.assign||function(r){for(var a,t=1,n=arguments.length;t<n;t++)for(var c in a=arguments[t])Object.prototype.hasOwnProperty.call(a,c)&&(r[c]=a[c]);return r},s.apply(this,arguments)},i=this&&this.__spreadArray||function(r,a,t){if(t||arguments.length===2)for(var n,c=0,p=a.length;c<p;c++)!n&&c in a||(n||(n=Array.prototype.slice.call(a,0,c)),n[c]=a[c]);return r.concat(n||Array.prototype.slice.call(a))};Object.defineProperty(v,"__esModule",{value:!0}),v.generateFakeMediaSdpAnswer=v.SdpUtil=void 0;var e=u(766),o=function(){function r(a){if(this.rawSdp=a.sdp,!a.sdp)throw new Error("No sdp to parse");this.sdpDetail=this.parse()}return Object.defineProperty(r.prototype,"detail",{get:function(){return this.sdpDetail},enumerable:!1,configurable:!0}),r.prototype.removeMedia=function(a){return this.removeMediaInner(a)},r.prototype.keepMedia=function(a){return this.removeMediaInner(a,{revert:!0})},r.prototype.removeMediaInner=function(a,t){t===void 0&&(t={revert:!1}),a.length&&this.sdpDetail.media&&this.sdpDetail.media.length&&(t.revert?this.sdpDetail.media=this.sdpDetail.media.filter(function(n){return a.includes(String(n.mid)||"")}):this.sdpDetail.media=this.sdpDetail.media.filter(function(n){return!a.includes(String(n.mid)||"")}),this.updateBundle())},r.prototype.addOrUpdateMedia=function(a,t){t===void 0&&(t={}),a=a.map(function(c){return s(s({},c),{setup:"passive"})});var n=[];this.sdpDetail.media=this.sdpDetail.media.map(function(c){var p=a.find(function(y){return y.mid===c.mid});if(p){n.push(c.mid);var C=p,x=c;return t.isPublish&&(C.ssrcs=x.ssrcs,C.ssrcGroups=x.ssrcGroups),p}return c}),this.sdpDetail.media=i(i([],this.sdpDetail.media,!0),a.filter(function(c){return!n.includes(c.mid)}),!0),this.updateBundle()},r.prototype.mungleMsid=function(){this.sdpDetail.media.forEach(function(a){if(a.msid){var t="";a.msid=a.msid.split(" ").map(function(n,c){return c===1?(t=n,n+"_"+a.mid):n}).join(" "),t&&a.ssrcs&&a.ssrcs.forEach(function(n){n.value&&(n.value=n.value.replace(t,t+"_"+a.mid))})}})},r.prototype.addMedia=function(a){var t;a=a.map(function(p){return s(s({},p),{setup:"passive"})}),this.sdpDetail.media=i(i([],this.sdpDetail.media,!0),a,!0);var n=a.reduce(function(p,C){return p+" "+C.mid},""),c=(t=this.sdpDetail.groups)===null||t===void 0?void 0:t.find(function(p){return p.type==="BUNDLE"});c&&(c.mids+="".concat(n))},r.prototype.setMediaInactive=function(a){this.sdpDetail.media.forEach(function(t){a.includes(String(t.mid))&&(t.direction="inactive")}),this.updateBundle()},r.prototype.getPublishSsrcs=function(){var a=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.ssrcs&&a.push({type:t.type,ssrc:t.ssrcs[0].id||"ERR_NOT_FOUND",mid:String(t.mid)})}),a},r.prototype.getPublishMsids=function(){var a=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.msid&&a.push({type:t.type,msid:t.msid,mid:String(t.mid)})}),a},r.prototype.generate=function(){return(0,e.write)(this.sdpDetail)},r.prototype.updateBundle=function(){var a,t=(a=this.sdpDetail.groups)===null||a===void 0?void 0:a.find(function(n){return n.type==="BUNDLE"});t&&(t.mids=this.sdpDetail.media.reduce(function(n,c){return n+c.mid+" "},"").trim())},r.prototype.addNack=function(){this.sdpDetail.media.forEach(function(a){var t,n,c;if(a.type==="audio"){if(!((t=a.rtcpFb)===null||t===void 0)&&t.some(function(C){return C.type==="nack"}))return;var p=(n=a.rtp.find(function(C){return C.codec==="opus"}))===null||n===void 0?void 0:n.payload;p&&((c=a.rtcpFb)===null||c===void 0||c.push({payload:p,type:"nack"}))}})},r.prototype.parse=function(){var a=(0,e.parse)(this.rawSdp);return this.patchMsid(a)},r.prototype.getMids=function(a){return a?.length?a.reduce(function(t,n){return i(i([],t,!0),[String(n.mid)],!1)},[]):[]},r.prototype.patchMsid=function(a){return a.media.forEach(function(t){var n,c;t.type==="application"||t.msid||(t.msid=(c=(n=t.ssrcs)===null||n===void 0?void 0:n.find(function(p){return p.attribute==="msid"}))===null||c===void 0?void 0:c.value)}),a},r}();v.SdpUtil=o,v.generateFakeMediaSdpAnswer=function(r){if(!r.mids.length||!r.medias.length||r.mids.length!==r.medias.length)return"";var a=`v=0
|
|
@@ -76,7 +76,7 @@ a=ssrc:`.concat(C,` cname:defaultcname
|
|
|
76
76
|
a=ssrc:`).concat(C," msid:").concat(x,`
|
|
77
77
|
a=ssrc:`).concat(C,` mslabel:rts
|
|
78
78
|
a=ssrc:`).concat(C," label:audio"),r.direction==="sub"&&(a+=y),a+=t)}),a}},237:(h,v,u)=>{Object.defineProperty(v,"__esModule",{value:!0}),v.UrlData=void 0;var s=u(887),i=function(){function e(o){var r=(0,s.parseUrlSubParams)(o.url);this.data={url:o.url,subAudio:r.subAudio,subVideo:r.subVideo},typeof o.subAudio=="boolean"&&(this.data.subAudio=o.subAudio),typeof o.subVideo=="boolean"&&(this.data.subVideo=o.subVideo)}return Object.defineProperty(e.prototype,"subVideo",{get:function(){return this.data.subVideo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subAudio",{get:function(){return this.data.subAudio},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return(0,s.pruneSubUrl)(this.data.url)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUrl",{get:function(){return this.data.url},enumerable:!1,configurable:!0}),e}();v.UrlData=i},123:function(h,v,u){var s,i=this&&this.__extends||(s=function(c,p){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,x){C.__proto__=x}||function(C,x){for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(C[y]=x[y])},s(c,p)},function(c,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function C(){this.constructor=c}s(c,p),c.prototype=p===null?Object.create(p):(C.prototype=p.prototype,new C)}),e=this&&this.__spreadArray||function(c,p,C){if(C||arguments.length===2)for(var x,y=0,E=p.length;y<E;y++)!x&&y in p||(x||(x=Array.prototype.slice.call(p,0,y)),x[y]=p[y]);return c.concat(x||Array.prototype.slice.call(p))},o=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(v,"__esModule",{value:!0});var r=o(u(885)),a=u(973),t=[a.EDatachannelSignalResCode.NGX_RTC_STREAM_NO_FOUND,a.EDatachannelSignalResCode.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND],n=function(c){function p(C,x){var y=c.call(this)||this;return y.datachannel=C,y.streamManager=x,y}return i(p,c),p.prototype.process=function(C){var x=this,y=this.parseFormat(C);if(y){var E=this.checkRecode(y),S=E.valid,d=E.error,R=E.reason;if(!S)return y.recode===3?void this.emit("datachannelNotEnabled"):void(d&&this.emit("pcReconnect",{recode:y.recode,reMsg:R}));this.emit("hebtReceived",y),this.checkStreams(y).forEach(function(D){var A={resCode:D.resCode,resMsg:D.resMsg,url:D.url,msids:D.msids,streams:D.streams,type:D.type,latestUrl:D.latestUrl};D.isReconnectable?x.emit("streamReconnect",A):x.emit("streamError",A)})}},p.prototype.parseFormat=function(C){try{return JSON.parse(C)}catch{console.log("Heartbeat parse failed."," Response Data: ",C)}},p.prototype.checkRecode=function(C){var x={valid:!1,error:!1,reason:""};return C.type!==a.EMessageType.HEBT?(x.reason="not heartbeat signal, ignore",x):C.recode!==0?(x.reason=C.msg,x.error=!0,x):(x.valid=!0,x)},p.prototype.checkStreams=function(C){var x=this,y=[];return C.streams&&C.streams.length&&e(e([],this.streamManager.getAllStreamListWithMsids(),!0),this.streamManager.getAllDatachannelList(),!0).forEach(function(E){var S,d=-1;if(C.streams.find(function(b,g){if(b.url===E.url)return d=g,!0})&&d!==-1){var R=C.streams[d];if(R.method===a.EMessageType.HEBT&&R.res_code===200){R.traceid&&x.emit("traceIdUpdate",{url:R.url,traceId:R.traceid});var D=[];E.msids.forEach(function(b){R.msid.find(function(g){return g.name===b.name})||D.push(b)});var A=(S=E.streams)===null||S===void 0?void 0:S.filter(function(b){return!!D.find(function(g){return g.streamId===b.id})});D.length&&y.push({url:E.url,msids:D,streams:A,isReconnectable:!0,resMsg:"RTS heartbeat msid mismatch",resCode:404,type:E.type,latestUrl:E.latestUrl})}else y.push({url:E.url,msids:E.msids,streams:E.streams,isReconnectable:x.isReconnectableErrorCode(R.res_code),resMsg:R.res_msg,resCode:R.res_code,type:E.type,latestUrl:E.latestUrl})}}),y},p.prototype.isReconnectableErrorCode=function(C){return t.includes(C)},p}(r.default);v.default=n},619:function(h,v,u){var s=this&&this.__assign||function(){return s=Object.assign||function(C){for(var x,y=1,E=arguments.length;y<E;y++)for(var S in x=arguments[y])Object.prototype.hasOwnProperty.call(x,S)&&(C[S]=x[S]);return C},s.apply(this,arguments)},i=this&&this.__awaiter||function(C,x,y,E){return new(y||(y=Promise))(function(S,d){function R(b){try{A(E.next(b))}catch(g){d(g)}}function D(b){try{A(E.throw(b))}catch(g){d(g)}}function A(b){var g;b.done?S(b.value):(g=b.value,g instanceof y?g:new y(function(O){O(g)})).then(R,D)}A((E=E.apply(C,x||[])).next())})},e=this&&this.__generator||function(C,x){var y,E,S,d,R={label:0,sent:function(){if(1&S[0])throw S[1];return S[1]},trys:[],ops:[]};return d={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function D(A){return function(b){return function(g){if(y)throw new TypeError("Generator is already executing.");for(;d&&(d=0,g[0]&&(R=0)),R;)try{if(y=1,E&&(S=2&g[0]?E.return:g[0]?E.throw||((S=E.return)&&S.call(E),0):E.next)&&!(S=S.call(E,g[1])).done)return S;switch(E=0,S&&(g=[2&g[0],S.value]),g[0]){case 0:case 1:S=g;break;case 4:return R.label++,{value:g[1],done:!1};case 5:R.label++,E=g[1],g=[0];continue;case 7:g=R.ops.pop(),R.trys.pop();continue;default:if(!((S=(S=R.trys).length>0&&S[S.length-1])||g[0]!==6&&g[0]!==2)){R=0;continue}if(g[0]===3&&(!S||g[1]>S[0]&&g[1]<S[3])){R.label=g[1];break}if(g[0]===6&&R.label<S[1]){R.label=S[1],S=g;break}if(S&&R.label<S[2]){R.label=S[2],R.ops.push(g);break}S[2]&&R.ops.pop(),R.trys.pop();continue}g=x.call(C,R)}catch(O){g=[6,O],E=0}finally{y=S=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}([A,b])}}},o=this&&this.__spreadArray||function(C,x,y){if(y||arguments.length===2)for(var E,S=0,d=x.length;S<d;S++)!E&&S in x||(E||(E=Array.prototype.slice.call(x,0,S)),E[S]=x[S]);return C.concat(E||Array.prototype.slice.call(x))};Object.defineProperty(v,"__esModule",{value:!0}),v.Signal=void 0;var r,a,t,n=u(651),c=u(887);(function(C){C.Sub="sub",C.Pub="pub",C.Hebt="hebt"})(r||(r={})),function(C){C.Add="add",C.Active="active",C.Stop="stop",C.Delete="delete",C.Hebt="hebt"}(a||(a={})),function(C){C.Audio="audio",C.Video="video",C.Data="data"}(t||(t={}));var p=function(){function C(x){this.latestMsgId=0,this.latestSubAddMsgId=0,this.pc=x.pc,this.datachannel=new n.DataChannelCore({pc:this.pc,onDatachannelEvent:x.onDatachannelEvent,delayOpen:x.delayOpen})}return C.prototype.getDatachannelCore=function(){return this.datachannel},C.prototype.subscribeAdd=function(x,y,E){var S;return i(this,void 0,void 0,function(){var d;return e(this,function(R){switch(R.label){case 0:return d=s(s({},this.baseParams({type:r.Sub,method:a.Add})),{streams:x.map(function(D,A){var b=D.urlData,g=[];return b.subAudio&&!E.isMsidSubPubDone(b.url,{aMsid:D.aMsid[0]})&&g.push({type:t.Audio,name:D.aMsid[0]}),b.subVideo&&!E.isMsidSubPubDone(b.url,{vMsid:D.vMsid[0]})&&g.push({type:t.Video,name:D.vMsid[0]}),{method:a.Add,url:b.url,msid:g,sdp:y[A],ttl:300}})}),[4,(S=this.datachannel)===null||S===void 0?void 0:S.sendData(d)];case 1:return[2,R.sent()]}})})},C.prototype.subscribeActive=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Sub,method:a.Active})),{streams:x.map(function(d){var R=d.urlData;return{method:a.Active,url:R.url}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return S.sent(),[2]}})})},C.prototype.subscribeDelete=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams()),{streams:x.map(function(d){var R=d.url,D=d.aMsid,A=d.vMsid,b=[];return D?.length&&(b=o(o([],b,!0),D.map(function(g){return{name:g}}),!0)),A?.length&&(b=o(o([],b,!0),A.map(function(g){return{name:g}}),!0)),{method:a.Delete,url:(0,c.pruneSubUrl)(R),msid:b}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeStop=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams()),{streams:x.map(function(d){var R=d.urlData;return{method:a.Stop,url:R.url}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeAddDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Sub,method:a.Add})),{streams:x.map(function(d){var R=d.url,D=d.msid;return{method:a.Add,url:R,msid:[{type:t.Data,name:D}]}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeActiveDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Sub,method:a.Active})),{streams:x.map(function(d){var R=d.url,D=d.datachannelId,A=d.msid;return{method:a.Active,url:R,msid:[{type:t.Data,name:A,channel:D}]}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.subscribeStopDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams()),{streams:x.map(function(d){var R=d.url;return{method:a.Stop,url:R}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.publishAdd=function(x,y,E,S){var d;return i(this,void 0,void 0,function(){var R;return e(this,function(D){return R=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(A,b){var g=E[b],O=S[b],k=[];return g.length&&k.push({type:"video",name:g[0].trim()}),O.length&&k.push({type:"audio",name:O[0].trim()}),{method:a.Add,url:A,msid:k,sdp:y[b]}})}),[2,(d=this.datachannel)===null||d===void 0?void 0:d.sendData(R)]})})},C.prototype.publishDelete=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){return E=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(d){var R=d.url,D=d.aMsid,A=d.vMsid,b=[];return D?.length&&(b=o(o([],b,!0),D.map(function(g){return{name:g}}),!0)),A?.length&&(b=o(o([],b,!0),A.map(function(g){return{name:g}}),!0)),{method:a.Delete,url:(0,c.pruneSubUrl)(R),msid:b}})}),[2,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)]})})},C.prototype.publishStop=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){return E=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(d){return{method:a.Stop,url:d}})}),[2,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)]})})},C.prototype.publishAddDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Pub,method:a.Add})),{streams:x.map(function(d){var R=d.url,D=d.datachannelId,A=d.msid;return{method:a.Add,url:R,msid:[{type:t.Data,name:A,channel:D}]}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.publishStopDatachannel=function(x){var y;return i(this,void 0,void 0,function(){var E;return e(this,function(S){switch(S.label){case 0:return E=s(s({},this.baseParams({type:r.Pub})),{streams:x.map(function(d){var R=d.url;return{method:a.Stop,url:R}})}),[4,(y=this.datachannel)===null||y===void 0?void 0:y.sendData(E)];case 1:return[2,S.sent()]}})})},C.prototype.sendHeartbeat=function(x){x&&!x.map&&(x=void 0);var y=s(s({},this.baseParams({type:r.Hebt})),{streams:x?.map(function(E){var S=E.url;return{method:a.Hebt,url:S}})});if(x||delete y.streams,this.datachannel.sendAsync(y))return y},C.prototype.sendFalseHeartbeat=function(x){var y=s(s({},this.baseParams({type:r.Hebt})),{streams:x?.map(function(E){return{method:"fake",url:E.url}})});if(x||delete y.streams,this.datachannel.sendAsync(y))return y},C.prototype.dispose=function(){this.datachannel.dispose()},C.prototype.baseParams=function(x){x===void 0&&(x={type:r.Sub});var y=0;return x.type===r.Sub&&x.method===a.Add?(y=++this.latestMsgId,this.latestSubAddMsgId=this.latestMsgId):y=x.type===r.Sub&&x.method===a.Active?this.latestSubAddMsgId:++this.latestMsgId,{msg_id:y,version:2,type:x.type}},C}();v.Signal=p},125:function(h,v,u){var s,i=this&&this.__extends||(s=function(c,p){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,x){C.__proto__=x}||function(C,x){for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(C[y]=x[y])},s(c,p)},function(c,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");function C(){this.constructor=c}s(c,p),c.prototype=p===null?Object.create(p):(C.prototype=p.prototype,new C)}),e=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(v,"__esModule",{value:!0}),v.NotifyProcessor=void 0;var o,r=u(973),a=e(u(885)),t=u(390);(function(c){c[c.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION=1]="NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION",c[c.NGX_RTC_H5_ACCESS_IP_MIGRATION=2]="NGX_RTC_H5_ACCESS_IP_MIGRATION",c[c.NGX_RTC_H5_ACCESS_SUB_STREAMINFO=3]="NGX_RTC_H5_ACCESS_SUB_STREAMINFO"})(o||(o={}));var n=function(c){function p(){var C=c.call(this)||this;return C.logger=new t.Logger({displayName:"NotifyProcessor",switchName:"RTS_NOTIFY_DEBUG"}),C}return i(p,c),p.prototype.processIpMigration=function(C){var x,y,E=this.parseFormat(C);if(E&&this.checkRelated(E)){this.logger.log("\u3010processIpMigration\u3011parsedData",E),this.emit("message",{message:E});var S=this.parseIP(E.notify_msg);!((x=S.pull)===null||x===void 0)&&x.length||!((y=S.push)===null||y===void 0)&&y.length?(console.warn("\u3010processIpMigration\u3011\u9700\u8981\u91CD\u8FDE",S),this.emit("pcReconnect",{ips:S})):this.logger.log("\u3010processIpMigration\u3011No valid ip found: ",E.notify_msg)}},p.prototype.processSubStreamInfo=function(C){var x=this.parseFormat(C);if(this.logger.log("\u3010processSubStreamInfo\u3011parsedData",x),x&&this.checkRelated(x,o.NGX_RTC_H5_ACCESS_SUB_STREAMINFO))return x},p.prototype.processInternalException=function(C){var x=this.parseFormat(C);if(x&&this.checkRelated(x,o.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION)){this.emit("message",{message:x}),this.logger.log("\u3010processInternalException\u3011parsedData",x);var y=Number(x.res_code);y&&![200,204,205,207,221,403,404,405,429,504,616,409,601].includes(y)?(console.warn("\u3010processInternalException\u3011\u9700\u8981\u91CD\u8FDE",y),this.emit("pcReconnect",{})):this.logger.log("\u3010processInternalException\u3011Error code should not retry ",y)}},p.prototype.parseFormat=function(C){try{return JSON.parse(C)}catch{console.warn("Notify parse failed."," Response Data: ",C)}},p.prototype.checkRelated=function(C,x){return x===void 0&&(x=o.NGX_RTC_H5_ACCESS_IP_MIGRATION),C.type===r.EMessageType.NOTI&&C.notify_type===x},p.prototype.parseIP=function(C){C===void 0&&(C=""),this.logger.log("Paring IP string: ".concat(C));var x=C.split(";"),y=/^(?:\d{1,3}\.){3}\d{1,3}$/,E=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,S=/^(push|pull)_ips:(.*)$/,d={};return x.forEach(function(R){var D=S.exec(R);if(D){var A=D[1],b=D[2].split(",").filter(function(g){return y.test(g)||E.test(g)});d[A]=b}}),this.logger.log("Parsed IP:",d),d},p}(a.default);v.NotifyProcessor=n},132:function(h,v,u){var s=this&&this.__awaiter||function(t,n,c,p){return new(c||(c=Promise))(function(C,x){function y(d){try{S(p.next(d))}catch(R){x(R)}}function E(d){try{S(p.throw(d))}catch(R){x(R)}}function S(d){var R;d.done?C(d.value):(R=d.value,R instanceof c?R:new c(function(D){D(R)})).then(y,E)}S((p=p.apply(t,n||[])).next())})},i=this&&this.__generator||function(t,n){var c,p,C,x,y={label:0,sent:function(){if(1&C[0])throw C[1];return C[1]},trys:[],ops:[]};return x={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(x[Symbol.iterator]=function(){return this}),x;function E(S){return function(d){return function(R){if(c)throw new TypeError("Generator is already executing.");for(;x&&(x=0,R[0]&&(y=0)),y;)try{if(c=1,p&&(C=2&R[0]?p.return:R[0]?p.throw||((C=p.return)&&C.call(p),0):p.next)&&!(C=C.call(p,R[1])).done)return C;switch(p=0,C&&(R=[2&R[0],C.value]),R[0]){case 0:case 1:C=R;break;case 4:return y.label++,{value:R[1],done:!1};case 5:y.label++,p=R[1],R=[0];continue;case 7:R=y.ops.pop(),y.trys.pop();continue;default:if(!((C=(C=y.trys).length>0&&C[C.length-1])||R[0]!==6&&R[0]!==2)){y=0;continue}if(R[0]===3&&(!C||R[1]>C[0]&&R[1]<C[3])){y.label=R[1];break}if(R[0]===6&&y.label<C[1]){y.label=C[1],C=R;break}if(C&&y.label<C[2]){y.label=C[2],y.ops.push(R);break}C[2]&&y.ops.pop(),y.trys.pop();continue}R=n.call(t,y)}catch(D){R=[6,D],p=0}finally{c=C=0}if(5&R[0])throw R[1];return{value:R[0]?R[1]:void 0,done:!0}}([S,d])}}},e=this&&this.__spreadArray||function(t,n,c){if(c||arguments.length===2)for(var p,C=0,x=n.length;C<x;C++)!p&&C in n||(p||(p=Array.prototype.slice.call(n,0,C)),p[C]=n[C]);return t.concat(p||Array.prototype.slice.call(n))},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(v,"__esModule",{value:!0}),v.PeerConnectionRollbackController=void 0;var r=o(u(775)),a=function(){function t(n){this.fakeSdpParams={direction:"sub",mids:[],medias:[]},this.pcCore=n}return t.prototype.setFakeSdpMids=function(n){this.fakeSdpParams.mids=n},t.prototype.setFakeSdpMedias=function(n,c){this.fakeSdpParams.medias=n,this.fakeSdpParams.direction=c},t.prototype.saveStreamManager=function(n){var c;this.streamManager=n,(c=this.streamManager)===null||c===void 0||c.backup()},t.prototype.rollback=function(n){return s(this,void 0,void 0,function(){var c;return i(this,function(p){switch(p.label){case 0:if(n?.trackListnerRollback&&(this.pcCore.removeTrackListener(),this.log("Sub Track Listener Removed")),n?.streamManagerRollback&&this.streamManager){this.streamManager.restore();try{this.log("Stream Manager Restored",JSON.parse((0,r.default)(this.streamManager)))}catch{}}if(n?.pcTransceiversRollback&&(this.fakeSdpParams.medias.forEach(function(C){var x;(x=C.trans)===null||x===void 0||x.receiver.track.stop()}),this.log("Sub Track(s) Stopped",this.fakeSdpParams.medias)),!n?.runSimulateSignal)return[3,4];this.log("SDP Simulating...",this.fakeSdpParams),p.label=1;case 1:return p.trys.push([1,3,,4]),[4,this.pcCore.simulateOfferAnswer(this.fakeSdpParams)];case 2:return p.sent(),this.log("SDP Simulation Done"),[3,4];case 3:return c=p.sent(),this.log("SDP Simulation Failed",c),[3,4];case 4:return[2]}})})},t.prototype.log=function(){for(var n=[],c=0;c<arguments.length;c++)n[c]=arguments[c];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["[PC-Core-Rollback]"],n,!1))},t}();v.PeerConnectionRollbackController=a},628:function(h,v,u){var s=this&&this.__assign||function(){return s=Object.assign||function(a){for(var t,n=1,c=arguments.length;n<c;n++)for(var p in t=arguments[n])Object.prototype.hasOwnProperty.call(t,p)&&(a[p]=t[p]);return a},s.apply(this,arguments)},i=this&&this.__spreadArray||function(a,t,n){if(n||arguments.length===2)for(var c,p=0,C=t.length;p<C;p++)!c&&p in t||(c||(c=Array.prototype.slice.call(t,0,p)),c[p]=t[p]);return a.concat(c||Array.prototype.slice.call(t))};Object.defineProperty(v,"__esModule",{value:!0}),v.StreamManager=v.EStreamType=void 0;var e,o=u(887);(function(a){a.Subscribe="sub",a.Publish="pub"})(e=v.EStreamType||(v.EStreamType={}));var r=function(){function a(t){this.streamMap={},this.streamMapBackup={},this.datachannelMap=new Map}return a.prototype.backup=function(){var t=this,n={};Object.keys(this.streamMap).forEach(function(c){var p=t.streamMap[c];n[c]=s(s({},t.streamMap[c]),{videoInfoList:i([],p.videoInfoList,!0),audioInfoList:i([],p.audioInfoList,!0),streamList:i([],p.streamList,!0)})}),this.streamMapBackup=n},a.prototype.restore=function(){this.streamMap=s({},this.streamMapBackup)},a.prototype.init=function(t,n){n===void 0&&(n=e.Subscribe);var c=(0,o.pruneSubUrl)(t);t=(0,o.pruneSubUrl)(t,!0),this.has(t)||(this.streamMap[t]={type:n,videoInfoList:[],audioInfoList:[],streamList:[],originUrl:c})},a.prototype.remove=function(t){delete this.streamMap[(0,o.pruneSubUrl)(t,!0)]},a.prototype.update=function(t,n){var c=this.get(t);if(!c)throw new Error("No url found");if(n.aMsid){var p=c.audioInfoList.find(function(x){return x.msid===n.aMsid})||this.createMediaItem(n.aMsid,"audio");n.aTransceiver&&(p.transceiver=n.aTransceiver),n.stream&&(p.streamId=n.stream.id),this.updateMediaInfoList(p,c.audioInfoList)}if(n.vMsid){var C=c.videoInfoList.find(function(x){return x.msid===n.vMsid})||this.createMediaItem(n.vMsid,"video");n.vTransceiver&&(C.transceiver=n.vTransceiver),n.cumuDelay&&(C.cumuDelay=n.cumuDelay),n.stream&&(C.streamId=n.stream.id),this.updateMediaInfoList(C,c.videoInfoList)}n.stream&&(c.streamList.some(function(x){return x.id===n.stream.id})||(c.streamList=i(i([],c.streamList,!0),[n.stream],!1)))},a.prototype.pruneStreamList=function(t){var n=this.get(t);n&&(n.streamList=n.streamList.filter(function(c){var p;return((p=c.mediaStream)===null||p===void 0?void 0:p.getTracks().length)>0}))},a.prototype.updateSdpInfo=function(t,n){var c,p=this.get(t);if(!p)throw new Error("No url found");if(n.aMsid?c=p.audioInfoList.find(function(C){return C.msid===n.aMsid}):n.vMsid&&(c=p.videoInfoList.find(function(C){return C.msid===n.vMsid})),!c)throw new Error("No target media found");c.ssrc=n.ssrc,c.codec=n.codec,c.pt=n.pt,c.from=n.from},a.prototype.get=function(t){return this.streamMap[(0,o.pruneSubUrl)(t,!0)]},a.prototype.has=function(t){return!!this.get(t)},a.prototype.getSize=function(){return this.getSubOrPubDoneMediaMapSize()+this.getDcMapSize()},a.prototype.getSubOrPubDoneMediaMapSize=function(){var t=this,n=0;return Object.keys(this.streamMap).forEach(function(c){var p=t.streamMap[c],C=!1;p.audioInfoList.forEach(function(x){C=C||p.type===e.Publish&&x.pubDone||p.type===e.Subscribe&&x.subDone}),p.videoInfoList.forEach(function(x){C=C||p.type===e.Publish&&x.pubDone||p.type===e.Subscribe&&x.subDone}),C&&n++}),n},a.prototype.getDcMapSize=function(){return this.datachannelMap.size},a.prototype.removeMsid=function(t,n){t=(0,o.pruneSubUrl)(t,!0);var c=this.get(t);c&&(n.vMsid&&(c.videoInfoList=c.videoInfoList.filter(function(p){return p.msid!==n.vMsid})),n.aMsid&&(c.audioInfoList=c.audioInfoList.filter(function(p){return p.msid!==n.aMsid})))},a.prototype.getMids=function(t,n){n===void 0&&(n={filterSubDone:!1}),t=(0,o.pruneSubUrl)(t,!0);var c=this.streamMap[t];return c?i(i([],c.audioInfoList.reduce(function(p,C){return C.transceiver&&(!n.filterSubDone||n.filterSubDone&&!C.subDone)?i(i([],p,!0),[String(C.transceiver.mid)],!1):p},[]),!0),c.videoInfoList.reduce(function(p,C){return C.transceiver&&(!n.filterSubDone||n.filterSubDone&&!C.subDone)?i(i([],p,!0),[String(C.transceiver.mid)],!1):p},[]),!0):[]},a.prototype.getAllTransceivers=function(t){if(!t)return[];t=(0,o.pruneSubUrl)(t,!0);var n=this.get(t);return n?i(i([],n.videoInfoList.map(function(c){return c.transceiver}),!0),n.audioInfoList.map(function(c){return c.transceiver}),!0):[]},a.prototype.getTransceiver=function(t,n){if(n===void 0&&(n={}),t){t=(0,o.pruneSubUrl)(t,!0);var c=n.vMsid,p=n.aMsid,C=this.get(t);if(C){var x;if(c)return(x=C.videoInfoList.find(function(y){return y.msid===c}))==null?void 0:x.transceiver;if(p)return(x=C.audioInfoList.find(function(y){return y.msid===p}))==null?void 0:x.transceiver}}},a.prototype.getStreamByMsid=function(t){var n,c,p=this.get(t.url);if(p){if(t.vMsid){var C=(n=p.videoInfoList.find(function(y){return y.msid===t.vMsid}))===null||n===void 0?void 0:n.streamId;return p.streamList.find(function(y){return y.id===C})}if(t.aMsid){var x=(c=p.audioInfoList.find(function(y){return y.msid===t.aMsid}))===null||c===void 0?void 0:c.streamId;return p.streamList.find(function(y){return y.id===x})}return p.streamList[0]}},a.prototype.hasTransceiver=function(t,n){return n===void 0&&(n={}),!!this.getTransceiver(t,n)},a.prototype.removeTransceiver=function(t,n){t=(0,o.pruneSubUrl)(t,!0);var c,p=this.get(t);p&&(n.vMsid&&(c=p.videoInfoList.find(function(C){return C.msid===n.vMsid}))&&(c.transceiver=void 0),n.aMsid&&(c=p.audioInfoList.find(function(C){return C.msid===n.aMsid}))&&(c.transceiver=void 0))},a.prototype.markAlreadySubPub=function(t,n){n===void 0&&(n={}),t=(0,o.pruneSubUrl)(t,!0);var c,p=this.streamMap[t];p&&(n.vMsid&&(c=p.videoInfoList.find(function(C){return C.msid===n.vMsid}))&&(c[n.isPub?"pubDone":"subDone"]=!n.reset),n.aMsid&&(c=p.audioInfoList.find(function(C){return C.msid===n.aMsid}))&&(c[n.isPub?"pubDone":"subDone"]=!n.reset))},a.prototype.isMsidSubPubDone=function(t,n){n===void 0&&(n={}),t=(0,o.pruneSubUrl)(t,!0);var c=this.streamMap[t];if(!c)return!1;if(n.vMsid){var p=c.videoInfoList.find(function(C){return C.msid===n.vMsid});return n.isPub?p?.pubDone:p?.subDone}return n.aMsid?(p=c.audioInfoList.find(function(C){return C.msid===n.aMsid}),n.isPub?p?.pubDone:p?.subDone):void 0},a.prototype.getAllMediaInfoList=function(t,n){var c=this.get(t);return c?i(i([],c.audioInfoList.map(function(p){var C,x,y,E,S=p.type,d=p.msid,R=p.ssrc,D=p.pt,A=p.codec,b=p.from,g=p.transceiver,O={type:S,msid:d,ssrc:R,pt:D,codec:A,from:b,trackId:c.type===e.Subscribe?(x=(C=g?.receiver)===null||C===void 0?void 0:C.track)===null||x===void 0?void 0:x.id:(E=(y=g?.sender)===null||y===void 0?void 0:y.track)===null||E===void 0?void 0:E.id};return n?s(s({},O),{transceiver:g}):O}),!0),c.videoInfoList.map(function(p){var C,x,y,E,S=p.type,d=p.msid,R=p.ssrc,D=p.pt,A=p.codec,b=p.from,g=p.transceiver,O={type:S,msid:d,ssrc:R,pt:D,codec:A,from:b,trackId:c.type===e.Subscribe?(x=(C=g?.receiver)===null||C===void 0?void 0:C.track)===null||x===void 0?void 0:x.id:(E=(y=g?.sender)===null||y===void 0?void 0:y.track)===null||E===void 0?void 0:E.id};return n?s(s({},O),{transceiver:g}):O}),!0):[]},a.prototype.getOriginUrl=function(t){var n=(0,o.pruneSubUrl)(t,!0),c=this.get(n);return c?c.originUrl:t},a.prototype.getAllTrackPairList=function(t){var n,c,p,C,x=[];for(var y in this.streamMap){var E=this.streamMap[y];if(E.type===t)for(var S=Math.max(E.audioInfoList.length,E.videoInfoList.length),d=0;d<S;d++){var R={url:y,originUrl:E.originUrl};d<E.audioInfoList.length&&(R.aTransceiver=t===e.Subscribe?(n=E.audioInfoList[d].transceiver)===null||n===void 0?void 0:n.receiver:(c=E.audioInfoList[d].transceiver)===null||c===void 0?void 0:c.sender,R.aMsid=E.audioInfoList[d].msid),d<E.videoInfoList.length&&(R.vTransceiver=t===e.Subscribe?(p=E.videoInfoList[d].transceiver)===null||p===void 0?void 0:p.receiver:(C=E.videoInfoList[d].transceiver)===null||C===void 0?void 0:C.sender,R.vMsid=E.videoInfoList[d].msid,R.cumuDelay=E.videoInfoList[d].cumuDelay),x.push(R)}}return x},a.prototype.getAllStreamListWithMsids=function(){var t,n=[];for(var c in this.streamMap){for(var p=this.streamMap[c],C=Math.max(p.audioInfoList.length,p.videoInfoList.length,p.streamList.length),x={url:c,msids:[],type:p.type,latestUrl:p.latestUrl||p.originUrl,streams:[]},y=0;y<C;y++){if(y<p.audioInfoList.length&&p.audioInfoList[y].msid){var E=p.audioInfoList[y];E.msid&&(p.type===e.Publish&&E.pubDone||p.type===e.Subscribe&&E.subDone)&&x.msids.push({name:E.msid||"",type:E.type||"audio",streamId:E.streamId})}if(y<p.videoInfoList.length&&p.videoInfoList[y].msid){var S=p.videoInfoList[y];S.msid&&(p.type===e.Publish&&S.pubDone||p.type===e.Subscribe&&S.subDone)&&x.msids.push({name:S.msid||"",type:S.type||"video",streamId:S.streamId})}y<p.streamList.length&&p.streamList[y]&&((t=x.streams)===null||t===void 0||t.push(p.streamList[y]))}x.msids.length&&n.push(x)}return n},a.prototype.getSender=function(t,n,c){var p,C,x=void 0,y=this.getAllMediaInfoList(t,!0);return c?y.forEach(function(E){var S,d,R,D=(d=(S=E.transceiver)===null||S===void 0?void 0:S.sender)===null||d===void 0?void 0:d.track;D?.kind===n&&E.msid===c&&(x=(R=E.transceiver)===null||R===void 0?void 0:R.sender)}):x=(C=(p=y?.find(function(E){var S,d,R;return((R=(d=(S=E.transceiver)===null||S===void 0?void 0:S.sender)===null||d===void 0?void 0:d.track)===null||R===void 0?void 0:R.kind)===n}))===null||p===void 0?void 0:p.transceiver)===null||C===void 0?void 0:C.sender,x},a.prototype.getReceiver=function(t,n,c){var p,C,x=void 0,y=this.getAllMediaInfoList(t,!0);return c?y.forEach(function(E){var S,d,R,D=(d=(S=E.transceiver)===null||S===void 0?void 0:S.receiver)===null||d===void 0?void 0:d.track;D?.kind===n&&E.msid===c&&(x=(R=E.transceiver)===null||R===void 0?void 0:R.receiver)}):x=(C=(p=y?.find(function(E){var S,d,R;return((R=(d=(S=E.transceiver)===null||S===void 0?void 0:S.receiver)===null||d===void 0?void 0:d.track)===null||R===void 0?void 0:R.kind)===n}))===null||p===void 0?void 0:p.transceiver)===null||C===void 0?void 0:C.receiver,x},a.prototype.dispose=function(){this.streamMap={}},a.prototype.updateMediaInfoList=function(t,n){var c=n.findIndex(function(p){return p.msid===t.msid});c!==-1?n.splice(c,1,t):n.push(t)},a.prototype.findMediaItemByMsid=function(t,n){return n.find(function(c){return c.msid===t})},a.prototype.createMediaItem=function(t,n){return{msid:t,ssrc:void 0,transceiver:void 0,subDone:!1,pubDone:!1,type:n,streamId:void 0}},a.prototype.addOrUpdateDatachannelItem=function(t){var n=this.datachannelMap.get(t.url);n?t.msids.forEach(function(c){n.msids.find(function(p){if(p.id===c.id&&p.name===c.name)return!0})?console.log("RTS [STREAM MANAGER]: duplicate msid for datachannel",t):n.msids.push(c)}):this.datachannelMap.set(t.url,t)},a.prototype.deleteDatachannelItem=function(t){this.datachannelMap.delete(t.url)},a.prototype.getAllDatachannelList=function(){var t=[];return this.datachannelMap.forEach(function(n){t.push(s(s({},n),{latestUrl:n.latestUrl||n.originUrl}))}),t},a.prototype.getDatachannelByMsid=function(t){var n;if(t.url){var c=this.datachannelMap.get((0,o.pruneSubUrl)(t.url,!0));if(c)return t.msid?(n=c.msids.find(function(p){return p.name===t.msid}))===null||n===void 0?void 0:n.datachannel:c.msids[0].datachannel}else console.warn("[getDatachannelByMsid] config.url is required.")},a.prototype.getPubOrSubDoneMediaUrlByIndex=function(t){var n=0,c=function(y){var E=p.streamMap[y],S=!1;if(E.audioInfoList.forEach(function(d){S=S||E.type===e.Publish&&d.pubDone||E.type===e.Subscribe&&d.subDone}),E.videoInfoList.forEach(function(d){S=S||E.type===e.Publish&&d.pubDone||E.type===e.Subscribe&&d.subDone}),S){if(n===t)return{value:y};n++}},p=this;for(var C in this.streamMap){var x=c(C);if(typeof x=="object")return x.value}},a.prototype.getDcUrlByIndex=function(t){var n=void 0;return this.datachannelMap.forEach(function(c){t===0&&(n={url:c.originUrl})}),n},a.prototype.updateLatestUrl=function(t){var n=this.get(t);return!!n&&(n.latestUrl=t,!0)},a}();v.StreamManager=r}},f={};function l(h){var v=f[h];if(v!==void 0)return v.exports;var u=f[h]={exports:{}};return _[h].call(u.exports,u,u.exports,l),u.exports}var m={};return(()=>{var h=m;Object.defineProperty(h,"__esModule",{value:!0}),h.DataChannelCore=h.EDatachannelStatus=h.PeerConnectionCore=void 0;var v=l(776);Object.defineProperty(h,"PeerConnectionCore",{enumerable:!0,get:function(){return v.PeerConnectionCore}}),Object.defineProperty(h,"EDatachannelStatus",{enumerable:!0,get:function(){return v.EDatachannelStatus}});var u=l(651);Object.defineProperty(h,"DataChannelCore",{enumerable:!0,get:function(){return u.DataChannelCore}})})(),m})(),H.exports=T()},2505:(H,T,_)=>{H.exports=_(8015)},5592:(H,T,_)=>{var f=_(9516),l=_(7522),m=_(3948),h=_(9106),v=_(9615),u=_(2012),s=_(4202),i=_(7763);H.exports=function(e){return new Promise(function(o,r){var a=e.data,t=e.headers,n=e.responseType;f.isFormData(a)&&delete t["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",C=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";t.Authorization="Basic "+btoa(p+":"+C)}var x=v(e.baseURL,e.url);function y(){if(c){var S="getAllResponseHeaders"in c?u(c.getAllResponseHeaders()):null,d={data:n&&n!=="text"&&n!=="json"?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:S,config:e,request:c};l(o,r,d),c=null}}if(c.open(e.method.toUpperCase(),h(x,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=y:c.onreadystatechange=function(){c&&c.readyState===4&&(c.status!==0||c.responseURL&&c.responseURL.indexOf("file:")===0)&&setTimeout(y)},c.onabort=function(){c&&(r(i("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){r(i("Network Error",e,null,c)),c=null},c.ontimeout=function(){var S="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(S=e.timeoutErrorMessage),r(i(S,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},f.isStandardBrowserEnv()){var E=(e.withCredentials||s(x))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;E&&(t[e.xsrfHeaderName]=E)}"setRequestHeader"in c&&f.forEach(t,function(S,d){a===void 0&&d.toLowerCase()==="content-type"?delete t[d]:c.setRequestHeader(d,S)}),f.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),n&&n!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(S){c&&(c.abort(),r(S),c=null)}),a||(a=null),c.send(a)})}},8015:(H,T,_)=>{var f=_(9516),l=_(9012),m=_(5155),h=_(5343);function v(s){var i=new m(s),e=l(m.prototype.request,i);return f.extend(e,m.prototype,i),f.extend(e,i),e}var u=v(_(6987));u.Axios=m,u.create=function(s){return v(h(u.defaults,s))},u.Cancel=_(1928),u.CancelToken=_(3191),u.isCancel=_(3864),u.all=function(s){return Promise.all(s)},u.spread=_(7980),u.isAxiosError=_(5019),H.exports=u,H.exports.default=u},1928:H=>{function T(_){this.message=_}T.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},T.prototype.__CANCEL__=!0,H.exports=T},3191:(H,T,_)=>{var f=_(1928);function l(m){if(typeof m!="function")throw new TypeError("executor must be a function.");var h;this.promise=new Promise(function(u){h=u});var v=this;m(function(u){v.reason||(v.reason=new f(u),h(v.reason))})}l.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},l.source=function(){var m;return{token:new l(function(h){m=h}),cancel:m}},H.exports=l},3864:H=>{H.exports=function(T){return!(!T||!T.__CANCEL__)}},5155:(H,T,_)=>{var f=_(9516),l=_(9106),m=_(3471),h=_(4490),v=_(5343),u=_(4841),s=u.validators;function i(e){this.defaults=e,this.interceptors={request:new m,response:new m}}i.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=v(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var o=e.transitional;o!==void 0&&u.assertOptions(o,{silentJSONParsing:s.transitional(s.boolean,"1.0.0"),forcedJSONParsing:s.transitional(s.boolean,"1.0.0"),clarifyTimeoutError:s.transitional(s.boolean,"1.0.0")},!1);var r=[],a=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(a=a&&y.synchronous,r.unshift(y.fulfilled,y.rejected))});var t,n=[];if(this.interceptors.response.forEach(function(y){n.push(y.fulfilled,y.rejected)}),!a){var c=[h,void 0];for(Array.prototype.unshift.apply(c,r),c=c.concat(n),t=Promise.resolve(e);c.length;)t=t.then(c.shift(),c.shift());return t}for(var p=e;r.length;){var C=r.shift(),x=r.shift();try{p=C(p)}catch(y){x(y);break}}try{t=h(p)}catch(y){return Promise.reject(y)}for(;n.length;)t=t.then(n.shift(),n.shift());return t},i.prototype.getUri=function(e){return e=v(this.defaults,e),l(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},f.forEach(["delete","get","head","options"],function(e){i.prototype[e]=function(o,r){return this.request(v(r||{},{method:e,url:o,data:(r||{}).data}))}}),f.forEach(["post","put","patch"],function(e){i.prototype[e]=function(o,r,a){return this.request(v(a||{},{method:e,url:o,data:r}))}}),H.exports=i},3471:(H,T,_)=>{var f=_(9516);function l(){this.handlers=[]}l.prototype.use=function(m,h,v){return this.handlers.push({fulfilled:m,rejected:h,synchronous:!!v&&v.synchronous,runWhen:v?v.runWhen:null}),this.handlers.length-1},l.prototype.eject=function(m){this.handlers[m]&&(this.handlers[m]=null)},l.prototype.forEach=function(m){f.forEach(this.handlers,function(h){h!==null&&m(h)})},H.exports=l},9615:(H,T,_)=>{var f=_(9137),l=_(4680);H.exports=function(m,h){return m&&!f(h)?l(m,h):h}},7763:(H,T,_)=>{var f=_(5449);H.exports=function(l,m,h,v,u){var s=new Error(l);return f(s,m,h,v,u)}},4490:(H,T,_)=>{var f=_(9516),l=_(2881),m=_(3864),h=_(6987);function v(u){u.cancelToken&&u.cancelToken.throwIfRequested()}H.exports=function(u){return v(u),u.headers=u.headers||{},u.data=l.call(u,u.data,u.headers,u.transformRequest),u.headers=f.merge(u.headers.common||{},u.headers[u.method]||{},u.headers),f.forEach(["delete","get","head","post","put","patch","common"],function(s){delete u.headers[s]}),(u.adapter||h.adapter)(u).then(function(s){return v(u),s.data=l.call(u,s.data,s.headers,u.transformResponse),s},function(s){return m(s)||(v(u),s&&s.response&&(s.response.data=l.call(u,s.response.data,s.response.headers,u.transformResponse))),Promise.reject(s)})}},5449:H=>{H.exports=function(T,_,f,l,m){return T.config=_,f&&(T.code=f),T.request=l,T.response=m,T.isAxiosError=!0,T.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},T}},5343:(H,T,_)=>{var f=_(9516);H.exports=function(l,m){m=m||{};var h={},v=["url","method","data"],u=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function e(t,n){return f.isPlainObject(t)&&f.isPlainObject(n)?f.merge(t,n):f.isPlainObject(n)?f.merge({},n):f.isArray(n)?n.slice():n}function o(t){f.isUndefined(m[t])?f.isUndefined(l[t])||(h[t]=e(void 0,l[t])):h[t]=e(l[t],m[t])}f.forEach(v,function(t){f.isUndefined(m[t])||(h[t]=e(void 0,m[t]))}),f.forEach(u,o),f.forEach(s,function(t){f.isUndefined(m[t])?f.isUndefined(l[t])||(h[t]=e(void 0,l[t])):h[t]=e(void 0,m[t])}),f.forEach(i,function(t){t in m?h[t]=e(l[t],m[t]):t in l&&(h[t]=e(void 0,l[t]))});var r=v.concat(u).concat(s).concat(i),a=Object.keys(l).concat(Object.keys(m)).filter(function(t){return r.indexOf(t)===-1});return f.forEach(a,o),h}},7522:(H,T,_)=>{var f=_(7763);H.exports=function(l,m,h){var v=h.config.validateStatus;h.status&&v&&!v(h.status)?m(f("Request failed with status code "+h.status,h.config,null,h.request,h)):l(h)}},2881:(H,T,_)=>{var f=_(9516),l=_(6987);H.exports=function(m,h,v){var u=this||l;return f.forEach(v,function(s){m=s.call(u,m,h)}),m}},6987:(H,T,_)=>{var f=_(9516),l=_(7018),m=_(5449),h={"Content-Type":"application/x-www-form-urlencoded"};function v(i,e){!f.isUndefined(i)&&f.isUndefined(i["Content-Type"])&&(i["Content-Type"]=e)}var u,s={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(u=_(5592)),u),transformRequest:[function(i,e){return l(e,"Accept"),l(e,"Content-Type"),f.isFormData(i)||f.isArrayBuffer(i)||f.isBuffer(i)||f.isStream(i)||f.isFile(i)||f.isBlob(i)?i:f.isArrayBufferView(i)?i.buffer:f.isURLSearchParams(i)?(v(e,"application/x-www-form-urlencoded;charset=utf-8"),i.toString()):f.isObject(i)||e&&e["Content-Type"]==="application/json"?(v(e,"application/json"),function(o,r,a){if(f.isString(o))try{return(r||JSON.parse)(o),f.trim(o)}catch(t){if(t.name!=="SyntaxError")throw t}return(0,JSON.stringify)(o)}(i)):i}],transformResponse:[function(i){var e=this.transitional,o=e&&e.silentJSONParsing,r=e&&e.forcedJSONParsing,a=!o&&this.responseType==="json";if(a||r&&f.isString(i)&&i.length)try{return JSON.parse(i)}catch(t){if(a)throw t.name==="SyntaxError"?m(t,this,"E_JSON_PARSE"):t}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(i){return i>=200&&i<300}};s.headers={common:{Accept:"application/json, text/plain, */*"}},f.forEach(["delete","get","head"],function(i){s.headers[i]={}}),f.forEach(["post","put","patch"],function(i){s.headers[i]=f.merge(h)}),H.exports=s},9012:H=>{H.exports=function(T,_){return function(){for(var f=new Array(arguments.length),l=0;l<f.length;l++)f[l]=arguments[l];return T.apply(_,f)}}},9106:(H,T,_)=>{var f=_(9516);function l(m){return encodeURIComponent(m).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}H.exports=function(m,h,v){if(!h)return m;var u;if(v)u=v(h);else if(f.isURLSearchParams(h))u=h.toString();else{var s=[];f.forEach(h,function(e,o){e!=null&&(f.isArray(e)?o+="[]":e=[e],f.forEach(e,function(r){f.isDate(r)?r=r.toISOString():f.isObject(r)&&(r=JSON.stringify(r)),s.push(l(o)+"="+l(r))}))}),u=s.join("&")}if(u){var i=m.indexOf("#");i!==-1&&(m=m.slice(0,i)),m+=(m.indexOf("?")===-1?"?":"&")+u}return m}},4680:H=>{H.exports=function(T,_){return _?T.replace(/\/+$/,"")+"/"+_.replace(/^\/+/,""):T}},3948:(H,T,_)=>{var f=_(9516);H.exports=f.isStandardBrowserEnv()?{write:function(l,m,h,v,u,s){var i=[];i.push(l+"="+encodeURIComponent(m)),f.isNumber(h)&&i.push("expires="+new Date(h).toGMTString()),f.isString(v)&&i.push("path="+v),f.isString(u)&&i.push("domain="+u),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read:function(l){var m=document.cookie.match(new RegExp("(^|;\\s*)("+l+")=([^;]*)"));return m?decodeURIComponent(m[3]):null},remove:function(l){this.write(l,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9137:H=>{H.exports=function(T){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(T)}},5019:H=>{H.exports=function(T){return typeof T=="object"&&T.isAxiosError===!0}},4202:(H,T,_)=>{var f=_(9516);H.exports=f.isStandardBrowserEnv()?function(){var l,m=/(msie|trident)/i.test(navigator.userAgent),h=document.createElement("a");function v(u){var s=u;return m&&(h.setAttribute("href",s),s=h.href),h.setAttribute("href",s),{href:h.href,protocol:h.protocol?h.protocol.replace(/:$/,""):"",host:h.host,search:h.search?h.search.replace(/^\?/,""):"",hash:h.hash?h.hash.replace(/^#/,""):"",hostname:h.hostname,port:h.port,pathname:h.pathname.charAt(0)==="/"?h.pathname:"/"+h.pathname}}return l=v(window.location.href),function(u){var s=f.isString(u)?v(u):u;return s.protocol===l.protocol&&s.host===l.host}}():function(){return!0}},7018:(H,T,_)=>{var f=_(9516);H.exports=function(l,m){f.forEach(l,function(h,v){v!==m&&v.toUpperCase()===m.toUpperCase()&&(l[m]=h,delete l[v])})}},2012:(H,T,_)=>{var f=_(9516),l=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];H.exports=function(m){var h,v,u,s={};return m&&f.forEach(m.split(`
|
|
79
|
-
`),function(i){if(u=i.indexOf(":"),h=f.trim(i.substr(0,u)).toLowerCase(),v=f.trim(i.substr(u+1)),h){if(s[h]&&l.indexOf(h)>=0)return;s[h]=h==="set-cookie"?(s[h]?s[h]:[]).concat([v]):s[h]?s[h]+", "+v:v}}),s}},7980:H=>{H.exports=function(T){return function(_){return T.apply(null,_)}}},4841:(H,T,_)=>{var f=_(4198),l={};["object","boolean","number","function","string","symbol"].forEach(function(u,s){l[u]=function(i){return typeof i===u||"a"+(s<1?"n ":" ")+u}});var m={},h=f.version.split(".");function v(u,s){for(var i=s?s.split("."):h,e=u.split("."),o=0;o<3;o++){if(i[o]>e[o])return!0;if(i[o]<e[o])return!1}return!1}l.transitional=function(u,s,i){var e=s&&v(s);function o(r,a){return"[Axios v"+f.version+"] Transitional option '"+r+"'"+a+(i?". "+i:"")}return function(r,a,t){if(u===!1)throw new Error(o(a," has been removed in "+s));return e&&!m[a]&&(m[a]=!0,console.warn(o(a," has been deprecated since v"+s+" and will be removed in the near future"))),!u||u(r,a,t)}},H.exports={isOlderVersion:v,assertOptions:function(u,s,i){if(typeof u!="object")throw new TypeError("options must be an object");for(var e=Object.keys(u),o=e.length;o-- >0;){var r=e[o],a=s[r];if(a){var t=u[r],n=t===void 0||a(t,r,u);if(n!==!0)throw new TypeError("option "+r+" must be "+n)}else if(i!==!0)throw Error("Unknown option "+r)}},validators:l}},9516:(H,T,_)=>{var f=_(9012),l=Object.prototype.toString;function m(e){return l.call(e)==="[object Array]"}function h(e){return e===void 0}function v(e){return e!==null&&typeof e=="object"}function u(e){if(l.call(e)!=="[object Object]")return!1;var o=Object.getPrototypeOf(e);return o===null||o===Object.prototype}function s(e){return l.call(e)==="[object Function]"}function i(e,o){if(e!=null)if(typeof e!="object"&&(e=[e]),m(e))for(var r=0,a=e.length;r<a;r++)o.call(null,e[r],r,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.call(null,e[t],t,e)}H.exports={isArray:m,isArrayBuffer:function(e){return l.call(e)==="[object ArrayBuffer]"},isBuffer:function(e){return e!==null&&!h(e)&&e.constructor!==null&&!h(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},isFormData:function(e){return typeof FormData<"u"&&e instanceof FormData},isArrayBufferView:function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isObject:v,isPlainObject:u,isUndefined:h,isDate:function(e){return l.call(e)==="[object Date]"},isFile:function(e){return l.call(e)==="[object File]"},isBlob:function(e){return l.call(e)==="[object Blob]"},isFunction:s,isStream:function(e){return v(e)&&s(e.pipe)},isURLSearchParams:function(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:i,merge:function e(){var o={};function r(n,c){u(o[c])&&u(n)?o[c]=e(o[c],n):u(n)?o[c]=e({},n):m(n)?o[c]=n.slice():o[c]=n}for(var a=0,t=arguments.length;a<t;a++)i(arguments[a],r);return o},extend:function(e,o,r){return i(o,function(a,t){e[t]=r&&typeof a=="function"?f(a,r):a}),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}}},3412:H=>{/*! media-device - ver 1.4.0 created:2025/7/3 19:29:03 */H.exports=(()=>{var T={304:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BrowserDeviceManager=void 0;var h=m(101),v=m(853),u=m(62),s=m(913),i=m(331),e=m(1),o=m(935),r=m(603),a=function(){function t(){this.systemUtil=new h.SystemUtil,this.deviceManager=this.createDeviceManager()}return t.prototype.getCameraList=function(){return this.deviceManager.getCameraList()},t.prototype.getMicList=function(){return this.deviceManager.getMicList()},t.prototype.getSpeakerList=function(){return this.deviceManager.getSpeakerList()},t.prototype.getAudioTrack=function(n){return this.deviceManager.getAudioTrack(n)},t.prototype.getVideoTrack=function(n){return this.deviceManager.getVideoTrack(n)},t.prototype.getAudioVideoTracks=function(n){return this.deviceManager.getAudioVideoTracks(n)},t.prototype.getScreenTrack=function(n){return this.deviceManager.getScreenTrack(n)},t.prototype.getAudioStream=function(n){return this.deviceManager.getAudioStream(n)},t.prototype.getVideoStream=function(n){return this.deviceManager.getVideoStream(n)},t.prototype.getScreenStream=function(n){return this.deviceManager.getScreenStream(n)},t.prototype.checkSupportScreenShare=function(){return this.deviceManager.checkSupportScreenShare()},t.prototype.createDeviceManager=function(){return this.systemUtil.isWindows?new o.WindowsDeviceManager:this.systemUtil.isAndroid?new v.AndroidDeviceManager:this.systemUtil.isIos?new s.IosDeviceManager:this.systemUtil.isMacOS?new e.MacDeviceManager:this.systemUtil.isLinux?new i.LinuxDeviceManager:new u.BaseDeviceManager},t.isDeviceManagerError=r.DeviceError.isDeviceManagerError,t}();l.BrowserDeviceManager=a},603:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DeviceError=l.DeviceErrorDescription=l.DeviceErrorCode=void 0;var h=m(610);(function(u){u[u.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",u[u.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",u[u.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",u[u.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",u[u.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",u[u.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",u[u.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",u[u.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",u[u.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",u[u.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",u[u.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",u[u.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",u[u.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",u[u.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",u[u.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",u[u.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",u[u.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",u[u.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT"})(l.DeviceErrorCode||(l.DeviceErrorCode={})),function(u){u.ERRORMESSAGE_DEVICENOTFOUND="Requested device not found",u.ERRORMESSAGE_DEVICENOTALLOWED="Permission denied",u.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE="Permission denied by system",u.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",u.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED="video device not allowed",u.ERRORMESSAGE_AUDIODEVICENOTREADABLE="Could not start audio source",u.ERRORMESSAGE_VIDEODEVICENOTREADABLE="Could not start video source",u.ERRORNAME_DEVICENOTFOUND="NotFoundError",u.ERRORNAME_DEVICENOTALLOWED="NotAllowedError",u.ERRORNAME_DEVICENOTREADABLE="NotReadableError",u.ERRORNAME_DEVICEOVERCONSTRAINED="OverconstrainedError",u.ERRORNAME_INVALID_ACCESS="InvalidAccessError"}(l.DeviceErrorDescription||(l.DeviceErrorDescription={}));var v=function(){function u(s,i){this.linkUtil=new h.LinkUtil,this.code=s,this.reason=i,this.relatedLink=this.linkUtil.getRelatedLink(s)}return u.isDeviceManagerError=function(s){return!!(s&&typeof s=="object"&&"code"in s&&"reason"in s)},u}();l.DeviceError=v},873:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DeviceType=l.MobileCameraType=void 0,function(m){m[m.USER=0]="USER",m[m.ENV=1]="ENV"}(l.MobileCameraType||(l.MobileCameraType={})),function(m){m.Camera="videoinput",m.Mic="audioinput",m.Mixed="audiovideoinput",m.Screen="screen",m.Speaker="audiooutput"}(l.DeviceType||(l.DeviceType={}))},853:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.AndroidDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(583).MobileDeviceManager);l.AndroidDeviceManager=u},62:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BaseDeviceManager=void 0;var h=m(603),v=m(873),u=function(){function s(){}return s.prototype.checkSupportScreenShare=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia&&navigator.mediaDevices.getDisplayMedia)},s.prototype.getCameraList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Camera).then(function(){i.getDeviceList(v.DeviceType.Camera).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Camera,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Camera,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getMicList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Mic).then(function(){i.getDeviceList(v.DeviceType.Mic).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Mic,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Mic,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getSpeakerList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Speaker).then(function(){i.getDeviceList(v.DeviceType.Speaker).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Speaker,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Speaker,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getAudioTrack=function(i){return this.getAudioStream(i).then(function(e){return e.getAudioTracks()[0]})},s.prototype.getAudioStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createAudioConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Mic,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getVideoTrack=function(i){return this.getVideoStream(i).then(function(e){return e.getVideoTracks()[0]})},s.prototype.getVideoStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createVideoConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Camera,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getAudioVideoTracks=function(i){return this.getMixedStream(i).then(function(e){return e.getTracks()})},s.prototype.getMixedStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createMixedConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Mixed,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getScreenTrack=function(i){return this.getScreenStream(i).then(function(e){return e.getTracks()})},s.prototype.getScreenStream=function(i){var e=this;return new Promise(function(o,r){e.checkSupportScreenShare()?navigator.mediaDevices.getDisplayMedia(i).then(function(a){o(a)}).catch(function(a){r(e.parseError(v.DeviceType.Screen,a))}):r(new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"browser not support screenshare"))})},s.prototype.checkSupport=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.getUserMedia)},s.prototype.getDeviceList=function(i){return new Promise(function(e,o){navigator.mediaDevices.enumerateDevices().then(function(r){var a=[];r.forEach(function(t){t.kind===i&&a.push(t)}),e(a)}).catch(function(r){o(r)})})},s.prototype.getDeviceRight=function(i){return new Promise(function(e,o){var r;v.DeviceType.Camera===i?r={video:!0}:v.DeviceType.Mic!==i&&v.DeviceType.Speaker!==i||(r={audio:!0}),navigator.mediaDevices.getUserMedia(r).then(function(a){a.getTracks().forEach(function(t){t.stop()}),e(void 0)}).catch(function(a){e(void 0)})})},s.prototype.parseError=function(i,e){var o=null;return v.DeviceType.Mic===i?o=this.parseAudioError(e):v.DeviceType.Camera===i?o=this.parseVideoError(e):v.DeviceType.Mixed===i?o=this.parseMixedError(e):v.DeviceType.Screen===i&&(o=this.parseScreenError(e)),o===null?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_UNKNOWNERROR,""):o},s.prototype.parseAudioError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND,"audio device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED,"audio device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):null},s.prototype.parseVideoError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND,"video device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},s.prototype.parseMixedError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTFOUND,"audio or video device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED,"audio or video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTREADABLE,"audio or video device not readable"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},s.prototype.parseScreenError=function(i){return i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTALLOWED?i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOTALLOWED,i.message):new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION,i.message):i.name===h.DeviceErrorDescription.ERRORNAME_INVALID_ACCESS?new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_INVALIDACCESS,i.message):null},s.prototype.createVideoConstraints=function(i){var e={video:i};return Object.keys(i).length===0&&(e={video:!0}),e},s.prototype.createAudioConstraints=function(i){var e={audio:i};return Object.keys(i).length===0&&(e={audio:!0}),e},s.prototype.createMixedConstraints=function(i){return i},s}();l.BaseDeviceManager=u},913:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.IosDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(583).MobileDeviceManager);l.IosDeviceManager=u},331:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.LinuxDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.LinuxDeviceManager=u},1:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.MacDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.MacDeviceManager=u},583:function(f,l,m){var h,v=this&&this.__extends||(h=function(i,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a])})(i,e)},function(i,e){function o(){this.constructor=i}h(i,e),i.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(l,"__esModule",{value:!0}),l.MobileDeviceManager=void 0;var u=m(603),s=function(i){function e(){return i.call(this)||this}return v(e,i),e.prototype.checkSupportScreenShare=function(){return!1},e.prototype.getScreenTrack=function(o){return new Promise(function(r,a){a(new u.DeviceError(u.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e.prototype.getScreenStream=function(o){return new Promise(function(r,a){a(new u.DeviceError(u.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e}(m(62).BaseDeviceManager);l.MobileDeviceManager=s},935:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.WindowsDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.WindowsDeviceManager=u},607:function(f,l,m){var h=this&&this.__createBinding||(Object.create?function(s,i,e,o){o===void 0&&(o=e),Object.defineProperty(s,o,{enumerable:!0,get:function(){return i[e]}})}:function(s,i,e,o){o===void 0&&(o=e),s[o]=i[e]}),v=this&&this.__exportStar||function(s,i){for(var e in s)e==="default"||Object.prototype.hasOwnProperty.call(i,e)||h(i,s,e)};Object.defineProperty(l,"__esModule",{value:!0}),l.BrowserDeviceManager=void 0;var u=m(304);Object.defineProperty(l,"BrowserDeviceManager",{enumerable:!0,get:function(){return u.BrowserDeviceManager}}),v(m(873),l),window&&(window.BrowserDeviceManager=u.BrowserDeviceManager)},610:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkUtil=void 0;var h,v=m(603),u=m(261),s=m(54);(function(a){a[a.Windows=0]="Windows",a[a.MacOS=1]="MacOS",a[a.Other=2]="Other"})(h||(h={}));var i="ms-settings:",e="x-apple.systempreferences:com.apple.preference.security?",o={SYS_MIC:[i+"privacy-microphone",e+"Privacy_Microphone"],SYS_CAMERA:[i+"privacy-webcam",e+"Privacy_Camera"],SYS_SCREENSHARE:["",e+"Privacy_ScreenCapture"]},r=function(){function a(){u||console.error("SystemUtil is not found"),this.systemType=this.getSystemType()}return a.prototype.getRelatedLink=function(t){var n="",c=this.systemType;switch(t){case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE:n=o.SYS_MIC[c];break;case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE:n=o.SYS_CAMERA[c];break;case v.DeviceErrorCode.ERROR_SCREENSHARE_UNKNOWNERRO:case v.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION:n=o.SYS_SCREENSHARE[c];break;case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED:s.isChrome?n=this.getChromeResetLink():s.isEdge&&(n=this.getEdgeResetLink());break;default:n=""}return n},a.prototype.getSystemType=function(){return u.isWindows?h.Windows:u.isMacOS?h.MacOS:h.Other},a.prototype.getChromeResetLink=function(){return"chrome://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},a.prototype.getEdgeResetLink=function(){return"edge://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},a}();l.LinkUtil=r},101:(f,l)=>{var m;Object.defineProperty(l,"__esModule",{value:!0}),l.SystemUtil=void 0,function(v){v[v.Unknown=0]="Unknown",v[v.MacOS=1]="MacOS",v[v.Windows=2]="Windows",v[v.Android=3]="Android",v[v.Iphone=4]="Iphone",v[v.Ipad=5]="Ipad",v[v.Linux=6]="Linux"}(m||(m={}));var h=function(){function v(){this.systemType=m.Unknown,this.getSystemInfo()}return Object.defineProperty(v.prototype,"isIos",{get:function(){return this.systemType===m.Ipad||this.systemType===m.Iphone},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isAndroid",{get:function(){return this.systemType===m.Android},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isMacOS",{get:function(){return this.systemType===m.MacOS},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isWindows",{get:function(){return this.systemType===m.Windows},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isLinux",{get:function(){return this.systemType===m.Linux},enumerable:!1,configurable:!0}),v.prototype.getSystemInfo=function(){if(navigator&&navigator.userAgent){var u=navigator.userAgent.toLocaleLowerCase();u.indexOf("ipad")>-1?this.systemType=m.Ipad:u.indexOf("iphone")>-1?this.systemType=m.Iphone:u.indexOf("android")>-1?this.systemType=m.Android:u.indexOf("win")>-1?this.systemType=m.Windows:u.indexOf("mac")>-1?this.systemType=m.MacOS:u.indexOf("linux")>-1?this.systemType=m.Linux:u.indexOf("")>-1&&(this.systemType=m.Unknown)}},v}();l.SystemUtil=h},54:f=>{f.exports=window.BrowserUtil},261:f=>{f.exports=window.SystemUtil}},_={};return function f(l){if(_[l])return _[l].exports;var m=_[l]={exports:{}};return T[l].call(m.exports,m,m.exports,f),m.exports}(607)})()},6677:(H,T,_)=>{var f=_(7963);function l(s,i,e,o,r){var a=f.writeRtpDescription(s.kind,i);if(a+=f.writeIceParameters(s.iceGatherer.getLocalParameters()),a+=f.writeDtlsParameters(s.dtlsTransport.getLocalParameters(),e==="offer"?"actpass":r||"active"),a+="a=mid:"+s.mid+`\r
|
|
79
|
+
`),function(i){if(u=i.indexOf(":"),h=f.trim(i.substr(0,u)).toLowerCase(),v=f.trim(i.substr(u+1)),h){if(s[h]&&l.indexOf(h)>=0)return;s[h]=h==="set-cookie"?(s[h]?s[h]:[]).concat([v]):s[h]?s[h]+", "+v:v}}),s}},7980:H=>{H.exports=function(T){return function(_){return T.apply(null,_)}}},4841:(H,T,_)=>{var f=_(4198),l={};["object","boolean","number","function","string","symbol"].forEach(function(u,s){l[u]=function(i){return typeof i===u||"a"+(s<1?"n ":" ")+u}});var m={},h=f.version.split(".");function v(u,s){for(var i=s?s.split("."):h,e=u.split("."),o=0;o<3;o++){if(i[o]>e[o])return!0;if(i[o]<e[o])return!1}return!1}l.transitional=function(u,s,i){var e=s&&v(s);function o(r,a){return"[Axios v"+f.version+"] Transitional option '"+r+"'"+a+(i?". "+i:"")}return function(r,a,t){if(u===!1)throw new Error(o(a," has been removed in "+s));return e&&!m[a]&&(m[a]=!0,console.warn(o(a," has been deprecated since v"+s+" and will be removed in the near future"))),!u||u(r,a,t)}},H.exports={isOlderVersion:v,assertOptions:function(u,s,i){if(typeof u!="object")throw new TypeError("options must be an object");for(var e=Object.keys(u),o=e.length;o-- >0;){var r=e[o],a=s[r];if(a){var t=u[r],n=t===void 0||a(t,r,u);if(n!==!0)throw new TypeError("option "+r+" must be "+n)}else if(i!==!0)throw Error("Unknown option "+r)}},validators:l}},9516:(H,T,_)=>{var f=_(9012),l=Object.prototype.toString;function m(e){return l.call(e)==="[object Array]"}function h(e){return e===void 0}function v(e){return e!==null&&typeof e=="object"}function u(e){if(l.call(e)!=="[object Object]")return!1;var o=Object.getPrototypeOf(e);return o===null||o===Object.prototype}function s(e){return l.call(e)==="[object Function]"}function i(e,o){if(e!=null)if(typeof e!="object"&&(e=[e]),m(e))for(var r=0,a=e.length;r<a;r++)o.call(null,e[r],r,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.call(null,e[t],t,e)}H.exports={isArray:m,isArrayBuffer:function(e){return l.call(e)==="[object ArrayBuffer]"},isBuffer:function(e){return e!==null&&!h(e)&&e.constructor!==null&&!h(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},isFormData:function(e){return typeof FormData<"u"&&e instanceof FormData},isArrayBufferView:function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isObject:v,isPlainObject:u,isUndefined:h,isDate:function(e){return l.call(e)==="[object Date]"},isFile:function(e){return l.call(e)==="[object File]"},isBlob:function(e){return l.call(e)==="[object Blob]"},isFunction:s,isStream:function(e){return v(e)&&s(e.pipe)},isURLSearchParams:function(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:i,merge:function e(){var o={};function r(n,c){u(o[c])&&u(n)?o[c]=e(o[c],n):u(n)?o[c]=e({},n):m(n)?o[c]=n.slice():o[c]=n}for(var a=0,t=arguments.length;a<t;a++)i(arguments[a],r);return o},extend:function(e,o,r){return i(o,function(a,t){e[t]=r&&typeof a=="function"?f(a,r):a}),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}}},3412:H=>{/*! media-device - ver 1.4.1 created:2025/10/21 10:43:54 */H.exports=(()=>{var T={304:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BrowserDeviceManager=void 0;var h=m(101),v=m(853),u=m(62),s=m(913),i=m(331),e=m(1),o=m(935),r=m(603),a=function(){function t(){this.systemUtil=new h.SystemUtil,this.deviceManager=this.createDeviceManager()}return t.prototype.getCameraList=function(){return this.deviceManager.getCameraList()},t.prototype.getMicList=function(){return this.deviceManager.getMicList()},t.prototype.getSpeakerList=function(){return this.deviceManager.getSpeakerList()},t.prototype.getAudioTrack=function(n){return this.deviceManager.getAudioTrack(n)},t.prototype.getVideoTrack=function(n){return this.deviceManager.getVideoTrack(n)},t.prototype.getAudioVideoTracks=function(n){return this.deviceManager.getAudioVideoTracks(n)},t.prototype.getScreenTrack=function(n){return this.deviceManager.getScreenTrack(n)},t.prototype.getAudioStream=function(n){return this.deviceManager.getAudioStream(n)},t.prototype.getVideoStream=function(n){return this.deviceManager.getVideoStream(n)},t.prototype.getScreenStream=function(n){return this.deviceManager.getScreenStream(n)},t.prototype.checkSupportScreenShare=function(){return this.deviceManager.checkSupportScreenShare()},t.prototype.createDeviceManager=function(){return this.systemUtil.isWindows?new o.WindowsDeviceManager:this.systemUtil.isAndroid?new v.AndroidDeviceManager:this.systemUtil.isIos?new s.IosDeviceManager:this.systemUtil.isMacOS?new e.MacDeviceManager:this.systemUtil.isLinux?new i.LinuxDeviceManager:new u.BaseDeviceManager},t.isDeviceManagerError=r.DeviceError.isDeviceManagerError,t}();l.BrowserDeviceManager=a},603:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DeviceError=l.DeviceErrorDescription=l.DeviceErrorCode=void 0;var h=m(610);(function(u){u[u.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",u[u.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",u[u.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",u[u.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",u[u.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",u[u.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",u[u.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",u[u.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",u[u.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",u[u.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",u[u.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",u[u.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",u[u.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",u[u.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",u[u.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",u[u.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",u[u.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",u[u.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT"})(l.DeviceErrorCode||(l.DeviceErrorCode={})),function(u){u.ERRORMESSAGE_DEVICENOTFOUND="Requested device not found",u.ERRORMESSAGE_DEVICENOTALLOWED="Permission denied",u.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE="Permission denied by system",u.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",u.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED="video device not allowed",u.ERRORMESSAGE_AUDIODEVICENOTREADABLE="Could not start audio source",u.ERRORMESSAGE_VIDEODEVICENOTREADABLE="Could not start video source",u.ERRORNAME_DEVICENOTFOUND="NotFoundError",u.ERRORNAME_DEVICENOTALLOWED="NotAllowedError",u.ERRORNAME_DEVICENOTREADABLE="NotReadableError",u.ERRORNAME_DEVICEOVERCONSTRAINED="OverconstrainedError",u.ERRORNAME_INVALID_ACCESS="InvalidAccessError"}(l.DeviceErrorDescription||(l.DeviceErrorDescription={}));var v=function(){function u(s,i){this.linkUtil=new h.LinkUtil,this.code=s,this.reason=i,this.relatedLink=this.linkUtil.getRelatedLink(s)}return u.isDeviceManagerError=function(s){return!!(s&&typeof s=="object"&&"code"in s&&"reason"in s)},u}();l.DeviceError=v},873:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DeviceType=l.MobileCameraType=void 0,function(m){m[m.USER=0]="USER",m[m.ENV=1]="ENV"}(l.MobileCameraType||(l.MobileCameraType={})),function(m){m.Camera="videoinput",m.Mic="audioinput",m.Mixed="audiovideoinput",m.Screen="screen",m.Speaker="audiooutput"}(l.DeviceType||(l.DeviceType={}))},853:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.AndroidDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(583).MobileDeviceManager);l.AndroidDeviceManager=u},62:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BaseDeviceManager=void 0;var h=m(603),v=m(873),u=function(){function s(){}return s.prototype.checkSupportScreenShare=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia&&navigator.mediaDevices.getDisplayMedia)},s.prototype.getCameraList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Camera).then(function(){i.getDeviceList(v.DeviceType.Camera).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Camera,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Camera,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getMicList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Mic).then(function(){i.getDeviceList(v.DeviceType.Mic).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Mic,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Mic,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getSpeakerList=function(){var i=this;return new Promise(function(e,o){i.checkSupport()?i.getDeviceRight(v.DeviceType.Speaker).then(function(){i.getDeviceList(v.DeviceType.Speaker).then(function(r){e(r)}).catch(function(r){o(i.parseError(v.DeviceType.Speaker,r))})}).catch(function(r){o(i.parseError(v.DeviceType.Speaker,r))}):o(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getAudioTrack=function(i){return this.getAudioStream(i).then(function(e){return e.getAudioTracks()[0]})},s.prototype.getAudioStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createAudioConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Mic,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getVideoTrack=function(i){return this.getVideoStream(i).then(function(e){return e.getVideoTracks()[0]})},s.prototype.getVideoStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createVideoConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Camera,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getAudioVideoTracks=function(i){return this.getMixedStream(i).then(function(e){return e.getTracks()})},s.prototype.getMixedStream=function(i){var e=this;return new Promise(function(o,r){if(e.checkSupport()){var a=e.createMixedConstraints(i);navigator.mediaDevices.getUserMedia(a).then(function(t){o(t)}).catch(function(t){r(e.parseError(v.DeviceType.Mixed,t))})}else r(new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},s.prototype.getScreenTrack=function(i){return this.getScreenStream(i).then(function(e){return e.getTracks()})},s.prototype.getScreenStream=function(i){var e=this;return new Promise(function(o,r){e.checkSupportScreenShare()?navigator.mediaDevices.getDisplayMedia(i).then(function(a){o(a)}).catch(function(a){r(e.parseError(v.DeviceType.Screen,a))}):r(new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"browser not support screenshare"))})},s.prototype.checkSupport=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.getUserMedia)},s.prototype.getDeviceList=function(i){return new Promise(function(e,o){navigator.mediaDevices.enumerateDevices().then(function(r){var a=[];r.forEach(function(t){t.kind===i&&a.push(t)}),e(a)}).catch(function(r){o(r)})})},s.prototype.getDeviceRight=function(i){return new Promise(function(e,o){var r;v.DeviceType.Camera===i?r={video:!0}:v.DeviceType.Mic!==i&&v.DeviceType.Speaker!==i||(r={audio:!0}),navigator.mediaDevices.getUserMedia(r).then(function(a){a.getTracks().forEach(function(t){t.stop()}),e(void 0)}).catch(function(a){e(void 0)})})},s.prototype.parseError=function(i,e){var o=null;return v.DeviceType.Mic===i?o=this.parseAudioError(e):v.DeviceType.Camera===i?o=this.parseVideoError(e):v.DeviceType.Mixed===i?o=this.parseMixedError(e):v.DeviceType.Screen===i&&(o=this.parseScreenError(e)),o===null?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_UNKNOWNERROR,""):o},s.prototype.parseAudioError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND,"audio device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED,"audio device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):null},s.prototype.parseVideoError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND,"video device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.message===h.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},s.prototype.parseMixedError=function(i){return i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTFOUND,"audio or video device not found"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED,"audio or video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_NOTREADABLE,"audio or video device not readable"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):i.message===h.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE?new h.DeviceError(h.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},s.prototype.parseScreenError=function(i){return i.name===h.DeviceErrorDescription.ERRORNAME_DEVICENOTALLOWED?i.message===h.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED?new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOTALLOWED,i.message):new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION,i.message):i.name===h.DeviceErrorDescription.ERRORNAME_INVALID_ACCESS?new h.DeviceError(h.DeviceErrorCode.ERROR_SCREENSHARE_INVALIDACCESS,i.message):null},s.prototype.createVideoConstraints=function(i){typeof i.deviceId=="string"&&(i.deviceId={exact:i.deviceId});var e={video:i};return Object.keys(i).length===0&&(e={video:!0}),e},s.prototype.createAudioConstraints=function(i){typeof i.deviceId=="string"&&(i.deviceId={exact:i.deviceId});var e={audio:i};return Object.keys(i).length===0&&(e={audio:!0}),e},s.prototype.createMixedConstraints=function(i){return i},s}();l.BaseDeviceManager=u},913:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.IosDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(583).MobileDeviceManager);l.IosDeviceManager=u},331:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.LinuxDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.LinuxDeviceManager=u},1:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.MacDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.MacDeviceManager=u},583:function(f,l,m){var h,v=this&&this.__extends||(h=function(i,e){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,r){o.__proto__=r}||function(o,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a])})(i,e)},function(i,e){function o(){this.constructor=i}h(i,e),i.prototype=e===null?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(l,"__esModule",{value:!0}),l.MobileDeviceManager=void 0;var u=m(603),s=function(i){function e(){return i.call(this)||this}return v(e,i),e.prototype.checkSupportScreenShare=function(){return!1},e.prototype.getScreenTrack=function(o){return new Promise(function(r,a){a(new u.DeviceError(u.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e.prototype.getScreenStream=function(o){return new Promise(function(r,a){a(new u.DeviceError(u.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e}(m(62).BaseDeviceManager);l.MobileDeviceManager=s},935:function(f,l,m){var h,v=this&&this.__extends||(h=function(s,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])})(s,i)},function(s,i){function e(){this.constructor=s}h(s,i),s.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)});Object.defineProperty(l,"__esModule",{value:!0}),l.WindowsDeviceManager=void 0;var u=function(s){function i(){return s.call(this)||this}return v(i,s),i}(m(62).BaseDeviceManager);l.WindowsDeviceManager=u},607:function(f,l,m){var h=this&&this.__createBinding||(Object.create?function(s,i,e,o){o===void 0&&(o=e),Object.defineProperty(s,o,{enumerable:!0,get:function(){return i[e]}})}:function(s,i,e,o){o===void 0&&(o=e),s[o]=i[e]}),v=this&&this.__exportStar||function(s,i){for(var e in s)e==="default"||Object.prototype.hasOwnProperty.call(i,e)||h(i,s,e)};Object.defineProperty(l,"__esModule",{value:!0}),l.BrowserDeviceManager=void 0;var u=m(304);Object.defineProperty(l,"BrowserDeviceManager",{enumerable:!0,get:function(){return u.BrowserDeviceManager}}),v(m(873),l),window&&(window.BrowserDeviceManager=u.BrowserDeviceManager)},610:(f,l,m)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkUtil=void 0;var h,v=m(603),u=m(261),s=m(54);(function(a){a[a.Windows=0]="Windows",a[a.MacOS=1]="MacOS",a[a.Other=2]="Other"})(h||(h={}));var i="ms-settings:",e="x-apple.systempreferences:com.apple.preference.security?",o={SYS_MIC:[i+"privacy-microphone",e+"Privacy_Microphone"],SYS_CAMERA:[i+"privacy-webcam",e+"Privacy_Camera"],SYS_SCREENSHARE:["",e+"Privacy_ScreenCapture"]},r=function(){function a(){u||console.error("SystemUtil is not found"),this.systemType=this.getSystemType()}return a.prototype.getRelatedLink=function(t){var n="",c=this.systemType;switch(t){case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE:n=o.SYS_MIC[c];break;case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE:n=o.SYS_CAMERA[c];break;case v.DeviceErrorCode.ERROR_SCREENSHARE_UNKNOWNERRO:case v.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION:n=o.SYS_SCREENSHARE[c];break;case v.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED:case v.DeviceErrorCode.ERROR_DEVICE_NOTALLOWED:s.isChrome?n=this.getChromeResetLink():s.isEdge&&(n=this.getEdgeResetLink());break;default:n=""}return n},a.prototype.getSystemType=function(){return u.isWindows?h.Windows:u.isMacOS?h.MacOS:h.Other},a.prototype.getChromeResetLink=function(){return"chrome://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},a.prototype.getEdgeResetLink=function(){return"edge://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},a}();l.LinkUtil=r},101:(f,l)=>{var m;Object.defineProperty(l,"__esModule",{value:!0}),l.SystemUtil=void 0,function(v){v[v.Unknown=0]="Unknown",v[v.MacOS=1]="MacOS",v[v.Windows=2]="Windows",v[v.Android=3]="Android",v[v.Iphone=4]="Iphone",v[v.Ipad=5]="Ipad",v[v.Linux=6]="Linux"}(m||(m={}));var h=function(){function v(){this.systemType=m.Unknown,this.getSystemInfo()}return Object.defineProperty(v.prototype,"isIos",{get:function(){return this.systemType===m.Ipad||this.systemType===m.Iphone},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isAndroid",{get:function(){return this.systemType===m.Android},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isMacOS",{get:function(){return this.systemType===m.MacOS},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isWindows",{get:function(){return this.systemType===m.Windows},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isLinux",{get:function(){return this.systemType===m.Linux},enumerable:!1,configurable:!0}),v.prototype.getSystemInfo=function(){if(navigator&&navigator.userAgent){var u=navigator.userAgent.toLocaleLowerCase();u.indexOf("ipad")>-1?this.systemType=m.Ipad:u.indexOf("iphone")>-1?this.systemType=m.Iphone:u.indexOf("android")>-1?this.systemType=m.Android:u.indexOf("win")>-1?this.systemType=m.Windows:u.indexOf("mac")>-1?this.systemType=m.MacOS:u.indexOf("linux")>-1?this.systemType=m.Linux:u.indexOf("")>-1&&(this.systemType=m.Unknown)}},v}();l.SystemUtil=h},54:f=>{f.exports=window.BrowserUtil},261:f=>{f.exports=window.SystemUtil}},_={};return function f(l){if(_[l])return _[l].exports;var m=_[l]={exports:{}};return T[l].call(m.exports,m,m.exports,f),m.exports}(607)})()},6677:(H,T,_)=>{var f=_(7963);function l(s,i,e,o,r){var a=f.writeRtpDescription(s.kind,i);if(a+=f.writeIceParameters(s.iceGatherer.getLocalParameters()),a+=f.writeDtlsParameters(s.dtlsTransport.getLocalParameters(),e==="offer"?"actpass":r||"active"),a+="a=mid:"+s.mid+`\r
|
|
80
80
|
`,s.rtpSender&&s.rtpReceiver?a+=`a=sendrecv\r
|
|
81
81
|
`:s.rtpSender?a+=`a=sendonly\r
|
|
82
82
|
`:s.rtpReceiver?a+=`a=recvonly\r
|
|
@@ -144,7 +144,7 @@ t=0 0\r
|
|
|
144
144
|
`;h+="a="+v,h+="a=ssrc:"+_.sendEncodingParameters[0].ssrc+" "+v,_.sendEncodingParameters[0].rtx&&(h+="a=ssrc:"+_.sendEncodingParameters[0].rtx.ssrc+" "+v,h+="a=ssrc-group:FID "+_.sendEncodingParameters[0].ssrc+" "+_.sendEncodingParameters[0].rtx.ssrc+`\r
|
|
145
145
|
`)}return h+="a=ssrc:"+_.sendEncodingParameters[0].ssrc+" cname:"+T.localCName+`\r
|
|
146
146
|
`,_.rtpSender&&_.sendEncodingParameters[0].rtx&&(h+="a=ssrc:"+_.sendEncodingParameters[0].rtx.ssrc+" cname:"+T.localCName+`\r
|
|
147
|
-
`),h},T.getDirection=function(_,f){for(var l=T.splitLines(_),m=0;m<l.length;m++)switch(l[m]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return l[m].substr(2)}return f?T.getDirection(f):"sendrecv"},T.getKind=function(_){return T.splitLines(_)[0].split(" ")[0].substr(2)},T.isRejected=function(_){return _.split(" ",2)[1]==="0"},T.parseMLine=function(_){var f=T.splitLines(_)[0].substr(2).split(" ");return{kind:f[0],port:parseInt(f[1],10),protocol:f[2],fmt:f.slice(3).join(" ")}},T.parseOLine=function(_){var f=T.matchPrefix(_,"o=")[0].substr(2).split(" ");return{username:f[0],sessionId:f[1],sessionVersion:parseInt(f[2],10),netType:f[3],addressType:f[4],address:f[5]}},T.isValidSDP=function(_){if(typeof _!="string"||_.length===0)return!1;for(var f=T.splitLines(_),l=0;l<f.length;l++)if(f[l].length<2||f[l].charAt(1)!=="=")return!1;return!0},H.exports=T},4845:function(H,T,_){var f=this&&this.__assign||function(){return f=Object.assign||function(n){for(var c,p=1,C=arguments.length;p<C;p++)for(var x in c=arguments[p])Object.prototype.hasOwnProperty.call(c,x)&&(n[x]=c[x]);return n},f.apply(this,arguments)},l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(T,"__esModule",{value:!0}),T.AliRTS=void 0;var m=_(2550),h=_(9428),v=_(3412),u=_(7668),s=_(233),i=l(_(2818)),e=_(5259),o=_(7989),r=_(6420),a=_(1698),t=function(){function n(){}return n.createClient=function(c){var p=c||{};return p.customReporter||(p.customReporter=n.customReporter),p.trackLog===void 0&&(p.trackLog=n.trackLog),a.configProvider.setContext(p),new u.RtsClient(p)},n.getMicList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getMicList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.getCameraList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getCameraList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.getSpeakerList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getSpeakerList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.createStream=function(c){return new Promise(function(p,C){var x=new m.LocalStream,y=new i.default({customReporter:n.customReporter,trackLog:n.trackLog});x.init(c).then(function(){p(x),y.reportStreamCreated(c,{videoTrack:!!x.videoTrack,audioTrack:!!x.audioTrack,screenAudio:!!x.screenAudioTrack,surface:x.screenSurfaceType})}).catch(function(E){var S=f(f({},E),{relatedLink:E.extraInfo});delete S.extraInfo,C(S),y.reportErrorInfo(h.ErrorCode.ERROR_INIT_LOCAL_FAIL,E.message,E.traceId,{config:c,originErr:E})})})},n.deviceManager=new v.BrowserDeviceManager,n.BrowserUtil=s.BrowserUtil,n.SystenUtil=s.SystemUtil,n.SupportUtil=o.SupportUtil,n.Clock=r.Clock,n.VideoProfileMap=e.VideoProfileMap,n.ScreenProfileMap=e.ScreenProfileMap,n.AudioProfileMap=e.AudioProfileMap,n.ErrorCode=h.ErrorCode,n.customReporter=function(){},n.trackLog=!0,n}();T.AliRTS=t},7028:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.default={version:"2.13.2",protocol_version:2,sdk_version:"0.0.1"}},9428:(H,T)=>{var _,f;Object.defineProperty(T,"__esModule",{value:!0}),T.PUB_RECONNECT_ERROR_LIST=T.RECONNECT_ERROR_EXCLUDE_LIST=T.SUB_RECONNECT_ERROR_LIST=T.DeviceErrorCode=T.ErrorCode=void 0,function(l){l[l.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",l[l.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",l[l.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",l[l.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",l[l.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",l[l.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",l[l.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",l[l.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",l[l.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",l[l.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",l[l.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",l[l.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",l[l.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",l[l.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT",l[l.ERROR_SIGNAL_ERROR=10101]="ERROR_SIGNAL_ERROR",l[l.ERROR_PLAY_FAILED=10102]="ERROR_PLAY_FAILED",l[l.ERROR_NOTSUPPORT_WEBRTC=10110]="ERROR_NOTSUPPORT_WEBRTC",l[l.ERROR_BROWSER_NOTSUPPORT=10111]="ERROR_BROWSER_NOTSUPPORT",l[l.ERROR_BROWSER_VERSIONLOW=10112]="ERROR_BROWSER_VERSIONLOW",l[l.ERROR_NOTSUPPORT_H264=10113]="ERROR_NOTSUPPORT_H264",l[l.ERROR_CREATEOFFER=10114]="ERROR_CREATEOFFER",l[l.ERROR_NO_DATACHANNEL=10115]="ERROR_NO_DATACHANNEL",l[l.ERROR_INIT_LOCAL_FAIL=10116]="ERROR_INIT_LOCAL_FAIL",l[l.ERROR_HEMLELEMENT_NOTMATCH=10125]="ERROR_HEMLELEMENT_NOTMATCH",l[l.ERROR_AUTOPLAY_ERROR=10201]="ERROR_AUTOPLAY_ERROR",l[l.ERROR_PLAY_URL=10202]="ERROR_PLAY_URL",l[l.ERROR_SUBSCRIBE_NOTHING=10203]="ERROR_SUBSCRIBE_NOTHING",l[l.ERROR_HTMLELEMENT_ERROR=10204]="ERROR_HTMLELEMENT_ERROR",l[l.ERROR_HTTPREQUEST_ERROR=10205]="ERROR_HTTPREQUEST_ERROR",l[l.ERROR_ANSWER_ERROR=10206]="ERROR_ANSWER_ERROR",l[l.ERROR_INBOUND_TIMEOUT=10207]="ERROR_INBOUND_TIMEOUT",l[l.ERROR_STREAM_ENDED=10208]="ERROR_STREAM_ENDED",l[l.ERROR_PC_DISCONNECTED=10209]="ERROR_PC_DISCONNECTED",l[l.ERROR_TRANSPORT_CLOSED=10210]="ERROR_TRANSPORT_CLOSED",l[l.ERROR_SIGNAL_URL=10211]="ERROR_SIGNAL_URL",l[l.ERROR_IP_MIGRATE=10212]="ERROR_IP_MIGRATE",l[l.ERROR_PUBLISH_URL=10300]="ERROR_PUBLISH_URL",l[l.ERROR_PUBLISH_NOAUDIO=10301]="ERROR_PUBLISH_NOAUDIO",l[l.ERROR_PUBLISH_NOSTREAM=10302]="ERROR_PUBLISH_NOSTREAM",l[l.ERROR_DATACHANNEL_PARAM=10500]="ERROR_DATACHANNEL_PARAM",l[l.ERROR_DATACHANNEL_OPEN=10501]="ERROR_DATACHANNEL_OPEN",l[l.ERROR_MEDIASTREAMTRACK_TYPE_ERROR=11e3]="ERROR_MEDIASTREAMTRACK_TYPE_ERROR",l[l.ERROR_MEDIASTREAMTRACK_KIND_ERROR=11001]="ERROR_MEDIASTREAMTRACK_KIND_ERROR",l[l.ERROR_MEDIASTREAMTRACK_AUDIO_NONE=11002]="ERROR_MEDIASTREAMTRACK_AUDIO_NONE",l[l.ERROR_CUSTOMSTREAM_NONE=11003]="ERROR_CUSTOMSTREAM_NONE",l[l.ERROR_CUSTOMSTREAM_INVALID=11004]="ERROR_CUSTOMSTREAM_INVALID",l[l.ERROR_CUSTOMSTREAM_TRACK_NONE=11005]="ERROR_CUSTOMSTREAM_TRACK_NONE",l[l.ERROR_PREERCONNECTION_UNKNOWN=12e3]="ERROR_PREERCONNECTION_UNKNOWN",l[l.ERROR_SUBADD_NO_RESULT=13e3]="ERROR_SUBADD_NO_RESULT",l[l.ERROR_PUBADD_NO_RESULT=13001]="ERROR_PUBADD_NO_RESULT",l[l.ERROR_SINGLE_PC_STREAM_ERROR=13100]="ERROR_SINGLE_PC_STREAM_ERROR",l[l.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED=13101]="ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED",l[l.ERROR_SINGLE_PC_FULL_RECONNECT=13102]="ERROR_SINGLE_PC_FULL_RECONNECT",l[l.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED=13103]="ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED"}(_||(T.ErrorCode=_={})),function(l){l[l.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",l[l.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",l[l.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",l[l.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",l[l.ERROR_SCREENSHARE_NOTSUPPORT=10010]="ERROR_SCREENSHARE_NOTSUPPORT",l[l.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",l[l.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",l[l.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",l[l.ERROR_SCREENSHARE_SAFARI_INVALIDACCESS=10014]="ERROR_SCREENSHARE_SAFARI_INVALIDACCESS",l[l.ERROR_SCREENSHARE_UNKNOWNERRO=10019]="ERROR_SCREENSHARE_UNKNOWNERRO",l[l.ERROR_DEVICE_NOTSUPPORT=2e4]="ERROR_DEVICE_NOTSUPPORT"}(f||(T.DeviceErrorCode=f={})),T.SUB_RECONNECT_ERROR_LIST=[_.ERROR_INBOUND_TIMEOUT,_.ERROR_STREAM_ENDED,_.ERROR_PC_DISCONNECTED],T.RECONNECT_ERROR_EXCLUDE_LIST=[_.ERROR_AUTOPLAY_ERROR,_.ERROR_PLAY_URL,_.ERROR_SUBSCRIBE_NOTHING,_.ERROR_HTMLELEMENT_ERROR,_.ERROR_HEMLELEMENT_NOTMATCH,_.ERROR_PUBLISH_URL,_.ERROR_PUBLISH_NOAUDIO,_.ERROR_PUBLISH_NOSTREAM],T.PUB_RECONNECT_ERROR_LIST=[_.ERROR_PC_DISCONNECTED,_.ERROR_TRANSPORT_CLOSED]},5044:(H,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.RtsError=void 0;var f=_(9428),l=function(){function m(h,v,u,s){this.errorCode=h,this.errorCodeName=f.ErrorCode[h],this.message=v,this.traceId=u,s&&(this.extraInfo=s)}return m.prototype.renameCode=function(h){this.errorCode=h,this.errorCodeName=f.ErrorCode[h]},m}();T.RtsError=l},6091:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.PlayEvent=T.PlayType=void 0,T.PlayType={PLAY_CANPLAY:"canplay",PLAY_WAITING:"waiting",PLAY_PLAYING:"playing",PLAY_MEDIA:"media",PLAY_ENDED:"ended",PLAY_TIMEOUT:"timeout"};var _=function(f){this.event=f};T.PlayEvent=_},5917:(H,T)=>{var _,f,l,m;Object.defineProperty(T,"__esModule",{value:!0}),T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=T.DEFAULT_HEARTBEAT_TIMEOUT=T.DEFAULT_RETRY_PUBLISH_INTERVAL=T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=T.DEFAULT_RETRY_PUBLISH_LIMIT=T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=T.EWorkerAction=T.EWorkerSource=T.EConnectStatus=T.TrackType=void 0,function(h){h.AUDIO="audio",h.VIDEO="video"}(_||(T.TrackType=_={})),function(h){h[h.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",h[h.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",h[h.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",h[h.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(f||(T.EConnectStatus=f={})),function(h){h.Sender="sender",h.Receiver="receiver"}(l||(T.EWorkerSource=l={})),function(h){h.Setup="setup",h.InserSEI="insertSEI",h.UpdatePubStats="updatePubStats",h.UpdateSubStats="updateSubStats",h.SwitchCumuDelay="switchCumuDelay"}(m||(T.EWorkerAction=m={})),T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,T.DEFAULT_RETRY_PUBLISH_LIMIT=5,T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,T.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,T.DEFAULT_HEARTBEAT_TIMEOUT=8,T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},6600:function(H,T,_){var f,l=this&&this.__extends||(f=function(R,D){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,b){A.__proto__=b}||function(A,b){for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(A[g]=b[g])},f(R,D)},function(R,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function A(){this.constructor=R}f(R,D),R.prototype=D===null?Object.create(D):(A.prototype=D.prototype,new A)}),m=this&&this.__assign||function(){return m=Object.assign||function(R){for(var D,A=1,b=arguments.length;A<b;A++)for(var g in D=arguments[A])Object.prototype.hasOwnProperty.call(D,g)&&(R[g]=D[g]);return R},m.apply(this,arguments)},h=this&&this.__awaiter||function(R,D,A,b){return new(A||(A=Promise))(function(g,O){function k(W){try{w(b.next(W))}catch(M){O(M)}}function U(W){try{w(b.throw(W))}catch(M){O(M)}}function w(W){var M;W.done?g(W.value):(M=W.value,M instanceof A?M:new A(function(N){N(M)})).then(k,U)}w((b=b.apply(R,D||[])).next())})},v=this&&this.__generator||function(R,D){var A,b,g,O,k={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return O={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(O[Symbol.iterator]=function(){return this}),O;function U(w){return function(W){return function(M){if(A)throw new TypeError("Generator is already executing.");for(;O&&(O=0,M[0]&&(k=0)),k;)try{if(A=1,b&&(g=2&M[0]?b.return:M[0]?b.throw||((g=b.return)&&g.call(b),0):b.next)&&!(g=g.call(b,M[1])).done)return g;switch(b=0,g&&(M=[2&M[0],g.value]),M[0]){case 0:case 1:g=M;break;case 4:return k.label++,{value:M[1],done:!1};case 5:k.label++,b=M[1],M=[0];continue;case 7:M=k.ops.pop(),k.trys.pop();continue;default:if(g=k.trys,!((g=g.length>0&&g[g.length-1])||M[0]!==6&&M[0]!==2)){k=0;continue}if(M[0]===3&&(!g||M[1]>g[0]&&M[1]<g[3])){k.label=M[1];break}if(M[0]===6&&k.label<g[1]){k.label=g[1],g=M;break}if(g&&k.label<g[2]){k.label=g[2],k.ops.push(M);break}g[2]&&k.ops.pop(),k.trys.pop();continue}M=D.call(R,k)}catch(N){M=[6,N],b=0}finally{A=g=0}if(5&M[0])throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}([w,W])}}},u=this&&this.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(T,"__esModule",{value:!0}),T.CommonController=void 0;var s=_(771),i=_(5917),e=u(_(102)),o=_(9594),r=_(2718),a=_(1698),t=_(5044),n=_(9428),c=_(6091),p=_(5788),C=_(280),x=u(_(1401)),y=_(5649),E=function(R){function D(A){var b=R.call(this)||this;return b.datachannelList=new S,b.receiverCodecPreferences={},b.senderCodecPreferences={},b.canAutoAssignDcId=!0,b.reporter=A,b.signalChannel=new p.SignalChannel({reporter:A}),b.proxySignalChannelEvents(),b}return l(D,R),D.prototype.setConfig=function(A){this.config=A},D.prototype.setPeerconnection=function(A){var b=this;A!==this.peerconnection&&(this.peerconnection&&this.peerconnection.removeAllListeners(),this.peerconnection=A,this.signalChannel.isOpen||(this.waitForOpenPms=new Promise(function(g,O){b.peerconnection.on("datachannelStatusChange",function(k){var U;b.emit("datachannelStatusChange",k),k.status===C.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(b.signalChannel.setPeerConnection(A),b.canAutoAssignDcId=typeof((U=b.signalChannel.datachannelCore)===null||U===void 0?void 0:U.id)=="number",g())})})),this.peerconnection.on("cumuDelayNotSupported",function(){var g;b.emit("cumuDelayNotSupported"),(g=b.reporter)===null||g===void 0||g.reportCumuDelayNotSupported()}),this.peerconnection.on("innerSubscribeDeleteTracks",function(g){b.handleWorkerSubDelete(g)}),this.peerconnection.on("encodedFrame",function(g){var O;b.emit("encodedFrame",g),g.kind==="video"&&(0,o.parseSei)((O=g.frame)===null||O===void 0?void 0:O.data).forEach(function(k){var U;if(k.payloadType===y.CUMU_DELAY_SEI_PAYLOAD_TYPE){var w={pub:{},sub:{},grtn:{},AIPub:{},AISub:{},AIAgent:{},AIGrtn:{},other:{}},W=new y.CumuDelaySeiPayloadParser(k.data);w.pub=W.pub||{},w.sub=g.subStats||{},w.grtn=W.grtn||{},w.AIPub=W.AIPub||{},w.AISub=W.AISub||{},w.AIAgent=W.AIAgent||{},w.AIGrtn=W.AIGrtn||{},w.other=W.other||{},Object.keys(w.pub).forEach(function(N){var P=w.pub[N];delete w.pub[N],w.pub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.sub).forEach(function(N){var P=w.sub[N];delete w.sub[N],w.sub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AIPub).forEach(function(N){var P=w.AIPub[N];delete w.AIPub[N],w.AIPub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AISub).forEach(function(N){var P=w.AISub[N];delete w.AISub[N],w.AISub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AIAgent).forEach(function(N){var P=w.AIAgent[N];delete w.AIAgent[N],w.AIAgent[(0,r.underlineToCamelCase)(N.toLowerCase())]=P}),Object.keys(w.AIGrtn).forEach(function(N){var P=w.AIGrtn[N];delete w.AIGrtn[N],w.AIGrtn[(0,r.underlineToCamelCase)(N.toLowerCase())]=P}),Object.keys(w.grtn).forEach(function(N){var P=w.grtn[N];delete w.grtn[N],w.grtn[(0,r.underlineToCamelCase)(N.toLowerCase())]=P});var M=void 0;try{M=(0,x.default)(w)}catch(N){console.warn(N,w)}M&&(k.data=new TextEncoder().encode(M),(U=b.reporter)===null||U===void 0||U.updateCumuDelayInfo({json:M}))}b.emit("receivedSEI",{url:g.url,vMsid:g.vMsid,sei:k})})}),this.peerconnection.on("message",function(g){var O;(O=b.reporter)===null||O===void 0||O.reportNotifyMessage(g)}),this.peerconnection.on("hebtReceived",function(g){b.emit("heartbeat",g)}),this.peerconnection.on("streamError",function(g){b.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",m({},g)))}),this.peerconnection.on("streamReconnect",function(g){b.emit("reconnect",{type:g.type,reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",m({},g)),retryTimes:1,extraInfo:m({},g)}),b.singleStreamReconnect(g).then(function(){b.emit("reconnectFinish",{type:g.type,latestUrl:g.latestUrl,msids:g.msids})}).catch(function(O){b.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:O}))})}),this.peerconnection.on("traceIdUpdate",function(g){b.emit("traceId",g)}),this.peerconnection.on("pcReconnect",function(g){b.emit("reconnect",{type:"pc",reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT,g.reMsg,"",m({},g)),retryTimes:1,extraInfo:m({},g)})}),(this.receiverCodecPreferences.video||this.receiverCodecPreferences.audio)&&this.peerconnection.setReceiverCodecPreferences(this.receiverCodecPreferences),(this.senderCodecPreferences.video||this.senderCodecPreferences.audio)&&this.peerconnection.setSenderCodecPreferences(this.senderCodecPreferences))},Object.defineProperty(D.prototype,"peerCore",{get:function(){var A;return(A=this.peerconnection)===null||A===void 0?void 0:A.getPeerCore()},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"streamManager",{get:function(){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.getStreamManager()},enumerable:!1,configurable:!0}),D.prototype.subscribeAdd=function(A,b){return h(this,void 0,void 0,function(){var g,O,k,U,w,W,M,N,P=this;return v(this,function(V){switch(V.label){case 0:if(A.forEach(function(j){var z;(z=P.reporter)===null||z===void 0||z.reportSubscribeStart(j.url,"",j.vMsid,j.aMsid,!0)}),!this.peerconnection)throw this.makeRtsError("subscribeAdd");this.peerconnection.isReused=!0,g=new Date().getTime(),V.label=1;case 1:return V.trys.push([1,3,,4]),[4,this.peerconnection.subAdd(A,b)];case 2:if(!(O=V.sent()).streamList)throw new t.RtsError(n.ErrorCode.ERROR_SUBADD_NO_RESULT,"subAdd streamList not found","",{api:"subscribeAdd",configList:A,response:O});return[3,4];case 3:throw k=V.sent(),U=k,(N=this.reporter)===null||N===void 0||N.reportErrorInfo(U.errorCode,U.message,U.traceId,U.extraInfo),U;case 4:return w=O.deleteRspTime-g,W=O.subAddRspTime-O.deleteRspTime,M=O.activeRspTime-O.subAddRspTime,O.streamList.forEach(function(j,z){var G,X,re,te;(G=P.reporter)===null||G===void 0||G.reportSubscribeOk({vurl:j.url||void 0,isSubAdd:!0});var oe,ue=A[z]||{},se=ue.targetStream,ce=ue.vMsid,de=ue.aMsid,pe=j.stream;if(se)return se.mergeStream(pe),(X=P.streamManager)===null||X===void 0||X.update(j.url,{stream:se,vMsid:ce?.[0],aMsid:de?.[0]}),void(j.stream=se);var he=(re=P.streamManager)===null||re===void 0?void 0:re.getStreamByMsid({url:j.url,vMsid:ce?.[0],aMsid:de?.[0]});if(he)he.mergeStream(pe),oe=he;else{(oe=new s.RemoteStream).updateMediaStream(pe),(te=P.streamManager)===null||te===void 0||te.update(j.url,{stream:oe,vMsid:ce?.[0],aMsid:de?.[0]}),oe.on("onCanPlay",function(){var fe,me,ge=new Date().getTime();(fe=P.reporter)===null||fe===void 0||fe.reportFirstFrameTime(j.url,j.traceId,-1,-1,ge-g,0,-1,{},w,W,M,ce,de,!0),(me=P.peerconnection)===null||me===void 0||me.playStart()});var Ee=new c.PlayEvent(c.PlayType.PLAY_CANPLAY);Ee.data={url:j.url,vMsid:ce?.[0]||"vMsid unknown",aMsid:de?.[0]||"aMsid unknown"},P.emit("onPlayEvent",Ee)}j.stream=oe}),[2,O.streamList]}})})},D.prototype.subscribeActive=function(A){return h(this,void 0,void 0,function(){var b;return v(this,function(g){if(!this.peerconnection)throw this.makeRtsError("subscribeActive");return[2,(b=this.peerconnection)===null||b===void 0?void 0:b.subActive(A)]})})},D.prototype.subscribeStop=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U;return v(this,function(w){switch(w.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeStop");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.subStop(A)];case 2:return b=w.sent(),this.peerconnection.getSubMonitor().updateTranceiversController(),g=this.peerconnection.getWorkerManager(),A.forEach(function(W){g.removeByUrl({url:W.url,source:i.EWorkerSource.Receiver})}),[3,4];case 3:throw O=w.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.subscribeDeleteTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeDeleteTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.subDeleteTracks(A)];case 2:if(!(b=U.sent()))throw this.makeRtsError("subscribeDeleteTracks");return this.peerconnection.getSubMonitor().updateTranceiversController(),this.handleWorkerSubDelete(A),[3,4];case 3:throw g=U.sent(),O=g,(k=this.reporter)===null||k===void 0||k.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),g;case 4:return[2,b]}})})},D.prototype.handleWorkerSubDelete=function(A){if(this.peerconnection){var b=this.peerconnection.getWorkerManager();A.forEach(function(g){var O,k;!((O=g.vMsid)===null||O===void 0)&&O.length&&b.removeByMsid({url:g.url,source:i.EWorkerSource.Receiver,kind:"video",msid:g.vMsid[0]}),!((k=g.aMsid)===null||k===void 0)&&k.length&&b.removeByMsid({url:g.url,source:i.EWorkerSource.Receiver,kind:"audio",msid:g.aMsid[0]})})}},D.prototype.publishAdd=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j=this;return v(this,function(z){switch(z.label){case 0:if(A.forEach(function(G){var X;(X=j.reporter)===null||X===void 0||X.reportStartPublish(G.url,"",!0)}),b=new Date().getTime(),!this.peerconnection)throw this.makeRtsError("publishAdd");z.label=1;case 1:return z.trys.push([1,3,,4]),[4,(M=this.peerconnection)===null||M===void 0?void 0:M.pubAdd(A)];case 2:if(!(g=z.sent()))throw new t.RtsError(n.ErrorCode.ERROR_PUBADD_NO_RESULT,"pubAdd streamList not found","",{api:"publishAdd",publishInfoList:A});return[3,4];case 3:throw O=z.sent(),k=O,(N=this.reporter)===null||N===void 0||N.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),k;case 4:return this.peerconnection.isReused=!0,U=new Date().getTime(),w=U-b,g.forEach(function(G){var X;(X=j.reporter)===null||X===void 0||X.reportPublishOk(G.url||"","",-1,-1,-1,G.traceId||"",w,!0)}),(W=(P=this.peerconnection)===null||P===void 0?void 0:P.getPc())&&(A.forEach(function(G){j.peerconnection&&G.stream.setEncodeParam(W)}),this.peerCore&&((V=this.peerconnection)===null||V===void 0||V.getPubMonitor().startHeartbeat(W,this.peerCore)),W.getSenders().forEach(function(G){var X;G.track&&((X=j.peerconnection)===null||X===void 0||X.handleEncodedInsertableStreams({sender:G}))})),[2,g]}})})},D.prototype.publishDeleteTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U;return v(this,function(w){switch(w.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishDeleteTracks");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.pubDeleteTracks(A)];case 2:if(!(b=w.sent()))throw this.makeRtsError("publishDeleteTracks");return this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),A.forEach(function(W){var M,N;!((M=W.vMsid)===null||M===void 0)&&M.length&&g.removeByMsid({url:W.url,source:i.EWorkerSource.Sender,kind:"video",msid:W.vMsid[0]}),!((N=W.aMsid)===null||N===void 0)&&N.length&&g.removeByMsid({url:W.url,source:i.EWorkerSource.Sender,kind:"audio",msid:W.aMsid[0]})}),[3,4];case 3:throw O=w.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.publishReplaceTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishReplaceTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.pubReplaceTracks(A)];case 2:if(!(b=U.sent()))throw this.makeRtsError("publishReplaceTracks");return this.peerconnection.getPubMonitor().updateSenders(),[3,4];case 3:throw g=U.sent(),O=g,(k=this.reporter)===null||k===void 0||k.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),g;case 4:return[2,b]}})})},D.prototype.publishStop=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w=this;return v(this,function(W){switch(W.label){case 0:if(A.forEach(function(M){var N;(N=w.reporter)===null||N===void 0||N.reportStopPublish(M.url,!0)}),!this.peerconnection)throw this.makeRtsError("publishStop");W.label=1;case 1:return W.trys.push([1,3,,4]),[4,this.peerconnection.pubStop(A)];case 2:return b=W.sent(),this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),A.forEach(function(M){g.removeByUrl({url:M.url,source:i.EWorkerSource.Sender})}),[3,4];case 3:throw O=W.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.handleAddDatachannel=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j,z=this;return v(this,function(G){switch(G.label){case 0:if(!A.url||!A.signalUrl||!A.msid)throw g=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, signalUrl, msid is required by subscribe(publish)AddDatachannel",""),(W=this.reporter)===null||W===void 0||W.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return b=A.type==="sub",this.waitForOpenPms?[4,this.waitForOpenPms]:[3,2];case 1:G.sent(),this.waitForOpenPms=void 0,G.label=2;case 2:if(this.signalChannel.isOpen)return[3,4];if(console.warn("Creating a new signal channel"),!A.signalUrl)throw g=new t.RtsError(n.ErrorCode.ERROR_SIGNAL_URL,"signal url is required",""),(M=this.reporter)===null||M===void 0||M.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return[4,this.initSignalChannel(A)];case 3:G.sent(),this.setPeerconnection(this.signalChannel.getPeerConnection()),this.canAutoAssignDcId=typeof((N=this.signalChannel.datachannelCore)===null||N===void 0?void 0:N.id)=="number",G.label=4;case 4:if(O=performance.now(),k={url:A.url,label:A.label,surl:A.signalUrl,msid:A.msid},b?(P=this.reporter)===null||P===void 0||P.reportDatachannelSubAdd(k):(V=this.reporter)===null||V===void 0||V.reportDatachannelPubAdd(k),!(U=(j=this.peerconnection)===null||j===void 0?void 0:j.getPc()))throw new Error("No avaliable peerconnection");return w=new C.DataChannelCore({pc:U,label:A.label,datachannelList:this.datachannelList.list,assignId:!this.canAutoAssignDcId,delayOpen:a.configProvider.getContext().datachannelDelayOpen}),this.datachannelList.update(w),[2,new Promise(function(X,re){return h(z,void 0,void 0,function(){var te,oe,ue,se,ce,de,pe,he,Ee,fe,me,ge,be,Re,Te,Pe,Oe=this;return v(this,function(Ae){switch(Ae.label){case 0:te="",oe=!1,ue=!1,w.on("statusChange",function(_e){var xe;(xe=Oe.reporter)===null||xe===void 0||xe.reportDatachannelStatusChange({state:C.EDatachannelStatus[_e],url:A.url,label:w.label,id:w.id,msid:A.msid}),_e===C.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(oe=!0,ue&&X({datachannel:w,traceId:te}))}),w.on("dispose",function(){var _e;(_e=Oe.reporter)===null||_e===void 0||_e.reportDatachannelDispose({url:A.url,label:w.label,id:w.id,msid:A.msid})}),Ae.label=1;case 1:return Ae.trys.push([1,6,,7]),se=[{url:A.url,msid:A.msid,datachannelId:w.id,label:A.label,datachannel:w}],b?[4,(fe=this.peerCore)===null||fe===void 0?void 0:fe.subscribeAddDatachannel(se)]:[3,3];case 2:return de=Ae.sent(),[3,5];case 3:return[4,(me=this.peerCore)===null||me===void 0?void 0:me.publishAddDatachannel(se)];case 4:de=Ae.sent(),Ae.label=5;case 5:return te=(be=(ge=(ce=de)==null?void 0:ce.streams)===null||ge===void 0?void 0:ge[0])===null||be===void 0?void 0:be.traceid,[3,7];case 6:return pe=Ae.sent(),he=pe,(Re=this.reporter)===null||Re===void 0||Re.reportErrorInfo(he.errorCode,he.message||"datachannel ".concat(b?"sub":"pub"," add error"),he.traceId,he.extraInfo),[2,re(pe)];case 7:return Ee={url:A.url,drct:Math.floor(performance.now()-O),tcid:te,label:w.label,id:w.id,msid:A.msid},b?(Te=this.reporter)===null||Te===void 0||Te.reportDatachannelSubAddOk(Ee):(Pe=this.reporter)===null||Pe===void 0||Pe.reportDatachannelPubAddOk(Ee),ue=!0,oe&&X({datachannel:w,traceId:te}),[2]}})})})]}})})},D.prototype.handleStopDatachannel=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j;return v(this,function(z){switch(z.label){case 0:if(!A.url||!A.datachannel)throw b=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, datachannel is required by subscribe(publish)StopDatachannel",""),(U=this.reporter)===null||U===void 0||U.reportErrorInfo(b.errorCode,b.message,b.traceId,b.extraInfo),b;if(!this.signalChannel.isOpen)throw b=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"Signal channel is closed",""),(w=this.reporter)===null||w===void 0||w.reportErrorInfo(b.errorCode,b.message,b.traceId,b.extraInfo),b;g=A.type==="sub",O=[{url:A.url}],k={url:A.url,label:A.datachannel.label,id:A.datachannel.id},g?(W=this.reporter)===null||W===void 0||W.reportDatachannelSubStop(k):(M=this.reporter)===null||M===void 0||M.reportDatachannelPubStop(k),z.label=1;case 1:return z.trys.push([1,6,,7]),g?[4,(N=this.peerCore)===null||N===void 0?void 0:N.subscribeStopDatachannel(O)]:[3,3];case 2:return z.sent(),[3,5];case 3:return[4,(P=this.peerCore)===null||P===void 0?void 0:P.publishStopDatachannel(O)];case 4:z.sent(),z.label=5;case 5:return[3,7];case 6:throw z.sent();case 7:return g?(V=this.reporter)===null||V===void 0||V.reportDatachannelSubStopOk(k):(j=this.reporter)===null||j===void 0||j.reportDatachannelPubStopOk(k),A.datachannel.dispose(),[2]}})})},D.prototype.subscribeAddDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleAddDatachannel(m(m({},A),{type:"sub"}))]})})},D.prototype.publishAddDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleAddDatachannel(m(m({},A),{type:"pub"}))]})})},D.prototype.subscribeStopDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleStopDatachannel(m(m({},A),{type:"sub"}))]})})},D.prototype.publishStopDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleStopDatachannel(m(m({},A),{type:"pub"}))]})})},D.prototype.getSubscribeVideoStats=function(A,b){return this.getSubscribeMediaStats(A,"video",b)},D.prototype.getSubscribeAudioStats=function(A,b){return this.getSubscribeMediaStats(A,"audio",b)},D.prototype.getPublishVideoStats=function(A,b){return this.getPublishMediaStats(A,"video",b)},D.prototype.getPublishAudioStats=function(A,b){return this.getPublishMediaStats(A,"audio",b)},D.prototype.sendSEI=function(A){var b,g;if(!((b=this.peerconnection)===null||b===void 0)&&b.isReused)return(g=this.peerconnection)===null||g===void 0?void 0:g.sendSEI(A)},D.prototype.setReceiverCodecPreferences=function(A){this.receiverCodecPreferences=m({},A)},D.prototype.setSenderCodecPreferences=function(A){this.senderCodecPreferences=m({},A)},D.prototype.getSubscribeMediaStats=function(A,b,g){var O=this;return new Promise(function(k){return h(O,void 0,void 0,function(){var U,w,W,M,N;return v(this,function(P){switch(P.label){case 0:return this.streamManager?(U=void 0,w=this.streamManager.getAllMediaInfoList(A,!0),g?w.forEach(function(V){var j,z,G,X=(z=(j=V.transceiver)===null||j===void 0?void 0:j.receiver)===null||z===void 0?void 0:z.track;X?.kind===b&&V.msid===g&&(U=(G=V.transceiver)===null||G===void 0?void 0:G.receiver)}):U=(N=(M=w?.find(function(V){var j,z,G;return((G=(z=(j=V.transceiver)===null||j===void 0?void 0:j.receiver)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.kind)===b}))===null||M===void 0?void 0:M.transceiver)===null||N===void 0?void 0:N.receiver,U?(W=!1,[4,U.getStats()]):[2,k({})]):[2,k({})];case 1:return P.sent().forEach(function(V){V.type==="inbound-rtp"&&(W=!0,k(V))}),W||k({}),[2]}})})})},D.prototype.getPublishMediaStats=function(A,b,g){var O=this;return new Promise(function(k){return h(O,void 0,void 0,function(){var U,w,W,M,N;return v(this,function(P){switch(P.label){case 0:return this.streamManager?(U=void 0,w=this.streamManager.getAllMediaInfoList(A,!0),g?w.forEach(function(V){var j,z,G,X=(z=(j=V.transceiver)===null||j===void 0?void 0:j.sender)===null||z===void 0?void 0:z.track;X?.kind===b&&V.msid===g&&(U=(G=V.transceiver)===null||G===void 0?void 0:G.sender)}):U=(N=(M=w?.find(function(V){var j,z,G;return((G=(z=(j=V.transceiver)===null||j===void 0?void 0:j.sender)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.kind)===b}))===null||M===void 0?void 0:M.transceiver)===null||N===void 0?void 0:N.sender,U?(W=!1,[4,U.getStats()]):[2,k({})]):[2,k({})];case 1:return P.sent().forEach(function(V){V.type==="outbound-rtp"&&k(V)}),W||k({}),[2]}})})})},D.prototype.proxySignalChannelEvents=function(){var A=this;this.signalChannel.on("connectStatusChange",function(b){A.emit("connectStatusChange",b)}),this.signalChannel.on("onError",function(b){A.emit("onError",b)})},D.prototype.initSignalChannel=function(A){return this.signalChannel.createDatachannel(A)},D.prototype.makeRtsError=function(A){var b,g=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"No avaliable datachannel, you should subscribe/publish first.","",{api:A});return(b=this.reporter)===null||b===void 0||b.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g},D.prototype.singleStreamReconnect=function(A){var b=this;return new Promise(function(g,O){var k,U,w=A.type,W=void 0,M=void 0;switch(w){case"sub":(k=A.streams)===null||k===void 0||k.forEach(function(P){var V=[],j=[],z=!0,G=!0;A.msids.forEach(function(X){X.streamId===P.id&&(X.type==="video"?j.push(X.name):X.type==="audio"&&V.push(X.name))}),V.length||(z=!1),j.length||(G=!1),b.subscribeAddWithRetry({url:A.latestUrl,subAudio:z,subVideo:G,vMsid:j,aMsid:V,targetStream:P}).then(g).catch(O)});break;case"pub":(U=A.streams)===null||U===void 0||U.forEach(function(P){var V=[],j=[];A.msids.forEach(function(z){z.streamId===P.id&&(z.type==="video"?j.push(z.name):z.type==="audio"&&V.push(z.name))}),b.publishAddWithRetry([{url:A.latestUrl,vMsid:j,aMsid:V,stream:P}]).then(g).catch(O)});break;case"pub-data":if(A.msids.forEach(function(P){W=P.name,M=P.label}),W&&M){var N=A.latestUrl;b.publishAddDatachannelWithRetry({url:N,signalUrl:N,msid:W,label:M}).then(g).catch(O)}break;case"sub-data":A.msids.forEach(function(P){W=P.name,M=P.label}),W&&M&&(N=A.latestUrl,b.subscribeAddDatachannelWithRetry({url:N,signalUrl:N,msid:W,label:M}).then(g).catch(O));break;default:console.warn("RTS PC STREAM RECONNECT: Unknown signal")}})},D.prototype.updateAuth=function(A){var b;return!!(!((b=this.streamManager)===null||b===void 0)&&b.updateLatestUrl(A))},D.prototype.subscribeAddWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.subscribeAdd([A],!0).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.subscribeAddWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.publishAddWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.publishAdd(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.publishAddWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.subscribeAddDatachannelWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.subscribeAddDatachannel(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.subscribeAddDatachannelWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.publishAddDatachannelWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.publishAddDatachannel(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.publishAddDatachannelWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D}(e.default);T.CommonController=E;var S=function(){function R(){this._list=[]}return Object.defineProperty(R.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),R.prototype.update=function(D){var A=this._list.findIndex(function(b){return b.id===D.id});A!==-1?this._list.splice(A,1,D):this._list.push(D)},R}();function d(R){return R===void 0&&(R=1e3),new Promise(function(D){setTimeout(D,R)})}},9796:function(H,T,_){var f,l=this&&this.__extends||(f=function(x,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var d in S)Object.prototype.hasOwnProperty.call(S,d)&&(E[d]=S[d])},f(x,y)},function(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function E(){this.constructor=x}f(x,y),x.prototype=y===null?Object.create(y):(E.prototype=y.prototype,new E)}),m=this&&this.__assign||function(){return m=Object.assign||function(x){for(var y,E=1,S=arguments.length;E<S;E++)for(var d in y=arguments[E])Object.prototype.hasOwnProperty.call(y,d)&&(x[d]=y[d]);return x},m.apply(this,arguments)},h=this&&this.__awaiter||function(x,y,E,S){return new(E||(E=Promise))(function(d,R){function D(g){try{b(S.next(g))}catch(O){R(O)}}function A(g){try{b(S.throw(g))}catch(O){R(O)}}function b(g){var O;g.done?d(g.value):(O=g.value,O instanceof E?O:new E(function(k){k(O)})).then(D,A)}b((S=S.apply(x,y||[])).next())})},v=this&&this.__generator||function(x,y){var E,S,d,R,D={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return R={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(R[Symbol.iterator]=function(){return this}),R;function A(b){return function(g){return function(O){if(E)throw new TypeError("Generator is already executing.");for(;R&&(R=0,O[0]&&(D=0)),D;)try{if(E=1,S&&(d=2&O[0]?S.return:O[0]?S.throw||((d=S.return)&&d.call(S),0):S.next)&&!(d=d.call(S,O[1])).done)return d;switch(S=0,d&&(O=[2&O[0],d.value]),O[0]){case 0:case 1:d=O;break;case 4:return D.label++,{value:O[1],done:!1};case 5:D.label++,S=O[1],O=[0];continue;case 7:O=D.ops.pop(),D.trys.pop();continue;default:if(d=D.trys,!((d=d.length>0&&d[d.length-1])||O[0]!==6&&O[0]!==2)){D=0;continue}if(O[0]===3&&(!d||O[1]>d[0]&&O[1]<d[3])){D.label=O[1];break}if(O[0]===6&&D.label<d[1]){D.label=d[1],d=O;break}if(d&&D.label<d[2]){D.label=d[2],D.ops.push(O);break}d[2]&&D.ops.pop(),D.trys.pop();continue}O=y.call(x,D)}catch(k){O=[6,k],S=0}finally{E=d=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([b,g])}}},u=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(T,"__esModule",{value:!0}),T.Publisher=void 0;var s=_(5917),i=_(4865),e=u(_(7028)),o=_(9428),r=_(5044),a=_(7989),t=u(_(102)),n=u(_(8219)),c=_(2718),p=u(_(1401)),C=function(x){function y(E){var S=x.call(this)||this;return S.publishStartTimeStamp=0,S.pubReconnectTimes=0,S.isConnecting=!1,S.reconnectTimerHandle=null,S.reportMonitorTimes=0,S.reportSubFlag=!1,S.reporter=E,S.peerconnection=new i.RtsPeerconnection,S.peerconnection.on("connectStatusChange",function(d){d.status!==s.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&d.status!==s.EConnectStatus.CONNECT_STATUS_RECONNECTING||!S.hasRetries()?S.emit("connectStatusChange",d):S.emit("onError",new r.RtsError(o.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",""))}),S.peerconnection.on("onMonitorEvent",function(d){var R,D=d.eventList;(R=S.peerconnection)===null||R===void 0||R.updateStatsForSEI(D,d.type),d.type==="pub"?(S.reportMonitorTimes++,S.reportMonitorTimes%4==0&&(D.forEach(function(A){S.reporter.reportPushStats(A)}),S.reportSubFlag=!0,S.reportMonitorTimes=0)):d.type==="sub"&&S.reportSubFlag&&(S.handleSubMonitorEvent(D),S.reportSubFlag=!1)}),S.peerconnection.on("onTransportStateEvent",function(d){var R;S.peerconnection.isReused||((R=S.peerconnection.getPc())===null||R===void 0?void 0:R.connectionState)!=="closed"&&d.state==="closed"&&S.hasRetries()&&S.emit("onError",new r.RtsError(o.ErrorCode.ERROR_TRANSPORT_CLOSED,"Transport has been closed. ".concat(d.kind,"|").concat(d.type,"|").concat(d.url),"",{protocol:d.protocol}))}),S.peerconnection.on("pcReconnect",function(d){var R,D;d.ips?(R="Migrate with ips: ".concat((0,p.default)(d.ips)),D=o.ErrorCode.ERROR_IP_MIGRATE):(R="PC disconnected",D=o.ErrorCode.ERROR_PC_DISCONNECTED),S.emit("onError",new r.RtsError(D,R,"",{pcErrorInfo:d}))}),S.signalingUrl="",S.publishUrl="",S.publishConfig={},S}return l(y,x),y.prototype.publish=function(E,S,d){var R=this;return new Promise(function(D,A){if(R.unpublish(),d?.cumuDelay&&(d.encodedInsertableStreams=!0),R.localStream=S,R.publishUrl=E,R.publishConfig=d||{},R.checkPublishUrl())if(S)if(S.audioTrack===null)A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_NOAUDIO,"publish need audiotrack",""));else{var b=d?.signalUrl;R.signalingUrl=b||R.signalingUrl,R.publishStartTimeStamp=new Date().getTime(),S.setReporter(R.reporter),R.peerconnection.createOffer(S.hasAudio,S.hasVideo||S.hasScreen,S,m(m({},d),{publishUrl:E})).then(function(g){var O=g.desp,k=g.publishTrackInfoList;R.publishTrackInfoList=k;var U=new Date().getTime();R.reporter.reportStartPublish(R.publishUrl,R.signalingUrl),R.excuteSignal(O).then(function(w){var W=new Date().getTime();R.peerconnection.recvAnswer(w.data,{answerSdpHook:d?.answerSdpHook,tcpOnly:d?.tcpOnly}).then(function(){R.reporter.reportPublishOk(R.publishUrl,R.signalingUrl,U-R.publishStartTimeStamp,W-U,new Date().getTime()-W,w.data.trace_id),D(w.data.trace_id),R.pubReconnectTimes=0,R.peerconnection.pushStart()}).catch(function(M){M.traceid=w.data?w.data.trace_id:"";var N=new r.RtsError(M.errorCode||o.ErrorCode.ERROR_ANSWER_ERROR,M.message||"set answer error",M.traceid,{sdp:M.sdp});A(N)})}).catch(function(w){var W=new r.RtsError(w.errorCode||o.ErrorCode.ERROR_HTTPREQUEST_ERROR,w.message||"","",{response:w.response,sdp:w.sdp});A(W)})}).catch(function(g){var O=new r.RtsError(g.errorCode||o.ErrorCode.ERROR_CREATEOFFER,g.message||"","");A(O)})}else A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_NOSTREAM,"publish stream not found",""));else A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_URL,"url need artc://",""))})},y.prototype.unpublish=function(){this.peerconnection.reset(),this.reporter.reportStopPublish(),this.signalingUrl="",this.publishUrl="",this.publishTrackInfoList=null},y.prototype.getTrackInfoList=function(){return this.publishTrackInfoList||[]},y.prototype.getPeerConnection=function(){return this.peerconnection},y.prototype.replaceTrack=function(E,S){return this.peerconnection.replaceTrack(this.publishUrl,E,S)},y.prototype.excuteSignal=function(E){var S,d=this,R={type:E.type,sdp:E.sdp};return this.isSingleMsid()&&(R.sdp=R.sdp.replace(/msid\:-? /g,"msid:")),!((S=this.publishConfig)===null||S===void 0)&&S.cumuDelay&&(R.sdp=R.sdp.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
|
|
147
|
+
`),h},T.getDirection=function(_,f){for(var l=T.splitLines(_),m=0;m<l.length;m++)switch(l[m]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return l[m].substr(2)}return f?T.getDirection(f):"sendrecv"},T.getKind=function(_){return T.splitLines(_)[0].split(" ")[0].substr(2)},T.isRejected=function(_){return _.split(" ",2)[1]==="0"},T.parseMLine=function(_){var f=T.splitLines(_)[0].substr(2).split(" ");return{kind:f[0],port:parseInt(f[1],10),protocol:f[2],fmt:f.slice(3).join(" ")}},T.parseOLine=function(_){var f=T.matchPrefix(_,"o=")[0].substr(2).split(" ");return{username:f[0],sessionId:f[1],sessionVersion:parseInt(f[2],10),netType:f[3],addressType:f[4],address:f[5]}},T.isValidSDP=function(_){if(typeof _!="string"||_.length===0)return!1;for(var f=T.splitLines(_),l=0;l<f.length;l++)if(f[l].length<2||f[l].charAt(1)!=="=")return!1;return!0},H.exports=T},4845:function(H,T,_){var f=this&&this.__assign||function(){return f=Object.assign||function(n){for(var c,p=1,C=arguments.length;p<C;p++)for(var x in c=arguments[p])Object.prototype.hasOwnProperty.call(c,x)&&(n[x]=c[x]);return n},f.apply(this,arguments)},l=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(T,"__esModule",{value:!0}),T.AliRTS=void 0;var m=_(2550),h=_(9428),v=_(3412),u=_(7668),s=_(233),i=l(_(2818)),e=_(5259),o=_(7989),r=_(6420),a=_(1698),t=function(){function n(){}return n.createClient=function(c){var p=c||{};return p.customReporter||(p.customReporter=n.customReporter),p.trackLog===void 0&&(p.trackLog=n.trackLog),a.configProvider.setContext(p),new u.RtsClient(p)},n.getMicList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getMicList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.getCameraList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getCameraList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.getSpeakerList=function(){var c=this;return new Promise(function(p,C){c.deviceManager.getSpeakerList().then(function(x){p(x)}).catch(function(x){C(x)})})},n.createStream=function(c){return new Promise(function(p,C){var x=new m.LocalStream,y=new i.default({customReporter:n.customReporter,trackLog:n.trackLog});x.init(c).then(function(){p(x),y.reportStreamCreated(c,{videoTrack:!!x.videoTrack,audioTrack:!!x.audioTrack,screenAudio:!!x.screenAudioTrack,surface:x.screenSurfaceType})}).catch(function(E){var S=f(f({},E),{relatedLink:E.extraInfo});delete S.extraInfo,C(S),y.reportErrorInfo(h.ErrorCode.ERROR_INIT_LOCAL_FAIL,E.message,E.traceId,{config:c,originErr:E})})})},n.deviceManager=new v.BrowserDeviceManager,n.BrowserUtil=s.BrowserUtil,n.SystenUtil=s.SystemUtil,n.SupportUtil=o.SupportUtil,n.Clock=r.Clock,n.VideoProfileMap=e.VideoProfileMap,n.ScreenProfileMap=e.ScreenProfileMap,n.AudioProfileMap=e.AudioProfileMap,n.ErrorCode=h.ErrorCode,n.customReporter=function(){},n.trackLog=!0,n}();T.AliRTS=t},7028:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.default={version:"2.13.3",protocol_version:2,sdk_version:"0.0.1"}},9428:(H,T)=>{var _,f;Object.defineProperty(T,"__esModule",{value:!0}),T.PUB_RECONNECT_ERROR_LIST=T.RECONNECT_ERROR_EXCLUDE_LIST=T.SUB_RECONNECT_ERROR_LIST=T.DeviceErrorCode=T.ErrorCode=void 0,function(l){l[l.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",l[l.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",l[l.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",l[l.ERROR_DEVICE_NOTFOUND=10020]="ERROR_DEVICE_NOTFOUND",l[l.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_NOTALLOWED=10021]="ERROR_DEVICE_NOTALLOWED",l[l.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_NOTREADABLE=10022]="ERROR_DEVICE_NOTREADABLE",l[l.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",l[l.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",l[l.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",l[l.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",l[l.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",l[l.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",l[l.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",l[l.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT",l[l.ERROR_SIGNAL_ERROR=10101]="ERROR_SIGNAL_ERROR",l[l.ERROR_PLAY_FAILED=10102]="ERROR_PLAY_FAILED",l[l.ERROR_NOTSUPPORT_WEBRTC=10110]="ERROR_NOTSUPPORT_WEBRTC",l[l.ERROR_BROWSER_NOTSUPPORT=10111]="ERROR_BROWSER_NOTSUPPORT",l[l.ERROR_BROWSER_VERSIONLOW=10112]="ERROR_BROWSER_VERSIONLOW",l[l.ERROR_NOTSUPPORT_H264=10113]="ERROR_NOTSUPPORT_H264",l[l.ERROR_CREATEOFFER=10114]="ERROR_CREATEOFFER",l[l.ERROR_NO_DATACHANNEL=10115]="ERROR_NO_DATACHANNEL",l[l.ERROR_INIT_LOCAL_FAIL=10116]="ERROR_INIT_LOCAL_FAIL",l[l.ERROR_HEMLELEMENT_NOTMATCH=10125]="ERROR_HEMLELEMENT_NOTMATCH",l[l.ERROR_AUTOPLAY_ERROR=10201]="ERROR_AUTOPLAY_ERROR",l[l.ERROR_PLAY_URL=10202]="ERROR_PLAY_URL",l[l.ERROR_SUBSCRIBE_NOTHING=10203]="ERROR_SUBSCRIBE_NOTHING",l[l.ERROR_HTMLELEMENT_ERROR=10204]="ERROR_HTMLELEMENT_ERROR",l[l.ERROR_HTTPREQUEST_ERROR=10205]="ERROR_HTTPREQUEST_ERROR",l[l.ERROR_ANSWER_ERROR=10206]="ERROR_ANSWER_ERROR",l[l.ERROR_INBOUND_TIMEOUT=10207]="ERROR_INBOUND_TIMEOUT",l[l.ERROR_STREAM_ENDED=10208]="ERROR_STREAM_ENDED",l[l.ERROR_PC_DISCONNECTED=10209]="ERROR_PC_DISCONNECTED",l[l.ERROR_TRANSPORT_CLOSED=10210]="ERROR_TRANSPORT_CLOSED",l[l.ERROR_SIGNAL_URL=10211]="ERROR_SIGNAL_URL",l[l.ERROR_IP_MIGRATE=10212]="ERROR_IP_MIGRATE",l[l.ERROR_PUBLISH_URL=10300]="ERROR_PUBLISH_URL",l[l.ERROR_PUBLISH_NOAUDIO=10301]="ERROR_PUBLISH_NOAUDIO",l[l.ERROR_PUBLISH_NOSTREAM=10302]="ERROR_PUBLISH_NOSTREAM",l[l.ERROR_DATACHANNEL_PARAM=10500]="ERROR_DATACHANNEL_PARAM",l[l.ERROR_DATACHANNEL_OPEN=10501]="ERROR_DATACHANNEL_OPEN",l[l.ERROR_MEDIASTREAMTRACK_TYPE_ERROR=11e3]="ERROR_MEDIASTREAMTRACK_TYPE_ERROR",l[l.ERROR_MEDIASTREAMTRACK_KIND_ERROR=11001]="ERROR_MEDIASTREAMTRACK_KIND_ERROR",l[l.ERROR_MEDIASTREAMTRACK_AUDIO_NONE=11002]="ERROR_MEDIASTREAMTRACK_AUDIO_NONE",l[l.ERROR_CUSTOMSTREAM_NONE=11003]="ERROR_CUSTOMSTREAM_NONE",l[l.ERROR_CUSTOMSTREAM_INVALID=11004]="ERROR_CUSTOMSTREAM_INVALID",l[l.ERROR_CUSTOMSTREAM_TRACK_NONE=11005]="ERROR_CUSTOMSTREAM_TRACK_NONE",l[l.ERROR_PREERCONNECTION_UNKNOWN=12e3]="ERROR_PREERCONNECTION_UNKNOWN",l[l.ERROR_SUBADD_NO_RESULT=13e3]="ERROR_SUBADD_NO_RESULT",l[l.ERROR_PUBADD_NO_RESULT=13001]="ERROR_PUBADD_NO_RESULT",l[l.ERROR_SINGLE_PC_STREAM_ERROR=13100]="ERROR_SINGLE_PC_STREAM_ERROR",l[l.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED=13101]="ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED",l[l.ERROR_SINGLE_PC_FULL_RECONNECT=13102]="ERROR_SINGLE_PC_FULL_RECONNECT",l[l.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED=13103]="ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED"}(_||(T.ErrorCode=_={})),function(l){l[l.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",l[l.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",l[l.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",l[l.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",l[l.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",l[l.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",l[l.ERROR_SCREENSHARE_NOTSUPPORT=10010]="ERROR_SCREENSHARE_NOTSUPPORT",l[l.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",l[l.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",l[l.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",l[l.ERROR_SCREENSHARE_SAFARI_INVALIDACCESS=10014]="ERROR_SCREENSHARE_SAFARI_INVALIDACCESS",l[l.ERROR_SCREENSHARE_UNKNOWNERRO=10019]="ERROR_SCREENSHARE_UNKNOWNERRO",l[l.ERROR_DEVICE_NOTSUPPORT=2e4]="ERROR_DEVICE_NOTSUPPORT"}(f||(T.DeviceErrorCode=f={})),T.SUB_RECONNECT_ERROR_LIST=[_.ERROR_INBOUND_TIMEOUT,_.ERROR_STREAM_ENDED,_.ERROR_PC_DISCONNECTED],T.RECONNECT_ERROR_EXCLUDE_LIST=[_.ERROR_AUTOPLAY_ERROR,_.ERROR_PLAY_URL,_.ERROR_SUBSCRIBE_NOTHING,_.ERROR_HTMLELEMENT_ERROR,_.ERROR_HEMLELEMENT_NOTMATCH,_.ERROR_PUBLISH_URL,_.ERROR_PUBLISH_NOAUDIO,_.ERROR_PUBLISH_NOSTREAM],T.PUB_RECONNECT_ERROR_LIST=[_.ERROR_PC_DISCONNECTED,_.ERROR_TRANSPORT_CLOSED]},5044:(H,T,_)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.RtsError=void 0;var f=_(9428),l=function(){function m(h,v,u,s){this.errorCode=h,this.errorCodeName=f.ErrorCode[h],this.message=v,this.traceId=u,s&&(this.extraInfo=s)}return m.prototype.renameCode=function(h){this.errorCode=h,this.errorCodeName=f.ErrorCode[h]},m}();T.RtsError=l},6091:(H,T)=>{Object.defineProperty(T,"__esModule",{value:!0}),T.PlayEvent=T.PlayType=void 0,T.PlayType={PLAY_CANPLAY:"canplay",PLAY_WAITING:"waiting",PLAY_PLAYING:"playing",PLAY_MEDIA:"media",PLAY_ENDED:"ended",PLAY_TIMEOUT:"timeout"};var _=function(f){this.event=f};T.PlayEvent=_},5917:(H,T)=>{var _,f,l,m;Object.defineProperty(T,"__esModule",{value:!0}),T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=T.DEFAULT_HEARTBEAT_TIMEOUT=T.DEFAULT_RETRY_PUBLISH_INTERVAL=T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=T.DEFAULT_RETRY_PUBLISH_LIMIT=T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=T.EWorkerAction=T.EWorkerSource=T.EConnectStatus=T.TrackType=void 0,function(h){h.AUDIO="audio",h.VIDEO="video"}(_||(T.TrackType=_={})),function(h){h[h.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",h[h.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",h[h.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",h[h.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(f||(T.EConnectStatus=f={})),function(h){h.Sender="sender",h.Receiver="receiver"}(l||(T.EWorkerSource=l={})),function(h){h.Setup="setup",h.InserSEI="insertSEI",h.UpdatePubStats="updatePubStats",h.UpdateSubStats="updateSubStats",h.SwitchCumuDelay="switchCumuDelay"}(m||(T.EWorkerAction=m={})),T.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,T.DEFAULT_RETRY_PUBLISH_LIMIT=5,T.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,T.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,T.DEFAULT_HEARTBEAT_TIMEOUT=8,T.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},6600:function(H,T,_){var f,l=this&&this.__extends||(f=function(R,D){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,b){A.__proto__=b}||function(A,b){for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(A[g]=b[g])},f(R,D)},function(R,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function A(){this.constructor=R}f(R,D),R.prototype=D===null?Object.create(D):(A.prototype=D.prototype,new A)}),m=this&&this.__assign||function(){return m=Object.assign||function(R){for(var D,A=1,b=arguments.length;A<b;A++)for(var g in D=arguments[A])Object.prototype.hasOwnProperty.call(D,g)&&(R[g]=D[g]);return R},m.apply(this,arguments)},h=this&&this.__awaiter||function(R,D,A,b){return new(A||(A=Promise))(function(g,O){function k(W){try{w(b.next(W))}catch(M){O(M)}}function U(W){try{w(b.throw(W))}catch(M){O(M)}}function w(W){var M;W.done?g(W.value):(M=W.value,M instanceof A?M:new A(function(N){N(M)})).then(k,U)}w((b=b.apply(R,D||[])).next())})},v=this&&this.__generator||function(R,D){var A,b,g,O,k={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return O={next:U(0),throw:U(1),return:U(2)},typeof Symbol=="function"&&(O[Symbol.iterator]=function(){return this}),O;function U(w){return function(W){return function(M){if(A)throw new TypeError("Generator is already executing.");for(;O&&(O=0,M[0]&&(k=0)),k;)try{if(A=1,b&&(g=2&M[0]?b.return:M[0]?b.throw||((g=b.return)&&g.call(b),0):b.next)&&!(g=g.call(b,M[1])).done)return g;switch(b=0,g&&(M=[2&M[0],g.value]),M[0]){case 0:case 1:g=M;break;case 4:return k.label++,{value:M[1],done:!1};case 5:k.label++,b=M[1],M=[0];continue;case 7:M=k.ops.pop(),k.trys.pop();continue;default:if(g=k.trys,!((g=g.length>0&&g[g.length-1])||M[0]!==6&&M[0]!==2)){k=0;continue}if(M[0]===3&&(!g||M[1]>g[0]&&M[1]<g[3])){k.label=M[1];break}if(M[0]===6&&k.label<g[1]){k.label=g[1],g=M;break}if(g&&k.label<g[2]){k.label=g[2],k.ops.push(M);break}g[2]&&k.ops.pop(),k.trys.pop();continue}M=D.call(R,k)}catch(N){M=[6,N],b=0}finally{A=g=0}if(5&M[0])throw M[1];return{value:M[0]?M[1]:void 0,done:!0}}([w,W])}}},u=this&&this.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(T,"__esModule",{value:!0}),T.CommonController=void 0;var s=_(771),i=_(5917),e=u(_(102)),o=_(9594),r=_(2718),a=_(1698),t=_(5044),n=_(9428),c=_(6091),p=_(5788),C=_(280),x=u(_(1401)),y=_(5649),E=function(R){function D(A){var b=R.call(this)||this;return b.datachannelList=new S,b.receiverCodecPreferences={},b.senderCodecPreferences={},b.canAutoAssignDcId=!0,b.reporter=A,b.signalChannel=new p.SignalChannel({reporter:A}),b.proxySignalChannelEvents(),b}return l(D,R),D.prototype.setConfig=function(A){this.config=A},D.prototype.setPeerconnection=function(A){var b=this;A!==this.peerconnection&&(this.peerconnection&&this.peerconnection.removeAllListeners(),this.peerconnection=A,this.signalChannel.isOpen||(this.waitForOpenPms=new Promise(function(g,O){b.peerconnection.on("datachannelStatusChange",function(k){var U;b.emit("datachannelStatusChange",k),k.status===C.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(b.signalChannel.setPeerConnection(A),b.canAutoAssignDcId=typeof((U=b.signalChannel.datachannelCore)===null||U===void 0?void 0:U.id)=="number",g())})})),this.peerconnection.on("cumuDelayNotSupported",function(){var g;b.emit("cumuDelayNotSupported"),(g=b.reporter)===null||g===void 0||g.reportCumuDelayNotSupported()}),this.peerconnection.on("innerSubscribeDeleteTracks",function(g){b.handleWorkerSubDelete(g)}),this.peerconnection.on("encodedFrame",function(g){var O;b.emit("encodedFrame",g),g.kind==="video"&&(0,o.parseSei)((O=g.frame)===null||O===void 0?void 0:O.data).forEach(function(k){var U;if(k.payloadType===y.CUMU_DELAY_SEI_PAYLOAD_TYPE){var w={pub:{},sub:{},grtn:{},AIPub:{},AISub:{},AIAgent:{},AIGrtn:{},other:{}},W=new y.CumuDelaySeiPayloadParser(k.data);w.pub=W.pub||{},w.sub=g.subStats||{},w.grtn=W.grtn||{},w.AIPub=W.AIPub||{},w.AISub=W.AISub||{},w.AIAgent=W.AIAgent||{},w.AIGrtn=W.AIGrtn||{},w.other=W.other||{},Object.keys(w.pub).forEach(function(N){var P=w.pub[N];delete w.pub[N],w.pub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.sub).forEach(function(N){var P=w.sub[N];delete w.sub[N],w.sub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AIPub).forEach(function(N){var P=w.AIPub[N];delete w.AIPub[N],w.AIPub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AISub).forEach(function(N){var P=w.AISub[N];delete w.AISub[N],w.AISub[(0,r.lowercaseFirstLetter)(N)]=P}),Object.keys(w.AIAgent).forEach(function(N){var P=w.AIAgent[N];delete w.AIAgent[N],w.AIAgent[(0,r.underlineToCamelCase)(N.toLowerCase())]=P}),Object.keys(w.AIGrtn).forEach(function(N){var P=w.AIGrtn[N];delete w.AIGrtn[N],w.AIGrtn[(0,r.underlineToCamelCase)(N.toLowerCase())]=P}),Object.keys(w.grtn).forEach(function(N){var P=w.grtn[N];delete w.grtn[N],w.grtn[(0,r.underlineToCamelCase)(N.toLowerCase())]=P});var M=void 0;try{M=(0,x.default)(w)}catch(N){console.warn(N,w)}M&&(k.data=new TextEncoder().encode(M),(U=b.reporter)===null||U===void 0||U.updateCumuDelayInfo({json:M}))}b.emit("receivedSEI",{url:g.url,vMsid:g.vMsid,sei:k})})}),this.peerconnection.on("message",function(g){var O;(O=b.reporter)===null||O===void 0||O.reportNotifyMessage(g)}),this.peerconnection.on("hebtReceived",function(g){b.emit("heartbeat",g)}),this.peerconnection.on("streamError",function(g){b.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",m({},g)))}),this.peerconnection.on("streamReconnect",function(g){b.emit("reconnect",{type:g.type,reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,g.resMsg,"",m({},g)),retryTimes:1,extraInfo:m({},g)}),b.singleStreamReconnect(g).then(function(){b.emit("reconnectFinish",{type:g.type,latestUrl:g.latestUrl,msids:g.msids})}).catch(function(O){b.emit("onError",new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:O}))})}),this.peerconnection.on("traceIdUpdate",function(g){b.emit("traceId",g)}),this.peerconnection.on("pcReconnect",function(g){b.emit("reconnect",{type:"pc",reason:new t.RtsError(n.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT,g.reMsg,"",m({},g)),retryTimes:1,extraInfo:m({},g)})}),(this.receiverCodecPreferences.video||this.receiverCodecPreferences.audio)&&this.peerconnection.setReceiverCodecPreferences(this.receiverCodecPreferences),(this.senderCodecPreferences.video||this.senderCodecPreferences.audio)&&this.peerconnection.setSenderCodecPreferences(this.senderCodecPreferences))},Object.defineProperty(D.prototype,"peerCore",{get:function(){var A;return(A=this.peerconnection)===null||A===void 0?void 0:A.getPeerCore()},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"streamManager",{get:function(){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.getStreamManager()},enumerable:!1,configurable:!0}),D.prototype.subscribeAdd=function(A,b){return h(this,void 0,void 0,function(){var g,O,k,U,w,W,M,N,P=this;return v(this,function(V){switch(V.label){case 0:if(A.forEach(function(j){var z;(z=P.reporter)===null||z===void 0||z.reportSubscribeStart(j.url,"",j.vMsid,j.aMsid,!0)}),!this.peerconnection)throw this.makeRtsError("subscribeAdd");this.peerconnection.isReused=!0,g=new Date().getTime(),V.label=1;case 1:return V.trys.push([1,3,,4]),[4,this.peerconnection.subAdd(A,b)];case 2:if(!(O=V.sent()).streamList)throw new t.RtsError(n.ErrorCode.ERROR_SUBADD_NO_RESULT,"subAdd streamList not found","",{api:"subscribeAdd",configList:A,response:O});return[3,4];case 3:throw k=V.sent(),U=k,(N=this.reporter)===null||N===void 0||N.reportErrorInfo(U.errorCode,U.message,U.traceId,U.extraInfo),U;case 4:return w=O.deleteRspTime-g,W=O.subAddRspTime-O.deleteRspTime,M=O.activeRspTime-O.subAddRspTime,O.streamList.forEach(function(j,z){var G,X,re,te;(G=P.reporter)===null||G===void 0||G.reportSubscribeOk({vurl:j.url||void 0,isSubAdd:!0});var oe,ue=A[z]||{},se=ue.targetStream,ce=ue.vMsid,de=ue.aMsid,pe=j.stream;if(se)return se.mergeStream(pe),(X=P.streamManager)===null||X===void 0||X.update(j.url,{stream:se,vMsid:ce?.[0],aMsid:de?.[0]}),void(j.stream=se);var he=(re=P.streamManager)===null||re===void 0?void 0:re.getStreamByMsid({url:j.url,vMsid:ce?.[0],aMsid:de?.[0]});if(he)he.mergeStream(pe),oe=he;else{(oe=new s.RemoteStream).updateMediaStream(pe),(te=P.streamManager)===null||te===void 0||te.update(j.url,{stream:oe,vMsid:ce?.[0],aMsid:de?.[0]}),oe.on("onCanPlay",function(){var fe,me,ge=new Date().getTime();(fe=P.reporter)===null||fe===void 0||fe.reportFirstFrameTime(j.url,j.traceId,-1,-1,ge-g,0,-1,{},w,W,M,ce,de,!0),(me=P.peerconnection)===null||me===void 0||me.playStart()});var Ee=new c.PlayEvent(c.PlayType.PLAY_CANPLAY);Ee.data={url:j.url,vMsid:ce?.[0]||"vMsid unknown",aMsid:de?.[0]||"aMsid unknown"},P.emit("onPlayEvent",Ee)}j.stream=oe}),[2,O.streamList]}})})},D.prototype.subscribeActive=function(A){return h(this,void 0,void 0,function(){var b;return v(this,function(g){if(!this.peerconnection)throw this.makeRtsError("subscribeActive");return[2,(b=this.peerconnection)===null||b===void 0?void 0:b.subActive(A)]})})},D.prototype.subscribeStop=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U;return v(this,function(w){switch(w.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeStop");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.subStop(A)];case 2:return b=w.sent(),this.peerconnection.getSubMonitor().updateTranceiversController(),g=this.peerconnection.getWorkerManager(),A.forEach(function(W){g.removeByUrl({url:W.url,source:i.EWorkerSource.Receiver})}),[3,4];case 3:throw O=w.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.subscribeDeleteTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeDeleteTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.subDeleteTracks(A)];case 2:if(!(b=U.sent()))throw this.makeRtsError("subscribeDeleteTracks");return this.peerconnection.getSubMonitor().updateTranceiversController(),this.handleWorkerSubDelete(A),[3,4];case 3:throw g=U.sent(),O=g,(k=this.reporter)===null||k===void 0||k.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),g;case 4:return[2,b]}})})},D.prototype.handleWorkerSubDelete=function(A){if(this.peerconnection){var b=this.peerconnection.getWorkerManager();A.forEach(function(g){var O,k;!((O=g.vMsid)===null||O===void 0)&&O.length&&b.removeByMsid({url:g.url,source:i.EWorkerSource.Receiver,kind:"video",msid:g.vMsid[0]}),!((k=g.aMsid)===null||k===void 0)&&k.length&&b.removeByMsid({url:g.url,source:i.EWorkerSource.Receiver,kind:"audio",msid:g.aMsid[0]})})}},D.prototype.publishAdd=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j=this;return v(this,function(z){switch(z.label){case 0:if(A.forEach(function(G){var X;(X=j.reporter)===null||X===void 0||X.reportStartPublish(G.url,"",!0)}),b=new Date().getTime(),!this.peerconnection)throw this.makeRtsError("publishAdd");z.label=1;case 1:return z.trys.push([1,3,,4]),[4,(M=this.peerconnection)===null||M===void 0?void 0:M.pubAdd(A)];case 2:if(!(g=z.sent()))throw new t.RtsError(n.ErrorCode.ERROR_PUBADD_NO_RESULT,"pubAdd streamList not found","",{api:"publishAdd",publishInfoList:A});return[3,4];case 3:throw O=z.sent(),k=O,(N=this.reporter)===null||N===void 0||N.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),k;case 4:return this.peerconnection.isReused=!0,U=new Date().getTime(),w=U-b,g.forEach(function(G){var X;(X=j.reporter)===null||X===void 0||X.reportPublishOk(G.url||"","",-1,-1,-1,G.traceId||"",w,!0)}),(W=(P=this.peerconnection)===null||P===void 0?void 0:P.getPc())&&(A.forEach(function(G){j.peerconnection&&G.stream.setEncodeParam(W)}),this.peerCore&&((V=this.peerconnection)===null||V===void 0||V.getPubMonitor().startHeartbeat(W,this.peerCore)),W.getSenders().forEach(function(G){var X;G.track&&((X=j.peerconnection)===null||X===void 0||X.handleEncodedInsertableStreams({sender:G}))})),[2,g]}})})},D.prototype.publishDeleteTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U;return v(this,function(w){switch(w.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishDeleteTracks");w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.peerconnection.pubDeleteTracks(A)];case 2:if(!(b=w.sent()))throw this.makeRtsError("publishDeleteTracks");return this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),A.forEach(function(W){var M,N;!((M=W.vMsid)===null||M===void 0)&&M.length&&g.removeByMsid({url:W.url,source:i.EWorkerSource.Sender,kind:"video",msid:W.vMsid[0]}),!((N=W.aMsid)===null||N===void 0)&&N.length&&g.removeByMsid({url:W.url,source:i.EWorkerSource.Sender,kind:"audio",msid:W.aMsid[0]})}),[3,4];case 3:throw O=w.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.publishReplaceTracks=function(A){return h(this,void 0,void 0,function(){var b,g,O,k;return v(this,function(U){switch(U.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishReplaceTracks");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,this.peerconnection.pubReplaceTracks(A)];case 2:if(!(b=U.sent()))throw this.makeRtsError("publishReplaceTracks");return this.peerconnection.getPubMonitor().updateSenders(),[3,4];case 3:throw g=U.sent(),O=g,(k=this.reporter)===null||k===void 0||k.reportErrorInfo(O.errorCode,O.message,O.traceId,O.extraInfo),g;case 4:return[2,b]}})})},D.prototype.publishStop=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w=this;return v(this,function(W){switch(W.label){case 0:if(A.forEach(function(M){var N;(N=w.reporter)===null||N===void 0||N.reportStopPublish(M.url,!0)}),!this.peerconnection)throw this.makeRtsError("publishStop");W.label=1;case 1:return W.trys.push([1,3,,4]),[4,this.peerconnection.pubStop(A)];case 2:return b=W.sent(),this.peerconnection.getPubMonitor().updateSenders(),g=this.peerconnection.getWorkerManager(),A.forEach(function(M){g.removeByUrl({url:M.url,source:i.EWorkerSource.Sender})}),[3,4];case 3:throw O=W.sent(),k=O,(U=this.reporter)===null||U===void 0||U.reportErrorInfo(k.errorCode,k.message,k.traceId,k.extraInfo),O;case 4:return[2,b]}})})},D.prototype.handleAddDatachannel=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j,z=this;return v(this,function(G){switch(G.label){case 0:if(!A.url||!A.signalUrl||!A.msid)throw g=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, signalUrl, msid is required by subscribe(publish)AddDatachannel",""),(W=this.reporter)===null||W===void 0||W.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return b=A.type==="sub",this.waitForOpenPms?[4,this.waitForOpenPms]:[3,2];case 1:G.sent(),this.waitForOpenPms=void 0,G.label=2;case 2:if(this.signalChannel.isOpen)return[3,4];if(console.warn("Creating a new signal channel"),!A.signalUrl)throw g=new t.RtsError(n.ErrorCode.ERROR_SIGNAL_URL,"signal url is required",""),(M=this.reporter)===null||M===void 0||M.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;return[4,this.initSignalChannel(A)];case 3:G.sent(),this.setPeerconnection(this.signalChannel.getPeerConnection()),this.canAutoAssignDcId=typeof((N=this.signalChannel.datachannelCore)===null||N===void 0?void 0:N.id)=="number",G.label=4;case 4:if(O=performance.now(),k={url:A.url,label:A.label,surl:A.signalUrl,msid:A.msid},b?(P=this.reporter)===null||P===void 0||P.reportDatachannelSubAdd(k):(V=this.reporter)===null||V===void 0||V.reportDatachannelPubAdd(k),!(U=(j=this.peerconnection)===null||j===void 0?void 0:j.getPc()))throw new Error("No avaliable peerconnection");return w=new C.DataChannelCore({pc:U,label:A.label,datachannelList:this.datachannelList.list,assignId:!this.canAutoAssignDcId,delayOpen:a.configProvider.getContext().datachannelDelayOpen}),this.datachannelList.update(w),[2,new Promise(function(X,re){return h(z,void 0,void 0,function(){var te,oe,ue,se,ce,de,pe,he,Ee,fe,me,ge,be,Re,Te,Pe,Oe=this;return v(this,function(Ae){switch(Ae.label){case 0:te="",oe=!1,ue=!1,w.on("statusChange",function(_e){var xe;(xe=Oe.reporter)===null||xe===void 0||xe.reportDatachannelStatusChange({state:C.EDatachannelStatus[_e],url:A.url,label:w.label,id:w.id,msid:A.msid}),_e===C.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(oe=!0,ue&&X({datachannel:w,traceId:te}))}),w.on("dispose",function(){var _e;(_e=Oe.reporter)===null||_e===void 0||_e.reportDatachannelDispose({url:A.url,label:w.label,id:w.id,msid:A.msid})}),Ae.label=1;case 1:return Ae.trys.push([1,6,,7]),se=[{url:A.url,msid:A.msid,datachannelId:w.id,label:A.label,datachannel:w}],b?[4,(fe=this.peerCore)===null||fe===void 0?void 0:fe.subscribeAddDatachannel(se)]:[3,3];case 2:return de=Ae.sent(),[3,5];case 3:return[4,(me=this.peerCore)===null||me===void 0?void 0:me.publishAddDatachannel(se)];case 4:de=Ae.sent(),Ae.label=5;case 5:return te=(be=(ge=(ce=de)==null?void 0:ce.streams)===null||ge===void 0?void 0:ge[0])===null||be===void 0?void 0:be.traceid,[3,7];case 6:return pe=Ae.sent(),he=pe,(Re=this.reporter)===null||Re===void 0||Re.reportErrorInfo(he.errorCode,he.message||"datachannel ".concat(b?"sub":"pub"," add error"),he.traceId,he.extraInfo),[2,re(pe)];case 7:return Ee={url:A.url,drct:Math.floor(performance.now()-O),tcid:te,label:w.label,id:w.id,msid:A.msid},b?(Te=this.reporter)===null||Te===void 0||Te.reportDatachannelSubAddOk(Ee):(Pe=this.reporter)===null||Pe===void 0||Pe.reportDatachannelPubAddOk(Ee),ue=!0,oe&&X({datachannel:w,traceId:te}),[2]}})})})]}})})},D.prototype.handleStopDatachannel=function(A){return h(this,void 0,void 0,function(){var b,g,O,k,U,w,W,M,N,P,V,j;return v(this,function(z){switch(z.label){case 0:if(!A.url||!A.datachannel)throw b=new t.RtsError(n.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, datachannel is required by subscribe(publish)StopDatachannel",""),(U=this.reporter)===null||U===void 0||U.reportErrorInfo(b.errorCode,b.message,b.traceId,b.extraInfo),b;if(!this.signalChannel.isOpen)throw b=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"Signal channel is closed",""),(w=this.reporter)===null||w===void 0||w.reportErrorInfo(b.errorCode,b.message,b.traceId,b.extraInfo),b;g=A.type==="sub",O=[{url:A.url}],k={url:A.url,label:A.datachannel.label,id:A.datachannel.id},g?(W=this.reporter)===null||W===void 0||W.reportDatachannelSubStop(k):(M=this.reporter)===null||M===void 0||M.reportDatachannelPubStop(k),z.label=1;case 1:return z.trys.push([1,6,,7]),g?[4,(N=this.peerCore)===null||N===void 0?void 0:N.subscribeStopDatachannel(O)]:[3,3];case 2:return z.sent(),[3,5];case 3:return[4,(P=this.peerCore)===null||P===void 0?void 0:P.publishStopDatachannel(O)];case 4:z.sent(),z.label=5;case 5:return[3,7];case 6:throw z.sent();case 7:return g?(V=this.reporter)===null||V===void 0||V.reportDatachannelSubStopOk(k):(j=this.reporter)===null||j===void 0||j.reportDatachannelPubStopOk(k),A.datachannel.dispose(),[2]}})})},D.prototype.subscribeAddDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleAddDatachannel(m(m({},A),{type:"sub"}))]})})},D.prototype.publishAddDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleAddDatachannel(m(m({},A),{type:"pub"}))]})})},D.prototype.subscribeStopDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleStopDatachannel(m(m({},A),{type:"sub"}))]})})},D.prototype.publishStopDatachannel=function(A){return h(this,void 0,void 0,function(){return v(this,function(b){return[2,this.handleStopDatachannel(m(m({},A),{type:"pub"}))]})})},D.prototype.getSubscribeVideoStats=function(A,b){return this.getSubscribeMediaStats(A,"video",b)},D.prototype.getSubscribeAudioStats=function(A,b){return this.getSubscribeMediaStats(A,"audio",b)},D.prototype.getPublishVideoStats=function(A,b){return this.getPublishMediaStats(A,"video",b)},D.prototype.getPublishAudioStats=function(A,b){return this.getPublishMediaStats(A,"audio",b)},D.prototype.sendSEI=function(A){var b,g;if(!((b=this.peerconnection)===null||b===void 0)&&b.isReused)return(g=this.peerconnection)===null||g===void 0?void 0:g.sendSEI(A)},D.prototype.setReceiverCodecPreferences=function(A){this.receiverCodecPreferences=m({},A)},D.prototype.setSenderCodecPreferences=function(A){this.senderCodecPreferences=m({},A)},D.prototype.getSubscribeMediaStats=function(A,b,g){var O=this;return new Promise(function(k){return h(O,void 0,void 0,function(){var U,w,W,M,N;return v(this,function(P){switch(P.label){case 0:return this.streamManager?(U=void 0,w=this.streamManager.getAllMediaInfoList(A,!0),g?w.forEach(function(V){var j,z,G,X=(z=(j=V.transceiver)===null||j===void 0?void 0:j.receiver)===null||z===void 0?void 0:z.track;X?.kind===b&&V.msid===g&&(U=(G=V.transceiver)===null||G===void 0?void 0:G.receiver)}):U=(N=(M=w?.find(function(V){var j,z,G;return((G=(z=(j=V.transceiver)===null||j===void 0?void 0:j.receiver)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.kind)===b}))===null||M===void 0?void 0:M.transceiver)===null||N===void 0?void 0:N.receiver,U?(W=!1,[4,U.getStats()]):[2,k({})]):[2,k({})];case 1:return P.sent().forEach(function(V){V.type==="inbound-rtp"&&(W=!0,k(V))}),W||k({}),[2]}})})})},D.prototype.getPublishMediaStats=function(A,b,g){var O=this;return new Promise(function(k){return h(O,void 0,void 0,function(){var U,w,W,M,N;return v(this,function(P){switch(P.label){case 0:return this.streamManager?(U=void 0,w=this.streamManager.getAllMediaInfoList(A,!0),g?w.forEach(function(V){var j,z,G,X=(z=(j=V.transceiver)===null||j===void 0?void 0:j.sender)===null||z===void 0?void 0:z.track;X?.kind===b&&V.msid===g&&(U=(G=V.transceiver)===null||G===void 0?void 0:G.sender)}):U=(N=(M=w?.find(function(V){var j,z,G;return((G=(z=(j=V.transceiver)===null||j===void 0?void 0:j.sender)===null||z===void 0?void 0:z.track)===null||G===void 0?void 0:G.kind)===b}))===null||M===void 0?void 0:M.transceiver)===null||N===void 0?void 0:N.sender,U?(W=!1,[4,U.getStats()]):[2,k({})]):[2,k({})];case 1:return P.sent().forEach(function(V){V.type==="outbound-rtp"&&k(V)}),W||k({}),[2]}})})})},D.prototype.proxySignalChannelEvents=function(){var A=this;this.signalChannel.on("connectStatusChange",function(b){A.emit("connectStatusChange",b)}),this.signalChannel.on("onError",function(b){A.emit("onError",b)})},D.prototype.initSignalChannel=function(A){return this.signalChannel.createDatachannel(A)},D.prototype.makeRtsError=function(A){var b,g=new t.RtsError(n.ErrorCode.ERROR_NO_DATACHANNEL,"No avaliable datachannel, you should subscribe/publish first.","",{api:A});return(b=this.reporter)===null||b===void 0||b.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g},D.prototype.singleStreamReconnect=function(A){var b=this;return new Promise(function(g,O){var k,U,w=A.type,W=void 0,M=void 0;switch(w){case"sub":(k=A.streams)===null||k===void 0||k.forEach(function(P){var V=[],j=[],z=!0,G=!0;A.msids.forEach(function(X){X.streamId===P.id&&(X.type==="video"?j.push(X.name):X.type==="audio"&&V.push(X.name))}),V.length||(z=!1),j.length||(G=!1),b.subscribeAddWithRetry({url:A.latestUrl,subAudio:z,subVideo:G,vMsid:j,aMsid:V,targetStream:P}).then(g).catch(O)});break;case"pub":(U=A.streams)===null||U===void 0||U.forEach(function(P){var V=[],j=[];A.msids.forEach(function(z){z.streamId===P.id&&(z.type==="video"?j.push(z.name):z.type==="audio"&&V.push(z.name))}),b.publishAddWithRetry([{url:A.latestUrl,vMsid:j,aMsid:V,stream:P}]).then(g).catch(O)});break;case"pub-data":if(A.msids.forEach(function(P){W=P.name,M=P.label}),W&&M){var N=A.latestUrl;b.publishAddDatachannelWithRetry({url:N,signalUrl:N,msid:W,label:M}).then(g).catch(O)}break;case"sub-data":A.msids.forEach(function(P){W=P.name,M=P.label}),W&&M&&(N=A.latestUrl,b.subscribeAddDatachannelWithRetry({url:N,signalUrl:N,msid:W,label:M}).then(g).catch(O));break;default:console.warn("RTS PC STREAM RECONNECT: Unknown signal")}})},D.prototype.updateAuth=function(A){var b;return!!(!((b=this.streamManager)===null||b===void 0)&&b.updateLatestUrl(A))},D.prototype.subscribeAddWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.subscribeAdd([A],!0).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.subscribeAddWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.publishAddWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.publishAdd(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.publishAddWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.subscribeAddDatachannelWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.subscribeAddDatachannel(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.subscribeAddDatachannelWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D.prototype.publishAddDatachannelWithRetry=function(A,b){var g=this;return b===void 0&&(b=0),new Promise(function(O,k){g.publishAddDatachannel(A).then(function(){O()}).catch(function(U){return h(g,void 0,void 0,function(){var w,W;return v(this,function(M){switch(M.label){case 0:return b<(((w=this.config)===null||w===void 0?void 0:w.retryTimes)||0)?[4,d(((W=this.config)===null||W===void 0?void 0:W.retryInterval)||0)]:[3,2];case 1:return M.sent(),[2,this.publishAddDatachannelWithRetry(A,b+1).then(O).catch(k)];case 2:k(U),M.label=3;case 3:return[2]}})})})})},D}(e.default);T.CommonController=E;var S=function(){function R(){this._list=[]}return Object.defineProperty(R.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),R.prototype.update=function(D){var A=this._list.findIndex(function(b){return b.id===D.id});A!==-1?this._list.splice(A,1,D):this._list.push(D)},R}();function d(R){return R===void 0&&(R=1e3),new Promise(function(D){setTimeout(D,R)})}},9796:function(H,T,_){var f,l=this&&this.__extends||(f=function(x,y){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,S){E.__proto__=S}||function(E,S){for(var d in S)Object.prototype.hasOwnProperty.call(S,d)&&(E[d]=S[d])},f(x,y)},function(x,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");function E(){this.constructor=x}f(x,y),x.prototype=y===null?Object.create(y):(E.prototype=y.prototype,new E)}),m=this&&this.__assign||function(){return m=Object.assign||function(x){for(var y,E=1,S=arguments.length;E<S;E++)for(var d in y=arguments[E])Object.prototype.hasOwnProperty.call(y,d)&&(x[d]=y[d]);return x},m.apply(this,arguments)},h=this&&this.__awaiter||function(x,y,E,S){return new(E||(E=Promise))(function(d,R){function D(g){try{b(S.next(g))}catch(O){R(O)}}function A(g){try{b(S.throw(g))}catch(O){R(O)}}function b(g){var O;g.done?d(g.value):(O=g.value,O instanceof E?O:new E(function(k){k(O)})).then(D,A)}b((S=S.apply(x,y||[])).next())})},v=this&&this.__generator||function(x,y){var E,S,d,R,D={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return R={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(R[Symbol.iterator]=function(){return this}),R;function A(b){return function(g){return function(O){if(E)throw new TypeError("Generator is already executing.");for(;R&&(R=0,O[0]&&(D=0)),D;)try{if(E=1,S&&(d=2&O[0]?S.return:O[0]?S.throw||((d=S.return)&&d.call(S),0):S.next)&&!(d=d.call(S,O[1])).done)return d;switch(S=0,d&&(O=[2&O[0],d.value]),O[0]){case 0:case 1:d=O;break;case 4:return D.label++,{value:O[1],done:!1};case 5:D.label++,S=O[1],O=[0];continue;case 7:O=D.ops.pop(),D.trys.pop();continue;default:if(d=D.trys,!((d=d.length>0&&d[d.length-1])||O[0]!==6&&O[0]!==2)){D=0;continue}if(O[0]===3&&(!d||O[1]>d[0]&&O[1]<d[3])){D.label=O[1];break}if(O[0]===6&&D.label<d[1]){D.label=d[1],d=O;break}if(d&&D.label<d[2]){D.label=d[2],D.ops.push(O);break}d[2]&&D.ops.pop(),D.trys.pop();continue}O=y.call(x,D)}catch(k){O=[6,k],S=0}finally{E=d=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([b,g])}}},u=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(T,"__esModule",{value:!0}),T.Publisher=void 0;var s=_(5917),i=_(4865),e=u(_(7028)),o=_(9428),r=_(5044),a=_(7989),t=u(_(102)),n=u(_(8219)),c=_(2718),p=u(_(1401)),C=function(x){function y(E){var S=x.call(this)||this;return S.publishStartTimeStamp=0,S.pubReconnectTimes=0,S.isConnecting=!1,S.reconnectTimerHandle=null,S.reportMonitorTimes=0,S.reportSubFlag=!1,S.reporter=E,S.peerconnection=new i.RtsPeerconnection,S.peerconnection.on("connectStatusChange",function(d){d.status!==s.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&d.status!==s.EConnectStatus.CONNECT_STATUS_RECONNECTING||!S.hasRetries()?S.emit("connectStatusChange",d):S.emit("onError",new r.RtsError(o.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",""))}),S.peerconnection.on("onMonitorEvent",function(d){var R,D=d.eventList;(R=S.peerconnection)===null||R===void 0||R.updateStatsForSEI(D,d.type),d.type==="pub"?(S.reportMonitorTimes++,S.reportMonitorTimes%4==0&&(D.forEach(function(A){S.reporter.reportPushStats(A)}),S.reportSubFlag=!0,S.reportMonitorTimes=0)):d.type==="sub"&&S.reportSubFlag&&(S.handleSubMonitorEvent(D),S.reportSubFlag=!1)}),S.peerconnection.on("onTransportStateEvent",function(d){var R;S.peerconnection.isReused||((R=S.peerconnection.getPc())===null||R===void 0?void 0:R.connectionState)!=="closed"&&d.state==="closed"&&S.hasRetries()&&S.emit("onError",new r.RtsError(o.ErrorCode.ERROR_TRANSPORT_CLOSED,"Transport has been closed. ".concat(d.kind,"|").concat(d.type,"|").concat(d.url),"",{protocol:d.protocol}))}),S.peerconnection.on("pcReconnect",function(d){var R,D;d.ips?(R="Migrate with ips: ".concat((0,p.default)(d.ips)),D=o.ErrorCode.ERROR_IP_MIGRATE):(R="PC disconnected",D=o.ErrorCode.ERROR_PC_DISCONNECTED),S.emit("onError",new r.RtsError(D,R,"",{pcErrorInfo:d}))}),S.signalingUrl="",S.publishUrl="",S.publishConfig={},S}return l(y,x),y.prototype.publish=function(E,S,d){var R=this;return new Promise(function(D,A){if(R.unpublish(),d?.cumuDelay&&(d.encodedInsertableStreams=!0),R.localStream=S,R.publishUrl=E,R.publishConfig=d||{},R.checkPublishUrl())if(S)if(S.audioTrack===null)A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_NOAUDIO,"publish need audiotrack",""));else{var b=d?.signalUrl;R.signalingUrl=b||R.signalingUrl,R.publishStartTimeStamp=new Date().getTime(),S.setReporter(R.reporter),R.peerconnection.createOffer(S.hasAudio,S.hasVideo||S.hasScreen,S,m(m({},d),{publishUrl:E})).then(function(g){var O=g.desp,k=g.publishTrackInfoList;R.publishTrackInfoList=k;var U=new Date().getTime();R.reporter.reportStartPublish(R.publishUrl,R.signalingUrl),R.excuteSignal(O).then(function(w){var W=new Date().getTime();R.peerconnection.recvAnswer(w.data,{answerSdpHook:d?.answerSdpHook,tcpOnly:d?.tcpOnly}).then(function(){R.reporter.reportPublishOk(R.publishUrl,R.signalingUrl,U-R.publishStartTimeStamp,W-U,new Date().getTime()-W,w.data.trace_id),D(w.data.trace_id),R.pubReconnectTimes=0,R.peerconnection.pushStart()}).catch(function(M){M.traceid=w.data?w.data.trace_id:"";var N=new r.RtsError(M.errorCode||o.ErrorCode.ERROR_ANSWER_ERROR,M.message||"set answer error",M.traceid,{sdp:M.sdp});A(N)})}).catch(function(w){var W=new r.RtsError(w.errorCode||o.ErrorCode.ERROR_HTTPREQUEST_ERROR,w.message||"","",{response:w.response,sdp:w.sdp});A(W)})}).catch(function(g){var O=new r.RtsError(g.errorCode||o.ErrorCode.ERROR_CREATEOFFER,g.message||"","");A(O)})}else A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_NOSTREAM,"publish stream not found",""));else A(new r.RtsError(o.ErrorCode.ERROR_PUBLISH_URL,"url need artc://",""))})},y.prototype.unpublish=function(){this.peerconnection.reset(),this.reporter.reportStopPublish(),this.signalingUrl="",this.publishUrl="",this.publishTrackInfoList=null},y.prototype.getTrackInfoList=function(){return this.publishTrackInfoList||[]},y.prototype.getPeerConnection=function(){return this.peerconnection},y.prototype.replaceTrack=function(E,S){return this.peerconnection.replaceTrack(this.publishUrl,E,S)},y.prototype.excuteSignal=function(E){var S,d=this,R={type:E.type,sdp:E.sdp};return this.isSingleMsid()&&(R.sdp=R.sdp.replace(/msid\:-? /g,"msid:")),!((S=this.publishConfig)===null||S===void 0)&&S.cumuDelay&&(R.sdp=R.sdp.replace(/(m=video[^\n]*\n)/,`$1a=cumudelay
|
|
148
148
|
`)),new Promise(function(D,A){n.default.post(d.signalingUrl,{version:e.default.protocol_version,sdk_version:e.default.sdk_version,mode:"rtc",push_stream:d.publishUrl,jsep:R}).then(function(b){var g,O,k,U;if(b&&b.status===200){D(b);try{!((g=d.publishConfig)===null||g===void 0)&&g.cumuDelay&&!(!((k=(O=b.data)===null||O===void 0?void 0:O.jsep)===null||k===void 0)&&k.sdp.includes("a=cumudelay"))&&(console.warn("Not found cumudelay in server sdp"),(U=d.reporter)===null||U===void 0||U.reportCumuDelayAnswerNotFound())}catch{}}else A({message:b?"response status:"+b.status:"response is null",sdp:R.sdp})}).catch(function(b){return h(d,void 0,void 0,function(){var g,O;return v(this,function(k){switch(k.label){case 0:if(![400,500].includes((O=b.response)===null||O===void 0?void 0:O.status))return[3,4];b.sdp=E.sdp,k.label=1;case 1:return k.trys.push([1,3,,4]),[4,new a.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return k.sent(),[3,4];case 3:return g=k.sent(),b.errorCode=g?.errorCode,b.message=g?.message,this.pubReconnectTimes=1/0,[3,4];case 4:return A(b),[2]}})})})})},y.prototype.checkPublishUrl=function(){if(!this.publishUrl||this.publishUrl.indexOf("artc://")!==0)return!1;var E=window.location.protocol,S=(["http:","https:"].indexOf(E)>-1?E:"https:")+"//";return this.signalingUrl=this.publishUrl.replace("artc://",S),!0},y.prototype.isSingleMsid=function(){if(!this.publishConfig)return!1;var E=this.publishConfig,S=E.vMsid,d=E.aMsid;return!(!S||!S[0]||S[0].indexOf(" ")!==-1)||!(!d||!d[0]||d[0].indexOf(" ")!==-1)},y.prototype.retryPublish=function(E,S){return h(this,void 0,void 0,function(){var d,R,D,A,b,g,O;return v(this,function(k){switch(k.label){case 0:if(E.extraInfo=m(m({},E.extraInfo),{retryTimes:this.pubReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof(d=this.publishConfig).beforeRetry!="function")return[3,4];k.label=1;case 1:return k.trys.push([1,3,,4]),[4,d.beforeRetry({url:this.publishUrl,stream:this.localStream,vMsid:d.vMsid,aMsid:d.aMsid,useTcp:S})];case 2:return(R=k.sent())?(D=R.url,A=R.stream,b=R.vMsid,g=R.aMsid,A||(console.error("Stream is not returned by beforeRetry function."),this.pubReconnectTimes=1/0),this.reporter.reportReconnectParams("pub",D,b,g,R.useTcp,A?.id),this.publishUrl=D,this.localStream=A,this.publishConfig.vMsid=b,this.publishConfig.aMsid=g,typeof R.useTcp=="boolean"&&(S=R.useTcp),console.log(`Retry with:
|
|
149
149
|
[URL] `.concat(D,`
|
|
150
150
|
[STREAM] `).concat(A?.id,`
|
|
@@ -159,5 +159,5 @@ t=0 0\r
|
|
|
159
159
|
`)):""},v.prototype.removeVideoTrack=function(u){for(var s="rts "+u,i=-1,e=-1,o=!1,r=0;r<this.sdpLines.length;++r){if(o&&this.sdpLines[r].indexOf("m=application")>-1){e=r-1;break}if(this.sdpLines[r].indexOf("m=video")>-1){if(o){e=r-1;break}i=r}this.sdpLines[r].indexOf(s)>-1&&(o=!0)}return!!o&&(e===-1&&(e=this.sdpLines.length-1),this.sdpLines.splice(i,e-i),!0)},v.prototype.ios15PushHack=function(){var u=!1,s=-1;if(this.sdpLines.forEach(function(o,r){o.includes("m=video")&&(u=!0),u&&s===-1&&o.includes("a=")&&(s=r)}),s!==-1){var i=this.getExtmapIds(),e=Math.max.apply(Math,i)+1;this.sdpLines.splice(s,0,"a=extmap:".concat(e," urn:3gpp:video-orientation"))}},v.prototype.addSps=function(){this.sdpLines=this.sdpLines.map(function(u){return u.includes("a=fmtp:")&&u.includes("level-asymmetry-allowed")?u+=";sps-pps-idr-in-keyframe=1":u})},v.prototype.removeTwccRtcpFb=function(){this.sdpLines=this.sdpLines.filter(function(u){return!u.includes("http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01")})},v.prototype.removeUdpCandidate=function(){this.sdpLines=this.sdpLines.filter(function(u){return!u.includes("a=candidate:")||!u.includes("UDP")})},v.prototype.setDirection=function(u){u===void 0&&(u={direction:"recvonly"});var s=["sendonly","recvonly","sendrecv"].filter(function(o){return o!==u.direction}),i=!1,e=!1;this.sdpLines=this.sdpLines.map(function(o,r){if(o.includes("m=video"))i=!0,e=!1;else if(o.includes("m=audio"))e=!0,i=!1;else if(o.includes("m=application"))i=!1,e=!1;else if(i||e){var a;if(s.some(function(t){if(o.includes(t))return a=t,!0})&&a)return o.replace(a,u.direction)}return o})},v.prototype.removeSDES=function(){var u=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"];this.sdpLines=this.sdpLines.filter(function(s){return!u.some(function(i){return s.includes(i)})})},v.prototype.addStereo=function(){var u=this;this.getPayloadType("opus").map(this.getFmtpIndex.bind(this)).filter(function(s){return s!==void 0}).forEach(function(s){u.sdpLines[s].indexOf("stereo=1")>-1||(u.sdpLines[s]=u.sdpLines[s]+";stereo=1")})},v.prototype.setSingleNaluPackMode__legacy=function(){this.sdpLines=this.sdpLines.filter(function(u){return!u.includes("a=fmtp:")||!u.includes("packetization-mode=1")})},v.prototype.setSingleNaluPackMode=function(){var u=this,s=[],i=[],e=!1;if(this.sdpLines.forEach(function(c){if(c.includes("packetization-mode=0")&&(e=!0),c.includes("packetization-mode=1")){var p=u.parseFmtpValue(c);s.push(p||"NULL")}s.length&&new RegExp("apt=(".concat(s.join("|"),")")).test(c)&&(p=u.parseFmtpValue(c),i.push(p||"NULL"))}),!e)return!1;var o=f(f([],s,!0),i,!0).join("|"),r=new RegExp("(rtpmap|rtcp-fb|fmtp):.*?(".concat(o,")"));this.sdpLines=this.sdpLines.filter(function(c){return!r.test(c)});for(var a=0;a<this.sdpLines.length;a++){var t=this.sdpLines[a];if(t.includes("m=video")){var n=new RegExp("( ".concat(f(f([],s,!0),i,!0).join("| "),")"),"g");this.sdpLines[a]=t.replace(n,"");break}}return!0},v.prototype.dispose=function(){this.localStream&&(this.localStream=void 0),this.sdpLines=new Array,this.publishStreamInfo=new m},v.prototype.getExtmapIds=function(){return this.sdpLines.reduce(function(u,s){if(s.includes("a=extmap")){var i=Number(s.replace("a=extmap:","").split(" ")[0]);return f(f([],u,!0),[i],!1)}return u},[]).filter(function(u){return u})},v.prototype.getPayloadType=function(u){for(var s=[],i=new RegExp("a\\=rtpmap\\:(\\d+) ".concat(u,".*"),"i"),e=0;e<this.sdpLines.length;e++){var o=this.sdpLines[e],r=i.exec(o);r?.length&&s.push(r[1])}return s},v.prototype.getFmtpIndex=function(u){for(var s=new RegExp("a\\=fmtp\\:".concat(u," .*"),"i"),i=0;i<this.sdpLines.length;i++){var e=this.sdpLines[i];if(s.test(e))return i}},v.prototype.parseFmtpValue=function(u){var s=u.match(/a=fmtp:(\d+)/);return s?s[1]:null},v}();T.SdpUtil=h},7989:function(H,T,_){var f=this&&this.__awaiter||function(r,a,t,n){return new(t||(t=Promise))(function(c,p){function C(E){try{y(n.next(E))}catch(S){p(S)}}function x(E){try{y(n.throw(E))}catch(S){p(S)}}function y(E){var S;E.done?c(E.value):(S=E.value,S instanceof t?S:new t(function(d){d(S)})).then(C,x)}y((n=n.apply(r,a||[])).next())})},l=this&&this.__generator||function(r,a){var t,n,c,p,C={label:0,sent:function(){if(1&c[0])throw c[1];return c[1]},trys:[],ops:[]};return p={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function x(y){return function(E){return function(S){if(t)throw new TypeError("Generator is already executing.");for(;p&&(p=0,S[0]&&(C=0)),C;)try{if(t=1,n&&(c=2&S[0]?n.return:S[0]?n.throw||((c=n.return)&&c.call(n),0):n.next)&&!(c=c.call(n,S[1])).done)return c;switch(n=0,c&&(S=[2&S[0],c.value]),S[0]){case 0:case 1:c=S;break;case 4:return C.label++,{value:S[1],done:!1};case 5:C.label++,n=S[1],S=[0];continue;case 7:S=C.ops.pop(),C.trys.pop();continue;default:if(c=C.trys,!((c=c.length>0&&c[c.length-1])||S[0]!==6&&S[0]!==2)){C=0;continue}if(S[0]===3&&(!c||S[1]>c[0]&&S[1]<c[3])){C.label=S[1];break}if(S[0]===6&&C.label<c[1]){C.label=c[1],c=S;break}if(c&&C.label<c[2]){C.label=c[2],C.ops.push(S);break}c[2]&&C.ops.pop(),C.trys.pop();continue}S=a.call(r,C)}catch(d){S=[6,d],n=0}finally{t=c=0}if(5&S[0])throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}([y,E])}}},m=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(T,"__esModule",{value:!0}),T.SupportUtil=void 0;var h=_(233),v=_(3412),u=m(_(1401)),s=_(9428),i=_(2672),e=function(){this.errorCode=0,this.message=""},o=function(){function r(){this.deviceManager=new v.BrowserDeviceManager}return r.prototype.isSupport=function(a){var t=this;return new Promise(function(n,c){return f(t,void 0,void 0,function(){var p,C,x,y;return l(this,function(E){switch(E.label){case 0:return p=new e,this.checkWebRtcSupport()?a.onlyCheckUA?this.checkBrowser(p)?[3,3]:[2,c(p)]:[3,1]:(p.errorCode=s.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,p.message=i.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,c(p)]);case 1:return[4,this.checkWebrtcAbilities()];case 2:if(C=E.sent(),x=C[0],C[1],C[2],y=C[3],!x)return p.errorCode=s.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,p.message=i.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,c(p)];if(y)return p.errorCode=s.ErrorCode.ERROR_BROWSER_NOTSUPPORT,p.message=i.EN.MESSAGE_BROWSER_NOTSUPPORT,[2,c(p)];E.label=3;case 3:return a.isReceiveVideo?this.checkH264Decode(p).then(function(){n(p)}).catch(function(){c(p)}):n(p),[2]}})})})},r.prototype.checkEncodedTransformSupport=function(){var a=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,t=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window;return a||t},r.prototype.checkWebrtcAbilities=function(a){return f(this,void 0,void 0,function(){var t,n,c,p,C,x,y,E,S;return l(this,function(d){switch(d.label){case 0:t=window.RTCPeerConnection,n=!1,c=!1,p=null,C=!1,d.label=1;case 1:return d.trys.push([1,4,,5]),t?(x=new t,c="createDataChannel"in x,a&&(y=this.createBlankStream()).getTracks().forEach(function(R){x?.addTrack(R,y)}),[4,x.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,iceRestart:!0})]):[3,3];case 2:E=d.sent(),S=(E||{}).sdp,p=a?!!(S&&S.indexOf("a=sendrecv")>-1):null,x.close(),x=void 0,n=!0,d.label=3;case 3:return[3,5];case 4:return d.sent(),n=!1,c=!1,p=!1,[3,5];case 5:return C=this.checkBlackList(),[2,[n,c,p,C]]}})})},r.prototype.checkPublishSupport=function(){return f(this,void 0,void 0,function(){var a,t,n,c,p,C,x,y;return l(this,function(E){switch(E.label){case 0:return a={isWebRTCSupported:!1,isH264EncodeSupported:!1,isMediaDevicesSupported:!1,isScreenCaptureSupported:!1,isAudioMixSupported:!1,cameraList:[],micList:[],speakerList:[]},this.checkWebRtcSupport()?[3,1]:(a.isWebRTCSupported=!1,a.isH264EncodeSupported=!1,[3,5]);case 1:return[4,this.checkWebrtcAbilities(!0)];case 2:return t=E.sent(),n=t[0],t[1],c=t[2],a.isWebRTCSupported=!(!n||!c),a.isWebRTCSupported?[3,3]:(a.isH264EncodeSupported=!1,[3,5]);case 3:return p=a,[4,this.checkH264Encode()];case 4:p.isH264EncodeSupported=E.sent(),E.label=5;case 5:if(a.isMediaDevicesSupported=this.checkMediaDevices(),a.isScreenCaptureSupported=this.checkScreenCapture(),a.isAudioMixSupported=this.checkAudioMix(),!a.isMediaDevicesSupported)return[3,11];E.label=6;case 6:return E.trys.push([6,10,,11]),C=a,[4,this.deviceManager.getCameraList()];case 7:return C.cameraList=E.sent().filter(function(S){return S.deviceId}),x=a,[4,this.deviceManager.getMicList()];case 8:return x.micList=E.sent().filter(function(S){return S.deviceId}),y=a,[4,this.deviceManager.getSpeakerList()];case 9:return y.speakerList=E.sent().filter(function(S){return S.deviceId}),[3,11];case 10:return E.sent(),[3,11];case 11:return[2,a]}})})},r.prototype.checkWebRtcSupport=function(){return!!window.RTCPeerConnection},r.prototype.checkMediaDevices=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)},r.prototype.checkScreenCapture=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},r.prototype.checkAudioMix=function(){if(!window.AudioContext)return!1;var a=new AudioContext;return!!a.createMediaStreamDestination&&!!a.createMediaStreamSource},r.prototype.checkBlackList=function(){var a=!1;if(h.BrowserUtil.isOppoBrowser&&h.SystemUtil.isAndroid){var t=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";a=!this.compareVersion(t,"40.7.39.1")}else(h.BrowserUtil.isUCBrowser||h.BrowserUtil.isQuarkBrowser)&&h.SystemUtil.isIos?a=!0:h.BrowserUtil.isWebView&&h.SystemUtil.isAndroid&&(a=!(h.BrowserUtil.browserMainVersion>=79));return a},r.prototype.checkBrowser=function(a){if(h.SystemUtil.isIos){if(h.BrowserUtil.isUCBrowser||h.BrowserUtil.isQuarkBrowser)return a.errorCode=s.ErrorCode.ERROR_BROWSER_NOTSUPPORT,a.message=i.EN.MESSAGE_BROWSER_NOTSUPPORT,!1;if(h.BrowserUtil.isSafari||h.BrowserUtil.isQQBrowser)return h.BrowserUtil.browserMainVersion>=11||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge||h.BrowserUtil.isChrome)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isMicroMessenger)return!!this.compareVersion(h.SystemUtil.systemVersion,"12.1.4")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isDingTalk)return!!h.SystemUtil.compareVersion("11.2.5")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isWebView)return!!this.compareVersion(h.SystemUtil.systemVersion,"14.3")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isAndroid){if(this.checkPrivateUcWebview())return!0;if(h.BrowserUtil.isChrome||h.BrowserUtil.isQQBrowser||h.BrowserUtil.isHuaweiBrowser||h.BrowserUtil.isSamsungBrowser)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isMicroMessenger)return!!this.compareVersion(this.getChromeCoreVersion(),"63")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isDingTalk)return!!this.compareVersion(this.getChromeCoreVersion(),"69")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isOppoBrowser){var t=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";return!!this.compareVersion(t,"40.7.39.1")||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}if(h.BrowserUtil.isX5Core)return!0;if(h.BrowserUtil.isWebView)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isMacOS){if(h.BrowserUtil.isElectron)return!0;if(h.BrowserUtil.isSafari)return h.BrowserUtil.browserMainVersion>=11||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isChrome)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isFirefox)return h.BrowserUtil.browserMainVersion>=62||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isOpera)return h.BrowserUtil.browserMainVersion>=15||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isWindows){if(h.BrowserUtil.isElectron||h.BrowserUtil.isMicroMessenger)return!0;if(h.BrowserUtil.isChrome||h.BrowserUtil.isQQBrowser)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isFirefox)return h.BrowserUtil.browserMainVersion>=62||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isOpera)return h.BrowserUtil.browserMainVersion>=15||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(h.SystemUtil.isLinux){if(h.BrowserUtil.isChrome)return h.BrowserUtil.browserMainVersion>=63||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isEdge)return h.BrowserUtil.browserMainVersion>=79||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(h.BrowserUtil.isFirefox)return h.BrowserUtil.browserMainVersion>=62||(a.errorCode=s.ErrorCode.ERROR_BROWSER_VERSIONLOW,a.message=i.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}return a.errorCode===0&&(a.errorCode=s.ErrorCode.ERROR_BROWSER_NOTSUPPORT,a.message=i.EN.MESSAGE_BROWSER_NOTSUPPORT),!1},r.prototype.checkH264Decode=function(a){var t=this;return new Promise(function(n,c){return f(t,void 0,void 0,function(){var p;return l(this,function(C){switch(C.label){case 0:return[4,this.tryFindH264FromSdp(a)];case 1:if(p=C.sent())return n(!0),[2];C.label=2;case 2:return C.trys.push([2,4,,5]),[4,this.loadH264(3)];case 3:return p=C.sent(),[3,5];case 4:return C.sent(),[3,5];case 5:return p?n(!0):(a&&a.errorCode===0&&(a.errorCode=s.ErrorCode.ERROR_NOTSUPPORT_H264,a.message=i.EN.MESSAGE_NOTSUPPORT_H264),c(!1)),[2]}})})})},r.prototype.checkSDPSupportH264=function(a){return a.indexOf("H264")>0||a.indexOf("h264")>0||a.indexOf("H.264")>0||a.indexOf("h.264")>0},r.prototype.checkPrivateUcWebview=function(){return this.getUa().indexOf("UniqueCode")>0},r.prototype.getUa=function(){return navigator&&navigator.userAgent||""},r.prototype.getChromeCoreVersion=function(){return(this.getUa().toLowerCase().match(/chrome\/([\d.]+)/)||[])[1]||""},r.prototype.compareVersion=function(a,t){a===void 0&&(a=""),t===void 0&&(t="");for(var n=(a||"").split("."),c=(t||"").split("."),p=0,C=0,x=0;x<n.length&&x<c.length;++x){if((p=isNaN(parseInt(n[x],10))?0:parseInt(n[x],10))<(C=isNaN(parseInt(c[x],10))?0:parseInt(c[x],10)))return!1;if(p>C)return!0}return!0},r.prototype.tryFindH264FromSdp=function(a){return f(this,void 0,void 0,function(){var t,n,c;return l(this,function(p){switch(p.label){case 0:if(t=!1,!RTCPeerConnection)return[2,t];n=new RTCPeerConnection,c=void 0,p.label=1;case 1:return p.trys.push([1,3,,4]),[4,n.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0})];case 2:return(c=p.sent())&&c.sdp&&(t=this.checkSDPSupportH264(c.sdp)),[3,4];case 3:return p.sent(),t=!1,a&&(a.errorCode=s.ErrorCode.ERROR_CREATEOFFER,a.message=i.EN.MESSAGE_CREATEOFFER),[3,4];case 4:return n.close(),n=void 0,[2,t]}})})},r.prototype.loadH264=function(a){var t=this;return new Promise(function(n,c){return f(t,void 0,void 0,function(){var p,C,x,y,E=this;return l(this,function(S){if(!h.SystemUtil.isAndroid||!h.BrowserUtil.isChrome&&!h.BrowserUtil.isWebView)return n(!1),[2];for(p=0,C=[],x=0;p<a;)y=setTimeout(function(){return f(E,void 0,void 0,function(){return l(this,function(d){switch(d.label){case 0:return x++,[4,this.tryFindH264FromSdp()];case 1:return d.sent()?(C.forEach(function(R){clearTimeout(R)}),C=[],n(!0),[2]):(x===a&&n(!1),[2])}})})},1e3*p),C.push(y),p++;return[2]})})})},r.prototype.checkH264Encode=function(){return f(this,void 0,void 0,function(){var a,t,n;return l(this,function(c){switch(c.label){case 0:return[4,this.loadH264(3)];case 1:return!(a=c.sent())&&RTCRtpSender&&RTCRtpSender.getCapabilities&&(t=(0,u.default)((n=RTCRtpSender.getCapabilities("video"))===null||n===void 0?void 0:n.codecs),a=t.toLowerCase().includes("video/h264")),[2,!!a]}})})},r.prototype.createBlankStream=function(){var a,t,n,c=(a=new AudioContext,t=a.createOscillator(),n=t.connect(a.createMediaStreamDestination()),t.start(),Object.assign(n.stream.getAudioTracks()[0],{enabled:!1}));c.stop();var p=function(C){var x,y={},E=y.width,S=E===void 0?160:E,d=y.height,R=d===void 0?90:d,D=document.createElement("canvas");D.width=S,D.height=R,(x=D.getContext("2d"))===null||x===void 0||x.fillRect(0,0,S,R);var A=D.captureStream();return Object.assign(A.getVideoTracks()[0],{enabled:!1})}();return p.stop(),new MediaStream([c,p])},r}();T.SupportUtil=o},2718:function(H,T){var _=this&&this.__spreadArray||function(f,l,m){if(m||arguments.length===2)for(var h,v=0,u=l.length;v<u;v++)!h&&v in l||(h||(h=Array.prototype.slice.call(l,0,v)),h[v]=l[v]);return f.concat(h||Array.prototype.slice.call(l))};Object.defineProperty(T,"__esModule",{value:!0}),T.hebtLog=T.createUUID=T.evaluateNetworkCondition=T.makeCancelable=T.hasVideoTrack=T.hasAudioTrack=T.getVideoTrack=T.getAudioTrack=T.pruneSubUrl=T.getJitterBufferDelayAvg=void 0,T.lowercaseFirstLetter=function(f){return f.replace(/([A-Za-z])/,function(l){return l.toLowerCase()})},T.underlineToCamelCase=function(f){return f.replace(/_([a-z])/g,function(l,m){return m.toUpperCase()})},T.getJitterBufferDelayAvg=function(f,l){return f&&l?Number(f)/Number(l)*1e3:-1},T.pruneSubUrl=function(f,l){var m=f||"";return m=m.replace("@subaudio=no","").replace("@subvideo=no",""),l&&(m=m.split("?")[0]),m},T.getAudioTrack=function(f){return f.getAudioTracks()[0]},T.getVideoTrack=function(f){return f.getVideoTracks()[0]},T.hasAudioTrack=function(f){return f.getAudioTracks().length>0},T.hasVideoTrack=function(f){return f.getVideoTracks().length>0},T.makeCancelable=function(f){var l=!1;return{promise:new Promise(function(m,h){f.then(function(v){return l?h({isCanceled:!0}):m(v)}),f.catch(function(v){return h(l?{isCanceled:!0}:v)})}),cancel:function(){l=!0}}},T.evaluateNetworkCondition=function(f,l,m,h,v){var u=0;if(!navigator.onLine)return u=6;var s=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],i=-1,e=-1,o=-1;if(typeof l=="number"&&l>=0||typeof m=="number"&&m>=0){i=0;var r=!1,a=!1;typeof l=="number"&&l>=0&&(i+=l,r=!0),typeof m=="number"&&m>=0&&(i+=m,a=!0),r&&!a&&(i*=2),a&&!r&&(i*=1.8)}typeof f=="number"&&f>=0&&(o=f),(typeof h=="number"&&h>=0||typeof v=="number"&&v>=0)&&(e=0,typeof h=="number"&&h>=0&&(e+=h),typeof v=="number"&&v>=0&&(e+=v));var t;if((t=4*(i!==-1?1:0)+2*(o!==-1?1:0)+(e!==-1?1:0))>0){var n=1.2*i*s[t-1].loss+o/1500*s[t-1].rtt+e/3e3*s[t-1].jbd;u=n<=.1?1:n<=.23?2:n<=.36?3:n<=.49?4:5}else u=0;return u},T.createUUID=function(f,l){var m,h="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),v=[];if(l=l||h.length,f)for(m=0;m<f;m++)v[m]=h[0|Math.random()*l];else{var u=void 0;for(v[8]=v[13]=v[18]=v[23]="-",v[14]="4",m=0;m<36;m++)v[m]||(u=0|16*Math.random(),v[m]=h[m==19?3&u|8:u])}return v.join("")},T.hebtLog=function(){for(var f=[],l=0;l<arguments.length;l++)f[l]=arguments[l];window.RTS_HEBT_DEBUG&&console.log.apply(console,_(["[rts hebt]"],f,!1))}},233:H=>{/*! useragent-util - ver 1.3.1 created:9/4/2024, 4:31:28 PM */H.exports=(()=>{var T={622:(m,h,v)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BrowserUtil=h.BrowserType=void 0;var u,s=v(101);(function(e){e.IE="IE",e.Chrome="Chrome",e.Safari="Safari",e.Firefox="Firefox",e.Opera="Opera",e.Edge="Edge",e.MicroMessenger="MicroMessenger",e.X5Core="X5Core",e.Quark="Quark",e.QQ="QQ",e.QQBrowser="QQBrowser",e.DingTalk="DingTalk",e.Electron="Electron",e.Sogou="Sogou",e.Vivo="VivoBrowser",e.Oppo="OppoBrowser",e.UC="UCBrowser",e.MI="MiBrowser",e.Lenovo="SLBrowser",e.Maxthon="Maxthon",e.Liebao="Liebao",e.Huawei="Huawei",e.Meizu="MZBrowser",e.Finger="FingerBrowser",e.Samsung="SamsungBrowser",e.WebVeiw="WebVeiw",e.Unknown="unknown"})(u=h.BrowserType||(h.BrowserType={}));var i=function(){function e(){}return Object.defineProperty(e,"isBrowser",{get:function(){return typeof document<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"domain",{get:function(){return window.location.protocol+window.location.host},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHttps",{get:function(){return this.isBrowser&&document.location&&(document.location.protocol=="https:"||document.location.host.indexOf("127.0.0.1:")===0||document.location.host.indexOf("localhost:")===0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSupportScreenShare",{get:function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChrome",{get:function(){return e._getBrowserInfo(),u.Chrome===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSafari",{get:function(){return e._getBrowserInfo(),u.Safari===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isIE",{get:function(){return e._getBrowserInfo(),u.IE===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFirefox",{get:function(){return e._getBrowserInfo(),u.Firefox===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isEdge",{get:function(){return e._getBrowserInfo(),u.Edge===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSogou",{get:function(){return e._getBrowserInfo(),u.Sogou===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isVivoBroswer",{get:function(){return e._getBrowserInfo(),u.Vivo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOppoBrowser",{get:function(){return e._getBrowserInfo(),u.Oppo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMiBrowser",{get:function(){return e._getBrowserInfo(),u.MI===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLenovoBrowser",{get:function(){return e._getBrowserInfo(),u.Lenovo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMaxthonBrowser",{get:function(){return e._getBrowserInfo(),u.Maxthon===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLiebaoBrowser",{get:function(){return e._getBrowserInfo(),u.Liebao===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHuaweiBrowser",{get:function(){return e._getBrowserInfo(),u.Huawei===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMZBrowser",{get:function(){return e._getBrowserInfo(),u.Meizu===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSamsungBrowser",{get:function(){return e._getBrowserInfo(),u.Samsung===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOpera",{get:function(){return e._getBrowserInfo(),u.Opera===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMicroMessenger",{get:function(){return e._getBrowserInfo(),e._browserName===u.MicroMessenger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQ",{get:function(){return e._getBrowserInfo(),u.QQ===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQBrowser",{get:function(){return e._getBrowserInfo(),u.QQBrowser===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isX5Core",{get:function(){return e._getBrowserInfo(),e._browserName===u.X5Core},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUCBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===u.UC},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQuarkBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===u.Quark},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFingerBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===u.Finger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChromeCore",{get:function(){return e._getBrowserInfo(),e._core==="Chrome"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isWebView",{get:function(){return e._getBrowserInfo(),e._browserName===u.WebVeiw},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isDingTalk",{get:function(){return e._getBrowserInfo(),e._browserName===u.DingTalk},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUnknown",{get:function(){return e._getBrowserInfo(),u.Unknown===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserName",{get:function(){return e._getBrowserInfo(),e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserMainVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion?parseInt(e._browserVersion.split(".")[0],10):0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserCoreVersion",{get:function(){return navigator.userAgent.toLowerCase(),s.SystemUtil.isIos||s.SystemUtil.isMacOS,e.browserMainVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isElectron",{get:function(){return e._getBrowserInfo(),u.Electron===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userAgent",{get:function(){var o=navigator.userAgent.toLowerCase(),r=o.indexOf("gecko");if(r>-1){r=o.indexOf(" ",r);var a=(o=o.substring(r+1,o.length)).split(" ");o="";for(var t=0;t<a.length;++t){var n=a[t].split("/");n&&n.length&&(o+=n[0]+" ")}}return o},enumerable:!1,configurable:!0}),e.compareVersion=function(o){if(e._getBrowserInfo(),e._browserVersion){for(var r=e._browserVersion.split("."),a=o.split("."),t=0,n=0,c=0;c<r.length&&c<a.length;++c){if((t=isNaN(parseInt(r[c],10))?0:parseInt(r[c],10))<(n=isNaN(parseInt(a[c],10))?0:parseInt(a[c],10)))return!1;if(t>n)return!0}return!0}return!0},e._getBrowserInfo=function(){if(!e._browserName||!e._browserVersion)if(navigator&&navigator.userAgent){var o=navigator.userAgent.toLowerCase(),r=void 0;(r=o.match(/edg[e|a]?\/([\d.]+)/))||(r=o.match(/edgios\/([\d.]+)/))?e._updateBrowserInfo(u.Edge,o,r[1]):(r=o.match(/rv:([\d.]+)\) like gecko/))||(r=o.match(/msie ([\d.]+)/))?e._updateBrowserInfo(u.IE,o,r[1]):(r=o.match(/vivobrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Vivo,o,r[1]):(r=o.match(/miuibrowser\/([\d.]+)/))?e._updateBrowserInfo(u.MI,o,r[1]):(r=o.match(/samsungbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Samsung,o,r[1]):(r=o.match(/heytapbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Oppo,o,r[1]):(r=o.match(/mzbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Meizu,o,r[1]):(r=o.match(/ucbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.UC,o,r[1]):(r=o.match(/quark\/([\d.]+)/))?e._updateBrowserInfo(u.Quark,o,r[1]):(r=o.match(/slbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Lenovo,o,r[1]):(r=o.match(/lbbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Liebao,o,r[1]):(r=o.match(/fingerbrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Finger,o,r[1]):(r=o.match(/huaweibrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Huawei,o,r[1]):(r=o.match(/maxthon\/([\d.]+)/))?e._updateBrowserInfo(u.Maxthon,o,r[1]):(r=o.match(/firefox\/([\d.]+)/))?e._updateBrowserInfo(u.Firefox,o,r[1]):(r=o.match(/electron\/([\d.]+)/))?e._updateBrowserInfo(u.Electron,o,r[1]):(r=o.match(/chrome\/([\d.]+)/))&&this._isChrome(o)||(r=o.match(/crios\/([\d.]+)/))&&this._isChrome(o)?e._updateBrowserInfo(u.Chrome,o,r[1]):(r=o.match(/metasr\s([\d.]+)/))||(r=o.match(/sogoumobilebrowser\/([\d.]+)/))?e._updateBrowserInfo(u.Sogou,o,r[1]):(r=o.match(/opr.([\d.]+)/))?e._updateBrowserInfo(u.Opera,o,r[1]):(r=o.match(/micromessenger.([\d.]+)/))?e._updateBrowserInfo(u.MicroMessenger,o,r[1]):(r=o.match(/qq\/([\d.]+)/))?e._updateBrowserInfo(u.QQ,o,r[1]):(r=o.match(/m?qqbrowser\/([\d.]+)/))||(r=o.match(/qqbrowserlite\/([\d.]+)/))?e._updateBrowserInfo(u.QQBrowser,o,r[1]):(r=o.match(/dingtalk.([\d.]+)/))?e._updateBrowserInfo(u.DingTalk,o,r[1]):(r=o.match(/tbs\/([\d.]+)/))?e._updateBrowserInfo(u.X5Core,o,r[1]):(r=o.match(/version\/([\d.]+).*safari/))&&this._isSafari(o)&&e._updateBrowserInfo(u.Safari,o,r[1]),e._browserName===u.Unknown&&e._isWebview(o)&&e._updateBrowserInfo(u.WebVeiw,o,"")}else e._browserName=u.Unknown,e._browserVersion="0.0"},e._isChrome=function(o){var r=o.split(/\(|\)/);if(e._core="Chrome",r.length===5){var a=r[4].trim().split(" ");if(a.length===2){if(a[0].indexOf("chrome")>-1&&a[1].indexOf("safari")>-1)return!0}else if(a.length===3){if(a[1].indexOf("mobile")>-1&&a[2].indexOf("safari")>-1&&(a[0].indexOf("chrome")>-1||a[0].indexOf("crios")>-1))return!0}else if(o.indexOf("qianniu")>-1)return!0}return!1},e._isSafari=function(o){var r=o.split(/\(|\)/);if(r.length===5){var a=r[4].trim().split(" ");if(a.length===2){if(a[0].indexOf("version")>-1&&a[1].indexOf("safari")>-1)return!0}else if(a.length===3&&a[0].indexOf("version")>-1&&a[1].indexOf("mobile")>-1&&a[2].indexOf("safari")>-1)return!0}return!1},e._isWebview=function(o){if(o){var r=new RegExp("("+["WebView","(iPhone|iPod|iPad)(?!.*Safari)","Android.*(wv|.0.0.0)","Linux; U; Android"].join("|")+")","ig"),a=new RegExp("("+["VivoBrowser","MZBrowser","MiuiBrowser"].join("|")+")","ig");return!!o.match(r)&&!o.match(a)}},e._updateBrowserInfo=function(o,r,a){e._browserName=o;var t=null;switch(o){case u.QQBrowser:s.SystemUtil.isIos||s.SystemUtil.isMacOS?(t=r.match(/version\/([\d.]+).*safari/),e._browserVersion=t?t[1]:"0.0"):(t=r.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0");break;case u.Vivo:case u.Oppo:case u.Meizu:case u.Huawei:case u.Sogou:case u.Samsung:t=r.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0";break;case u.WebVeiw:s.SystemUtil.isAndroid?(t=r.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0"):s.SystemUtil.isIos&&(e._browserVersion=s.SystemUtil.systemVersion);break;default:e._browserVersion=a}},e._browserName=u.Unknown,e._browserVersion="",e._core="",e}();h.BrowserUtil=i},864:(m,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Guid=void 0;var v=function(){function u(){}return u.create=function(s,i){i===void 0&&(i=16);var e,o,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];if(i=i||r.length,s)for(e=0;e<s;e++)a[e]=r[0|Math.random()*i];else for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",e=0;e<36;e++)a[e]||(o=0|16*Math.random(),a[e]=r[e==19?3&o|8:o]);return a.join("")},u}();h.Guid=v},442:(m,h,v)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.LocalStorage=void 0;var u=v(864),s=function(){function i(){}return Object.defineProperty(i,"uuid",{get:function(){var e="alirtc_uuid",o=i.get(e);return o||(o=u.Guid.create(32),i.set(e,o)),o},enumerable:!1,configurable:!0}),i.get=function(e){var o="";return window&&window.localStorage&&(o=window.localStorage.getItem(e)||""),o},i.set=function(e,o){e&&window&&window.localStorage&&window.localStorage.setItem(e,o)},i}();h.LocalStorage=s},72:(m,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ApiRequest=void 0;var v=function(){function u(){}return u.postBody=function(s,i,e){s=u._getUrl(s,i);var o,r={};return r.headers||(r.headers={}),r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",new Promise(function(a,t){u.requestBody("POST",s,e).then(function(n){return o=n,n.ok?n.json():n.text()}).then(function(n){o.ok?n.code?(n=u._intercept(n),t(n)):a(n.data):t(u._httpErrorMessage(o,n))}).catch(function(n){n=u._httpErrorMessage(n),t(n)})})},u.get=function(s,i,e){var o;return e===void 0&&(e={}),s=u._getUrl(s,i),e.headers||(e.headers={}),e.headers["Content-Type"]="application/json",new Promise(function(r,a){u.request("GET",s,e).then(function(t){return o=t,t.ok?t.json():t.text()}).then(function(t){o.ok?t.code?(t=u._intercept(t),a(t)):r(t.data):a(u._httpErrorMessage(o,t))}).catch(function(t){t=u._httpErrorMessage(t),a(t)})})},u.post=function(s,i,e,o){var r;return o===void 0&&(o={}),s=u._getUrl(s,i),o.headers||(o.headers={}),o.body=e,o.headers.Accept="application/json",o.headers["Content-Type"]="application/json",new Promise(function(a,t){u.request("POST",s,o).then(function(n){return r=n,n.ok?n.json():n.text()}).then(function(n){r.ok?n.code?(n=u._intercept(n),t(n)):a(n.data):t(u._httpErrorMessage(r,n))}).catch(function(n){n=u._httpErrorMessage(n),t(n)})})},u.request=function(s,i,e){s===void 0&&(s="GET");var o=new Headers(e.headers),r=new Request(i,{method:s,headers:o});return fetch(r)},u.requestBody=function(s,i,e){return s===void 0&&(s="GET"),fetch(i,{method:s,body:e,headers:new Headers({"Content-Type":"application/json"})})},u.ajaxPost=function(s,i,e,o){return o===void 0&&(o={}),s=u._getUrl(s,i),o.headers||(o.headers={}),o.headers.Accept="application/json",o.headers["Content-Type"]="application/json",u.ajax("POST",s,e,o)},u.ajax=function(s,i,e,o){s===void 0&&(s="GET"),o===void 0&&(o={});var r=new XMLHttpRequest;return new Promise(function(a,t){r.onreadystatechange=function(){if(r.readyState===4)if(r.status===200){var c=JSON.parse(r.responseText);c.code?(c=u._intercept(c),t(c)):a(c)}else t({message:r.responseText||"\u8BF7\u6C42\u5931\u8D25:"+i})},r.open(s,i,!0);try{if(o.withCredentials&&(r.withCredentials=!0),o.headers)for(var n in o.headers)r.setRequestHeader(n,o.headers[n])}catch(c){return void t(c)}try{r.send(e)}catch(c){t(c)}})},u._getUrl=function(s,i){var e=[];if(i)for(var o in i)e.push(o+"="+i[o]);var r=e.join("&");return(s.indexOf("?")!=-1?s:s+"?")+r},u._httpErrorMessage=function(s,i){return s.message||(s.message="HTTP "+s.status+"("+s.statusText+") : "+i),s},u._intercept=function(s){var i=s.data;return s.code&&((i=i||{}).data=s.data,i.code=s.code,i.description=s.description,i.message="0x"+Number(s.code).toString(16)+", "+s.description,i.tid&&(i.message+=", tid="+i.tid)),i},u}();h.ApiRequest=v},101:(m,h)=>{var v,u;Object.defineProperty(h,"__esModule",{value:!0}),h.SystemUtil=h.WindowsType=h.SystemType=void 0,function(i){i.Unknown="Unknown",i.MacOS="Mac",i.Windows="Windows",i.Android="Android",i.Iphone="iphone",i.Ipad="ipad",i.iOS="iOS",i.Linux="Linux",i.ChromeOS="ChromeOS"}(v=h.SystemType||(h.SystemType={})),function(i){i.Windows10="Windows 10",i.Windows7="Windows 7",i.WindowsVista="Windows vista",i.WindowsXP="Windows xp"}(u=h.WindowsType||(h.WindowsType={}));var s=function(){function i(){}return Object.defineProperty(i,"isMacOS",{get:function(){return v.MacOS===i.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isWindows",{get:function(){return i.systemName.indexOf(v.Windows)>-1},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isIos",{get:function(){return v.Iphone===i.systemName||v.Ipad===i.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isAndroid",{get:function(){return v.Android===i.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isLinux",{get:function(){return v.Linux===i.systemName||v.Linux===i._platform},enumerable:!1,configurable:!0}),Object.defineProperty(i,"systemName",{get:function(){return i._getSystemInfo(),i._systemName},enumerable:!1,configurable:!0}),Object.defineProperty(i,"systemVersion",{get:function(){return i._getSystemInfo(),i._systemVersion},enumerable:!1,configurable:!0}),Object.defineProperty(i,"platform",{get:function(){return i._getSystemInfo(),i._platform},enumerable:!1,configurable:!0}),Object.defineProperty(i,"isUnknown",{get:function(){return!i.platform||i.platform===v.Unknown},enumerable:!1,configurable:!0}),i.compareVersion=function(e){if(i._getSystemInfo(),i._systemVersion){for(var o=i._systemVersion.split("."),r=e.split("."),a=0,t=0,n=0;n<o.length&&n<r.length;++n){if((a=isNaN(parseInt(o[n],10))?0:parseInt(o[n],10))<(t=isNaN(parseInt(r[n],10))?0:parseInt(r[n],10)))return!1;if(a>t)return!0}return!0}return!0},i._getSystemInfo=function(){if(!i._systemName||!i._systemVersion||!i._platform)if(navigator&&navigator.userAgent){var e=navigator.userAgent.toLowerCase();e.indexOf("ipad")>-1?(i._systemName=v.Ipad,i._platform=v.iOS,i._systemVersion=i._getIosSystemVersion(e)):e.indexOf("iphone")>-1?(i._systemName=v.Iphone,i._platform=v.iOS,i._systemVersion=i._getIosSystemVersion(e)):e.indexOf("android")>-1?(i._platform=v.Android,i._systemName=v.Android,i._systemVersion=i._getAndroidSystemVersion(e)):e.indexOf("win")>-1?e.indexOf("windwos nt 10")>-1||e.indexOf("windows 10")?(i._systemName=u.Windows10,i._platform=v.Windows,i._systemVersion="10"):e.indexOf("windows nt 6.1")>-1||e.indexOf("windows 7")>-1?(i._systemName=u.Windows7,i._platform=v.Windows,i._systemVersion="7"):e.indexOf("windows nt 6.0")>-1||e.indexOf("windows vista")>-1?(i._systemName=u.WindowsVista,i._platform=v.Windows,i._systemVersion="vista"):e.indexOf("widows nt 5.1")>-1||e.indexOf("windows xp")>-1?(i._systemName=u.WindowsXP,i._platform=v.Windows,i._systemVersion="xp"):(i._platform=v.Windows,i._systemName=v.Windows,i._systemVersion="0.0"):e.indexOf("mac")>-1?navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0?(i._systemName=v.Ipad,i._platform=v.iOS,i._systemVersion=i._getIosSystemVersion(e)):(i._platform=v.MacOS,i._systemName=v.MacOS,i._systemVersion=i._getMacSystemVersion(e)):e.indexOf("linux")>-1?(i._platform=v.Linux,i._systemName=v.Linux,i._systemVersion="0.0"):e.indexOf("cros")>-1?(i._platform=v.Linux,i._systemName=v.ChromeOS,i._systemVersion="0.0"):(i._systemName=v.Unknown,i._platform=v.Windows,i._systemVersion="0.0")}else i._systemName=v.Unknown,i._platform=v.Unknown,i._systemVersion="0.0"},i._getIosSystemVersion=function(e){return(e.match(/OS [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},i._getMacSystemVersion=function(e){return(e.match(/OS X [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},i._getAndroidSystemVersion=function(e){return e.substr(e.indexOf("android")+8,e.indexOf(";",e.indexOf("android"))-e.indexOf("android")-8)},i._systemName="",i._systemVersion="",i._platform=v.Unknown,i}();h.SystemUtil=s}},_={};function f(m){if(_[m])return _[m].exports;var h=_[m]={exports:{}};return T[m](h,h.exports,f),h.exports}var l={};return(()=>{var m=l;Object.defineProperty(m,"__esModule",{value:!0}),m.ApiRequest=m.LocalStorage=m.Guid=m.BrowserUtil=m.SystemUtil=void 0;var h=f(101);Object.defineProperty(m,"SystemUtil",{enumerable:!0,get:function(){return h.SystemUtil}});var v=f(622);Object.defineProperty(m,"BrowserUtil",{enumerable:!0,get:function(){return v.BrowserUtil}});var u=f(864);Object.defineProperty(m,"Guid",{enumerable:!0,get:function(){return u.Guid}});var s=f(442);Object.defineProperty(m,"LocalStorage",{enumerable:!0,get:function(){return s.LocalStorage}});var i=f(72);Object.defineProperty(m,"ApiRequest",{enumerable:!0,get:function(){return i.ApiRequest}}),window&&(window.SystemUtil=h.SystemUtil,window.BrowserUtil=v.BrowserUtil,window.Guid=u.Guid,window.LocalStorage=s.LocalStorage,window.ApiRequest=i.ApiRequest)})(),l})()},9543:(H,T,_)=>{_.r(T),_.d(T,{default:()=>De});var f={};_.r(f),_.d(f,{fixNegotiationNeeded:()=>k,shimAddTrackRemoveTrack:()=>g,shimAddTrackRemoveTrackWithNative:()=>b,shimGetDisplayMedia:()=>E,shimGetSendersWithDtmf:()=>R,shimGetStats:()=>D,shimGetUserMedia:()=>y,shimMediaStream:()=>S,shimOnTrack:()=>d,shimPeerConnection:()=>O,shimSenderReceiverGetStats:()=>A});var l={};_.r(l),_.d(l,{shimGetDisplayMedia:()=>M,shimGetUserMedia:()=>W,shimPeerConnection:()=>N,shimReplaceTrack:()=>P});var m={};_.r(m),_.d(m,{shimAddTransceiver:()=>ue,shimCreateAnswer:()=>de,shimCreateOffer:()=>ce,shimGetDisplayMedia:()=>j,shimGetParameters:()=>se,shimGetUserMedia:()=>V,shimOnTrack:()=>z,shimPeerConnection:()=>G,shimRTCDataChannel:()=>oe,shimReceiverGetStats:()=>re,shimRemoveStream:()=>te,shimSenderGetStats:()=>X});var h={};_.r(h),_.d(h,{shimAudioContext:()=>Te,shimCallbacksAPI:()=>Ee,shimConstraints:()=>me,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>fe,shimLocalStreamsAPI:()=>pe,shimRTCIceServerUrls:()=>ge,shimRemoteStreamsAPI:()=>he,shimTrackEventTransceiver:()=>be});var v={};_.r(v),_.d(v,{removeExtmapAllowMixed:()=>Ie,shimAddIceCandidateNullOrEmpty:()=>ke,shimConnectionState:()=>Me,shimMaxMessageSize:()=>_e,shimRTCIceCandidate:()=>Ae,shimSendThrowTypeError:()=>xe});let u=!0,s=!0;function i(I,K,q){const Q=I.match(K);return Q&&Q.length>=q&&parseInt(Q[q],10)}function e(I,K,q){if(!I.RTCPeerConnection)return;const Q=I.RTCPeerConnection.prototype,Z=Q.addEventListener;Q.addEventListener=function(J,ie){if(J!==K)return Z.apply(this,arguments);const ne=ae=>{const le=q(ae);le&&(ie.handleEvent?ie.handleEvent(le):ie(le))};return this._eventMap=this._eventMap||{},this._eventMap[K]||(this._eventMap[K]=new Map),this._eventMap[K].set(ie,ne),Z.apply(this,[J,ne])};const ee=Q.removeEventListener;Q.removeEventListener=function(J,ie){if(J!==K||!this._eventMap||!this._eventMap[K])return ee.apply(this,arguments);if(!this._eventMap[K].has(ie))return ee.apply(this,arguments);const ne=this._eventMap[K].get(ie);return this._eventMap[K].delete(ie),this._eventMap[K].size===0&&delete this._eventMap[K],Object.keys(this._eventMap).length===0&&delete this._eventMap,ee.apply(this,[J,ne])},Object.defineProperty(Q,"on"+K,{get(){return this["_on"+K]},set(J){this["_on"+K]&&(this.removeEventListener(K,this["_on"+K]),delete this["_on"+K]),J&&this.addEventListener(K,this["_on"+K]=J)},enumerable:!0,configurable:!0})}function o(I){return typeof I!="boolean"?new Error("Argument type: "+typeof I+". Please use a boolean."):(u=I,I?"adapter.js logging disabled":"adapter.js logging enabled")}function r(I){return typeof I!="boolean"?new Error("Argument type: "+typeof I+". Please use a boolean."):(s=!I,"adapter.js deprecation warnings "+(I?"disabled":"enabled"))}function a(){if(typeof window=="object"){if(u)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function t(I,K){s&&console.warn(I+" is deprecated, please use "+K+" instead.")}function n(I){return Object.prototype.toString.call(I)==="[object Object]"}function c(I){return n(I)?Object.keys(I).reduce(function(K,q){const Q=n(I[q]),Z=Q?c(I[q]):I[q],ee=Q&&!Object.keys(Z).length;return Z===void 0||ee?K:Object.assign(K,{[q]:Z})},{}):I}function p(I,K,q){K&&!q.has(K.id)&&(q.set(K.id,K),Object.keys(K).forEach(Q=>{Q.endsWith("Id")?p(I,I.get(K[Q]),q):Q.endsWith("Ids")&&K[Q].forEach(Z=>{p(I,I.get(Z),q)})}))}function C(I,K,q){const Q=q?"outbound-rtp":"inbound-rtp",Z=new Map;if(K===null)return Z;const ee=[];return I.forEach(J=>{J.type==="track"&&J.trackIdentifier===K.id&&ee.push(J)}),ee.forEach(J=>{I.forEach(ie=>{ie.type===Q&&ie.trackId===J.id&&p(I,ie,Z)})}),Z}const x=a;function y(I,K){const q=I&&I.navigator;if(!q.mediaDevices)return;const Q=function(J){if(typeof J!="object"||J.mandatory||J.optional)return J;const ie={};return Object.keys(J).forEach(ne=>{if(ne==="require"||ne==="advanced"||ne==="mediaSource")return;const ae=typeof J[ne]=="object"?J[ne]:{ideal:J[ne]};ae.exact!==void 0&&typeof ae.exact=="number"&&(ae.min=ae.max=ae.exact);const le=function(ve,Ce){return ve?ve+Ce.charAt(0).toUpperCase()+Ce.slice(1):Ce==="deviceId"?"sourceId":Ce};if(ae.ideal!==void 0){ie.optional=ie.optional||[];let ve={};typeof ae.ideal=="number"?(ve[le("min",ne)]=ae.ideal,ie.optional.push(ve),ve={},ve[le("max",ne)]=ae.ideal,ie.optional.push(ve)):(ve[le("",ne)]=ae.ideal,ie.optional.push(ve))}ae.exact!==void 0&&typeof ae.exact!="number"?(ie.mandatory=ie.mandatory||{},ie.mandatory[le("",ne)]=ae.exact):["min","max"].forEach(ve=>{ae[ve]!==void 0&&(ie.mandatory=ie.mandatory||{},ie.mandatory[le(ve,ne)]=ae[ve])})}),J.advanced&&(ie.optional=(ie.optional||[]).concat(J.advanced)),ie},Z=function(J,ie){if(K.version>=61)return ie(J);if((J=JSON.parse(JSON.stringify(J)))&&typeof J.audio=="object"){const ne=function(ae,le,ve){le in ae&&!(ve in ae)&&(ae[ve]=ae[le],delete ae[le])};ne((J=JSON.parse(JSON.stringify(J))).audio,"autoGainControl","googAutoGainControl"),ne(J.audio,"noiseSuppression","googNoiseSuppression"),J.audio=Q(J.audio)}if(J&&typeof J.video=="object"){let ne=J.video.facingMode;ne=ne&&(typeof ne=="object"?ne:{ideal:ne});const ae=K.version<66;if(ne&&(ne.exact==="user"||ne.exact==="environment"||ne.ideal==="user"||ne.ideal==="environment")&&(!q.mediaDevices.getSupportedConstraints||!q.mediaDevices.getSupportedConstraints().facingMode||ae)){let le;if(delete J.video.facingMode,ne.exact==="environment"||ne.ideal==="environment"?le=["back","rear"]:ne.exact!=="user"&&ne.ideal!=="user"||(le=["front"]),le)return q.mediaDevices.enumerateDevices().then(ve=>{let Ce=(ve=ve.filter(We=>We.kind==="videoinput")).find(We=>le.some(Fe=>We.label.toLowerCase().includes(Fe)));return!Ce&&ve.length&&le.includes("back")&&(Ce=ve[ve.length-1]),Ce&&(J.video.deviceId=ne.exact?{exact:Ce.deviceId}:{ideal:Ce.deviceId}),J.video=Q(J.video),x("chrome: "+JSON.stringify(J)),ie(J)})}J.video=Q(J.video)}return x("chrome: "+JSON.stringify(J)),ie(J)},ee=function(J){return K.version>=64?J:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[J.name]||J.name,message:J.message,constraint:J.constraint||J.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(q.getUserMedia=function(J,ie,ne){Z(J,ae=>{q.webkitGetUserMedia(ae,ie,le=>{ne&&ne(ee(le))})})}.bind(q),q.mediaDevices.getUserMedia){const J=q.mediaDevices.getUserMedia.bind(q.mediaDevices);q.mediaDevices.getUserMedia=function(ie){return Z(ie,ne=>J(ne).then(ae=>{if(ne.audio&&!ae.getAudioTracks().length||ne.video&&!ae.getVideoTracks().length)throw ae.getTracks().forEach(le=>{le.stop()}),new DOMException("","NotFoundError");return ae},ae=>Promise.reject(ee(ae))))}}}function E(I,K){I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||I.navigator.mediaDevices&&(typeof K=="function"?I.navigator.mediaDevices.getDisplayMedia=function(q){return K(q).then(Q=>{const Z=q.video&&q.video.width,ee=q.video&&q.video.height,J=q.video&&q.video.frameRate;return q.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:Q,maxFrameRate:J||3}},Z&&(q.video.mandatory.maxWidth=Z),ee&&(q.video.mandatory.maxHeight=ee),I.navigator.mediaDevices.getUserMedia(q)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function S(I){I.MediaStream=I.MediaStream||I.webkitMediaStream}function d(I){if(typeof I=="object"&&I.RTCPeerConnection&&!("ontrack"in I.RTCPeerConnection.prototype)){Object.defineProperty(I.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(q){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=q)},enumerable:!0,configurable:!0});const K=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=q=>{q.stream.addEventListener("addtrack",Q=>{let Z;Z=I.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(J=>J.track&&J.track.id===Q.track.id):{track:Q.track};const ee=new Event("track");ee.track=Q.track,ee.receiver=Z,ee.transceiver={receiver:Z},ee.streams=[q.stream],this.dispatchEvent(ee)}),q.stream.getTracks().forEach(Q=>{let Z;Z=I.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(J=>J.track&&J.track.id===Q.id):{track:Q};const ee=new Event("track");ee.track=Q,ee.receiver=Z,ee.transceiver={receiver:Z},ee.streams=[q.stream],this.dispatchEvent(ee)})},this.addEventListener("addstream",this._ontrackpoly)),K.apply(this,arguments)}}else e(I,"track",K=>(K.transceiver||Object.defineProperty(K,"transceiver",{value:{receiver:K.receiver}}),K))}function R(I){if(typeof I=="object"&&I.RTCPeerConnection&&!("getSenders"in I.RTCPeerConnection.prototype)&&"createDTMFSender"in I.RTCPeerConnection.prototype){const K=function(Z,ee){return{track:ee,get dtmf(){return this._dtmf===void 0&&(ee.kind==="audio"?this._dtmf=Z.createDTMFSender(ee):this._dtmf=null),this._dtmf},_pc:Z}};if(!I.RTCPeerConnection.prototype.getSenders){I.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const Z=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addTrack=function(J,ie){let ne=Z.apply(this,arguments);return ne||(ne=K(this,J),this._senders.push(ne)),ne};const ee=I.RTCPeerConnection.prototype.removeTrack;I.RTCPeerConnection.prototype.removeTrack=function(J){ee.apply(this,arguments);const ie=this._senders.indexOf(J);ie!==-1&&this._senders.splice(ie,1)}}const q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(Z){this._senders=this._senders||[],q.apply(this,[Z]),Z.getTracks().forEach(ee=>{this._senders.push(K(this,ee))})};const Q=I.RTCPeerConnection.prototype.removeStream;I.RTCPeerConnection.prototype.removeStream=function(Z){this._senders=this._senders||[],Q.apply(this,[Z]),Z.getTracks().forEach(ee=>{const J=this._senders.find(ie=>ie.track===ee);J&&this._senders.splice(this._senders.indexOf(J),1)})}}else if(typeof I=="object"&&I.RTCPeerConnection&&"getSenders"in I.RTCPeerConnection.prototype&&"createDTMFSender"in I.RTCPeerConnection.prototype&&I.RTCRtpSender&&!("dtmf"in I.RTCRtpSender.prototype)){const K=I.RTCPeerConnection.prototype.getSenders;I.RTCPeerConnection.prototype.getSenders=function(){const q=K.apply(this,[]);return q.forEach(Q=>Q._pc=this),q},Object.defineProperty(I.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function D(I){if(!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){const[q,Q,Z]=arguments;if(arguments.length>0&&typeof q=="function")return K.apply(this,arguments);if(K.length===0&&(arguments.length===0||typeof q!="function"))return K.apply(this,[]);const ee=function(ie){const ne={};return ie.result().forEach(ae=>{const le={id:ae.id,timestamp:ae.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[ae.type]||ae.type};ae.names().forEach(ve=>{le[ve]=ae.stat(ve)}),ne[le.id]=le}),ne},J=function(ie){return new Map(Object.keys(ie).map(ne=>[ne,ie[ne]]))};if(arguments.length>=2){const ie=function(ne){Q(J(ee(ne)))};return K.apply(this,[ie,q])}return new Promise((ie,ne)=>{K.apply(this,[function(ae){ie(J(ee(ae)))},ne])}).then(Q,Z)}}function A(I){if(!(typeof I=="object"&&I.RTCPeerConnection&&I.RTCRtpSender&&I.RTCRtpReceiver))return;if(!("getStats"in I.RTCRtpSender.prototype)){const q=I.RTCPeerConnection.prototype.getSenders;q&&(I.RTCPeerConnection.prototype.getSenders=function(){const Z=q.apply(this,[]);return Z.forEach(ee=>ee._pc=this),Z});const Q=I.RTCPeerConnection.prototype.addTrack;Q&&(I.RTCPeerConnection.prototype.addTrack=function(){const Z=Q.apply(this,arguments);return Z._pc=this,Z}),I.RTCRtpSender.prototype.getStats=function(){const Z=this;return this._pc.getStats().then(ee=>C(ee,Z.track,!0))}}if(!("getStats"in I.RTCRtpReceiver.prototype)){const q=I.RTCPeerConnection.prototype.getReceivers;q&&(I.RTCPeerConnection.prototype.getReceivers=function(){const Q=q.apply(this,[]);return Q.forEach(Z=>Z._pc=this),Q}),e(I,"track",Q=>(Q.receiver._pc=Q.srcElement,Q)),I.RTCRtpReceiver.prototype.getStats=function(){const Q=this;return this._pc.getStats().then(Z=>C(Z,Q.track,!1))}}if(!("getStats"in I.RTCRtpSender.prototype)||!("getStats"in I.RTCRtpReceiver.prototype))return;const K=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof I.MediaStreamTrack){const q=arguments[0];let Q,Z,ee;return this.getSenders().forEach(J=>{J.track===q&&(Q?ee=!0:Q=J)}),this.getReceivers().forEach(J=>(J.track===q&&(Z?ee=!0:Z=J),J.track===q)),ee||Q&&Z?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):Q?Q.getStats():Z?Z.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return K.apply(this,arguments)}}function b(I){I.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(ee=>this._shimmedLocalStreams[ee][0])};const K=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addTrack=function(ee,J){if(!J)return K.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const ie=K.apply(this,arguments);return this._shimmedLocalStreams[J.id]?this._shimmedLocalStreams[J.id].indexOf(ie)===-1&&this._shimmedLocalStreams[J.id].push(ie):this._shimmedLocalStreams[J.id]=[J,ie],ie};const q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(ee){this._shimmedLocalStreams=this._shimmedLocalStreams||{},ee.getTracks().forEach(ne=>{if(this.getSenders().find(ae=>ae.track===ne))throw new DOMException("Track already exists.","InvalidAccessError")});const J=this.getSenders();q.apply(this,arguments);const ie=this.getSenders().filter(ne=>J.indexOf(ne)===-1);this._shimmedLocalStreams[ee.id]=[ee].concat(ie)};const Q=I.RTCPeerConnection.prototype.removeStream;I.RTCPeerConnection.prototype.removeStream=function(ee){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[ee.id],Q.apply(this,arguments)};const Z=I.RTCPeerConnection.prototype.removeTrack;I.RTCPeerConnection.prototype.removeTrack=function(ee){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},ee&&Object.keys(this._shimmedLocalStreams).forEach(J=>{const ie=this._shimmedLocalStreams[J].indexOf(ee);ie!==-1&&this._shimmedLocalStreams[J].splice(ie,1),this._shimmedLocalStreams[J].length===1&&delete this._shimmedLocalStreams[J]}),Z.apply(this,arguments)}}function g(I,K){if(!I.RTCPeerConnection)return;if(I.RTCPeerConnection.prototype.addTrack&&K.version>=65)return b(I);const q=I.RTCPeerConnection.prototype.getLocalStreams;I.RTCPeerConnection.prototype.getLocalStreams=function(){const ne=q.apply(this);return this._reverseStreams=this._reverseStreams||{},ne.map(ae=>this._reverseStreams[ae.id])};const Q=I.RTCPeerConnection.prototype.addStream;I.RTCPeerConnection.prototype.addStream=function(ne){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},ne.getTracks().forEach(ae=>{if(this.getSenders().find(le=>le.track===ae))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[ne.id]){const ae=new I.MediaStream(ne.getTracks());this._streams[ne.id]=ae,this._reverseStreams[ae.id]=ne,ne=ae}Q.apply(this,[ne])};const Z=I.RTCPeerConnection.prototype.removeStream;function ee(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const Ce=ne._reverseStreams[ve],We=ne._streams[Ce.id];le=le.replace(new RegExp(We.id,"g"),Ce.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}I.RTCPeerConnection.prototype.removeStream=function(ne){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Z.apply(this,[this._streams[ne.id]||ne]),delete this._reverseStreams[this._streams[ne.id]?this._streams[ne.id].id:ne.id],delete this._streams[ne.id]},I.RTCPeerConnection.prototype.addTrack=function(ne,ae){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const le=[].slice.call(arguments,1);if(le.length!==1||!le[0].getTracks().find(Ce=>Ce===ne))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(Ce=>Ce.track===ne))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const ve=this._streams[ae.id];if(ve)ve.addTrack(ne),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const Ce=new I.MediaStream([ne]);this._streams[ae.id]=Ce,this._reverseStreams[Ce.id]=ae,this.addStream(Ce)}return this.getSenders().find(Ce=>Ce.track===ne)},["createOffer","createAnswer"].forEach(function(ne){const ae=I.RTCPeerConnection.prototype[ne],le={[ne](){const ve=arguments;return arguments.length&&typeof arguments[0]=="function"?ae.apply(this,[Ce=>{const We=ee(this,Ce);ve[0].apply(null,[We])},Ce=>{ve[1]&&ve[1].apply(null,Ce)},arguments[2]]):ae.apply(this,arguments).then(Ce=>ee(this,Ce))}};I.RTCPeerConnection.prototype[ne]=le[ne]});const J=I.RTCPeerConnection.prototype.setLocalDescription;I.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const Ce=ne._reverseStreams[ve],We=ne._streams[Ce.id];le=le.replace(new RegExp(Ce.id,"g"),We.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}(this,arguments[0]),J.apply(this,arguments)):J.apply(this,arguments)};const ie=Object.getOwnPropertyDescriptor(I.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(I.RTCPeerConnection.prototype,"localDescription",{get(){const ne=ie.get.apply(this);return ne.type===""?ne:ee(this,ne)}}),I.RTCPeerConnection.prototype.removeTrack=function(ne){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!ne._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(ne._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let ae;this._streams=this._streams||{},Object.keys(this._streams).forEach(le=>{this._streams[le].getTracks().find(ve=>ne.track===ve)&&(ae=this._streams[le])}),ae&&(ae.getTracks().length===1?this.removeStream(this._reverseStreams[ae.id]):ae.removeTrack(ne.track),this.dispatchEvent(new Event("negotiationneeded")))}}function O(I,K){!I.RTCPeerConnection&&I.webkitRTCPeerConnection&&(I.RTCPeerConnection=I.webkitRTCPeerConnection),I.RTCPeerConnection&&K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(q){const Q=I.RTCPeerConnection.prototype[q],Z={[q](){return arguments[0]=new(q==="addIceCandidate"?I.RTCIceCandidate:I.RTCSessionDescription)(arguments[0]),Q.apply(this,arguments)}};I.RTCPeerConnection.prototype[q]=Z[q]})}function k(I,K){e(I,"negotiationneeded",q=>{const Q=q.target;if(!(K.version<72||Q.getConfiguration&&Q.getConfiguration().sdpSemantics==="plan-b")||Q.signalingState==="stable")return q})}var U=_(6677),w=_.n(U);function W(I){const K=I&&I.navigator,q=K.mediaDevices.getUserMedia.bind(K.mediaDevices);K.mediaDevices.getUserMedia=function(Q){return q(Q).catch(Z=>Promise.reject(function(ee){return{name:{PermissionDeniedError:"NotAllowedError"}[ee.name]||ee.name,message:ee.message,constraint:ee.constraint,toString(){return this.name}}}(Z)))}}function M(I){"getDisplayMedia"in I.navigator&&I.navigator.mediaDevices&&(I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||(I.navigator.mediaDevices.getDisplayMedia=I.navigator.getDisplayMedia.bind(I.navigator)))}function N(I,K){if(I.RTCIceGatherer&&(I.RTCIceCandidate||(I.RTCIceCandidate=function(Q){return Q}),I.RTCSessionDescription||(I.RTCSessionDescription=function(Q){return Q}),K.version<15025)){const Q=Object.getOwnPropertyDescriptor(I.MediaStreamTrack.prototype,"enabled");Object.defineProperty(I.MediaStreamTrack.prototype,"enabled",{set(Z){Q.set.call(this,Z);const ee=new Event("enabled");ee.enabled=Z,this.dispatchEvent(ee)}})}I.RTCRtpSender&&!("dtmf"in I.RTCRtpSender.prototype)&&Object.defineProperty(I.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new I.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),I.RTCDtmfSender&&!I.RTCDTMFSender&&(I.RTCDTMFSender=I.RTCDtmfSender);const q=w()(I,K.version);I.RTCPeerConnection=function(Q){return Q&&Q.iceServers&&(Q.iceServers=function(Z){let ee=!1;return(Z=JSON.parse(JSON.stringify(Z))).filter(J=>{if(J&&(J.urls||J.url)){let ie=J.urls||J.url;J.url&&!J.urls&&t("RTCIceServer.url","RTCIceServer.urls");const ne=typeof ie=="string";return ne&&(ie=[ie]),ie=ie.filter(ae=>{if(ae.indexOf("stun:")===0)return!1;const le=ae.startsWith("turn")&&!ae.startsWith("turn:[")&&ae.includes("transport=udp");return le&&!ee?(ee=!0,!0):le&&!ee}),delete J.url,J.urls=ne?ie[0]:ie,!!ie.length}})}(Q.iceServers,K.version),a("ICE servers after filtering:",Q.iceServers)),new q(Q)},I.RTCPeerConnection.prototype=q.prototype}function P(I){I.RTCRtpSender&&!("replaceTrack"in I.RTCRtpSender.prototype)&&(I.RTCRtpSender.prototype.replaceTrack=I.RTCRtpSender.prototype.setTrack)}function V(I,K){const q=I&&I.navigator,Q=I&&I.MediaStreamTrack;if(q.getUserMedia=function(Z,ee,J){t("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),q.mediaDevices.getUserMedia(Z).then(ee,J)},!(K.version>55&&"autoGainControl"in q.mediaDevices.getSupportedConstraints())){const Z=function(J,ie,ne){ie in J&&!(ne in J)&&(J[ne]=J[ie],delete J[ie])},ee=q.mediaDevices.getUserMedia.bind(q.mediaDevices);if(q.mediaDevices.getUserMedia=function(J){return typeof J=="object"&&typeof J.audio=="object"&&(J=JSON.parse(JSON.stringify(J)),Z(J.audio,"autoGainControl","mozAutoGainControl"),Z(J.audio,"noiseSuppression","mozNoiseSuppression")),ee(J)},Q&&Q.prototype.getSettings){const J=Q.prototype.getSettings;Q.prototype.getSettings=function(){const ie=J.apply(this,arguments);return Z(ie,"mozAutoGainControl","autoGainControl"),Z(ie,"mozNoiseSuppression","noiseSuppression"),ie}}if(Q&&Q.prototype.applyConstraints){const J=Q.prototype.applyConstraints;Q.prototype.applyConstraints=function(ie){return this.kind==="audio"&&typeof ie=="object"&&(ie=JSON.parse(JSON.stringify(ie)),Z(ie,"autoGainControl","mozAutoGainControl"),Z(ie,"noiseSuppression","mozNoiseSuppression")),J.apply(this,[ie])}}}}function j(I,K){I.navigator.mediaDevices&&"getDisplayMedia"in I.navigator.mediaDevices||I.navigator.mediaDevices&&(I.navigator.mediaDevices.getDisplayMedia=function(q){if(!q||!q.video){const Q=new DOMException("getDisplayMedia without video constraints is undefined");return Q.name="NotFoundError",Q.code=8,Promise.reject(Q)}return q.video===!0?q.video={mediaSource:K}:q.video.mediaSource=K,I.navigator.mediaDevices.getUserMedia(q)})}function z(I){typeof I=="object"&&I.RTCTrackEvent&&"receiver"in I.RTCTrackEvent.prototype&&!("transceiver"in I.RTCTrackEvent.prototype)&&Object.defineProperty(I.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function G(I,K){if(typeof I!="object"||!I.RTCPeerConnection&&!I.mozRTCPeerConnection)return;!I.RTCPeerConnection&&I.mozRTCPeerConnection&&(I.RTCPeerConnection=I.mozRTCPeerConnection),K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Z){const ee=I.RTCPeerConnection.prototype[Z],J={[Z](){return arguments[0]=new(Z==="addIceCandidate"?I.RTCIceCandidate:I.RTCSessionDescription)(arguments[0]),ee.apply(this,arguments)}};I.RTCPeerConnection.prototype[Z]=J[Z]});const q={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},Q=I.RTCPeerConnection.prototype.getStats;I.RTCPeerConnection.prototype.getStats=function(){const[Z,ee,J]=arguments;return Q.apply(this,[Z||null]).then(ie=>{if(K.version<53&&!ee)try{ie.forEach(ne=>{ne.type=q[ne.type]||ne.type})}catch(ne){if(ne.name!=="TypeError")throw ne;ie.forEach((ae,le)=>{ie.set(le,Object.assign({},ae,{type:q[ae.type]||ae.type}))})}return ie}).then(ee,J)}}function X(I){if(typeof I!="object"||!I.RTCPeerConnection||!I.RTCRtpSender||I.RTCRtpSender&&"getStats"in I.RTCRtpSender.prototype)return;const K=I.RTCPeerConnection.prototype.getSenders;K&&(I.RTCPeerConnection.prototype.getSenders=function(){const Q=K.apply(this,[]);return Q.forEach(Z=>Z._pc=this),Q});const q=I.RTCPeerConnection.prototype.addTrack;q&&(I.RTCPeerConnection.prototype.addTrack=function(){const Q=q.apply(this,arguments);return Q._pc=this,Q}),I.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function re(I){if(typeof I!="object"||!I.RTCPeerConnection||!I.RTCRtpSender||I.RTCRtpSender&&"getStats"in I.RTCRtpReceiver.prototype)return;const K=I.RTCPeerConnection.prototype.getReceivers;K&&(I.RTCPeerConnection.prototype.getReceivers=function(){const q=K.apply(this,[]);return q.forEach(Q=>Q._pc=this),q}),e(I,"track",q=>(q.receiver._pc=q.srcElement,q)),I.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function te(I){I.RTCPeerConnection&&!("removeStream"in I.RTCPeerConnection.prototype)&&(I.RTCPeerConnection.prototype.removeStream=function(K){t("removeStream","removeTrack"),this.getSenders().forEach(q=>{q.track&&K.getTracks().includes(q.track)&&this.removeTrack(q)})})}function oe(I){I.DataChannel&&!I.RTCDataChannel&&(I.RTCDataChannel=I.DataChannel)}function ue(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.addTransceiver;K&&(I.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const q=arguments[1],Q=q&&"sendEncodings"in q;Q&&q.sendEncodings.forEach(ee=>{if("rid"in ee&&!/^[a-z0-9]{0,16}$/i.test(ee.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in ee&&!(parseFloat(ee.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in ee&&!(parseFloat(ee.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const Z=K.apply(this,arguments);if(Q){const{sender:ee}=Z,J=ee.getParameters();(!("encodings"in J)||J.encodings.length===1&&Object.keys(J.encodings[0]).length===0)&&(J.encodings=q.sendEncodings,ee.sendEncodings=q.sendEncodings,this.setParametersPromises.push(ee.setParameters(J).then(()=>{delete ee.sendEncodings}).catch(()=>{delete ee.sendEncodings})))}return Z})}function se(I){if(typeof I!="object"||!I.RTCRtpSender)return;const K=I.RTCRtpSender.prototype.getParameters;K&&(I.RTCRtpSender.prototype.getParameters=function(){const q=K.apply(this,arguments);return"encodings"in q||(q.encodings=[].concat(this.sendEncodings||[{}])),q})}function ce(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.createOffer;I.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function de(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype.createAnswer;I.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function pe(I){if(typeof I=="object"&&I.RTCPeerConnection){if("getLocalStreams"in I.RTCPeerConnection.prototype||(I.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in I.RTCPeerConnection.prototype)){const K=I.RTCPeerConnection.prototype.addTrack;I.RTCPeerConnection.prototype.addStream=function(q){this._localStreams||(this._localStreams=[]),this._localStreams.includes(q)||this._localStreams.push(q),q.getAudioTracks().forEach(Q=>K.call(this,Q,q)),q.getVideoTracks().forEach(Q=>K.call(this,Q,q))},I.RTCPeerConnection.prototype.addTrack=function(q,...Q){return Q&&Q.forEach(Z=>{this._localStreams?this._localStreams.includes(Z)||this._localStreams.push(Z):this._localStreams=[Z]}),K.apply(this,arguments)}}"removeStream"in I.RTCPeerConnection.prototype||(I.RTCPeerConnection.prototype.removeStream=function(K){this._localStreams||(this._localStreams=[]);const q=this._localStreams.indexOf(K);if(q===-1)return;this._localStreams.splice(q,1);const Q=K.getTracks();this.getSenders().forEach(Z=>{Q.includes(Z.track)&&this.removeTrack(Z)})})}}function he(I){if(typeof I=="object"&&I.RTCPeerConnection&&("getRemoteStreams"in I.RTCPeerConnection.prototype||(I.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in I.RTCPeerConnection.prototype))){Object.defineProperty(I.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(q){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=q),this.addEventListener("track",this._onaddstreampoly=Q=>{Q.streams.forEach(Z=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(Z))return;this._remoteStreams.push(Z);const ee=new Event("addstream");ee.stream=Z,this.dispatchEvent(ee)})})}});const K=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){const q=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(Q){Q.streams.forEach(Z=>{if(q._remoteStreams||(q._remoteStreams=[]),q._remoteStreams.indexOf(Z)>=0)return;q._remoteStreams.push(Z);const ee=new Event("addstream");ee.stream=Z,q.dispatchEvent(ee)})}),K.apply(q,arguments)}}}function Ee(I){if(typeof I!="object"||!I.RTCPeerConnection)return;const K=I.RTCPeerConnection.prototype,q=K.createOffer,Q=K.createAnswer,Z=K.setLocalDescription,ee=K.setRemoteDescription,J=K.addIceCandidate;K.createOffer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=q.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve},K.createAnswer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=Q.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve};let ie=function(ne,ae,le){const ve=Z.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve};K.setLocalDescription=ie,ie=function(ne,ae,le){const ve=ee.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.setRemoteDescription=ie,ie=function(ne,ae,le){const ve=J.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.addIceCandidate=ie}function fe(I){const K=I&&I.navigator;if(K.mediaDevices&&K.mediaDevices.getUserMedia){const q=K.mediaDevices,Q=q.getUserMedia.bind(q);K.mediaDevices.getUserMedia=Z=>Q(me(Z))}!K.getUserMedia&&K.mediaDevices&&K.mediaDevices.getUserMedia&&(K.getUserMedia=function(q,Q,Z){K.mediaDevices.getUserMedia(q).then(Q,Z)}.bind(K))}function me(I){return I&&I.video!==void 0?Object.assign({},I,{video:c(I.video)}):I}function ge(I){if(!I.RTCPeerConnection)return;const K=I.RTCPeerConnection;I.RTCPeerConnection=function(q,Q){if(q&&q.iceServers){const Z=[];for(let ee=0;ee<q.iceServers.length;ee++){let J=q.iceServers[ee];!J.hasOwnProperty("urls")&&J.hasOwnProperty("url")?(t("RTCIceServer.url","RTCIceServer.urls"),J=JSON.parse(JSON.stringify(J)),J.urls=J.url,delete J.url,Z.push(J)):Z.push(q.iceServers[ee])}q.iceServers=Z}return new K(q,Q)},I.RTCPeerConnection.prototype=K.prototype,"generateCertificate"in K&&Object.defineProperty(I.RTCPeerConnection,"generateCertificate",{get:()=>K.generateCertificate})}function be(I){typeof I=="object"&&I.RTCTrackEvent&&"receiver"in I.RTCTrackEvent.prototype&&!("transceiver"in I.RTCTrackEvent.prototype)&&Object.defineProperty(I.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Re(I){const K=I.RTCPeerConnection.prototype.createOffer;I.RTCPeerConnection.prototype.createOffer=function(q){if(q){q.offerToReceiveAudio!==void 0&&(q.offerToReceiveAudio=!!q.offerToReceiveAudio);const Q=this.getTransceivers().find(ee=>ee.receiver.track.kind==="audio");q.offerToReceiveAudio===!1&&Q?Q.direction==="sendrecv"?Q.setDirection?Q.setDirection("sendonly"):Q.direction="sendonly":Q.direction==="recvonly"&&(Q.setDirection?Q.setDirection("inactive"):Q.direction="inactive"):q.offerToReceiveAudio!==!0||Q||this.addTransceiver("audio"),q.offerToReceiveVideo!==void 0&&(q.offerToReceiveVideo=!!q.offerToReceiveVideo);const Z=this.getTransceivers().find(ee=>ee.receiver.track.kind==="video");q.offerToReceiveVideo===!1&&Z?Z.direction==="sendrecv"?Z.setDirection?Z.setDirection("sendonly"):Z.direction="sendonly":Z.direction==="recvonly"&&(Z.setDirection?Z.setDirection("inactive"):Z.direction="inactive"):q.offerToReceiveVideo!==!0||Z||this.addTransceiver("video")}return K.apply(this,arguments)}}function Te(I){typeof I!="object"||I.AudioContext||(I.AudioContext=I.webkitAudioContext)}var Pe=_(7963),Oe=_.n(Pe);function Ae(I){if(!I.RTCIceCandidate||I.RTCIceCandidate&&"foundation"in I.RTCIceCandidate.prototype)return;const K=I.RTCIceCandidate;I.RTCIceCandidate=function(q){if(typeof q=="object"&&q.candidate&&q.candidate.indexOf("a=")===0&&((q=JSON.parse(JSON.stringify(q))).candidate=q.candidate.substr(2)),q.candidate&&q.candidate.length){const Q=new K(q),Z=Oe().parseCandidate(q.candidate),ee=Object.assign(Q,Z);return ee.toJSON=function(){return{candidate:ee.candidate,sdpMid:ee.sdpMid,sdpMLineIndex:ee.sdpMLineIndex,usernameFragment:ee.usernameFragment}},ee}return new K(q)},I.RTCIceCandidate.prototype=K.prototype,e(I,"icecandidate",q=>(q.candidate&&Object.defineProperty(q,"candidate",{value:new I.RTCIceCandidate(q.candidate),writable:"false"}),q))}function _e(I,K){if(!I.RTCPeerConnection)return;"sctp"in I.RTCPeerConnection.prototype||Object.defineProperty(I.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const q=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,K.browser==="chrome"&&K.version>=76){const{sdpSemantics:Q}=this.getConfiguration();Q==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(function(Q){if(!Q||!Q.sdp)return!1;const Z=Oe().splitSections(Q.sdp);return Z.shift(),Z.some(ee=>{const J=Oe().parseMLine(ee);return J&&J.kind==="application"&&J.protocol.indexOf("SCTP")!==-1})}(arguments[0])){const Q=function(ne){const ae=ne.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(ae===null||ae.length<2)return-1;const le=parseInt(ae[1],10);return le!=le?-1:le}(arguments[0]),Z=function(ne){let ae=65536;return K.browser==="firefox"&&(ae=K.version<57?ne===-1?16384:2147483637:K.version<60?K.version===57?65535:65536:2147483637),ae}(Q),ee=function(ne,ae){let le=65536;K.browser==="firefox"&&K.version===57&&(le=65535);const ve=Oe().matchPrefix(ne.sdp,"a=max-message-size:");return ve.length>0?le=parseInt(ve[0].substr(19),10):K.browser==="firefox"&&ae!==-1&&(le=2147483637),le}(arguments[0],Q);let J;J=Z===0&&ee===0?Number.POSITIVE_INFINITY:Z===0||ee===0?Math.max(Z,ee):Math.min(Z,ee);const ie={};Object.defineProperty(ie,"maxMessageSize",{get:()=>J}),this._sctp=ie}return q.apply(this,arguments)}}function xe(I){if(!I.RTCPeerConnection||!("createDataChannel"in I.RTCPeerConnection.prototype))return;function K(Q,Z){const ee=Q.send;Q.send=function(){const J=arguments[0],ie=J.length||J.size||J.byteLength;if(Q.readyState==="open"&&Z.sctp&&ie>Z.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+Z.sctp.maxMessageSize+" bytes)");return ee.apply(Q,arguments)}}const q=I.RTCPeerConnection.prototype.createDataChannel;I.RTCPeerConnection.prototype.createDataChannel=function(){const Q=q.apply(this,arguments);return K(Q,this),Q},e(I,"datachannel",Q=>(K(Q.channel,Q.target),Q))}function Me(I){if(!I.RTCPeerConnection||"connectionState"in I.RTCPeerConnection.prototype)return;const K=I.RTCPeerConnection.prototype;Object.defineProperty(K,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(K,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(q){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),q&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=q)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(q=>{const Q=K[q];K[q]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=Z=>{const ee=Z.target;if(ee._lastConnectionState!==ee.connectionState){ee._lastConnectionState=ee.connectionState;const J=new Event("connectionstatechange",Z);ee.dispatchEvent(J)}return Z},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),Q.apply(this,arguments)}})}function Ie(I,K){if(!I.RTCPeerConnection||K.browser==="chrome"&&K.version>=71||K.browser==="safari"&&K.version>=605)return;const q=I.RTCPeerConnection.prototype.setRemoteDescription;I.RTCPeerConnection.prototype.setRemoteDescription=function(Q){if(Q&&Q.sdp&&Q.sdp.indexOf(`
|
|
160
160
|
a=extmap-allow-mixed`)!==-1){const Z=Q.sdp.split(`
|
|
161
161
|
`).filter(ee=>ee.trim()!=="a=extmap-allow-mixed").join(`
|
|
162
|
-
`);I.RTCSessionDescription&&Q instanceof I.RTCSessionDescription?arguments[0]=new I.RTCSessionDescription({type:Q.type,sdp:Z}):Q.sdp=Z}return q.apply(this,arguments)}}function ke(I,K){if(!I.RTCPeerConnection||!I.RTCPeerConnection.prototype)return;const q=I.RTCPeerConnection.prototype.addIceCandidate;q&&q.length!==0&&(I.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():q.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const Ue=function({window:I}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const q=a,Q=function(ee){const J={browser:null,version:null};if(ee===void 0||!ee.navigator)return J.browser="Not a browser.",J;const{navigator:ie}=ee;if(ie.mozGetUserMedia)J.browser="firefox",J.version=i(ie.userAgent,/Firefox\/(\d+)\./,1);else if(ie.webkitGetUserMedia||ee.isSecureContext===!1&&ee.webkitRTCPeerConnection&&!ee.RTCIceGatherer)J.browser="chrome",J.version=i(ie.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(ie.mediaDevices&&ie.userAgent.match(/Edge\/(\d+).(\d+)$/))J.browser="edge",J.version=i(ie.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!ee.RTCPeerConnection||!ie.userAgent.match(/AppleWebKit\/(\d+)\./))return J.browser="Not a supported browser.",J;J.browser="safari",J.version=i(ie.userAgent,/AppleWebKit\/(\d+)\./,1),J.supportsUnifiedPlan=ee.RTCRtpTransceiver&&"currentDirection"in ee.RTCRtpTransceiver.prototype}return J}(I),Z={browserDetails:Q,commonShim:v,extractVersion:i,disableLog:o,disableWarnings:r};switch(Q.browser){case"chrome":if(!f||!O||!K.shimChrome)return q("Chrome shim is not included in this adapter release."),Z;if(Q.version===null)return q("Chrome shim can not determine version, not shimming."),Z;q("adapter.js shimming chrome."),Z.browserShim=f,ke(I,Q),y(I,Q),S(I),O(I,Q),d(I),g(I,Q),R(I),D(I),A(I),k(I,Q),Ae(I),Me(I),_e(I,Q),xe(I),Ie(I,Q);break;case"firefox":if(!m||!G||!K.shimFirefox)return q("Firefox shim is not included in this adapter release."),Z;q("adapter.js shimming firefox."),Z.browserShim=m,ke(I,Q),V(I,Q),G(I,Q),z(I),te(I),X(I),re(I),oe(I),ue(I),se(I),ce(I),de(I),Ae(I),Me(I),_e(I,Q),xe(I);break;case"edge":if(!l||!N||!K.shimEdge)return q("MS edge shim is not included in this adapter release."),Z;q("adapter.js shimming edge."),Z.browserShim=l,W(I),M(I),N(I,Q),P(I),_e(I,Q),xe(I);break;case"safari":if(!h||!K.shimSafari)return q("Safari shim is not included in this adapter release."),Z;q("adapter.js shimming safari."),Z.browserShim=h,ke(I,Q),ge(I),Re(I),Ee(I),pe(I),he(I),be(I),fe(I),Te(I),Ae(I),_e(I,Q),xe(I),Ie(I,Q);break;default:q("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),De=Ue},6834:(H,T,_)=>{_.r(T),_.d(T,{default:()=>m});var f=_(5512),l=_.n(f);function m(){return l()('/*! aliyun rts sdk - ver2.13.2 created:2025/10/14 11:48:41 */(()=>{"use strict";var e={28:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={version:"2.13.2",protocol_version:2,sdk_version:"0.0.1"}},917:(e,t)=>{var r,o,n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=t.DEFAULT_HEARTBEAT_TIMEOUT=t.DEFAULT_RETRY_PUBLISH_INTERVAL=t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=t.DEFAULT_RETRY_PUBLISH_LIMIT=t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=t.EWorkerAction=t.EWorkerSource=t.EConnectStatus=t.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(r||(t.TrackType=r={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(o||(t.EConnectStatus=o={})),function(e){e.Sender="sender",e.Receiver="receiver"}(n||(t.EWorkerSource=n={})),function(e){e.Setup="setup",e.InserSEI="insertSEI",e.UpdatePubStats="updatePubStats",e.UpdateSubStats="updateSubStats",e.SwitchCumuDelay="switchCumuDelay"}(i||(t.EWorkerAction=i={})),t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,t.DEFAULT_RETRY_PUBLISH_LIMIT=5,t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,t.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,t.DEFAULT_HEARTBEAT_TIMEOUT=8,t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},649:function(e,t,r){var o,n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CumuDelaySeiPayloadParser=t.CumuDelaySeiPayload=t.ECumuDelayGrtnKey=t.ECumuDelayPubSdkKey=t.ECumuDelayAVCommonKey=t.ECumuDelayVideoKey=t.ECumuDelayGrtnExportKey=t.ECumuDelaySubKey=t.CUMU_DELAY_UUID=t.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var s,u,l,A,C=a(r(28));t.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,t.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(e){e.SophonAudioDual="sophon_audio_dual",e.SophonVideoCamera="sophon_video_camera",e.SophonVideoCameraSmall="sophon_video_camera_small",e.SophonVideoCameraSuper="sophon_video_camera_super",e.SophonVideoScreenShare="sophon_video_screen_share",e.SophonAudio="sophon_audio",e.SophonVideoCameraLarge="sophon_video_camera_large",e.RtsAudio="rts audio",e.RtsVideo="rts video"}(s||(s={})),function(e){e[e.Web=0]="Web",e[e.iOS=1]="iOS",e[e.Android=2]="Android"}(u||(u={})),function(e){e.VTotalCost="VTotalCost",e.VAssemblyCost="VAssemblyCost",e.VJitterBufferDelay="VJitterBufferDelay",e.VDecPlugCost="VDecPlugCost",e.DownRTTHalf="DownRTTHalf"}(l||(t.ECumuDelaySubKey=l={})),function(e){e.TOTAL_COST="TOTAL_COST",e.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",e.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(A||(t.ECumuDelayGrtnExportKey=A={}));var c,T,f,d,E,_,y,S=((o={})[s.SophonAudioDual]=4,o[s.SophonVideoCamera]=5,o[s.SophonVideoCameraSmall]=6,o[s.SophonVideoCameraSuper]=7,o[s.SophonVideoScreenShare]=8,o[s.SophonAudio]=9,o[s.SophonVideoCameraLarge]=10,o[s.RtsAudio]=11,o[s.RtsVideo]=12,o);(n={})[S[s.SophonAudioDual]]=s.SophonAudioDual,n[S[s.SophonVideoCamera]]=s.SophonVideoCamera,n[S[s.SophonVideoCameraSmall]]=s.SophonVideoCameraSmall,n[S[s.SophonVideoCameraSuper]]=s.SophonVideoCameraSuper,n[S[s.SophonVideoScreenShare]]=s.SophonVideoScreenShare,n[S[s.SophonAudio]]=s.SophonAudio,n[S[s.SophonVideoCameraLarge]]=s.SophonVideoCameraLarge,n[S[s.RtsAudio]]=s.RtsAudio,n[S[s.RtsVideo]]=s.RtsVideo;!function(e){e[e.VTotalCost=4]="VTotalCost",e[e.CapDeviceCost=5]="CapDeviceCost",e[e.PushExtCost=6]="PushExtCost",e[e.CapPlugCost=7]="CapPlugCost",e[e.PrepThrCost=8]="PrepThrCost",e[e.PrepPlugCost=9]="PrepPlugCost",e[e.DispThrCost=10]="DispThrCost",e[e.DispPlugCost=11]="DispPlugCost",e[e.VEncThrCost=12]="VEncThrCost",e[e.VEncPlugCost=13]="VEncPlugCost"}(c||(t.ECumuDelayVideoKey=c={})),function(e){e[e.ATotalCost=24]="ATotalCost",e[e.ASourceCCost=25]="ASourceCCost",e[e.AMixerCost=26]="AMixerCost",e[e.AEncodeCCost=27]="AEncodeCCost",e[e.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",e[e.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",e[e.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",e[e.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",e[e.AAIClientScentenceId=32]="AAIClientScentenceId",e[e.AAIClientSourceCost=33]="AAIClientSourceCost",e[e.AAIClientMixerCost=34]="AAIClientMixerCost",e[e.AAIClientEncoderCost=35]="AAIClientEncoderCost",e[e.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",e[e.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",e[e.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",e[e.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",e[e.AAILinuxPlayCost=40]="AAILinuxPlayCost",e[e.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",e[e.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",e[e.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(T||(T={})),function(e){e[e.NetsdkThrCost=44]="NetsdkThrCost",e[e.QosThrCost=45]="QosThrCost",e[e.PacerCost=46]="PacerCost",e[e.UpRTTHalf=47]="UpRTTHalf",e[e.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",e[e.AIClientQosThrCost=49]="AIClientQosThrCost",e[e.AIClientPacerCost=50]="AIClientPacerCost",e[e.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(f||(t.ECumuDelayAVCommonKey=f={})),function(e){e[e.AIAsrCost=64]="AIAsrCost",e[e.AILlmCost=65]="AILlmCost",e[e.AITtsCost=66]="AITtsCost",e[e.AIMuteCost=67]="AIMuteCost",e[e.AIAgentTotalCost=68]="AIAgentTotalCost",e[e.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(d||(d={})),function(e){e[e.PubSdkType=100]="PubSdkType",e[e.PubSdkVersion=101]="PubSdkVersion"}(E||(t.ECumuDelayPubSdkKey=E={})),function(e){e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(_||(t.ECumuDelayGrtnKey=_={})),function(e){e[e.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",e[e.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",e[e.AIGRTNPacerCost=106]="AIGRTNPacerCost",e[e.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(y||(y={}));var p=function(e){e.msid=s.SophonAudio;var t=S[e.msid];t||console.warn("No mapped msid for cumuDelay",e.msid);var r=new ArrayBuffer(e.sendTs?8:4);if(e.sendTs){var o=Math.floor(performance.now()+performance.timeOrigin-e.windowTimeOrigin);o>=Math.pow(2,32)-1&&(o=0);var n=new DataView(r);n.setUint8(0,8),n.setUint8(1,0),n.setUint8(2,t),n.setUint8(3,5),n.setUint32(4,o)}else new Uint8Array(r).set([0,0,t,1]);e.kv[E.PubSdkType]=u.Web,e.kv[E.PubSdkVersion]=Number(C.default.version.split(".").join("").split("-")[0]);var a=Object.keys(e.kv).length;a>256&&console.warn("Too much kv");var l,A,T,d,_=1+3*a+1,y=new ArrayBuffer(_),p=new DataView(y);p.setInt8(0,a),Object.keys(e.kv).forEach((function(t,r){t in i(i(i({},c),f),E)||console.warn("Unknown CumuDelay key: ".concat(t));var o=e.kv[t],n=1+3*r;p.setUint8(n,parseInt(t)),p.setUint16(n+1,o)})),p.setUint8(_-1,128),this.buffer=(l=r,A=y,T=new ArrayBuffer(l.byteLength+A.byteLength),(d=new Uint8Array(T)).set(new Uint8Array(l),0),d.set(new Uint8Array(A),l.byteLength),T)};t.CumuDelaySeiPayload=p;var h=function(e){var t;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var r,o,n=new v(e),i=(n.readBits(3),n.readBits()),a=n.readBits(),s=n.readBits(),u=n.readBits(),l=n.readBits();n.readBits(8),n.readBits(8),n.readBits(8),1===i&&n.readBits(16);if(1===a){var C=n.readBits(32);this.pub.timestamp=C,this.pub.timestampRecv=Math.floor(performance.now())}1===s&&n.readBits(16);1===u&&(r=n.readBits(32)),1===l&&(o=n.readBits(32)),r&&o&&(this.grtn=((t={})[A.TOTAL_COST]=o-r,t[A.ENTER_GRTN_TIMESTAMP]=r,t[A.LEAVE_GRTN_TIMESTAMP]=o,t));for(var S=n.readBits(8),p=0;p<S;p++){var h=n.readBits(8),m=n.readBits(16);if(I(h,[c.VTotalCost,c.VEncPlugCost])||I(h,[T.ATotalCost,T.AEncodeCCost])||I(h,[f.NetsdkThrCost,f.UpRTTHalf])||I(h,[E.PubSdkType,E.PubSdkVersion])){var b=c[h]||T[h]||f[h]||E[h];this.pub[b]=m}else if(I(h,[T.AAIClientQuestionTimestampHEAD,T.AAIClientEncoderCost])||I(h,[f.AIClientNetsdkThrCost,f.AIClientUpRTTHalf]))b=T[h]||f[h],this.AIPub[b]=m;else if(I(h,[T.AAILinuxReceiveCost,T.AIClinetSmartDenoise]))b=T[h],this.AISub[b]=m;else if(I(h,[d.AIAsrCost,d.AIAgentExtraAvatarCost]))b=d[h],this.AIAgent[b]=m;else if(I(h,[y.AIGRTNInternalRTTHalf,y.AIGRTNDownRTTHalf])){b=y[h];for(var D=0,U="".concat(b,"_").concat(D);this.AIGrtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.AIGrtn[U]=m}else if(I(h,[_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(b=_[h],D=0,U="".concat(b,"_").concat(D);this.grtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.grtn[U]=m}else this.other[h]=m}};function I(e,t){return e>=t[0]&&e<=t[1]}t.CumuDelaySeiPayloadParser=h;var v=function(){function e(e){this.byteOffset=0,this.bitOffset=0;var t=new Uint8Array(e);this.buffer=t}return e.prototype.readBits=function(e){void 0===e&&(e=1);for(var t=0,r=0;r<e;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var o=8-this.bitOffset,n=Math.min(o,e-r);t=t<<n|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+n-1),this.bitOffset+=n,r+=n,8===this.bitOffset&&(this.byteOffset++,this.bitOffset=0)}return 32===e&&(t>>>=0),t},e.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},e.prototype.getBitsFromByte=function(e,t,r,o){if(t<0||t>=e.byteLength||r<0||o>7||r>o)throw new Error("Invalid parameters");return e[t]>>7-o&(1<<o-r+1)-1},e}()},594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readUUID=t.discardEPB=t.insertEPB=t.SODBtoRBSP=t.convertPayloadSize=t.NALU=t.SEI=t.parseSei=t.insertSei=void 0;var o=r(649);t.insertSei=function(e,t,r,o){void 0===r&&(r=5);for(var a=e.data,s=new DataView(a),u=0;;){if(1===s.getUint32(u)){s.getUint8(u+4);var l=new n(t,r,o).buffer,A=new i(l).buffer,C=new ArrayBuffer(A.byteLength+a.byteLength),c=new Uint8Array(C),T=new Uint8Array(A);c.set(T);var f=new Uint8Array(a);c.set(f,A.byteLength),e.data=C,u+=1;break}if((u+=1)+4>=s.byteLength)break}};t.parseSei=function(e){for(var r=[],o=new DataView(e),n=0;;){var i=n,s=o.getUint32(i);if(i+=4,1===s){if(6===(31&o.getUint8(i++))){for(var u=o.getUint8(i++),l=a(u)?16:0,A=0;255==o.getUint8(i);)i++,A+=255;if((A+=o.getUint8(i++))>0&&o.byteLength>i+A){var C=new Uint8Array(o.buffer),c="";if(a(u)){var T=C.slice(i,i+l);c=(0,t.readUUID)((0,t.discardEPB)(T))}var f=C.slice(i+l,i+A);i+=A,r.push({payloadType:u,uuid:c,data:f.buffer})}}n=i}else n+=1;if(n+4>=o.byteLength)break}return r};var n=function(e,r,o){void 0===r&&(r=5);var n=a(r)?16:0,i=e.byteLength+n,s=(0,t.convertPayloadSize)(i),u=s.buffer.byteLength,l=new ArrayBuffer(1+u+n+e.byteLength),A=new Uint8Array(l),C=0;if(A[C++]=r,A.set(s,C),C+=s.byteLength,a(r)){o=(o||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var c=0;c<16;c++)A[C+c]=parseInt(o.substr(2*c,2),16);C+=16}var T=new Uint8Array(e);A.set(T,C);var f=(0,t.SODBtoRBSP)(A);this.buffer=f.buffer};t.SEI=n;var i=function(e){var t=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),o=new ArrayBuffer(t.byteLength+r.byteLength+e.byteLength),n=new Uint8Array(o);n.set(t),n.set(r,t.byteLength),n.set(new Uint8Array(e),t.byteLength+r.byteLength),this.buffer=o};t.NALU=i;t.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var t=Math.ceil(e/255),r=new ArrayBuffer(t),o=new DataView(r),n=0;n<t-1;n++)o.setUint8(n,255);return o.setUint8(t-1,e%255&255),new Uint8Array(r)};t.SODBtoRBSP=function(e){for(var r=new Uint8Array(e),o="",n=0;n<r.length;n++)o+=r[n].toString(2).padStart(8,"0");for(o+="1";o.length%8!=0;)o+="0";var i=o.length/8,a=new Uint8Array(i);for(n=0;n<i;n++)a[n]=parseInt(o.slice(8*n,8*n+8),2);return(0,t.insertEPB)(a)};t.insertEPB=function(e){for(var t=[],r=0,o=0;o<e.length;o++)t.push(e[o]),0===e[o]?2===++r&&o<e.length-1&&e[o+1]<=3&&(t.push(3),r=0):r=0;return new Uint8Array(t)};t.discardEPB=function(e){for(var t=e.byteLength,r=[],o=1;o<t-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;var n=t-r.length,i=new Uint8Array(n),a=0;for(o=0;o<n;a++,o++)a===r[0]&&(a++,r.shift()),i[o]=e[a];return i};t.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var t=e.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))};var a=function(e){return 5===e||e===o.CUMU_DELAY_SEI_PAYLOAD_TYPE}},718:function(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.hebtLog=t.createUUID=t.evaluateNetworkCondition=t.makeCancelable=t.hasVideoTrack=t.hasAudioTrack=t.getVideoTrack=t.getAudioTrack=t.pruneSubUrl=t.getJitterBufferDelayAvg=void 0,t.lowercaseFirstLetter=function(e){return e.replace(/([A-Za-z])/,(function(e){return e.toLowerCase()}))},t.underlineToCamelCase=function(e){return e.replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.getJitterBufferDelayAvg=function(e,t){return e&&t?Number(e)/Number(t)*1e3:-1};t.pruneSubUrl=function(e,t){var r=e||"";return r=r.replace("@subaudio=no","").replace("@subvideo=no",""),t&&(r=r.split("?")[0]),r};t.getAudioTrack=function(e){return e.getAudioTracks()[0]};t.getVideoTrack=function(e){return e.getVideoTracks()[0]};t.hasAudioTrack=function(e){return e.getAudioTracks().length>0};t.hasVideoTrack=function(e){return e.getVideoTracks().length>0};t.makeCancelable=function(e){var t=!1;return{promise:new Promise((function(r,o){e.then((function(e){return t?o({isCanceled:!0}):r(e)})),e.catch((function(e){return o(t?{isCanceled:!0}:e)}))})),cancel:function(){t=!0}}};t.evaluateNetworkCondition=function(e,t,r,o,n){var i=0;if(!navigator.onLine)return i=6;var a=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],s=-1,u=-1,l=-1;if("number"==typeof t&&t>=0||"number"==typeof r&&r>=0){s=0;var A=!1,C=!1;"number"==typeof t&&t>=0&&(s+=t,A=!0),"number"==typeof r&&r>=0&&(s+=r,C=!0),A&&!C&&(s*=2),C&&!A&&(s*=1.8)}if("number"==typeof e&&e>=0&&(l=e),"number"==typeof o&&o>=0||"number"==typeof n&&n>=0){u=0;"number"==typeof o&&o>=0&&(u+=o),"number"==typeof n&&n>=0&&(u+=n)}var c;if((c=4*(-1!==s?1:0)+2*(-1!==l?1:0)+(-1!==u?1:0))>0){var T=1.2*s*a[c-1].loss+l/1500*a[c-1].rtt+u/3e3*a[c-1].jbd;i=T<=.1?1:T<=.23?2:T<=.36?3:T<=.49?4:5}else i=0;return i};t.createUUID=function(e,t){var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(t=t||o.length,e)for(r=0;r<e;r++)n[r]=o[0|Math.random()*t];else{var i=void 0;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(i=0|16*Math.random(),n[r]=o[19==r?3&i|8:i])}return n.join("")};t.hebtLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];window.RTS_HEBT_DEBUG&&console.log.apply(console,r(["[rts hebt]"],e,!1))}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o,n,i,a,s,u,l,A,C,c,T,f;a=r(594),s=r(718),u=r(649),l=r(917),A=self,C=!1,c=0,T=function(e,t,r,s){if(e===l.EWorkerSource.Sender){var A=new TransformStream({transform:function(e,t){var r=e;if(e.type){if(o)try{(!o.keyframeOnly||o.keyframeOnly&&"key"===e.type)&&((0,a.insertSei)(e,o.sei,o.payloadType,o.uuid),void 0===o.repeatCount?o=null:-1!==o.repeatCount&&(o.repeatCount--,o.repeatCount<0&&(o=null)))}catch(t){e=r,console.log("error in inserting user SEI",t)}else if(C)try{if("key"===e.type&&n){var i={};n.v_encode_time_avg&&(i[u.ECumuDelayVideoKey.VEncPlugCost]=Math.ceil(n.v_encode_time_avg)),n.v_packet_send_delay_avg&&(i[u.ECumuDelayAVCommonKey.PacerCost]=Math.ceil(n.v_packet_send_delay_avg)),n.rtt&&(i[u.ECumuDelayAVCommonKey.UpRTTHalf]=Math.ceil(n.rtt/2*1e3)),i[u.ECumuDelayVideoKey.VTotalCost]=Math.ceil((i[u.ECumuDelayVideoKey.VEncPlugCost]||0)+(i[u.ECumuDelayAVCommonKey.PacerCost]||0)),(0,a.insertSei)(e,new u.CumuDelaySeiPayload({msid:n.vMsid||"",kv:i,sendTs:!0,windowTimeOrigin:c}).buffer,u.CUMU_DELAY_SEI_PAYLOAD_TYPE,(0,a.readUUID)(new Uint8Array(u.CUMU_DELAY_UUID)))}}catch(t){e=r,console.log("error in inserting cumuDelay SEI",t)}r=null,s&&s(e)}t.enqueue(e)}});t.pipeThrough(A).pipeTo(r)}else e===l.EWorkerSource.Receiver&&(A=new TransformStream({transform:function(e,t){var r,o,n,a,l,A,C,c,T,f,d,E=e;if(e.type){try{if(i){var _=((r={})[u.ECumuDelaySubKey.DownRTTHalf]=Math.ceil(((null===(n=null===(o=i.video)||void 0===o?void 0:o.transportStats)||void 0===n?void 0:n.rtt)||0)/2*1e3),r[u.ECumuDelaySubKey.VAssemblyCost]=Math.ceil((null===(l=null===(a=i.video)||void 0===a?void 0:a.inboundRtpStatsPerSec)||void 0===l?void 0:l.totalAssemblyTimeAvg)||0),r[u.ECumuDelaySubKey.VJitterBufferDelay]=Math.ceil((null===(C=null===(A=i.video)||void 0===A?void 0:A.inboundRtpStatsPerSec)||void 0===C?void 0:C.jitterBufferDelayAvg)||0),r[u.ECumuDelaySubKey.VDecPlugCost]=Math.ceil((null===(T=null===(c=i.video)||void 0===c?void 0:c.inboundRtpStatsPerSec)||void 0===T?void 0:T.decodeTimeAvg)||0),r[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((null===(d=null===(f=i.video)||void 0===f?void 0:f.inboundRtpStatsPerSec)||void 0===d?void 0:d.totalProcessingDelayAvg)||0),r);_[u.ECumuDelaySubKey.VTotalCost]||(_[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((_[u.ECumuDelaySubKey.VAssemblyCost]||0)+(_[u.ECumuDelaySubKey.VJitterBufferDelay]||0)+(_[u.ECumuDelaySubKey.VDecPlugCost]||0))),e.subStats=_}}catch(t){console.log("error in parsing SEI",t),e=E}E=null,s&&s(e)}delete e.subStats,t.enqueue(e)}}),t.pipeThrough(A).pipeTo(r))},f=function(e){var t=e.data.slice(0);A.postMessage({type:"encodedFrame",data:t,frameInfo:{type:e.type,timestamp:e.timestamp},subStats:e.subStats},[t]),t=null},A.RTCTransformEvent&&(A.onrtctransform=function(e){var t=e.transformer,r=t.options.source,o=t.readable,n=t.writable;T(r,o,n,(function(e){r===l.EWorkerSource.Receiver&&f(e)}))}),onmessage=function(e){switch(e.data.operation){case l.EWorkerAction.Setup:t=e.data,r=t.source,a=t.readable,u=t.writable,T(r,a,u,(function(e){r===l.EWorkerSource.Receiver&&f(e)}));break;case l.EWorkerAction.InserSEI:!function(e){(o=e)&&(o.uuid=(0,s.createUUID)().toLowerCase(),o.repeatCount=o.repeatCount||0)}(e.data);break;case l.EWorkerAction.UpdatePubStats:!function(e){n=e.stats}(e.data);break;case l.EWorkerAction.UpdateSubStats:!function(e){i=e.stats}(e.data);break;case l.EWorkerAction.SwitchCumuDelay:!function(e){C=e.enable,c=e.windowTimeOrigin}(e.data)}var t,r,a,u}})();',"Worker",void 0,void 0)}},5512:H=>{H.exports=function(T,_,f,l){var m=self||window;try{try{var h;try{h=new m.Blob([T])}catch{(h=new(m.BlobBuilder||m.WebKitBlobBuilder||m.MozBlobBuilder||m.MSBlobBuilder)).append(T),h=h.getBlob()}var v=m.URL||m.webkitURL,u=v.createObjectURL(h),s=new m[_](u,f);return v.revokeObjectURL(u),s}catch{return new m[_]("data:application/javascript,".concat(encodeURIComponent(T)),f)}}catch{if(!l)throw Error("Inline worker is not supported");return new m[_](l,f)}}},2632:(H,T,_)=>{_.r(T),_.d(T,{default:()=>i});function f(e,o,r){Object.defineProperty(e,o,{writable:!0,enumerable:!0,configurable:!0,value:r})}Array(32);var l,m,h;class v{constructor(o){var r,a;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(r=o.time)!=null?r:10,this.count=(a=o.count)!=null?a:10,o.host.startsWith("http://")||o.host.startsWith("https://")?this.url=o.host+"/logstores/"+o.logstore+"/track":this.url="https://"+o.project+"."+o.host+"/logstores/"+o.logstore+"/track",this.opt=o,o.installUnloadHook&&typeof o.installUnloadHook=="function"&&o.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(o=this.arr){const r={__logs__:o};return this.opt.tags&&(r.__tags__=this.opt.tags),this.opt.topic&&(r.__topic__=this.opt.topic),this.opt.source&&(r.__source__=this.opt.source),JSON.stringify(r)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const o=this.assemblePayload();this.opt.sendPayload(this.url,o)}}transString(o){let r={};for(let a in o)typeof o[a]=="object"?r[a]=JSON.stringify(o[a]):r[a]=String(o[a]);return r}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const o=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){o.sendImmediateInner()},1e3*this.time)}}send(o){const r=this.transString(o);this.arr.push(r),this.sendInner()}sendImmediate(o){const r=this.transString(o);this.arr.push(r),this.sendImmediateInner()}sendBatchLogs(o){const r=o.map(a=>this.transString(a));this.arr.push(...r),this.sendInner()}sendBatchLogsImmediate(o){const r=o.map(a=>this.transString(a));this.arr.push(...r),this.sendImmediateInner()}}function u(e,o){const r=new window.XMLHttpRequest;r.open("POST",`${e}?APIVersion=0.6.0`,!0),r.send(o)}function s(e,o){try{if(o.length>=32768)return void u(e,o);(function(r,a){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${r}?APIVersion=0.6.0`,a)})(e,o)||u(e,o)}catch(r){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
163
|
-
`+r),console.error("Failed log data:",e))}}class i extends v{constructor(o){super(Object.assign({},o,{installUnloadHook:r=>{window.addEventListener("beforeunload",()=>{r()})},sendPayload:(r,a)=>{s(r,a)}}))}}l=window,m="SLS_Tracker",h=i,f(l,m,h)},4198:H=>{H.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},F={};function $(H){var T=F[H];if(T!==void 0)return T.exports;var _=F[H]={exports:{}};return B[H].call(_.exports,_,_.exports,$),_.exports}return $.n=H=>{var T=H&&H.__esModule?()=>H.default:()=>H;return $.d(T,{a:T}),T},$.d=(H,T)=>{for(var _ in T)$.o(T,_)&&!$.o(H,_)&&Object.defineProperty(H,_,{enumerable:!0,get:T[_]})},$.o=(H,T)=>Object.prototype.hasOwnProperty.call(H,T),$.r=H=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},$(8156)})())})(Vr);for(var jn=Vr.exports,Le=[],Gt=0;Gt<256;++Gt)Le.push((Gt+256).toString(16).slice(1));function Wn(Y,L=0){return(Le[Y[L+0]]+Le[Y[L+1]]+Le[Y[L+2]]+Le[Y[L+3]]+"-"+Le[Y[L+4]]+Le[Y[L+5]]+"-"+Le[Y[L+6]]+Le[Y[L+7]]+"-"+Le[Y[L+8]]+Le[Y[L+9]]+"-"+Le[Y[L+10]]+Le[Y[L+11]]+Le[Y[L+12]]+Le[Y[L+13]]+Le[Y[L+14]]+Le[Y[L+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:Yn};function ot(Y,L,B){if(Hr.randomUUID&&!L&&!Y)return Hr.randomUUID();Y=Y||{};var F=Y.random||(Y.rng||zn)();return F[6]=F[6]&15|64,F[8]=F[8]&63|128,Wn(F)}var qn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(Y,L,B,F){if(arguments.length===1&&typeof Y=="string"&&!/\d/.test(Y)&&(L=Y,Y=void 0),Y=Y||Y===0?Y:new Date,Y instanceof Date||(Y=new Date(Y)),isNaN(Y))throw TypeError("Invalid date");L=String(jr[L]||L||jr.default);var $=L.slice(0,4);($==="UTC:"||$==="GMT:")&&(L=L.slice(4),B=!0,$==="GMT:"&&(F=!0));var H=function(){return B?"getUTC":"get"},T=function(){return Y[H()+"Date"]()},_=function(){return Y[H()+"Day"]()},f=function(){return Y[H()+"Month"]()},l=function(){return Y[H()+"FullYear"]()},m=function(){return Y[H()+"Hours"]()},h=function(){return Y[H()+"Minutes"]()},v=function(){return Y[H()+"Seconds"]()},u=function(){return Y[H()+"Milliseconds"]()},s=function(){return B?0:Y.getTimezoneOffset()},i=function(){return Qn(Y)},e=function(){return $n(Y)},o={d:function(){return T()},dd:function(){return je(T())},ddd:function(){return Ve.dayNames[_()]},DDD:function(){return Wr({y:l(),m:f(),d:T(),_:H(),dayName:Ve.dayNames[_()],short:!0})},dddd:function(){return Ve.dayNames[_()+7]},DDDD:function(){return Wr({y:l(),m:f(),d:T(),_:H(),dayName:Ve.dayNames[_()+7]})},m:function(){return f()+1},mm:function(){return je(f()+1)},mmm:function(){return Ve.monthNames[f()]},mmmm:function(){return Ve.monthNames[f()+12]},yy:function(){return String(l()).slice(2)},yyyy:function(){return je(l(),4)},h:function(){return m()%12||12},hh:function(){return je(m()%12||12)},H:function(){return m()},HH:function(){return je(m())},M:function(){return h()},MM:function(){return je(h())},s:function(){return v()},ss:function(){return je(v())},l:function(){return je(u(),3)},L:function(){return je(Math.floor(u()/10))},t:function(){return m()<12?Ve.timeNames[0]:Ve.timeNames[1]},tt:function(){return m()<12?Ve.timeNames[2]:Ve.timeNames[3]},T:function(){return m()<12?Ve.timeNames[4]:Ve.timeNames[5]},TT:function(){return m()<12?Ve.timeNames[6]:Ve.timeNames[7]},Z:function(){return F?"GMT":B?"UTC":Jn(Y)},o:function(){return(s()>0?"-":"+")+je(Math.floor(Math.abs(s())/60)*100+Math.abs(s())%60,4)},p:function(){return(s()>0?"-":"+")+je(Math.floor(Math.abs(s())/60),2)+":"+je(Math.floor(Math.abs(s())%60),2)},S:function(){return["th","st","nd","rd"][T()%10>3?0:(T()%100-T()%10!=10)*T()%10]},W:function(){return i()},WW:function(){return je(i())},N:function(){return e()}};return L.replace(qn,function(r){return r in o?o[r]():r.slice(1,r.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ve={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},je=function(L){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(L).padStart(B,"0")},Wr=function(L){var B=L.y,F=L.m,$=L.d,H=L._,T=L.dayName,_=L.short,f=_===void 0?!1:_,l=new Date,m=new Date;m.setDate(m[H+"Date"]()-1);var h=new Date;h.setDate(h[H+"Date"]()+1);var v=function(){return l[H+"Date"]()},u=function(){return l[H+"Month"]()},s=function(){return l[H+"FullYear"]()},i=function(){return m[H+"Date"]()},e=function(){return m[H+"Month"]()},o=function(){return m[H+"FullYear"]()},r=function(){return h[H+"Date"]()},a=function(){return h[H+"Month"]()},t=function(){return h[H+"FullYear"]()};return s()===B&&u()===F&&v()===$?f?"Tdy":"Today":o()===B&&e()===F&&i()===$?f?"Ysd":"Yesterday":t()===B&&a()===F&&r()===$?f?"Tmw":"Tomorrow":T},Qn=function(L){var B=new Date(L.getFullYear(),L.getMonth(),L.getDate());B.setDate(B.getDate()-(B.getDay()+6)%7+3);var F=new Date(B.getFullYear(),0,4);F.setDate(F.getDate()-(F.getDay()+6)%7+3);var $=B.getTimezoneOffset()-F.getTimezoneOffset();B.setHours(B.getHours()-$);var H=(B-F)/(864e5*7);return 1+Math.floor(H)},$n=function(L){var B=L.getDay();return B===0&&(B=7),B},Jn=function(L){return(String(L).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},Yt;(function(Y){Y.prod="rs.rtn.aliyuncs.com",Y.pre="prs.rtn.aliyuncs.com"})(Yt||(Yt={}));var Gr;(function(Y){Y[Y.ByClient=0]="ByClient",Y[Y.KickOut=1]="KickOut",Y[Y.ChannelClosed=2]="ChannelClosed",Y[Y.Restore=3]="Restore",Y[Y.Expired=4]="Expired",Y[Y.Reconnect=5]="Reconnect",Y[Y.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.7";class Kt{static getVersionNumber(){let L=zr.split("."),B="";return L.forEach(F=>{F.length===1?B+="0"+F:B+=F}),parseInt(B)}static queryingParam(L){let B=[];if(L)for(let F in L)B.push(F+"="+L[F]);return B.join("&")}static getQueryParams(L){const B=window.location.search.substring(1).split("&");for(let F=0;F<B.length;F++){const $=B[F].split("=");if(decodeURIComponent($[0])===L)return decodeURIComponent($[1])}}static createCallid(L=""){const B=ot();return L&&B&&B.length>L.length?`${L}${B.substring(L.length)}`:B}static checkSubOptionsValid(L){if(L){const{audio:B,video:F,screen:$}=L;if(B===!1&&F===!1&&$===!1)return!1}return!0}static async isNetworkAvailable(){const L=Yt.prod,{onLine:B}=navigator;if(!B)return!1;try{return await fetch(`https://${L}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(L){let B;if(L instanceof Error)B=L.message;else if(typeof L=="string")B=L;else try{B=JSON.stringify(L)}catch{B="undefined"}return B}static paramArrayToString(L){let B="";for(let F=0;F<L.length;F++){B!==""&&(B+=" ");let $=Kt.toString(L[F]);B+=$}return B}}const Zn=(Y,L)=>Y.find(B=>{if(typeof B.test=="function")return B.test(L);if(Array.isArray(B.test))return B.test.some(F=>typeof F=="string"?L.indexOf(F)>-1:F instanceof RegExp?F.test(L):!1)}),eo=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],to=()=>{let Y="unknown";try{const L=navigator.userAgent||"",B=Zn(eo,L);if(!B)return Y;Y=B.describe(L)}catch{}return Y};var ro=Object.defineProperty,no=(Y,L,B)=>L in Y?ro(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,we=(Y,L,B)=>no(Y,typeof L!="symbol"?L+"":L,B);const{BrowserUtil:Yr,SystenUtil:qr}=jn.AliRTS,oo=to(),io="woMMssV6jmyol9fr",ao=200,it=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function qt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var He;(function(Y){Y[Y.DEBUG=0]="DEBUG",Y[Y.INFO=1]="INFO",Y[Y.API=2]="API",Y[Y.WARNING=3]="WARNING",Y[Y.ERROR=4]="ERROR",Y[Y.NONE=5]="NONE"})(He||(He={}));var Ke;(function(Y){Y[Y.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",Y[Y.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",Y[Y.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class so{constructor(){we(this,"tracker"),we(this,"slsPlugin"),we(this,"stsData"),we(this,"stsExpiration",Date.now()),we(this,"clientId",ot()),we(this,"bSesid",ot()),we(this,"logLevel",He.WARNING),we(this,"appId",""),we(this,"sessionId",""),we(this,"logCache",[]),we(this,"updateTaskTimer"),we(this,"endReported",!0),we(this,"logSequence",0),we(this,"sendLogBeforeUnload",async L=>{if(!this.slsPlugin)return;this.logSequence+=1,L.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${qt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const B=`https://${at.project}.${at.host}/logstores/${at.logstore}`,F={__logs__:L.map(T=>this.slsPlugin.transString(T))},{data:$,header:H}=await this.slsPlugin.process(B,JSON.stringify(F));fetch(B,{keepalive:!0,method:"POST",headers:H,body:$})}),we(this,"logMethod",(L,B=console.log)=>(...F)=>{let $=qt();this.logLevel<=L&&B($,...F);let H=Kt.paramArrayToString(F);L>He.DEBUG&&this.addLog(H)}),we(this,"d",this.logMethod(He.DEBUG,console.debug)),we(this,"i",this.logMethod(He.INFO)),we(this,"w",this.logMethod(He.WARNING,console.warn)),we(this,"e",this.logMethod(He.ERROR,(...L)=>{const[B,...F]=L;console.error(B,"<error>",F)})),we(this,"ev",this.logMethod(He.API)),we(this,"a",this.logMethod(He.API,(...L)=>{const[B,...F]=L;if(F.length>2){const $=`${F[1]}`;$.startsWith("__g__")&&console.group(`${$.substring(5)}_${F[2]}`)}console.log(B,...F)})),we(this,"ar",this.logMethod(He.API,(...L)=>{const[B,...F]=L;console.log(B,...F),F.length>2&&`${F[1]}`.startsWith("__g__")&&console.groupEnd()})),we(this,"ae",this.logMethod(He.API,(...L)=>{const[B,...F]=L;console.error(B,"<error>",...F),F.length>2&&`${F[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=ot(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const L=await this.refreshSTSToken();this.createTracker(L)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const L=await this.requestSTSToken(),B=new Date(L?.Expiration).getTime()||0,F=Date.now()+it;this.stsExpiration=Math.max(B,F),this.stsData=L}return this.stsData}requestSTSToken(){const L=Date.now(),B=`${this.clientId}|${io}|${L}`,F={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(B).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${L}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(L,"isoUtcDateTime")},$=`https://slsrole.alicdn.com/?${new URLSearchParams(F).toString()}`;return fetch($).then(H=>H.json()).then(H=>JSON.parse(window.atob(H.SlsAuthResult)))}createTracker(L){if(!this.tracker){const B={accessKeyId:L.AccessKeyId,accessKeySecret:L.AccessKeySecret,securityToken:L.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(H=>{B.accessKeyId=H.AccessKeyId,B.accessKeySecret=H.AccessKeySecret,B.securityToken=H.SecurityToken}).catch(()=>{})}},F=new er(at),$=Fr(B);F.useStsPlugin($),this.slsPlugin=$,this.tracker=F,this.reportStartAndCache()}}changeConfig(L){L.logLevel!==void 0&&L.logLevel>=He.DEBUG&&L.logLevel<=He.NONE&&(this.logLevel=L.logLevel)}setSessionID(L,B){!L||!B||(this.appId=L,this.sessionId=B,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const L={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},B=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,L),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,L)];this.tracker.sendBatchLogsImmediate(B),this.logCache.forEach(F=>{this.sendLog(F)})}reportEnd(L=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const B={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},F=[this.getLogParams(Ke.SESSION_UPLOAD_END,B),this.getLogParams(Ke.TASK_UPLOAD_END,B)];L?this.sendLogBeforeUnload(F):(this.tracker.sendBatchLogsImmediate(F),this.endReported=!0),this.reset()}getLogParams(L,B){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:oo,db:Yr.browserName,dm:Yr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:qr.systemName,osv:qr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:L,...B||{}}}sendLog(L){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const B=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:L,stat_log_seq:this.logSequence});this.tracker.send(B)}addLog(L){const B=qt(),F=`[${Kr()} ${B}] ${L}`;!this.sessionId||!this.tracker?(this.logCache.push(F),this.logCache.length>=ao&&this.logCache.shift()):this.sendLog(F)}}var co=Object.defineProperty,uo=(Y,L,B)=>L in Y?co(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,lo=(Y,L,B)=>uo(Y,L+"",B);class Ze{static getLogger(){return this.logger||(this.logger=new so),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(L){this.getLogger().changeConfig({logLevel:L})}static setSessionID(L,B){this.getLogger().setSessionID(L,B)}static reportEnd(){this.getLogger().reportEnd()}static interface(...L){this.getLogger().a("[API]",...L)}static interfaceResult(L,B,F,...$){F?this.getLogger().ar("[ARE]",L,B,...$):this.getLogger().ae("[ARE]",L,B,...$)}static event(...L){this.getLogger().ev("[EVT]",...L)}static debug(...L){this.getLogger().d("[DBG]",...L)}static info(...L){this.getLogger().i("[INF]",...L)}static warn(...L){this.getLogger().w("[WARN]",...L)}static error(...L){this.getLogger().e("[ERR]",...L)}}lo(Ze,"logger");var po=Object.defineProperty,fo=(Y,L,B)=>L in Y?po(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,Xe=(Y,L,B)=>fo(Y,typeof L!="symbol"?L+"":L,B);const Xr=48e3,tt="[AliyunAudio3A] ";class ho extends $r{constructor(L){super("AliRtcAudioProcessPlugin",Jr.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",B=>this.audioContext.createMediaStreamSource(new MediaStream([B]))),this.options=L,this.slsReporter=L?.slsReporter,this.enableSoft3ACheck=L?.enableSoft3ACheck||!1,this.useHardOnly=L?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(L){return this.lastInputAudioTrack?.id!==L.currentAudioTrack?.id}videoUpdated(L){return console.log("videoUpdated",L),!1}setOptions(L){this.farNode||!L.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(L.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...L})}isSupported(){return $t.isSupported()}shouldUpdate(L){return!!(L.originAudioTrack&&!this.audioProcessor||!L.originAudioTrack&&this.audioProcessor)}async process(L){if(!L.currentAudioTrack){L.updateAudioTrack(),this.clear(L);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new $t({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(F,$)=>{let H=3e3;$.includes("far")?H=5e3:$.includes("output")?H=1e4:$.includes("meta")&&(H=8e3),setTimeout(()=>{const T=URL.createObjectURL(F),_=document.createElement("a");_.href=T,_.download=$,document.body.appendChild(_),_.click(),document.body.removeChild(_)},H)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||L.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",F=>{Ze.error(tt,"loaderror:",F?.message),this.emit("error",F)}),this.audioProcessor.on("outputlog",F=>{Ze.info(tt,"outputlog:",F),F?.includes("diff")&&(this.lastDiffOutputLog=F||"")}),this.audioProcessor.on("statdata",F=>{if(F)try{let $=F;if(this.lastDiffOutputLog){const H=this.extractDiffValue(this.lastDiffOutputLog),T=JSON.parse(F);H!==null&&(T.diff=H);const _=this.extractLeakValue(this.lastDiffOutputLog);_!==null&&(T.leak=_),$=JSON.stringify(T)}this.slsReporter?.reportPublishAudio3A("","","",$)}catch($){Ze.error(tt,"statdata error:",$)}});const B=this.createNode(L.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,B,1,Xr,this.farNode)}}extractDiffValue(L){if(!L)return null;const B=L.match(/diff\s*=\s*(-?\d+\.?\d*)/);return B?parseFloat(B[1]):null}extractLeakValue(L){if(!L)return null;const B=L.match(/leak\s*=\s*(-?\d+\.?\d*)/);return B?parseFloat(B[1]):null}clear(L){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(L),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{ho as default};
|
|
162
|
+
`);I.RTCSessionDescription&&Q instanceof I.RTCSessionDescription?arguments[0]=new I.RTCSessionDescription({type:Q.type,sdp:Z}):Q.sdp=Z}return q.apply(this,arguments)}}function ke(I,K){if(!I.RTCPeerConnection||!I.RTCPeerConnection.prototype)return;const q=I.RTCPeerConnection.prototype.addIceCandidate;q&&q.length!==0&&(I.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():q.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const Ue=function({window:I}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const q=a,Q=function(ee){const J={browser:null,version:null};if(ee===void 0||!ee.navigator)return J.browser="Not a browser.",J;const{navigator:ie}=ee;if(ie.mozGetUserMedia)J.browser="firefox",J.version=i(ie.userAgent,/Firefox\/(\d+)\./,1);else if(ie.webkitGetUserMedia||ee.isSecureContext===!1&&ee.webkitRTCPeerConnection&&!ee.RTCIceGatherer)J.browser="chrome",J.version=i(ie.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(ie.mediaDevices&&ie.userAgent.match(/Edge\/(\d+).(\d+)$/))J.browser="edge",J.version=i(ie.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!ee.RTCPeerConnection||!ie.userAgent.match(/AppleWebKit\/(\d+)\./))return J.browser="Not a supported browser.",J;J.browser="safari",J.version=i(ie.userAgent,/AppleWebKit\/(\d+)\./,1),J.supportsUnifiedPlan=ee.RTCRtpTransceiver&&"currentDirection"in ee.RTCRtpTransceiver.prototype}return J}(I),Z={browserDetails:Q,commonShim:v,extractVersion:i,disableLog:o,disableWarnings:r};switch(Q.browser){case"chrome":if(!f||!O||!K.shimChrome)return q("Chrome shim is not included in this adapter release."),Z;if(Q.version===null)return q("Chrome shim can not determine version, not shimming."),Z;q("adapter.js shimming chrome."),Z.browserShim=f,ke(I,Q),y(I,Q),S(I),O(I,Q),d(I),g(I,Q),R(I),D(I),A(I),k(I,Q),Ae(I),Me(I),_e(I,Q),xe(I),Ie(I,Q);break;case"firefox":if(!m||!G||!K.shimFirefox)return q("Firefox shim is not included in this adapter release."),Z;q("adapter.js shimming firefox."),Z.browserShim=m,ke(I,Q),V(I,Q),G(I,Q),z(I),te(I),X(I),re(I),oe(I),ue(I),se(I),ce(I),de(I),Ae(I),Me(I),_e(I,Q),xe(I);break;case"edge":if(!l||!N||!K.shimEdge)return q("MS edge shim is not included in this adapter release."),Z;q("adapter.js shimming edge."),Z.browserShim=l,W(I),M(I),N(I,Q),P(I),_e(I,Q),xe(I);break;case"safari":if(!h||!K.shimSafari)return q("Safari shim is not included in this adapter release."),Z;q("adapter.js shimming safari."),Z.browserShim=h,ke(I,Q),ge(I),Re(I),Ee(I),pe(I),he(I),be(I),fe(I),Te(I),Ae(I),_e(I,Q),xe(I),Ie(I,Q);break;default:q("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),De=Ue},6834:(H,T,_)=>{_.r(T),_.d(T,{default:()=>m});var f=_(5512),l=_.n(f);function m(){return l()('/*! aliyun rts sdk - ver2.13.3 created:2025/10/21 10:50:31 */(()=>{"use strict";var e={28:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default={version:"2.13.3",protocol_version:2,sdk_version:"0.0.1"}},917:(e,t)=>{var r,o,n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=t.DEFAULT_HEARTBEAT_TIMEOUT=t.DEFAULT_RETRY_PUBLISH_INTERVAL=t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=t.DEFAULT_RETRY_PUBLISH_LIMIT=t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=t.EWorkerAction=t.EWorkerSource=t.EConnectStatus=t.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(r||(t.TrackType=r={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(o||(t.EConnectStatus=o={})),function(e){e.Sender="sender",e.Receiver="receiver"}(n||(t.EWorkerSource=n={})),function(e){e.Setup="setup",e.InserSEI="insertSEI",e.UpdatePubStats="updatePubStats",e.UpdateSubStats="updateSubStats",e.SwitchCumuDelay="switchCumuDelay"}(i||(t.EWorkerAction=i={})),t.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,t.DEFAULT_RETRY_PUBLISH_LIMIT=5,t.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,t.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,t.DEFAULT_HEARTBEAT_TIMEOUT=8,t.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},649:function(e,t,r){var o,n,i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CumuDelaySeiPayloadParser=t.CumuDelaySeiPayload=t.ECumuDelayGrtnKey=t.ECumuDelayPubSdkKey=t.ECumuDelayAVCommonKey=t.ECumuDelayVideoKey=t.ECumuDelayGrtnExportKey=t.ECumuDelaySubKey=t.CUMU_DELAY_UUID=t.CUMU_DELAY_SEI_PAYLOAD_TYPE=void 0;var s,u,l,A,C=a(r(28));t.CUMU_DELAY_SEI_PAYLOAD_TYPE=99,t.CUMU_DELAY_UUID=[32,36,16,9,16,23,7,1,150,117,25,212,25,129,3,7],function(e){e.SophonAudioDual="sophon_audio_dual",e.SophonVideoCamera="sophon_video_camera",e.SophonVideoCameraSmall="sophon_video_camera_small",e.SophonVideoCameraSuper="sophon_video_camera_super",e.SophonVideoScreenShare="sophon_video_screen_share",e.SophonAudio="sophon_audio",e.SophonVideoCameraLarge="sophon_video_camera_large",e.RtsAudio="rts audio",e.RtsVideo="rts video"}(s||(s={})),function(e){e[e.Web=0]="Web",e[e.iOS=1]="iOS",e[e.Android=2]="Android"}(u||(u={})),function(e){e.VTotalCost="VTotalCost",e.VAssemblyCost="VAssemblyCost",e.VJitterBufferDelay="VJitterBufferDelay",e.VDecPlugCost="VDecPlugCost",e.DownRTTHalf="DownRTTHalf"}(l||(t.ECumuDelaySubKey=l={})),function(e){e.TOTAL_COST="TOTAL_COST",e.ENTER_GRTN_TIMESTAMP="ENTER_GRTN_TIMESTAMP",e.LEAVE_GRTN_TIMESTAMP="LEAVE_GRTN_TIMESTAMP"}(A||(t.ECumuDelayGrtnExportKey=A={}));var c,T,f,d,E,_,y,S=((o={})[s.SophonAudioDual]=4,o[s.SophonVideoCamera]=5,o[s.SophonVideoCameraSmall]=6,o[s.SophonVideoCameraSuper]=7,o[s.SophonVideoScreenShare]=8,o[s.SophonAudio]=9,o[s.SophonVideoCameraLarge]=10,o[s.RtsAudio]=11,o[s.RtsVideo]=12,o);(n={})[S[s.SophonAudioDual]]=s.SophonAudioDual,n[S[s.SophonVideoCamera]]=s.SophonVideoCamera,n[S[s.SophonVideoCameraSmall]]=s.SophonVideoCameraSmall,n[S[s.SophonVideoCameraSuper]]=s.SophonVideoCameraSuper,n[S[s.SophonVideoScreenShare]]=s.SophonVideoScreenShare,n[S[s.SophonAudio]]=s.SophonAudio,n[S[s.SophonVideoCameraLarge]]=s.SophonVideoCameraLarge,n[S[s.RtsAudio]]=s.RtsAudio,n[S[s.RtsVideo]]=s.RtsVideo;!function(e){e[e.VTotalCost=4]="VTotalCost",e[e.CapDeviceCost=5]="CapDeviceCost",e[e.PushExtCost=6]="PushExtCost",e[e.CapPlugCost=7]="CapPlugCost",e[e.PrepThrCost=8]="PrepThrCost",e[e.PrepPlugCost=9]="PrepPlugCost",e[e.DispThrCost=10]="DispThrCost",e[e.DispPlugCost=11]="DispPlugCost",e[e.VEncThrCost=12]="VEncThrCost",e[e.VEncPlugCost=13]="VEncPlugCost"}(c||(t.ECumuDelayVideoKey=c={})),function(e){e[e.ATotalCost=24]="ATotalCost",e[e.ASourceCCost=25]="ASourceCCost",e[e.AMixerCost=26]="AMixerCost",e[e.AEncodeCCost=27]="AEncodeCCost",e[e.AAIClientQuestionTimestampHEAD=28]="AAIClientQuestionTimestampHEAD",e[e.AAIClientQuestionTimestampTAIL=29]="AAIClientQuestionTimestampTAIL",e[e.AAIClientAnswerTimestampHEAD=30]="AAIClientAnswerTimestampHEAD",e[e.AAIClientAnswerTimestampTAIL=31]="AAIClientAnswerTimestampTAIL",e[e.AAIClientScentenceId=32]="AAIClientScentenceId",e[e.AAIClientSourceCost=33]="AAIClientSourceCost",e[e.AAIClientMixerCost=34]="AAIClientMixerCost",e[e.AAIClientEncoderCost=35]="AAIClientEncoderCost",e[e.AAILinuxReceiveCost=36]="AAILinuxReceiveCost",e[e.AAILinuxNeteqCost=37]="AAILinuxNeteqCost",e[e.AAILinuxRemoteSourceCost=38]="AAILinuxRemoteSourceCost",e[e.AAILinuxPlayMixerCost=39]="AAILinuxPlayMixerCost",e[e.AAILinuxPlayCost=40]="AAILinuxPlayCost",e[e.AAIClientQuestionUidDigestHEAD=41]="AAIClientQuestionUidDigestHEAD",e[e.AAIClientQuestionUidDigestTAIL=42]="AAIClientQuestionUidDigestTAIL",e[e.AIClinetSmartDenoise=43]="AIClinetSmartDenoise"}(T||(T={})),function(e){e[e.NetsdkThrCost=44]="NetsdkThrCost",e[e.QosThrCost=45]="QosThrCost",e[e.PacerCost=46]="PacerCost",e[e.UpRTTHalf=47]="UpRTTHalf",e[e.AIClientNetsdkThrCost=48]="AIClientNetsdkThrCost",e[e.AIClientQosThrCost=49]="AIClientQosThrCost",e[e.AIClientPacerCost=50]="AIClientPacerCost",e[e.AIClientUpRTTHalf=51]="AIClientUpRTTHalf"}(f||(t.ECumuDelayAVCommonKey=f={})),function(e){e[e.AIAsrCost=64]="AIAsrCost",e[e.AILlmCost=65]="AILlmCost",e[e.AITtsCost=66]="AITtsCost",e[e.AIMuteCost=67]="AIMuteCost",e[e.AIAgentTotalCost=68]="AIAgentTotalCost",e[e.AIAgentExtraAvatarCost=69]="AIAgentExtraAvatarCost"}(d||(d={})),function(e){e[e.PubSdkType=100]="PubSdkType",e[e.PubSdkVersion=101]="PubSdkVersion"}(E||(t.ECumuDelayPubSdkKey=E={})),function(e){e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF=121]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER=122]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_BEF_PACER",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST=123]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_GRTN_NODE_PACER_COST",e[e.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF=124]="NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF"}(_||(t.ECumuDelayGrtnKey=_={})),function(e){e[e.AIGRTNInternalRTTHalf=104]="AIGRTNInternalRTTHalf",e[e.AIGRTNBeforePacer=105]="AIGRTNBeforePacer",e[e.AIGRTNPacerCost=106]="AIGRTNPacerCost",e[e.AIGRTNDownRTTHalf=107]="AIGRTNDownRTTHalf"}(y||(y={}));var p=function(e){e.msid=s.SophonAudio;var t=S[e.msid];t||console.warn("No mapped msid for cumuDelay",e.msid);var r=new ArrayBuffer(e.sendTs?8:4);if(e.sendTs){var o=Math.floor(performance.now()+performance.timeOrigin-e.windowTimeOrigin);o>=Math.pow(2,32)-1&&(o=0);var n=new DataView(r);n.setUint8(0,8),n.setUint8(1,0),n.setUint8(2,t),n.setUint8(3,5),n.setUint32(4,o)}else new Uint8Array(r).set([0,0,t,1]);e.kv[E.PubSdkType]=u.Web,e.kv[E.PubSdkVersion]=Number(C.default.version.split(".").join("").split("-")[0]);var a=Object.keys(e.kv).length;a>256&&console.warn("Too much kv");var l,A,T,d,_=1+3*a+1,y=new ArrayBuffer(_),p=new DataView(y);p.setInt8(0,a),Object.keys(e.kv).forEach((function(t,r){t in i(i(i({},c),f),E)||console.warn("Unknown CumuDelay key: ".concat(t));var o=e.kv[t],n=1+3*r;p.setUint8(n,parseInt(t)),p.setUint16(n+1,o)})),p.setUint8(_-1,128),this.buffer=(l=r,A=y,T=new ArrayBuffer(l.byteLength+A.byteLength),(d=new Uint8Array(T)).set(new Uint8Array(l),0),d.set(new Uint8Array(A),l.byteLength),T)};t.CumuDelaySeiPayload=p;var h=function(e){var t;this.pub={},this.grtn={},this.AIPub={},this.AISub={},this.AIAgent={},this.AIGrtn={},this.other={};var r,o,n=new v(e),i=(n.readBits(3),n.readBits()),a=n.readBits(),s=n.readBits(),u=n.readBits(),l=n.readBits();n.readBits(8),n.readBits(8),n.readBits(8),1===i&&n.readBits(16);if(1===a){var C=n.readBits(32);this.pub.timestamp=C,this.pub.timestampRecv=Math.floor(performance.now())}1===s&&n.readBits(16);1===u&&(r=n.readBits(32)),1===l&&(o=n.readBits(32)),r&&o&&(this.grtn=((t={})[A.TOTAL_COST]=o-r,t[A.ENTER_GRTN_TIMESTAMP]=r,t[A.LEAVE_GRTN_TIMESTAMP]=o,t));for(var S=n.readBits(8),p=0;p<S;p++){var h=n.readBits(8),m=n.readBits(16);if(I(h,[c.VTotalCost,c.VEncPlugCost])||I(h,[T.ATotalCost,T.AEncodeCCost])||I(h,[f.NetsdkThrCost,f.UpRTTHalf])||I(h,[E.PubSdkType,E.PubSdkVersion])){var b=c[h]||T[h]||f[h]||E[h];this.pub[b]=m}else if(I(h,[T.AAIClientQuestionTimestampHEAD,T.AAIClientEncoderCost])||I(h,[f.AIClientNetsdkThrCost,f.AIClientUpRTTHalf]))b=T[h]||f[h],this.AIPub[b]=m;else if(I(h,[T.AAILinuxReceiveCost,T.AIClinetSmartDenoise]))b=T[h],this.AISub[b]=m;else if(I(h,[d.AIAsrCost,d.AIAgentExtraAvatarCost]))b=d[h],this.AIAgent[b]=m;else if(I(h,[y.AIGRTNInternalRTTHalf,y.AIGRTNDownRTTHalf])){b=y[h];for(var D=0,U="".concat(b,"_").concat(D);this.AIGrtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.AIGrtn[U]=m}else if(I(h,[_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_INTERNAL_RTT_HALF,_.NGX_RTC_SEI_CUMULATIVE_DELAY_KEY_DOWN_RTT_HALF])){for(b=_[h],D=0,U="".concat(b,"_").concat(D);this.grtn.hasOwnProperty(U);)U="".concat(b,"_").concat(D++);this.grtn[U]=m}else this.other[h]=m}};function I(e,t){return e>=t[0]&&e<=t[1]}t.CumuDelaySeiPayloadParser=h;var v=function(){function e(e){this.byteOffset=0,this.bitOffset=0;var t=new Uint8Array(e);this.buffer=t}return e.prototype.readBits=function(e){void 0===e&&(e=1);for(var t=0,r=0;r<e;){if(this.byteOffset>=this.buffer.byteLength)throw new Error("readBits out of range");var o=8-this.bitOffset,n=Math.min(o,e-r);t=t<<n|this.getBitsFromByte(this.buffer,this.byteOffset,this.bitOffset,this.bitOffset+n-1),this.bitOffset+=n,r+=n,8===this.bitOffset&&(this.byteOffset++,this.bitOffset=0)}return 32===e&&(t>>>=0),t},e.prototype.hasNext=function(){return this.byteOffset<this.buffer.byteLength},e.prototype.getBitsFromByte=function(e,t,r,o){if(t<0||t>=e.byteLength||r<0||o>7||r>o)throw new Error("Invalid parameters");return e[t]>>7-o&(1<<o-r+1)-1},e}()},594:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readUUID=t.discardEPB=t.insertEPB=t.SODBtoRBSP=t.convertPayloadSize=t.NALU=t.SEI=t.parseSei=t.insertSei=void 0;var o=r(649);t.insertSei=function(e,t,r,o){void 0===r&&(r=5);for(var a=e.data,s=new DataView(a),u=0;;){if(1===s.getUint32(u)){s.getUint8(u+4);var l=new n(t,r,o).buffer,A=new i(l).buffer,C=new ArrayBuffer(A.byteLength+a.byteLength),c=new Uint8Array(C),T=new Uint8Array(A);c.set(T);var f=new Uint8Array(a);c.set(f,A.byteLength),e.data=C,u+=1;break}if((u+=1)+4>=s.byteLength)break}};t.parseSei=function(e){for(var r=[],o=new DataView(e),n=0;;){var i=n,s=o.getUint32(i);if(i+=4,1===s){if(6===(31&o.getUint8(i++))){for(var u=o.getUint8(i++),l=a(u)?16:0,A=0;255==o.getUint8(i);)i++,A+=255;if((A+=o.getUint8(i++))>0&&o.byteLength>i+A){var C=new Uint8Array(o.buffer),c="";if(a(u)){var T=C.slice(i,i+l);c=(0,t.readUUID)((0,t.discardEPB)(T))}var f=C.slice(i+l,i+A);i+=A,r.push({payloadType:u,uuid:c,data:f.buffer})}}n=i}else n+=1;if(n+4>=o.byteLength)break}return r};var n=function(e,r,o){void 0===r&&(r=5);var n=a(r)?16:0,i=e.byteLength+n,s=(0,t.convertPayloadSize)(i),u=s.buffer.byteLength,l=new ArrayBuffer(1+u+n+e.byteLength),A=new Uint8Array(l),C=0;if(A[C++]=r,A.set(s,C),C+=s.byteLength,a(r)){o=(o||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var c=0;c<16;c++)A[C+c]=parseInt(o.substr(2*c,2),16);C+=16}var T=new Uint8Array(e);A.set(T,C);var f=(0,t.SODBtoRBSP)(A);this.buffer=f.buffer};t.SEI=n;var i=function(e){var t=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),o=new ArrayBuffer(t.byteLength+r.byteLength+e.byteLength),n=new Uint8Array(o);n.set(t),n.set(r,t.byteLength),n.set(new Uint8Array(e),t.byteLength+r.byteLength),this.buffer=o};t.NALU=i;t.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var t=Math.ceil(e/255),r=new ArrayBuffer(t),o=new DataView(r),n=0;n<t-1;n++)o.setUint8(n,255);return o.setUint8(t-1,e%255&255),new Uint8Array(r)};t.SODBtoRBSP=function(e){for(var r=new Uint8Array(e),o="",n=0;n<r.length;n++)o+=r[n].toString(2).padStart(8,"0");for(o+="1";o.length%8!=0;)o+="0";var i=o.length/8,a=new Uint8Array(i);for(n=0;n<i;n++)a[n]=parseInt(o.slice(8*n,8*n+8),2);return(0,t.insertEPB)(a)};t.insertEPB=function(e){for(var t=[],r=0,o=0;o<e.length;o++)t.push(e[o]),0===e[o]?2===++r&&o<e.length-1&&e[o+1]<=3&&(t.push(3),r=0):r=0;return new Uint8Array(t)};t.discardEPB=function(e){for(var t=e.byteLength,r=[],o=1;o<t-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;var n=t-r.length,i=new Uint8Array(n),a=0;for(o=0;o<n;a++,o++)a===r[0]&&(a++,r.shift()),i[o]=e[a];return i};t.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var t=e.reduce((function(e,t){return e+t.toString(16).padStart(2,"0")}),"");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))};var a=function(e){return 5===e||e===o.CUMU_DELAY_SEI_PAYLOAD_TYPE}},718:function(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.hebtLog=t.createUUID=t.evaluateNetworkCondition=t.makeCancelable=t.hasVideoTrack=t.hasAudioTrack=t.getVideoTrack=t.getAudioTrack=t.pruneSubUrl=t.getJitterBufferDelayAvg=void 0,t.lowercaseFirstLetter=function(e){return e.replace(/([A-Za-z])/,(function(e){return e.toLowerCase()}))},t.underlineToCamelCase=function(e){return e.replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.getJitterBufferDelayAvg=function(e,t){return e&&t?Number(e)/Number(t)*1e3:-1};t.pruneSubUrl=function(e,t){var r=e||"";return r=r.replace("@subaudio=no","").replace("@subvideo=no",""),t&&(r=r.split("?")[0]),r};t.getAudioTrack=function(e){return e.getAudioTracks()[0]};t.getVideoTrack=function(e){return e.getVideoTracks()[0]};t.hasAudioTrack=function(e){return e.getAudioTracks().length>0};t.hasVideoTrack=function(e){return e.getVideoTracks().length>0};t.makeCancelable=function(e){var t=!1;return{promise:new Promise((function(r,o){e.then((function(e){return t?o({isCanceled:!0}):r(e)})),e.catch((function(e){return o(t?{isCanceled:!0}:e)}))})),cancel:function(){t=!0}}};t.evaluateNetworkCondition=function(e,t,r,o,n){var i=0;if(!navigator.onLine)return i=6;var a=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],s=-1,u=-1,l=-1;if("number"==typeof t&&t>=0||"number"==typeof r&&r>=0){s=0;var A=!1,C=!1;"number"==typeof t&&t>=0&&(s+=t,A=!0),"number"==typeof r&&r>=0&&(s+=r,C=!0),A&&!C&&(s*=2),C&&!A&&(s*=1.8)}if("number"==typeof e&&e>=0&&(l=e),"number"==typeof o&&o>=0||"number"==typeof n&&n>=0){u=0;"number"==typeof o&&o>=0&&(u+=o),"number"==typeof n&&n>=0&&(u+=n)}var c;if((c=4*(-1!==s?1:0)+2*(-1!==l?1:0)+(-1!==u?1:0))>0){var T=1.2*s*a[c-1].loss+l/1500*a[c-1].rtt+u/3e3*a[c-1].jbd;i=T<=.1?1:T<=.23?2:T<=.36?3:T<=.49?4:5}else i=0;return i};t.createUUID=function(e,t){var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[];if(t=t||o.length,e)for(r=0;r<e;r++)n[r]=o[0|Math.random()*t];else{var i=void 0;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",r=0;r<36;r++)n[r]||(i=0|16*Math.random(),n[r]=o[19==r?3&i|8:i])}return n.join("")};t.hebtLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];window.RTS_HEBT_DEBUG&&console.log.apply(console,r(["[rts hebt]"],e,!1))}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}var o,n,i,a,s,u,l,A,C,c,T,f;a=r(594),s=r(718),u=r(649),l=r(917),A=self,C=!1,c=0,T=function(e,t,r,s){if(e===l.EWorkerSource.Sender){var A=new TransformStream({transform:function(e,t){var r=e;if(e.type){if(o)try{(!o.keyframeOnly||o.keyframeOnly&&"key"===e.type)&&((0,a.insertSei)(e,o.sei,o.payloadType,o.uuid),void 0===o.repeatCount?o=null:-1!==o.repeatCount&&(o.repeatCount--,o.repeatCount<0&&(o=null)))}catch(t){e=r,console.log("error in inserting user SEI",t)}else if(C)try{if("key"===e.type&&n){var i={};n.v_encode_time_avg&&(i[u.ECumuDelayVideoKey.VEncPlugCost]=Math.ceil(n.v_encode_time_avg)),n.v_packet_send_delay_avg&&(i[u.ECumuDelayAVCommonKey.PacerCost]=Math.ceil(n.v_packet_send_delay_avg)),n.rtt&&(i[u.ECumuDelayAVCommonKey.UpRTTHalf]=Math.ceil(n.rtt/2*1e3)),i[u.ECumuDelayVideoKey.VTotalCost]=Math.ceil((i[u.ECumuDelayVideoKey.VEncPlugCost]||0)+(i[u.ECumuDelayAVCommonKey.PacerCost]||0)),(0,a.insertSei)(e,new u.CumuDelaySeiPayload({msid:n.vMsid||"",kv:i,sendTs:!0,windowTimeOrigin:c}).buffer,u.CUMU_DELAY_SEI_PAYLOAD_TYPE,(0,a.readUUID)(new Uint8Array(u.CUMU_DELAY_UUID)))}}catch(t){e=r,console.log("error in inserting cumuDelay SEI",t)}r=null,s&&s(e)}t.enqueue(e)}});t.pipeThrough(A).pipeTo(r)}else e===l.EWorkerSource.Receiver&&(A=new TransformStream({transform:function(e,t){var r,o,n,a,l,A,C,c,T,f,d,E=e;if(e.type){try{if(i){var _=((r={})[u.ECumuDelaySubKey.DownRTTHalf]=Math.ceil(((null===(n=null===(o=i.video)||void 0===o?void 0:o.transportStats)||void 0===n?void 0:n.rtt)||0)/2*1e3),r[u.ECumuDelaySubKey.VAssemblyCost]=Math.ceil((null===(l=null===(a=i.video)||void 0===a?void 0:a.inboundRtpStatsPerSec)||void 0===l?void 0:l.totalAssemblyTimeAvg)||0),r[u.ECumuDelaySubKey.VJitterBufferDelay]=Math.ceil((null===(C=null===(A=i.video)||void 0===A?void 0:A.inboundRtpStatsPerSec)||void 0===C?void 0:C.jitterBufferDelayAvg)||0),r[u.ECumuDelaySubKey.VDecPlugCost]=Math.ceil((null===(T=null===(c=i.video)||void 0===c?void 0:c.inboundRtpStatsPerSec)||void 0===T?void 0:T.decodeTimeAvg)||0),r[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((null===(d=null===(f=i.video)||void 0===f?void 0:f.inboundRtpStatsPerSec)||void 0===d?void 0:d.totalProcessingDelayAvg)||0),r);_[u.ECumuDelaySubKey.VTotalCost]||(_[u.ECumuDelaySubKey.VTotalCost]=Math.ceil((_[u.ECumuDelaySubKey.VAssemblyCost]||0)+(_[u.ECumuDelaySubKey.VJitterBufferDelay]||0)+(_[u.ECumuDelaySubKey.VDecPlugCost]||0))),e.subStats=_}}catch(t){console.log("error in parsing SEI",t),e=E}E=null,s&&s(e)}delete e.subStats,t.enqueue(e)}}),t.pipeThrough(A).pipeTo(r))},f=function(e){var t=e.data.slice(0);A.postMessage({type:"encodedFrame",data:t,frameInfo:{type:e.type,timestamp:e.timestamp},subStats:e.subStats},[t]),t=null},A.RTCTransformEvent&&(A.onrtctransform=function(e){var t=e.transformer,r=t.options.source,o=t.readable,n=t.writable;T(r,o,n,(function(e){r===l.EWorkerSource.Receiver&&f(e)}))}),onmessage=function(e){switch(e.data.operation){case l.EWorkerAction.Setup:t=e.data,r=t.source,a=t.readable,u=t.writable,T(r,a,u,(function(e){r===l.EWorkerSource.Receiver&&f(e)}));break;case l.EWorkerAction.InserSEI:!function(e){(o=e)&&(o.uuid=(0,s.createUUID)().toLowerCase(),o.repeatCount=o.repeatCount||0)}(e.data);break;case l.EWorkerAction.UpdatePubStats:!function(e){n=e.stats}(e.data);break;case l.EWorkerAction.UpdateSubStats:!function(e){i=e.stats}(e.data);break;case l.EWorkerAction.SwitchCumuDelay:!function(e){C=e.enable,c=e.windowTimeOrigin}(e.data)}var t,r,a,u}})();',"Worker",void 0,void 0)}},5512:H=>{H.exports=function(T,_,f,l){var m=self||window;try{try{var h;try{h=new m.Blob([T])}catch{(h=new(m.BlobBuilder||m.WebKitBlobBuilder||m.MozBlobBuilder||m.MSBlobBuilder)).append(T),h=h.getBlob()}var v=m.URL||m.webkitURL,u=v.createObjectURL(h),s=new m[_](u,f);return v.revokeObjectURL(u),s}catch{return new m[_]("data:application/javascript,".concat(encodeURIComponent(T)),f)}}catch{if(!l)throw Error("Inline worker is not supported");return new m[_](l,f)}}},2632:(H,T,_)=>{_.r(T),_.d(T,{default:()=>i});function f(e,o,r){Object.defineProperty(e,o,{writable:!0,enumerable:!0,configurable:!0,value:r})}Array(32);var l,m,h;class v{constructor(o){var r,a;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(r=o.time)!=null?r:10,this.count=(a=o.count)!=null?a:10,o.host.startsWith("http://")||o.host.startsWith("https://")?this.url=o.host+"/logstores/"+o.logstore+"/track":this.url="https://"+o.project+"."+o.host+"/logstores/"+o.logstore+"/track",this.opt=o,o.installUnloadHook&&typeof o.installUnloadHook=="function"&&o.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(o=this.arr){const r={__logs__:o};return this.opt.tags&&(r.__tags__=this.opt.tags),this.opt.topic&&(r.__topic__=this.opt.topic),this.opt.source&&(r.__source__=this.opt.source),JSON.stringify(r)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const o=this.assemblePayload();this.opt.sendPayload(this.url,o)}}transString(o){let r={};for(let a in o)typeof o[a]=="object"?r[a]=JSON.stringify(o[a]):r[a]=String(o[a]);return r}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const o=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){o.sendImmediateInner()},1e3*this.time)}}send(o){const r=this.transString(o);this.arr.push(r),this.sendInner()}sendImmediate(o){const r=this.transString(o);this.arr.push(r),this.sendImmediateInner()}sendBatchLogs(o){const r=o.map(a=>this.transString(a));this.arr.push(...r),this.sendInner()}sendBatchLogsImmediate(o){const r=o.map(a=>this.transString(a));this.arr.push(...r),this.sendImmediateInner()}}function u(e,o){const r=new window.XMLHttpRequest;r.open("POST",`${e}?APIVersion=0.6.0`,!0),r.send(o)}function s(e,o){try{if(o.length>=32768)return void u(e,o);(function(r,a){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${r}?APIVersion=0.6.0`,a)})(e,o)||u(e,o)}catch(r){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
|
|
163
|
+
`+r),console.error("Failed log data:",e))}}class i extends v{constructor(o){super(Object.assign({},o,{installUnloadHook:r=>{window.addEventListener("beforeunload",()=>{r()})},sendPayload:(r,a)=>{s(r,a)}}))}}l=window,m="SLS_Tracker",h=i,f(l,m,h)},4198:H=>{H.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},F={};function $(H){var T=F[H];if(T!==void 0)return T.exports;var _=F[H]={exports:{}};return B[H].call(_.exports,_,_.exports,$),_.exports}return $.n=H=>{var T=H&&H.__esModule?()=>H.default:()=>H;return $.d(T,{a:T}),T},$.d=(H,T)=>{for(var _ in T)$.o(T,_)&&!$.o(H,_)&&Object.defineProperty(H,_,{enumerable:!0,get:T[_]})},$.o=(H,T)=>Object.prototype.hasOwnProperty.call(H,T),$.r=H=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},$(8156)})())})(Vr);for(var jn=Vr.exports,Le=[],Gt=0;Gt<256;++Gt)Le.push((Gt+256).toString(16).slice(1));function Wn(Y,L=0){return(Le[Y[L+0]]+Le[Y[L+1]]+Le[Y[L+2]]+Le[Y[L+3]]+"-"+Le[Y[L+4]]+Le[Y[L+5]]+"-"+Le[Y[L+6]]+Le[Y[L+7]]+"-"+Le[Y[L+8]]+Le[Y[L+9]]+"-"+Le[Y[L+10]]+Le[Y[L+11]]+Le[Y[L+12]]+Le[Y[L+13]]+Le[Y[L+14]]+Le[Y[L+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var Yn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hr={randomUUID:Yn};function ot(Y,L,B){if(Hr.randomUUID&&!L&&!Y)return Hr.randomUUID();Y=Y||{};var F=Y.random||(Y.rng||zn)();return F[6]=F[6]&15|64,F[8]=F[8]&63|128,Wn(F)}var qn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(Y,L,B,F){if(arguments.length===1&&typeof Y=="string"&&!/\d/.test(Y)&&(L=Y,Y=void 0),Y=Y||Y===0?Y:new Date,Y instanceof Date||(Y=new Date(Y)),isNaN(Y))throw TypeError("Invalid date");L=String(jr[L]||L||jr.default);var $=L.slice(0,4);($==="UTC:"||$==="GMT:")&&(L=L.slice(4),B=!0,$==="GMT:"&&(F=!0));var H=function(){return B?"getUTC":"get"},T=function(){return Y[H()+"Date"]()},_=function(){return Y[H()+"Day"]()},f=function(){return Y[H()+"Month"]()},l=function(){return Y[H()+"FullYear"]()},m=function(){return Y[H()+"Hours"]()},h=function(){return Y[H()+"Minutes"]()},v=function(){return Y[H()+"Seconds"]()},u=function(){return Y[H()+"Milliseconds"]()},s=function(){return B?0:Y.getTimezoneOffset()},i=function(){return Qn(Y)},e=function(){return $n(Y)},o={d:function(){return T()},dd:function(){return je(T())},ddd:function(){return Ve.dayNames[_()]},DDD:function(){return Wr({y:l(),m:f(),d:T(),_:H(),dayName:Ve.dayNames[_()],short:!0})},dddd:function(){return Ve.dayNames[_()+7]},DDDD:function(){return Wr({y:l(),m:f(),d:T(),_:H(),dayName:Ve.dayNames[_()+7]})},m:function(){return f()+1},mm:function(){return je(f()+1)},mmm:function(){return Ve.monthNames[f()]},mmmm:function(){return Ve.monthNames[f()+12]},yy:function(){return String(l()).slice(2)},yyyy:function(){return je(l(),4)},h:function(){return m()%12||12},hh:function(){return je(m()%12||12)},H:function(){return m()},HH:function(){return je(m())},M:function(){return h()},MM:function(){return je(h())},s:function(){return v()},ss:function(){return je(v())},l:function(){return je(u(),3)},L:function(){return je(Math.floor(u()/10))},t:function(){return m()<12?Ve.timeNames[0]:Ve.timeNames[1]},tt:function(){return m()<12?Ve.timeNames[2]:Ve.timeNames[3]},T:function(){return m()<12?Ve.timeNames[4]:Ve.timeNames[5]},TT:function(){return m()<12?Ve.timeNames[6]:Ve.timeNames[7]},Z:function(){return F?"GMT":B?"UTC":Jn(Y)},o:function(){return(s()>0?"-":"+")+je(Math.floor(Math.abs(s())/60)*100+Math.abs(s())%60,4)},p:function(){return(s()>0?"-":"+")+je(Math.floor(Math.abs(s())/60),2)+":"+je(Math.floor(Math.abs(s())%60),2)},S:function(){return["th","st","nd","rd"][T()%10>3?0:(T()%100-T()%10!=10)*T()%10]},W:function(){return i()},WW:function(){return je(i())},N:function(){return e()}};return L.replace(qn,function(r){return r in o?o[r]():r.slice(1,r.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ve={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},je=function(L){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(L).padStart(B,"0")},Wr=function(L){var B=L.y,F=L.m,$=L.d,H=L._,T=L.dayName,_=L.short,f=_===void 0?!1:_,l=new Date,m=new Date;m.setDate(m[H+"Date"]()-1);var h=new Date;h.setDate(h[H+"Date"]()+1);var v=function(){return l[H+"Date"]()},u=function(){return l[H+"Month"]()},s=function(){return l[H+"FullYear"]()},i=function(){return m[H+"Date"]()},e=function(){return m[H+"Month"]()},o=function(){return m[H+"FullYear"]()},r=function(){return h[H+"Date"]()},a=function(){return h[H+"Month"]()},t=function(){return h[H+"FullYear"]()};return s()===B&&u()===F&&v()===$?f?"Tdy":"Today":o()===B&&e()===F&&i()===$?f?"Ysd":"Yesterday":t()===B&&a()===F&&r()===$?f?"Tmw":"Tomorrow":T},Qn=function(L){var B=new Date(L.getFullYear(),L.getMonth(),L.getDate());B.setDate(B.getDate()-(B.getDay()+6)%7+3);var F=new Date(B.getFullYear(),0,4);F.setDate(F.getDate()-(F.getDay()+6)%7+3);var $=B.getTimezoneOffset()-F.getTimezoneOffset();B.setHours(B.getHours()-$);var H=(B-F)/(864e5*7);return 1+Math.floor(H)},$n=function(L){var B=L.getDay();return B===0&&(B=7),B},Jn=function(L){return(String(L).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},Yt;(function(Y){Y.prod="rs.rtn.aliyuncs.com",Y.pre="prs.rtn.aliyuncs.com"})(Yt||(Yt={}));var Gr;(function(Y){Y[Y.ByClient=0]="ByClient",Y[Y.KickOut=1]="KickOut",Y[Y.ChannelClosed=2]="ChannelClosed",Y[Y.Restore=3]="Restore",Y[Y.Expired=4]="Expired",Y[Y.Reconnect=5]="Reconnect",Y[Y.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.8";class Kt{static getVersionNumber(){let L=zr.split("."),B="";return L.forEach(F=>{F.length===1?B+="0"+F:B+=F}),parseInt(B)}static queryingParam(L){let B=[];if(L)for(let F in L)B.push(F+"="+L[F]);return B.join("&")}static getQueryParams(L){const B=window.location.search.substring(1).split("&");for(let F=0;F<B.length;F++){const $=B[F].split("=");if(decodeURIComponent($[0])===L)return decodeURIComponent($[1])}}static createCallid(L=""){const B=ot();return L&&B&&B.length>L.length?`${L}${B.substring(L.length)}`:B}static checkSubOptionsValid(L){if(L){const{audio:B,video:F,screen:$}=L;if(B===!1&&F===!1&&$===!1)return!1}return!0}static async isNetworkAvailable(){const L=Yt.prod,{onLine:B}=navigator;if(!B)return!1;try{return await fetch(`https://${L}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(L){let B;if(L instanceof Error)B=L.message;else if(typeof L=="string")B=L;else try{B=JSON.stringify(L)}catch{B="undefined"}return B}static paramArrayToString(L){let B="";for(let F=0;F<L.length;F++){B!==""&&(B+=" ");let $=Kt.toString(L[F]);B+=$}return B}}const Zn=(Y,L)=>Y.find(B=>{if(typeof B.test=="function")return B.test(L);if(Array.isArray(B.test))return B.test.some(F=>typeof F=="string"?L.indexOf(F)>-1:F instanceof RegExp?F.test(L):!1)}),eo=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],to=()=>{let Y="unknown";try{const L=navigator.userAgent||"",B=Zn(eo,L);if(!B)return Y;Y=B.describe(L)}catch{}return Y};var ro=Object.defineProperty,no=(Y,L,B)=>L in Y?ro(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,we=(Y,L,B)=>no(Y,typeof L!="symbol"?L+"":L,B);const{BrowserUtil:Yr,SystenUtil:qr}=jn.AliRTS,oo=to(),io="woMMssV6jmyol9fr",ao=200,it=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function qt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var He;(function(Y){Y[Y.DEBUG=0]="DEBUG",Y[Y.INFO=1]="INFO",Y[Y.API=2]="API",Y[Y.WARNING=3]="WARNING",Y[Y.ERROR=4]="ERROR",Y[Y.NONE=5]="NONE"})(He||(He={}));var Ke;(function(Y){Y[Y.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",Y[Y.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",Y[Y.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",Y[Y.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class so{constructor(){we(this,"tracker"),we(this,"slsPlugin"),we(this,"stsData"),we(this,"stsExpiration",Date.now()),we(this,"clientId",ot()),we(this,"bSesid",ot()),we(this,"logLevel",He.WARNING),we(this,"appId",""),we(this,"sessionId",""),we(this,"logCache",[]),we(this,"updateTaskTimer"),we(this,"endReported",!0),we(this,"logSequence",0),we(this,"sendLogBeforeUnload",async L=>{if(!this.slsPlugin)return;this.logSequence+=1,L.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${qt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const B=`https://${at.project}.${at.host}/logstores/${at.logstore}`,F={__logs__:L.map(T=>this.slsPlugin.transString(T))},{data:$,header:H}=await this.slsPlugin.process(B,JSON.stringify(F));fetch(B,{keepalive:!0,method:"POST",headers:H,body:$})}),we(this,"logMethod",(L,B=console.log)=>(...F)=>{let $=qt();this.logLevel<=L&&B($,...F);let H=Kt.paramArrayToString(F);L>He.DEBUG&&this.addLog(H)}),we(this,"d",this.logMethod(He.DEBUG,console.debug)),we(this,"i",this.logMethod(He.INFO)),we(this,"w",this.logMethod(He.WARNING,console.warn)),we(this,"e",this.logMethod(He.ERROR,(...L)=>{const[B,...F]=L;console.error(B,"<error>",F)})),we(this,"ev",this.logMethod(He.API)),we(this,"a",this.logMethod(He.API,(...L)=>{const[B,...F]=L;if(F.length>2){const $=`${F[1]}`;$.startsWith("__g__")&&console.group(`${$.substring(5)}_${F[2]}`)}console.log(B,...F)})),we(this,"ar",this.logMethod(He.API,(...L)=>{const[B,...F]=L;console.log(B,...F),F.length>2&&`${F[1]}`.startsWith("__g__")&&console.groupEnd()})),we(this,"ae",this.logMethod(He.API,(...L)=>{const[B,...F]=L;console.error(B,"<error>",...F),F.length>2&&`${F[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=ot(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const L=await this.refreshSTSToken();this.createTracker(L)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},it)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-it){const L=await this.requestSTSToken(),B=new Date(L?.Expiration).getTime()||0,F=Date.now()+it;this.stsExpiration=Math.max(B,F),this.stsData=L}return this.stsData}requestSTSToken(){const L=Date.now(),B=`${this.clientId}|${io}|${L}`,F={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(B).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${L}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(L,"isoUtcDateTime")},$=`https://slsrole.alicdn.com/?${new URLSearchParams(F).toString()}`;return fetch($).then(H=>H.json()).then(H=>JSON.parse(window.atob(H.SlsAuthResult)))}createTracker(L){if(!this.tracker){const B={accessKeyId:L.AccessKeyId,accessKeySecret:L.AccessKeySecret,securityToken:L.SecurityToken,refreshSTSTokenInterval:it,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(H=>{B.accessKeyId=H.AccessKeyId,B.accessKeySecret=H.AccessKeySecret,B.securityToken=H.SecurityToken}).catch(()=>{})}},F=new er(at),$=Fr(B);F.useStsPlugin($),this.slsPlugin=$,this.tracker=F,this.reportStartAndCache()}}changeConfig(L){L.logLevel!==void 0&&L.logLevel>=He.DEBUG&&L.logLevel<=He.NONE&&(this.logLevel=L.logLevel)}setSessionID(L,B){!L||!B||(this.appId=L,this.sessionId=B,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const L={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},B=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,L),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,L)];this.tracker.sendBatchLogsImmediate(B),this.logCache.forEach(F=>{this.sendLog(F)})}reportEnd(L=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const B={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},F=[this.getLogParams(Ke.SESSION_UPLOAD_END,B),this.getLogParams(Ke.TASK_UPLOAD_END,B)];L?this.sendLogBeforeUnload(F):(this.tracker.sendBatchLogsImmediate(F),this.endReported=!0),this.reset()}getLogParams(L,B){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:oo,db:Yr.browserName,dm:Yr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:qr.systemName,osv:qr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:L,...B||{}}}sendLog(L){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const B=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:L,stat_log_seq:this.logSequence});this.tracker.send(B)}addLog(L){const B=qt(),F=`[${Kr()} ${B}] ${L}`;!this.sessionId||!this.tracker?(this.logCache.push(F),this.logCache.length>=ao&&this.logCache.shift()):this.sendLog(F)}}var co=Object.defineProperty,uo=(Y,L,B)=>L in Y?co(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,lo=(Y,L,B)=>uo(Y,L+"",B);class Ze{static getLogger(){return this.logger||(this.logger=new so),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(L){this.getLogger().changeConfig({logLevel:L})}static setSessionID(L,B){this.getLogger().setSessionID(L,B)}static reportEnd(){this.getLogger().reportEnd()}static interface(...L){this.getLogger().a("[API]",...L)}static interfaceResult(L,B,F,...$){F?this.getLogger().ar("[ARE]",L,B,...$):this.getLogger().ae("[ARE]",L,B,...$)}static event(...L){this.getLogger().ev("[EVT]",...L)}static debug(...L){this.getLogger().d("[DBG]",...L)}static info(...L){this.getLogger().i("[INF]",...L)}static warn(...L){this.getLogger().w("[WARN]",...L)}static error(...L){this.getLogger().e("[ERR]",...L)}}lo(Ze,"logger");var po=Object.defineProperty,fo=(Y,L,B)=>L in Y?po(Y,L,{enumerable:!0,configurable:!0,writable:!0,value:B}):Y[L]=B,Xe=(Y,L,B)=>fo(Y,typeof L!="symbol"?L+"":L,B);const Xr=48e3,tt="[AliyunAudio3A] ";class ho extends $r{constructor(L){super("AliRtcAudioProcessPlugin",Jr.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",B=>this.audioContext.createMediaStreamSource(new MediaStream([B]))),this.options=L,this.slsReporter=L?.slsReporter,this.enableSoft3ACheck=L?.enableSoft3ACheck||!1,this.useHardOnly=L?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(L){return this.lastInputAudioTrack?.id!==L.currentAudioTrack?.id}videoUpdated(L){return console.log("videoUpdated",L),!1}setOptions(L){this.farNode||!L.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(L.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...L})}isSupported(){return $t.isSupported()}shouldUpdate(L){return!!(L.originAudioTrack&&!this.audioProcessor||!L.originAudioTrack&&this.audioProcessor)}async process(L){if(!L.currentAudioTrack){L.updateAudioTrack(),this.clear(L);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new $t({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(F,$)=>{let H=3e3;$.includes("far")?H=5e3:$.includes("output")?H=1e4:$.includes("meta")&&(H=8e3),setTimeout(()=>{const T=URL.createObjectURL(F),_=document.createElement("a");_.href=T,_.download=$,document.body.appendChild(_),_.click(),document.body.removeChild(_)},H)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||L.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",F=>{Ze.error(tt,"loaderror:",F?.message),this.emit("error",F)}),this.audioProcessor.on("outputlog",F=>{Ze.info(tt,"outputlog:",F),F?.includes("diff")&&(this.lastDiffOutputLog=F||"")}),this.audioProcessor.on("statdata",F=>{if(F)try{let $=F;if(this.lastDiffOutputLog){const H=this.extractDiffValue(this.lastDiffOutputLog),T=JSON.parse(F);H!==null&&(T.diff=H);const _=this.extractLeakValue(this.lastDiffOutputLog);_!==null&&(T.leak=_),$=JSON.stringify(T)}this.slsReporter?.reportPublishAudio3A("","","",$)}catch($){Ze.error(tt,"statdata error:",$)}});const B=this.createNode(L.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,B,1,Xr,this.farNode)}}extractDiffValue(L){if(!L)return null;const B=L.match(/diff\s*=\s*(-?\d+\.?\d*)/);return B?parseFloat(B[1]):null}extractLeakValue(L){if(!L)return null;const B=L.match(/leak\s*=\s*(-?\d+\.?\d*)/);return B?parseFloat(B[1]):null}clear(L){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(L),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{ho as default};
|