trtc-sdk-v5
Version:
Tencent Cloud RTC SDK for Web
5 lines • 718 kB
JavaScript
var s_=Object.create;var fs=Object.defineProperty,n_=Object.defineProperties,bh=Object.getOwnPropertyDescriptor,a_=Object.getOwnPropertyDescriptors,c_=Object.getOwnPropertyNames,Ln=Object.getOwnPropertySymbols,Nh=Object.getPrototypeOf,id=Object.prototype.hasOwnProperty,vh=Object.prototype.propertyIsEnumerable,d_=Reflect.get;var or=Math.pow,td=(o,i,e)=>i in o?fs(o,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[i]=e,D=(o,i)=>{for(var e in i||(i={}))id.call(i,e)&&td(o,e,i[e]);if(Ln)for(var e of Ln(i))vh.call(i,e)&&td(o,e,i[e]);return o},w=(o,i)=>n_(o,a_(i));var Dh=(o,i)=>{var e={};for(var t in o)id.call(o,t)&&i.indexOf(t)<0&&(e[t]=o[t]);if(o!=null&&Ln)for(var t of Ln(o))i.indexOf(t)<0&&vh.call(o,t)&&(e[t]=o[t]);return e};var Ni=(o,i)=>()=>(i||o((i={exports:{}}).exports,i),i.exports),vi=(o,i)=>{for(var e in i)fs(o,e,{get:i[e],enumerable:!0})},l_=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of c_(i))!id.call(o,r)&&r!==e&&fs(o,r,{get:()=>i[r],enumerable:!(t=bh(i,r))||t.enumerable});return o};var Ge=(o,i,e)=>(e=o!=null?s_(Nh(o)):{},l_(i||!o||!o.__esModule?fs(e,"default",{value:o,enumerable:!0}):e,o));var M=(o,i,e,t)=>{for(var r=t>1?void 0:t?bh(i,e):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(t?n(i,e,r):n(r))||r);return t&&r&&fs(i,e,r),r};var d=(o,i,e)=>td(o,typeof i!="symbol"?i+"":i,e);var We=(o,i,e)=>d_(Nh(o),e,i);var f=(o,i,e)=>new Promise((t,r)=>{var s=c=>{try{a(e.next(c))}catch(l){r(l)}},n=c=>{try{a(e.throw(c))}catch(l){r(l)}},a=c=>c.done?t(c.value):Promise.resolve(c.value).then(s,n);a((e=e.apply(o,i)).next())});var it=Ni((MS,rd)=>{"use strict";var u_=Object.prototype.hasOwnProperty,tt="~";function _s(){}Object.create&&(_s.prototype=Object.create(null),new _s().__proto__||(tt=!1));function h_(o,i,e){this.fn=o,this.context=i,this.once=e||!1}function Mh(o,i,e,t,r){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new h_(e,t||o,r),n=tt?tt+i:i;return o._events[n]?o._events[n].fn?o._events[n]=[o._events[n],s]:o._events[n].push(s):(o._events[n]=s,o._eventsCount++),o}function Pn(o,i){--o._eventsCount===0?o._events=new _s:delete o._events[i]}function je(){this._events=new _s,this._eventsCount=0}je.prototype.eventNames=function(){var i=[],e,t;if(this._eventsCount===0)return i;for(t in e=this._events)u_.call(e,t)&&i.push(tt?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i};je.prototype.listeners=function(i){var e=tt?tt+i:i,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var r=0,s=t.length,n=new Array(s);r<s;r++)n[r]=t[r].fn;return n};je.prototype.listenerCount=function(i){var e=tt?tt+i:i,t=this._events[e];return t?t.fn?1:t.length:0};je.prototype.emit=function(i,e,t,r,s,n){var a=tt?tt+i:i;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,u,h;if(c.fn){switch(c.once&&this.removeListener(i,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,t),!0;case 4:return c.fn.call(c.context,e,t,r),!0;case 5:return c.fn.call(c.context,e,t,r,s),!0;case 6:return c.fn.call(c.context,e,t,r,s,n),!0}for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];c.fn.apply(c.context,u)}else{var m=c.length,g;for(h=0;h<m;h++)switch(c[h].once&&this.removeListener(i,c[h].fn,void 0,!0),l){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,t);break;case 4:c[h].fn.call(c[h].context,e,t,r);break;default:if(!u)for(g=1,u=new Array(l-1);g<l;g++)u[g-1]=arguments[g];c[h].fn.apply(c[h].context,u)}}return!0};je.prototype.on=function(i,e,t){return Mh(this,i,e,t,!1)};je.prototype.once=function(i,e,t){return Mh(this,i,e,t,!0)};je.prototype.removeListener=function(i,e,t,r){var s=tt?tt+i:i;if(!this._events[s])return this;if(!e)return Pn(this,s),this;var n=this._events[s];if(n.fn)n.fn===e&&(!r||n.once)&&(!t||n.context===t)&&Pn(this,s);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||r&&!n[a].once||t&&n[a].context!==t)&&c.push(n[a]);c.length?this._events[s]=c.length===1?c[0]:c:Pn(this,s)}return this};je.prototype.removeAllListeners=function(i){var e;return i?(e=tt?tt+i:i,this._events[e]&&Pn(this,e)):(this._events=new _s,this._eventsCount=0),this};je.prototype.off=je.prototype.removeListener;je.prototype.addListener=je.prototype.on;je.prefixed=tt;je.EventEmitter=je;typeof rd!="undefined"&&(rd.exports=je)});var va=Ni((QI,Im)=>{"use strict";var Sm=Im.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(o){return o.encoding?"rtpmap:%d %s/%s/%s":o.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(o){return o.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(o){return o.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(o){return"extmap:%d"+(o.direction?"/%s":"%v")+(o["encrypt-uri"]?" %s":"%v")+" %s"+(o.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(o){return o.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(o){var i="candidate:%s %d %s %d %s %d typ %s";return i+=o.raddr!=null?" raddr %s rport %d":"%v%v",i+=o.tcptype!=null?" tcptype %s":"%v",o.generation!=null&&(i+=" generation %d"),i+=o["network-id"]!=null?" network-id %d":"%v",i+=o["network-cost"]!=null?" network-cost %d":"%v",i}},{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(o){var i="ssrc:%d";return o.attribute!=null&&(i+=" %s",o.value!=null&&(i+=":%s")),i}},{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(o){return o.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(o){return o.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(o){return"imageattr:%s %s %s"+(o.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(o){return"simulcast:%s %s"+(o.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(o){return"ts-refclk:%s"+(o.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(o){var i="mediaclk:";return i+=o.id!=null?"id=%s %s":"%v%s",i+=o.mediaClockValue!=null?"=%s":"",i+=o.rateNumerator!=null?" rate=%s":"",i+=o.rateDenominator!=null?"/%s":"",i}},{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(Sm).forEach(function(o){var i=Sm[o];i.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})});var Rm=Ni(Gi=>{"use strict";var Bo=function(o){return String(Number(o))===o?Number(o):o},Tg=function(o,i,e,t){if(t&&!e)i[t]=Bo(o[1]);else for(var r=0;r<e.length;r+=1)o[r+1]!=null&&(i[e[r]]=Bo(o[r+1]))},Eg=function(o,i,e){var t=o.name&&o.names;o.push&&!i[o.push]?i[o.push]=[]:t&&!i[o.name]&&(i[o.name]={});var r=o.push?{}:t?i[o.name]:i;Tg(e.match(o.reg),r,o.names,o.name),o.push&&i[o.push].push(r)},Am=va(),Sg=RegExp.prototype.test.bind(/^([a-z])=(.*)/);Gi.parse=function(o){var i={},e=[],t=i;return o.split(/(\r\n|\r|\n)/).filter(Sg).forEach(function(r){var s=r[0],n=r.slice(2);s==="m"&&(e.push({rtp:[],fmtp:[]}),t=e[e.length-1]);for(var a=0;a<(Am[s]||[]).length;a+=1){var c=Am[s][a];if(c.reg.test(n))return Eg(c,t,n)}}),i.media=e,i};var Cm=function(o,i){var e=i.split(/=(.+)/,2);return e.length===2?o[e[0]]=Bo(e[1]):e.length===1&&i.length>1&&(o[e[0]]=void 0),o};Gi.parseParams=function(o){return o.split(/;\s?/).reduce(Cm,{})};Gi.parseFmtpConfig=Gi.parseParams;Gi.parsePayloads=function(o){return o.toString().split(" ").map(Number)};Gi.parseRemoteCandidates=function(o){for(var i=[],e=o.split(" ").map(Bo),t=0;t<e.length;t+=3)i.push({component:e[t],ip:e[t+1],port:e[t+2]});return i};Gi.parseImageAttributes=function(o){return o.split(" ").map(function(i){return i.substring(1,i.length-1).split(",").reduce(Cm,{})})};Gi.parseSimulcastStreamList=function(o){return o.split(";").map(function(i){return i.split(",").map(function(e){var t,r=!1;return e[0]!=="~"?t=Bo(e):(t=Bo(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}});var bm=Ni((ZI,ym)=>{"use strict";var _l=va(),Ig=/%[sdv%]/g,Ag=function(o){var i=1,e=arguments,t=e.length;return o.replace(Ig,function(r){if(i>=t)return r;var s=e[i];switch(i+=1,r){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}})},qs=function(o,i,e){var t=i.format instanceof Function?i.format(i.push?e:e[i.name]):i.format,r=[o+"="+t];if(i.names)for(var s=0;s<i.names.length;s+=1){var n=i.names[s];i.name?r.push(e[i.name][n]):r.push(e[i.names[s]])}else r.push(e[i.name]);return Ag.apply(null,r)},Cg=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Rg=["i","c","b","a"];ym.exports=function(o,i){i=i||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEach(function(s){s.payloads==null&&(s.payloads="")});var e=i.outerOrder||Cg,t=i.innerOrder||Rg,r=[];return e.forEach(function(s){_l[s].forEach(function(n){n.name in o&&o[n.name]!=null?r.push(qs(s,n,o)):n.push in o&&o[n.push]!=null&&o[n.push].forEach(function(a){r.push(qs(s,n,a))})})}),o.media.forEach(function(s){r.push(qs("m",_l.m[0],s)),t.forEach(function(n){_l[n].forEach(function(a){a.name in s&&s[a.name]!=null?r.push(qs(n,a,s)):a.push in s&&s[a.push]!=null&&s[a.push].forEach(function(c){r.push(qs(n,a,c))})})})}),r.join(`\r
`)+`\r
`}});var Nm=Ni(ui=>{"use strict";var Br=Rm(),yg=bm(),bg=va();ui.grammar=bg;ui.write=yg;ui.parse=Br.parse;ui.parseParams=Br.parseParams;ui.parseFmtpConfig=Br.parseFmtpConfig;ui.parsePayloads=Br.parsePayloads;ui.parseRemoteCandidates=Br.parseRemoteCandidates;ui.parseImageAttributes=Br.parseImageAttributes;ui.parseSimulcastStreamList=Br.parseSimulcastStreamList});var dh=Ni((ZV,mf)=>{"use strict";var hf=mf.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(o){return o.encoding?"rtpmap:%d %s/%s/%s":o.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(o){return o.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(o){return o.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(o){return"extmap:%d"+(o.direction?"/%s":"%v")+(o["encrypt-uri"]?" %s":"%v")+" %s"+(o.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(o){return o.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(o){var i="candidate:%s %d %s %d %s %d typ %s";return i+=o.raddr!=null?" raddr %s rport %d":"%v%v",i+=o.tcptype!=null?" tcptype %s":"%v",o.generation!=null&&(i+=" generation %d"),i+=o["network-id"]!=null?" network-id %d":"%v",i+=o["network-cost"]!=null?" network-cost %d":"%v",i}},{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(o){var i="ssrc:%d";return o.attribute!=null&&(i+=" %s",o.value!=null&&(i+=":%s")),i}},{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(o){return o.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(o){return o.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(o){return"imageattr:%s %s %s"+(o.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(o){return"simulcast:%s %s"+(o.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(o){return"ts-refclk:%s"+(o.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(o){var i="mediaclk:";return i+=o.id!=null?"id=%s %s":"%v%s",i+=o.mediaClockValue!=null?"=%s":"",i+=o.rateNumerator!=null?" rate=%s":"",i+=o.rateDenominator!=null?"/%s":"",i}},{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(hf).forEach(function(o){var i=hf[o];i.forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})})});var _f=Ni(tr=>{"use strict";var ls=function(o){return String(Number(o))===o?Number(o):o},tS=function(o,i,e,t){if(t&&!e)i[t]=ls(o[1]);else for(var r=0;r<e.length;r+=1)o[r+1]!=null&&(i[e[r]]=ls(o[r+1]))},iS=function(o,i,e){var t=o.name&&o.names;o.push&&!i[o.push]?i[o.push]=[]:t&&!i[o.name]&&(i[o.name]={});var r=o.push?{}:t?i[o.name]:i;tS(e.match(o.reg),r,o.names,o.name),o.push&&i[o.push].push(r)},pf=dh(),rS=RegExp.prototype.test.bind(/^([a-z])=(.*)/);tr.parse=function(o){var i={},e=[],t=i;return o.split(/(\r\n|\r|\n)/).filter(rS).forEach(function(r){var s=r[0],n=r.slice(2);s==="m"&&(e.push({rtp:[],fmtp:[]}),t=e[e.length-1]);for(var a=0;a<(pf[s]||[]).length;a+=1){var c=pf[s][a];if(c.reg.test(n))return iS(c,t,n)}}),i.media=e,i};var ff=function(o,i){var e=i.split(/=(.+)/,2);return e.length===2?o[e[0]]=ls(e[1]):e.length===1&&i.length>1&&(o[e[0]]=void 0),o};tr.parseParams=function(o){return o.split(/;\s?/).reduce(ff,{})};tr.parseFmtpConfig=tr.parseParams;tr.parsePayloads=function(o){return o.toString().split(" ").map(Number)};tr.parseRemoteCandidates=function(o){for(var i=[],e=o.split(" ").map(ls),t=0;t<e.length;t+=3)i.push({component:e[t],ip:e[t+1],port:e[t+2]});return i};tr.parseImageAttributes=function(o){return o.split(" ").map(function(i){return i.substring(1,i.length-1).split(",").reduce(ff,{})})};tr.parseSimulcastStreamList=function(o){return o.split(";").map(function(i){return i.split(",").map(function(e){var t,r=!1;return e[0]!=="~"?t=ls(e):(t=ls(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}});var Tf=Ni((eU,gf)=>{"use strict";var lh=dh(),oS=/%[sdv%]/g,sS=function(o){var i=1,e=arguments,t=e.length;return o.replace(oS,function(r){if(i>=t)return r;var s=e[i];switch(i+=1,r){case"%%":return"%";case"%s":return String(s);case"%d":return Number(s);case"%v":return""}})},vn=function(o,i,e){var t=i.format instanceof Function?i.format(i.push?e:e[i.name]):i.format,r=[o+"="+t];if(i.names)for(var s=0;s<i.names.length;s+=1){var n=i.names[s];i.name?r.push(e[i.name][n]):r.push(e[i.names[s]])}else r.push(e[i.name]);return sS.apply(null,r)},nS=["v","o","s","i","u","e","p","c","b","t","r","z","a"],aS=["i","c","b","a"];gf.exports=function(o,i){i=i||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEach(function(s){s.payloads==null&&(s.payloads="")});var e=i.outerOrder||nS,t=i.innerOrder||aS,r=[];return e.forEach(function(s){lh[s].forEach(function(n){n.name in o&&o[n.name]!=null?r.push(vn(s,n,o)):n.push in o&&o[n.push]!=null&&o[n.push].forEach(function(a){r.push(vn(s,n,a))})})}),o.media.forEach(function(s){r.push(vn("m",lh.m[0],s)),t.forEach(function(n){lh[n].forEach(function(a){a.name in s&&s[a.name]!=null?r.push(vn(n,a,s)):a.push in s&&s[a.push]!=null&&s[a.push].forEach(function(c){r.push(vn(n,a,c))})})})}),r.join(`\r
`)+`\r
`}});var uh=Ni(ir=>{"use strict";var io=_f(),cS=Tf();ir.write=cS;ir.parse=io.parse;ir.parseParams=io.parseParams;ir.parseFmtpConfig=io.parseFmtpConfig;ir.parsePayloads=io.parsePayloads;ir.parseRemoteCandidates=io.parseRemoteCandidates;ir.parseImageAttributes=io.parseImageAttributes;ir.parseSimulcastStreamList=io.parseSimulcastStreamList});import zG from"webrtc-adapter";var of=Ge(it());var Oh=(B=>(B[B.INVALID_PARAMETER=4096]="INVALID_PARAMETER",B[B.INVALID_OPERATION=4097]="INVALID_OPERATION",B[B.NOT_SUPPORTED=4098]="NOT_SUPPORTED",B[B.DEVICE_NOT_FOUND=4099]="DEVICE_NOT_FOUND",B[B.INITIALIZE_FAILED=4100]="INITIALIZE_FAILED",B[B.SIGNAL_CHANNEL_SETUP_FAILED=16385]="SIGNAL_CHANNEL_SETUP_FAILED",B[B.SIGNAL_CHANNEL_ERROR=16386]="SIGNAL_CHANNEL_ERROR",B[B.ICE_TRANSPORT_ERROR=16387]="ICE_TRANSPORT_ERROR",B[B.JOIN_ROOM_FAILED=16388]="JOIN_ROOM_FAILED",B[B.CREATE_OFFER_FAILED=16389]="CREATE_OFFER_FAILED",B[B.SIGNAL_CHANNEL_RECONNECTION_FAILED=16390]="SIGNAL_CHANNEL_RECONNECTION_FAILED",B[B.UPLINK_RECONNECTION_FAILED=16391]="UPLINK_RECONNECTION_FAILED",B[B.DOWNLINK_RECONNECTION_FAILED=16392]="DOWNLINK_RECONNECTION_FAILED",B[B.REMOTE_STREAM_NOT_EXIST=16400]="REMOTE_STREAM_NOT_EXIST",B[B.CLIENT_BANNED=16448]="CLIENT_BANNED",B[B.SERVER_TIMEOUT=16449]="SERVER_TIMEOUT",B[B.SUBSCRIPTION_TIMEOUT=16450]="SUBSCRIPTION_TIMEOUT",B[B.PLAY_NOT_ALLOWED=16451]="PLAY_NOT_ALLOWED",B[B.DEVICE_AUTO_RECOVER_FAILED=16452]="DEVICE_AUTO_RECOVER_FAILED",B[B.START_PUBLISH_CDN_FAILED=16453]="START_PUBLISH_CDN_FAILED",B[B.STOP_PUBLISH_CDN_FAILED=16454]="STOP_PUBLISH_CDN_FAILED",B[B.START_MIX_TRANSCODE_FAILED=16455]="START_MIX_TRANSCODE_FAILED",B[B.STOP_MIX_TRANSCODE_FAILED=16456]="STOP_MIX_TRANSCODE_FAILED",B[B.NOT_SUPPORTED_H264=16457]="NOT_SUPPORTED_H264",B[B.SWITCH_ROLE_FAILED=16458]="SWITCH_ROLE_FAILED",B[B.API_CALL_TIMEOUT=16459]="API_CALL_TIMEOUT",B[B.SCHEDULE_FAILED=16460]="SCHEDULE_FAILED",B[B.API_CALL_ABORTED=16461]="API_CALL_ABORTED",B[B.SPC_INITIALIZED_FAILED=16462]="SPC_INITIALIZED_FAILED",B[B.VIDEO_MANAGER_ERROR=16463]="VIDEO_MANAGER_ERROR",B[B.SWITCH_ROOM_FAILED=16464]="SWITCH_ROOM_FAILED",B[B.VIDEO_ENCODE_FAILED=16465]="VIDEO_ENCODE_FAILED",B[B.AUDIO_ENCODE_FAILED=16466]="AUDIO_ENCODE_FAILED",B[B.UNKNOWN=65535]="UNKNOWN",B))(Oh||{}),A=Oh;var m_=function(o){for(let i in A)if(A[i]===o)return i;return"UNKNOWN"},od=class extends Error{constructor({name:e="RtcError",message:t,code:r=A.UNKNOWN,extraCode:s=0,constraint:n}){let a=`<${m_(r)} 0x${r.toString(16)}>`,c=`${t}${n?` constraint: ${n}`:""}${t!=null&&t.includes(a)?"":` ${a}`}`;super(c);d(this,"code");d(this,"extraCode");d(this,"message");d(this,"originMessage");d(this,"name");d(this,"constraint");this.code=r,this.extraCode=s,this.name=e,this.message=c,this.constraint=n,this.originMessage=t}getCode(){return this.code}getExtraCode(){return this.extraCode}toString(){return this.originMessage}},v=od;var kh=new Date().getTime(),sd=0,wh=function(o){kh=o,sd=kh-new Date().getTime();let i=new Date;i.setTime(o),b.info(`baseTime from server: ${i} offset: ${sd}`)},gs=function(){return new Date().getTime()+sd},Vn=function(){let o=new Date;return o.setTime(gs()),o.toLocaleString()},ao=function(o){let i=String(o.getMilliseconds());return"padStart"in String.prototype&&(i=i.toString().padStart(3,"0")),`${o.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")}:${i}`};var ft={};vi(ft,{REPORT_TYPE:()=>Ao,buildSSOPackage:()=>Pi,bytes2ms:()=>$h,calculateScaleResolutionDownNumber:()=>Io,convertObjectNumberToInt:()=>Ms,copyProperties:()=>Hh,deepClone:()=>Nr,deepCloneBasic:()=>Qn,deepMerge:()=>Bt,delay:()=>Li,fibonacci:()=>Dr,formatedTime:()=>Qh,getConstructorName:()=>_o,getContainerFromElement:()=>zh,getEnv:()=>Bh,getInternalVersion:()=>jh,getLoggerUrl:()=>wi,getMediaStreamTrackInfo:()=>ta,getMuteStateFromFlag:()=>xi,getNetworkType:()=>Dd,getNumNetworkType:()=>vr,getReconnectionTimeout:()=>Ut,getStringByteLength:()=>Ds,getTurnServer:()=>Xh,getUint32Version:()=>Zn,getValueType:()=>Re,getViewListFromView:()=>Eo,glog:()=>kd,ipv4ToUint32:()=>To,isArray:()=>Se,isAudioWorkletSupported:()=>qh,isBoolean:()=>de,isConstructor:()=>Mr,isEmpty:()=>go,isFunction:()=>ae,isLangChinese:()=>Vt,isMediaStreamTrack:()=>Wh,isNumber:()=>q,isObject:()=>pt,isOverseaSdkAppId:()=>ki,isPlainObject:()=>ze,isPortrait:()=>wd,isPromise:()=>lr,isRemoteTrack:()=>Jh,isRotate90Or270:()=>yt,isString:()=>te,isUndefined:()=>T,loadImage:()=>So,loadVideo:()=>Yh,ms2bytes:()=>Gh,ms2samples:()=>Od,normalizeUrl:()=>ea,performanceNow:()=>P,promiseAny:()=>Or,samples2ms:()=>Md,setNetworkType:()=>Yn,stringify:()=>Rt,stringifyIncludeValue:()=>vs,throttlePromise:()=>Kn});var Ed={};vi(Ed,{AUDIO_MUTE_BIT:()=>Gn,AUDIO_STAT_BIT:()=>cr,AUX_STAT_BIT:()=>Cr,AUX_STREAM_MSID:()=>hd,BACKEND_ENV:()=>$n,BASE_DOC_URL:()=>ii,BASE_HOST:()=>xh,CAPABILITIES_KEYS:()=>qn,CLASS_NAME:()=>L_,CLOUD_CONSOLE_URL:()=>g_,CROSS_ROOM_BIT:()=>ud,DATA_FREEZE_TIMING:()=>Jn,DOC_URL:()=>T_,DTLS_STATE_UNKNOWN:()=>Pt,ENV_NAME:()=>Di,EXCHANGE_SDP_TIMEOUT:()=>gd,IS_WORKER:()=>co,IS_WORKLET:()=>Es,KIBANA_EVENT:()=>ct,LOCAL_STREAM_PUBLISH_STATE:()=>Ph,LOGGER_CMD_TYPE:()=>sr,LOGGER_DOMAIN:()=>ad,LOGGER_DOMAIN_OVERSEA:()=>cd,LOG_LEVEL:()=>xt,LOG_LEVEL_NAME:()=>V_,MAIN_STREAM_MSID:()=>As,MAX_RTT:()=>ys,MICROPHONE_COMMUNICATIONS:()=>P_,MICROPHONE_DEFAULT:()=>br,MUTE_ALL_BIT:()=>I_,NAME:()=>p,NETWORK_TYPE:()=>Un,NOT_SUPPORTED_H264:()=>Rr,PAUSED_RETRY_COUNT:()=>yr,PEERCONNECTION_CONNECTING_TIMEOUT:()=>Cs,PEER_CONNECTION_STATE:()=>ge,PEER_LEAVE_REASON:()=>Td,RECOVER_CAPTURE_INTERVAL:()=>ho,REMOTE_STREAM_TYPE_AUX:()=>pd,REMOTE_STREAM_TYPE_MAIN:()=>md,RENDER_FREEZE_TIMING:()=>O_,SCHEDULE_DOMAIN:()=>Oi,SCHEDULE_TIMEOUT:()=>x_,SDP_SEMANTICS_PLAN_B:()=>lo,SDP_SEMANTICS_UNIFIED_PLAN:()=>dr,SECOND_HOST:()=>f_,SIGNAL_PING_PONG_INTERVAL:()=>S_,SIGNAL_PING_TIMEOUT:()=>E_,SIGNAL_RECONNECTION_COUNT:()=>D_,SMALL_STAT_BIT:()=>Is,SPEAKER_DEFAULT:()=>Rs,STORAGE_EXPIRES_TIME:()=>Bn,STREAM_TYPE_BIG:()=>k_,STREAM_TYPE_SMALL:()=>w_,SUBSCRIBE_SMALL_RETRY_COUNT:()=>uo,SYNC_USER_LIST_INTERVAL:()=>M_,Scene:()=>ri,THIRD_HOST:()=>__,TRANSPORT_DIRECTION:()=>ie,TRTC_ERROR_ASSISTANCE:()=>dd,TRTC_QUALITY_BAD:()=>b_,TRTC_QUALITY_DISCONNECTED:()=>v_,TRTC_QUALITY_EXCELLENT:()=>C_,TRTC_QUALITY_GOOD:()=>R_,TRTC_QUALITY_POOR:()=>y_,TRTC_QUALITY_UNKNOWN:()=>A_,TRTC_QUALITY_VERY_BAD:()=>N_,UPDATE_OFFER_TIMEOUT:()=>_d,VIDEO_MUTE_BIT:()=>Wn,VIDEO_STAT_BIT:()=>ar,audioProfileMap:()=>Fn,defaultBigVideoProfile:()=>nr,defaultSmallVideoProfile:()=>ld,getRetryCount:()=>Mi,getScriptDir:()=>p_,innerVersion:()=>Ts,loggerProxy:()=>Ss,screenProfileMap:()=>Hn,setLoggerProxy:()=>Ar,setRetryCount:()=>fd,setVersion:()=>nd,version:()=>xe,videoProfileMap:()=>Lt});var Ts="4.15.00.1600",xe="5.0.0";function nd(o){xe=o;let[i,e,t]=o.split(".").map(r=>parseInt(r,10));Ts=`${i}.${Math.min(15,e)}.${Math.min(15,t)}.${e.toString().padStart(2,"0")}${t.toString().padStart(2,"0")}`}var co=typeof importScripts!="undefined",Es=typeof registerProcessor!="undefined",p_=()=>{let o=co?self.location.href:document.currentScript.src;return o.substring(0,o.lastIndexOf("/")+1)},Ss="",Ar=o=>Ss=o,xh="web.sdk.qcloud.com",f_="web.sdk.tencent.cn",__="web.sdk.cloud.tencent.cn",g_="https://console.cloud.tencent.com/trtc",ii=`https://${xh}/trtc/webrtc/v5/doc`,T_=`${ii}/zh-cn/`,ad="https://yun.tim.qq.com",cd="https://apisgp.my-imcloud.com",dd="trtc_error_assistance",sr={LOG:"jssdk_log",EVENT:"jssdk_event",KEY_POINT:"jssdk_new_endreport",KV_STAT:"jssdk_key_metrics_report"},Di={QCLOUD:"qcloud",OLD_CLOUD_LADDER:"trtc",WEBRTC:"webrtc"},xt=(n=>(n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.NONE=5]="NONE",n))(xt||{}),E_=18e3,S_=2e3,Un={unknown:0,wifi:1,"3g":2,"2g":3,"4g":4,wired:5,"5g":6},Bn=7*24*3600*1e3,Fn={standard:{sampleRate:48e3,channelCount:1,bitrate:40},"standard-stereo":{sampleRate:48e3,channelCount:2,bitrate:64},high:{sampleRate:48e3,channelCount:1,bitrate:128},"high-stereo":{sampleRate:48e3,channelCount:2,bitrate:192}},Lt={"120p":{width:160,height:120,frameRate:15,bitrate:200},"120p_2":{width:160,height:120,frameRate:15,bitrate:100},"180p":{width:320,height:180,frameRate:15,bitrate:350},"180p_2":{width:320,height:180,frameRate:15,bitrate:150},"240p":{width:320,height:240,frameRate:15,bitrate:400},"240p_2":{width:320,height:240,frameRate:15,bitrate:200},"360p":{width:640,height:360,frameRate:15,bitrate:800},"360p_2":{width:640,height:360,frameRate:15,bitrate:400},"480p":{width:640,height:480,frameRate:15,bitrate:900},"480p_2":{width:640,height:480,frameRate:15,bitrate:500},"720p":{width:1280,height:720,frameRate:15,bitrate:1500},"1080p":{width:1920,height:1080,frameRate:15,bitrate:2e3},"1440p":{width:2560,height:1440,frameRate:30,bitrate:4860},"4K":{width:3840,height:2160,frameRate:30,bitrate:9e3}},nr=Lt["480p_2"],ld=Lt["120p_2"],Hn={"480p":{width:640,height:480,frameRate:5,bitrate:900},"480p_2":{width:640,height:480,frameRate:30,bitrate:1e3},"720p":{width:1280,height:720,frameRate:5,bitrate:1200},"720p_2":{width:1280,height:720,frameRate:30,bitrate:3e3},"1080p":{width:1920,height:1080,frameRate:5,bitrate:1600},"1080p_2":{width:1920,height:1080,frameRate:30,bitrate:4e3}},p={CANVAS:"canvas",AUDIO:"audio",VIDEO:"video",SCREEN:"screen",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",SMALL_VIDEO:"smallVideo",FACING_MODE_USER:"user",FACING_MODE_ENVIRONMENT:"environment",MUTE:"mute",UNMUTE:"unmute",ENDED:"ended",PLAYING:"playing",PAUSE:"pause",ERROR:"error",LOADEDDATA:"loadeddata",LOADEDMETADATA:"loadedmetadata",AUDIO_INPUT:"audioinput",VIDEO_INPUT:"videoinput",DETAIL:"detail",TEXT:"text",MAIN:"main",BACKUP:"backup",BANNED:"banned",KICK:"kick",USER_TIME_OUT:"user_time_out",ROOM_DISBAND:"room_disband",SEI_MESSAGE:"sei-message",ADD:"add",REMOVE:"remove",REPLACE:"replace",TRACK:"track",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",TRANSCEIVER_DIRECTION_SENDONLY:"sendonly",TRANSCEIVER_DIRECTION_RECVONLY:"recvonly",ENTER_PICTURE_IN_PICTURE:"enterpictureinpicture",LEAVE_PICTURE_IN_PICTURE:"leavepictureinpicture"},ie={INACTIVE:"inactive",SENDONLY:"sendonly",RECVONLY:"recvonly"},$n={OLD_CLOUD_LADDER:"wss://trtc.rtc.qq.com",WEBRTC:"wss://webrtc.qq.com"},ri=(e=>(e.LIVE="live",e.RTC="rtc",e))(ri||{}),ar=1,Is=2,Cr=4,cr=8,Gn=64,Wn=16,I_=112,ud=128,As="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",hd="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",md=p.MAIN,pd=p.AUXILIARY,A_=0,C_=1,R_=2,y_=3,b_=4,N_=5,v_=6,Pt="unknown",ge={NEW:"new",CONNECTING:"connecting",FAILED:"failed",CLOSED:"closed",DISCONNECTED:"disconnected",CONNECTED:"connected",COMPLETED:"completed"},Lh=1/0;function fd(o){Lh=o}function Mi(){return Lh}var D_=30,ct={JOIN:"join",DELTA_JOIN:"delta-join",REJOIN:"rejoin",LEAVE:"leave",DELTA_LEAVE:"delta-leave",PUBLISH:"publish",DELTA_PUBLISH:"delta-publish",UNPUBLISH:"unpublish",SUBSCRIBE:"subscribe",UNSUBSCRIBE:"unsubscribe",UPLINK_CONNECTION:"uplink-connection",UPLINK_RECONNECTION:"uplink-reconnection",DOWNLINK_CONNECTION:"downlink-connection",DOWNLINK_RECONNECTION:"downlink-reconnection",ON_TRACK:"ontrack",ICE_CONNECTION_STATE:"iceConnectionState",LOCAL_STREAM_INITIALIZE:"stream-initialize",SIGNAL_CONNECTION:"websocketConnectionState",SIGNAL_RECONNECTION:"websocketReconnectionState",UPDATE_STREAM:"update-stream",RECOVER_LOCAL_AUDIO_TRACK:"recover-local-audio-track",RECOVER_LOCAL_VIDEO_TRACK:"recover-local-video-track",RECOVER_SUBSCRIPTION:"recover-subscription",START_MIX_TRANSCODE:"start-mix-transcode",STOP_MIX_TRANSCODE:"stop-mix-transcode",PLAYER_ERROR:"player-error",SCHEDULE:"schedule",LOAD_WORKLET:"load-worklet",VIDEO_FROZEN_COUNT:"videoFrozenCount",GET_USER_MEDIA_RETRY:"getUserMedia-retry"},M_=1e4,_d=1e4,gd=1e4,dr="unified-plan",lo="plan-b",Rr=1028,Ph=(t=>(t[t.UNPUBLISH=-1]="UNPUBLISH",t[t.PUBLISHING=0]="PUBLISHING",t[t.PUBLISHED=1]="PUBLISHED",t))(Ph||{}),Jn=500,O_=1e3,k_=p.BIG,w_=p.SMALL,Cs=10*1e3,Oi={MAIN:"schedule.cloud-rtc.com",BACKUP:"schedule.cloud-rtc.net",MAIN_OVERSEA:"schedule.rtc-web.com",BACKUP_OVERSEA:"schedule.rtc-web.io",MAIN_OVERSEA_BACKUP:"intl-schedule.cloud-rtc.com"},x_=2e3,L_={TRTC:"TRTC",CLIENT:"Client",LOCAL_STREAM:"LocalStream",REMOTE_STREAM:"RemoteStream",STREAM:"Stream"},yr=5,br="default",Rs=br,P_="communications",V_=Object.keys(xt),Td=["normal leave","timeout leave","kick","role change"],uo=10,ho=2e3,qn=["width","height","frameRate","facingMode","sampleRate","sampleSize","channelCount","deviceId","min","max"],ys=10*1e3;var U_=function(o,i,e,t){function r(s){return s instanceof e?s:new e(function(n){n(s)})}return new(e||(e=Promise))(function(s,n){function a(u){try{l(t.next(u))}catch(h){n(h)}}function c(u){try{l(t.throw(u))}catch(h){n(h)}}function l(u){u.done?s(u.value):r(u.value).then(a,c)}l((t=t.apply(o,i||[])).next())})},Sd=Symbol(32),Id=Symbol(16),Ad=Symbol(8),oi=class{constructor(i){this.g=i,this.consumed=0,i&&(this.need=i.next().value)}setG(i){this.g=i,this.demand(i.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(i,e){return e&&this.consume(),this.need=i,this.flush()}read(i){return U_(this,void 0,void 0,function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise((e,t)=>{var r;this.reject=t,this.resolve=n=>{delete this.lastReadPromise,delete this.resolve,delete this.need,e(n)},this.demand(i,!0)||(r=this.pull)===null||r===void 0||r.call(this,i)})})}readU32(){return this.read(Sd)}readU16(){return this.read(Id)}readU8(){return this.read(Ad)}close(){var i;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),(i=this.reject)===null||i===void 0||i.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let i=null,e=this.buffer.subarray(this.consumed),t=0,r=s=>e.length<(t=s);if(typeof this.need=="number"){if(r(this.need))return;i=e.subarray(0,t)}else if(this.need===Sd){if(r(4))return;i=e[0]<<24|e[1]<<16|e[2]<<8|e[3]}else if(this.need===Id){if(r(2))return;i=e[0]<<8|e[1]}else if(this.need===Ad){if(r(1))return;i=e[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(r(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(e.subarray(0,t)),i=this.need}else if(this.g){this.g.throw(new Error("Unsupported type"));return}}else{if(r(this.need.byteLength))return;new Uint8Array(this.need).set(e.subarray(0,t)),i=this.need}return this.consumed+=t,this.g?this.demand(this.g.next(i).value,!0):this.resolve&&this.resolve(i),i}write(i){if(i instanceof Uint8Array?this.malloc(i.length).set(i):"buffer"in i?this.malloc(i.byteLength).set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)):this.malloc(i.byteLength).set(new Uint8Array(i)),this.g||this.resolve)this.flush();else return new Promise(e=>this.pull=e)}writeU32(i){this.malloc(4).set([i>>24&255,i>>16&255,i>>8&255,i&255]),this.flush()}writeU16(i){this.malloc(2).set([i>>8&255,i&255]),this.flush()}writeU8(i){this.malloc(1)[0]=i,this.flush()}malloc(i){if(this.buffer){let e=this.buffer.length,t=e+i;if(t<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,t);else{let r=new Uint8Array(t);r.set(this.buffer),this.buffer=r}return this.buffer.subarray(e,t)}else return this.buffer=new Uint8Array(i),this.buffer}};oi.U32=Sd;oi.U16=Id;oi.U8=Ad;var B_=128,F_=127,BS=~F_,FS=Math.pow(2,31);function Cd(o){let i=new oi;for(;o>=128;)i.malloc(1)[0]=o&255|B_,o>>>=7;return i.malloc(1)[0]=o&255,i.buffer||new Uint8Array(0)}function jn(o,i=0){let e=new oi,t=i<<3;switch(typeof o){case"boolean":let r=e.malloc(2);r[0]=t,r[1]=o?1:0;break;case"number":e.malloc(1)[0]=t,e.write(Cd(o));break;case"string":e.malloc(1)[0]=t|2;let s=new TextEncoder().encode(o);e.write(Cd(s.length));let n=e.malloc(s.length);for(let c=0;c<s.length;c++)n[c]=s[c];break;case"object":let a=new oi;if(Array.isArray(o))for(let c=0;c<o.length;c++){let l=jn(o[c],c+1);l&&a.write(l)}else{let c=1;for(let l in o){let u=jn(o[l],c++);u&&a.write(u)}}i===0?a.buffer&&e.write(a.buffer):(e.malloc(1)[0]=t|2,a.buffer&&(e.write(Cd(a.buffer.length)),e.write(a.buffer)))}return e.buffer||new Uint8Array(0)}var bs=class{constructor(){d(this,"buffer");this.buffer=[]}get data(){return this.buffer}get length(){return this.buffer.length}writeInt32(i){this.buffer.push(i>>>24&255),this.buffer.push(i>>>16&255),this.buffer.push(i>>>8&255),this.buffer.push(i&255)}writeInt16(i){this.buffer.push(i>>>8&255),this.buffer.push(i&255)}writeByte(i){this.buffer.push(i&255)}writeBytes(i){for(let e=0;e<i.length;e++)this.buffer.push(i[e])}};function Rd(o,i,e){o[e]=i>>>24&255,o[e+1]=i>>>16&255,o[e+2]=i>>>8&255,o[e+3]=i&255}function Xe(o,i){return o[i]<<24|o[i+1]<<16|o[i+2]<<8|o[i+3]}function yd(o,i){return o[i]}function mo(o,i,e){return new TextDecoder().decode(H_(o,i,e))}function H_(o,i,e){return o.slice(i,i+e)}var bd=0,Xn=2654435769,zn=16,vd=4,po=2,fo=7;function $_(o,i,e,t="AVQualityReportSvc.C2S",r=2e3,s=2,n=30){return{version:r,encryption:s,d2:"",d2Len:0,uinType:n,uin:"",uinLen:0,reqHead:{seqNumber:e,appId:o,appidAtThird:new Uint8Array(0),a2:"",a2Len:0,serviceCmd:t,serviceCmdLen:0,cookie:"",cookieLen:0,imei:"",imeiLen:0,ksid:"",ksidLen:0,clientVersionInfo:"",clientVersionInfoLen:0},busiBuff:i}}function Vh(o,i){let e=new bs,t=$_(i,o,bd);bd=bd+1&2147483647,e.writeInt32(0),e.writeInt32(t.version),e.writeByte(t.encryption);let r=new TextEncoder().encode(t.d2);e.writeInt32(r.length+4),r&&e.writeBytes(r),e.writeByte(t.uinType);let s=new TextEncoder().encode(t.uin);e.writeInt32(s.length+4),s.length&&e.writeBytes(s);let n=new bs;n.writeInt32(0),n.writeInt32(t.reqHead.seqNumber),n.writeInt32(t.reqHead.appId),n.writeByte(t.reqHead.appId>>>24&255),n.writeByte(t.reqHead.appId>>>16&255),n.writeByte(t.reqHead.appId>>>8&255),n.writeByte(t.reqHead.appId&255);for(let K=4;K<16;K++)n.writeByte(0);let a=new TextEncoder().encode(t.reqHead.a2);n.writeInt32(a.length+4),a.length&&n.writeBytes(a);let c=new TextEncoder().encode(t.reqHead.serviceCmd);n.writeInt32(c.length+4),c.length&&n.writeBytes(c);let l=new TextEncoder().encode(t.reqHead.cookie);n.writeInt32(l.length+4),l.length&&n.writeBytes(l);let u=new TextEncoder().encode(t.reqHead.imei);n.writeInt32(u.length+4),u.length&&n.writeBytes(u);let h=new TextEncoder().encode(t.reqHead.ksid);n.writeInt32(h.length+4),h.length&&n.writeBytes(h);let m=new TextEncoder().encode(t.reqHead.clientVersionInfo);n.writeInt16(m.length+2),m.length&&n.writeBytes(m);let g=n.length;n.data[0]=g>>>24&255,n.data[1]=g>>>16&255,n.data[2]=g>>>8&255,n.data[3]=g&255,te(o)&&(o=new TextEncoder().encode(o)),n.writeInt32(o.length+4),o.length&&n.writeBytes(o);let S=new Uint8Array(n.data),_=null;t.encryption===1?_=new TextEncoder().encode(t.uin):t.encryption===2&&(_=new Uint8Array(16)),_&&(S=G_(S,_)),e.writeBytes(S);let I=new Uint8Array(e.data),R=I.length;return I[0]=R>>>24&255,I[1]=R>>>16&255,I[2]=R>>>8&255,I[3]=R&255,I}function G_(o,i){let e=o.length,r=(e+1+po+fo)%8;r&&(r=8-r);let s=e+1+po+fo+r,n=new Uint8Array(s),a=0,c=new Uint8Array(8),l=new Uint8Array(8),u=new Uint8Array(8),h=0;c[0]=Math.floor(Math.random()*256)&248|r,h=1;for(let g=0;g<r;g++)c[h]=Math.floor(Math.random()*256)&255,h+=1;for(let g=0;g<po;)if(h<8&&(c[h]=Math.floor(Math.random()*256)&255,h+=1,g+=1),h===8){Nd(c,i,l,u,n,a),a+=8,h=0;for(let S=0;S<8;S++)u[S]=n[a-8+S]}let m=0;for(;m<e;)if(h<8&&(c[h]=o[m],h+=1,m+=1),h===8){Nd(c,i,l,u,n,a),a+=8,h=0;for(let g=0;g<8;g++)u[g]=n[a-8+g]}for(let g=0;g<fo;)if(h<8&&(c[h]=0,h+=1,g+=1),h===8){Nd(c,i,l,u,n,a),a+=8,h=0;for(let S=0;S<8;S++)u[S]=n[a-8+S]}return n}function Nd(o,i,e,t,r,s){for(let n=0;n<8;n++)o[n]^=t[n];W_(o,i,r,s);for(let n=0;n<8;n++)r[s+n]^=e[n];for(let n=0;n<8;n++)e[n]=o[n]}function W_(o,i,e,t){let r=Xe(o,0),s=Xe(o,4),n=[];for(let c=0;c<4;c++)n[c]=Xe(i,c*4);let a=0;for(let c=0;c<zn;c++)a+=Xn,a=a>>>0,r+=(s<<4)+n[0]^s+a^(s>>>5)+n[1],r=r>>>0,s+=(r<<4)+n[2]^r+a^(r>>>5)+n[3],s=s>>>0;Rd(e,r,t),Rd(e,s,t+4)}var Bh=function(){return new URLSearchParams(location.search).get("trtc_env")||""},ki=o=>Number(o)<14e8,wi=function(o,i){let e;Ss?e=Ss:e=ki(o)?cd:ad;let t=Math.floor(Math.random()*or(2,31));return`${e}/v5/AVQualityReportSvc/C2S?random=${t}&sdkappid=${o}&cmdtype=${i}`},Ns="unknown";function Dd(){if(Ns!=="unknown")return Ns;let{userAgent:o,connection:i}=navigator,e=(o.match(/NetType\/\S+/)||[])[0]||"";e=e.toLowerCase().replace("nettype/",""),e==="3gnet"&&(e="3g");let t=i&&i.type&&i.type.toLowerCase(),r=i&&i.effectiveType&&i.effectiveType.toLowerCase();return r==="slow-2"&&(r="2g"),t&&(Ns=Fh(t,r)),Ns}function Fh(o,i){if(Un[o])return o;switch(o){case"cellular":case"wimax":return i||"unknown";case"ethernet":return"wired";case"none":case"other":default:return"unknown"}}function Yn(o){Ns=Fh(o)}function vr(){return Un[Dd()]}function Hh(o,i){for(let e of Reflect.ownKeys(i))if(e!=="constructor"&&e!=="prototype"&&e!=="name"){let t=Object.getOwnPropertyDescriptor(i,e)||"";Object.defineProperty(o,e,t)}return o}function $h(o,i=48e3){return Md(o/4,i)}function Md(o,i=48e3){return o*1e3/i}function Gh(o,i=48e3){return Od(o,i)*4}function Od(o,i=48e3){return o*i/1e3}var kd=typeof window!="undefined"&&typeof window.glog=="function"?window.glog:()=>{},Vt=()=>{let o=navigator.language;return o=o.substring(0,2),o==="zh"},ze=function(o){if(!o||typeof o!="object"||Object.prototype.toString.call(o)!="[object Object]")return!1;let i=Object.getPrototypeOf(o);if(i===null)return!0;let e=Object.prototype.hasOwnProperty.call(i,"constructor")&&i.constructor;return typeof e=="function"&&e instanceof e&&Function.prototype.toString.call(e)===Function.prototype.toString.call(Object)};function Dr(o,i=1,e=1){return o<=1?e:Dr(o-1,e,i+e)}function Ut(o){return o>8?30*1e3:Dr(o)*1e3}function Re(o){return Reflect.apply(Object.prototype.toString,o,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}var ae=o=>typeof o=="function",T=o=>typeof o=="undefined",te=o=>typeof o=="string",q=o=>typeof o=="number",de=o=>typeof o=="boolean",pt=o=>Re(o)==="object",Se=o=>Re(o)==="array",Wh=o=>Re(o)==="MediaStreamTrack".toLowerCase(),Jh=o=>o.isRemote,lr=o=>Re(o)==="promise",Mr=o=>ae(o)&&o.prototype.constructor===o,_o=o=>Mr(o)?o.prototype.constructor.name:"",qh=typeof AudioWorkletNode!="undefined";function Or(o){return new Promise((i,e)=>{let t=[];o.forEach(r=>{r.then(i).catch(s=>{t.push(s),t.length===o.length&&e(t)})})})}function P(){return!performance||!performance.now?Date.now():Math.floor(performance.now())}var Uh=o=>+o<10?`0${o}`:o,jh=o=>{let i=o.match(/^\d+\.\d+\.\d+/)[0];if(!i)return o;let e=i.split("."),t=Uh(e[1])+Uh(e[2]);return e[1]-15>0&&(e[1]="15"),e[2]-15>0&&(e[2]="15"),`${e.join(".")}.${t}`},J_=Object.prototype.hasOwnProperty,{toString:ZS}=Object.prototype;function go(o){if(o==null)return!0;if(typeof o=="boolean")return!1;if(typeof o=="number")return o===0;if(typeof o=="string"||typeof o=="function"||Array.isArray(o))return o.length===0;if(o instanceof Error)return o.message==="";if(ze(o))switch(Object.prototype.toString.call(o)){case"[object File]":case"[object Map]":case"[object Set]":return o.size===0;case"[object Object]":{for(let i in o)if(J_.call(o,i))return!1;return!0}}return!1}function xi(o,i){return{userId:i,hasAudio:!!(o&cr),hasVideo:!!(o&ar),hasAuxiliary:!!(o&Cr),hasSmall:!!(o&Is),audioMuted:!!(o&Gn),videoMuted:!!(o&Wn),audioAvailable:!!(o&cr)&&!(o&Gn),videoAvailable:!!(o&ar)&&!(o&Wn)}}function Xh(o){let i={urls:o.url.startsWith("turn:")||o.url.startsWith("turns:")?o.url:`turn:${o.url}`};return!T(o.username)&&!T(o.credential)&&(i.username=o.username,i.credential=o.credential,i.credentialType="password",T(o.credentialType)||(i.credentialType=o.credentialType)),i}function To(o,i=!0){if(!te(o))return 0;let e=o.split(".");return i?(Number(e[0])<<24|Number(e[1])<<16|Number(e[2])<<8|Number(e[3]))>>>0:(Number(e[3])<<24|Number(e[2])<<16|Number(e[1])<<8|Number(e[0]))>>>0}var Bt=function(o,i,e,t){if(!(pt(o)&&pt(i)))return 0;let r=0,s=Object.keys(i),n;for(let a=0,c=s.length;a<c;a++)if(n=s[a],!(T(i[n])||e&&e.includes(n)))if(pt(o[n])&&pt(i[n]))r+=Bt(o[n],i[n],e,t);else{if(t&&t.includes(i[n]))continue;o[n]!==i[n]&&(o[n]=Nr(i[n]),r+=1)}return r};function Nr(o){if(Se(o)){let i=[];return o.forEach((e,t)=>{i[t]=Nr(e)}),i}if(pt(o)){let i={};return Object.keys(o).forEach(e=>{i[e]=Nr(o[e])}),i}return o}var Eo=o=>{let i=[];if(Se(o))i=[...o];else if(te(o)){let e=document.getElementById(o);e&&i.push(e)}else o&&i.push(o);return i},zh=o=>te(o)?document.getElementById(o):o,q_=o=>{let i=c=>c<10?`0${c}`:`${c}`,e=o.getFullYear(),t=o.getMonth()+1,r=o.getDate(),s=i(o.getHours()),n=i(o.getMinutes()),a=i(o.getSeconds());return`${e}/${t}/${r} ${s}:${n}:${a}`},Qh=()=>q_(new Date);function Rt(o,{keysToInclude:i,keysToExclude:e}){try{if(Se(o))return`[${o.map(n=>Rt(n,{keysToInclude:i,keysToExclude:e})).join(",")}]`;if(!ze(o)||!Se(i)&&!Se(e))return JSON.stringify(o);let t={},r=new Set(i),s=new Set(e);return Object.keys(o).forEach(n=>{(s.size===0&&r.has(n)||r.size===0&&!s.has(n))&&(t[n]=ze(o[n])||Se(o[n])?JSON.parse(Rt(o[n],{keysToExclude:e,keysToInclude:i})):o[n])}),JSON.stringify(t)}catch(t){return"{}"}}function vs(o,i=!1){let e=[];return Object.keys(o).forEach(t=>{i===o[t]&&e.push(t)}),Rt(o,{keysToInclude:e})}function Ds(o){return o.replace(/[\u4e00-\u9fa5]/g,"aa").length}var wd=()=>{var o,i,e,t;return(o=window.screen)!=null&&o.orientation?!!((t=(e=(i=window.screen)==null?void 0:i.orientation)==null?void 0:e.type)!=null&&t.includes("portrait")):window.orientation===0||window.orientation===180},So=o=>f(void 0,null,function*(){return new Promise((i,e)=>{let t;if(te(o))t=new Image,t.crossOrigin="anonymous",t.src=o;else if(t=o,t.complete){i(t);return}t.onload=()=>i(t),t.onerror=()=>{e(new v({code:A.INVALID_PARAMETER,message:`load image failed, url: ${o}`}))}})}),Zn=o=>{let i=o.split(".");return+i[0]<<24|+i[1]<<16|+i[2]<<8|+i[3]<<0},Ms=o=>(Object.keys(o).forEach(i=>