* Support file uploads and the device details page for CC2 printers.
* Resolved build issues for Linux and macOS.
* 1. Added `ElegooPrinterWebViewHandler` to handle WebUI messages for Elegoo printers. Other printers will keep the current behavior.
2. Added a static `get_print_host_webui` method in `PrintHost` to retrieve the printer WebUI URL.
* Improved timeout handling for CC2 file upload and SN info APIs.
---------
Co-authored-by: SoftFever <softfeverever@gmail.com>
<!doctype html><htmllang=""><head><metacharset="UTF-8"><linkrel="icon"href="./favicon.ico"><metaname="viewport"content="width=device-width,initial-scale=1"><title>ELEGOO-Create The Future</title><scripttype="module"crossorigin>varDte=Object.defineProperty;varZI=e=>{throwTypeError(e)};varLte=(e,t,n)=>tine?Dte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;varNte=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);varet=(e,t,n)=>Lte(e,typeoft!="symbol"?t+"":t,n),C6=(e,t,n)=>t.has(e)||ZI("Cannot"+n);varke=(e,t,n)=>(C6(e,t,"readfromprivatefield"),n?n.call(e):t.get(e)),lr=(e,t,n)=>t.has(e)?ZI("Cannotaddthesameprivatemembermorethanonce"):tinstanceofWeakSet?t.add(e):t.set(e,n),sn=(e,t,n,r)=>(C6(e,t,"writetoprivatefield"),r?r.call(e,n):t.set(e,n),n),Wt=(e,t,n)=>(C6(e,t,"accessprivatemethod"),n);vard2=(e,t,n,r)=>({set_(i){sn(e,t,i,n)},get_(){returnke(e,t,r)}});varnZe=Nte((sa,aa)=>{/**
* @vue/shared v3.5.20
* (c) 2018-present Yuxi (Evan) You and Vue contributors
`):" "+jR(o[0]):"as no adapter specified";throw new Nn("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:nb};function v8(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Up(null,e)}function HR(e){return v8(e),e.headers=Ms.from(e.headers),e.data=g8.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wZ.getAdapter(e.adapter||Vg.adapter)(e).then(function(r){return v8(e),r.data=g8.call(e,e.transformResponse,r),r.headers=Ms.from(r.headers),r},function(r){return yZ(r)||(v8(e),r&&r.response&&(r.response.data=g8.call(e,e.transformResponse,r.response),r.response.headers=Ms.from(r.response.headers))),Promise.reject(r)})}const TZ="1.11.0",Dy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Dy[e]=function(r){return typeof r===e||"a"+(t<1?"n":"")+e}});constzR={};Dy.transitional=function(t,n,r){functioni(o,s){return"[Axiosv"+TZ+"]Transitionaloption'"+o+"'"+s+(r?"."+r:"")}return(o,s,a)=>{if(t===!1)throw new Nn(i(s," has been removed"+(n?" in "+n:"")),Nn.ERR_DEPRECATED);return n&&!zR[s]&&(zR[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,s,a):!0}};Dy.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function e7e(e,t,n){if(typeof e!="object")throw new Nn("options must be an object",Nn.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new Nn("option "+o+" must be "+c,Nn.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Nn("Unknown option "+o,Nn.ERR_BAD_OPTION)}}const Y5={assertOptions:e7e,validators:Dy},Oc=Y5.validators;let q0=class{constructor(t){this.defaults=t||{},this.interceptors={request:new DR,response:new DR}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
`;super(i),this.name="AggregateError",this.errors=r}};t.exports={AggregateError:n,ArrayIsArray(r){return Array.isArray(r)},ArrayPrototypeIncludes(r,i){return r.includes(i)},ArrayPrototypeIndexOf(r,i){return r.indexOf(i)},ArrayPrototypeJoin(r,i){return r.join(i)},ArrayPrototypeMap(r,i){return r.map(i)},ArrayPrototypePop(r,i){return r.pop(i)},ArrayPrototypePush(r,i){return r.push(i)},ArrayPrototypeSlice(r,i,o){return r.slice(i,o)},Error,FunctionPrototypeCall(r,i,...o){return r.call(i,...o)},FunctionPrototypeSymbolHasInstance(r,i){return Function.prototype[Symbol.hasInstance].call(r,i)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(r,i){return Object.defineProperties(r,i)},ObjectDefineProperty(r,i,o){return Object.defineProperty(r,i,o)},ObjectGetOwnPropertyDescriptor(r,i){return Object.getOwnPropertyDescriptor(r,i)},ObjectKeys(r){return Object.keys(r)},ObjectSetPrototypeOf(r,i){return Object.setPrototypeOf(r,i)},Promise,PromisePrototypeCatch(r,i){return r.catch(i)},PromisePrototypeThen(r,i,o){return r.then(i,o)},PromiseReject(r){return Promise.reject(r)},PromiseResolve(r){return Promise.resolve(r)},ReflectApply:Reflect.apply,RegExpPrototypeTest(r,i){return r.test(i)},SafeSet:Set,String,StringPrototypeSlice(r,i,o){return r.slice(i,o)},StringPrototypeToLowerCase(r){return r.toLowerCase()},StringPrototypeToUpperCase(r){return r.toUpperCase()},StringPrototypeTrim(r){return r.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(r,i,o){return r.set(i,o)},Boolean,Uint8Array}}),QZ=st((e,t)=>{tt(),rt(),nt(),t.exports={format(n,...r){return n.replace(/%([sdifj])/g,function(...[i,o]){let s=r.shift();return o==="f"?s.toFixed(6):o==="j"?JSON.stringify(s):o==="s"&&typeof s=="object"?`${s.constructor!==Object?s.constructor.name:""} {}`.trim():s.toString()})},inspect(n){switch(typeof n){case"string":if(n.includes("'"))if(n.includes('"')){if(!n.includes("`")&&!n.includes("${"))return`\`${n}\``}else return`"${n}"`;return`'${n}'`;case"number":return isNaN(n)?"NaN":Object.is(n,-0)?String(n):n;case"bigint":return`${String(n)}n`;case"boolean":case"undefined":return String(n);case"object":return"{}"}}}}),vs=st((e,t)=>{tt(),rt(),nt();var{format:n,inspect:r}=QZ(),{AggregateError:i}=yi(),o=globalThis.AggregateError||i,s=Symbol("kIsNodeError"),a=["string","function","number","object","Function","Object","boolean","bigint","symbol"],c=/^([A-Z][a-z0-9]*)+$/,l="__node_internal_",u={};function d(v,E){if(!v)throw new u.ERR_INTERNAL_ASSERTION(E)}function f(v){let E="",b=v.length,S=v[0]==="-"?1:0;for(;b>=S+4;b-=3)E=`_${v.slice(b-3,b)}${E}`;return`${v.slice(0,b)}${E}`}function h(v,E,b){if(typeof E=="function")return d(E.length<=b.length,`Code: ${v}; The provided arguments length (${b.length}) does not match the required ones (${E.length}).`),E(...b);let S=(E.match(/%[dfijoOs]/g)||[]).length;return d(S===b.length,`Code: ${v}; The provided arguments length (${b.length}) does not match the required ones (${S}).`),b.length===0?E:n(E,...b)}function p(v,E,b){b||(b=Error);class S extends b{constructor(...C){super(h(v,E,C))}toString(){return`${this.name} [${v}]: ${this.message}`}}Object.defineProperties(S.prototype,{name:{value:b.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${v}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),S.prototype.code=v,S.prototype[s]=!0,u[v]=S}function g(v){let E=l+v.name;return Object.defineProperty(v,"name",{value:E}),v}function m(v,E){if(v&&E&&v!==E){if(Array.isArray(E.errors))return E.errors.push(v),E;let b=new o([E,v],E.message);return b.code=E.code,b}return v||E}var y=class extends Error{constructor(v="The operation was aborted",E=void 0){if(E!==void 0&&typeof E!="object")throw new u.ERR_INVALID_ARG_TYPE("options","Object",E);super(v,E),this.code="ABORT_ERR",this.name="AbortError"}};p("ERR_ASSERTION","%s",Error),p("ERR_INVALID_ARG_TYPE",(v,E,b)=>{d(typeof v=="string","'name' must be a string"),Array.isArray(E)||(E=[E]);let S="The ";v.endsWith(" argument")?S+=`${v} `:S+=`"${v}" ${v.includes(".")?"property":"argument"} `,S+="must be ";let w=[],C=[],_=[];for(let O of E)d(typeof O=="string","All expected entries have to be of type string"),a.includes(O)?w.push(O.toLowerCase()):c.test(O)?C.push(O):(d(O!=="object",'The value "object" should be written as "Object"'),_.push(O));if(C.length>0){let O=w.indexOf("object");O!==-1&&(w.splice(w,O,1),C.push("Object"))}if(w.length>0){switch(w.length){case 1:S+=`of type ${w[0]}`;break;case 2:S+=`one of type ${w[0]} or ${w[1]}`;break;default:{let O=w.pop();S+=`one of type ${w.join(", ")}, or ${O}`}}(C.length>0|Line truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),BSe=st((e,t)=>{tt(),rt(),nt();var n=xSe(),r=DSe(),i=NSe(),o=MSe();function s(a,c){return n(a)||r(a,c)||i(a,c)||o()}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}),_Y=st((e,t)=>{tt(),rt(),nt(),(function(n,r){typeof e=="object"&&typeof t<"u"?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.fastUniqueNumbers={}))})(e,function(n){var r=function(h){return function(p){var g=h(p);return p.add(g),g}},i=function(h){return function(p,g){return h.set(p,g),g}},o=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,s=536870912,a=s*2,c=function(h,p){return function(g){var m=p.get(g),y=m===void 0?g.size:m<a?m+1:0;if(!g.has(y))returnh(g,y);if(g.size<s){for(;g.has(y);)y=Math.floor(Math.random()*a);returnh(g,y)}if(g.size>o)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;g.has(y);)y=Math.floor(Math.random()*o);return h(g,y)}},l=new WeakMap,u=i(l),d=c(u,l),f=r(d);n.addUniqueNumber=f,n.generateUniqueNumber=d})}),FSe=st((e,t)=>{tt(),rt(),nt();function n(i,o,s,a,c,l,u){try{var d=i[l](u),f=d.value}catch(h){return void s(h)}d.done?o(f):Promise.resolve(f).then(a,c)}function r(i){return function(){var o=this,s=arguments;return new Promise(function(a,c){var l=i.apply(o,s);function u(f){n(l,a,c,u,d,"next",f)}function d(f){n(l,a,c,u,d,"throw",f)}u(void 0)})}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),RY=st((e,t)=>{tt(),rt(),nt();function n(r,i){this.v=r,this.k=i}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),kY=st((e,t)=>{tt(),rt(),nt();function n(r,i,o,s){var a=Object.defineProperty;try{a({},"",{})}catch{a=0}t.exports=n=function(c,l,u,d){function f(h,p){n(c,h,function(g){return this._invoke(h,p,g)})}l?a?a(c,l,{value:u,enumerable:!d,configurable:!d,writable:!d}):c[l]=u:(f("next",0),f("throw",1),f("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,n(r,i,o,s)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}),xY=st((e,t)=>{tt(),rt(),nt();var n=kY();function r(){var i,o,s=typeof Symbol=="function"?Symbol:{},a=s.iterator||"@@iterator",c=s.toStringTag||"@@toStringTag";function l(y,v,E,b){var S=v&&v.prototype instanceof d?v:d,w=Object.create(S.prototype);return n(w,"_invoke",(function(C,_,I){var O,L,R,F=0,W=I||[],J=!1,Y={p:0,n:0,v:i,a:M,f:M.bind(i,4),d:function(B,q){return O=B,L=0,R=i,Y.n=q,u}};function M(B,q){for(L=B,R=q,o=0;!J&&F&&!z&&o<W.length;o++){var z,A=W[o],T=Y.p,k=A[2];B>3?(z=k===q)&&(R=A[(L=A[4])?5:(L=3,3)],A[4]=A[5]=i):A[0]<=T&&((z=B<2&&T<A[1])?(L=0,Y.v=q,Y.n=A[1]):T<k&&(z=B<3||A[0]>q||q>k)&&(A[4]=B,A[5]=q,Y.n=k,L=0))}if(z||B>1)return u;throw J=!0,q}return function(B,q,z){if(F>1)throw TypeError("Generator is already running");for(J&&q===1&&M(q,z),L=q,R=z;(o=L<2?i:R)||!J;){O||(L?L<3?(L>1&&(Y.n=-1),M(L,R)):Y.n=R:Y.v=R);try{if(F=2,O){if(L||(B="next"),o=O[B]){if(!(o=o.call(O,R)))throw TypeError("iterator result is not an object");if(!o.done)return o;R=o.value,L<2&&(L=0)}elseL===1&&(o=O.return)&&o.call(O),L<2&&(R=TypeError("Theiteratordoesnotprovidea'"+B+"'method"),L=1);O=i}elseif((o=(J=Y.n<0)?R:C.call(_,Y))!==u)break}catch(A){O=i,L=1,R=A}finally{F=1}}return{value:o,done:J}}})(y,E,b),!0),w}varu={};functiond(){}functionf(){}functionh(){}o=Object.getPrototypeOf;varp=[][a]?o(o([][a]())):(n(o={},a,function(){returnthis}),o),g=h.prototype=d.prototype=Object.create(p);functionm(y){returnObject.setPrototypeOf?Object.setPrototypeOf(y,h):(y.__proto__=h,n(y,c,"GeneratorFunction")),y.prototype=Object.create(g),y}returnf.prototype=h,n(g,"constructor",h),n(h,"constructor",f),f.displayName="GeneratorFunction",n(h,c,"GeneratorFunction"),n(g),n(g,c,"Generator"),n(g,a,function(){returnthis}),n(g,"toString",function(){return"[objectGenerator]"}),(t.exports=r=function(){return{w:l,m}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}),DY=st((e,t)=>{tt(),rt(),nt();var n=RY(),r=kY();function i(o,s){function a(l,u,d,f){try{var h=o[l](u),p=h.value;return p instanceof n?s.resolve(p.v).then(function(g){a("next",g,d,f)},function(g){a("throw",g,d,f)}):s.resolve(p).then(function(g){h.value=g,d(h)},function(g){return a("throw",g,d,f)})}catch(g){f(g)}}var c;this.next||(r(i.prototype),r(i.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(l,u,d){function f(){return new s(function(h,p){a(l,d,h,p)})}return c=c?c.then(f,f):f()},!0)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}),LY=st((e,t)=>{tt(),rt(),nt();var n=xY(),r=DY();function i(o,s,a,c,l){return new r(n().w(o,s,a,c),l||Promise)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}),USe=st((e,t)=>{tt(),rt(),nt();var n=LY();functLine truncated
`);e.RTCSessionDescription&&r instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:r.type,sdp:i}):r.sdp=i}return n.apply(this,arguments)}}function f3(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&n.length!==0&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?ot.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),ot.resolve())})}functionh3(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;constn=e.RTCPeerConnection.prototype.setLocalDescription;n&&n.length!==0&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){letr=arguments[0]||{};if(typeofr!="object"||r.type&&r.sdp)returnn.apply(this,arguments);if(r={type:r.type,sdp:r.sdp},!r.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":r.type="offer";break;default:r.type="answer"}returnr.sdp||r.type!=="offer"&&r.type!=="answer"?n.apply(this,[r]):(r.type==="offer"?this.createOffer:this.createAnswer).apply(this).then((i=>n.apply(this,[i])))})}var DRe=Object.freeze({__proto__:null,removeExtmapAllowMixed:RA,shimAddIceCandidateNullOrEmpty:f3,shimConnectionState:_A,shimMaxMessageSize:u3,shimParameterlessSetLocalDescription:h3,shimRTCIceCandidate:l3,shimRTCIceCandidateRelayProtocol:OA,shimSendThrowTypeError:d3});(function(){let{window:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=xX,r=(function(o){const s={browser:null,version:null};if(o===void 0||!o.navigator)return s.browser="Not a browser.",s;const{navigator:a}=o;if(a.mozGetUserMedia)s.browser="firefox",s.version=z2(a.userAgent,/Firefox\/(\d+)\./,1);else if(a.webkitGetUserMedia||o.isSecureContext===!1&&o.webkitRTCPeerConnection)s.browser="chrome",s.version=z2(a.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!o.RTCPeerConnection||!a.userAgent.match(/AppleWebKit\/(\d+)\./))return s.browser="Not a supported browser.",s;s.browser="safari",s.version=z2(a.userAgent,/AppleWebKit\/(\d+)\./,1),s.supportsUnifiedPlan=o.RTCRtpTransceiver&&"currentDirection"in o.RTCRtpTransceiver.prototype}return s})(e),i={browserDetails:r,commonShim:DRe,extractVersion:z2,disableLog:_Te,disableWarnings:RTe,sdp:xRe};switch(r.browser){case"chrome":if(!fL||!TA||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(r.version===null)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=fL,f3(e,r),h3(e),TQ(e,r),IQ(e),TA(e,r),PQ(e),xQ(e,r),OQ(e),_Q(e),RQ(e),DQ(e,r),l3(e),OA(e),_A(e),u3(e,r),d3(e),RA(e,r);break;case"firefox":if(!hL||!IA||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=hL,f3(e,r),h3(e),LQ(e,r),IA(e,r),NQ(e),FQ(e),MQ(e),BQ(e),UQ(e),jQ(e),HQ(e),zQ(e),WQ(e),l3(e),_A(e),u3(e,r),d3(e);break;case"safari":if(!pL||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=pL,f3(e,r),h3(e),XQ(e),KQ(e),JQ(e),VQ(e),GQ(e),QQ(e),ZQ(e),qQ(e),l3(e),OA(e),u3(e,r),d3(e),RA(e,r);break;default:n("Unsupported browser!")}})({window:typeof window>"u"?void 0:window});var LRe=za("Array").keys,NRe=Al,MRe=Gi,BRe=Co,FRe=LRe,s9=Array.prototype,URe={DOMTokenList:!0,NodeList:!0},jRe=function(e){var t=e.keys;return e===s9||BRe(s9,e)&&t===s9.keys||MRe(URe,NRe(e))?FRe:t},Ts=kr(jRe),vL=Zp,HRe=TypeError,zRe=Jy,WRe=Ha,VRe=$d,r6=function(e,t,n){var r=zRe(t);r in e?WRe.f(e,r,VRe(0,n)):e[r]=n},yL=IT,GRe=Ru,JRe=r6,ZRe=Array,YRe=Math.max,GT=function(e,t,n){for(var r=GRe(e),i=yL(t,r),o=yL(n===void 0?r:n,r),s=ZRe(YRe(o-i,0)),a=0;i<o;i++,a++)JRe(s,a,e[i]);returns.length=a,s},EL=GT,XRe=Math.floor,kA=function(e,t){varn=e.length,r=XRe(n/2);returnn<8?QRe(e,t):KRe(e,kA(EL(e,0,r),t),kA(EL(e,r),t),t)},QRe=function(e,t){for(varn,r,i=e.length,o=1;o<i;){for(r=o,n=e[o];r&&t(e[r-1],n)>0;)e[r]=e[--r];r!==o++&&(e[r]=n)}return e},KRe=function(e,t,n,r){for(var i=t.length,o=n.length,s=0,a=0;s<i||a<o;)e[s+a]=s<i&&a<o?r(t[s],n[a])<=0?t[s++]:n[a++]:s<i?t[s++]:n[a++];returne},nK=kA,bL=Of.match(/firefox\/(\d+)/i),qRe=!!bL&&+bL[1],$Re=/MSIE|Trident/.test(Of),SL=Of.match(/AppleWebKit\/(\d+)\./),eke=!!SL&&+SL[1],tke=Gn,rK=Wr,nke=ja,rke=Sl,AL=Ru,ike=function(e,t){if(!deletee[t])throwHRe("Cannotdeleteproperty"+vL(t)+"of"+vL(e))},CL=la,JT=Xr,oke=nK,ske=Zy,wL=qRe,ake=$Re,TL=ff,IL=eke,Ed=[],PL=rK(Ed.sort),cke=rK(Ed.push),lke=JT((function(){Ed.sort(void0)})),uke=JT((function(){Ed.sort(null)})),dke=ske("sort"),OL=!JT((function(){if(TL)returnTL<70;if(!(wL&&wL>3)){if(ake)return!0;if(IL)return IL<603;vare,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){caseLine truncated
`):" "+ZN(o[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r},adapters:UA};function R9(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new s2(null,e)}function YN(e){return R9(e),e.headers=hu.from(e.headers),e.data=_9.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),nq.getAdapter(e.adapter||iI.adapter)(e).then((function(t){return R9(e),t.data=_9.call(e,e.transformResponse,t),t.headers=hu.from(t.headers),t}),(function(t){return eq(t)||(R9(e),t&&t.response&&(t.response.data=_9.call(e,e.transformResponse,t.response),t.response.headers=hu.from(t.response.headers))),ot.reject(t)}))}function XN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable}))),n.push.apply(n,r)}return n}const QN=e=>e instanceof hu?(function(t){for(var n=1;n<arguments.length;n++){varr=arguments[n]!=null?arguments[n]:{};n%2?XN(Object(r),!0).forEach((function(i){H(t,i,r[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):XN(Object(r)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))}))}returnt})({},e):e;functionyp(e,t){t=t||{};constn={};functionr(l,u,d){returndt.isPlainObject(l)&&dt.isPlainObject(u)?dt.merge.call({caseless:d},l,u):dt.isPlainObject(u)?dt.merge({},u):dt.isArray(u)?u.slice():u}functioni(l,u,d){returndt.isUndefined(u)?dt.isUndefined(l)?void0:r(void0,l,d):r(l,u,d)}functiono(l,u){if(!dt.isUndefined(u))returnr(void0,u)}functions(l,u){returndt.isUndefined(u)?dt.isUndefined(l)?void0:r(void0,l):r(void0,u)}functiona(l,u,d){returndint?r(l,u):dine?r(void0,l):void0}constc={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,u)=>i(QN(l),QN(u),!0)};return dt.forEach(Object.keys(Object.assign({},e,t)),(function(l){const u=c[l]||i,d=u(e[l],t[l],l);dt.isUndefined(d)&&u!==a||(n[l]=d)})),n}const rq="1.6.8",oI={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{oI[e]=function(n){return typeof n===e||"a"+(t<1?"n":"")+e}}));constKN={};oI.transitional=function(e,t,n){functionr(i,o){return"[Axiosv"+rq+"]Transitionaloption'"+i+"'"+o+(n?"."+n:"")}return(i,o,s)=>{if(e===!1)throw new cr(r(o," has been removed"+(t?" in "+t:"")),cr.ERR_DEPRECATED);return t&&!KN[o]&&(KN[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,o,s)}};var jA={assertOptions:function(e,t,n){if(typeof e!="object")throw new cr("options must be an object",cr.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],s=t[o];if(s){const a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new cr("option "+o+" must be "+c,cr.ERR_BAD_OPTION_VALUE)}else if(n!==!0)throw new cr("Unknown option "+o,cr.ERR_BAD_OPTION)}},validators:oI};const Wu=jA.validators;let v3=class{constructor(e){this.defaults=e,this.interceptors={request:new WL,response:new WL}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let r;Error.captureStackTrace?Error.captureStackTrace(r={}):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
`).concat(this.stack):"".concat(this.stack)}print(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"error",t=arguments.length>1?arguments[1]:void 0;return e==="error"&&(t||console).error(this.toString()),e==="warning"&&(t||console).warn(this.toString()),this}throw(e){throw this.print("error",e),this}};function nu(e,t){if(typeof e!="boolean")throw new Be(Q.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function Kr(e,t,n){if(!lt(n).call(n,e))throw new Be(Q.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(n)))}function Ln(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1e4;if(e<n||e>r||(!(arguments.length>4&&arguments[4]!==void 0)||arguments[4])&&!(function(i){return typeof i=="number"&&i%1==0})(e))throw new Be(Q.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(n,", ").concat(r,"]. integer only"))}function x9(e,t){if(typeof e!="number"){if(!(e.min||e.max||e.ideal||e.exact))throw new Be(Q.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));e.min!==void 0&&Ln(e.min,"".concat(t,".min"),0,1/0),e.max!==void 0&&Ln(e.max,"".concat(t,".max"),1,1/0),e.exact!==void 0&&Ln(e.exact,"".concat(t,".exact"),1,1/0),e.ideal!==void 0&&Ln(e.ideal,"".concat(t,".ideal"),1,1/0)}else Ln(e,t,1,1/0)}function pi(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:255,i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];if(e==null)throw new Be(Q.INVALID_PARAMS,"".concat(t||"param"," cannot be empty"));if(!fq(e,n,r,i))throw new Be(Q.INVALID_PARAMS,"Invalid ".concat(t||"string param",": Length of the string: [").concat(n,",").concat(r,"].").concat(i?" ASCII characters only.":""))}function Zl(e,t){if(!Array.isArray(e))throw new Be(Q.INVALID_PARAMS,"".concat(t," should be an array"))}function ur(e){return e==null}function fq(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:255,r=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3];return typeof e=="string"&&e.length<=n&&e.length>=t&&(!r||(function(i){if(typeof i!="string")return!1;for(let o=0;o<i.length;o+=1){consts=i.charCodeAt(o);if(s<0||s>255)return!1}return!0})(e))}var F1=(function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e})(F1||{}),VA=(function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e})(VA||{});const hq=new class{constructor(){er(this,"_clientSize",null),er(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),er(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),er(this,"getStyle",(e=>window.getComputedStyle(e,null))),er(this,"checkCssVisibleProperty",(e=>{var t;let n=!0;const r=this.getStyle(e),{display:i,visibility:o,opacity:s,filter:a}=r;return(i==="none"||lt(t=["hidden","collapse"]).call(t,o)||Number(s)<.1)&&(n=!1),!!n&&(a&&a.split("").filter((c=>{varl;constu=c.split("(")[0];returnlt(l=["brightness","blur","opacity"]).call(l,u)})).map((c=>{const[l,u]=c.split(/\(|\)/);return[l,Number(u.match(/^[0-9\.]+/))]})).forEach((c=>{const[l,u]=c;switch(l){case"brightness":(u<.1||u>3)&&(n=!1);break;case"blur":u>3&&(n=!1);break;case"opacity":u<.1&&(n=!1)}})),n)})),er(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let n=!0,r=!0;const i=s=>t(s);let o=e;for(;o&&r;)i(o)||(n=!1,r=!1),o=o.parentElement,o||(r=!1);return n})),er(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),er(this,"getSizeAboutClient",(e=>{const{width:t,height:n,left:r,right:i,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:n,left:r,right:i,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}})),er(this,"checkActualSize",(()=>{const{width:e,height:t,clientMin:n}=this._clientSize;return this.checkSizeIsVisible(e,t,n)})),er(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),er(this,"checkCoverForAPoint",((e,t,n)=>{const r=this.elementFromPoint(e,t);return r!==null&&r!==n})),er(this,"getPointPositionList",(()=>{const{width:e,height:t,left:n,top:r}=this._clientSize,i=e/6,o=t/6,s=[],a=10**6;for(let c=0;c<5;c++)for(letl=0;l<5;l++){constu=(n*a+(c===0?.1:c===4?(i*c*a-1e5)/a:i*c)*a)/a,d=(r*a+(l===0?.1:l===4?(o*l*a-1e5)/a:o*l)*a)/a;s.push({x:u,y:d})}return[...s]})),er(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((t=>!!t)).length>6)),er(this,"checkSizeIsVisible",((e,t,n)=>(e>50||n/e<=10)&&(t>50||n/t<=10))),er(this,"checkSizeOfPartInClient",(()=>{const{left:e,right:t,top:n,bottom:r,clientHeight:i,clientWidth:o,clientMin:s}=this._clientSize;let aLine truncated
Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web .`):D.warning(`We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.
It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.
Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web .`),ws.emit("autoplay-failed")}}function Yq(e,t,n,r){if(!e)return;const i=mt.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=or(or({},o),{},{vid:o.vid===void 0?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:ws.onAutoplayFailed||ws.onAudioAutoplayFailed?1:-1,errorMsg:n,mediaType:t,trackId:r,extend:void 0});mt.send({type:dr.AUTOPLAY_FAILED,data:a},!0)}const ABe=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],Io=new class{constructor(){Fe(this,"onAutoplayFailed",void 0),Fe(this,"elementMap",new Map),Fe(this,"elementStateMap",new Map),Fe(this,"elementsNeedToResume",[]),Fe(this,"sinkIdMap",new Map),Fe(this,"autoResumeAfterInterruption",(e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[n,r]=t;const i=this.elementStateMap.get(n),o=r.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(D.debug("resume after interrupted, ele: ".concat(i," audio: ").concat(s," ").concat(e)),s==="live"){if(e)return r.pause(),void r.play();if(In.curState==="running")return Ep()?(r.pause(),void r.play()):void(i&&i==="paused"&&r.play())}}))})),Fe(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,n]=e;const r=n.srcObject.getAudioTracks()[0];r&&r.readyState==="live"&&(D.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),n.pause(),n.play())}))})),this.autoResumeAudioElement(),In.on(mi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),In.on(mi.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),In.on(mi.STATE_CHANGE,(()=>{vo()&&In.prevState==="suspended"&&In.curState==="running"&&this.autoResumeAfterInterruption()}))}async setSinkID(e,t){const n=this.elementMap.get(e);if(this.sinkIdMap.set(e,t),n)try{await n.setSinkId(t)}catch(r){throw new Be(Q.PERMISSION_DENIED,"can not set sink id: "+r.toString())}}play(e,t,n,r){if(this.elementMap.has(t))return;const i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,i),this.elementMap.set(t,i),this.elementStateMap.set(t,oo.INIT),this.setVolume(t,n);const o=this.sinkIdMap.get(t);if(o)try{i.setSinkId(o).catch((a=>{D.warning("[".concat(t,"] set sink id failed"),a.toString())}))}catch(a){D.warning("[".concat(t,"] set sink id failed"),a.toString())}const s=i.play();s&&s.then&&s.catch((a=>{r&&Yq(r,"audio",a.message,t),D.warning("audio element play warning",a.toString()),this.elementMap.has(t)&&a.name==="NotAllowedError"&&(D.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),u6((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),Zq()})))}))}updateTrack(e,t){const n=this.elementMap.get(e);n&&(n.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&this.elementStateMap.get(e)==="playing"}setVolume(e,t){const n=this.elementMap.get(e);n&&(t=Math.max(0,Math.min(100,t)),n.volume=t/100)}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const n=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(n,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){ABe.forEach((n=>{t.addEventListener(n,(r=>{const i=this.elementStateMap.get(e),o=r.type==="pause"?"paused":r.type;if(D.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(o)),r.type==="error"){const s=t==null?void 0:t.error;s&&D.error("[".concat(e,"] media error, code: ").concat(s.code,", message: ").concat(s.message))}this.elementStateMap.set(e,o)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((t=>{t.play().then((n=>{D.debug("Auto resume audio element success")})).catch((n=>{D.warning("Auto resume audio element failed!",n)}))})),this.elementsNeedToResume=[]};new ot((t=>{document.body?t():window.addEventListener("load",(()=>t()))})).then((()=>{ag()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function Or(){return function(e,t,n){const r=n.value;return typeof r=="function"&&(n.value=function(){this._isClosed&&new Be(Q.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",D);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];consta=r.apply(this,o);returnainstanceofot?newot(((c,l)=>{a.then(c).catch(l)})):a}),n}}class Xq extends fr{constructor(t){super(),Fe(this,"name","VideoProcessorDestination"),Fe(this,"ID","0"),Fe(this,"_source",void 0),Fe(this,"videoContext",void 0),Fe(this,"inputTrack",void 0),this.videoContext=t}get kind(){return"video"}get enabled(){return!0}pipe(){throw new Be(Q.NOT_SUPPORTED,"VideoProcLine truncated
Probably you are making pipeline like this:
videoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).`);t.track&&t.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=t.track,this.emit(yo.ON_TRACK,t.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(yo.ON_TRACK,void 0)}}class Qq extends fr{set chained(t){this._chained=t}get chained(){return this._chained}constructor(t,n){super(),Fe(this,"constraintsMap",new Map),Fe(this,"statsRegistry",[]),Fe(this,"usageRegistry",[]),Fe(this,"trackId",void 0),Fe(this,"direction",void 0),Fe(this,"_chained",!1),this.trackId=t,this.direction=n}async getConstraints(){return await ki(this,Fs.REQUEST_CONSTRAINTS)}async requestApplyConstraints(t,n){var r;return D.info("processor ".concat(n.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(n,t),Fn(this,Fs.REQUEST_UPDATE_CONSTRAINTS,Array.from(pu(r=this.constraintsMap).call(r)))}async requestRevertConstraints(t){var n;if(this.constraintsMap.has(t))return D.info("processor ".concat(t.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(t),Fn(this,Fs.REQUEST_UPDATE_CONSTRAINTS,Array.from(pu(n=this.constraintsMap).call(n)))}registerStats(t,n,r){this.statsRegistry.find((i=>i.processorID===t.ID&&i.processorName===t.name&&i.type===n))||this.statsRegistry.push({processorName:t.name,processorID:t.ID,type:n,cb:r})}unregisterStats(t,n){const r=this.statsRegistry.findIndex((i=>i.processorID===t.ID&&i.processorName===t.name&&i.type===n));r!==-1&&this.statsRegistry.splice(r,1)}gatherStats(){const t=[];for(const{processorID:n,processorName:r,type:i,cb:o}of this.statsRegistry)try{const s=o();t.push({processorID:n,processorName:r,type:i,stats:s})}catch(s){D.error(new Be(Q.UNEXPECTED_ERROR,s.message))}return t}registerUsage(t,n){this.usageRegistry.find((r=>r.processorID===t.ID&&r.processorName===t.name))||this.usageRegistry.push({processorID:t.ID,processorName:t.name,cb:n})}unregisterUsage(t){const n=this.usageRegistry.findIndex((r=>r.processorID===t.ID&&r.processorName===t.name));n!==-1&&this.usageRegistry.splice(n,1)}async gatherUsage(){const t=[];if(!this.chained)return[];for(const{cb:n}of this.usageRegistry)try{let r=n();r instanceof ot&&(r=await r),t.push(or(or({},r),{},{direction:this.direction}))}catch(r){D.error("gather extension usage error",r)}return t}getDirection(){return this.direction}}class Kq extends fr{constructor(t){super(),Fe(this,"name","AudioProcessorDestination"),Fe(this,"ID","0"),Fe(this,"inputTrack",void 0),Fe(this,"inputNode",void 0),Fe(this,"audioProcessorContext",void 0),Fe(this,"_source",void 0),this.audioProcessorContext=t}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new Be(Q.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new Be(Q.NOT_SUPPORTED,"AudioProcessor cannot unpipe to any other Processor")}enable(){}disable(){}reset(){this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext.chained=!1,this.emit(yo.ON_TRACK,void 0),this.emit(yo.ON_NODE,void 0)}updateInput(t){if(t.context!==this.audioProcessorContext)throw new Error(`ProcessorContext passed to AudioTrack.processorDestination doesn't match it's belonging AudioTrack's context.
`)})),B.push("--"+M+"--"),new Blob(B,{type:"multipart/form-data; boundary="+M})},J.prototype[Symbol.iterator]=function(){return this.entries()},J.prototype.toString=function(){return"[object FormData]"},R&&!R.matches&&(R.matches=R.matchesSelector||R.mozMatchesSelector||R.msMatchesSelector||R.oMatchesSelector||R.webkitMatchesSelector||function(M){for(var B=(M=(this.document||this.ownerDocument).querySelectorAll(M)).length;0<=--B&&M.item(B)!==this;);return-1<B}),F&&(J.prototype[F]="FormData"),I){varY=C.XMLHttpRequest.prototype.setRequestHeader;C.XMLHttpRequest.prototype.setRequestHeader=function(M,B){Y.call(this,M,B),M.toLowerCase()==="content-type"&&(this.B=!0)},C.XMLHttpRequest.prototype.send=function(M){MinstanceofJ?(M=M._blob(),this.B||this.setRequestHeader("Content-Type",M.type),I.call(this,M)):I.call(this,M)}}O&&(C.fetch=function(M,B){returnB&&B.body&&B.bodyinstanceofJ&&(B.body=B.body._blob()),O.call(this,M,B)}),L&&(C.navigator.sendBeacon=function(M,B){returnBinstanceofJ&&(B=B._asNative()),L.call(this,M,B)}),C.FormData=J}})();constpg=()=>{const e=he("AREAS");return e.length===0&&e.push(gn.GLOBAL),vc(e).call(e,((t,n,r)=>{const i=m$(n);return i?r===0?i:"".concat(t,",").concat(i):t}),"")},m$=e=>e===gn.OVERSEA?"".concat(Ui.ASIA,",").concat(Ui.EUROPE,",").concat(Ui.AFRICA,",").concat(Ui.NORTH_AMERICA,",").concat(Ui.SOUTH_AMERICA,",").concat(Ui.OCEANIA):Ui[e],xBe=e=>{const t={CODE:"",WEBCS_DOMAIN:[],WEBCS_DOMAIN_BACKUP_LIST:[],PROXY_CS:[],CDS_AP:[],ACCOUNT_REGISTER:[],UAP_AP:[],EVENT_REPORT_DOMAIN:[],EVENT_REPORT_BACKUP_DOMAIN:[],LOG_UPLOAD_SERVER:[],PROXY_SERVER_TYPE3:[]};return e.map((n=>{const r=m6[n],i=Object.keys(r);i&&i.map((o=>{o!=="CODE"&&(t[o]=t[o].concat(r[o]))}))})),t},I3={GLOBAL:{ASIA:[gn.CHINA,gn.JAPAN,gn.INDIA,gn.KOREA,gn.HKMC],EUROPE:[],NORTH_AMERICA:[gn.US],SOUTH_AMERICA:[],OCEANIA:[],AFRICA:[]}},b5=Object.keys(I3[gn.GLOBAL]),pE=[gn.CHINA,gn.NORTH_AMERICA,gn.EUROPE,gn.ASIA,gn.JAPAN,gn.INDIA,gn.OCEANIA,gn.SOUTH_AMERICA,gn.AFRICA,gn.KOREA,gn.HKMC,gn.US],DBe=function(e,t){let n=[];if(lt(e).call(e,gn.GLOBAL)){const o=[gn.GLOBAL,gn.OVERSEA],s=Object.keys(m6);if(t===gn.GLOBAL)throw new xe(Q.INVALID_PARAMS,"GLOBAL is an invalid excludedArea value");if(t===gn.CHINA)n=[gn.OVERSEA];else if(i=t,lt(b5).call(b5,i)){const a=(r=t,I3[gn.GLOBAL][r]||[]),c=[...o,t,...a];n=s.filter((l=>!lt(c).call(c,l)))}else if((function(a){let c=!1;return b5.forEach((l=>{var u;lt(u=I3[gn.GLOBAL][l]).call(u,a)&&(c=!0)})),c})(t)){const a=(function(l){let u;return b5.forEach((d=>{var f;lt(f=I3[gn.GLOBAL][d]).call(f,l)&&(u=d)})),u})(t),c=[...o,a,t];n=s.filter((l=>!lt(c).call(c,l)))}else n=e;n=(function(a){const c=[];return pE.forEach((l=>{lt(a).call(a,l)&&c.push(l)})),c.concat(a.filter((l=>!lt(pE).call(pE,l))))})(n)}else n=e;var r,i;return n};function WF(e){var t,n;if(!e&<(t=he("AREAS")).call(t,gn.EXTENSIONS))return D.debug("update area from ap : reset"),void TI(cNe,!0);if(!lt(n=he("AREAS")).call(n,gn.GLOBAL)||!e)return;let r=m6.EXTENSIONS;r&&(r={CODE:m$(gn.EXTENSIONS),WEBCS_DOMAIN:["ap-web-1-".concat(e,".agora.io")],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-".concat(e,".ap.sd-rtn.com")],PROXY_CS:["proxy-ap-web-".concat(e,".agora.io")],CDS_AP:["cds-ap-web-1-".concat(e,".agora.io"),"cds-ap-web-2-".concat(e,".ap.sd-rtn.com")],ACCOUNT_REGISTER:["sua-ap-web-1-".concat(e,".agora.io"),"sua-ap-web-2-".concat(e,".ap.sd-rtn.com")],UAP_AP:["uap-ap-web-1-".concat(e,".agora.io"),"uap-ap-web-2-".concat(e,".ap.sd-rtn.com")],EVENT_REPORT_DOMAIN:["statscollector-1-".concat(e,".agora.io")],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-".concat(e,".agora.io")],LOG_UPLOAD_SERVER:["logservice-".concat(e,".agora.io")],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy-".concat(e,".agora.io")]},D.debug("update area from ap success: ".concat(e,",config is "),r),Dn("AREAS",[gn.EXTENSIONS],!0),Object.keys(r).map((i=>{i==="LOG_UPLOAD_SERVER"||i==="EVENT_REPORT_DOMAIN"||i==="EVENT_REPORT_BACKUP_DOMAIN"||i==="PROXY_SERVER_TYPE3"?Dn(i,r[i][0]):Dn(i,r[i])})))}function TI(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];const n=mt.reportApiInvoke(null,{name:Zr.SET_AREA,options:e,tag:vr.TRACER});try{let r=[];if(typeof e=="string"&&(r=[e]),Array.isArray(e)&&(e.forEach((o=>{if(!lt(IM).call(IM,o))throw new xe(Q.INVALID_PARAMS,"invalid area code")})),r=e),Object.prototype.toString.call(e)==="[object Object]"){const{areaCode:o,excludedArea:s}=e;if(!o)throw new xe(Q.INVALID_PARAMS,"area code is needed");let a=o;typeof o=="string"&&(a=[o]),r=s?DBe(a,s):a}if(!t){if(bd.AREAS){const o=new xe(Q.PROHIBITED_OPERATION,"setArea is prohibited because of config-distribute");return n.onError(o),void D.warning("setArea is prohibited because of config-distribute")}if(lt(r).call(r,gn.GLOBAL)&&he("AREAS")===gn.EXTENSIONS){const o=new xe(Q.PROHIBITED_OPERATION,"setArea is prohibited because of ap extensions");return n.onError(o),void D.warning("setArea is prohibited because of ap extensions")}}Dn("AREAS",r,t);const i=xBe(r);Object.keys(i).map((o=>{o==="LOG_UPLOAD_SERVER"||Line truncated
o=- 0 0 IN IP4 127.0.0.1
s=AgoraGateway
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS
a=extmap-allow-mixed
m=video 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=sendonly
a=rtcp-mux
a=rtcp-rsize
a=mid:0
m=audio 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=sendonly
a=rtcp-mux
a=rtcp-rsize
a=mid:1
`):gi.parse(`v=0
o=- 0 0 IN IP4 127.0.0.1
s=AgoraGateway
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS
a=extmap-allow-mixed
m=video 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=mid:0
m=audio 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=mid:1
`),this._rtpCapabilities=i,this._candidates=r,this._iceParameters=t,this._dtlsParameters=n,this._localCapabilities=o;const d=s===po.RECEIVE_ONLY?this.rtpCapabilities.send:this.rtpCapabilities.recv,f=s===po.RECEIVE_ONLY?this._localCapabilities.recv:this._localCapabilities.send,h=s===po.RECEIVE_ONLY?i.send.videoCodecs:bm(vt.VIDEO,d,f,c),p=s===po.RECEIVE_ONLY?i.send.audioCodecs:bm(vt.AUDIO,d,f,l);for(const g of u.mediaDescriptions)g.attributes.iceUfrag=t.iceUfrag,g.attributes.icePwd=t.icePwd,g.attributes.fingerprints=n.fingerprints,g.attributes.candidates=r,g.attributes.setup=this.setup,g.media.mediaType==="application"&&(g.attributes.sctpPort="5000"),g.media.mediaType==="video"&&(g.media.fmts=h.map((m=>m.payloadType.toString(10))),g.attributes.payloads=h,g.attributes.extmaps=d.videoExtensions),g.media.mediaType==="audio"&&(g.media.fmts=p.map((m=>m.payloadType.toString(10))),g.attributes.payloads=p,g.attributes.extmaps=d.audioExtensions,Tp(g));this.sessionDesc=u,this.currentMidIndex=u.mediaDescriptions.length-1}toString(){return gi.print(this.sessionDesc)}hasMid(e){return Array.isArray(e)?e.every((t=>this.hasMid(t))):this.sessionDesc.mediaDescriptions.some((t=>t.attributes.mid===e))}send(e,t,n,r,i){n=n.replace(/ /g,"-");const{ssrcs:o,ssrcGroups:s}=_0(t,this.cname,he("SYNC_GROUP")?n:void 0),a=this.findPreloadMediaDesc(o);if(a){if(Er()&&this.firefoxSsrcMidMap.set(o[0].ssrcId,a.attributes.mid),i&&(i.twcc||i.remb)){const c=this.sessionDesc.mediaDescriptions.indexOf(a);return this.sessionDesc.mediaDescriptions[c]=this.mungSendMediaDesc(a,i),{mid:a.attributes.mid,needExchangeSDP:!0}}return{mid:a.attributes.mid,needExchangeSDP:!1}}{const c=this.findAvailableMediaIndex(e,o,r);let l;return c===-1?(l=this.createOrRecycleSendMedia(e,o,s,"sendonly",r,i),this.updateBundleMids()):(l=Lr(this.sessionDesc.mediaDescriptions[c]),l.attributes.direction="sendonly",l.attributes.ssrcs=o,l.attributes.ssrcGroups=s,this.sessionDesc.mediaDescriptions[c]=this.mungSendMediaDesc(l,i)),Er()&&this.firefoxSsrcMidMap.set(o[0].ssrcId,l.attributes.mid),{needExchangeSDP:!0,mid:l.attributes.mid}}}stopSending(e){const t=this.sessionDesc.mediaDescriptions.filter((n=>n.attributes.mid&&e.indexOf(n.attributes.mid)!==-1));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.stopSending.");t.forEach((n=>{n.attributes.ssrcs=[]})),this.updateBundleMids()}receive(e,t,n){const r=[];return e.forEach((i=>{const o=i._mediaStreamTrack.kind,s=this.findAvailableRecvMediaIndex(o);let a,c=!1;s===-1?(c=!0,a=this.createOrRecycleRecvMedia(i,[],"recvonly",t,n),this.updateBundleMids()):(a=Lr(this.sessionDesc.mediaDescriptions[s]),a.attributes.direction="recvonly"),r.push({mid:a.attributes.mid,needCreateTransceiver:c})})),r}stopReceiving(e){const t=this.sessionDesc.mediaDescriptions.filter((n=>e.indexOf(n.attributes.mid)!==-1));if(t.length!==e.length)throw new Error("MediaDescriptions' length doesn't match mids's length when calling RemoteSDP.receive.");t.forEach((n=>{n.media.port="0",n.attributes.direction="inactive"})),this.updateBundleMids()}addRemoteCandidate(e){const{foundation:t,protocol:n,address:r,port:i,type:o,relatedAddress:s,relatedPort:a,priority:c}=new RTCIceCandidate(e),l={foundation:t??"",componentId:"1",transport:n??"",priority:c?c+"":"",connectionAddress:r??"",port:i?i+"":"",type:o?o+"":"",relAddr:s??"",relPort:a?a+"":"",extension:{}};this.candidates.some((u=>u.priority===l.priority&&u.connectionAddress===l.connectionAddress&&u.port===l.port))||(this._candidates.push(l),this.sessionDesc.mediaDescriptions.forEach((u=>{u.attributes.candidates=this.candidates})))}clearRemoteCandidate(){this._candidates=[],this.sessionDesc.mediaDescriptions[0].attributes.candidates=this._candidates}createOrRecycleRecvMedia(e,t,n,r,i){const o=e._mediaStreamTrack.kind,s=this.rtpCapabilities.recv,a=bm(o,s,this.localCapabilities.send,o===vt.AUDIO?i:r),c=o===vt.VIDEO?s.videoExtensions:s.audioExtensions,l="".concat(++this.currentMidIndex);let u={media:{mediaType:o,port:"9",protos:["UDP","TLS","RTP","SAVPF"],fmts:a.map((f=>f.payloadType.toString(10)))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:this.iceParameters.iceUfrag,icePwd:this.iceParameters.icePwd,unrecognized:[],candidates:[],extmaps:c,fingerprints:this.dtlsParameters.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:t,ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:a,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:n,rtcpMux:!0,rtcpRsize:!0,mid:"".concat(l)}};u=this.mungRecvMediaDsec(u,e);const d=this.findFirstClosedMedia(o);if(d){const f=this.sessionDesc.mediaDescriptions.indexOf(d);this.sessionDesc.mediaDescriptions[f]=u}else this.sessionDesc.mediaDescriptions.push(u);return u}muteRemote(e){const t=this.sessionDesc.mediaDescriptions.filter((n=>lt(e).call(e,n.attributes.mid||"")));if(t.length!==e.length)throw new Error("mediaDescriptions' lLine truncated
`),t),n==="offer"?o=>{this.logSDPExchange(o,"answer",r==="local"?"remote":"local",i)}:void 0}async muteLocal(t){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.muteLocal before remote SDP created.");const n=this.peerConnection.getTransceivers().filter((s=>s.mid&&t.indexOf(s.mid)!==-1));if(n.length!==t.length)throw new Error("Transceivers' length doesn't match mids' length.");n.map((s=>{s.direction="inactive"}));const r=await this.peerConnection.createOffer(),i=this.logSDPExchange(r.sdp||"","offer","local","muteLocal");await this.peerConnection.setLocalDescription(r),this.remoteSDP.muteRemote(t);const o=this.remoteSDP.toString();i==null||i(o),await this.setRemoteDescription({type:"answer",sdp:o})}catch(n){throw new Be(Q.EXCHANGE_SDP_FAILED,"P2PConnection.muteLocal failed; ".concat(n.toString()))}}async unmuteLocal(t){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.unmuteLocal before remote SDP created.");const n=this.peerConnection.getTransceivers().filter((s=>s.mid&&t.indexOf(s.mid)!==-1));if(n.length!==t.length)throw new Error("Transceivers' length doesn't match mids' length.");n.map((async s=>{s.direction="sendonly"}));const r=await this.peerConnection.createOffer(),i=this.logSDPExchange(r.sdp||"","offer","local","unmuteLocal");await this.peerConnection.setLocalDescription(r),this.remoteSDP.unmuteRemote(t);const o=this.remoteSDP.toString();i==null||i(o),await this.setRemoteDescription({type:"answer",sdp:o})}catch(n){throw new Be(Q.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteLocal failed; ".concat(n.toString()))}}async getRemoteSSRC(t,n){var r,i;if(n=(r=n)!==null&&r!==void 0?r:(i=this.currentRemoteDescription)===null||i===void 0?void 0:i.sdp){var o;const s=(o=gi.parse(n).mediaDescriptions.find((a=>a.attributes.mid===t)))===null||o===void 0?void 0:o.attributes.ssrcs;return s==null?void 0:s[0].ssrcId}}async setRemoteDescription(t){var n;await this.peerConnection.setRemoteDescription(t),lt(n=["connected","completed"]).call(n,this.peerConnection.iceConnectionState)||(this.isReady=!0,this.addRemoteCandidate())}mungReceiveAnswerSDP(t,n,r){const i=gi.parse(t),o=i.mediaDescriptions.find((s=>s.attributes.mid===n));return o&&r===vt.AUDIO&&o.media.mediaType==="audio"&&Tp(o),gi.print(i)}},ft(Zn.prototype,"establish",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"establish"),Zn.prototype),ft(Zn.prototype,"connect",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"connect"),Zn.prototype),ft(Zn.prototype,"receive",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"receive"),Zn.prototype),ft(Zn.prototype,"mockReceive",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"mockReceive"),Zn.prototype),ft(Zn.prototype,"stopReceiving",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"stopReceiving"),Zn.prototype),ft(Zn.prototype,"restartICE",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"restartICE"),Zn.prototype),ft(Zn.prototype,"close",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"close"),Zn.prototype),ft(Zn.prototype,"updateEncoderConfig",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"updateEncoderConfig"),Zn.prototype),ft(Zn.prototype,"updateSendParameters",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"updateSendParameters"),Zn.prototype),ft(Zn.prototype,"replaceTrack",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"replaceTrack"),Zn.prototype),ft(Zn.prototype,"muteLocal",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"muteLocal"),Zn.prototype),ft(Zn.prototype,"unmuteLocal",[Ea],Object.getOwnPropertyDescriptor(Zn.prototype,"unmuteLocal"),Zn.prototype),Zn);function Ea(e,t,n){const r=e[t];if(typeof r!="function")throw new Error("Cannot use mutex on object property.");return n.value=async function(){const i=this.mutex,o=await i.lock("From P2PConnection.".concat(t));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];returnawaitr.apply(this,a)}finally{o()}},n}functionuC(e,t){letn=document.createElement("video"),r=document.createElement("canvas");n.setAttribute("style","display:none"),r.setAttribute("style","display:none"),n.setAttribute("muted",""),n.muted=!0,n.setAttribute("autoplay",""),n.autoplay=!0,n.setAttribute("playsinline",""),r.width=hs(t.width),r.height=hs(t.height);consti=hs(t.framerate||15);document.body.append(n),document.body.append(r);leto=e._mediaStreamTrack;n.srcObject=newMediaStream([o]),n.play();consts=r.getContext("2d");if(!s)thrownewxe(Q.UNEXPECTED_ERROR,"cannotgetcanvascontext");consta=fn(),c=r.captureStream(a.supportRequestFrame?0:i).getVideoTracks()[0];c.canvas||(c.canvas=r),r.startCapture=()=>{if(!n)return r.stopCapture&&r.stopCapture();if(n.paused&&n.play(),n.videoHeight>2&&n.videoWidth>2){const u=n.videoWidth,d=n.videoHeight/u,f=r.width*d;Math.abs(f-r.height)>=2&&(D.debug("adjust low stream resolution","".concat(r.width,"x").concat(r.height," -> ").concat(r.width,"x").concat(f)),r.height=f)}s.drawImage(n,0,0,r.width,r.height),c.requestFrame&&c.requestFrame(),o!==e._mediaStreamTrack&&(o=e._mediaStreamTrLine truncated
o=- 0 0 IN IP4 127.0.0.1
s=AgoraGateway
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS
a=ice-lite
m=audio 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=sendrecv
a=rtcp-mux
a=rtcp-rsize
a=mid:audio
m=video 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=sendrecv
a=rtcp-mux
a=rtcp-rsize
a=mid:video
`);this.rtpCapabilities=a,this.candidates=s,this.iceParameters=i,this.dtlsParameters=o,this.setup=c,this.localCapabilities=l,this.cname=d;for(let h=0;h<f.mediaDescriptions.length;h++){constp=f.mediaDescriptions[h];if(p.attributes.iceUfrag=i.iceUfrag,p.attributes.icePwd=i.icePwd,p.attributes.fingerprints=o.fingerprints,p.attributes.candidates=s,p.attributes.setup=c,p.media.mediaType==="video"){p.media.fmts=a.videoCodecs.map((m=>m.payloadType.toString(10)));let g=a.videoCodecs.filter((m=>{var y,v;return(y=m.rtpMap)===null||y===void 0?void 0:lt(v=y.encodingName.toLowerCase()).call(v,u)}));g.length===0&&(g=a.videoCodecs),p.attributes.payloads=g,p.attributes.extmaps=a.videoExtensions}p.media.mediaType==="audio"&&(p.media.fmts=a.audioCodecs.map((g=>g.payloadType.toString(10))),p.attributes.payloads=a.audioCodecs,p.attributes.extmaps=a.audioExtensions),f.mediaDescriptions[h]=this.mungMediaDesc(p)}this.sessionDesc=f,this.currentMidIndex=f.mediaDescriptions.length-1}toString(){return gi.print(this.sessionDesc)}send(r,i,o){const{ssrcs:s,ssrcGroups:a}=_0(i,this.cname),c=this.sessionDesc.mediaDescriptions.find((d=>r===vt.VIDEO?d.media.mediaType==="video":d.media.mediaType==="audio")),l=s[0].attributes.label,u=s[0].attributes.mslabel;return c.attributes.ssrcs=c.attributes.ssrcs.concat(s),c.attributes.ssrcGroups=c.attributes.ssrcGroups.concat(a),{id:l,mslabel:u}}batchSend(r){return r.map((i=>{let{kind:o,ssrcMsg:s}=i;return this.send(o,s,void 0)}))}stopSending(r){this.sessionDesc.mediaDescriptions.forEach((i=>{const o=[],s=[],a=[];i.attributes.ssrcs.forEach((c=>{lt(r).call(r,c.attributes.label||"")?a.push(c):o.push(c)})),i.attributes.ssrcGroups.forEach((c=>{var l;lt(l=a.map((u=>u.ssrcId))).call(l,c.ssrcIds[0])||s.push(c)})),i.attributes.ssrcs=o,i.attributes.ssrcGroups=s}))}mute(r){const i=this.sessionDesc.mediaDescriptions.find((o=>o.attributes.mid===r));if(!i)throw new Error("mediaDescription not found with ".concat(r," in remote SDP when calling RemoteSDP.mute."));i.attributes.direction="inactive"}unmute(r){const i=this.sessionDesc.mediaDescriptions.find((o=>o.attributes.mid===r));if(!i)throw new Error("mediaDescription not found with ".concat(r," in remote SDP when calling RemoteSDP.unmute."));i.attributes.direction="sendonly"}receive(r,i,o){r.forEach(((s,a)=>{const c=s._mediaStreamTrack,l=this.sessionDesc.mediaDescriptions.findIndex((d=>d.attributes.mid===c.kind)),u=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[l],s);this.sessionDesc.mediaDescriptions[l]=u}))}stopReceiving(r){}updateCandidates(r){r===ls.TCP?this.candidates.forEach((i=>{this.candidates.findIndex((o=>o.transport==="tcp"&&o.connectionAddress===i.connectionAddress&&o.port===i.port))===-1&&this.candidates.push(_U(_U({},i),{},{foundation:"tcpcandidate",priority:Number(i.priority)-1+"",transport:"tcp",port:Number(i.port)+90+""}))})):this.candidates=this.candidates.filter((i=>i.transport!=="tcp"));for(const i of this.sessionDesc.mediaDescriptions)i.attributes.candidates=this.candidates}restartICE(r){r=Lr(r),this.iceParameters=r,this.sessionDesc.mediaDescriptions.forEach((i=>{i.attributes.iceUfrag=r.iceUfrag,i.attributes.icePwd=r.icePwd}))}predictReceivingMids(r){const i=[];for(let o=0;o<r;o++)i.push((this.currentMidIndex+o+1).toString(10));returni}mungRecvMediaDsec(r,i){consto=Lr(r);returnwp(o,i),CI(o,i),o}updateRecvMedia(r,i){consto=this.sessionDesc.mediaDescriptions.findIndex((s=>s.attributes.mid===r));if(o!==-1){const s=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[o],i);this.sessionDesc.mediaDescriptions[o]=s}}bumpMid(r){this.currentMidIndex+=r}updateTrackLabel(r,i,o){const s=this.sessionDesc.mediaDescriptions.find((c=>r===vt.VIDEO?c.attributes.mid==="video":c.attributes.mid==="audio"));if(s){const c=s.attributes.ssrcs.find((l=>l.attributes.label===i));var a;c&&(c.attributes.label=o,(a=c.attributes.msid)===null||a===void 0||a.replace(i,o))}}mungMediaDesc(r){const i=Lr(r);return AI(i),(function(o){const s=o.attributes.extmaps.find((a=>a.extensionName==="http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"));s&&o.attributes.extmaps.splice(o.attributes.extmaps.indexOf(s),1),o.attributes.payloads.forEach((a=>{const c=a.rtcpFeedbacks.findIndex((l=>l.type==="transport-cc"));c!==-1&&a.rtcpFeedbacks.splice(c,1)}))})(i),i}getSSRC(r){for(const i of this.sessionDesc.mediaDescriptions)for(const o of i.attributes.ssrcs)if(o.attributes.label===r)return[o]}}(A5(A5({},t),{},{rtpCapabilities:t.rtpCapabilities.send,localCapabilities:this.localCapabilities,sdkCodec:this.store.codec}));const n=this.remoteSDP.toString();await this.peerConnection.setLocalDescription(this.initialOffer),await this.peerConnection.setRemoteDescription({type:"answer",sdp:n})}catch(n){throw new Be(Q.EXCHANGE_SDP_FAILED,"P2PConnection.connect failed; ".concat(n.toString()))}}async updateRemoteRTPCapabilities(t,n){throw new Be(Q.NOT_SUPPORTED,"Planb mode does not support createDataChannels.")}getPreMedia(t){}send(t,n){var r=this;return cc((function*(Line truncated
o=- 0 0 IN IP4 127.0.0.1
s=AgoraGateway
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS
a=ice-lite
m=video 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=sendonly
a=rtcp-mux
a=rtcp-rsize
a=mid:0
m=audio 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 127.0.0.1
a=rtcp:9 IN IP4 0.0.0.0
a=sendonly
a=rtcp-mux
a=rtcp-rsize
a=mid:1
`);this._rtpCapabilities=t;const r=this.rtpCapabilities.send,i=this.localCapabilities.send;for(const o of n.mediaDescriptions){if(o.attributes.iceUfrag=this._iceParameters.iceUfrag,o.attributes.icePwd=this._iceParameters.icePwd,o.attributes.fingerprints=this._dtlsParameters.fingerprints,o.attributes.candidates=this._candidates,o.attributes.setup=this.setup,o.media.mediaType==="application"&&(o.attributes.sctpPort="5000"),o.media.mediaType==="video"){if(r.videoCodecs.length===0){const s=i.videoCodecs.filter((a=>{var c,l;return(c=a.rtpMap)===null||c===void 0?void 0:lt(l=c.encodingName.toLowerCase()).call(l,"vp8")}))||[i.videoCodecs[0]];o.media.fmts=s.map((a=>a.payloadType.toString(10))),o.attributes.payloads=s,o.attributes.extmaps=[]}else if(o.media.fmts=r.videoCodecs.map((s=>s.payloadType.toString(10))),o.attributes.payloads=r.videoCodecs,o.attributes.extmaps=r.videoExtensions,he("PRELOAD_MEDIA_COUNT")>0){const{ssrcs:s,ssrcGroups:a}=_0([{ssrcId:xU,rtx:he("USE_SUB_RTX")?40001:void 0}],this.cname);o.attributes.ssrcs=s,o.attributes.ssrcGroups=a}}if(o.media.mediaType==="audio"){if(r.audioCodecs.length===0){const s=i.audioCodecs.filter((a=>{var c,l;return(c=a.rtpMap)===null||c===void 0?void 0:lt(l=c.encodingName.toLowerCase()).call(l,"opus")}))||[i.audioCodecs[0]];o.media.fmts=s.map((a=>a.payloadType.toString(10))),o.attributes.payloads=s,o.attributes.extmaps=[]}else if(o.media.fmts=r.audioCodecs.map((s=>s.payloadType.toString(10))),o.attributes.payloads=r.audioCodecs,o.attributes.extmaps=r.audioExtensions,Tp(o),he("PRELOAD_MEDIA_COUNT")>0){const{ssrcs:s,ssrcGroups:a}=_0([{ssrcId:2e4}],this.cname);o.attributes.ssrcs=s,o.attributes.ssrcGroups=a}}}return this.sessionDesc=n,this.currentMidIndex=n.mediaDescriptions.length-1,this.sessionDesc}updateCandidates(t){const n=this._candidates.filter((r=>r.transport==="udp"));if(t===ls.TCP){if(n.length===0)return;if(he("TCP_CANDIDATE_ONLY")){const r=this._candidates.filter((i=>i.transport==="tcp"));n.forEach((i=>{r.findIndex((o=>o.connectionAddress===i.connectionAddress))===-1&&r.push(Zu(Zu({},i),{},{foundation:"tcpcandidate",priority:Number(i.priority)-1+"",transport:"tcp",port:Number(i.port)+90+""}))})),this._candidates=r}else{const r=[];n.forEach((i=>{r.push(Zu(Zu({},i),{},{foundation:"tcpcandidate",priority:Number(i.priority)-1+"",transport:"tcp",port:Number(i.port)+90+""}))})),this._candidates=[...n,...r]}}else if(t===ls.RELAY){if(n.length!==0)return;{const r=this._candidates.filter((i=>i.transport==="tcp"));r.forEach((i=>{n.push(Zu(Zu({},i),{},{foundation:"udpcandidate",priority:Number(i.priority)+1+"",transport:"udp",port:Number(i.port)-90+""}))})),this._candidates=[...n,...r]}}else n.length===0?(this._candidates.filter((r=>r.transport==="tcp")).forEach((r=>{n.push(Zu(Zu({},r),{},{foundation:"udpcandidate",priority:Number(r.priority)+1+"",transport:"udp",port:Number(r.port)-90+""}))})),this._candidates=n):this._candidates=this._candidates.filter((r=>r.transport!=="tcp"));for(const r of this.sessionDesc.mediaDescriptions)r.attributes.candidates=this.candidates}restartICE(t){t=Lr(t),this._iceParameters=t,this.sessionDesc.mediaDescriptions.forEach((n=>{n.attributes.iceUfrag=t.iceUfrag,n.attributes.icePwd=t.icePwd}))}predictReceivingMids(t){const n=[];for(let r=0;r<t;r++)n.push((this.currentMidIndex+r+1).toString(10));returnn}findAvailableMediaIndex(t,n){returnthis.sessionDesc.mediaDescriptions.findIndex((r=>{consti=r.media.mediaType===t&&r.media.port!=="0"&&(r.attributes.direction==="sendonly"||r.attributes.direction==="sendrecv")&&r.attributes.ssrcs.length===0;if(Er()){if(i){consto=this.firefoxSsrcMidMap.get(n[0].ssrcId);return!(o||r.attributes.mid!=="0"&&r.attributes.mid!=="1")||!(!o||o!==r.attributes.mid)}return!1}returni}))}createOrRecycleDataChannel(){for(constrofthis.sessionDesc.mediaDescriptions)if(r.media.mediaType==="application")return{mediaDesc:r,needExchangeSDP:!1};this.currentMidIndex+=1;constt="".concat(this.currentMidIndex),n={media:{mediaType:"application",port:w1,protos:["UDP","DTLS","SCTP"],fmts:["webrtc-datachannel"]},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:this.iceParameters.iceUfrag,icePwd:this.iceParameters.icePwd,unrecognized:[],candidates:this.candidates,extmaps:[],fingerprints:this.dtlsParameters.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[],rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,mid:"".concat(t),sctpPort:"5000"}};returnthis.sessionDesc.mediaDescriptions.push(n),{mediaDesc:n,needExchangeSDP:!0}}createOrRecycleRecvMedia(t,n,r,i,o,s){consta=t._mediaStreamTrack.kind,c=this.rtpCapabilities.recv,l=bm(a,c,this.localCapabilities.send,a===vt.VIDEO?i:o),u=a===vt.VIDEO?c.videoExtensions:c.audioExtensions;this.currentMidIndex+=1;constd="".concat(this.currentMidIndex);letf={media:{mediaType:a,port:w1,protos:["UDP","TLS","RTP","SAVPF"],fmts:l.map((p=>p.payloadType.toLine truncated
xQiYDz3vqa6bP29adwIDAQAB`),w=new Uint8Array(new ArrayBuffer(S.length));for(let C=0;C<S.length;C+=1)w[C]=S.charCodeAt(C);returnw})(),y=awaitwindow.crypto.subtle.importKey("spki",m,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),v=cI(g),E=awaitwindow.crypto.subtle.encrypt({name:"RSA-OAEP"},y,v);return(function(b){letS="";for(letw=0;w<b.length;w+=1)S+=String.fromCharCode(b[w]);returnwindow.btoa(S)})(newUint8Array(E))})(this._encryptionSecret),!this._joinAndNotLeaveYet)thrownewxe(Q.INVALID_OPERATION,"[".concat(this._clientId,"]Clientalreadyleft"));this._encryptionSalt&&(d.aessalt=this._encryptionSalt)}if(this._encryptDataStream&&(this._encryptionMode==="aes-128-gcm2"||this._encryptionMode==="aes-256-gcm2"))if(this._encryptionSalt&&this._encryptionSecret)if(window.crypto.subtle){constg=newTextEncoder,m=he("USE_PURE_ENCRYPTION_MASTER_KEY")?g.encode(d.appId+this._encryptionSecret+this._encryptionSecret):g.encode(d.appId+d.cname+this._encryptionSecret);this._encryptDataStreamIv=await(asyncfunction(y,v,E){constb=awaitwindow.crypto.subtle.importKey("raw",v,"PBKDF2",!1,["deriveBits","deriveKey"]),S=y==="aes-128-gcm2"?128:256,w=awaitwindow.crypto.subtle.deriveBits({name:"PBKDF2",iterations:gM,hash:"SHA-256",salt:E},b,S+nNe);returnnewUint8Array(w).subarray(S/8)})(this._encryptionMode,m,H0(this._encryptionSalt)),this._encryptDataStreamKey=await(asyncfunction(y,v,E){constb=awaitwindow.crypto.subtle.importKey("raw",v,"PBKDF2",!1,["deriveBits","deriveKey"]),S=y==="aes-128-gcm2"?128:256;returnawaitwindow.crypto.subtle.deriveKey({name:"PBKDF2",iterations:gM,hash:"SHA-256",salt:E},b,{name:"AES-GCM",length:S},!0,["encrypt","decrypt"])})(this._encryptionMode,m,H0(this._encryptionSalt))}elsea?D.warning("[".concat(this._clientId,"]encryptdatastreammustberunninginasecurecontext,fallbacktoplaindatastream")):D.warning("[".concat(this._clientId,"]currentbrowserdonotsupportWebCrypto,fallbacktoplaindatastream")),this._encryptDataStream=!1;elsethis._encryptDataStream=!1,D.debug("[".concat(this._clientId,"]nosalt/secret,cannotsupportencryptdatastream,fallbacktoplaindatastream"));this._startSession(this._sessionId,{channel:t,appId:e,stringUid:d.stringUid});constf=this._sessionId;setTimeout((()=>{this.connectionState==="CONNECTING"&&f===this._sessionId&&mt.joinChannelTimeout(this._sessionId,5)}),5e3);try{var h;let g;const m=d.cloudProxyServer;if(lt(h=["proxy3","proxy4","proxy5"]).call(h,m)){const S=he("PROXY_SERVER_TYPE3");Array.isArray(S)?d.proxyServer=S[0]:d.proxyServer=S}if(mt.setProxyServer(d.proxyServer),D.setProxyServer(d.proxyServer),this.store.requestAPStart(),c){if(D.debug("[".concat(this._clientId,"] get serverInfo Success from Preload Cache ").concat(d.stringUid?", ".concat(d.stringUid," => ").concat(c.intUid):""," ")),d.stringUid&&!d.uid&&(d.uid=c.intUid),g={gatewayInfo:c.ap.gatewayInfo},he("JOIN_WITH_FALLBACK_MEDIA_PROXY")&&d.turnServer.mode==="auto")if(c.ap.proxyInfo.addresses.length===0)D.warning("no edge services in ap response of proxy fallback, will not set proxy in iceServers");else{const S=(await Oq(c.ap.proxyInfo,c.ap.gatewayInfo.uid)).map((w=>({turnServerURL:w.address,tcpport:w.tcpport||Ti.tcpport,udpport:w.udpport||Ti.udpport,username:w.username||Ti.username,password:w.password||Ti.password,forceturn:!1,security:!0})));d.turnServer={mode:"manual",servers:S}}GU(c,d.stringUid)}else{if(d.stringUid&&!d.uid){let S;[S,g]=await ot.all([y$(d.stringUid,d,this._axiosCancelSource.token,this._config.httpRetryConfig||jr,this.store),ZF(d,this._axiosCancelSource.token,this._config.httpRetryConfig||jr,!0,this.store)]),D.debug("[".concat(this._clientId,"] getUserAccount Success ").concat(d.stringUid," => ").concat(S)),d.uid=S,g.gatewayInfo.uid=S,g.gatewayInfo.res.uid=S}else g=await ZF(d,this._axiosCancelSource.token,this._config.httpRetryConfig||jr,!0,this.store);if(!this._joinAndNotLeaveYet)throw new xe(Q.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"))}this.store.requestAPEnd(),setTimeout((()=>{this._configDistribute.startGetConfigDistribute(d,this._axiosCancelSource.token),this._configDistribute.on(QA.UPDATE_BITRATE_LIMIT,(S=>{this._p2pChannel.updateBitrateLimit(S)}))}),0),this._key=n||e;const y=g.gatewayInfo,v=d.uid?d.uid:y.uid;this._joinInfo=$a($a({},d),{},{cid:y.cid,uid:v,vid:y.vid,apResponse:y.res,apGatewayAddress:y.apGatewayAddress,uni_lbs_ip:y.uni_lbs_ip,gatewayAddrs:y.gatewayAddrs}),this.store.intUid=v;const E=await this._joinGateway();if(!this._joinAndNotLeaveYet)throw new xe(Q.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));u.onSuccess(E),this._appId=e,this._channelName=d.cname,this._uid=E,this.store.uid=E,setTimeout((()=>{this._networkQualityInterval&&window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=window.setInterval(this._handleUpdateNetworkQuality,2e3),window.addEventListener(Ri()?"beforeunload":"pagehide",this._handleBeforeUnload),this._statsCollector.startUpdateStats()}),0);coLine truncated
The secret must contain at least 1 lowercase alphabetical character,
The secret must contain at least 1 uppercase alphabetical character,
The secret must contain at least 1 numeric character,
The secret must contain at least one special character,
The secret must be eight characters or longer.
`),this._encryptionMode=e,this._encryptionSecret=t,n&&(this._encryptionSalt=_d(n))}async renewToken(e){if(pi(e,"token",1,2047),!this._key||!this._joinInfo)throw new xe(Q.INVALID_OPERATION,"renewToken should not be called before user join");const t=this._key;this._key=e,this._joinInfo&&(this._joinInfo.token=e);const n=await this._renewTokenMutex.lock();try{if(he("USE_NEW_TOKEN")){D.debug("[".concat(this._clientId,"] start renew token with ticket from unilbs"));const r=await jBe(this._joinInfo,this._axiosCancelSource.token,this._config.httpRetryConfig||jr);D.debug("[".concat(this._clientId,"] get ticket from unilbs success")),await this._gateway.renewToken({token:e,ticket:r})}else D.debug("[".concat(this._clientId,"] start renew token without ticket")),await this._gateway.renewToken({token:e});D.debug("[".concat(this._clientId,"] renewToken success"))}catch(r){throw this._key=t,this._joinInfo.token=t,D.error("[".concat(this._clientId,"] renewToken failed"),r.toString()),r}finally{n()}}enableAudioVolumeIndicator(){this._audioVolumeIndicationInterval?D.warning("you have already enabled audio volume indicator!"):this._audioVolumeIndicationInterval=window.setInterval((()=>{const e=this._p2pChannel.getAudioLevels();this.safeEmit($t.VOLUME_INDICATOR,e)}),he("AUDIO_VOLUME_INDICATION_INTERVAL")||2e3)}getRTCStats(){const e=this._statsCollector.getRTCStats(),t=this._gateway.getInChannelInfo();return e.Duration=Math.round(t.duration/1e3),e}async startLiveStreaming(e,t){if(!t){if(this.codec!=="h264")throw new xe(Q.LIVE_STREAMING_INVALID_RAW_STREAM,"raw streaming is only support h264");if(!this._p2pChannel.hasLocalMedia())throw new xe(Q.LIVE_STREAMING_INVALID_RAW_STREAM,"can not find stream to raw streaming")}if(this._liveRawStreamingClient&&this._liveRawStreamingClient.hasUrl(e)||this._liveTranscodeStreamingClient&&this._liveTranscodeStreamingClient.hasUrl(e))throw new xe(Q.LIVE_STREAMING_TASK_CONFLICT);const n=t?au.TRANSCODE:au.RAW;return this._createLiveStreamingClient(n).startLiveStreamingTask(e,n)}setLiveTranscoding(e){return this._createLiveStreamingClient(au.TRANSCODE).setTranscodingConfig(e)}async stopLiveStreaming(e){const t=[this._liveRawStreamingClient,this._liveTranscodeStreamingClient].filter((n=>n&&n.hasUrl(e)));if(!t.length)throw new xe(Q.INVALID_PARAMS,"can not find live streaming url to stop");await ot.all(t.map((n=>n&&n.stopLiveStreamingTask(e))))}async startChannelMediaRelay(e){IU(e),await this._createChannelMediaRelayClient().startChannelMediaRelay(e)}async updateChannelMediaRelay(e){IU(e),await this._createChannelMediaRelayClient().updateChannelMediaRelay(e)}async stopChannelMediaRelay(){await this._createChannelMediaRelayClient().stopChannelMediaRelay(),this._statsCollector.onStatsChanged&&(this._statsCollector.onStatsChanged=void 0)}async sendStreamMessage(e){var t;let n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];if(!this._joinInfo)throw new xe(Q.INVALID_OPERATION,"can not send data stream, not joined");if((typeof e=="string"||e instanceof Uint8Array)&&(e={payload:e}),typeof e.payload=="string"){const i=new TextEncoder;e.payload=i.encode(e.payload)}let r=!1;if(this._encryptDataStream&&this._encryptDataStreamIv&&this._encryptDataStreamKey&&window.crypto.subtle&<(t=["aes-128-gcm2","aes-256-gcm2"]).call(t,this._encryptionMode)&&(r=!0,e.payload=await(async function(i,o,s){var a;const c=vc(a=Array.from(s)).call(a,((g,m)=>g+m),0),l={serverTs:0,seq:rNe++,length:s.length,checkSum:c},u=new Uint8Array(hM(c,2)),d=new ArrayBuffer(Yf),f=new DataView(d);f.setUint32(0,l.serverTs),f.setUint16(4,l.seq),f.setUint16(6,l.length),f.setUint16(8,l.checkSum);const h=16-s.length%16;s=lM(s,new Uint8Array(h));const p=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i,tagLength:mM,additionalData:u},o,s);return lM(new Uint8Array(d),new Uint8Array(p))})(this._encryptDataStreamIv,this._encryptDataStreamKey,e.payload)),new Blob([e.payload]).size>1024)throw new xe(Q.INVALID_PARAMS,r?"encrypted stream message out of range.":"stream message out of range.");return this._gateway.signal.request(Dt.DATA_STREAM,{payload:_d(e.payload),syncWithAudio:e.syncWithAudio,sendTs:Date.now()-dFe},!n)}sendMetadata(e){if(!this._joinInfo)throw new xe(Q.INVALID_OPERATION,"can not send metadata, not joined");if(new Blob([e]).size>1024)throw new xe(Q.METADATA_OUT_OF_RANGE);return this._gateway.signal.request(Dt.SEND_METADATA,{session_id:this._joinInfo.sid,metadata:_d(e)})}async sendCustomReportMessage(e){if(Array.isArray(e)||(e=[e]),e.forEach(oNe),!this._joinInfo)throw new xe(Q.INVALID_OPERATION,"can not send custom report, not joined");await mt.sendCustomReportMessage(this._joinInfo.sid,e)}getLocalAudioStats(){return this._statsCollector.getLocalAudioTrackStats()}getRemoteAudioStats(){return this._statsCollector.getRemoteAudioTrackStats()}getLocalVideoStats(){return this._statsCollector.getLocalVideoTrackStats()}getRemoteVideoStats(){return this._statsCollector.getRemoteVideoTrackStats()}getRemoteNetworkQuality(){return thisLine truncated
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.