@rongcloud/plugin-rtc 5.36.1-nctest-alpha.2 → 5.36.1-nctest-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nexconn/engine");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@nexconn/engine");function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function r(e,t,r){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,r||[],u(e).constructor):t.apply(e,r))}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=E(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function s(e,t,r){return(t=T(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},c.apply(null,arguments)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function _(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof s?r:s,u=Object.create(c.prototype);return f(u,"_invoke",function(n,r,i){var o,s,c,u=0,d=i||[],_=!1,l={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,s=0,c=e,l.n=n,a}};function p(n,r){for(s=n,c=r,t=0;!_&&u&&!i&&t<d.length;t++){var i,o=d[t],p=l.p,f=o[2];n>3?(i=f===r)&&(c=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((i=n<2&&p<o[1])?(s=0,l.v=r,l.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,l.n=f,s=0))}if(i||n>1)return a;throw _=!0,r}return function(i,d,f){if(u>1)throw TypeError("Generator is already running");for(_&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!_;){o||(s?s<3?(s>1&&(l.n=-1),p(s,c)):l.n=c:l.v=c);try{if(u=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(_=l.n<0)?c:n.call(r,l))!==a)break}catch(t){o=e,s=1,c=t}finally{u=1}}return{value:t,done:_}}}(n,i,o),!0),u}var a={};function s(){}function c(){}function u(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),_=u.prototype=s.prototype=Object.create(d);function l(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,f(e,i,"GeneratorFunction")),e.prototype=Object.create(_),e}return c.prototype=u,f(_,"constructor",u),f(u,"constructor",c),c.displayName="GeneratorFunction",f(u,i,"GeneratorFunction"),f(_),f(_,i,"Generator"),f(_,r,function(){return this}),f(_,"toString",function(){return"[object Generator]"}),(p=function(){return{w:o,m:l}})()}function f(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}f=function(e,t,n,r){function o(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},f(e,t,n,r)}function h(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}function R(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||I(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t,n,r){var i=u(d(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function v(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function I(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function S(e){var t="function"==typeof Map?new Map:void 0;return S=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(l())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&g(i,n.prototype),i}(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),g(n,e)},S(e)}var E,O=function(e){return"string"==typeof e},b=function(e){return"boolean"==typeof e},y=function(e){return"number"==typeof e&&!Number.isNaN(e)},L=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},k=function(e){return O(e)&&e.length>0},A=function(e){return"[object Object]"===Object.prototype.toString.call(e)},N=function(e){return"function"==typeof e},P=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},D=function(e){return O(e)&&/https?:\/\//.test(e)};!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK"}(E||(E={}));var U,w,M,x=c(c(c(c(c(c(c({},E.STRING,k),E.ONLY_STRING,O),E.NUMBER,y),E.BOOLEAN,function(e){return"boolean"==typeof e}),E.OBJECT,A),E.ARRAY,L),E.CALLBACK,function(e){var t=!0;return A(e)||(t=!1),(e=e||{}).onSuccess&&!N(e.onSuccess)&&(t=!1),e.onError&&!N(e.onError)&&(t=!1),t}),B=function(){function e(t){var n;return i(this,e),(n=r(this,e,[t])).name="RCAssertError",n}return _(e,S(Error)),a(e)}(),V=function(e,t,n){if(!j(e,t,n,arguments.length>3&&void 0!==arguments[3]&&arguments[3]))throw new B("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},j=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n=x[n]||n;var i=r?n(t):P(t)||null==t||n(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},F=function(){return a(function e(){i(this,e),Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:{}})},[{key:"on",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some(function(e){return e.listener===t&&e.target===n})||r.push({listener:t,target:n})}},{key:"once",value:function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some(function(e){return e.listener===t&&e.target===n})||r.push({listener:t,target:n,once:!0})}},{key:"off",value:function(e,t,n){var r=this._map[e];r&&((r=r.filter(function(e){return e.listener!==t||e.target!==n})).length?this._map[e]=r:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0;o<t.length;o+=1){var a=t[o],s=a.target,c=a.once,u=a.listener;c&&(t.splice(o,1),o-=1);try{u.call.apply(u,[s].concat(r))}catch(e){null===console||void 0===console||console.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}])}();function G(e,t){var n;if(!e)return"";var r="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==M.HTTP||r?"https://".concat(e):"http://".concat(e)}!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(U||(U={})),function(e){e.WIFI="wifi",e.FOUR_G="4g",e.THREE_G="3g",e.TWO_G="2g",e.FIVE_G="2g",e.THREE_GENT="3gnet",e.UNKONWN="unknown"}(w||(w={})),function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(M||(M={}));var J,H=function(e,t,n){var r=null==n?void 0:n.isReverse;A(e)&&function(){for(var n in e)t(e[n],n,e)}(),(L(e)||O(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()};function K(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function q(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}!function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(J||(J={})),"function"==typeof SuppressedError&&SuppressedError;var W=function(){return a(function e(t,n){var r=this;i(this,e),Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_onCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._promise=new Promise(function(e){r._resolve=e,t(r._onResolve.bind(r))}),this._onCancel=n},[{key:"_onResolve",value:function(e){this._resolve(e)}},{key:"result",value:function(){return this._promise}},{key:"abort",value:function(){this._onCancel(this._onResolve.bind(this))}}])}();function z(e){var t=e.method||U.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=e.onProgress,s=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).filter(function(e){return!!e});return n.length?[e,n.join("&")].join("?"):e}(e.url,i),c=new XMLHttpRequest;if(c.open(t,s),r&&c.setRequestHeader)for(var u in r)c.setRequestHeader(u,r[u]);return function(e,t,n,r){return new W(function(i){e.onreadystatechange=function(){4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},r&&(e.upload.onprogress=function(e){return r(e)}),0!==t&&setTimeout(function(){e.abort(),i({status:e.status})},t),e.send(n)},function(t){e.abort(),t({status:-1})})}(c,n,o,a)}var Y,Q,Z,X=function(){return a(function e(t,n,r){i(this,e),Object.defineProperty(this,"isOk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"msg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isOk=0===t,this.code=t,this.msg=n,this.data=r},[{key:"next",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOk){t.n=1;break}return t.a(2,e(this.data));case 1:return t.a(2,this.wipe())}},t,this)}))}},{key:"or",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOk){t.n=1;break}return t.a(2,this);case 1:return t.a(2,e(this.code))}},t,this)}))}},{key:"orSync",value:function(e){return this.isOk?this:e(this.code)}},{key:"trans",value:function(e){return this.isOk?$(e(this.data)):this.wipe()}},{key:"tryTrans",value:function(e){return this.isOk?e(this.data):this.wipe()}},{key:"errmsg",value:function(){return JSON.stringify({code:this.code,msg:this.msg})}},{key:"wipe",value:function(){return this.isOk?$(void 0,this.msg):ee(this.code,this.msg)}}])}(),$=function(e,t){return new X(0,t||"success",e)},ee=function(e,t,n){return new X(e,t||"fail: ".concat(e),n)},te=function(){var e,t=new Promise(function(t){e=t});return{resolve:e,promise:t}},ne=function(){return a(function e(t){i(this,e),Y.add(this),Q.set(this,void 0),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,Q,t,"f"),this._logger=t.logger},[{key:"open",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return e=e.sort(function(e,t){return t.weight-e.weight}),t.a(2,q(this,Y,"m",Z).call(this,e,q(this,Q,"f")))},t,this)}))}}])}();Q=new WeakMap,Y=new WeakSet,Z=function e(t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(0!==t.length){r.n=1;break}return r.a(2,ee(39005,"All addrs failed"));case 1:return i=t.shift(),o=G(i.addr,i.protocol),o="".concat(o,"/v3/message/get_stream.json?sdkVersion=","5.36.1-nctest-alpha.2","&platform=Websocket&messageUID=").concat(n.msgUId),this._logger.info("L-req_stream_msg_content-O","try open -> ".concat(o)),r.n=2,this._openHandler(o,n);case 2:return a=r.v,r.a(2,a.or(function(r){return K(s,void 0,void 0,p().m(function i(){return p().w(function(i){for(;;)switch(i.n){case 0:if(-1!==r){i.n=1;break}return i.a(2,q(this,Y,"m",e).call(this,t,n));case 1:return i.a(2,a)}},i,this)}))}))}},r,this)}))};var re=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,ne),a(e,[{key:"_openHandler",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s=this;return p().w(function(n){for(;;)if(0===n.n)return r=te(),i=r.resolve,o=r.promise,(a=new XMLHttpRequest).open("GET",e,!0),a.timeout=t.timeout,a.ontimeout=function(){s._logger.warn("L-req_stream_msg_content-E","timeout -> ".concat(e)),i(ee(-1,"timeout"))},a.onreadystatechange=function(n){if(a.readyState===XMLHttpRequest.HEADERS_RECEIVED){var r=a.getResponseHeader("Content-Type"),o=null==r?void 0:r.startsWith("text/event-stream");if(200===a.status&&o){i($());var c=0;a.onprogress=function(e){var n=a.response.slice(c);c=a.response.length,t.onRawContent(n)},a.onerror=function(n){s._logger.warn("L-req_stream_msg_content-E","network error in transit -> ".concat(e)),a.onprogress=null,a.abort(),t.onNetworkError(39005)}}else a.onloadend=function(){var e=JSON.parse(a.response);i(ee(e.code,e.message))}}},a.onerror=function(t){s._logger.warn("L-req_stream_msg_content-E","req fail -> ".concat(e)),i(ee(-1))},a.setRequestHeader("Content-Type","application/json;charset=UTF-8"),a.setRequestHeader("App-Key",t.appkey),a.setRequestHeader("Authorization","Bearer ".concat(t.token)),a.send(),n.a(2,o)},n)}))}}])}(),ie=!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,r=t.length;n<r;n++)if(!e[t[n]])return!1;return!0}(uni));var oe=null,ae=function(e){return K(void 0,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,_e.getNetworkType();case 1:n=t.v,oe({status:"online"===e.type,type:n});case 2:return t.a(2)}},t)}))};var se,ce,ue,de,_e={tag:"browser",httpReq:function(e){return z(e).result()},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:ie,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",Promise.resolve($({id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,r=t.reason;e(n,r)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}))},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:w.UNKONWN},t=e.type,n=e.effectiveType,r=t||n||w.UNKONWN;return Promise.resolve(r)},setNetworkStatusListener:function(e){oe=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",ae),window.addEventListener("online",ae))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",ae),window.removeEventListener("online",ae)),oe=null},createSSEClient:function(e){return $(new re(e))},getApiVer:function(){var e=_e.runtimeInfo,t=e.type,n=e.version;return"|".concat(t,"|").concat(n)},get runtimeInfo(){var e,t,n=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var i in r)if(r.hasOwnProperty(i)){var o=n.match(r[i]);if(o){t=i,e=o[1]||o[2];break}}return{type:t||"Unknown",version:e||"Unknown"}}},le=_e;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=2]="GROUP",e[e.SYSTEM=3]="SYSTEM",e[e.CUSTOM=4]="CUSTOM",e[e.RTC_ROOM=7]="RTC_ROOM"}(se||(se={})),function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ce||(ce={})),function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.STATISTICS=6]="STATISTICS"}(ue||(ue={})),function(e){e.RTC="RTC",e.CallPlus="CallPlus"}(de||(de={}));class pe{constructor(e){Object.defineProperty(this,"_writer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:0})}debug(e,t,n){this._writer.writeLog(ue.Debug,e,null!=t?t:"",n)}info(e,t,n){this._writer.writeLog(ue.Info,e,null!=t?t:"",n)}warn(e,t,n){this._writer.writeLog(ue.Warn,e,null!=t?t:"",n)}error(e,t,n){this._writer.writeLog(ue.Error,e,null!=t?t:"",n)}createTraceId(){return""+ ++this._traceId}setOutputLevel(e){this._writer.setOutputLevel(e)}__statistics(e,t,n){this._writer.writeLog(ue.STATISTICS,e,null!=t?t:"",n)}}const fe={toCommon:e=>e,toNative:e=>e},he={[e.ConversationType.PRIVATE]:se.PRIVATE,[e.ConversationType.GROUP]:se.GROUP,[e.ConversationType.SYSTEM]:se.SYSTEM,[e.ConversationType.CHATROOM]:se.CUSTOM,[e.ConversationType.APP_PUBLIC_SERVICE]:se.RTC_ROOM,[e.ConversationType.RTC_ROOM]:se.RTC_ROOM},Re={[se.PRIVATE]:e.ConversationType.PRIVATE,[se.GROUP]:e.ConversationType.GROUP,[se.SYSTEM]:e.ConversationType.SYSTEM,[se.CUSTOM]:e.ConversationType.CHATROOM,[se.RTC_ROOM]:e.ConversationType.APP_PUBLIC_SERVICE},ge={toCommon(e){var t;return null!==(t=he[e])&&void 0!==t?t:e},toNative(e){var t;return null!==(t=Re[e])&&void 0!==t?t:e}},me={[e.RCConnectionStatus.CONNECTED]:ce.CONNECTED,[e.RCConnectionStatus.CONNECTING]:ce.CONNECTING,[e.RCConnectionStatus.DISCONNECTED]:ce.DISCONNECTED,[e.RCConnectionStatus.SUSPENDED]:ce.SUSPENDED},Ce={[ce.DISCONNECTED]:e.RCConnectionStatus.DISCONNECTED,[ce.CONNECTING]:e.RCConnectionStatus.CONNECTING,[ce.CONNECTED]:e.RCConnectionStatus.CONNECTED,[ce.SUSPENDED]:e.RCConnectionStatus.SUSPENDED},ve={toNative:e=>Object.assign({},e)},Te={errorCode:fe,conversationType:ge,connectionStatus:{toCommon(e){var t;return null!==(t=me[e])&&void 0!==t?t:e},toNative(e){var t;return null!==(t=Ce[e])&&void 0!==t?t:e}},sendMsgOptions:ve,receivedMessage:{toCommon:e=>e},naviInfo:{toCommon(e){var t,n,r;return{voipCallInfo:null!==(t=e.voipCallInfo)&&void 0!==t?t:void 0,rtcAISwitch:e.rtcAISwitch,jwtToken:null!==(n=e.jwtToken)&&void 0!==n?n:e.jwt,logServer:e.logServer,dataCenter:null!==(r=e.dataCenter)&&void 0!==r?r:e.dc,openGzip:e.openGzip,ipType:e.ipType}}}};var Ie,Se,Ee,Oe;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=2]="GROUP",e[e.SYSTEM=3]="SYSTEM",e[e.CUSTOM=4]="CUSTOM",e[e.RTC_ROOM=7]="RTC_ROOM"}(Ie||(Ie={})),function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(Se||(Se={})),function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.STATISTICS=6]="STATISTICS"}(Ee||(Ee={})),function(e){e.RTC="RTC",e.CallPlus="CallPlus"}(Oe||(Oe={}));var be,ye,Le,ke=0,Ae=2,Ne=-1;exports.RCRTCCode=void 0,(be=exports.RCRTCCode||(exports.RCRTCCode={}))[be.SUCCESS=1e4]="SUCCESS",be[be.PB_ERROR=40001]="PB_ERROR",be[be.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",be[be.PARAMS_ERROR=50001]="PARAMS_ERROR",be[be.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",be[be.NOT_IN_ROOM=50003]="NOT_IN_ROOM",be[be.SERVICE_INVALID=50004]="SERVICE_INVALID",be[be.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",be[be.ASR_NOT_AVAILABLE=50034]="ASR_NOT_AVAILABLE",be[be.ASR_NOT_START=50035]="ASR_NOT_START",be[be.SIGNAL_ERROR=53001]="SIGNAL_ERROR",be[be.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",be[be.REQUEST_FAILED=53004]="REQUEST_FAILED",be[be.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",be[be.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",be[be.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",be[be.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",be[be.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",be[be.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",be[be.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",be[be.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",be[be.INVALID_TAGS=53014]="INVALID_TAGS",be[be.INVALID_USER_ID=53015]="INVALID_USER_ID",be[be.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",be[be.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",be[be.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",be[be.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",be[be.TRACK_NOT_READY=53020]="TRACK_NOT_READY",be[be.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",be[be.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",be[be.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",be[be.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",be[be.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",be[be.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",be[be.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",be[be.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",be[be.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",be[be.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",be[be.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",be[be.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",be[be.JWT_TIME_OUT=1004]="JWT_TIME_OUT",be[be.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",be[be.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",be[be.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",be[be.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",be[be.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",function(e){e.L_INDEX_INSTALL_RTC_PLUGIN_O="L-index_install_rtc_plugin-O",e.L_RTC_CLIENT_IM_CONNECTION_STATE_S="L-rtc_client_im_connection_state-S",e.L_RTC_CLIENT_MESSAGE_O="L-rtc_client_message-O",e.L_RTC_CLIENT_DESTROY_S="L-rtc_client_destroy-S",e.L_RTC_CLIENT_JOIN_RTC_ROOM_T="L-rtc_client_join_rtc_room-T",e.L_RTC_CLIENT_JOIN_RTC_ROOM_O="L-rtc_client_join_rtc_room-O",e.L_RTC_CLIENT_JOIN_RTC_ROOM_R="L-rtc_client_join_rtc_room-R",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_T="L-rtc_client_join_living_room-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_R="L-rtc_client_join_living_room-R",e.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O="L-rtc_client_get_audience_client-O",e.L_RTC_CLIENT_LEAVE_ROOM_T="L-rtc_client_leave_room-T",e.L_RTC_CLIENT_LEAVE_ROOM_R="L-rtc_client_leave_room-R",e.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O="L-rtc_client_create_microphone_audio_track-O",e.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O="L-rtc_client_create_camera_video_track-O",e.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O="L-rtc_client_create_microphone_and_camera_tracks-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O="L-rtc_client_create_screen_video_track-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O="L-rtc_client_create_screen_video_and_audio_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O="L-rtc_client_create_local_audio_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O="L-rtc_client_create_local_video_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O="L-rtc_client_create_local_file_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O="L-rtc_client_create_local_tracks-O",e.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O="L-rtc_client_apply_video_aspect_ratio-O",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_join_living_room_as_audience-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_join_living_room_as_audience_R",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_leave_living_room_as_audience-T",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_leave_living_room_as_audience-R",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T="L-rtc_client_upgrade_to_anchor_room-T",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R="L-rtc_client_upgrade_to_anchor_room-R",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T="L-rtc_client_downgrade_to_audience_room-T",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R="L-rtc_client_downgrade_to_audience_room-R",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T="L-rtc_client_get_joined_room_info-T",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R="L-rtc_client_get_joined_room_info-R",e.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T="L-rtc_client_generate_summarization-T",e.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R="L-rtc_client_generate_summarization-R",e.L_RTC_CLIENT_GET_ASR_CONTENT_T="L-rtc_client_get_asr_content-T",e.L_RTC_CLIENT_GET_ASR_CONTENT_R="L-rtc_client_get_asr_content-R",e.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O="L-audinence_client_call_onTrackReady-O",e.L_AUDIENCE_CLIENT_SUBSCRIBE_T="L-audinence_client_subscribe-T",e.L_AUDIENCE_CLIENT_SUBSCRIBE_R="L-audinence_client_subscribe-R",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T="L-audinence_client_unsubscribe-T",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R="L-audinence_client_unsubscribe-R",e.L_PINGER_START_O="L-pinger_start-O",e.L_PINGER_STOP_O="L-pinger_stop-O",e.L_PINGER_SEND_RTCPING_E="L-pinger_send_rtcping-E",e.L_ABSTRACT_ROOM_SEND_MESSAGE_T="L-abstract_room_send_message-T",e.L_ABSTRACT_ROOM_SEND_MESSAGE_R="L-abstract_room_send_message-R",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T="L-abstract_room_set_room_attribute-T",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R="L-abstract_room_set_room_attribute_R",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T="L-abstract_room_delete_room_attribute_T",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R="L-abstract_room_delete_room_attribute_R",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T="L-abstract_room_get_room_attribute_T",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R="L-abstract_room_get_room_attribute_R",e.L_ABSTRACT_ROOM_PUBLISH_T="L-abstract_room_publish-T",e.L_ABSTRACT_ROOM_PUBLISH_R="L-abstract_room_publish-R",e.L_ABSTRACT_ROOM_PUBLISH_E="L-abstract_room_publish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_T="L-abstract_room_unpublish-T",e.L_ABSTRACT_ROOM_UNPUBLISH_R="L-abstract_room_unpublish-R",e.L_ABSTRACT_ROOM_UNPUBLISH_E="L-abstract_room_unpublish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_P="L-abstract_room_unpublish-P",e.L_ABSTRACT_ROOM_SUBSCRIBE_T="L-abstract_room_subscribe-T",e.L_ABSTRACT_ROOM_SUBSCRIBE_R="L-abstract_room_subscribe-R",e.L_ABSTRACT_ROOM_SUBSCRIBE_E="L-abstract_room_subscribe-E",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_T="L-abstract_room_unsubscribe-T",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_R="L-abstract_room_unsubscribe-R",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_E="L-abstract_room_unsubscribe-E",e.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_T="L-abstract_room_set_src_language-T",e.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_R="L-abstract_room_set_src_language-R",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T="L-abstract_room_operate_asr_status-T",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R="L-abstract_room_operate_asr_status-R",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T="L-abstract_room_set_enable_asr-T",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R="L-abstract_room_set_enable_asr-R",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T="L-abstract_room_operate_realtime_translation-T",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R="L-abstract_room_operate_realtime_translation-R",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T="L-abstract_room_operate_summarization-T",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R="L-abstract_room_operate_summarization-R",e.L_APP_CALL_UNSUBSCRIBE_O="L-app_call_unsubscribe-O",e.L_USER_LEFT_UNSUBSCRIBE_O="L-user_left_unsubscribe-O",e.L_RES_UNPUB_UNSUBSCRIBE_O="L-res_unpub_unsubscribe-O",e.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O="L-abstract_room_register_room_event_listener-O",e.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O="L-abstract_room_register_report_listener-O",e.L_ABSTRACT_ROOM_AUDIO_LEVEL_O="L-abstract_room_audio_level-O",e.L_ABSTRACT_ROOM_IM_RECONNECTED_T="L-abstract_room_im_reconnected-T",e.L_ABSTRACT_ROOM_IM_RECONNECTED_R="L-abstract_room_im_reconnected-R",e.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O="L-abstract_room_call_app_listener-O",e.L_ABSTRACT_ROOM_SETBITRATE_O="L-abstract_room_setBitrate-O",e.L_ABSTRACT_ROOM_ONTRACKREADY_O="L-abstract_room_onTrackReady-O",e.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O="L-abstract_room_receive_message-O",e.L_ABSTRACT_ROOM_ONKICKOFF_O="L-abstract_room_onKickoff-O",e.L_LIVING_ROOM_RECONNECTED_T="L-living_room_reconnected-T",e.L_LIVING_ROOM_RECONNECTED_R="L-living_room_reconnected-R",e.L_LIVING_ROOM_ENABLE_INNER_CDN_T="L-living_room_enable_inner_cdn-T",e.L_LIVING_ROOM_ENABLE_INNER_CDN_R="L-living_room_enable_inner_cdn-R",e.L_LIVING_ROOM_SPREAD_CDN_INFO_T="L-living_room_spread_cdn_info-T",e.L_LIVING_ROOM_SPREAD_CDN_INFO_R="L-living_room_spread_cdn_info-R",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T="L-living_room_set_room_cdn_info-T",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R="L-living_room_set_room_cdn_info-R",e.L_LIVING_ROOM_JOINED_PK_ROOM_T="L-living_room_joined_pk_room-T",e.L_LIVING_ROOM_JOINED_PK_ROOM_R="L-living_room_joined_pk_room-R",e.L_LIVING_ROOM_LEAVE_PK_ROOM_T="L-living_room_leave_pk_room-T",e.L_LIVING_ROOM_LEAVE_PK_ROOM_R="L-living_room_leave_pk_room-R",e.L_APP_CALL_LEAVE_PK_ROOM_O="L-app_call_leave_pk_room-O",e.L_QUIT_PK_LEAVE_PK_ROOM_O="L-quit_pk_leave_pk_room-O",e.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O="L-living_room_get_room_pk_handler-O",e.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O="L-living_room_get_mcu_config_builder-O",e.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O="L-living_room_quit_all_pk_room-O",e.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O="L-living_pk_handler_register_room_pk_event_listener-O",e.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O="L-living_pk_handler_call_app_listener-O",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_request_join_other_room-T",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_request_join_other_room-R",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_cancel_request_join_other_room-T",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_cancel_request_join_other_room-R",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T="L-living_pk_handler_response_join_other_room-T",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R="L-living_pk_handler_response_join_other_room-R",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T="L-living_pk_handler_join_other_room-T",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R="L-living_pk_handler_join_other_room-R",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_T="L-living_pk_handler_leave_other_room-T",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_R="L-living_pk_handler_leave_other_room-R",e.L_QUIT_PK_T="L-quit_pk-T",e.L_QUIT_PK_R="L-quit_pk-R",e.L_EXCHANGE_WITH_PUSHOTHERROOM_T="L-exchange_with_pushotherroom-T",e.L_EXCHANGE_WITH_PUSHOTHERROOM_R="L-exchange_with_pushotherroom-R",e.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O="L-audience_living_room_call_app_listener-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_O="L-audience_living_room_pull_kvEntries-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R",e.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P="L-audience_living_room_singal_data_change-P",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T="L-audience_living_room_get_cdn_play_url-T",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R="L-audience_living_room_get_cdn_play_url-R",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T="L-audience_living_room_subscribe-T",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R="L-audience_living_room_subscribe-R",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T="L-audience_living_room_unsubscribe-T",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R="L-audience_living_room_unsubscribe-R",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T="L-audience_living_room_update_subscribeList-T",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R="L-audience_living_room_update_subscribeList-R",e.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O="L-audience_living_room_onTrackReady-O",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R="L-audience_living_room_im_reconnected-R",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T="L-audience_living_room_im_reconnected-T",e.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O="L-mcu_config_builder_set_host_video_track-O",e.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O="L-mcu_config_builder_set_mix_layout_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O="L-mcu_config_builder_set_output_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_tiny_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O="L-mcu_config_builder_set_output_tiny_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_tiny_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O="L-mcu_config_builder_set_output_video_render_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O="L-mcu_config_builder_set_output_audio_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O="L-mcu_config_builder_set_output_background_color-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_add_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_remove_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_clear_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O="L-mcu_config_builder_set_output_background_picture-fill-mode-O",e.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_add_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_remove_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_clear_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_add_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_remove_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_clear_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_set_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_add_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_remove_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_clear_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_RESET_O="L-mcu_config_builder_reset-O",e.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O="L-mcu_config_builder_add_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O="L-mcu_config_builder_remove_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_CLEAR_SINGLE_WATER_MARK_O="L-mcu_config_builder_clear_single_water_mark-O",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_T="L-media_service_set_mcu_config-T",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_R="L-media_service_set_mcu_config-R",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T="L-media_service_get_cnd_resource_info-T",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R="L-media_service_get_cnd_resource_info-R",e.L_MEDIA_SERVICE_MSLIST_CHANGE_O="L-media_service_msList_change-O",e.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O="L-media_service_parse_navi_callvoip_info-O",e.L_MEDIA_SERVICE_REQUEST_T="L-media_service_request-T",e.L_MEDIA_SERVICE_REQUEST_R="L-media_service_request-R",e.L_LOCAL_TRACK_DESTROY_O="L-loacl_track_destroy-O",e.L_LOCAL_TRACK_SET_BITRATE_O="L-loacl_track_set_bitrate-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_O="L-loacl_track_set_local_muted-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T="L-loacl_track_set_local_muted_spread-T",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R="L-loacl_track_set_local_muted_spread-R",e.L_TRACK_PLAY_O="L-track_play-O",e.L_TRACK_PLAY_E="L-track_play-E",e.L_TRACK_LOAD_START_O="L-track_load_start-O",e.L_TRACK_DURATION_CHANGE_O="L-track_duration_change-O",e.L_TRACK_LOADED_META_DATA_O="L-track_loaded_meta_data-O",e.L_TRACK_LOADED_DATA_O="L-track_loaded_data-O",e.L_TRACK_ABORT_O="L-track_abort-O",e.L_TRACK_VOLUME_CHANGE_O="L-track_volume_change-O",e.L_TRACK_CANPLAY_O="L-track_canplay-O",e.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O="L-abstract_stat_parser_format_rtc_state_report-O",e.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O="L-a_sdp_strategy_set_sdp_semantics-O",e.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O="L-a_sdp_strategy_set_remote_answer-O",e.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O="L-rtc_peer_connection_add_local_track-O",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S="L-rtc_peer_connection_ice_connection_state-S",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R="L-rtc_peer_connection_ice_connection_state_report-R",e.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S="L-rtc_peer_connection_connection_state-S",e.L_RTC_PEER_CONNECTION_SET_BITRATE_O="L-rtc_peer_connection_set_bitrate-O",e.L_RTC_PEER_CONNECTION_CREATE_OFFER_O="L-rtc_peer_connection_create_offer-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O="L-rtc_peer_connection_remove_local_track_by_id-O",e.L_RTC_PEER_CONNECTION_REMOVE_ALL_LOCAL_TRACK_O="L-rtc_peer_connection_remove_all_local_track-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O="L-rtc_peer_connection_remove_local_track-O",e.L_RTC_PEER_CONNECTION_DESTROY_O="L-rtc_peer_connection_destroy-O",e.L_RTC_SET_RECOMMEND_BITRATE_O="L_rtc_set_recommend_bitrate_O",e.L_RTC_3ANOISE_NODE_O="L_RTC_AAAnoiseNode_O",e.L_RTC_3ANOISE_NODE_E="L_RTC_AAAnoiseNode_E",e.L_RTC_3ANOISE_NODE_STOP_O="L_RTC_AAAnoiseNode_Stop_O",e.L_QS_JOIN_ROOM_S="RTC-joinRoomRtc-S",e.L_QS_SUBSCRIBE_S="RTC-subscribe-S",e.L_QS_UNSUBSCRIBE_S="RTC-unsubscribe-S",e.L_QS_PUBLISH_S="RTC-publishRtc-S",e.L_QS_UNPUBLISH_S="RTC-unpublishRtc-S",e.L_QS_ICE_STATUS_S="RTC-iceStatus-S",e.L_QS_KICKED_S="RTC-forcedOffline-S",e.L_QS_PUB_ICE_STATUS_S="RTC-pubIceConnected-S",e.L_QS_SUB_ICE_STATUS_S="RTC-subIceConnected-S",e.L_QS_RECV_PUB_MSG_S="RTC-recvPubMsg-S",e.L_SET_ENCODER_PREFERENCES_S="RTC-set_Encoder_Preferences-S",e.L_RTCNTF_PULL_ROOM_STATUS_O="L-rtcntf_pull_room_status-O",e.L_RTCPING_PULL_ROOM_STATUS_O="L-rtcping_pull_room_status-O",e.L_PULL_ROOM_STATUS_T="L-pull_room_status-T",e.L_PULL_ROOM_STATUS_R="L-pull_room_status-R",e.L_OLD_DAILY_RECORD_O="L-old_daily_record-O",e.L_REMOTE_USER_JOINED_RESOURCES_O="L-remote_user_joined_resources-O",e.L_REMOTE_USER_STATE_HANDLE_O="L-remote_user_state_handle-O",e.L_UPDATE_SUBSCRIBELIST_COMMAND_T="L-update_subscribeList_command-T",e.L_UPDATE_SUBSCRIBELIST_COMMAND_P="L-update_subscribeList_command-P",e.L_UPDATE_SUBSCRIBELIST_COMMAND_R="L-update_subscribeList_command-R",e.L_RTC_CLIENT_NAVI_CHANGE_O="L-rtc_client_navi_change-O",e.L_UNPUBLISH_PREV_COMMAND_T="L-unpublish_prev_command-T",e.L_UNPUBLISH_PREV_COMMAND_R="L-unpublish_prev_command-R",e.L_RETRY_EXCHANGE_COMMAND_T="L-retry_exchange_command-T",e.L_RETRY_EXCHANGE_SPREAD_T="L-retry_exchange_spread-T",e.L_RETRY_EXCHANGE_SPREAD_R="L-retry_exchange_spread-R",e.L_PARSE_USERSTATE_COMMAND_R="L-parse_userstate_command-R",e.L_RESUB_REPUB_RES_R="L-resub_repub_res-R",e.L_PARSE_ROOMDATA_URIS_R="L-parse_roomdata_uris-R",e.L_SET_AUDIO_CONSTRAINTS_O="L-set_audio_constraints-O",e.L_FUNCTION_IS_UNAVAILABLE="L-function_is_unavailable",e.L_CLEAR_UNSUBSCRIBE_LIST_O="L-clear_unsubscribe_list-O",e.L_INVOKER_PUSH_O="L-invoker_push-O",e.L_INVOKER_EXECUTE_T="L-invoker_execute-T",e.L_INVOKER_EXECUTE_R="L-invoker_execute-R",e.L_INVOKER_DESTROY_O="L-invoker_destroy-R",e.L_PARSE_VOIP_SERVER_CONF_E="L_PARSE_VOIP_SERVER_CONF_E",e.L_GET_MEDIA_STREAM_E="L_GET_MEDIA_STREAM_E",e.L_INNER_SET_TRACK_O="L_INNER_SET_TRACK_O",e.A_APPLY_3A_NOISE_WORKLET_T="A-apply_3a_noise_worklet-T",e.A_APPLY_3A_NOISE_WORKLET_R="A-apply_3a_noise_worklet-R",e.L_ENCRYPTOR_ENCODE_E="L-encryptor_encode-E",e.L_ENCRYPTOR_DECODE_E="L-encryptor_decode-E",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T="L-rtc_client_change_media_device-T",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R="L-rtc_client_change_media_device-R"}(ye||(ye={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(Le||(Le={}));let Pe=!0,De=!0;function Ue(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function we(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};const o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Me(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Pe=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function xe(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(De=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Be(){if("object"==typeof window){if(Pe)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Ve(e,t){De&&console.warn(e+" is deprecated, please use "+t+" instead.")}function je(e){return"[object Object]"===Object.prototype.toString.call(e)}function Fe(e){return je(e)?Object.keys(e).reduce(function(t,n){const r=je(e[n]),i=r?Fe(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[n]:i})},{}):e}function Ge(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith("Id")?Ge(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach(t=>{Ge(e,e.get(t),n)})}))}function Je(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)}),o.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&Ge(e,n,i)})}),i}const He=Be;function Ke(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let a=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!a&&n.length&&t.includes("back")&&(a=n[n.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=r(e.video),He("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return He("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(o(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(o(e))))}}}function qe(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function We(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else we(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function ze(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ye(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},o=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(o(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])}).then(n,r)}}function Qe(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Je(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),we(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Je(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Ze(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function Xe(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Ze(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>o(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function $e(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function et(e,t){we(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var tt=Object.freeze({__proto__:null,shimMediaStream:qe,shimOnTrack:We,shimGetSendersWithDtmf:ze,shimGetStats:Ye,shimSenderReceiverGetStats:Qe,shimAddTrackRemoveTrackWithNative:Ze,shimAddTrackRemoveTrack:Xe,shimPeerConnection:$e,fixNegotiationNeeded:et,shimGetUserMedia:Ke,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var nt,rt,it=(nt=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},t.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(function(e){return 0===e.indexOf(n)})},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach(function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)}),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var o=r[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach(function(e){n.headerExtensions.push(t.parseExtmap(e))}),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach(function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)});var i=0;return n.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach(function(e){r+=t.writeExtmap(e)}),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(t))}}),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach(function(e){e.maxBitrate=d})),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){var n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var o=t.writeRtpDescription(e.kind,n);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t},nt(rt={exports:{}},rt.exports),rt.exports);function ot(e,t,n,r,i){var o=it.writeRtpDescription(e.kind,t);if(o+=it.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=it.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(r?r.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+it.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+it.localCName+"\r\n"),o}function at(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var o=r(e.parameters.apt,n),a=r(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach(function(r){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(r.name.toLowerCase()===a.name.toLowerCase()&&r.clockRate===a.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&a.parameters.apt&&!i(r,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(r.numChannels,a.numChannels),n.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter(function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}}),n}function st(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function ct(e,t){var n=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});return n||e.addRemoteCandidate(t),!n}function ut(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var dt=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=i,e.setTimeout(function(){t._dispatchEvent("track",o)})}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){r[e]=i[e].bind(i)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw ut("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||n?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(n=!0,!0)}),delete e.url,e.urls=i?r[0]:r,!!r.length}})}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var o=n.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=it.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw ut("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find(function(e){return e.track===t}))throw ut("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach(function(t){n.addTrack(t,e)});else{var r=e.clone();e.getTracks().forEach(function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",function(e){n.enabled=e.enabled})}),r.getTracks().forEach(function(e){n.addTrack(e,r)})}},i.prototype.removeTrack=function(t){if(this._isClosed)throw ut("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find(function(e){return e.rtpSender===t});if(!n)throw ut("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var n=t.getSenders().find(function(t){return t.track===e});n&&t.removeTrack(n)})},i.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},i.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:n};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=it.writeCandidate(a);o.candidate=Object.assign(o.candidate,it.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=it.getMediaSections(r._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",r._localDescription.sdp=it.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",o),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout(function(){o.forEach(function(e){i.onlocalcandidate(e)})},0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=at(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:it.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(ut("TypeError",'Unsupported type "'+e.type+'"'));if(!st("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(ut("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=it.splitSections(e.sdp),n=t.shift(),t.forEach(function(e,t){var n=it.parseRtpParameters(e);r.transceivers[t].localCapabilities=n}),r.transceivers.forEach(function(e,t){r._gather(e.mid,t)});else if("answer"===e.type){t=it.splitSections(r._remoteDescription.sdp),n=t.shift();var i=it.matchPrefix(n,"a=ice-lite").length>0;t.forEach(function(e,t){var o=r.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,d=o.remoteCapabilities;if(!(it.isRejected(e)&&0===it.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var _=it.getIceParameters(e,n),l=it.getDtlsParameters(e,n);i&&(l.role="server"),r.usingBundle&&0!==t||(r._gather(o.mid,t),"new"===s.state&&s.start(a,_,i?"controlling":"controlled"),"new"===c.state&&c.start(l));var p=at(u,d);r._transceive(o,p.codecs.length>0,!1)}})}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(ut("TypeError",'Unsupported type "'+i.type+'"'));if(!st("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(ut("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach(function(e){a[e.id]=e});var s=[],c=it.splitSections(i.sdp),u=c.shift(),d=it.matchPrefix(u,"a=ice-lite").length>0,_=it.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=_;var l=it.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!l&&l.substr(14).split(" ").indexOf("trickle")>=0,c.forEach(function(r,c){var l=it.splitLines(r),p=it.getKind(r),f=it.isRejected(r)&&0===it.matchPrefix(r,"a=bundle-only").length,h=l[0].substr(2).split(" ")[2],R=it.getDirection(r,u),g=it.parseMsid(r),m=it.getMid(r)||it.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===h||"UDP/DTLS/SCTP"===h))o.transceivers[c]={mid:m,kind:p,protocol:h,rejected:!0};else{var C,v,T,I,S,E,O,b,y;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var L,k,A=it.parseRtpParameters(r);f||(L=it.getIceParameters(r,u),(k=it.getDtlsParameters(r,u)).role="client"),O=it.parseRtpEncodingParameters(r);var N=it.parseRtcpParameters(r),P=it.matchPrefix(r,"a=end-of-candidates",u).length>0,D=it.matchPrefix(r,"a=candidate:").map(function(e){return it.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===i.type||"answer"===i.type)&&!f&&_&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){v=(C=o.transceivers[c]).iceGatherer,T=C.iceTransport,I=C.dtlsTransport,S=C.rtpReceiver,E=C.sendEncodingParameters,b=C.localCapabilities,o.transceivers[c].recvEncodingParameters=O,o.transceivers[c].remoteCapabilities=A,o.transceivers[c].rtcpParameters=N,D.length&&"new"===T.state&&(!d&&!P||_&&0!==c?D.forEach(function(e){ct(C.iceTransport,e)}):T.setRemoteCandidates(D)),_&&0!==c||("new"===T.state&&T.start(v,L,"controlling"),"new"===I.state&&I.start(k)),!at(C.localCapabilities,C.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&C.sendEncodingParameters[0].rtx&&delete C.sendEncodingParameters[0].rtx,o._transceive(C,"sendrecv"===R||"recvonly"===R,"sendrecv"===R||"sendonly"===R),!S||"sendrecv"!==R&&"sendonly"!==R?delete C.rtpReceiver:(y=S.track,g?(a[g.stream]||(a[g.stream]=new e.MediaStream),n(y,a[g.stream]),s.push([y,S,a[g.stream]])):(a.default||(a.default=new e.MediaStream),n(y,a.default),s.push([y,S,a.default])))}}else{(C=o.transceivers[c]||o._createTransceiver(p)).mid=m,C.iceGatherer||(C.iceGatherer=o._createIceGatherer(c,_)),D.length&&"new"===C.iceTransport.state&&(!P||_&&0!==c?D.forEach(function(e){ct(C.iceTransport,e)}):C.iceTransport.setRemoteCandidates(D)),b=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(b.codecs=b.codecs.filter(function(e){return"rtx"!==e.name})),E=C.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var U,w=!1;if("sendrecv"===R||"sendonly"===R){if(w=!C.rtpReceiver,S=C.rtpReceiver||new e.RTCRtpReceiver(C.dtlsTransport,p),w)y=S.track,g&&"-"===g.stream||(g?(a[g.stream]||(a[g.stream]=new e.MediaStream,Object.defineProperty(a[g.stream],"id",{get:function(){return g.stream}})),Object.defineProperty(y,"id",{get:function(){return g.track}}),U=a[g.stream]):(a.default||(a.default=new e.MediaStream),U=a.default)),U&&(n(y,U),C.associatedRemoteMediaStreams.push(U)),s.push([y,S,U])}else C.rtpReceiver&&C.rtpReceiver.track&&(C.associatedRemoteMediaStreams.forEach(function(t){var n=t.getTracks().find(function(e){return e.id===C.rtpReceiver.track.id});n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)}),C.associatedRemoteMediaStreams=[]);C.localCapabilities=b,C.remoteCapabilities=A,C.rtpReceiver=S,C.rtcpParameters=N,C.sendEncodingParameters=E,C.recvEncodingParameters=O,o._transceive(o.transceivers[c],!1,w)}}}),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach(function(t){var n=a[t];if(n.getTracks().length){if(-1===o.remoteStreams.indexOf(n)){o.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout(function(){o._dispatchEvent("addstream",i)})}s.forEach(function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(o,t,i,[n])})}}),s.forEach(function(e){e[2]||r(o,e[0],e[1],[])}),e.setTimeout(function(){o&&o.transceivers&&o.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++}),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(ut("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter(function(e){return"audio"===e.kind}).length,i=n.transceivers.filter(function(e){return"video"===e.kind}).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(r=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(n.transceivers.forEach(function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)});r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var a=it.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach(function(r,i){var o=r.track,a=r.kind,s=r.mid||it.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter(function(e){return"rtx"!==e.name})),c.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),c.headerExtensions.forEach(function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,a)),r.localCapabilities=c,r.sendEncodingParameters=u}),"max-compat"!==n._config.bundlePolicy&&(a+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",n.transceivers.forEach(function(e,t){a+=ot(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,a+="a="+it.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))});var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(ut("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(ut("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=it.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=it.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach(function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;if(e.stream)"audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=at(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=ot(e,s,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}});var o=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(r,i){if(!n._remoteDescription)return i(ut("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<n.transceivers.length;a++)if(n.transceivers[a].mid===e.sdpMid){o=a;break}var s=n.transceivers[o];if(!s)return i(ut("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?it.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===o||o>0&&s.iceTransport!==n.transceivers[0].iceTransport)&&!ct(s.iceTransport,c))return i(ut("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=it.getMediaSections(n._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=it.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=it.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=it.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()})},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)}),!n)throw ut("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){e[t]&&r.push(e[t].getStats())})}),Promise.all(r).then(function(e){var t=new Map;return e.forEach(function(e){e.forEach(function(e){t.set(e.id,e)})}),t})};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then(function(e){var t=new Map;return Object.keys(e).forEach(function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])}),t})}}});var o=["createOffer","createAnswer"];return o.forEach(function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then(function(t){"function"==typeof e[0]&&e[0].apply(null,[t])},function(t){"function"==typeof e[1]&&e[1].apply(null,[t])}):t.apply(this,arguments)}}),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(t){"function"==typeof e[2]&&e[2].apply(null,[t])}):t.apply(this,arguments)}}),["getStats"].forEach(function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):t.apply(this,arguments)}}),i};function _t(e){const t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function lt(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function pt(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const n=dt(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e){let t=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let n=e.urls||e.url;e.url&&!e.urls&&Ve("RTCIceServer.url","RTCIceServer.urls");const r="string"==typeof n;return r&&(n=[n]),n=n.filter(e=>{if(0===e.indexOf("stun:"))return!1;const n=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return n&&!t?(t=!0,!0):n&&!t}),delete e.url,e.urls=r?n[0]:n,!!n.length}})}(e.iceServers,t.version),Be("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function ft(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var ht=Object.freeze({__proto__:null,shimPeerConnection:pt,shimReplaceTrack:ft,shimGetUserMedia:_t,shimGetDisplayMedia:lt});function Rt(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){Ve("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function gt(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function mt(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,o)}}function Ct(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function vt(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),we(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Tt(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Ve("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function It(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function St(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Et(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Ot(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function bt(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var yt=Object.freeze({__proto__:null,shimOnTrack:gt,shimPeerConnection:mt,shimSenderGetStats:Ct,shimReceiverGetStats:vt,shimRemoveStream:Tt,shimRTCDataChannel:It,shimAddTransceiver:St,shimGetParameters:Et,shimCreateOffer:Ot,shimCreateAnswer:bt,shimGetUserMedia:Rt,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function Lt(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function kt(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function At(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){const r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Nt(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Pt(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function Pt(e){return e&&void 0!==e.video?Object.assign({},e,{video:Fe(e.video)}):e}function Dt(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(Ve("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Ut(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function wt(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function Mt(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xt=Object.freeze({__proto__:null,shimLocalStreamsAPI:Lt,shimRemoteStreamsAPI:kt,shimCallbacksAPI:At,shimGetUserMedia:Nt,shimConstraints:Pt,shimRTCIceServerUrls:Dt,shimTrackEventTransceiver:Ut,shimCreateOfferLegacy:wt,shimAudioContext:Mt});function Bt(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const n=new t(e),r=it.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,we(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Vt(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=it.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=it.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=it.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function jt(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},we(e,"datachannel",e=>(t(e.channel,e.target),e))}function Ft(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Gt(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function Jt(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var Ht=Object.freeze({__proto__:null,shimRTCIceCandidate:Bt,shimMaxMessageSize:Vt,shimSendThrowTypeError:jt,shimConnectionState:Ft,removeExtmapAllowMixed:Gt,shimAddIceCandidateNullOrEmpty:Jt});const Kt=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const n=Be,r=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=Ue(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=Ue(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=Ue(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Ue(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:r,commonShim:Ht,extractVersion:Ue,disableLog:Me,disableWarnings:xe};switch(r.browser){case"chrome":if(!tt||!$e||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(null===r.version)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=tt,Jt(e,r),Ke(e,r),qe(e),$e(e,r),We(e),Xe(e,r),ze(e),Ye(e),Qe(e),et(e,r),Bt(e),Ft(e),Vt(e,r),jt(e),Gt(e,r);break;case"firefox":if(!yt||!mt||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=yt,Jt(e,r),Rt(e,r),mt(e,r),gt(e),Tt(e),Ct(e),vt(e),It(e),St(e),Et(e),Ot(e),bt(e),Bt(e),Ft(e),Vt(e,r),jt(e);break;case"edge":if(!ht||!pt||!t.shimEdge)return n("MS edge shim is not included in this adapter release."),i;n("adapter.js shimming edge."),i.browserShim=ht,_t(e),lt(e),pt(e,r),ft(e),Vt(e,r),jt(e);break;case"safari":if(!xt||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=xt,Jt(e,r),Dt(e),wt(e),At(e),Lt(e),kt(e),Ut(e),Nt(e),Mt(e),Bt(e),Vt(e,r),jt(e),Gt(e,r);break;default:n("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var qt,Wt,zt,Yt;exports.RCFrameRate=void 0,(qt=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",qt.FPS_15="FPS_15",qt.FPS_24="FPS_24",qt.FPS_30="FPS_30",exports.RCResolution=void 0,(Wt=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",Wt.W176_H144="W176_H144",Wt.W180_H180="W180_H180",Wt.W240_H180="W240_H180",Wt.W240_H240="W240_H240",Wt.W256_H144="W256_H144",Wt.W320_H180="W320_H180",Wt.W320_H240="W320_H240",Wt.W360_H360="W360_H360",Wt.W480_H360="W480_H360",Wt.W480_H480="W480_H480",Wt.W640_H360="W640_H360",Wt.W640_H480="W640_H480",Wt.W720_H480="W720_H480",Wt.W848_H480="W848_H480",Wt.W960_H720="W960_H720",Wt.W1280_H720="W1280_H720",Wt.W1920_H1080="W1920_H1080",Wt.W144_H176="W144_H176",Wt.W144_H256="W144_H256",Wt.W180_H240="W180_H240",Wt.W180_H320="W180_H320",Wt.W240_H320="W240_H320",Wt.W360_H480="W360_H480",Wt.W360_H640="W360_H640",Wt.W480_H640="W480_H640",Wt.W480_H720="W480_H720",Wt.W480_H848="W480_H848",Wt.W720_H1280="W720_H1280",Wt.W720_H960="W720_H960",Wt.W1080_H1920="W1080_H1920",exports.RCMediaType=void 0,(zt=exports.RCMediaType||(exports.RCMediaType={}))[zt.AUDIO_ONLY=0]="AUDIO_ONLY",zt[zt.VIDEO_ONLY=1]="VIDEO_ONLY",zt[zt.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Qt,Zt=(c(c(c(c(c(c(c(c(c(c(Yt={},exports.RCResolution.W176_H132,{width:176,height:132,maxBitrate:150,minBitrate:80}),exports.RCResolution.W176_H144,{width:176,height:144,maxBitrate:150,minBitrate:80}),exports.RCResolution.W180_H180,{width:180,height:180,maxBitrate:200,minBitrate:100}),exports.RCResolution.W240_H180,{width:240,height:180,maxBitrate:240,minBitrate:120}),exports.RCResolution.W240_H240,{width:240,height:240,maxBitrate:280,minBitrate:120}),exports.RCResolution.W256_H144,{width:256,height:144,maxBitrate:240,minBitrate:120}),exports.RCResolution.W320_H180,{width:320,height:180,maxBitrate:280,minBitrate:120}),exports.RCResolution.W320_H240,{width:320,height:240,maxBitrate:400,minBitrate:120}),exports.RCResolution.W360_H360,{width:360,height:360,maxBitrate:520,minBitrate:140}),exports.RCResolution.W480_H360,{width:480,height:360,maxBitrate:650,minBitrate:150}),c(c(c(c(c(c(c(c(c(c(Yt,exports.RCResolution.W480_H480,{width:480,height:480,maxBitrate:800,minBitrate:180}),exports.RCResolution.W640_H360,{width:640,height:360,maxBitrate:800,minBitrate:180}),exports.RCResolution.W640_H480,{width:640,height:480,maxBitrate:900,minBitrate:200}),exports.RCResolution.W720_H480,{width:720,height:480,maxBitrate:1e3,minBitrate:200}),exports.RCResolution.W848_H480,{width:848,height:480,maxBitrate:1860,minBitrate:200}),exports.RCResolution.W960_H720,{width:960,height:720,maxBitrate:2e3,minBitrate:250}),exports.RCResolution.W1280_H720,{width:1280,height:720,maxBitrate:2200,minBitrate:250}),exports.RCResolution.W1920_H1080,{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}),exports.RCResolution.W144_H176,{width:144,height:176,maxBitrate:150,minBitrate:80}),exports.RCResolution.W144_H256,{width:144,height:256,maxBitrate:240,minBitrate:120}),c(c(c(c(c(c(c(c(c(c(Yt,exports.RCResolution.W180_H240,{width:180,height:240,maxBitrate:240,minBitrate:120}),exports.RCResolution.W180_H320,{width:180,height:320,maxBitrate:280,minBitrate:120}),exports.RCResolution.W240_H320,{width:240,height:320,maxBitrate:400,minBitrate:120}),exports.RCResolution.W360_H480,{width:360,height:480,maxBitrate:650,minBitrate:150}),exports.RCResolution.W360_H640,{width:360,height:640,maxBitrate:800,minBitrate:180}),exports.RCResolution.W480_H640,{width:480,height:640,maxBitrate:900,minBitrate:200}),exports.RCResolution.W480_H720,{width:480,height:720,maxBitrate:1e3,minBitrate:200}),exports.RCResolution.W480_H848,{width:480,height:848,maxBitrate:1860,minBitrate:930}),exports.RCResolution.W720_H1280,{width:720,height:1280,maxBitrate:2200,minBitrate:250}),exports.RCResolution.W720_H960,{width:720,height:960,maxBitrate:2760,minBitrate:910}),c(Yt,exports.RCResolution.W1080_H1920,{width:1080,height:1920,maxBitrate:4e3,minBitrate:400})),Xt=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},$t=function(e,t){e=Xt(e),t=Xt(t);var n=Zt["W".concat(e,"_H").concat(t)];if(n)return n;var r=e*t;return Object.keys(Zt).map(function(e){return Zt[e]}).sort(function(e,t){return e.height*e.width-t.width*t.height}).filter(function(e){return e.height*e.width>=r})[0]||Zt.W1920_H1080},en={10:1,15:1,24:1.5,30:1.5},tn=function(e){var t=Number.MAX_VALUE,n=1;for(var r in en){var i=Math.abs(e-parseInt(r));i<t&&(t=i,n=en[r])}return n},nn={getCameras:function(){return K(void 0,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"videoinput"===e.kind}))}},e)}))},getMicrophones:function(){return K(void 0,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"audioinput"===e.kind}))}},e)}))},getSpeakers:function(){return K(void 0,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"audiooutput"===e.kind}))}},e)}))}};!function(e){e.AUDIO="audio",e.VIDEO="video"}(Qt||(Qt={}));var rn,on=function(){function e(t,n,o,a,s,c){var u;return i(this,e),u=r(this,e),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(u,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u._streamId=[u._userId||u._roomId,u._tag].join("_"),u._id=[u._streamId,u.isAudioTrack()?0:1].join("_"),u}return _(e,F),a(e,[{key:"getStreamId",value:function(){return this._streamId}},{key:"getTrackId",value:function(){return this._id}},{key:"getUserId",value:function(){return this._userId}},{key:"__innerGetMediaStreamTrack",value:function(){return this._msTrack}},{key:"streamTrack",get:function(){return this._msTrack}},{key:"getTag",value:function(){return this._tag}},{key:"isLocalTrack",value:function(){return this._isLocalTrack}},{key:"isVideoTrack",value:function(){return"video"===this._kind}},{key:"isAudioTrack",value:function(){return"audio"===this._kind}},{key:"isReady",value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}},{key:"__innerSetMediaStreamTrack",value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,n=t.getTracks()[0];n&&t.removeTrack(n),this._isLocalTrack||this._logger.warn(ye.L_INNER_SET_TRACK_O,"trackId: ".concat(this._id,", track: ").concat(e?e.id:"undefined")),e?t.addTrack(e):this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.pause(),this._element.srcObject=null)}},{key:"_setLocalMuted",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,t.a(2,exports.RCRTCCode.SUCCESS)},t,this)}))}},{key:"mute",value:function(){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return e.a(2,this._setLocalMuted(!0))},e,this)}))}},{key:"unmute",value:function(){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return e.a(2,this._setLocalMuted(!1))},e,this)}))}},{key:"isLocalMuted",value:function(){return this._localMuted}},{key:"isMCUTrack",value:function(){return Boolean(this._roomId)}},{key:"isOwnerMuted",value:function(){return this._remoteMuted}},{key:"_validateVolume",value:function(e){if(null==e?void 0:e.volume){if(!y(null==e?void 0:e.volume))return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==e?void 0:e.volume)<0&&(e.volume=0,this._logger.warn(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,msg:"params error -> options.volume < 0",tips:"the valid range of options.volume is 0-100, the value of volume has been set 0"}))),(null==e?void 0:e.volume)>100&&(e.volume=100,this._logger.warn(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,msg:"params error -> options.volume > 100",tips:"the valid range of options.volume is 0-100, the value of volume has been set 100"})))}}},{key:"_validatePlayOptions",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:if(this._msTrack){n.n=1;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),n.a(2,{code:exports.RCRTCCode.TRACK_NOT_READY});case 1:if("ended"===this._msTrack.readyState&&this._logger.warn(ye.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),!(r=this._validateVolume(t))){n.n=2;break}return n.a(2,r);case 2:if(!(null==t?void 0:t.audioDeviceId)){n.n=4;break}return n.n=3,nn.getSpeakers();case 3:if(i=n.v.map(function(e){return e.deviceId}),i.includes(t.audioDeviceId)){n.n=4;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))){n.n=5;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),n.a(2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT});case 5:return n.a(2)}},n,this)}))}},{key:"_setPlayAttrs",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r;return p().w(function(n){for(;;)switch(n.n){case 0:if(e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e){n.n=1;break}return n.n=1,this._element.setSinkId(t.audioDeviceId);case 1:e||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=t.volume/100),null===(r=this._element)||void 0===r||r.setAttribute(this.DataTrackId,this.getTrackId());case 2:return n.a(2)}},n,this)}))}},{key:"play",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o=this;return p().w(function(n){for(;;)switch(n.n){case 0:return this._logger.info(ye.L_TRACK_PLAY_O,JSON.stringify({elementId:null==e?void 0:e.id,trackId:this._id,kind:this._kind,options:t?{volume:null==t?void 0:t.volume,audioDeviceId:t.audioDeviceId}:void 0})),n.n=1,this._validatePlayOptions(e,t);case 1:if(!(r=n.v)){n.n=2;break}return n.a(2,r);case 2:return i=this.isVideoTrack(),this._element=i?e:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t;o._logger.info(ye.L_TRACK_LOAD_START_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.ondurationchange=function(e){var t;o._logger.info(ye.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onloadedmetadata=function(e){var t;o._logger.info(ye.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onloadeddata=function(e){var t;o._logger.info(ye.L_TRACK_LOADED_DATA_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onabort=function(e){var t;o._logger.info(ye.L_TRACK_ABORT_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.oncanplay=function(e){return K(o,void 0,void 0,p().m(function n(){var r,o,a;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:if(this._logger.info(ye.L_TRACK_CANPLAY_O,JSON.stringify({status:Le.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", trackId: ").concat(this._id)})),n.p=1,!(null==t?void 0:t.audioDeviceId)||i){n.n=2;break}return n.n=2,this._element.setSinkId(t.audioDeviceId);case 2:return n.n=3,null===(o=this._element)||void 0===o?void 0:o.play();case 3:n.n=6;break;case 4:if(n.p=4,"No permission to use requested device"!==(a=n.v).message){n.n=5;break}return this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,kind:this._kind,code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(a.message)})),n.a(2);case 5:this._logger.error(ye.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.TRACK_PLAY_ERROR,kind:this._kind,msg:"play error, error msg: ".concat(a.message)}));case 6:return n.a(2)}},n,this,[[1,4]])}))},this._element.onvolumechange=function(e){var t,n,r=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));o._logger.info(ye.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:Le.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", volume: ").concat(r,", trackId: ").concat(o._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,n.n=3,this._setPlayAttrs(i,t);case 3:return n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"__innerDestroy",value:function(){this.__innerSetMediaStreamTrack(void 0)}},{key:"__releaseMediaElement",value:function(){this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.remove(),this._element.srcObject=null)}},{key:"_validateVideoNodeName",value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}])}();exports.RCAudioBitrate=void 0,(rn=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",rn.Music="Music",rn.MusicHigh="MusicHigh";var an,sn=c(c(c({},exports.RCAudioBitrate.Music,{max:64,min:64}),exports.RCAudioBitrate.MusicHigh,{max:128,min:128}),exports.RCAudioBitrate.Speech,{max:32,min:32});exports.RCVideoBitrate=void 0,(an=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",an.LEVEL1="LEVEL1",an.LEVEL2="LEVEL2",an.LEVEL3="LEVEL3",an.LEVEL4="LEVEL4",an.LEVEL5="LEVEL5";var cn=c(c(c(c(c(c({},exports.RCVideoBitrate.LEVEL0,{max:150,min:80}),exports.RCVideoBitrate.LEVEL1,{max:280,min:120}),exports.RCVideoBitrate.LEVEL2,{max:650,min:150}),exports.RCVideoBitrate.LEVEL3,{max:1e3,min:200}),exports.RCVideoBitrate.LEVEL4,{max:2200,min:250}),exports.RCVideoBitrate.LEVEL5,{max:4e3,min:400}),un=function(){function e(){i(this,e)}return a(e,null,[{key:"apply3ANoiseWorklet",value:function(t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:return r=new AudioContext({sampleRate:44100}),n.p=1,n.n=2,r.audioWorklet.addModule(e.SCRIPT_URL);case 2:return n.n=3,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"});case 3:return o=n.v,n.n=4,o.arrayBuffer();case 4:i=n.v,n.n=6;break;case 5:return n.p=5,n.v,n.a(2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED});case 6:return a=r.createMediaStreamSource(new MediaStream([t])),s=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:i}}),c=r.createMediaStreamDestination(),a.connect(s).connect(c),u=c.stream.getAudioTracks()[0],e._maps.set(t.id,r),n.a(2,{code:exports.RCRTCCode.SUCCESS,track:u})}},n,null,[[1,5]])}))}},{key:"release3ANoiseWorklet",value:function(t){var n=e._maps.get(t.id);n&&(n.close(),e._maps.delete(t.id))}}])}();Object.defineProperty(un,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(un,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(un,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map});var dn=function(){function e(t,n,o,a,s){var c;return i(this,e),c=r(this,e,[t,n,o,a,!0]),Object.defineProperty(c,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c.__innerSetMediaStreamTrack(s),s.onended=function(){s.onended=null,c._onTrackEnded()},c}return _(e,on),a(e,[{key:"_onTrackEnded",value:function(){this.emit(e.EVENT_LOCAL_TRACK_END,this),this.removeAll(e.EVENT_LOCAL_TRACK_END)}},{key:"_setLocalMuted",value:function(t){var n=this;return new Promise(function(r){var i=n._localMuted!==t;C(e,"_setLocalMuted",n,3)([t]),n._remoteMuted=n._localMuted,i&&n._isPublished?n.emit(e.__INNER_EVENT_MUTED_CHANGE__,n,r):r(exports.RCRTCCode.SUCCESS),n._logger.info(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:t,trackId:n._id}))})}},{key:"__innerSetPublished",value:function(e){this._isPublished=e}},{key:"isPublished",value:function(){return this._isPublished}},{key:"destroy",value:function(){var t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._isDestroyed||(this._logger.info(ye.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(t=this._msTrack)||void 0===t||t.stop(),C(e,"__innerDestroy",this,3)([]),this.isAudioTrack()&&C(e,"__releaseMediaElement",this,3)([]),this._isPublished&&n&&this.emit(e.__INNER_EVENT_DESTROY__,this))}},{key:"isDestroyed",value:function(){return this._isDestroyed}},{key:"setBitrate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!y(e)||!y(t)||!y(n)||e<=0||t<=0||e<t?this._logger.error(ye.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> max: ".concat(e,",min: ").concat(t,", start: ").concat(n),trackId:this._id})):(this._logger.info(ye.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,max:e,min:t,start:n,trackId:this._id})),this._bitrateInfo={max:e,min:t,start:n})}},{key:"getBitrate",value:function(){var e,t,n,r,i,o,a,s=0,c=0,u=0;if((null===(e=this._msTrack)||void 0===e?void 0:e.kind)===Qt.VIDEO){var d=An(this._msTrack);s=d.min,c=d.max}else if((null===(t=this._msTrack)||void 0===t?void 0:t.kind)===Qt.AUDIO){var _={min:32,max:32};s=_.min,c=_.max}return(null===(n=this._bitrateInfo)||void 0===n?void 0:n.max)&&(u=.7*(null===(r=this._bitrateInfo)||void 0===r?void 0:r.max)),{min:(null===(i=this._bitrateInfo)||void 0===i?void 0:i.min)||s,max:(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)||c,start:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.start)||u}}},{key:"getSettings",value:function(){var e;return null===(e=this._msTrack)||void 0===e?void 0:e.getSettings()}}])}();Object.defineProperty(dn,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(dn,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(dn,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"});var _n=function(){function e(t,n,o,a){return i(this,e),r(this,e,[t,n,o,"audio",a])}return _(e,dn),a(e,[{key:"setRecommendBitrate",value:function(e){if(j("audioBitrate",e,function(e){return e in exports.RCAudioBitrate})){var t=sn[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(ye.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}},{key:"setBitrate",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r[0],a=void 0===o?1:o,s=r[1],c=void 0===s?.7*t||1:s;C(e,"setBitrate",this,3)([t,a,c])}}])}(),ln=function(){function e(t,n,o,a){var s,c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return i(this,e),s=r(this,e,[t,n,o,"video",a]),Object.defineProperty(s,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:c}),s}return _(e,dn),a(e,[{key:"__isTiny",value:function(){return this._isTiny}},{key:"getStreamId",value:function(){var t=C(e,"getStreamId",this,3)([]);return this._isTiny?"".concat(t,"_tiny"):t}},{key:"getTrackId",value:function(){var t=C(e,"getTrackId",this,3)([]);return this._isTiny?"".concat(t,"_tiny"):t}},{key:"setRecommendBitrate",value:function(e){if(j("videoBitrate",e,function(e){return e in exports.RCVideoBitrate})){var t=cn[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(ye.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}},{key:"setBitrate",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=r[0],a=void 0===o?1:o,s=r[1],c=void 0===s?.7*t||1:s;C(e,"setBitrate",this,3)([t,a,c])}}])}(),pn=function(){function e(t,n,o,a,s,c){var u;return i(this,e),u=r(this,e,[t,n,o,a,s]),Object.defineProperty(u,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:c}),e._innerSetMapping(u.getTrackId(),c),u}return _(e,dn),a(e,[{key:"destroy",value:function(){this.isAudioTrack()&&this.mute(),e._innerRemoveMapping(this.getTrackId(),this._resource),C(e,"destroy",this,3)([])}}],[{key:"_innerSetMapping",value:function(e,t){var n=this._mapping.get(t)||[];n.push(e),this._mapping.set(t,n)}},{key:"_innerRemoveMapping",value:function(e,t){var n,r,i=null===(n=this._mapping.get(t))||void 0===n?void 0:n.filter(function(t){return t!==e});i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(r=t.parentNode)||void 0===r||r.removeChild(t))}}])}();Object.defineProperty(pn,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map});var fn,hn=function(){function e(t,n,o,a,s){return i(this,e),r(this,e,[t,n,o,"video",a,s])}return _(e,pn),a(e)}(),Rn=function(){function e(t,n,o,a,s){return i(this,e),r(this,e,[t,n,o,"audio",a,s])}return _(e,pn),a(e,[{key:"_setLocalMuted",value:function(t){var n=this,r=Object.create(null,{_setLocalMuted:{get:function(){return C(e,"_setLocalMuted",n,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return this._resource&&(this._resource.muted=t),e.a(2,r._setLocalMuted.call(this,t))},e,this)}))}},{key:"play",value:function(){return K(this,void 0,void 0,p().m(function e(){var t;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._setLocalMuted(!1);case 1:return t=e.v,e.a(2,{code:t})}},e,this)}))}}])}(),gn=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),t}return _(e,_n),a(e,[{key:"apply3ANoiseWorklet",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r;return p().w(function(e){for(;;)switch(e.n){case 0:if(this._logger.info(ye.A_APPLY_3A_NOISE_WORKLET_T),!this._originTrack){e.n=1;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"3A noise module already applied"})),e.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this._msTrack&&!this.isDestroyed()){e.n=2;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"track not ready"})),e.a(2,{code:exports.RCRTCCode.TRACK_NOT_READY});case 2:if(!this.isPublished()){e.n=3;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"track already published"})),e.a(2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH});case 3:return e.n=4,un.apply3ANoiseWorklet(this._msTrack);case 4:if(t=e.v,n=t.code,r=t.track,n===exports.RCRTCCode.SUCCESS&&r){e.n=5;break}return this._logger.warn(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"apply 3A noise module failed: ".concat(n),SCRIPT_URL:un.SCRIPT_URL,WASM_URL:un.WASM_URL})),e.a(2,{code:n});case 5:return this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(ye.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.SUCCESSED})),e.a(2,{code:exports.RCRTCCode.SUCCESS})}},e,this)}))}},{key:"__innerSetMediaStreamTrack",value:function(t){!t&&this._originTrack&&(un.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),C(e,"__innerSetMediaStreamTrack",this,3)([t])}},{key:"replaceInnerTrack",value:function(e){}}])}(),mn=function(){function e(t,n,o,a){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return i(this,e),r(this,e,[t,n,o,a,s])}return _(e,ln),a(e,[{key:"replaceInnerTrack",value:function(e){}}])}(),Cn=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,ln),a(e,[{key:"_onTrackEnded",value:function(){C(e,"_onTrackEnded",this,3)([]),this.isPublished()&&this.emit(dn.__INNER_EVENT_DESTROY__,this)}}])}(),vn=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,_n),a(e,[{key:"_onTrackEnded",value:function(){C(e,"_onTrackEnded",this,3)([]),this.isPublished()&&this.emit(dn.__INNER_EVENT_DESTROY__,this)}}])}(),Tn=function(){function e(t,n,o,a,s){var c;return i(this,e),c=r(this,e,[t,n,o,a,!1,s]),Object.defineProperty(c,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),c}return _(e,on),a(e,[{key:"__innerSetRemoteMuted",value:function(e){this._remoteMuted=e}},{key:"__innerSetSubscribed",value:function(e){this._isSubscribed=e}},{key:"isSubscribed",value:function(){return this._isSubscribed}}])}(),In=function(){function e(t,n,o,a){return i(this,e),r(this,e,[t,n,o,"audio",a])}return _(e,Tn),a(e,[{key:"_setLocalMuted",value:function(t){var n=Fn.browser,r=Fn.version;return this._element&&r&&/chrome/i.test(n)&&r>=130&&(this._element.muted=t),C(e,"_setLocalMuted",this,3)([t])}},{key:"getVolume",value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}])}(),Sn=function(){function e(t,n,o,a){var s;return i(this,e),s=r(this,e,[t,n,o,"video",a]),Object.defineProperty(s,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return _(e,Tn),a(e,[{key:"__innerSetIsTinyTrack",value:function(e){this._isSubTiny=e}},{key:"isSubTiny",value:function(){return this._isSubTiny}}])}();exports.RCRTCGenerateSummarizationFormat=void 0,(fn=exports.RCRTCGenerateSummarizationFormat||(exports.RCRTCGenerateSummarizationFormat={}))[fn.MARK_DOWN=0]="MARK_DOWN",fn[fn.JSON=1]="JSON";var En,On=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},bn=function(e){return JSON.stringify(e)},yn=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},Ln=function(e){if(void 0===e)return 0;if(y(e))return e;var t=e;return t.exact||t.ideal||t.max||0},kn=function(e){var t=e.getSettings(),n=e.getConstraints();return{width:Ln(n.width)||t.width||0,height:Ln(n.height)||t.height||0,frameRate:t.frameRate||Ln(n.frameRate)}},An=function(e){var t=kn(e),n=t.width,r=t.height,i=t.frameRate,o=$t(n||1920,r||1080),a=tn(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},Nn=function(e){return[e.msid,e.mediaType].join("_")},Pn=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},Dn=function(e,t){return[e,t].join("_")},Un=function(e){return e.map(function(e){return Object.assign({},e)})},wn=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e.slice();var r=[],i=[],o=[];return t.forEach(function(t){var i=Nn(t),a=e.findIndex(function(e){return Nn(e)===i});if(n&&(a=e.findIndex(function(e){return e.uri===t.uri})),-1!==a){var s=e[a];s.uri!==t.uri?r.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else r.push(t)}),i.push.apply(i,v(e)),{publishedList:r,unpublishedList:i,modifiedList:o}},Mn=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},xn=function(e){if(Zt[e]){var t=Zt[e];return{width:t.width,height:t.height}}var n=m(e.split("_").map(function(e){return parseInt(e.replace(/[^\d]/g,""))}),2);return{width:n[0],height:n[1]}},Bn=function(e){return!!exports.RCResolution[e]},Vn=function(e){return!!exports.RCFrameRate[e]},jn=function(e){return parseInt(e.replace("FPS_",""))},Fn={browser:(En=Kt.browserDetails).browser,version:En.version,supportsUnifiedPlan:!1!==En.supportsUnifiedPlan};function Gn(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Jn(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var Hn,Kn,qn=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Wn=function(e){return 1===e.type},zn=function(e,t){var n=0;return e.forEach(function(e){var r=e instanceof dn?e.getTrackId():e.track.getTrackId();t.getLocalTrack(r)||(e instanceof dn?n++:e.pubTiny&&e.track.isVideoTrack()&&(n+=2))}),n},Yn=function(e,t,n,r){var i={},o=Object.keys(e.users);return o.length&&o.forEach(function(o){var a=[],s=e.users[o];if(s.extra){var c=JSON.parse(s.extra).roomId;if(t!==c)return}if(s.uris)try{a.push.apply(a,v(JSON.parse(s.uris)))}catch(e){n.warn(ye.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(o,", userData: ").concat(s),r)}i[o]=a}),i},Qn=function(e,t){for(var n=!1,r=0,i=0;i<t.length;i++){var o=t[i];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){n=!0,r=i;break}}return{isInclude:n,index:r}},Zn=function(e){return e instanceof on?e.getTrackId():e.track.getTrackId()},Xn=function(e){if(!A(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)},$n=function(e){if("destLang"in e&&!O(e.destLang))return{isValid:!1,key:"destLang"};if("customPrompt"in e&&!O(e.customPrompt))return{isValid:!1,key:"customPrompt"};if("enableSummarization"in e&&!b(e.enableSummarization))return{isValid:!1,key:"enableSummarization"};if("enableSummarizationDetails"in e&&!b(e.enableSummarizationDetails))return{isValid:!1,key:"enableSummarizationDetails"};if("enableChapterSummary"in e&&!b(e.enableChapterSummary))return{isValid:!1,key:"enableChapterSummary"};if("enableTodoList"in e&&!b(e.enableTodoList))return{isValid:!1,key:"enableTodoList"};if("enableHashtag"in e&&!b(e.enableHashtag))return{isValid:!1,key:"enableHashtag"};if("format"in e&&void 0===exports.RCRTCGenerateSummarizationFormat[e.format])return{isValid:!1,key:"format"};var t=e.enableSummarization||e.enableSummarizationDetails||e.enableChapterSummary||e.enableTodoList||e.enableHashtag;return e.customPrompt||t?{isValid:!0,key:""}:{isValid:!1,key:"at least one of the summary features must be enabled"}};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline",e.ROOM_TASK_FINISH="RCRTC:roomTaskFinish",e.ASR_STATUS="RCRTC:AsrStatus",e.ASR_SEI="RCRTC:PublishSeiAi",e.SUMMARIZATION_STATUS="RCRTC:Summarization"}(Hn||(Hn={})),exports.RCRTCPingResult=void 0,(Kn=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",Kn.FAIL="Fail";var er=function(){return a(function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_latestTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onPingResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger},[{key:"start",value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(ye.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}},{key:"_sendPing",value:function(){var e=this;return new Promise(function(t){e._context.rtcPing(e._roomId,e._roomMode).then(t),setTimeout(t,5e3,{code:Ne})})}},{key:"_checkAlive",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c=this;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this._context.logger,r=n.createTraceId(),t.n=1,this._sendPing();case 1:if(i=t.v,o=i.code,a=i.data,this._started){t.n=2;break}return t.a(2);case 2:if(s=Date.now(),o!==ke){t.n=3;break}return this._latestTimestamp=s,this.onPingResult(exports.RCRTCPingResult.SUCCESS,a.version),this._timer=setTimeout(function(){return c._checkAlive(e)},this._gap),t.a(2);case 3:if(n.error(ye.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:o}),r),this.onPingResult(exports.RCRTCPingResult.FAIL),!(40003===o||s-this._latestTimestamp>e)){t.n=4;break}return this.stop(),this.onFailed(40003===o),t.a(2);case 4:this._timer=setTimeout(function(){return c._checkAlive(e)},this._gap);case 5:return t.a(2)}},t,this)}))}},{key:"stop",value:function(){this._started&&(this._logger.info(ye.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}])}();function tr(e){let t=e.length;for(;--t>=0;)e[t]=0}const nr=256,rr=286,ir=30,or=15,ar=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),sr=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),cr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ur=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dr=new Array(576);tr(dr);const _r=new Array(60);tr(_r);const lr=new Array(512);tr(lr);const pr=new Array(256);tr(pr);const fr=new Array(29);tr(fr);const hr=new Array(ir);function Rr(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let gr,mr,Cr;function vr(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}tr(hr);const Tr=e=>e<256?lr[e]:lr[256+(e>>>7)],Ir=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Sr=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Ir(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Er=(e,t,n)=>{Sr(e,n[2*t],n[2*t+1])},Or=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},br=(e,t,n)=>{const r=new Array(16);let i,o,a=0;for(i=1;i<=or;i++)a=a+n[i-1]<<1,r[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=Or(r[t]++,t))}},yr=e=>{let t;for(t=0;t<rr;t++)e.dyn_ltree[2*t]=0;for(t=0;t<ir;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Lr=e=>{e.bi_valid>8?Ir(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},kr=(e,t,n,r)=>{const i=2*t,o=2*n;return e[i]<e[o]||e[i]===e[o]&&r[t]<=r[n]},Ar=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&kr(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!kr(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Nr=(e,t,n)=>{let r,i,o,a,s=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+s++],r+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===r?Er(e,i,t):(o=pr[i],Er(e,o+nr+1,t),a=ar[o],0!==a&&(i-=fr[o],Sr(e,i,a)),r--,o=Tr(r),Er(e,o,n),a=sr[o],0!==a&&(r-=hr[o],Sr(e,r,a)))}while(s<e.sym_next);Er(e,256,t)},Pr=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==n[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):n[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,n[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=r[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)Ar(e,n,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ar(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[2*c]=n[2*a]+n[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[2*a+1]=n[2*s+1]=c,e.heap[1]=c++,Ar(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,d,_,l,p,f,h=0;for(l=0;l<=or;l++)e.bl_count[l]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)d=e.heap[u],l=n[2*n[2*d+1]+1]+1,l>c&&(l=c,h++),n[2*d+1]=l,d>r||(e.bl_count[l]++,p=0,d>=s&&(p=a[d-s]),f=n[2*d],e.opt_len+=f*(l+p),o&&(e.static_len+=f*(i[2*d+1]+p)));if(0!==h){do{for(l=c-1;0===e.bl_count[l];)l--;e.bl_count[l]--,e.bl_count[l+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(l=c;0!==l;l--)for(d=e.bl_count[l];0!==d;)_=e.heap[--u],_>r||(n[2*_+1]!==l&&(e.opt_len+=(l-n[2*_+1])*n[2*_],n[2*_+1]=l),d--)}})(e,t),br(n,u,e.bl_count)},Dr=(e,t,n)=>{let r,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=t[2*(r+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},Ur=(e,t,n)=>{let r,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=n;r++)if(i=a,a=t[2*(r+1)+1],!(++s<c&&i===a)){if(s<u)do{Er(e,i,e.bl_tree)}while(0!==--s);else 0!==i?(i!==o&&(Er(e,i,e.bl_tree),s--),Er(e,16,e.bl_tree),Sr(e,s-3,2)):s<=10?(Er(e,17,e.bl_tree),Sr(e,s-3,3)):(Er(e,18,e.bl_tree),Sr(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}};let wr=!1;const Mr=(e,t,n,r)=>{Sr(e,0+(r?1:0),3),Lr(e),Ir(e,n),Ir(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var xr=(e,t,n,r)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<nr;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Pr(e,e.l_desc),Pr(e,e.d_desc),a=(e=>{let t;for(Dr(e,e.dyn_ltree,e.l_desc.max_code),Dr(e,e.dyn_dtree,e.d_desc.max_code),Pr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ur[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==t?Mr(e,t,n,r):4===e.strategy||o===i?(Sr(e,2+(r?1:0),3),Nr(e,dr,_r)):(Sr(e,4+(r?1:0),3),((e,t,n,r)=>{let i;for(Sr(e,t-257,5),Sr(e,n-1,5),Sr(e,r-4,4),i=0;i<r;i++)Sr(e,e.bl_tree[2*ur[i]+1],3);Ur(e,e.dyn_ltree,t-1),Ur(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Nr(e,e.dyn_ltree,e.dyn_dtree)),yr(e),r&&Lr(e)},Br={_tr_init:e=>{wr||((()=>{let e,t,n,r,i;const o=new Array(16);for(n=0,r=0;r<28;r++)for(fr[r]=n,e=0;e<1<<ar[r];e++)pr[n++]=r;for(pr[n-1]=r,i=0,r=0;r<16;r++)for(hr[r]=i,e=0;e<1<<sr[r];e++)lr[i++]=r;for(i>>=7;r<ir;r++)for(hr[r]=i<<7,e=0;e<1<<sr[r]-7;e++)lr[256+i++]=r;for(t=0;t<=or;t++)o[t]=0;for(e=0;e<=143;)dr[2*e+1]=8,e++,o[8]++;for(;e<=255;)dr[2*e+1]=9,e++,o[9]++;for(;e<=279;)dr[2*e+1]=7,e++,o[7]++;for(;e<=287;)dr[2*e+1]=8,e++,o[8]++;for(br(dr,287,o),e=0;e<ir;e++)_r[2*e+1]=5,_r[2*e]=Or(e,5);gr=new Rr(dr,ar,257,rr,or),mr=new Rr(_r,sr,0,ir,or),Cr=new Rr(new Array(0),cr,0,19,7)})(),wr=!0),e.l_desc=new vr(e.dyn_ltree,gr),e.d_desc=new vr(e.dyn_dtree,mr),e.bl_desc=new vr(e.bl_tree,Cr),e.bi_buf=0,e.bi_valid=0,yr(e)},_tr_stored_block:Mr,_tr_flush_block:xr,_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(pr[n]+nr+1)]++,e.dyn_dtree[2*Tr(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Sr(e,2,3),Er(e,256,dr),(e=>{16===e.bi_valid?(Ir(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Vr=(e,t,n,r)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do{i=i+t[r++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const jr=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var Fr=(e,t,n,r)=>{const i=jr,o=r+n;e^=-1;for(let n=r;n<o;n++)e=e>>>8^i[255&(e^t[n])];return-1^e},Gr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Jr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Hr,_tr_stored_block:Kr,_tr_flush_block:qr,_tr_tally:Wr,_tr_align:zr}=Br,{Z_NO_FLUSH:Yr,Z_PARTIAL_FLUSH:Qr,Z_FULL_FLUSH:Zr,Z_FINISH:Xr,Z_BLOCK:$r,Z_OK:ei,Z_STREAM_END:ti,Z_STREAM_ERROR:ni,Z_DATA_ERROR:ri,Z_BUF_ERROR:ii,Z_DEFAULT_COMPRESSION:oi,Z_FILTERED:ai,Z_HUFFMAN_ONLY:si,Z_RLE:ci,Z_FIXED:ui,Z_DEFAULT_STRATEGY:di,Z_UNKNOWN:_i,Z_DEFLATED:li}=Jr,pi=258,fi=262,hi=42,Ri=113,gi=666,mi=(e,t)=>(e.msg=Gr[t],t),Ci=e=>2*e-(e>4?9:0),vi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ti=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=i?n-i:0}while(--t);t=i,r=t;do{n=e.prev[--r],e.prev[r]=n>=i?n-i:0}while(--t)};let Ii=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Si=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},Ei=(e,t)=>{qr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Si(e.strm)},Oi=(e,t)=>{e.pending_buf[e.pending++]=t},bi=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},yi=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=Vr(e.adler,t,i,n):2===e.state.wrap&&(e.adler=Fr(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Li=(e,t)=>{let n,r,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-fi?e.strstart-(e.w_size-fi):0,u=e.window,d=e.w_mask,_=e.prev,l=e.strstart+pi;let p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,u[n+a]===f&&u[n+a-1]===p&&u[n]===u[o]&&u[++n]===u[o+1]){o+=2,n++;do{}while(u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&o<l);if(r=pi-(l-o),o=l-pi,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=_[t&d])>c&&0!==--i);return a<=e.lookahead?a:e.lookahead},ki=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-fi)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ti(e),r+=t),0===e.strm.avail_in)break;if(n=yi(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ii(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ii(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<fi&&0!==e.strm.avail_in)},Ai=(e,t)=>{let n,r,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(n=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,r=e.strstart-e.block_start,n>r+e.strm.avail_in&&(n=r+e.strm.avail_in),n>i&&(n=i),n<o&&(0===n&&t!==Xr||t===Yr||n!==r+e.strm.avail_in))break;a=t===Xr&&n===r+e.strm.avail_in?1:0,Kr(e,0,0,a),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Si(e.strm),r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(yi(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==Yr&&t!==Xr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(yi(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=o||(r||t===Xr)&&t!==Yr&&0===e.strm.avail_in&&r<=i)&&(n=r>i?i:r,a=t===Xr&&0===e.strm.avail_in&&n===r?1:0,Kr(e,e.block_start,n,a),e.block_start+=n,Si(e.strm)),a?3:1)},Ni=(e,t)=>{let n,r;for(;;){if(e.lookahead<fi){if(ki(e),e.lookahead<fi&&t===Yr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Ii(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-fi&&(e.match_length=Li(e,n)),e.match_length>=3)if(r=Wr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Ii(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ii(e,e.ins_h,e.window[e.strstart+1]);else r=Wr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ei(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Xr?(Ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ei(e,!1),0===e.strm.avail_out)?1:2},Pi=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<fi){if(ki(e),e.lookahead<fi&&t===Yr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Ii(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-fi&&(e.match_length=Li(e,n),e.match_length<=5&&(e.strategy===ai||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,r=Wr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Ii(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!==--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(Ei(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=Wr(e,0,e.window[e.strstart-1]),r&&Ei(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Wr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Xr?(Ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ei(e,!1),0===e.strm.avail_out)?1:2};function Di(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Ui=[new Di(0,0,0,0,Ai),new Di(4,4,8,4,Ni),new Di(4,5,16,8,Ni),new Di(4,6,32,32,Ni),new Di(4,4,16,16,Pi),new Di(8,16,32,32,Pi),new Di(8,16,128,128,Pi),new Di(8,32,128,256,Pi),new Di(32,128,258,1024,Pi),new Di(32,258,258,4096,Pi)];function wi(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=li,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),vi(this.dyn_ltree),vi(this.dyn_dtree),vi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),vi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),vi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Mi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==hi&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Ri&&t.status!==gi?1:0},xi=e=>{if(Mi(e))return mi(e,ni);e.total_in=e.total_out=0,e.data_type=_i;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?hi:Ri,e.adler=2===t.wrap?0:1,t.last_flush=-2,Hr(t),ei},Bi=e=>{const t=xi(e);var n;return t===ei&&((n=e.state).window_size=2*n.w_size,vi(n.head),n.max_lazy_match=Ui[n.level].max_lazy,n.good_match=Ui[n.level].good_length,n.nice_match=Ui[n.level].nice_length,n.max_chain_length=Ui[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},Vi=(e,t,n,r,i,o)=>{if(!e)return ni;let a=1;if(t===oi&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>9||n!==li||r<8||r>15||t<0||t>9||o<0||o>ui||8===r&&1!==a)return mi(e,ni);8===r&&(r=9);const s=new wi;return e.state=s,s.strm=e,s.status=hi,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=n,Bi(e)};var ji={deflateInit:(e,t)=>Vi(e,t,li,15,8,di),deflateInit2:Vi,deflateReset:Bi,deflateResetKeep:xi,deflateSetHeader:(e,t)=>Mi(e)||2!==e.state.wrap?ni:(e.state.gzhead=t,ei),deflate:(e,t)=>{if(Mi(e)||t>$r||t<0)return e?mi(e,ni):ni;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===gi&&t!==Xr)return mi(e,0===e.avail_out?ii:ni);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){if(Si(e),0===e.avail_out)return n.last_flush=-1,ei}else if(0===e.avail_in&&Ci(t)<=Ci(r)&&t!==Xr)return mi(e,ii);if(n.status===gi&&0!==e.avail_in)return mi(e,ii);if(n.status===hi&&0===n.wrap&&(n.status=Ri),n.status===hi){let t=li+(n.w_bits-8<<4)<<8,r=-1;if(r=n.strategy>=si||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,bi(n,t),0!==n.strstart&&(bi(n,e.adler>>>16),bi(n,65535&e.adler)),e.adler=1,n.status=Ri,Si(e),0!==n.pending)return n.last_flush=-1,ei}if(57===n.status)if(e.adler=0,Oi(n,31),Oi(n,139),Oi(n,8),n.gzhead)Oi(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Oi(n,255&n.gzhead.time),Oi(n,n.gzhead.time>>8&255),Oi(n,n.gzhead.time>>16&255),Oi(n,n.gzhead.time>>24&255),Oi(n,9===n.level?2:n.strategy>=si||n.level<2?4:0),Oi(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Oi(n,255&n.gzhead.extra.length),Oi(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Fr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Oi(n,0),Oi(n,0),Oi(n,0),Oi(n,0),Oi(n,0),Oi(n,9===n.level?2:n.strategy>=si||n.level<2?4:0),Oi(n,3),n.status=Ri,Si(e),0!==n.pending)return n.last_flush=-1,ei;if(69===n.status){if(n.gzhead.extra){let t=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=Fr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Si(e),0!==n.pending)return n.last_flush=-1,ei;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra);n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=Fr(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=Fr(e.adler,n.pending_buf,n.pending-r,r)),Si(e),0!==n.pending)return n.last_flush=-1,ei;r=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Oi(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=Fr(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=Fr(e.adler,n.pending_buf,n.pending-r,r)),Si(e),0!==n.pending)return n.last_flush=-1,ei;r=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Oi(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=Fr(e.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Si(e),0!==n.pending))return n.last_flush=-1,ei;Oi(n,255&e.adler),Oi(n,e.adler>>8&255),e.adler=0}if(n.status=Ri,Si(e),0!==n.pending)return n.last_flush=-1,ei}if(0!==e.avail_in||0!==n.lookahead||t!==Yr&&n.status!==gi){let r=0===n.level?Ai(n,t):n.strategy===si?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(ki(e),0===e.lookahead)){if(t===Yr)return 1;break}if(e.match_length=0,n=Wr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ei(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Xr?(Ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ei(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===ci?((e,t)=>{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=pi){if(ki(e),e.lookahead<=pi&&t===Yr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+pi;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);e.match_length=pi-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=Wr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Wr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ei(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Xr?(Ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Ei(e,!1),0===e.strm.avail_out)?1:2})(n,t):Ui[n.level].func(n,t);if(3!==r&&4!==r||(n.status=gi),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),ei;if(2===r&&(t===Qr?zr(n):t!==$r&&(Kr(n,0,0,!1),t===Zr&&(vi(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Si(e),0===e.avail_out))return n.last_flush=-1,ei}return t!==Xr?ei:n.wrap<=0?ti:(2===n.wrap?(Oi(n,255&e.adler),Oi(n,e.adler>>8&255),Oi(n,e.adler>>16&255),Oi(n,e.adler>>24&255),Oi(n,255&e.total_in),Oi(n,e.total_in>>8&255),Oi(n,e.total_in>>16&255),Oi(n,e.total_in>>24&255)):(bi(n,e.adler>>>16),bi(n,65535&e.adler)),Si(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?ei:ti)},deflateEnd:e=>{if(Mi(e))return ni;const t=e.state.status;return e.state=null,t===Ri?mi(e,ri):ei},deflateSetDictionary:(e,t)=>{let n=t.length;if(Mi(e))return ni;const r=e.state,i=r.wrap;if(2===i||1===i&&r.status!==hi||r.lookahead)return ni;if(1===i&&(e.adler=Vr(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){0===i&&(vi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,ki(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{r.ins_h=Ii(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,ki(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,ei},deflateInfo:"pako deflate (from Nodeca project)"};const Fi=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Gi=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)Fi(n,t)&&(e[t]=n[t])}}return e},Ji=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n};let Hi=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Hi=!1}const Ki=new Uint8Array(256);for(let e=0;e<256;e++)Ki[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ki[254]=Ki[254]=1;var qi=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i<a;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<a&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<a&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},Wi=(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,i;const o=new Array(2*n);for(i=0,r=0;r<n;){let t=e[r++];if(t<128){o[i++]=t;continue}let a=Ki[t];if(a>4)o[i++]=65533,r+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&r<n;)t=t<<6|63&e[r++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Hi)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n})(o,i)},zi=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+Ki[e[n]]>t?n:t};var Yi=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Qi=Object.prototype.toString,{Z_NO_FLUSH:Zi,Z_SYNC_FLUSH:Xi,Z_FULL_FLUSH:$i,Z_FINISH:eo,Z_OK:to,Z_STREAM_END:no,Z_DEFAULT_COMPRESSION:ro,Z_DEFAULT_STRATEGY:io,Z_DEFLATED:oo}=Jr;function ao(e){this.options=Gi({level:ro,method:oo,chunkSize:16384,windowBits:15,memLevel:8,strategy:io},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Yi,this.strm.avail_out=0;let n=ji.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==to)throw new Error(Gr[n]);if(t.header&&ji.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?qi(t.dictionary):"[object ArrayBuffer]"===Qi.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=ji.deflateSetDictionary(this.strm,e),n!==to)throw new Error(Gr[n]);this._dict_set=!0}}function so(e,t){const n=new ao(t);if(n.push(e,!0),n.err)throw n.msg||Gr[n.err];return n.result}ao.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?eo:Zi,"string"==typeof e?n.input=qi(e):"[object ArrayBuffer]"===Qi.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===Xi||o===$i)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=ji.deflate(n,o),i===no)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=ji.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===to;if(0!==n.avail_out){if(o>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},ao.prototype.onData=function(e){this.chunks.push(e)},ao.prototype.onEnd=function(e){e===to&&(this.result=Ji(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var co={Deflate:ao,deflate:so,deflateRaw:function(e,t){return(t=t||{}).raw=!0,so(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,so(e,t)},constants:Jr};const uo=16209;var _o=function(e,t){let n,r,i,o,a,s,c,u,d,_,l,p,f,h,R,g,m,C,v,T,I,S,E,O;const b=e.state;n=e.next_in,E=e.input,r=n+(e.avail_in-5),i=e.next_out,O=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=b.dmax,c=b.wsize,u=b.whave,d=b.wnext,_=b.window,l=b.hold,p=b.bits,f=b.lencode,h=b.distcode,R=(1<<b.lenbits)-1,g=(1<<b.distbits)-1;e:do{p<15&&(l+=E[n++]<<p,p+=8,l+=E[n++]<<p,p+=8),m=f[l&R];t:for(;;){if(C=m>>>24,l>>>=C,p-=C,C=m>>>16&255,0===C)O[i++]=65535&m;else{if(!(16&C)){if(64&C){if(32&C){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=uo;break e}m=f[(65535&m)+(l&(1<<C)-1)];continue t}for(v=65535&m,C&=15,C&&(p<C&&(l+=E[n++]<<p,p+=8),v+=l&(1<<C)-1,l>>>=C,p-=C),p<15&&(l+=E[n++]<<p,p+=8,l+=E[n++]<<p,p+=8),m=h[l&g];;){if(C=m>>>24,l>>>=C,p-=C,C=m>>>16&255,16&C){if(T=65535&m,C&=15,p<C&&(l+=E[n++]<<p,p+=8,p<C&&(l+=E[n++]<<p,p+=8)),T+=l&(1<<C)-1,T>s){e.msg="invalid distance too far back",b.mode=uo;break e}if(l>>>=C,p-=C,C=i-o,T>C){if(C=T-C,C>u&&b.sane){e.msg="invalid distance too far back",b.mode=uo;break e}if(I=0,S=_,0===d){if(I+=c-C,C<v){v-=C;do{O[i++]=_[I++]}while(--C);I=i-T,S=O}}else if(d<C){if(I+=c+d-C,C-=d,C<v){v-=C;do{O[i++]=_[I++]}while(--C);if(I=0,d<v){C=d,v-=C;do{O[i++]=_[I++]}while(--C);I=i-T,S=O}}}else if(I+=d-C,C<v){v-=C;do{O[i++]=_[I++]}while(--C);I=i-T,S=O}for(;v>2;)O[i++]=S[I++],O[i++]=S[I++],O[i++]=S[I++],v-=3;v&&(O[i++]=S[I++],v>1&&(O[i++]=S[I++]))}else{I=i-T;do{O[i++]=O[I++],O[i++]=O[I++],O[i++]=O[I++],v-=3}while(v>2);v&&(O[i++]=O[I++],v>1&&(O[i++]=O[I++]))}break}if(64&C){e.msg="invalid distance code",b.mode=uo;break e}m=h[(65535&m)+(l&(1<<C)-1)]}}break}}while(n<r&&i<a);v=p>>3,n-=v,p-=v<<3,l&=(1<<p)-1,e.next_in=n,e.next_out=i,e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=i<a?a-i+257:257-(i-a),b.hold=l,b.bits=p};const lo=15,po=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),fo=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ho=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ro=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var go=(e,t,n,r,i,o,a,s)=>{const c=s.bits;let u,d,_,l,p,f,h=0,R=0,g=0,m=0,C=0,v=0,T=0,I=0,S=0,E=0,O=null;const b=new Uint16Array(16),y=new Uint16Array(16);let L,k,A,N=null;for(h=0;h<=lo;h++)b[h]=0;for(R=0;R<r;R++)b[t[n+R]]++;for(C=c,m=lo;m>=1&&0===b[m];m--);if(C>m&&(C=m),0===m)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(g=1;g<m&&0===b[g];g++);for(C<g&&(C=g),I=1,h=1;h<=lo;h++)if(I<<=1,I-=b[h],I<0)return-1;if(I>0&&(0===e||1!==m))return-1;for(y[1]=0,h=1;h<lo;h++)y[h+1]=y[h]+b[h];for(R=0;R<r;R++)0!==t[n+R]&&(a[y[t[n+R]]++]=R);if(0===e?(O=N=a,f=20):1===e?(O=po,N=fo,f=257):(O=ho,N=Ro,f=0),E=0,R=0,h=g,p=o,v=C,T=0,_=-1,S=1<<C,l=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){L=h-T,a[R]+1<f?(k=0,A=a[R]):a[R]>=f?(k=N[a[R]-f],A=O[a[R]-f]):(k=96,A=0),u=1<<h-T,d=1<<v,g=d;do{d-=u,i[p+(E>>T)+d]=L<<24|k<<16|A}while(0!==d);for(u=1<<h-1;E&u;)u>>=1;if(0!==u?(E&=u-1,E+=u):E=0,R++,0===--b[h]){if(h===m)break;h=t[n+a[R]]}if(h>C&&(E&l)!==_){for(0===T&&(T=C),p+=g,v=h-T,I=1<<v;v+T<m&&(I-=b[v+T],!(I<=0));)v++,I<<=1;if(S+=1<<v,1===e&&S>852||2===e&&S>592)return 1;_=E&l,i[_]=C<<24|v<<16|p-o}}return 0!==E&&(i[p+E]=h-T<<24|64<<16),s.bits=C,0};const{Z_FINISH:mo,Z_BLOCK:Co,Z_TREES:vo,Z_OK:To,Z_STREAM_END:Io,Z_NEED_DICT:So,Z_STREAM_ERROR:Eo,Z_DATA_ERROR:Oo,Z_MEM_ERROR:bo,Z_BUF_ERROR:yo,Z_DEFLATED:Lo}=Jr,ko=16180,Ao=16190,No=16191,Po=16192,Do=16194,Uo=16199,wo=16200,Mo=16206,xo=16209,Bo=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Vo(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const jo=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<ko||t.mode>16211?1:0},Fo=e=>{if(jo(e))return Eo;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=ko,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,To},Go=e=>{if(jo(e))return Eo;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Fo(e)},Jo=(e,t)=>{let n;if(jo(e))return Eo;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Eo:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Go(e))},Ho=(e,t)=>{if(!e)return Eo;const n=new Vo;e.state=n,n.strm=e,n.window=null,n.mode=ko;const r=Jo(e,t);return r!==To&&(e.state=null),r};let Ko,qo,Wo=!0;const zo=e=>{if(Wo){Ko=new Int32Array(512),qo=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(go(1,e.lens,0,288,Ko,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;go(2,e.lens,0,32,qo,0,e.work,{bits:5}),Wo=!1}e.lencode=Ko,e.lenbits=9,e.distcode=qo,e.distbits=5},Yo=(e,t,n,r)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Qo={inflateReset:Go,inflateReset2:Jo,inflateResetKeep:Fo,inflateInit:e=>Ho(e,15),inflateInit2:Ho,inflate:(e,t)=>{let n,r,i,o,a,s,c,u,d,_,l,p,f,h,R,g,m,C,v,T,I,S,E=0;const O=new Uint8Array(4);let b,y;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(jo(e)||!e.output||!e.input&&0!==e.avail_in)return Eo;n=e.state,n.mode===No&&(n.mode=Po),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,_=s,l=c,S=To;e:for(;;)switch(n.mode){case ko:if(0===n.wrap){n.mode=Po;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&n.wrap&&35615===u){0===n.wbits&&(n.wbits=15),n.check=0,O[0]=255&u,O[1]=u>>>8&255,n.check=Fr(n.check,O,2,0),u=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=xo;break}if((15&u)!==Lo){e.msg="unknown compression method",n.mode=xo;break}if(u>>>=4,d-=4,I=8+(15&u),0===n.wbits&&(n.wbits=I),I>15||I>n.wbits){e.msg="invalid window size",n.mode=xo;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&u?16189:No,u=0,d=0;break;case 16181:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(n.flags=u,(255&n.flags)!==Lo){e.msg="unknown compression method",n.mode=xo;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=xo;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,n.check=Fr(n.check,O,2,0)),u=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.head&&(n.head.time=u),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,O[2]=u>>>16&255,O[3]=u>>>24&255,n.check=Fr(n.check,O,4,0)),u=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,n.check=Fr(n.check,O,2,0)),u=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&4&n.wrap&&(O[0]=255&u,O[1]=u>>>8&255,n.check=Fr(n.check,O,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>s&&(p=s),p&&(n.head&&(I=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+p),I)),512&n.flags&&4&n.wrap&&(n.check=Fr(n.check,r,p,o)),s-=p,o+=p,n.length-=p),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===s)break e;p=0;do{I=r[o+p++],n.head&&I&&n.length<65536&&(n.head.name+=String.fromCharCode(I))}while(I&&p<s);if(512&n.flags&&4&n.wrap&&(n.check=Fr(n.check,r,p,o)),s-=p,o+=p,I)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===s)break e;p=0;do{I=r[o+p++],n.head&&I&&n.length<65536&&(n.head.comment+=String.fromCharCode(I))}while(I&&p<s);if(512&n.flags&&4&n.wrap&&(n.check=Fr(n.check,r,p,o)),s-=p,o+=p,I)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(4&n.wrap&&u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=xo;break}u=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=No;break;case 16189:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=n.check=Bo(u),u=0,d=0,n.mode=Ao;case Ao:if(0===n.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,So;e.adler=n.check=1,n.mode=No;case No:if(t===Co||t===vo)break e;case Po:if(n.last){u>>>=7&d,d-=7&d,n.mode=Mo;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(n.last=1&u,u>>>=1,d-=1,3&u){case 0:n.mode=16193;break;case 1:if(zo(n),n.mode=Uo,t===vo){u>>>=2,d-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=xo}u>>>=2,d-=2;break;case 16193:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=xo;break}if(n.length=65535&u,u=0,d=0,n.mode=Do,t===vo)break e;case Do:n.mode=16195;case 16195:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;i.set(r.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,n.length-=p;break}n.mode=No;break;case 16196:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(n.nlen=257+(31&u),u>>>=5,d-=5,n.ndist=1+(31&u),u>>>=5,d-=5,n.ncode=4+(15&u),u>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=xo;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.lens[L[n.have++]]=7&u,u>>>=3,d-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,b={bits:n.lenbits},S=go(0,n.lens,0,19,n.lencode,0,n.work,b),n.lenbits=b.bits,S){e.msg="invalid code lengths set",n.mode=xo;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;E=n.lencode[u&(1<<n.lenbits)-1],R=E>>>24,g=E>>>16&255,m=65535&E,!(R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m<16)u>>>=R,d-=R,n.lens[n.have++]=m;else{if(16===m){for(y=R+2;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=R,d-=R,0===n.have){e.msg="invalid bit length repeat",n.mode=xo;break}I=n.lens[n.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===m){for(y=R+3;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=R,d-=R,I=0,p=3+(7&u),u>>>=3,d-=3}else{for(y=R+7;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=R,d-=R,I=0,p=11+(127&u),u>>>=7,d-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=xo;break}for(;p--;)n.lens[n.have++]=I}}if(n.mode===xo)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=xo;break}if(n.lenbits=9,b={bits:n.lenbits},S=go(1,n.lens,0,n.nlen,n.lencode,0,n.work,b),n.lenbits=b.bits,S){e.msg="invalid literal/lengths set",n.mode=xo;break}if(n.distbits=6,n.distcode=n.distdyn,b={bits:n.distbits},S=go(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,b),n.distbits=b.bits,S){e.msg="invalid distances set",n.mode=xo;break}if(n.mode=Uo,t===vo)break e;case Uo:n.mode=wo;case wo:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,_o(e,l),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,n.mode===No&&(n.back=-1);break}for(n.back=0;E=n.lencode[u&(1<<n.lenbits)-1],R=E>>>24,g=E>>>16&255,m=65535&E,!(R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(g&&!(240&g)){for(C=R,v=g,T=m;E=n.lencode[T+((u&(1<<C+v)-1)>>C)],R=E>>>24,g=E>>>16&255,m=65535&E,!(C+R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=R,d-=R,n.back+=R,n.length=m,0===g){n.mode=16205;break}if(32&g){n.back=-1,n.mode=No;break}if(64&g){e.msg="invalid literal/length code",n.mode=xo;break}n.extra=15&g,n.mode=16201;case 16201:if(n.extra){for(y=n.extra;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;E=n.distcode[u&(1<<n.distbits)-1],R=E>>>24,g=E>>>16&255,m=65535&E,!(R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(!(240&g)){for(C=R,v=g,T=m;E=n.distcode[T+((u&(1<<C+v)-1)>>C)],R=E>>>24,g=E>>>16&255,m=65535&E,!(C+R<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=R,d-=R,n.back+=R,64&g){e.msg="invalid distance code",n.mode=xo;break}n.offset=m,n.extra=15&g,n.mode=16203;case 16203:if(n.extra){for(y=n.extra;d<y;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=xo;break}n.mode=16204;case 16204:if(0===c)break e;if(p=l-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=xo;break}p>n.wnext?(p-=n.wnext,f=n.wsize-p):f=n.wnext-p,p>n.length&&(p=n.length),h=n.window}else h=i,f=a-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do{i[a++]=h[f++]}while(--p);0===n.length&&(n.mode=wo);break;case 16205:if(0===c)break e;i[a++]=n.length,c--,n.mode=wo;break;case Mo:if(n.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(l-=c,e.total_out+=l,n.total+=l,4&n.wrap&&l&&(e.adler=n.check=n.flags?Fr(n.check,i,l,a-l):Vr(n.check,i,l,a-l)),l=c,4&n.wrap&&(n.flags?u:Bo(u))!==n.check){e.msg="incorrect data check",n.mode=xo;break}u=0,d=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(4&n.wrap&&u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=xo;break}u=0,d=0}n.mode=16208;case 16208:S=Io;break e;case xo:S=Oo;break e;case 16210:return bo;default:return Eo}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,(n.wsize||l!==e.avail_out&&n.mode<xo&&(n.mode<Mo||t!==mo))&&Yo(e,e.output,e.next_out,l-e.avail_out),_-=e.avail_in,l-=e.avail_out,e.total_in+=_,e.total_out+=l,n.total+=l,4&n.wrap&&l&&(e.adler=n.check=n.flags?Fr(n.check,i,l,e.next_out-l):Vr(n.check,i,l,e.next_out-l)),e.data_type=n.bits+(n.last?64:0)+(n.mode===No?128:0)+(n.mode===Uo||n.mode===Do?256:0),(0===_&&0===l||t===mo)&&S===To&&(S=yo),S},inflateEnd:e=>{if(jo(e))return Eo;let t=e.state;return t.window&&(t.window=null),e.state=null,To},inflateGetHeader:(e,t)=>{if(jo(e))return Eo;const n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,To):Eo},inflateSetDictionary:(e,t)=>{const n=t.length;let r,i,o;return jo(e)?Eo:(r=e.state,0!==r.wrap&&r.mode!==Ao?Eo:r.mode===Ao&&(i=1,i=Vr(i,t,n,0),i!==r.check)?Oo:(o=Yo(e,t,n,n),o?(r.mode=16210,bo):(r.havedict=1,To)))},inflateInfo:"pako inflate (from Nodeca project)"};var Zo=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Xo=Object.prototype.toString,{Z_NO_FLUSH:$o,Z_FINISH:ea,Z_OK:ta,Z_STREAM_END:na,Z_NEED_DICT:ra,Z_STREAM_ERROR:ia,Z_DATA_ERROR:oa,Z_MEM_ERROR:aa}=Jr;function sa(e){this.options=Gi({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Yi,this.strm.avail_out=0;let n=Qo.inflateInit2(this.strm,t.windowBits);if(n!==ta)throw new Error(Gr[n]);if(this.header=new Zo,Qo.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=qi(t.dictionary):"[object ArrayBuffer]"===Xo.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Qo.inflateSetDictionary(this.strm,t.dictionary),n!==ta)))throw new Error(Gr[n])}sa.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?ea:$o,"[object ArrayBuffer]"===Xo.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Qo.inflate(n,a),o===ra&&i&&(o=Qo.inflateSetDictionary(n,i),o===ta?o=Qo.inflate(n,a):o===oa&&(o=ra));n.avail_in>0&&o===na&&n.state.wrap>0&&0!==e[n.next_in];)Qo.inflateReset(n),o=Qo.inflate(n,a);switch(o){case ia:case oa:case ra:case aa:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(0===n.avail_out||o===na))if("string"===this.options.to){let e=zi(n.output,n.next_out),t=n.next_out-e,i=Wi(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(o!==ta||0!==s){if(o===na)return o=Qo.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},sa.prototype.onData=function(e){this.chunks.push(e)},sa.prototype.onEnd=function(e){e===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ji(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:ca,deflate:ua,deflateRaw:da,gzip:_a}=co;var la=_a;var pa,fa=-1,ha="RongCloudSEIAI",Ra=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},ga=function(e,t){return e+Math.floor(Math.random()*(t-e))},ma=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Fn.browser,"|").concat(Fn.version),ClientVersion:"5.36.1-nctest-alpha.2","Client-Session-Id":Ra(),"Request-Id":Date.now().toString()}},Ca=function(e,t,n){return K(void 0,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)if(0===r.n)return i=[],o=n.jwtToken||"",r.a(2,new Promise(function(n,r){e.forEach(function(e){return K(void 0,void 0,void 0,p().m(function r(){var a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:return a=e.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(a,"/rtc/detector/ping?t=").concat(ga(1e3,9999)),c={jwt:o},r.n=1,t.httpReq({url:s,body:JSON.stringify(c),timeout:5e3,method:U.POST});case 1:200===r.v.status&&i.push(e.clusterId),n(i);case 2:return r.a(2)}},r)}))})}))},r)}))},va=function(e,t){var n,r;if(!t)return"";try{r=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(n){return e.warn(ye.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===r.strategy)return"";var i=null===(n=r.callEngine)||void 0===n?void 0:n.filter(function(e){return 4===e.engineType});if(!i||0===i.length)return"";var o=i[0];return o.detectorManager?o.detectorManager:""},Ta=function(e,t,n){return K(void 0,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_;return p().w(function(r){for(;;)switch(r.n){case 0:return i=va(t,n),o=n.jwtToken||"",a=120,s=0,c=n.ipType||0,u={jwt:o,ipType:c},r.n=1,e.httpReq({url:"".concat(i,"/rtc/detector/servers"),body:JSON.stringify(u),headers:ma(),method:U.POST});case 1:return d=r.v,_=d.data&&JSON.parse(d.data).detectorAddrs||[],a=d.data&&JSON.parse(d.data).clientDetectMinute,s=d.data&&JSON.parse(d.data).resultCode,r.a(2,{detectoraddrs:_,clientDetectMinute:a,status:s})}},r)}))};exports.RCRTCOperateSummarizationType=void 0,(pa=exports.RCRTCOperateSummarizationType||(exports.RCRTCOperateSummarizationType={})).OPEN="2",pa.CLOSE="1";function Ia(e){var t=e.method||U.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,a=e.onProgress,s=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).filter(function(e){return!!e});return n.length?[e,n.join("&")].join("?"):e}(e.url,i),c=new XMLHttpRequest;if(c.open(t,s),r&&c.setRequestHeader)for(var u in r)c.setRequestHeader(u,r[u]);return function(e,t,n,r){return new Promise(function(i){e.onreadystatechange=function(){r?2===e.readyState?i({data:e.responseText,status:e.status,xhr:e}):4===e.readyState?r(e.responseText,!0):3===e.readyState&&r(e.responseText,!1):4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},0!==t&&setTimeout(function(){e.abort(),i({status:e.status})},t),e.send(n)})}(c,n,o,a)}var Sa,Ea=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Fn.browser,"|").concat(Fn.version),ClientVersion:"5.36.1-nctest-alpha.2","Client-Session-Id":Ra(),"Request-Id":Date.now().toString()}},Oa=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;i(this,e),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_failedMs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clusterId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_configUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_msList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_qualityMsList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,n.getConnectionStatus()===Se.CONNECTED&&this.isNededDetector()&&this.detectorMediaSever()}return a(e,[{key:"isNededDetector",value:function(){var t=this._context.getNaviInfo();if(!t)return!1;var n=va(this._logger,t),r=t.jwtToken||"",i=Date.now(),o=!1;return 0===e.detectorTime?o=!1:e.detectValidMinute+e.detectorTime<i&&(o=!0),!(!n||!r||this._msUrl||o)}},{key:"detectorMediaSever",value:function(){this.clearMSList();var e=this._context.getNaviInfo();this._startDetector(e)}},{key:"_startDetector",value:function(t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s;return p().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,Ta(this._runtime,this._logger,t);case 1:if(i=n.v,o=i.detectoraddrs,a=i.clientDetectMinute,i.status!==exports.RCRTCCode.JWT_TIME_OUT){n.n=3;break}return s=this._context.getPluginContext(),n.n=2,null===(r=s.refetchNaviInfo)||void 0===r?void 0:r.call(s);case 2:return this.detectorMediaSever(),n.a(2);case 3:if(!o.length){n.n=5;break}return n.n=4,Ca(o,this._runtime,t);case 4:e.msInDetector=n.v;case 5:e.detectorTime=Date.now(),e.detectValidMinute=60*a*1e3;case 6:return n.a(2)}},n,this)}))}},{key:"clearMSList",value:function(){this._msList.length=0}},{key:"getMsList",value:function(){return this._msUrl?[this._msUrl]:(this._sortMediaServiceList(),v(this._msList))}},{key:"_sortMediaServiceList",value:function(){var t=e.msInDetector[0],n=e.msInDetector.slice(1),r=function(e,t){var n,r;if(!e)return[];try{r=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(n){return t.warn(ye.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===r.strategy)return[];var i=null===(n=r.callEngine)||void 0===n?void 0:n.filter(function(e){return 4===e.engineType});if(!i||0===i.length)return[];var o=i[0],a=[];return o.mediaServer&&a.push(o.mediaServer.replace(/^(https?:\/\/)?/,"https://")),o.backupMediaServer&&o.backupMediaServer.forEach(function(e){a.push(e.replace(/^(https?:\/\/)?/,"https://"))}),a}(this._context.getNaviInfo(),this._logger),i=r[0],o=r.slice(1),a=[this._clusterId,t,i].concat(v(n),v(o)).filter(function(e){return!!e}).map(function(e){return e.replace(/^(https?:\/\/)?/,"https://")});this._msList=v(new Set(a)),this._logger.info(ye.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList)))}},{key:"_openGzip",value:function(e,t){for(var n=JSON.stringify(t),r=n.length,i=new Uint8Array(r),o=0;o<r;o++)i[o]=n.charCodeAt(o);var a;return{headers:e=Object.assign(Object.assign({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=la(i,a)}}},{key:"_dealRequestSuccessResult",value:function(e){var t=JSON.parse(e);return t.rtcFinger&&(this._rtcFinger=t.rtcFinger),t.clusterId&&(this._clusterId!==t.clusterId&&this.clearMSList(),this._clusterId=t.clusterId),{code:exports.RCRTCCode.SUCCESS,data:t,qualityMsList:this._qualityMsList}}},{key:"_request",value:function(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E;return p().w(function(a){for(;;)switch(a.n){case 0:if(this._qualityMsList=[],c=(s={headers:t,body:n}).headers,u=s.body,0!==(d=this.getMsList()).length){a.n=1;break}return this._logger.error(ye.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),r),a.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 1:this._rtcFinger&&(u.rtcFinger=this._rtcFinger),_=0;case 2:if(!(_<d.length)){a.n=10;break}if(l=Date.now(),f="".concat(d[_]).concat(e),h=Ea(),R=Object.assign(Object.assign({},h),c),g=/x-www-form-urlencoded/.test(R["Content-Type"])?u:JSON.stringify(u),m=h["Request-Id"],this._logger.info(ye.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:f,"Request-Id":m}),r),C=void 0,v={url:f,body:g,headers:R,method:U.POST,timeout:this._timeout},!o){a.n=4;break}return a.n=3,Ia(Object.assign(Object.assign({},v),{onProgress:o}));case 3:C=a.v,a.n=6;break;case 4:return a.n=5,this._runtime.httpReq(Object.assign({},v));case 5:C=a.v;case 6:if(I=(T=C).status,S=T.data,E=T.xhr,i&&this._qualityMsList.push({rsdur:Date.now()-l,rsid:m,rscod:200===I?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:f}),200!==I){a.n=8;break}if(this._logger.info(ye.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.SUCCESSED,url:f}),r),!o){a.n=7;break}return a.a(2,{code:exports.RCRTCCode.SUCCESS,data:E});case 7:return a.a(2,this._dealRequestSuccessResult(S));case 8:this._logger.error(ye.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.FAILED,msg:"request error -> Request-Id: ".concat(m,", status: ").concat(I,", url: ").concat(f),timeout:this._timeout}),r);case 9:_+=1,a.n=2;break;case 10:return a.a(2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList})}},a,this)}))}},{key:"exchange",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s;return p().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,this._request("/exchange",e,t,n,r);case 1:return(a=i.v).code===exports.RCRTCCode.SUCCESS&&(null===(o=a.data)||void 0===o?void 0:o.resultCode)===exports.RCRTCCode.SUCCESS&&(s=a.data.urls)&&(this._configUrl=s.configUrl),i.a(2,a)}},i,this)}))}},{key:"exit",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this._logger.createTraceId(),t.n=1,this._request("/exit",e,{},n);case 1:return r=t.v,i=r.code,t.a(2,i)}},t,this)}))}},{key:"broadcastSubscribe",value:function(e,t){var n=this._logger.createTraceId();return this._request("/broadcast/subscribe",e,t,n,!0)}},{key:"broadcastExit",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this._logger.createTraceId(),t.n=1,this._request("/broadcast/exit",e,{},n,!0);case 1:return r=t.v,i=r.code,t.a(2,{code:i})}},t,this)}))}},{key:"setMcuConfig",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:t}),r),this._configUrl){n.n=1;break}return this._logger.error(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),r),n.a(2,{code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND});case 1:return i="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),o=Ea(),a=Object.assign(Object.assign({},o),e),s=JSON.stringify(t),c=o["Request-Id"],n.n=2,this._runtime.httpReq({url:i,headers:a,body:s,method:U.POST});case 2:if(u=n.v,d=u.status,_=u.data,200!==d){n.n=3;break}return l=JSON.parse(_),(f=l.resultCode)===exports.RCRTCCode.SUCCESS?this._logger.info(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.SUCCESSED,"Request-Id":c}),r):this._logger.warn(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:f,"Request-Id":c}),r),n.a(2,{code:f,res:l});case 3:return this._logger.error(ye.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(c,", status: ").concat(d,", url: ").concat(i)}),r),n.a(2,{code:exports.RCRTCCode.REQUEST_FAILED})}},n,this)}))}},{key:"getCDNResourceInfo",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d;return p().w(function(r){for(;;)switch(r.n){case 0:return i=Ea(),o=Object.assign(Object.assign({},i),e),a=i["Request-Id"],this._logger.info(ye.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(a,", url: ").concat(t),n),r.n=1,this._runtime.httpReq({url:t,headers:o,method:U.GET});case 1:if(s=r.v,c=s.status,u=s.data,200!==c){r.n=2;break}return d=JSON.parse(u),this._logger.info(ye.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:Le.SUCCESSED,cdnPlayerUrl:null==d?void 0:d.data.pull_url}),n),r.a(2,{code:d.resultCode,res:d});case 2:return this._logger.info(ye.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REQUEST_FAILED}),n),r.a(2,{code:exports.RCRTCCode.REQUEST_FAILED})}},r,this)}))}},{key:"updateASRStatus",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._request("/rtc/media/v1/asr/update",e,t,n);case 1:return i=r.v,r.a(2,i)}},r,this)}))}},{key:"operateRealtimeTranslation",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._request("/rtc/media/v1/asr/translation",e,t,n);case 1:return i=r.v,r.a(2,i)}},r,this)}))}},{key:"operateSummarization",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:return i="/rtc/media/v1/ai/room/sum/".concat(t.status===exports.RCRTCOperateSummarizationType.OPEN?"start":"stop"),r.n=1,this._request(i,e,t,n);case 1:return o=r.v,r.a(2,o)}},r,this)}))}},{key:"generateSummarization",value:function(e,t,n,r,i,o,a){return K(this,void 0,void 0,p().m(function s(){var c,u,d,_,l,f,h;return p().w(function(s){for(;;)switch(s.n){case 0:return c={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:n,endTime:r,config:{summarization:i.enableSummarization,summarizationDetails:i.enableSummarizationDetails,chapterSummary:i.enableChapterSummary,todoList:i.enableTodoList,hashtag:i.enableHashtag,language:i.destLang,format:i.format,custom:i.customPrompt}},s.n=1,this._request("/rtc/media/v1/ai/room/sum/gen",c,u,a,!1,function(e,t){o(e,t)});case 1:if(d=s.v,_=d.code,l=d.data,f=null==l?void 0:l.getResponseHeader("x-code"),h=null==l?void 0:l.getResponseHeader("x-msg"),_!==exports.RCRTCCode.SUCCESS||!f||Number(f)===exports.RCRTCCode.SUCCESS){s.n=2;break}return s.a(2,{code:Number(f),msg:h});case 2:return s.a(2,{code:_})}},s,this)}))}},{key:"getASRContent",value:function(e,t,n,r,i,o,a){return K(this,void 0,void 0,p().m(function s(){var c,u,d,_,l,f,h;return p().w(function(s){for(;;)switch(s.n){case 0:return c={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:n,endTime:r,language:a},s.n=1,this._request("/rtc/media/v1/ai/room/sum/asr",c,u,o,!1,function(e,t){i(e,t)});case 1:if(d=s.v,_=d.code,l=d.data,f=null==l?void 0:l.getResponseHeader("x-code"),h=null==l?void 0:l.getResponseHeader("x-msg"),_!==exports.RCRTCCode.SUCCESS||!f||Number(f)===exports.RCRTCCode.SUCCESS){s.n=2;break}return s.a(2,{code:Number(f),msg:h});case 2:return s.a(2,{code:_})}},s,this)}))}}])}();Object.defineProperty(Oa,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(Oa,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(Oa,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(Sa||(Sa={}));var ba,ya=function(e,t){return Math.round(8*t/e)},La=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=Math.pow(10,t);return Math.round(e*n)/n},ka=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e>1&&(e=1);var n=Math.pow(10,t);return Math.round(e*n)},Aa=function(e,t,n,r){if(0===t)return 0;if(!n||!r)return La(e/t,3);var i=t-r;if(0===i)return 0;var o=e-n;return o<0||i<0?0:La(o/i,3)},Na=function(e){var t=e.jitter,n=e.rtt,r=e.packetsLostRate;return!qn(t)||!qn(n)||0!==r};!function(e){e.TRACK="track",e.STREAM="stream",e.MEDIASOURCE="media-source",e.INBOUNDRTP="inbound-rtp",e.OUTBOUNDRTP="outbound-rtp",e.REMOTEINBOUNDRTP="remote-inbound-rtp",e.PEERCONNECTION="peer-connection",e.TRANSPORT="transport",e.CERTIFICATE="certificate",e.CANDIDATEPAIR="candidate-pair",e.REMOTECANDIDATE="remote-candidate",e.LOCALCANDIDATE="local-candidate"}(ba||(ba={}));var Pa=function(){return a(function e(t,n,r,o,a,s){i(this,e),Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_latestPacketsSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestPacketsRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}})},[{key:"getTrackIdByMid",value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}},{key:"updateBytesSent",value:function(e,t,n){var r,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];r=t-o.bytesSent,i=n-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:n}}else r=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:n};return ya(i,r)}},{key:"updateBytesRecv",value:function(e,t,n){var r,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];r=t-o.bytesRecv,i=n-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n}}else r=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n};return ya(i,r)}},{key:"updateSenderPacketsLost",value:function(e,t,n){var r;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var i=this._latestPacketsSent[e],o=i.packetsLost,a=i.packetsSent;r=Aa(t,n,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:n}else r=Aa(t,n),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=n;return r}},{key:"updateReceiverPacketsLost",value:function(e,t,n){var r;if(this._latestPacketsRecv[e]){var i=this._latestPacketsRecv[e],o=i.packetsLost,a=i.packetsRecv;r=Aa(t,n+t,o,a+o)}else r=Aa(t,n);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:n},r}},{key:"clearLatestpacketsSent",value:function(e){var t=this;e.forEach(function(e){if(parseInt(e.split("_").pop())===exports.RCMediaType.VIDEO_ONLY){var n="".concat(e,"_tiny");delete t._latestPacketsSent[n],delete t._latestBytesSent[n]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]})}},{key:"clearLatestPacketsRecv",value:function(e){var t=this;e.forEach(function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]})}},{key:"parseRTCStatsReport",value:function(e){var t,n={},r=s(e.entries());try{for(r.s();!(t=r.n()).done;){var i=m(t.value,2),o=i[0],a=i[1];/codec/gi.test(a)&&o.includes("RTCCodec_")||(n[o]=a)}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"formatRCRTCStateReport",value:function(e){var t={senders:[],receivers:[]};return this._logger.info(ye.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:Le.SUCCESSED,stats:e,reports:t})),t}},{key:"isValidTranceiver",value:function(e,t){var n,r,i="outbound-rtp"===t?null===(n=this._rtcPeerConn.currentLocalDescription)||void 0===n?void 0:n.sdp:null===(r=this._rtcPeerConn.currentRemoteDescription)||void 0===r?void 0:r.sdp,o=e.ssrc;return!(null==i?void 0:i.split("\r\nm=").some(function(e){return e.includes(o)&&e.includes("a=inactive")}))}},{key:"formatStateData",value:function(e){return Object.values(e).reduce(function(e,t){return t.type===ba.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===ba.INBOUNDRTP?(e.inbound.push(t),e):t.type===ba.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===ba.TRANSPORT?(e.transport.push(t),e):t.type===ba.PEERCONNECTION?(e.connection.push(t),e):e},{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}])}(),Da=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,Pa),a(e,[{key:"formatRCRTCStateReport",value:function(e){var t=this.formatStateData(e),n=t.outbound,r=t.remoteInbound,i=t.inbound,o=t.transport,a=t.connection,s={senders:[],receivers:[]},c=Math.floor(a[0].timestamp);s.timestamp=c;var u=0,d=0,_=this.pickOutbound(n,e,u,c,d);u=_.totalPacketsLost,d=_.bitrateSend,s.senders=_.senders,r.length>0&&s.senders.length>0&&this.pickRemoteInbound(r,s.senders,e);var l=0,p=this.pickInbound(i,e,u,c,l);if(u=p.totalPacketsLost,l=p.bitrateRecv,s.receivers=p.receivers,o.length>0){var f=o[0];this.pickRtcTransport(f,e,s,l,d,u)}return s}},{key:"pickRtcTransport",value:function(e,t,n,r,i,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,d=s.currentRoundTripTime,_=s.localCandidateId,l=s.remoteCandidateId,p=t[_],f=p.ip,h=p.port,R=p.networkType,g=t[l],m=g.ip,C=g.port,v=g.protocol;n.iceCandidatePair={IP:f,port:h,networkType:R,remoteIP:m,remotePort:C,protocol:v,bitrateRecv:r,bitrateSend:i,rtt:1e3*d,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},n.receivers.forEach(function(e){e.rtt=1e3*d})}}},{key:"pickRemoteInbound",value:function(e,t,n){var r=this;e.forEach(function(e){var i,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter(function(e){return e.id===o})[0];if(u&&!Na(u)){var d=null===(i=r._store)||void 0===i?void 0:i.getTrackIdBySSRC(n[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var _=r._latestPacketsSent[d].crtPacketsSent;u.packetsLostRate=r.updateSenderPacketsLost(d,c,_)}})}},{key:"_getOutboundVideoAttrs",value:function(e,t,n,r,i){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,d=e.frameHeight;return"video"!==n||u||d||c||(u=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[i].width,d=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[i].height,c=(null===(s=t[i])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:d}}},{key:"pickOutbound",value:function(e,t,n,r,i){var o=this,a=[];return e.forEach(function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"outbound-rtp")){var c=e.id,u=e.kind,d=e.mediaSourceId,_=e.remoteId,l=e.packetsSent,p=e.bytesSent,f=e.encoderImplementation,h=e.pliCount,R=e.nackCount,g=e.mid,m=e.trackId;if(void 0!==g&&(m=o.getTrackIdByMid(g)),m){var C=o._getOutboundVideoAttrs(e,t,u,m,d),v=C.frameRate,T=C.frameWidth,I=C.frameHeight,S=t[_],E=null,O=null,b=0;S&&(E=S.jitter,O=S.roundTripTime,b=S.packetsLost),n+=b;var y=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(y){var L=d?t[d].audioLevel:t[m].audioLevel,k=0;!o._latestPacketsSent[y]&&(o._latestPacketsSent[y]={}),S?k=o.updateSenderPacketsLost(y,b,l):o._latestPacketsSent[y].crtPacketsSent=l;var A=o.updateBytesSent(y,p,r);A<0&&(A=0),i+=A,a.push({id:c,trackId:y,kind:u,packetsLostRate:k,remoteResource:!1,audioLevel:L||0===L?ka(L):null,frameWidth:T,frameHeight:I,frameRate:v,bitrate:A,jitter:E?Math.round(1e3*E):E,rtt:O?Math.round(1e3*O):O,encoderImplementation:f,pliCount:h,nackCount:R,googFirsSent:fa,samplingRate:fa,googRenderDelayMs:fa,trackState:fa})}}}}),{totalPacketsLost:n,bitrateSend:i,senders:a}}},{key:"_getInboundMediaAttrs",value:function(e,t,n,r,i){var o,a,s,c=e.frameWidth,u=e.frameHeight,d=e.audioLevel;return"video"===i?c||u||(c=(null===(o=t[n])||void 0===o?void 0:o.frameWidth)||t[r].width,u=(null===(a=t[n])||void 0===a?void 0:a.frameHeight)||t[r].height):d||(d=(null===(s=t[n])||void 0===s?void 0:s.audioLevel)||t[r].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:d}}},{key:"pickInbound",value:function(e,t,n,r,i){var o=this,a=[];return e.forEach(function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"inbound-rtp")){var c=e.packetsLost,u=e.packetsReceived,d=e.jitter,_=e.bytesReceived,l=e.framesPerSecond,p=e.kind,f=e.codecImplementationName,h=e.nackCount,R=e.pliCount,g=e.mid,m=e.id,C=e.trackId;if(void 0!==g&&(C=o.getTrackIdByMid(g)),C){var v=o._getInboundMediaAttrs(e,t,C,m,p),T=v.frameWidth,I=v.frameHeight,S=v.audioLevel;n+=c;var E=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),O=o.updateReceiverPacketsLost(E,c,u),b=o.updateBytesRecv(E,_,r);b<0&&(b=0),i+=b,a.push({trackId:E,kind:p,packetsLostRate:O,remoteResource:!0,audioLevel:S||0===S?ka(S):null,frameWidth:T,frameHeight:I,frameRate:l,bitrate:b,jitter:d?Math.round(1e3*d):0,codecImplementationName:f,nackCount:h,pliCount:R,rtt:null,samplingRate:fa,googFirsReceived:fa,googRenderDelayMs:fa,trackState:fa})}}}),{totalPacketsLost:n,bitrateRecv:i,receivers:a}}}])}(),Ua=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return _(e,Pa),a(e,[{key:"_pickSenderData",value:function(e,t,n){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,n)){var i=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,d=e.pliCount,_=e.remoteId,l=_?t[_]:{jitter:null,roundTripTime:null,packetsLost:0},p=l.jitter,f=l.roundTripTime,h=l.packetsLost,R=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=h;var g=0;!this._latestPacketsSent[R]&&(this._latestPacketsSent[R]={}),_?g=this.updateSenderPacketsLost(R,h,a):this._latestPacketsSent[R].crtPacketsSent=a;var m=0;"video"===i?s&&(m=Math.floor(s/1e3)):m=this.updateBytesSent(R,o,this._reportsData.timestamp),m<0&&(m=0),this._bitrateSend+=m,this._reportsData.senders.push({trackId:R,kind:i,packetsLostRate:g,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:m,jitter:p?Math.round(1e3*p):null,rtt:f,encoderImplementation:null,pliCount:d,nackCount:u,googFirsSent:fa,samplingRate:fa,googRenderDelayMs:fa,trackState:fa})}}},{key:"_addSenderData",value:function(e,t){var n,r=t.localId,i=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e[r].ssrc),o=this._reportsData.senders.filter(function(e){return e.trackId===i})[0];o&&Na(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(i,t.packetsLost,this._latestPacketsSent[i].crtPacketsSent))}},{key:"_pickReceiverData",value:function(e,t){var n;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var r=e.packetsLost,i=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,d=e.nackCount,_=e.pliCount,l=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=r;var p=this.updateReceiverPacketsLost(l,r,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(l,i,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:l,kind:c,packetsLostRate:p,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:f,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:d,pliCount:_,rtt:null,samplingRate:fa,googFirsReceived:fa,googRenderDelayMs:fa,trackState:fa})}}},{key:"_pickIceCandidatePair",value:function(e,t){var n=e[t.localCandidateId],r=n.address,i=n.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:r,port:i,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}},{key:"formatRCRTCStateReport",value:function(e){var t=+new Date;for(var n in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var r=e[n],i=r.type;"outbound-rtp"===i&&this._pickSenderData(r,e,i),"remote-inbound-rtp"===i&&this._addSenderData(e,r),"inbound-rtp"===i&&this._pickReceiverData(r,i),"candidate-pair"===i&&"succeeded"===r.state&&this._pickIceCandidatePair(e,r)}return this._reportsData}}])}(),wa=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return _(e,Pa),a(e,[{key:"_pickReceiverData",value:function(e,t){var n=this;e.forEach(function(e){var t;if("unified-plan"!==n._sdpSemantics||n.isValidTranceiver(e,"inbound-rtp")){var r=e.packetsLost,i=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.kind,c=e.nackCount,u=e.pliCount,d=e.audioLevel,_=e.frameHeight,l=e.frameWidth,p=null===(t=n._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(p){n._totalPacketsLost+=r;var f=n.updateReceiverPacketsLost(p,r,i),h=n.updateBytesRecv(p,a,n._reportsData.timestamp);h<0&&(h=0),n._bitrateRecv+=h,n._reportsData.receivers.push({trackId:p,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:d||0===d?ka(d):null,frameWidth:l,frameHeight:_,frameRate:null,bitrate:h,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:fa,googFirsReceived:fa,googRenderDelayMs:fa,trackState:fa})}}})}},{key:"_pickSenderData",value:function(e,t){var n=this;e.forEach(function(e){var r;if("unified-plan"!==n._sdpSemantics||n.isValidTranceiver(e,"outbound-rtp")){var i=null===(r=n._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,d=e.frameHeight,_=e.frameWidth,l=e.codecId,p=e.remoteId,f=e.packetsSent;if(i){var h=t[p],R=null,g=null,m=0;h&&(R=h.jitter,g=h.roundTripTime,m=h.packetsLost),n._totalPacketsLost+=m;var C=0;!n._latestPacketsSent[i]&&(n._latestPacketsSent[i]={}),h?C=n.updateSenderPacketsLost(i,m,f):n._latestPacketsSent[i].crtPacketsSent=f;var v=n.updateBytesSent(i,a,n._reportsData.timestamp);v<0&&(v=0),n._bitrateSend+=v,n._reportsData.senders.push({trackId:i,kind:o,packetsLostRate:C,remoteResource:!1,audioLevel:u||0===u?ka(u):null,frameWidth:_,frameHeight:d,frameRate:null,bitrate:v,jitter:R?Math.round(1e3*R):R,rtt:g?Math.round(1e3*g):g,encoderImplementation:t[l].mimeType,pliCount:s,nackCount:c,googFirsSent:fa,samplingRate:fa,googRenderDelayMs:fa,trackState:fa})}}})}},{key:"_pickIceCandidatePair",value:function(e,t){var n=e.selectedCandidatePairId;if(n){var r=t[n],i=r.availableOutgoingBitrate,o=r.availableIncomingBitrate,a=r.currentRoundTripTime,s=r.localCandidateId,c=r.remoteCandidateId,u=t[s],d=u.address,_=u.port,l=t[c],p=l.address,f=l.port,h=l.protocol;this._reportsData.iceCandidatePair={IP:d||null,port:_,networkType:null,remoteIP:p,remotePort:f,protocol:h,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:i,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach(function(e){e.rtt=1e3*a})}}},{key:"formatRCRTCStateReport",value:function(e){var t=this.formatStateData(e),n=t.outbound,r=t.inbound,i=t.transport,o=t.connection;this._reportsData={senders:[],receivers:[]};var a=Math.floor(o[0].timestamp);if(this._reportsData.timestamp=a,this._totalPacketsLost=0,this._bitrateSend=0,this._bitrateRecv=0,this._pickSenderData(n,e),this._pickReceiverData(r,e),i.length>0){var s=i[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}])}(),Ma=function(){function e(t,n,r){i(this,e),Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"SDPHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"videoStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"audioStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]});var o=this.getStreamIndex();this.spliteStreams(o)}return a(e,[{key:"videoSdps",get:function(){return this.videoStreams.slice()}},{key:"audioSdps",get:function(){return this.audioStreams.slice()}},{key:"getStreamIndex",value:function(){for(var e=/m=(?:video|audio)/gim,t=new Set([0]),n=e.exec(this.SDP);null!==n;)t.add(null==n?void 0:n.index),n=e.exec(this.SDP);return t.add(this.SDP.length),v(t)}},{key:"spliteStreams",value:function(e){this.SDPHeader=this.SDP.substring(e[0],e[1]).replace(/\r\ns=-/g,"\r\ns=".concat((new Date).valueOf()));for(var t=1;t<e.length;t++){var n=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(n)?this.videoStreams.push(n):this.audioStreams.push(n)}}},{key:"setHeaderBitrate",value:function(t){this.SDPHeader=this.SDPHeader.replace(/(\r\ns=[^\r\n]+)/gi,"$1\r\nc=IN IP4 0.0.0.0\r\nb=AS:".concat(t*e.KBitrate,"\r\nb=TIAS:").concat(t*e.KBitrate*850))}},{key:"setAudiosBitrate",value:function(e){var t=this;return this.audioStreams=this.audioStreams.map(function(n){return t.setAudioItemBitrate(n,e)}),this}},{key:"setAudioBitrateWithStreamId",value:function(e,t){var n=this;return this.audioStreams=this.audioStreams.map(function(r){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(r)?n.setAudioItemBitrate(r,e):r}),this}},{key:"setAudioBitrateWithMid",value:function(e,t){var n=this;return this.audioStreams=this.audioStreams.map(function(r){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(r)?n.setAudioItemBitrate(r,e):r}),this}},{key:"setAudioItemBitrate",value:function(t,n){if(0===n.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var r=["$1","maxaveragebitrate=".concat(n.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,r.join(";"))}return this.addAudioBlineAS(t,n)}},{key:"addAudioBlineAS",value:function(t,n){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(n.max*e.KBitrate,"\r\nb=TIAS:").concat(n.max*e.KBitrate*850))}},{key:"setVideosBitrate",value:function(e){var t=this;return this.videoStreams=this.videoStreams.map(function(n){return t.setVideoItemBitrate(n,e)}),this}},{key:"setVideoBitrateWithStreamId",value:function(e,t){var n=this;return this.videoStreams=this.videoStreams.map(function(r){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(r)?n.setVideoItemBitrate(r,e):r}),this}},{key:"setVideoBitrateWithMid",value:function(e,t){var n=this;return this.videoStreams=this.videoStreams.map(function(r){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(r)?n.setVideoItemBitrate(r,e):r}),this}},{key:"setVideoItemBitrate",value:function(t,n){if(0===n.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var r=["$1","x-google-max-bitrate=".concat(n.max*e.KBitrate),"x-google-min-bitrate=".concat(n.min*e.KBitrate),"x-google-start-bitrate=".concat(n.start||n.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,r.join(";"))}return this.addVideoBlineAS(t,n)}},{key:"addVideoBlineAS",value:function(t,n){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(n.max*e.KBitrate,"\r\nb=TIAS:").concat(n.max*e.KBitrate*850))}},{key:"clearnSsrcWithMid",value:function(e,t){var n=this;return this.audioStreams=this.audioStreams.map(function(r){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(r)?n.clearSSRC(r,t):r}),this.videoStreams=this.videoStreams.map(function(r){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(r)?n.clearSSRC(r,t):r}),this}},{key:"clearSSRC",value:function(e,t){if(t===Fa.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Fa.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Fa.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}],[{key:"trimBlankLine",value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}},{key:"clearInactiveOrRecvonly",value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}])}();Object.defineProperty(Ma,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1});var xa,Ba=function(){return a(function e(){i(this,e)},null,[{key:"init",value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}},{key:"isInit",value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}},{key:"decodeAudio",value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"encodeAudio",value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"decodeVideo",value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"encodeVideo",value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(ye.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}])}();!function(e){e[e.NB=0]="NB",e[e.MB=1]="MB",e[e.WB=2]="WB",e[e.SWB=3]="SWB",e[e.FB=4]="FB"}(xa||(xa={})),xa.NB,xa.NB,xa.NB,xa.NB,xa.MB,xa.MB,xa.MB,xa.MB,xa.WB,xa.WB,xa.WB,xa.WB,xa.SWB,xa.SWB,xa.FB,xa.FB,xa.NB,xa.NB,xa.NB,xa.NB,xa.WB,xa.WB,xa.WB,xa.WB,xa.SWB,xa.SWB,xa.SWB,xa.SWB,xa.FB,xa.FB,xa.FB,xa.FB;var Va=function(){function e(){i(this,e)}return a(e,null,[{key:"splitSections",value:function(e){return e.split("\nm=").map(function(e,t){var n=t>0?"m=".concat(e):e;return"".concat(n.trim(),"\r\n")})}},{key:"getMediaSections",value:function(t){var n=e.splitSections(t);return n.shift(),n}},{key:"parseExtmap",value:function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}}},{key:"splitLines",value:function(e){return e.trim().split("\n").map(function(e){return e.trim()})}},{key:"parseMLine",value:function(t){var n=e.splitLines(t)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}}},{key:"matchPrefix",value:function(t,n){return e.splitLines(t).filter(function(e){return 0===e.indexOf(n)})}},{key:"parseMsid",value:function(t){var n,r=e.matchPrefix(t,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=e.matchPrefix(t,"a=ssrc:").map(function(t){return e.parseSsrcMedia(t)}).filter(function(e){return"msid"===e.attribute});return i.length>0&&i[0].value?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:{stream:"",track:""}}},{key:"parseSsrcMedia",value:function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n}},{key:"getMid",value:function(t){var n=e.matchPrefix(t,"a=mid:")[0];if(n)return n.substr(6)}},{key:"splitNaluData",value:function(e){var t=new Uint8Array(e),n=0;if(this.isIFrame(t)){var r=t.join(","),i=r.indexOf("0,0,0,1,101");-1===i&&(i=r.indexOf("0,0,0,1,37")),n=r.substring(0,i).split(",").length-1+4+8}else n=12;return{header:t.slice(0,n),payloadData:t.slice(n)}}},{key:"deal0x03",value:function(e,t){var n=[];return n="encode"===t?e.join(",").replaceAll(",0,0,1,",",0,0,3,1,").split(",").map(function(e){return Number(e)}):e.join(",").replaceAll(",0,0,3,1,",",0,0,1,").split(",").map(function(e){return Number(e)}),new Uint8Array(n)}},{key:"isIFrame",value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}},{key:"parsePayloadTypes",value:function(t){var n=e.getMediaSections(t).find(function(t){return"audio"===e.parseMLine(t).kind});if(n){var r=n.match(/a=rtpmap:(\d+)\s+(\S+)/g);r&&(e.payloadTypeCodecMap=r.map(function(e){var t=e.match(/a=rtpmap:(\d+)\s+(\w+)/);return t?{payloadType:Number(t[1]),codec:t[2]}:null}).filter(function(e){return!!e}))}}}])}();Object.defineProperty(Va,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]});var ja,Fa;function Ga(e,t){for(var n=0,r=t;r<e.length;){var i=e[r];if(n+=i,r++,255!==i)break}return{value:n,nextOffset:r}}function Ja(e,t){if(t>=e.length)return null;var n=Ga(e,t),r=n.value,i=n.nextOffset,o=Ga(e,i),a=o.value;if(i=o.nextOffset,a<16)return null;if(i+a>e.length)return null;var s=e.slice(i,i+16),c=i+16,u=a-16,d=e.slice(c,c+u);return d.length>=2&&0===d[d.length-2]&&128===d[d.length-1]?d=d.slice(0,d.length-2):d.length>=1&&128===d[d.length-1]&&(d=d.slice(0,d.length-1)),5===r?{payloadSize:a,uuid:s,content:d}:null}!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(ja||(ja={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(Fa||(Fa={}));var Ha=function(){function e(t,n,r,o){i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_onReceiveSeiListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return a(e,[{key:"setReceiveSeiListener",value:function(e){this._onReceiveSeiListener=e}},{key:"getOutboundVideoInfo",value:function(){var e=[];for(var t in this._outboundStreams){var n=this._outboundStreams[t].getVideoTracks()[0];if(n){var r=/_tiny$/.test(t),i=kn(n),o=i.width,a=i.height;e.push({trackId:n.id,simulcast:r?Sa.TINY:Sa.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}},{key:"setRemoteAnswer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=Ma.trimBlankLine(e),t.p=1,t.n=2,this._peer.setRemoteDescription({type:"answer",sdp:e});case 2:t.n=4;break;case 3:return t.p=3,n=t.v,this._logger.info(ye.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:Le.FAILED,msg:n})),t.a(2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED);case 4:return this._logger.info(ye.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:Le.SUCCESSED,sdp:e})),t.a(2,exports.RCRTCCode.SUCCESS)}},t,this,[[1,3]])}))}},{key:"getStatParsr",value:function(e,t,n,r){return/chrome/i.test(Fn.browser)?new Da(this,e,this._logger,t,n,r):/Firefox/i.test(Fn.browser)?new Ua(this,e,this._logger,t,n,r):/Safari/i.test(Fn.browser)?new wa(this,e,this._logger,t,n,r):null}},{key:"getTrackIdByMid",value:function(e){return null}},{key:"resetSdp",value:function(e){return Ma.trimBlankLine(e)}},{key:"_setupSenderTransform",value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),n=t.readable,r=t.writable,i=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});n.pipeThrough(i).pipeTo(r)}}},{key:"_setupReceiverTransform",value:function(e){var t=e.createEncodedStreams(),n=t.readable,r=t.writable,i=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});n.pipeThrough(i).pipeTo(r)}},{key:"_encodeVideoFrame",value:function(e){var t=Va.splitNaluData(e),n=t.header,r=t.payloadData,i=Ba.encodeVideo(r),o=Va.deal0x03(i,"encode");return new Uint8Array([].concat(v(n),v(o))).buffer}},{key:"_decodeVideoFrame",value:function(e){var t,n=new Uint8Array(e),r=n.join(",").indexOf("0,0,0,1,6,5");if(-1!==r&&n.join(",").includes("84,128,131,151,240,35,71,75,183,247,79,50,181,78,6,172")){var i=n.join(",").slice(r);return null===(t=this._onReceiveSeiListener)||void 0===t||t.call(this,i),e}if(!this._useEncrypt)return e;var o=Va.splitNaluData(e),a=o.header,s=o.payloadData,c=Va.deal0x03(s,"decode"),u=Ba.decodeVideo(c);return new Uint8Array([].concat(v(a),v(u))).buffer}},{key:"_handleAudioREDFrame",value:function(e,t){var n=function(e){for(var t=[],n=0;;){var r,i=!(e[n]>>7),o=127&e[n],a=void 0,s=void 0,c=void 0;if(i?(a=0,s=e.byteLength-(t.length>0?t.map(function(e){return 4+e.block.byteLength}).reduce(function(e,t){return e+t}):0)-1,c=e.slice(n,n+1),n+=1):(a=(e[n+1]<<6)+(e[n+2]>>2),s=((3&e[n+2])<<8)+e[n+3],c=e.slice(n,n+4),n+=4),r=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:r,isPrimary:i,blockPType:o}),i)break}return t.forEach(function(t){var r=t.block.byteLength,i=e.slice(n,n+r);t.block.set(i),n+=r}),t}(new Uint8Array(e)),r=[],i=[],o=0;n.forEach(function(e){var n="decode"===t?Ba.decodeAudio(e.block):Ba.encodeAudio(e.block);if(n.byteLength!==e.block.byteLength&&!e.isPrimary){var a=m(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+n.byteLength>>8,c=255&n.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=n,o+=e.block.byteLength+e.header.byteLength,r.push(e.header),i.push(e.block)});var a=new Uint8Array(o),s=0;return[].concat(r,i).forEach(function(e){a.set(e,s),s+=e.byteLength}),a.buffer}},{key:"_handleOpusFrame",value:function(e,t){var n=new Uint8Array(e);return("encode"===t?Ba.encodeAudio(n):Ba.decodeAudio(n)).buffer}},{key:"_encodeRtpChunk",value:function(e,t,n){var r=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(r);else{var i=t.getMetadata().payloadType,o=Va.payloadTypeCodecMap.filter(function(e){return e.payloadType===i})[0].codec;"red"===o?t.data=this._handleAudioREDFrame(r,"encode"):"opus"===o?t.data=this._handleOpusFrame(r,"encode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}n.enqueue(t)}},{key:"_decodeRtpChunk",value:function(e,t,n){var r=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(r);else if(this._useEncrypt){var i=t.getMetadata().payloadType,o=Va.payloadTypeCodecMap.filter(function(e){return e.payloadType===i})[0].codec;"red"===o?t.data=this._handleAudioREDFrame(r,"decode"):"opus"===o?t.data=this._handleOpusFrame(r,"decode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}n.enqueue(t)}}],[{key:"setSdpSemantics",value:function(e,t){var n=Fn.browser,r=Fn.version,i=Fn.supportsUnifiedPlan;if(t.info(ye.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:i,browser:n,version:r})),i)return/chrome/i.test(n)?r?void(this._sdpSemantics=r>92?"unified-plan":r<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(n)?this._sdpSemantics="unified-plan":/safari/i.test(n)?this._sdpSemantics=r<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}},{key:"getSdpSemantics",value:function(){return e._sdpSemantics}}])}(),Ka=function(){function e(t,n){var o;return i(this,e),o=r(this,e,[n,ja.PLANB,t]),Object.defineProperty(o,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,Ma),a(e,[{key:"stringify",value:function(){var e=[this.SDPHeader];[].concat(v(this.audioStreams),v(this.videoStreams)).forEach(function(t){var n=t.match(/\ba=mid:(video|audio)\b/),r=Ma.clearInactiveOrRecvonly(t);n&&n[1]===Qt.AUDIO&&(e[1]=r),n&&n[1]===Qt.VIDEO&&(e[2]=r)});var t=e.join("");return Ma.trimBlankLine(t)}},{key:"setAudioBitrateWithStreamId",value:function(e,t){return this._logger.warn(ye.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}},{key:"setVideoBitrateWithStreamId",value:function(e,t){return this._logger.warn(ye.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}])}(),qa=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return _(e,Ha),a(e,[{key:"addLocalTrack",value:function(e){this._localTracks.every(function(t){return t.getTrackId()!==e.getTrackId()})&&this._localTracks.push(e);var t=e.getStreamId(),n=e.__innerGetMediaStreamTrack(),r=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);r.getTracks().forEach(function(e){e.kind===n.kind&&r.removeTrack(e)}),r.addTrack(n);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(n):(this.senders[i]=this._peer.addTrack(n,r),Object.defineProperty(n,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}))}},{key:"removeLocalTrack",value:function(e){var t=this._localTracks.findIndex(function(t){return t===e});t>=0&&this._localTracks.splice(t,1);var n=e.getTrackId(),r=this.senders[n];r&&(r.replaceTrack(null),this._peer.removeTrack(r),delete this.senders[n])}},{key:"updateSubRemoteTracks",value:function(e){}},{key:"updateRecvTransceiverMap",value:function(e,t){}},{key:"setBitrate",value:function(e,t,n){}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 1:for(r in n=t.v,this._outboundStreams)i=this._outboundStreams[r].id,n.sdp=n.sdp.replace(new RegExp(i,"g"),r);return n.sdp&&(n.sdp=this.resetSdp(n.sdp)),t.n=2,this._peer.setLocalDescription(n);case 2:return t.a(2,{type:"offer",semantics:"plan-b",sdp:n.sdp})}},t,this)}))}},{key:"setRemoteAnswer",value:function(t){return t=this.resetSdp(t),C(e,"setRemoteAnswer",this,3)([t])}},{key:"_getMaxRangeBitrate",value:function(e){var t=this._localTracks.filter(function(t){return e===exports.RCMediaType.AUDIO_ONLY?t.isAudioTrack():t.isVideoTrack()}),n={max:0,min:0};return t.forEach(function(e){var t=e.getBitrate(),r=t.min,i=t.max,o=t.start;n.max=n.max<i?i:n.max,n.min=n.min>r?r:n.min,n.max===i?n.start=o:n.start=.7*n.max}),n}},{key:"resetSdp",value:function(e){var t=new Ka(this._logger,e),n=this._getMaxRangeBitrate(exports.RCMediaType.VIDEO_ONLY),r=this._getMaxRangeBitrate(exports.RCMediaType.AUDIO_ONLY);return t.setAudiosBitrate(r),t.setVideosBitrate(n),t.stringify()}}])}(),Wa=function(){function e(t,n){return i(this,e),r(this,e,[n,ja.UNIFIEDPLAN,t])}return _(e,Ma),a(e,[{key:"stringify",value:function(){var e=[this.SDPHeader];[].concat(v(this.audioStreams),v(this.videoStreams)).forEach(function(t){var n=t.match(/\ba=mid:(\d+)\b/);n&&n[1]&&(e[+n[1]+1]=t)}),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return Ma.trimBlankLine(t)}}])}(),za=function(){function e(){i(this,e),Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return a(e,[{key:"push",value:function(e,t){return this.__streams.set(e,t),t}},{key:"pickup",value:function(e){return this.__streams.get(e)}},{key:"delete",value:function(e){return this.__streams.delete(e)}},{key:"streams",get:function(){var e,t=new Map,n=s(this.__streams.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.set(r,this.pickup(r))}}catch(e){n.e(e)}finally{n.f()}return t}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}])}(),Ya=function(){function e(){var t;return i(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_sendTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_recvAudio",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvVideo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_subedTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"midMsid",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t}return _(e,Ha),a(e,[{key:"setBitrate",value:function(e,t,n){this._logger.warn(ye.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}},{key:"getTrackIdByMid",value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var n in this._recvTransceiver){if(this._recvTransceiver[n].mid===e)return n}return null}},{key:"addLocalTrack",value:function(e){var t,n=e.getTrackId(),r=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[n]=e;var o=this._outboundStreams[r]||(this._outboundStreams[r]=new MediaStream);o.getTracks().forEach(function(e){e.kind===i.kind&&o.removeTrack(e)}),o.addTrack(i);var a=this._sendTransceiver[n];if(a)a.sender.replaceTrack(i),a.direction="sendonly";else{var s=this._sendTransceiver[n]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}za.getInstance().push(n,{msid:r,id:this._outboundStreams[r].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}},{key:"removeLocalTrack",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.getTrackId(),r=e.getStreamId();delete this._localTracks[n];var i=this._sendTransceiver[n];if(i){"closed"!==this._peer.connectionState&&(i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null));var o=this._outboundStreams[r];(e.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach(function(e){return o.removeTrack(e)});var a=this._sendTransceiver["".concat(n,"_tiny")];if(a&&"inactive"!==a.direction&&t&&"closed"!==this._peer.connectionState){a.direction="inactive";var s=a.sender,c=s.track;this._peer.removeTrack(s),s.replaceTrack(null),this._outboundStreams["".concat(r,"_tiny")].removeTrack(c),c.stop()}}}},{key:"updateRecvTransceiverMap",value:function(e,t){var n=Pn(e).mediaType;this._recvTransceiver[e]=t;var r=n===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=r.findIndex(function(e){return e===t});i>=0&&r.splice(i,1)}},{key:"updateSubRemoteTracks",value:function(e){var t=this,n=e.slice(),r=this._subedTracks.slice();this._subedTracks=e.slice();for(var i=function(){var e=n[o],t=r.findIndex(function(t){return t===e});t>=0&&(n.splice(o,1),r.splice(t,1))},o=n.length-1;o>=0;o-=1)i();r.length&&r.forEach(function(e){var n=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var r=t._recvTransceiver[n];r&&(r.direction="inactive")});var a={audio:0,video:0};n.length&&n.forEach(function(e){var n=e.isAudioTrack()?"audio":"video",r=t._recvTransceiver[e.getTrackId()];r?r.direction="recvonly":a[n]+=1});for(var s=this._recvAudio.length;s<a.audio;s+=1){var c=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(c),this._setupReceiverTransform(c.receiver)}for(var u=this._recvVideo.length;u<a.video;u+=1){var d=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(d),this._setupReceiverTransform(d.receiver)}}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._peer.createOffer({iceRestart:e});case 1:for(i in n=t.v,r=n.sdp,this._outboundStreams)o=this._outboundStreams[i].id,r=r.replace(new RegExp(o,"g"),i);return r=(r=this.resetOfferSdp(r)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),n.sdp=r,t.n=2,this._peer.setLocalDescription(n);case 2:return t.a(2,{type:"offer",semantics:"unified-plan",sdp:r})}},t,this)}))}},{key:"setRemoteAnswer",value:function(t){t=this.resetAnswerSdp(t);var n=/[\r\n]+\r\n[\r\n]+/g;return n.test(t)&&(t=t.replace(n,"\r\n")),C(e,"setRemoteAnswer",this,3)([t])}},{key:"_genarateMid",value:function(e,t,n){var r=null;return Va.getMediaSections(e).forEach(function(e){Va.parseExtmap(e);var i=Va.parseMLine(e).kind,o=Va.parseMsid(e).stream,a=Va.getMid(e);"video"===n?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&n===i&&a&&(r=a)}),r}},{key:"_setSenderTransceiverBitrate",value:function(e,t,n,r){var i=this._localTracks[t],o=null==i?void 0:i.getBitrate();r===Qt.AUDIO&&o&&e.setAudioBitrateWithMid(o,n),r===Qt.VIDEO&&o&&e.setVideoBitrateWithMid(o,n)}},{key:"_resetSenderTransceiver",value:function(e,t){var n;for(var r in this._sendTransceiver){var i=this._sendTransceiver[r],o=null===(n=i.sender.track)||void 0===n?void 0:n.kind,a=i.direction,s=i.mid;s||(s=this._genarateMid(e,r,o)),s&&(a===Fa.SENDONLY&&this._setSenderTransceiverBitrate(t,r,s,o),a===Fa.INACTIVE&&t.clearnSsrcWithMid(s,Fa.INACTIVE))}}},{key:"_resetRecvTransceiver",value:function(e){for(var t in this._recvTransceiver){var n=this._recvTransceiver[t],r=n.direction,i=n.mid;i&&r===Fa.INACTIVE&&e.clearnSsrcWithMid(i,Fa.RECVONLY)}}},{key:"resetOfferSdp",value:function(e){var t=new Wa(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}},{key:"resetAnswerSdp",value:function(e){var t,n=new Wa(this._logger,e);for(var r in this._sendTransceiver){var i=this._sendTransceiver[r],o=i.mid;if(o){var a=this._localTracks[r],s=null==a?void 0:a.getBitrate(),c=null===(t=i.sender.track)||void 0===t?void 0:t.kind;c===Qt.AUDIO&&s&&n.setAudioBitrateWithMid(s,o),c===Qt.VIDEO&&s&&n.setVideoBitrateWithMid(s,o)}}return n.stringify()}}])}(),Qa=function(){function e(t,n,o,a,s,c){var u,d=arguments.length>6&&void 0!==arguments[6]&&arguments[6],_=arguments.length>7&&void 0!==arguments[7]&&arguments[7];i(this,e),u=r(this,e),Object.defineProperty(u,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_store",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(u,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(u,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var l=Ha.getSdpSemantics(),p="unified-plan"===l&&_&&"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams&&Ba.isInit(),f=u._rtcPeerConn=new RTCPeerConnection({sdpSemantics:l,encodedInsertableStreams:p});return u._sdpStrategy="plan-b"===l?new qa(t,u._logger,f,!1):new Ya(t,u._logger,f,p),u._sdpStrategy.setReceiveSeiListener(u._decodeSeiData.bind(u)),u._rtcPeerConn.oniceconnectionstatechange=u._onICEConnectionStateChange.bind(u),u._rtcPeerConn.onconnectionstatechange=u._onConnectionStateChange.bind(u),u._rtcPeerConn.ontrack=u._onTrackReady.bind(u),u.reportParser=u._sdpStrategy.getStatParsr(u._rtcPeerConn,l,u._currentUserId,u._store),u}return _(e,F),a(e,[{key:"getLocalTracks",value:function(){return Object.values(this.pubLocalTracks)}},{key:"_decodeSeiData",value:function(t){var n=t.split(",").map(function(e){return Number(e)}),r=function(e){if(e.length>=4&&0===e[0]&&0===e[1]&&(1===e[2]||0===e[2]&&1===e[3]))for(var t=0;t+4<e.length;)if(0===e[t]&&0===e[t+1]&&(1===e[t+2]||0===e[t+2]&&1===e[t+3])){var n=t+(1===e[t+2]?3:4);if(n>=e.length)break;if(6==(31&e[n])){var r=Ja(e,n+1);if(r)return{payloadSize:r.payloadSize,content:r.content}}t=n+1}else t++;else for(var i=0;i+4<=e.length;){var o=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3];if(o<=0||i+4+o>e.length)break;var a=i+4;if(6==(31&e[a])){var s=a+1,c=Ja(e.subarray(s,i+4+o),0);if(c)return{payloadSize:c.payloadSize,content:c.content}}i+=4+o}return null}(new Uint8Array(n));if(null==r?void 0:r.content.length){var i=this._context.decodeAsrText(r.content,n);i.length&&this.emit(e.__INNER_SEI_CONTENT__,i)}}},{key:"_onConnectionStateChange",value:function(){this._logger.info(ye.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}},{key:"startAutoExecute",value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout(function(){t._reportHandle(),t.startAutoExecute(e)},e)}},{key:"stopAutoExecute",value:function(){clearTimeout(this._reportStatsTimer)}},{key:"_onICEConnectionStateChange",value:function(){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(ye.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),t.n=1,this._getStatsData();case 1:o=t.v,a=o?this._createRCRTCStateReport(o).iceCandidatePair:null,this.emit(e.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:a}),"connected"===i?(this.emit(e.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==i&&"disconnected"!==i||this._handleRetry();try{null===(r=null===(n=this._reportListener)||void 0===n?void 0:n.onICEConnectionStateChange)||void 0===r||r.call(n,i)}catch(e){this._logger.error(ye.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:Le.FAILED,mag:e}))}case 2:return t.a(2)}},t,this)}))}},{key:"_handleRetry",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r=this;return p().w(function(e){for(;;)switch(e.n){case 0:if(!this._inRetry){e.n=1;break}return e.a(2);case 1:return this.clearReTryExchangeTimer(),this._inRetry=!0,e.n=2,this._reTryExchange();case 2:if(t=e.v,n=t.code,this._inRetry=!1,n!==exports.RCRTCCode.SUCCESS){e.n=3;break}return e.a(2);case 3:this._reTryExchangeTimer=setTimeout(function(){return r._handleRetry()},15e3);case 4:return e.a(2)}},e,this)}))}},{key:"_onTrackReady",value:function(t){if(t.streams.length){var n=t.streams[0].id,r=t.receiver.track,i=[n,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");Object.defineProperty(r,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(i,t.transceiver),Pn(i).tag!==ha&&this.emit(e.__INNER_EVENT_TRACK_READY__,t)}}},{key:"setBitrate",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)switch(r.n){case 0:this._sdpStrategy.setBitrate(e,t,n),this._logger.info(ye.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,max:e,min:t,start:n}));case 1:return r.a(2)}},r,this)}))}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._sdpStrategy.createOffer(e);case 1:return n=t.v,this._logger.info(ye.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({offerSDP:n.sdp,sdpDemantics:n.semantics})),t.a(2,n)}},t,this)}))}},{key:"setRemoteAnswer",value:function(e){return K(this,arguments,void 0,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return p().m(function r(){var i;return p().w(function(r){for(;;)if(0===r.n)return Va.parsePayloadTypes(null===(i=t._rtcPeerConn.localDescription)||void 0===i?void 0:i.sdp),t._firstConnectFromPub=n,r.a(2,t._sdpStrategy.setRemoteAnswer(e))},r)})()})}},{key:"getLocalTrack",value:function(e){return this.pubLocalTracks[e]||null}},{key:"addLocalTrack",value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(dn.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(dn.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(dn.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(dn.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(ye.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,"trackId: ".concat(e.getTrackId()))}},{key:"removeLocalTrackById",value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(ye.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(ye.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:Le.FAILED,msg:"track not found",trackId:e}))}},{key:"removeAllLocalTrack",value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach(function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)})}},{key:"removeLocalTrack",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.getTrackId();delete this.pubLocalTracks[n],this._sdpStrategy.removeLocalTrack(e,t),e.__innerSetPublished(!1),e.off(dn.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(dn.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var r="".concat(n,"_tiny"),i=this.getLocalTrack(r);i&&t&&(this._sdpStrategy.removeLocalTrack(i,t),delete this.pubLocalTracks[r],i.destroy()),this._logger.info(ye.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:n}))}},{key:"_updateRecvTransceiverMap",value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}},{key:"updateSubRemoteTracks",value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}},{key:"getOutboundVideoInfo",value:function(){return this._sdpStrategy.getOutboundVideoInfo()}},{key:"_onLocalTrackMuted",value:function(e,t){var n=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));n&&(n.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(dn.__INNER_EVENT_MUTED_CHANGE__,e,t)}},{key:"_onLocalTrackDestroied",value:function(e){this.emit(dn.__INNER_EVENT_DESTROY__,e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"_createSenderReport",value:function(e){return e.filter(function(e){return e.trackId}).map(function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),Object.assign({},t)})}},{key:"_createReceiverReport",value:function(e){return e.filter(function(e){return e.trackId}).map(function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),Object.assign({},t)})}},{key:"_createRCRTCStateReport",value:function(e){var t=e.timestamp,n=e.iceCandidatePair,r=e.senders,i=e.receivers;for(var o in(null==n?void 0:n.totalPacketsLost)&&(null==n||delete n.totalPacketsLost),n)qn(n[o])&&delete n[o];return{timestamp:t,iceCandidatePair:n,senders:this._createSenderReport(r),receivers:this._createReceiverReport(i)}}},{key:"_getStatsData",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o;return p().w(function(e){for(;;)switch(e.n){case 0:return this._formatStatsData=null,r=null,e.n=1,this._rtcPeerConn.getStats();case 1:return i=e.v,r=null===(t=this.reportParser)||void 0===t?void 0:t.parseRTCStatsReport(i),o=null===(n=this.reportParser)||void 0===n?void 0:n.formatRCRTCStateReport(r),this._formatStatsData=o,e.a(2,o)}},e,this)}))}},{key:"_reportHandle",value:function(){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u,d;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._getStatsData();case 1:if(s=t.v){t.n=2;break}return t.a(2);case 2:c=this._createRCRTCStateReport(s);try{null===(r=null===(n=this._reportListener)||void 0===n?void 0:n.onStateReport)||void 0===r||r.call(n,JSON.parse(JSON.stringify(c)))}catch(e){this._logger.error(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(u=[].concat(v(s.receivers),v(s.senders)).filter(function(e){return"audio"===e.kind}).map(function(e){return{trackId:e.trackId,audioLevel:e.audioLevel}}),this.emit(e.__INNER_AUDIOLEVEL_CHANGE__,u),this._isRoomAudience&&(null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)){d=this._getLiveAudioState();try{d.length&&(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onReportLiveAudioStates)||void 0===a||a.call(o,d))}catch(e){this._logger.error(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}case 3:return t.a(2)}},t,this)}))}},{key:"_getLiveAudioState",value:function(){var e=this,t=[];return this._rtcPeerConn.getReceivers().forEach(function(e){var n=e.getContributingSources();n.length&&t.push.apply(t,v(n))}),t.map(function(t){var n=t.source,r=t.audioLevel,i=e._store.getTrackIdBySSRC(n);if(!i)return{};var o=Pn(i).userId;return{audioLevel:ka(r),userId:o,trackId:i}}).filter(function(e){return!!e.userId})}},{key:"_sendR3R4Data",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o,a,s,c;return p().w(function(e){for(;;)switch(e.n){case 0:if(o=this._formatStatsData){e.n=1;break}return e.a(2);case 1:if(s=(a=o).senders,c=a.receivers,console.log("sendR3R4: senderTrackId: ".concat(null===(t=s[0])||void 0===t?void 0:t.trackId,", receiverTrackId: ").concat(null===(n=c[0])||void 0===n?void 0:n.trackId)),!s.length){e.n=2;break}return e.n=2,null===(r=this._polarisReport)||void 0===r?void 0:r.sendR3Data(o);case 2:if(!c.length){e.n=3;break}return e.n=3,null===(i=this._polarisReport)||void 0===i?void 0:i.sendR4Data(o);case 3:s.length=0,c.length=0,o=null;case 4:return e.a(2)}},e,this)}))}},{key:"__reportR3R4ToPolaris",value:function(){return K(this,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)switch(e.n){case 0:if(!this._isDestroyed){e.n=1;break}return e.a(2);case 1:clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout(function(){return K(t,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)switch(e.n){case 0:if(!this._isDestroyed){e.n=1;break}return e.a(2);case 1:this._sendR3R4Data().then(function(){t.__reportR3R4ToPolaris()});case 2:return e.a(2)}},e,this)}))},2e3);case 2:return e.a(2)}},e,this)}))}},{key:"getRTCPeerConn",value:function(){return this._rtcPeerConn}},{key:"destroy",value:function(){this.clear(),this.clearReTryExchangeTimer(),clearTimeout(this._reportR3R4ToPolarisTimer),this.stopAutoExecute(),this.registerReportListener(null),this._rtcPeerConn.close(),this._isDestroyed=!0,this.reportParser=null,this._logger.info(ye.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:Le.SUCCESSED}))}},{key:"clearReTryExchangeTimer",value:function(){clearTimeout(this._reTryExchangeTimer),this._reTryExchangeTimer=null}},{key:"isDestroyed",value:function(){return this._isDestroyed}}])}();Object.defineProperty(Qa,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(Qa,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(Qa,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(Qa,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),Object.defineProperty(Qa,"__INNER_SEI_CONTENT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-sei-content"});var Za,Xa,$a,es,ts=function(){return a(function e(t,n){i(this,e),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})},[{key:"audioLevelReport",value:function(e){var t=this;if(this._audioLevelChangeHandler){var n=[];e.forEach(function(e){var r=Pn(e.trackId).userId,i=t._store.crtUserId===r?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);i&&n.push({track:i,audioLevel:e.audioLevel||0})}),this._audioLevelChangeHandler(n)}}},{key:"onAudioLevelChange",value:function(e){this._audioLevelChangeHandler=e}}])}();exports.RCRTCLiveRole=void 0,(Za=exports.RCRTCLiveRole||(exports.RCRTCLiveRole={}))[Za.ANCHOR=1]="ANCHOR",Za[Za.AUDIENCE=2]="AUDIENCE",function(e){e.UNPUBLISH_PREV="UnpublishPrevCommand",e.PULL_RTCROOM_STATUS="PullRTCRoomStatusCommand",e.JOINROOM="JoinRoomCommand",e.PARSE_REMOTERES="ParseRemoteResCommand",e.PARSE_USERSTATE="ParseUserStateCommand",e.LOCAL_TRACK_MUTE="LocalTrackMuteCommand",e.PUBLISH="PublishCommand",e.RETRY_EXCHANGE="RetryExchangeCommand",e.UNPUBLISH="UnpublishCommand",e.SUBSCRIBE="SubscribeCommand",e.UNSUBSCRIBE="UnsubscribeCommand",e.UPDATE_SUBSCRIBE_LIST="UpdateSubscribeListCommand",e.ON_SIGNAL_RECONNECTED="OnSignalReconnectedCommand",e.LEAVE_OTHER_ROOM="LeaveOtherRoomCommand",e.RTC_IDENTITY_CHANGE="RTCIdentityChangeCommand",e.ENABLE_INNER_CDN="EnableInnerCDNCommand",e.EXCHANGE_WITH_PUSH_OTHER_ROOM="ExchangeWithPushOtherRoomCommand",e.MCUCONFIG_FLUSH="MCUConfigFlushCommand",e.UNKNOWN="Unknown"}(Xa||(Xa={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}($a||($a={})),function(e){e[e.Destroy=40400]="Destroy"}(es||(es={}));var ns,rs=function(){return a(function e(){i(this,e)},[{key:"priority",get:function(){return $a.LOW}},{key:"kind",get:function(){return Xa.UNKNOWN}}])}(),is=function(){return a(function e(t,n,r,o){i(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_busy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1})},[{key:"_next",value:function(){this._busy=!1,this._execute()}},{key:"_execute",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o,a,s;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this._isDestroyed&&!this._busy&&0!==this._queue.length){e.n=1;break}return e.a(2);case 1:return this._busy=!0,t=this._queue.shift(),n=t.command,r=t.resolve,o=this._logger.createTraceId(),e.p=2,this._logger.info(ye.L_INVOKER_EXECUTE_T,"kind: ".concat(n.kind,", length: ").concat(this._queue.length),o),e.n=3,n.execute(this._context,this._store,this);case 3:i=e.v,e.n=5;break;case 4:return e.p=4,s=e.v,console.error(s),this._logger.error(ye.L_INVOKER_EXECUTE_R,n.kind,o),this._next(),e.a(2);case 5:(a=i.code)!==exports.RCRTCCode.SUCCESS&&a!==ke?this._logger.warn(ye.L_INVOKER_EXECUTE_R,"code: ".concat(a,", kind: ").concat(n.kind),o):this._logger.info(ye.L_INVOKER_EXECUTE_R,"kind: ".concat(n.kind,", Done"),o),r(i),this._next();case 6:return e.a(2)}},e,this,[[2,4]])}))}},{key:"push",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n=this;return p().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){if(n._logger.info(ye.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:n._isDestroyed,kind:e.kind,length:n._queue.length})),n._isDestroyed)t({code:exports.RCRTCCode.NOT_IN_ROOM});else{var r=e.priority;if(r===$a.LOW)n._queue.push({command:e,resolve:t});else{var i=n._queue.findIndex(function(e){return e.command.priority<r}),o=-1===i?n._queue.length-1:i;n._queue.splice(o,0,{command:e,resolve:t})}setTimeout(function(){n._execute()},0)}}))},t)}))}},{key:"isDestroyed",value:function(){return this._isDestroyed}},{key:"destroy",value:function(){var e=this;this._isDestroyed||(this._logger.info(ye.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach(function(t){t.resolve({code:e.abortCode})}),this._queue.length=0)}}])}(),os=function(){function e(t,n){return i(this,e),r(this,e,[t.logger,t,n,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED])}return _(e,is),a(e,[{key:"store",get:function(){return this._context.store}},{key:"destroy",value:function(){C(e,"destroy",this,3)([]),this._store.removeRemoteTracks()}}])}();!function(e){e.VOID="0",e.OPEN="2",e.CLOSE="1"}(ns||(ns={}));var as=function(){return a(function e(t,n,r,o,a,s,c,u){i(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_roomResources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_collectSubscribeList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_CDNEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_trackIdSSRCMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_roomStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_supportNtf",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_asrStatus",{enumerable:!0,configurable:!0,writable:!0,value:ns.VOID}),Object.defineProperty(this,"_asrEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isStartRealTranslate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_translationLang",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_summarizationStatusData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_nickName",{enumerable:!0,configurable:!0,writable:!0,value:""})},[{key:"getResourcesByUserId",value:function(e){return this._roomResources[e]||this._asrSeiUris[e]}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getRemoteTracks",value:function(){return this._remoteTracks}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getAllUserIds",value:function(){return Object.keys(this._roomResources)}},{key:"getRemoteUserIds",value:function(){var e=this;return this.getAllUserIds().filter(function(t){return t!==e.crtUserId})}},{key:"getSubscribedList",value:function(){return this._subscribedList}},{key:"getCollectSubscribeList",value:function(){return this._collectSubscribeList}},{key:"getPublishedResourceByTrackId",value:function(e){var t=Pn(e),n=t.tag,r=t.userId;return n===ha?this._asrSeiUris[r][0]:this._roomResources[r].find(function(t){return Nn(t)===e})}},{key:"getToken",value:function(){return this._token}},{key:"getCDNEnable",value:function(){return this._CDNEnable}},{key:"getCDNUris",value:function(){return this._CDNUris}},{key:"getRoomStatusVersion",value:function(){return this._roomStatusVersion}},{key:"getTrackIdBySSRC",value:function(e){return this._trackIdSSRCMap.get(e)}},{key:"getRTCRequestHeader",value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}},{key:"getSupportNtf",value:function(){return this._supportNtf}},{key:"getASRIsAvailable",value:function(){return!!this.getASRSeiUris().length}},{key:"getASRStatus",value:function(){return this._asrStatus}},{key:"getASREnable",value:function(){return this._asrEnable}},{key:"getSrcLanguage",value:function(){return this._srcLanguage}},{key:"getASRSeiUris",value:function(){var e=Object.values(this._asrSeiUris);return e.length?e[0]:[]}},{key:"getIsStartRealTranslate",value:function(){return this._isStartRealTranslate}},{key:"getTranslationLang",value:function(){return this._translationLang}},{key:"getSummarizationStatusData",value:function(){return this._summarizationStatusData||null}},{key:"getNickName",value:function(){return this._nickName}}])}(),ss=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,as),a(e,[{key:"_updateTrackIdSSRCMap",value:function(){var e=this;Object.values(this._roomResources).forEach(function(t){t.forEach(function(t){var n=JSON.parse(t.uri),r=n.ssrc,i=n.resourceId;e._trackIdSSRCMap.set(r,i)})})}},{key:"setTrackIdSSRCMap",value:function(e,t){this._trackIdSSRCMap.set(e,t)}},{key:"_initRemoteTracks",value:function(){var e=this;for(var t in this._roomResources){var n=this._roomResources[t];t!==this.crtUserId&&0!==n.length&&n.forEach(function(t){var n=Nn(t),r=Pn(n),i=r.tag,o=r.userId,a=r.mediaType===exports.RCMediaType.AUDIO_ONLY?new In(e._logger,i,o):new Sn(e._logger,i,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[n]=a})}}},{key:"initWithRoomData",value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=Xn(e.version),this._roomResources=Yn(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(ye.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}},{key:"assignRoomData",value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}},{key:"setResourcesByUserId",value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}},{key:"removeRemoteTrack",value:function(e){delete this._remoteTracks[e]}},{key:"removeResourcesByUserId",value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}},{key:"addRemoteTrack",value:function(e){this._remoteTracks[e.getTrackId()]=e}},{key:"removeRemoteTracks",value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach(function(e){e.isAudioTrack()&&e.__releaseMediaElement()}),this._remoteTracks={})}},{key:"setCDNEnabel",value:function(e){this._CDNEnable=e}},{key:"setCDNUris",value:function(e){this._CDNUris=e}},{key:"resetSubscribedList",value:function(e){var t;(t=this._subscribedList).splice.apply(t,[0,this._subscribedList.length].concat(v(e))),this.resetCollectSubscribeList(e)}},{key:"resetCollectSubscribeList",value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,[0,this._collectSubscribeList.length].concat(v(e)))}},{key:"setRoomStatusVersion",value:function(e){this._roomStatusVersion=Xn(e)}},{key:"setASRStatus",value:function(e){this._asrStatus=e}},{key:"setASREnable",value:function(e){this._asrEnable=e}},{key:"setSrcLanguage",value:function(e){this._srcLanguage=e}},{key:"setASRSeiUris",value:function(e){if(e.length){var t=e[0].msid.split("_")[0];this._asrSeiUris[t]=e}else this._asrSeiUris={}}},{key:"addSeiRemoteTrack",value:function(e){var t=e[0].msid.split("_"),n=t.pop(),r=t[0],i=new Sn(this._logger,n,r);this.addRemoteTrack(i)}},{key:"removeSeiRemoteTrack",value:function(){if(this.getASRSeiUris().length){var e=this.getASRSeiUris()[0],t=e.msid,n=e.mediaType,r="".concat(t,"_").concat(n);this.removeRemoteTrack(r)}}},{key:"setIsStartRealTranslate",value:function(e){this._isStartRealTranslate=e}},{key:"setTranslationLang",value:function(e){this._translationLang=e}},{key:"setSummarizationStatusData",value:function(e){this._summarizationStatusData=e}},{key:"setNickName",value:function(e){this._nickName=e}}])}(),cs=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.UNPUBLISH_PREV}},{key:"execute",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c;return p().w(function(n){for(;;)switch(n.n){case 0:return r=e.logger,i=e.context,o=t.getResourcesByUserId(t.crtUserId),a=o.slice(),o.length=0,s=r.createTraceId(),r.info(ye.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:a}),s),n.n=1,i.setRTCTotalRes(t.roomId,[On(Hn.UNPUBLISH,a)],bn([]),Hn.TOTAL_CONTENT_RESOURCE,bn([]));case 1:return(c=n.v)!==ke?r.error(ye.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:Le.FAILED,code:c}),s):r.info(ye.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:Le.SUCCESSED}),s),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n)}))}}])}();exports.RTCMode=void 0,function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL"}(exports.RTCMode||(exports.RTCMode={}));var us,ds=function(){function e(t,n,o,a,s,c,u,d,_){var l;return i(this,e),l=r(this,e),Object.defineProperty(l,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(l,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(l,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(l,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(l,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(l,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(l,"srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(l,"nickName",{enumerable:!0,configurable:!0,writable:!0,value:_}),l}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.JOINROOM}},{key:"_getResultTag",value:function(){var e=ye.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===exports.RTCMode.LIVE&&(e=ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}},{key:"_validateParams",value:function(e,t,n){var r=this;if(e.getConnectionStatus()!==Se.CONNECTED)return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(Wn(e.getNaviInfo()))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),this.traceId),{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR};if(!j("roomId",this.roomId,k,!0))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!j("roomType",this.roomType,function(e){return void 0!==exports.RTCMode[e]}))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!j("outerUserDatas",this.outerUserDatas,A,!1))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every(function(e){return j("outerUserDatas.".concat(e),r.outerUserDatas[e],O,!0)}))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.nickName&&(!j("nickName",this.nickName,O,!0)||this.nickName.length>64))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> nickName"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.srcLanguage&&(!j("srcLanguage",this.srcLanguage,O,!0)||this.srcLanguage.length>50))return t.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> srcLanguage"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b,y;return p().w(function(r){for(;;)switch(r.n){case 0:if(c=Date.now(),u=e.context,d=e.service,_=e.logger,l=e.reportMediaActionLogger,f=this._getResultTag(),h=this._validateParams(u,_,f),(R=h.code)===exports.RCRTCCode.SUCCESS){r.n=1;break}return r.a(2,{code:R});case 1:if(d.getMsList().length){r.n=2;break}return _.error(f,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),r.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 2:return g=t.getSupportNtf(),r.n=3,u.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,g);case 3:if(m=r.v,C=m.code,v=m.data,l.reportQualityJoinRoomData(c,C,this.roomType,null==v?void 0:v.sessionId),C===ke&&v){r.n=4;break}return T=40032===C?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:C,_.error(f,JSON.stringify({status:Le.FAILED,code:T,msg:"joinRoom failed"}),this.traceId),r.a(2,{code:T});case 4:return t.initWithRoomData(v,this.traceId),this.nickName&&t.setNickName(this.nickName),this.srcLanguage&&t.setSrcLanguage(this.srcLanguage),t.getResourcesByUserId(t.crtUserId).length>0&&n.push(new cs),(I=null===(i=v.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value)&&t.setCDNUris(JSON.parse(I)[0]),(S=null===(o=v.roomInfo.filter(function(e){return"asr_status"===e.key})[0])||void 0===o?void 0:o.value)&&t.setASRStatus(S),(E=null===(a=v.roomInfo.filter(function(e){return"sei_ai_uris"===e.key})[0])||void 0===a?void 0:a.value)&&(O=JSON.parse(E)).length&&(t.setASRSeiUris(O),t.addSeiRemoteTrack(O)),(b=null===(s=v.roomInfo.filter(function(e){return"summarization"===e.key})[0])||void 0===s?void 0:s.value)&&(y=JSON.parse(b),t.setSummarizationStatusData(y)),_.info(f,JSON.stringify({status:Le.SUCCESSED,userId:t.crtUserId,roomId:this.roomId,sessionId:v.sessionId}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS,data:v})}},r,this)}))}}])}();!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(us||(us={}));var _s,ls,ps,fs="PEER_CONNECTION_CLOSED_BY_EXCEPTION",hs="USER_JOIN",Rs="USER_LEAVE",gs="TRACKS_PUBLISH",ms="TRACKS_UNPUBLISH",Cs="AUDIO_MUTE_CHANGE",vs="VIDEO_MUTE_CHANGE",Ts="CDN_ENABLE_CHANGE",Is="USER_STATE_CHANGE",Ss="ASR_SEI_PUBLISH",Es="ASR_SEI_UNPUBLISH",Os="SUMMARIZATION_START",bs="SUMMARIZATION_STOP",ys=function(){function e(t,n,o,a,s,c,u,d){var _;return i(this,e),_=r(this,e),Object.defineProperty(_,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"service",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"context",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"peer",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(_,"store",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(_,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(_,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(_,"getPushOtherRooms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),_}return _(e,F),a(e)}();!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(_s||(_s={})),function(e){e.BEGIN="begin",e.END="end"}(ls||(ls={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(ps||(ps={}));var Ls,ks=function(){function e(t,n,o){var a;return i(this,e),a=r(this,e),Object.defineProperty(a,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return _(e,rs),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f;return p().w(function(n){for(;;)switch(n.n){case 0:return i=e.service,o=e.context,n.n=1,i.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas);case 1:return a=n.v,s=a.code,c=a.data,u=a.qualityMsList,d={code:s,data:{data:c,qualityMsList:u}},_=null===(r=null==c?void 0:c.urls)||void 0===r?void 0:r.pull_url,t.roomMode===exports.RTCMode.LIVE&&_&&(l=JSON.parse(_),t.setCDNUris(l),(null==l?void 0:l.broadcast)===ps.SPREAD&&(t.setCDNEnabel(!0),f=Object.assign(Object.assign({},l),{enableInnerCDN:!0}),ws(o,t.roomId,f))),n.a(2,d)}},n,this)}))}}])}();!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(Ls||(Ls={}));var As=function(){function e(t,n,o){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ls.SUB,c=arguments.length>4?arguments[4]:void 0;return i(this,e),a=r(this,e),Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(a,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(a,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(a,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),a}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.UPDATE_SUBSCRIBE_LIST}},{key:"_dealSubscribeResult",value:function(e,t,n,r){var i=null==r?void 0:r.map(function(e){return"".concat(e.msid,"_").concat(e.mediaType)}),o=n.filter(function(e){return null==i?void 0:i.includes(e.track.getTrackId())}),a=n.filter(function(e){return!(null==i?void 0:i.includes(e.track.getTrackId()))});t.info(ye.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,subSuccessTrackIds:i,failedList:a}),this.traceId);var s=e.getRemoteTracks(),c=function(e){var t=o.some(function(t){return t.track.getTrackId()===e});s[e].__innerSetSubscribed(t);var n=o.some(function(t){return t.track.getTrackId()===e&&t.subTiny});s[e].isVideoTrack()&&s[e].__innerSetIsTinyTrack(n)};for(var u in s)c(u);return e.resetSubscribedList(o),a}},{key:"_getParams",value:function(e,t,n){var r=this,i=n.map(function(e){return e instanceof Tn?{track:e}:Object.assign({},e)}),o={};return i=i.filter(function(n){var i=n.track.getTrackId();return e.getRemoteTrack(i)?!o[i]&&(o[i]=!0,!0):(t.warn(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(i),r.traceId),!1)}).map(function(e){return Object.assign({},e)})}},{key:"_validateParams",value:function(e,t){return j("tracks",t,function(){return L(t)&&t.every(function(e){return e instanceof Tn||e.track instanceof Tn})},!0)?{code:exports.RCRTCCode.SUCCESS}:(e.warn(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}},{key:"_reportPubOrSubQualityData",value:function(e,t,n){(null==n?void 0:n.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,n,t,this._trackMediaMap)}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b,y=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,a=e.reportMediaActionLogger,s=e.context,this._actionStartTime=Date.now(),c=this.tracks,u=this.forceReq,d=t.roomId,i.info(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(d,", forceReq: ").concat(u,", trackIds: ").concat(c.map(Zn)),this.traceId),_=this._validateParams(i,c),(l=_.code)===exports.RCRTCCode.SUCCESS){r.n=1;break}return r.a(2,{code:l});case 1:if(f=this._getParams(t,i,c),h=t.getSubscribedList().map(function(e){return Object.assign({},e)}),u){r.n=3;break}if(zs(f,h)){r.n=2;break}return i.warn(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:h.length&&(R=h.map(function(e){return e.track}),i.warn(ye.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:R.map(function(e){return e.getTrackId()})}),this.traceId),g=t.getSubscribedList().filter(function(e){return R.every(function(t){return t.getTrackId()!==e.track.getTrackId()})}),t.resetSubscribedList(g));case 3:return o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),o.updateSubRemoteTracks(f.map(function(e){return e.track})),r.n=4,Ds(f,!1,o,t,s);case 4:return(m=r.v).pushOtherRooms=e.getPushOtherRooms(),r.n=5,new ks(m,this.traceId,!0).execute(e,t,n);case 5:if(C=r.v,c.forEach(function(e){var t=e instanceof Tn?e.getTrackId():e.track.getTrackId();y._trackMediaMap[t]=C.data.qualityMsList||[]}),v=this.fromCommand===Ls.SUB?c:this.unsubTracks,C.code===exports.RCRTCCode.SUCCESS){r.n=6;break}return this._reportPubOrSubQualityData(a,C.code,v),i.error(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:C.code}),this.traceId),r.a(2,{code:C.code});case 6:if(T=C.data.data,I=T.sdp,S=T.resultCode,E=T.subscribedList,S===exports.RCRTCCode.SUCCESS){r.n=7;break}return this._reportPubOrSubQualityData(a,S,v),i.error(ye.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:S}),this.traceId),r.a(2,{code:S});case 7:return a.setPubOrSubSuccessTime(Date.now()),r.n=8,o.setRemoteAnswer(I.sdp);case 8:if(O=r.v,this._reportPubOrSubQualityData(a,O,v),O===exports.RCRTCCode.SUCCESS){r.n=9;break}return r.a(2,{code:O});case 9:return b=this._dealSubscribeResult(t,i,f,E),r.a(2,b.length?{code:exports.RCRTCCode.SUCCESS,data:b}:{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Ns=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.UNSUBSCRIBE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.polarisReport,a=this.tracks,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof Tn})},!0)){r.n=1;break}return i.warn(ye.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return i.info(ye.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:a.map(Zn)}),this.traceId),s=t.getSubscribedList().map(function(e){return Object.assign({},e)}).filter(function(e){return a.every(function(t){return t.getTrackId()!==e.track.getTrackId()})}),o.sendR2(_s.SUBSCRIBE,ls.END,a.map(function(e){return e.getTrackId()})),r.a(2,new As(s,!1,this.traceId,Ls.UNSUB,this.tracks).execute(e,t,n))}},r,this)}))}}])}(),Ps=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,rs),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(ye.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),r.n=1,new Ns(o,a).execute(e,t,n);case 1:return o.forEach(function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())}),e.emit(ms,o),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}();function Ds(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s,c,u,d,_,l;return p().w(function(o){for(;;)switch(o.n){case 0:return s=(null===(a=i.getNaviInfo())||void 0===a?void 0:a.ipType)||0,o.n=1,n.createOffer(t);case 1:return c=o.v,u=r.getSrcLanguage(),d=r.getNickName(),_={resolutionInfo:n.getOutboundVideoInfo()},u&&Object.assign(_,{srcLanguage:u}),d&&Object.assign(_,{nickName:d}),l={asr_status:r.getASRStatus(),ipType:s,sdp:c,extend:JSON.stringify(_),subscribeList:e.filter(function(e){var t=e.track.getTrackId(),n=Pn(t).userId,i=r.getResourcesByUserId(n);if(!i)return!1;var o=i.filter(function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)}).length;return o}).map(function(e){return{simulcast:e.subTiny?Sa.TINY:Sa.NORMAL,resolution:"",uri:r.getPublishedResourceByTrackId(e.track.getTrackId()).uri}}),switchstream:!1},o.a(2,l)}},o)}))}function Us(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger.createTraceId(),e.logger.info(ye.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:n}),i),r.n=1,e.setRTCCDNUris(t,Hn.TOTAL_CONTENT_RESOURCE,JSON.stringify([n]));case 1:if((o=r.v)===ke){r.n=2;break}return e.logger.error(ye.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(Le.FAILED,", code: ").concat(o),i),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e.logger.info(ye.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(Le.SUCCESSED),i),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r)}))}function ws(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger.createTraceId(),e.logger.info(ye.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(n),i),r.n=1,e.setRTCData(t,"cdn_uris",JSON.stringify([n]),!0,us.ROOM);case 1:if((o=r.v)===ke){r.n=2;break}return e.logger.error(ye.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(Le.FAILED,", code: ").concat(o),i),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e.logger.info(ye.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(Le.SUCCESSED),i),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r)}))}function Ms(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a;return p().w(function(n){for(;;)switch(n.n){case 0:return r=t.roomId,i=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),n.n=1,Promise.all([Us(e,r,i),ws(e,r,i)]);case 1:return o=n.v,a=o.every(function(e){return e.code===exports.RCRTCCode.SUCCESS}),n.a(2,a?{code:exports.RCRTCCode.SUCCESS}:{code:exports.RCRTCCode.SIGNAL_ERROR})}},n)}))}var xs=function(e,t,n,r){return K(void 0,void 0,void 0,p().m(function i(){var o,a,s,c,u,d;return p().w(function(i){for(;;)switch(i.n){case 0:o=e.crtUserId,u=h(r);case 1:if((d=u()).done){i.n=4;break}if((a=d.value)!==o){i.n=2;break}return i.a(3,1);case 2:if(!(s=r[a]).length){i.n=3;break}return c=s.map(function(t){return e.getRemoteTrack(Nn(t))}),i.n=3,new Ps(c).execute(t,e,n);case 3:i.n=1;break;case 4:return i.a(2)}},i)}))},Bs=function(e,t,n){var r=t.logger;Object.keys(n).forEach(function(i){var o=n[i];if(0!==o.length){var a=o.map(function(t){var n=Nn(t),i=Pn(n),o=i.userId,a=i.tag,s=i.mediaType===exports.RCMediaType.AUDIO_ONLY?new In(r,a,o):new Sn(r,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s});a.length&&t.emit(gs,a)}})},Vs=function(e,t,n){Object.keys(n).forEach(function(r){n[r].forEach(function(n){var r=Nn(n),i=e.getRemoteTrack(r);i.__innerSetRemoteMuted(0===n.state),i.isAudioTrack()?t.emit(Cs,i):t.emit(vs,i)})})};function js(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b;return p().w(function(a){for(;;)switch(a.n){case 0:s=n.logger,c=t.roomId,u=t.roomMode,d=[],_={},l={},f={},h=Yn(e,c,s,o),R=Object.keys(h),g=t.getAllUserIds(),m=R.length-1;case 1:if(!(m>=0)){a.n=4;break}if(C=R[m],-1!==(v=g.indexOf(C))){a.n=2;break}return d.push(C),_[C]=Un(h[C]),a.a(3,3);case 2:T=t.getResourcesByUserId(C),I=h[C],S=wn(T,I,!0),E=S.publishedList,O=S.modifiedList,b=S.unpublishedList,_[C]=Un(E),l[C]=Un(b),f[C]=Un(O),g.splice(v,1);case 3:m-=1,a.n=1;break;case 4:if(g.length&&g.forEach(function(e){t.removeResourcesByUserId(e)}),t.assignRoomData(h),!g.length){a.n=6;break}return a.n=5,Gs(g,n,t,r,o);case 5:n.emit(Rs,g);case 6:return d.length&&n.emit(hs,d),a.n=7,xs(t,n,r,l);case 7:Bs(t,n,_),Vs(t,n,f),u===J.LIVE&&Fs(n,t,s,i);case 8:return a.a(2)}},a)}))}function Fs(e,t,n,r){var i;if(r){var o=JSON.parse(r),a=(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN)!==o.enableInnerCDN;t.setCDNUris(o),a&&e.emit(Ts,o.enableInnerCDN)}else n.warn(ye.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,code:"",msg:"cdn_uris not found"}))}function Gs(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s;return p().w(function(o){for(;;)switch(o.n){case 0:if(a=[],s=[],e.forEach(function(e){a.push.apply(a,v(n.getRemoteTracksByUserId(e))),s.push(e)}),!a.length){o.n=2;break}return o.n=1,new Ns(a,i).execute(t,n,r);case 1:a.forEach(function(e){return n.removeRemoteTrack(e.getTrackId())});case 2:s.length&&s.forEach(function(e){return n.removeResourcesByUserId(e)});case 3:return o.a(2)}},o)}))}function Js(e){var t,n=e.userId,r=e.userData,i=e.event,o=e.switchRoleType;return{users:[{userId:n,extra:null===(t=r.filter(function(e){return"extra"===e.key})[0])||void 0===t?void 0:t.value,state:i,switchRoleType:o}]}}function Hs(e){var t,n,r=e.userId,i=e.userData,o=function(e){return e.some(function(e){return"uris"===e.key||"cdn_uris"===e.key})}(i);if(o){var a=null===(t=i.filter(function(e){return"uris"===e.key})[0])||void 0===t?void 0:t.value,s=null===(n=i.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===n?void 0:n.value;return{userId:r,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}function Ks(e){var t={users:{}},n="";return e.forEach(function(e){var r,i,o=e.userId,a=e.userData;t.users[o]={};var s=null===(r=a.filter(function(e){return"uris"===e.key})[0])||void 0===r?void 0:r.value,c=null===(i=a.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value;n=c||n,t.users[o]={uris:s}}),{urisData:t,CDNUris:n&&JSON.stringify(JSON.parse(n)[0])}}var qs,Ws=function(e,t,n){var r=e.split("\r\nm"),i=n===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.filter(function(e){return e.includes("=".concat(i))&&e.includes(t)})[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},zs=function(e,t){var n=!1;return e.forEach(function(e){var r=t.findIndex(function(t){return t.track.getTrackId()===e.track.getTrackId()});-1!==r?t.splice(r,1)[0].subTiny!==e.subTiny&&(n=!0):n=!0}),t.length&&(n=!0),n},Ys=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.PARSE_USERSTATE}},{key:"priority",get:function(){return $a.NORMAL}},{key:"_isPKRoomUser",value:function(e,t){var n,r=s(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.extra&&i.extra.roomId!==e.roomId)return!0;if(1===Number(i.state)&&!e.getRemoteUserIds().includes(i.userId))return!0}}catch(e){r.e(e)}finally{r.f()}return!1}},{key:"_dealAddUser",value:function(e,t,n,r,i){var o=e.getResourcesByUserId(i);o||(r?n.upgrade.push(i):n.joined.push(i),t.info(ye.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(r?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(i,o||[])}},{key:"_dealReduceUser",value:function(e,t,n,r,i){e.info(ye.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(r?"downgrade":"left")}),this.traceId),r?t.downgrade.push(i):1!==Number(n)?t.offline.push(i):t.left.push(i)}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o={joined:[],left:[],offline:[],upgrade:[],downgrade:[]},0!==(a=this.msgContent.users).length){r.n=1;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS,data:o});case 1:if(!this._isPKRoomUser(t,a)){r.n=2;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS,data:o});case 2:if(a.forEach(function(e){var n=e.userId;0===Number(e.state)?c._dealAddUser(t,i,o,e.switchRoleType,n):c._dealReduceUser(i,o,e.state,e.switchRoleType,n)}),!(s=[].concat(v(o.left),v(o.downgrade),v(o.offline))).length){r.n=3;break}return r.n=3,Gs(s,e,t,n,this.traceId);case 3:return r.a(2,{code:exports.RCRTCCode.SUCCESS,data:o})}},r,this)}))}}])}(),Qs=function(){function e(t,n,o,a,s){var c;return i(this,e),c=r(this,e),Object.defineProperty(c,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(c,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),c}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.PARSE_REMOTERES}},{key:"priority",get:function(){return $a.NORMAL}},{key:"_dealPublishList",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.reportMediaActionLogger,a=this._nowResources.map(Nn),s=[],c=[],this._publishedList.forEach(function(e){var n=Nn(e),r=a.indexOf(n),o=Pn(n),u=o.userId,d=o.tag,_=o.mediaType;r>-1?l._nowResources[r]=e:l._nowResources.push(e);var p=t.getRemoteTrack(n);p?p.isSubscribed()&&s.push(p):(p=_===exports.RCMediaType.AUDIO_ONLY?new In(i,d,u):new Sn(i,d,u),t.addRemoteTrack(p),c.push(p)),p.__innerSetRemoteMuted(0===e.state)}),!s.length){r.n=2;break}return u=s.map(function(e){return e.getTrackId()}),r.n=1,new As(s,!0,this.traceId).execute(e,t,n);case 1:d=r.v,(_=d.code)!==exports.RCRTCCode.SUCCESS&&i.error(ye.L_RESUB_REPUB_RES_R,JSON.stringify({status:Le.FAILED,trackIds:u,code:_}),this.traceId);case 2:c.length&&e.emit(gs,c),o.reportQualityRecvPubMsgData(this.sentTime,this.senderId);case 3:return r.a(2)}},r,this)}))}},{key:"_dealUnpublishList",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:for(i=this._unpublishedList.map(Nn),o=this._nowResources.length-1;o>=0;o-=1)a=this._nowResources[o],i.includes(Nn(a))&&this._nowResources.splice(o,1);return s=this._unpublishedList.map(function(e){var n=Nn(e);return t.getRemoteTrack(n)}),r.n=1,new Ps(s).execute(e,t,n);case 1:return r.a(2)}},r,this)}))}},{key:"_dealModifiedList",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,c,u,d;return p().w(function(n){for(;;)switch(n.n){case 0:r=this._nowResources.map(Nn),i=s(this._modifiedList);try{for(i.s();!(o=i.n()).done;)a=o.value,c=Nn(a),u=r.indexOf(c),this._nowResources[u].state=a.state,(d=t.getRemoteTrack(c)).__innerSetRemoteMuted(0===a.state),d.isAudioTrack()?e.emit(Cs,d):e.emit(vs,d)}catch(e){i.e(e)}finally{i.f()}case 1:return n.a(2)}},n,this)}))}},{key:"_updateCDNUris",value:function(e,t){var n,r,i=this.msgContent.cdn_uris[0],o=(null===(n=t.getCDNUris())||void 0===n?void 0:n.enableInnerCDN)!==i.enableInnerCDN;t.setCDNUris(i),o&&e.emit(Ts,!!(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h;return p().w(function(r){for(;;)switch(r.n){case 0:if(d=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],l=this.senderId,f=this.messageType,t.getRemoteUserIds().includes(l)){r.n=1;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:this._nowResources=t.getResourcesByUserId(l)||[],h=f,r.n=h===Hn.MODIFY?2:h===Hn.PUBLISH?3:h===Hn.UNPUBLISH?4:h===Hn.TOTAL_CONTENT_RESOURCE?5:6;break;case 2:return(i=this._modifiedList).push.apply(i,v(d)),r.a(3,6);case 3:return(o=this._publishedList).push.apply(o,v(d)),r.a(3,6);case 4:return(a=this._unpublishedList).push.apply(a,v(d)),r.a(3,6);case 5:return _=wn(this._nowResources,d),(s=this._publishedList).push.apply(s,v(_.publishedList)),(c=this._unpublishedList).push.apply(c,v(_.unpublishedList)),(u=this._modifiedList).push.apply(u,v(_.modifiedList)),r.a(3,6);case 6:if(!this._publishedList.length){r.n=7;break}return r.n=7,this._dealPublishList(e,t,n);case 7:if(!this._unpublishedList.length){r.n=8;break}return r.n=8,this._dealUnpublishList(e,t,n);case 8:if(!this._modifiedList.length){r.n=9;break}return r.n=9,this._dealModifiedList(e,t);case 9:if(t.setResourcesByUserId(l,this._nowResources),t.roomMode===exports.RTCMode.LIVE){r.n=10;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS});case 10:if(this.msgContent.cdn_uris){r.n=11;break}return r.a(2,{code:exports.RCRTCCode.SUCCESS});case 11:return this._updateCDNUris(e,t),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Zs=function(){function e(t,n,o){var a;return i(this,e),a=r(this,e),Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.SUBSCRIBE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.polarisReport,a=this.tracks,s=this.forceReq,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof Tn||e.track instanceof Tn})},!0)){r.n=1;break}return i.error(ye.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(i.info(ye.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:a.map(Zn),forceReq:s}),this.traceId),c=t.getSubscribedList().map(function(e){return Object.assign({},e)}),u=a.map(function(e){return e instanceof Tn?{track:e}:e}),d=!1,_=[],u.forEach(function(e){var t=e.track.getTrackId();_.push(t);var n=c.find(function(e){return e.track.getTrackId()===t});n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:c.push(e),d=!0)}),d||s){r.n=2;break}return i.warn(ye.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,msg:"repeat subscribe"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return o.sendR2(_s.SUBSCRIBE,ls.BEGIN,_),r.a(2,new As(c,!0,this.traceId).execute(e,t,n))}},r,this)}))}}])}(),Xs=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(n,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),n}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.PUBLISH}},{key:"_removePubFailedTracks",value:function(e,t){e.forEach(function(e){var n=e instanceof dn?e:e.track;t.removeLocalTrackById(n.getTrackId())})}},{key:"_addLocalTracks",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,c,u,d,_,l,f,h,R,g,m,C,v,T;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:r=[],i=s(e),n.p=1,i.s();case 2:if((o=i.n()).done){n.n=9;break}if(a=o.value,u=(c=a instanceof dn?{pubTiny:!1,track:a}:a).track,d=c.pubTiny,!u.isVideoTrack()){n.n=7;break}if(!d){n.n=7;break}return _=void 0,n.p=3,_=u.__innerGetMediaStreamTrack().clone(),l=d.frameRate||exports.RCFrameRate.FPS_15,f=d.resolution||exports.RCResolution.W176_H144,h=xn(f),R=h.width,g=h.height,m=jn(l),n.n=4,_.applyConstraints({width:R,height:g,frameRate:m});case 4:n.n=6;break;case 5:return n.p=5,v=n.v,null==_||_.stop(),this._logger.warn(ye.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(u.getTrackId(),", msg: ").concat(v.message),this._traceId),n.a(3,9);case 6:C=new ln(this._logger,u.getTag(),u.getUserId(),_,!0),r.push(C),t.addLocalTrack(C),n.n=7;break;case 7:t.addLocalTrack(u);case 8:n.n=2;break;case 9:n.n=11;break;case 10:n.p=10,T=n.v,i.e(T);case 11:return n.p=11,i.f(),n.f(11);case 12:return n.a(2,r)}},n,this,[[3,5],[1,10,11,12]])}))}},{key:"__publish",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g,m,C=this;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=e.peer,a=e.reportMediaActionLogger,s=e.context,t.roomId,c=[],n.forEach(function(e){var t=(e instanceof dn?{track:e}:e).track;c.push(t)}),n.sort(function(e,t){return(e instanceof dn?{track:e}:e).track.getBitrate().max-(t instanceof dn?{track:t}:t).track.getBitrate().max}),!(o.getLocalTracks().length+zn(n,o)>10)){i.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:n.map(Zn),msg:"publish track limit exceeded"}),this._traceId),i.a(2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:c});case 1:return i.n=2,this._addLocalTracks(n,o);case 2:return u=i.v,o.clearReTryExchangeTimer(),d=t.getSubscribedList(),i.n=3,Ds(d,!1,o,t,s);case 3:return(_=i.v).pushOtherRooms=e.getPushOtherRooms(),i.n=4,new ks(_,this._traceId,!0).execute(e,t,r);case 4:if(l=i.v,c.forEach(function(e){var t=e.getTrackId();C._trackMediaMap[t]=l.data.qualityMsList||[]}),l.code===exports.RCRTCCode.SUCCESS){i.n=5;break}return a.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,c,l.code,this._trackMediaMap),this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,tracks:n.map(Zn),code:l.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(n,o),i.a(2,{code:l.code,tracks:c});case 5:if(f=l.data.data,h=f.sdp,R=f.resultCode,g=f.message,R===exports.RCRTCCode.SUCCESS){i.n=6;break}return a.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,c,R,this._trackMediaMap),this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,trackIds:n.map(Zn),code:R,msg:"exchange inner failed: ".concat(g)}),this._traceId),this._removePubFailedTracks(n,o),i.a(2,{code:R,tracks:c});case 6:return a.setPubOrSubSuccessTime(Date.now()),i.n=7,o.setRemoteAnswer(h.sdp,!0);case 7:if((m=i.v)===exports.RCRTCCode.SUCCESS){i.n=8;break}return a.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,c,m,this._trackMediaMap),this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,trackIds:n.map(Zn),code:m,msg:"set remote answer error"}),this._traceId),i.a(2,{code:m,tracks:c});case 8:return u.length&&this._updateTinyTrackIdSSRCMap(t,_.sdp.sdp,u),i.a(2,Object.assign(Object.assign({code:R},l.data),{tracks:c}))}},i,this)}))}},{key:"_updateTinyTrackIdSSRCMap",value:function(e,t,n){n.forEach(function(n){var r=Ws(t,n.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(r),n.getTrackId())})}},{key:"_dealPublishRes",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,T,I,S,E,O,b,y,L,k;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=n.polarisReport,o=n.context,a=n.peer,s=n.reportMediaActionLogger,c=t.crtUserId,u=t.roomId,d="",_=t.getResourcesByUserId(c),l=v(_),f=[],h=e.tracks,e.code===exports.RCRTCCode.SUCCESS){r.n=1;break}return r.a(2,{code:e.code});case 1:return R=e.data,g=R.publishList,m=R.urls,C=R.mcuPublishList,d=null==m?void 0:m.liveUrl,g.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:a.getLocalTrack(Nn(e)).isLocalMuted()?0:1},e)}).forEach(function(e){var t=Qn(e,l),n=t.isInclude,r=t.index;n?l.splice(r,1,e):l.push(e)}),T=(null==C?void 0:C.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)}))||[],f=T,I=wn(_,l),S=I.publishedList,E=Object.assign(Object.assign({},t.getCDNUris()),{enableInnerCDN:t.getCDNEnable()}),O=E&&E.broadcast===ps.SPREAD?JSON.stringify([E]):"",b=Date.now(),r.n=2,o.setRTCTotalRes(u,[On(Hn.PUBLISH,S)],bn(l),Hn.TOTAL_CONTENT_RESOURCE,bn(f),O);case 2:if(y=r.v,s.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,h,y,this._trackMediaMap,[{dur:Date.now()-b,cod:y}]),y===ke){r.n=3;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:y,msg:"send publish streams notification failed"}),this._traceId),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 3:return t.setResourcesByUserId(c,l),L=S.map(function(e){return Nn(e)}),i.sendR2(_s.PUBLISH,ls.BEGIN,L),S.forEach(function(e){a.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)}),k={code:exports.RCRTCCode.SUCCESS},d&&(k.liveUrl=d),r.a(2,k)}},r,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,this._traceId=i.createTraceId(),this._logger=i,this._actionStartTime=Date.now(),a=this.tracks,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof dn||e.track instanceof dn})},!0)){r.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._logger.info(ye.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:a.map(Zn)})),(a=a.filter(function(e){var t=(e instanceof dn?{track:e}:e).track,n=t.isDestroyed();return n&&u._logger.warn(ye.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),u._traceId),!n})).length){r.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),r.a(2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID});case 2:return o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),r.n=3,this.__publish(e,t,a,n);case 3:return s=r.v,r.n=4,this._dealPublishRes(s,t,e);case 4:return c=r.v,r.a(2,c)}},r,this)}))}}])}(),$s=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(n,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),n}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.UNPUBLISH}},{key:"__unpublish",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g,m,C=this;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=e.peer,a=e.polarisReport,s=e.logger,c=e.reportMediaActionLogger,u=e.context,d=r.map(function(e){return e.getTrackId()}),0!==d.map(t.getPublishedResourceByTrackId.bind(t)).filter(function(e){return!!e}).length){i.n=1;break}return i.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:r});case 1:return d.forEach(function(e){return o.removeLocalTrackById(e)}),a.sendR2(_s.PUBLISH,ls.END,d),o.clearReTryExchangeTimer(),_=t.getSubscribedList(),i.n=2,Ds(_,!1,o,t,u);case 2:return l=i.v,(f=e.getPushOtherRooms()).length&&(l.pushOtherRooms=f),i.n=3,new ks(l,this._traceId,!0).execute(e,t,n);case 3:if(h=i.v,r.forEach(function(e){var t=e.getTrackId();C._trackMediaMap[t]=h.data.qualityMsList||[]}),h.code===exports.RCRTCCode.SUCCESS){i.n=4;break}return c.reportPubOrSubQualityData(Ls.UNPUB,this._actionStartTime,r,h.code,this._trackMediaMap),s.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:Le.FAILED,code:h.code,trackIds:r.map(Zn),msg:"exchange failed"}),this._traceId),i.a(2,{code:h.code,tracks:r});case 4:if(R=h.data.data,g=R.resultCode,m=R.message,g===exports.RCRTCCode.SUCCESS){i.n=5;break}return c.reportPubOrSubQualityData(Ls.UNPUB,this._actionStartTime,r,h.data.data.resultCode,this._trackMediaMap),s.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:Le.FAILED,code:g,trackIds:r.map(Zn),msg:"exchange inner failed: ".concat(m)}),this._traceId),i.a(2,{code:g,tracks:r});case 5:return i.a(2,Object.assign(Object.assign({code:h.code},h.data),{tracks:r}))}},i,this)}))}},{key:"_dealUnpublishRes",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,T,I,S,E,O;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.context,o=e.logger,a=e.peer,s=e.reportMediaActionLogger,c=i.getCurrentId(),u=t.roomId,d=[],_=[],l=n.tracks,f=n.code,h=n.data,f===exports.RCRTCCode.SUCCESS){r.n=1;break}return o.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:f,msg:"unpublish failed"}),this._traceId),r.a(2,{code:f});case 1:if(h){r.n=2;break}return o.info(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.SUCCESSED,msg:"unpublish list is empty "})),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return R=h.mcuPublishList,g=l.map(function(e){return e.getTrackId()}),m=g.map(t.getPublishedResourceByTrackId.bind(t)).filter(function(e){return!!e}),d.push.apply(d,v(m)),C=R?R.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)}):[],_=C,T=t.getResourcesByUserId(c),I=T.filter(function(e){return!d.includes(e)}),S=Date.now(),r.n=3,i.setRTCTotalRes(u,[On(Hn.UNPUBLISH,d)],bn(I),Hn.TOTAL_CONTENT_RESOURCE,bn(_));case 3:if(E=r.v,s.reportPubOrSubQualityData(Ls.UNPUB,this._actionStartTime,l,E,this._trackMediaMap,[{dur:Date.now()-S,cod:E}]),E===ke){r.n=4;break}return o.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.FAILED,code:E,msg:"send unpublish notification failed"}),this._traceId),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:return o.info(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.SUCCESSED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:g}),this._traceId),O=n.data.sdp,r.n=5,a.setRemoteAnswer(O.sdp);case 5:return t.setResourcesByUserId(c,I),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,this._actionStartTime=Date.now(),o=t.crtUserId,a=this.tracks,this._traceId=i.createTraceId(),j("tracks",a,function(){return a.every(function(e){return e.getUserId()===o&&e instanceof dn})},!0)){r.n=1;break}return i.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return i.info(ye.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:a.map(Zn)})),r.n=2,this.__unpublish(e,t,n,a);case 2:return s=r.v,r.n=3,this._dealUnpublishRes(e,t,s);case 3:return c=r.v,r.a(2,c)}},r,this)}))}}])}(),ec=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.LOCAL_TRACK_MUTE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,c,u,d,_,l,f,h,g,m,C,v,T;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:r=e.logger,i=e.context,o=this.localTrack,a=o.getTrackId(),c=t.crtUserId,u=t.roomId,d=!o.isLocalMuted(),_=r.createTraceId(),r.info(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:d,trackId:this.localTrack.getTrackId()}),_),l=[{resourceId:a,enabled:d}],f=t.getResourcesByUserId(c),h=[],g=s(f),n.p=1,C=p().m(function e(){var t,n,r,i;return p().w(function(e){for(;;)switch(e.n){case 0:if(t=m.value,n=Nn(t),r=l.findIndex(function(e){return e.resourceId===n}),!(r>=0)){e.n=1;break}return i=l[r].enabled,t.state=i?1:0,h.push(t),e.a(2,1);case 1:return e.a(2)}},e)}),g.s();case 2:if((m=g.n()).done){n.n=5;break}return n.d(R(C()),3);case 3:if(!n.v){n.n=4;break}return n.a(3,5);case 4:n.n=2;break;case 5:n.n=7;break;case 6:n.p=6,T=n.v,g.e(T);case 7:return n.p=7,g.f(),n.f(7);case 8:return n.n=9,i.setRTCTotalRes(u,[On(Hn.MODIFY,h)],bn(f),Hn.TOTAL_CONTENT_RESOURCE);case 9:if((v=n.v)===ke){n.n=10;break}return r.error(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:Le.FAILED,code:v,msg:"signal error"}),_),n.a(2,{code:v});case 10:return r.info(ye.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:Le.SUCCESSED}),_),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this,[[1,6,7,8]])}))}}])}(),tc=function(){function e(){return i(this,e),r(this,e,arguments)}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.RETRY_EXCHANGE}},{key:"priority",get:function(){return $a.HIGH}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C,v;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger,o=e.peer,a=e.context,s=i.createTraceId(),i.info(ye.L_RETRY_EXCHANGE_COMMAND_T),c=a.getCurrentId(),u=t.getSubscribedList(),r.n=1,Ds(u,!0,o,t,a);case 1:return(d=r.v).pushOtherRooms=e.getPushOtherRooms(),r.n=2,new ks(d,s).execute(e,t,n);case 2:if((_=r.v).code===exports.RCRTCCode.SUCCESS){r.n=3;break}return r.a(2,{code:_.code});case 3:if(l=_.data.data,f=l.sdp,(h=l.resultCode)===exports.RCRTCCode.SUCCESS){r.n=4;break}return r.a(2,{code:h});case 4:return o.clearReTryExchangeTimer(),r.n=5,o.setRemoteAnswer(f.sdp);case 5:if((R=r.v)===exports.RCRTCCode.SUCCESS){r.n=6;break}return r.a(2,{code:R});case 6:if(g=_.data.data.publishList||[],m=this._diffPublishListChange(g,t,o,c),C=m.plus,v=m.minus,!C.length&&!v.length){r.n=7;break}return r.n=7,this._spreadPublishListUri(e,c,C,v,s);case 7:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"_diffPublishListChange",value:function(e,t,n,r){var i=t.getResourcesByUserId(r),o=JSON.parse(JSON.stringify(i));e.forEach(function(e){var t,r=e.mediaType,i=e.msid,a=o.findIndex(function(e){var t=e.mediaType,n=e.msid;return r===t&&i===n});if(-1===a){var s=Object.assign({tag:i.split("_").pop(),state:(null===(t=n.getLocalTrack(Nn(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(s)}else o[a].uri=e.uri});var a=wn(i,o,!0),s=a.publishedList,c=a.unpublishedList;return t.setResourcesByUserId(r,o),{plus:s,minus:c}}},{key:"_spreadPublishListUri",value:function(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s,c,u;return p().w(function(o){for(;;)switch(o.n){case 0:return a=e.store,s=e.logger,c=a.getResourcesByUserId(t),s.info(ye.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:n,minus:r,allPublishList:c}),i),u=[],r.length&&u.push(On(Hn.UNPUBLISH,r)),n.length&&u.push(On(Hn.PUBLISH,n)),o.n=1,e.context.setRTCTotalRes(a.roomId,u,bn(c),Hn.TOTAL_CONTENT_RESOURCE);case 1:o.v===ke?s.info(ye.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(Le.SUCCESSED),i):s.error(ye.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(Le.FAILED),i);case 2:return o.a(2)}},o)}))}}])}();!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(qs||(qs={}));var nc,rc,ic=function(){function e(t,n,o,a){var s;return i(this,e),s=r(this,e),Object.defineProperty(s,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_context",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.PULL_RTCROOM_STATUS}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b,y;return p().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i=e.logger,o=t.getRoomStatusVersion(),i.info(ye.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:o}),this._traceId),!(this._targetPullVersion&&this._targetPullVersion<=o)){r.n=1;break}return i.info(ye.L_PULL_ROOM_STATUS_R,JSON.stringify({status:Le.SUCCESSED,msg:"the roomData has been pulled",localVersion:o,targetPullVersion:this._targetPullVersion}),this._traceId),r.a(2,{code:ke});case 1:return r.n=2,this._context.pullRTCRoomStatus(this._roomId,o);case 2:if(a=r.v,c=a.code,u=a.data,c===ke){r.n=3;break}return i.info(ye.L_PULL_ROOM_STATUS_R,JSON.stringify({status:Le.FAILED,code:c}),this._traceId),r.a(2,{code:c});case 3:if(d=u.bFullStatus,_=u.version,l=u.usersData,f=u.roomStatus,i.info(ye.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:d,version:Xn(_),usersData:l,roomStatus:f}),this._traceId),t.setRoomStatusVersion(_),!d){r.n=5;break}return h=Ks(l),R=h.urisData,g=h.CDNUris,r.n=4,js(R,t,e,n,g,this._traceId);case 4:return r.a(2,{code:c});case 5:m=s(f),r.p=6,m.s();case 7:if((C=m.n()).done){r.n=14;break}if((v=C.value).event!==qs.RESOURCECHANGE){r.n=11;break}if(T=Hs(v)){r.n=8;break}return r.a(3,13);case 8:if(I=T.content,(S=T.userId)!==t.crtUserId){r.n=9;break}return r.a(3,13);case 9:return r.n=10,new Qs(I,Hn.TOTAL_CONTENT_RESOURCE,S,this._traceId).execute(e,t,n);case 10:r.n=13;break;case 11:return E=Js(v),r.n=12,new Ys(E,this._traceId).execute(e,t,n);case 12:O=r.v,b=O.data,e.emit(Is,b);case 13:r.n=7;break;case 14:r.n=16;break;case 15:r.p=15,y=r.v,m.e(y);case 16:return r.p=16,m.f(),r.f(16);case 17:return r.a(2,{code:c})}},r,this,[[6,15,16,17]])}))}}])}(),oc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.ON_SIGNAL_RECONNECTED}},{key:"priority",get:function(){return $a.HIGH}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,a=e.context,s=t.roomId,c=t.roomMode,u=i.createTraceId(),i.info(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,u),"closed"!==o.getRTCPeerConn().connectionState){r.n=1;break}return i.error(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",u),e.emit(fs),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return r.n=2,a.rtcPing(s,c);case 2:if(d=r.v,40001!==d.code){r.n=5;break}return r.n=3,this._joinRoom(e,t,n,u);case 3:if(r.v!==ke){r.n=4;break}return r.n=4,this._restoreMediaServer(e,t,n);case 4:r.n=6;break;case 5:return r.n=6,new ic(s,u,a).execute(e,t,n);case 6:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"_joinRoom",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g,m,C,v,T,I,S,E,O,b;return p().w(function(i){for(;;)switch(i.n){case 0:return u=e.context,d=e.logger,i.n=1,u.joinRTCRoom(t.roomId,t.roomMode,this.livingType);case 1:if(_=i.v,l=_.code,f=_.data,l===ke){i.n=2;break}return d.error(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,code:l,msg:"im reconnect joinRTCRoom failed"}),r),i.a(2);case 2:if(f){i.n=3;break}return d.info(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),r),i.a(2);case 3:return h=null===(o=f.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===o?void 0:o.value,i.n=4,js(f,t,e,n,h,r);case 4:return(R=null===(a=f.roomInfo.filter(function(e){return"asr_status"===e.key})[0])||void 0===a?void 0:a.value)&&t.setASRStatus(R),g=null===(s=f.roomInfo.filter(function(e){return"sei_ai_uris"===e.key})[0])||void 0===s?void 0:s.value,m=t.getASRIsAvailable(),g&&((C=JSON.parse(g)).length?(m||e.emit(Ss),t.setASRSeiUris(C),v=C[0],T=v.msid,I=v.mediaType,S="".concat(T,"_").concat(I),!t.getRemoteTrack(S)&&t.addSeiRemoteTrack(C)):(m&&e.emit(Es),t.removeSeiRemoteTrack(),t.setASRSeiUris(C))),(E=null===(c=f.roomInfo.filter(function(e){return"summarization"===e.key})[0])||void 0===c?void 0:c.value)&&(O=JSON.parse(E),(b=t.getSummarizationStatusData())&&b.status!==O.status&&e.emit(O.status===exports.RCRTCOperateSummarizationType.OPEN?Os:bs,O.taskId),t.setSummarizationStatusData(O)),d.info(ye.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.SUCCESSED,roomData:f}),r),i.a(2,l)}},i,this)}))}},{key:"_restoreMediaServer",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.peer.getLocalTracks(),o=Object.values(t.getRemoteTracks()).filter(function(e){return!!e.isSubscribed()}),!i.length){r.n=1;break}return r.n=1,new Xs(i).execute(e,t,n);case 1:if(i.length||!o.length){r.n=2;break}return r.n=2,new Zs(o,!0).execute(e,t,n);case 2:return r.a(2)}},r)}))}}])}(),ac=1,sc=5;!function(e){e[e.new=0]="new",e[e.checking=1]="checking",e[e.connected=2]="connected",e[e.completed=3]="completed",e[e.failed=4]="failed",e[e.disconnected=5]="disconnected",e[e.closed=6]="closed"}(nc||(nc={})),exports.RCKickReason=void 0,(rc=exports.RCKickReason||(exports.RCKickReason={}))[rc.SERVER_KICK=1]="SERVER_KICK",rc[rc.OTHER_KICK=2]="OTHER_KICK",rc[rc.IM_DISCONNECTED=3]="IM_DISCONNECTED",rc[rc.IM_LOGOUT=4]="IM_LOGOUT",rc[rc.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED";var cc,uc,dc,_c,lc=function(){return a(function e(t,n,r,o){var a=this;i(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_baseReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_networkReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pubOrSubSuccessTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_peerCStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reportQualityJoinRoomData",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t,n,r){a._baseReportData=Object.assign(a._baseReportData,{snid:r});var i=Object.assign(Object.assign(Object.assign({},a._baseReportData),a._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:n});a._logger.__statistics(ye.L_QS_JOIN_ROOM_S,JSON.stringify(i))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}},[{key:"reportQualityKickedData",value:function(e){var t=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?sc:ac});this._logger.__statistics(ye.L_QS_KICKED_S,JSON.stringify(t))}},{key:"reportPubOrSubQualityData",value:function(e,t,n,r,i,o){var a=this;n.forEach(function(n){var s,c,u=n instanceof dn||n instanceof Tn?n:n.track,d=u.getTrackId(),_=Pn(d).mediaType,l=!1;l=u instanceof dn?!!u.isVideoTrack()&&(null===(c=(s=u).__isTiny)||void 0===c?void 0:c.call(s)):n.subTiny||!1;var p=Object.assign(Object.assign(Object.assign({},a._baseReportData),a._networkReportData),{resid:d,mtp:_,smct:l?Sa.TINY:Sa.NORMAL,stp:"Rongcloud"!==u.getTag()?1:0,cod:r,msas:i?i[d]:[],sigs:o,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":a._logger.__statistics(ye.L_QS_PUBLISH_S,JSON.stringify(p));break;case"unpub":a._logger.__statistics(ye.L_QS_UNPUBLISH_S,JSON.stringify(p));break;case"sub":a._logger.__statistics(ye.L_QS_SUBSCRIBE_S,JSON.stringify(p));break;case"unsub":a._logger.__statistics(ye.L_QS_UNSUBSCRIBE_S,JSON.stringify(p))}})}},{key:"reportQualityRecvPubMsgData",value:function(e,t){var n=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(ye.L_QS_RECV_PUB_MSG_S,JSON.stringify(n))}},{key:"setPubOrSubSuccessTime",value:function(e){this._pubOrSubSuccessTime=e}},{key:"reportIceFirstConnectData",value:function(e){var t=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),n="pub"===e?ye.L_QS_PUB_ICE_STATUS_S:ye.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(n,JSON.stringify(t))}},{key:"recordQualityIceStatusData",value:function(e,t,n){var r=this._peerCStatus||{},i=r.status,o=r.time;if(o){var a=e.IP,s=e.port,c=e.networkType,u=e.remoteIP,d=e.remotePort,_=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{dur:n-o,time:n,pices:nc[i],ices:nc[t],rcdts:[{ip:"".concat(u,":").concat(d)}],lcdts:[{ip:"".concat(a,":").concat(s),nttp:c}],cncdts:[]});this._logger.__statistics(ye.L_QS_ICE_STATUS_S,JSON.stringify(_)),this._peerCStatus={status:t,time:n}}else this._peerCStatus={status:t,time:n}}}])}();!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(cc||(cc={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(uc||(uc={})),function(e){e[e.NOT_REPORT=-1]="NOT_REPORT",e[e.REPORT_SUCCESS=1e4]="REPORT_SUCCESS",e[e.REPORT_FAIL=0]="REPORT_FAIL",e[e.PB_ERROR=40001]="PB_ERROR"}(dc||(dc={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(_c||(_c={}));var pc,fc=function(){return a(function e(t,n,r,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:uc.MeetingOrAnchor;i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:a})},[{key:"_send",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(this._context.getConnectionStatus()===Se.CONNECTED){t.n=1;break}return t.a(2,dc.NOT_REPORT);case 1:return t.n=2,this._context.setRTCState(this._roomId,e);case 2:if(t.v!==ke){t.n=3;break}return t.a(2,dc.REPORT_SUCCESS);case 3:return t.a(2,dc.REPORT_FAIL)}},t,this)}))}},{key:"_getClientID",value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=Mn(),this._runtime.localStorage.setItem(e,t)),t}},{key:"_getRealResourceId",value:function(e){var t=e,n=e.indexOf("_tiny");return n>-1&&(t=e.slice(0,n)),t}},{key:"_getPolarisTrackId",value:function(e){var t="",n=e.split("_");if(e.includes("_tiny")){var r=n.pop(),i=parseInt(n.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=n.pop();t=[n.join("_"),o,r,i].join("_")}else{var a=parseInt(n.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",s=n.pop();t=[n.join("_"),s,a].join("_")}return t}},{key:"_getBaseData",value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||fa,bitrateRecv:(null==e?void 0:e.bitrateRecv)||fa,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||fa,localAddress:"".concat((null==e?void 0:e.IP)||fa,":").concat(null==e?void 0:e.port),remoteAddress:"".concat(null==e?void 0:e.remoteIP,":").concat(null==e?void 0:e.remotePort),receiveBand:(null==e?void 0:e.availableIncomingBitrate)||fa,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||fa,packetsLost:(null==e?void 0:e.totalPacketsLost)||fa,deviceId:this._context.getCurrentId()}}},{key:"_getAudioLevel",value:function(e){return e||0===e?e:fa}},{key:"_getBitrate",value:function(e){return e||0===e?e:fa}},{key:"_getPacketsLostRate",value:function(e){return e||0===e?e:fa}},{key:"_getFrameRate",value:function(e){return e||fa}},{key:"_getResolution",value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(fa)}},{key:"_getJitter",value:function(e){return e||fa}},{key:"_getNackCount",value:function(e){return e||0===e?e:fa}},{key:"_getPliCount",value:function(e){return e||0===e?e:fa}},{key:"_getRTT",value:function(e){return e||fa}},{key:"_getTrackState",value:function(e,t){var n=e?this._crtRTCRoom.getLocalTrack(t):this._crtRTCRoom.getRemoteTrack(t);return(null==n?void 0:n.isLocalMuted())?cc.DISABLE:cc.ENABLE}},{key:"sendR3Data",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s=this;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.iceCandidatePair,r=e.senders,i=this._getBaseData(n),o="R3\t".concat(i.bitrateSend,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),a=r.map(function(e){var t=e.trackId,n=e.audioLevel,r=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,a=e.frameRate,c=e.frameWidth,u=e.frameHeight,d=e.googRenderDelayMs,_=e.jitter,l=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsSent,R=e.encoderImplementation,g=s._getPolarisTrackId(t),m=s._getRealResourceId(t);return{trackId:g,googCodecName:R||String(fa),audioLevel:s._getAudioLevel(n),bitrate:s._getBitrate(i),packetsLostRate:s._getPacketsLostRate(o),frameRate:s._getFrameRate(a),resolution:s._getResolution(c,u),jitter:s._getJitter(_),nackCount:s._getNackCount(l),pliCount:s._getPliCount(p),rtt:s._getRTT(f),googFirsSent:h,samplingRate:r,googRenderDelayMs:d,encoderImplementation:R||String(fa),trackState:s._getTrackState(!0,m)}}),o+=a.map(function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)}).join("\n"),t.n=1,this._send("".concat(o,"\r").concat(this._userRole));case 1:if(t.v===dc.REPORT_SUCCESS){t.n=2;break}return t.a(2,dc.REPORT_FAIL);case 2:return t.a(2,dc.REPORT_SUCCESS)}},t,this)}))}},{key:"sendR4Data",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s=this;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.iceCandidatePair,r=e.receivers,i=this._getBaseData(n),o="R4\t".concat(i.bitrateRecv,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),a=r.filter(function(e){return!!e.trackId}).map(function(e){var t=e.trackId,n=e.audioLevel,r=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,a=e.frameRate,c=e.frameWidth,u=e.frameHeight,d=e.googRenderDelayMs,_=e.jitter,l=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsReceived,R=e.codecImplementationName,g=s._getPolarisTrackId(t),m=s._getRealResourceId(t);return{trackId:g,googCodecName:R||String(fa),audioLevel:s._getAudioLevel(n),bitrate:s._getBitrate(i),packetsLostRate:s._getPacketsLostRate(o),frameRate:s._getFrameRate(a),resolution:s._getResolution(c,u),jitter:s._getJitter(_),nackCount:s._getNackCount(l),pliCount:s._getPliCount(p),rtt:s._getRTT(f),googFirsReceived:h,samplingRate:r,googRenderDelayMs:d,codecImplementationName:R||String(fa),trackState:s._getTrackState(!1,m)}}),o+=a.map(function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)}).join("\n"),t.n=1,this._send("".concat(o,"\r").concat(this._userRole));case 1:if(t.v===dc.REPORT_SUCCESS){t.n=2;break}return t.a(2,dc.REPORT_FAIL);case 2:return t.a(2,dc.REPORT_SUCCESS)}},t,this)}))}},{key:"sendR1",value:function(){var e,t=this._context.getCoreVersion(),n=(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platformn)||navigator.platform,r=Fn.browser,i=Fn.version,o=this._getClientID(),a="R1\t".concat("5.36.1-nctest-alpha.2","\t").concat(t,"\t").concat("web","\t").concat(n,"\t").concat(-1,"\t").concat(r,"\t").concat(i,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}},{key:"sendR2",value:function(e,t,n){var r=this._getClientID(),i="R2\t".concat(e,"\t").concat(t,"\t").concat(r,"\r").concat(n.join("\t"),"\r").concat(this._userRole);this._send(i)}}])}(),hc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"oldTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"newTrack",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.peer,o=e.logger,this.oldTrack&&this.newTrack){r.n=1;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack or newTrack is empty"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(![mn,gn].every(function(e){return!(R.oldTrack instanceof e)})){r.n=2;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(![mn,gn].every(function(e){return!(R.newTrack instanceof e)})){r.n=3;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"newTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(a=this.oldTrack.getSettings(),s=this.newTrack.getSettings(),c=this.oldTrack.getTrackId(),u=this.newTrack.getTrackId(),d=this.oldTrack.isAudioTrack()?"audio":"video",_=this.newTrack.isAudioTrack()?"audio":"video",o.info(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T,JSON.stringify({oldTrackId:c,newTrackId:u,oldSettings:a,newSettings:s})),this.oldTrack.isPublished()){r.n=4;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not published"),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(c===u){r.n=5;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack trackId are different, oldTrackId: ".concat(c,", newTrackId: ").concat(u)),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:if(d===_){r.n=6;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack are not the same kind, oldTrackKind: ".concat(d,", newTrackKind: ").concat(_)),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 6:if((null==a?void 0:a.deviceId)!==(null==s?void 0:s.deviceId)){r.n=7;break}return o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack deviceId are the same, oldDeviceId: ".concat(null==a?void 0:a.deviceId,", newDeviceId: ").concat(null==s?void 0:s.deviceId)),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 7:if(i.addLocalTrack(this.newTrack),l=(null==a?void 0:a.width)!==(null==s?void 0:s.width)||(null==a?void 0:a.height)!==(null==s?void 0:s.height)||(null==a?void 0:a.frameRate)!==(null==s?void 0:s.frameRate),f=i.getLocalTrack("".concat(this.oldTrack.getTrackId(),"_tiny")),l){r.n=8;break}return f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 8:return r.n=9,(new tc).execute(e,t,n);case 9:if((h=r.v).code===exports.RCRTCCode.SUCCESS){r.n=10;break}return i.removeLocalTrack(this.newTrack,!1),i.addLocalTrack(this.oldTrack),this.newTrack.destroy(),o.error(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"negotiation failed, code: ".concat(h.code)),r.a(2,{code:h.code});case 10:return f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(ye.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),r.a(2,{code:h.code})}},r,this)}))}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(pc||(pc={}));var Rc,gc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return _(e,rs),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=e.logger,i=e.context,o=e.service,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T,"type: ".concat(this._type),this._traceId),(null==(a=i.getNaviInfo())?void 0:a.rtcAISwitch)!==pc.CLOSE){n.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(this._type!==t.getASRStatus()){n.n=2;break}return this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return s=t.roomId,n.n=3,i.setRTCData(s,"asr_status",this._type.toString(),!0,us.ROOM,{name:Hn.ASR_STATUS,content:JSON.stringify({asr_status:this._type.toString()})});case 3:if((c=n.v)===ke){n.n=4;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:c}),this._traceId),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:return t.setASRStatus(this._type),n.n=5,o.updateASRStatus(t.getRTCRequestHeader(),{asr_status:this._type},this._traceId);case 5:if(u=n.v,d=u.code,_=u.data,d===exports.RCRTCCode.SUCCESS&&((null==_?void 0:_.resultCode)===exports.RCRTCCode.SUCCESS||42200===(null==_?void 0:_.resultCode))){n.n=6;break}return l=d!==exports.RCRTCCode.SUCCESS?d:null==_?void 0:_.resultCode,this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:l}),this._traceId),n.a(2,{code:l});case 6:return this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),mc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_enable",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return _(e,rs),a(e,[{key:"_updateSubSei",value:function(e,t,n,r){var i="".concat(e[0].msid,"_").concat(e[0].mediaType),o=n.getRemoteTrack(i);return this._enable?new Zs([o]).execute(t,n,r):new Ns([o],this._traceId).execute(t,n,r)}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.context,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T,"enable: ".concat(this._enable),this._traceId),t.setASREnable(this._enable),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)!==pc.CLOSE){r.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if((s=t.getASRSeiUris()).length){r.n=2;break}return this._logger.info(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS,asrSeiUrisLength:0}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return r.n=3,this._updateSubSei(s,e,t,n);case 3:if(c=r.v,(u=c.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return this._logger.error(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:u}),this._traceId),r.a(2,{code:u});case 4:return this._logger.info(ye.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(Rc||(Rc={}));var Cc,vc,Tc,Ic,Sc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_destLanguage",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o}return _(e,rs),a(e,[{key:"_operateWithRetry",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3e3;return p().m(function o(){var a,s,c,u;return p().w(function(o){for(;;)switch(o.p=o.n){case 0:a=1;case 1:if(!(a<=r)){o.n=8;break}return o.p=2,o.n=3,t.operateRealtimeTranslation(e.getRTCRequestHeader(),{status:n._status},n._traceId);case 3:if(s=o.v,c=s.code,s.data,c!==exports.RCRTCCode.SUCCESS){o.n=4;break}return o.a(2);case 4:console.warn("第 ".concat(a," 次调用失败,code=").concat(c)),o.n=6;break;case 5:o.p=5,u=o.v,console.error("第 ".concat(a," 次调用异常:"),u);case 6:if(!(a<r)){o.n=7;break}return o.n=7,new Promise(function(e){setTimeout(e,i)});case 7:a++,o.n=1;break;case 8:return o.a(2)}},o,null,[[2,5]])})()})}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=e.logger,i=e.service,o=e.context,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T,JSON.stringify({status:this._status,destLanguage:this._destLanguage}),this._traceId),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)!==pc.CLOSE){n.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(this._status!==Rc.OPEN){n.n=3;break}if(this._destLanguage){n.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.PARAMS_ERROR}),this._traceId),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(t.getASRSeiUris().length){n.n=3;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_START});case 3:return s={status:this._status},this._destLanguage&&(s.destLanguage=this._destLanguage),n.n=4,i.operateRealtimeTranslation(t.getRTCRequestHeader(),s,this._traceId);case 4:if(c=n.v,u=c.code,d=c.data,this._status!==Rc.CLOSE){n.n=5;break}return t.setIsStartRealTranslate(!1),this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),u!==exports.RCRTCCode.SUCCESS&&this._operateWithRetry(t,i),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 5:if(u===exports.RCRTCCode.SUCCESS&&(null==d?void 0:d.resultCode)===exports.RCRTCCode.SUCCESS){n.n=6;break}return _=u!==exports.RCRTCCode.SUCCESS?u:null==d?void 0:d.resultCode,this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:_}),this._traceId),n.a(2,{code:_});case 6:return t.setIsStartRealTranslate(!0),this._destLanguage&&t.setTranslationLang(this._destLanguage),this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),Ec=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,rs),a(e,[{key:"execute",value:function(e,t){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return t.setASRStatus(this._type),e.a(2,{code:exports.RCRTCCode.SUCCESS})},e,this)}))}}])}(),Oc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:t}),n}return _(e,rs),a(e,[{key:"_setEnableAsr",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:if(!(i=t.getASREnable())){r.n=2;break}return r.n=1,new mc(this._asrSeiUris.length>0).execute(e,t,n);case 1:t.setASREnable(i);case 2:return r.a(2)}},r,this)}))}},{key:"_onPublish",value:function(e,t,n){e.emit(Ss),t.setASRSeiUris(this._asrSeiUris),t.addSeiRemoteTrack(this._asrSeiUris),this._setEnableAsr(e,t,n)}},{key:"_onUnPublish",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)switch(r.n){case 0:return e.emit(Es),r.n=1,this._setEnableAsr(e,t,n);case 1:t.removeSeiRemoteTrack(),t.setASRSeiUris(this._asrSeiUris);case 2:return r.a(2)}},r,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)if(0===r.n)return this._asrSeiUris.length?this._onPublish(e,t,n):this._onUnPublish(e,t,n),r.a(2,{code:exports.RCRTCCode.SUCCESS})},r,this)}))}}])}(),bc=function(){function e(t){var n;return i(this,e),n=r(this,e),Object.defineProperty(n,"_isStart",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return _(e,rs),a(e,[{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l;return p().w(function(n){for(;;)switch(n.n){case 0:if(o=e.logger,a=e.context,s=e.service,this._traceId=o.createTraceId(),this._logger=o,this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T,"isStart: ".concat(this._isStart),this._traceId),(null==(c=a.getNaviInfo())?void 0:c.rtcAISwitch)!==pc.CLOSE){n.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(t.getASRSeiUris().length){n.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_START});case 2:if(!((null===(r=t.getSummarizationStatusData())||void 0===r?void 0:r.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._isStart||(null===(i=t.getSummarizationStatusData())||void 0===i?void 0:i.status)===exports.RCRTCOperateSummarizationType.CLOSE&&!this._isStart)){n.n=3;break}return this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId});case 3:return u={status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE},n.n=4,s.operateSummarization(t.getRTCRequestHeader(),u,this._traceId);case 4:if(d=n.v,_=d.code,l=d.data,_===exports.RCRTCCode.SUCCESS){n.n=5;break}return this._logger.error(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:_}),this._traceId),n.a(2,{code:_});case 5:return t.setSummarizationStatusData({taskId:l.taskId,status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE}),this._logger.info(ye.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:null==l?void 0:l.taskId}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS,taskId:null==l?void 0:l.taskId})}},n,this)}))}}])}(),yc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_taskId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"execute",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){return p().w(function(n){for(;;)if(0===n.n)return t.setSummarizationStatusData({status:this._status,taskId:this._taskId}),e.emit(this._status===exports.RCRTCOperateSummarizationType.OPEN?Os:bs,this._taskId),n.a(2,{code:exports.RCRTCCode.SUCCESS})},n,this)}))}}])}(),Lc="evt-leave",kc=function(){function e(t,n,o,a,s,c,u,d){var _,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Ra(),f=arguments.length>9&&void 0!==arguments[9]&&arguments[9];i(this,e),_=r(this,e),Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_service",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(_,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(_,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_onRecvPKMsg",{enumerable:!0,configurable:!0,writable:!0,value:null});var h=_._logger=_._context.logger;_._reportMediaActionLogger=new lc(h,_._roomId,_._clientSessionId,_._context.getCurrentId()),_._polarisReport=new fc(_._context,_._runtime,_._roomId,_);var R=_._context.getCurrentId(),g=new ss(h,l,_._context.getAppkey(),o,R,a,u,d),m=_._peerConnection=new Qa(t,h,_._reTryExchange.bind(_),R,g,_._polarisReport,!1,f);_._setPeerConnectionListener();var C=_._executeCtx=new ys(h,_._service,t,n,m,g,_._polarisReport,_._reportMediaActionLogger);return C.getPushOtherRooms=function(){return _._getPushOtherRoomsParams()},_.setCommandEventListener(),_._invoker=new os(C,g),_._store=_._invoker.store,_._audioLevelReport=new ts(_._store,m),m.on(Qa.__INNER_AUDIOLEVEL_CHANGE__,_._audioLevelReport.audioLevelReport,_._audioLevelReport),_._pinger=new er(_._context,_._roomId,a,_._initOptions.pingGap),_._pinger.onFailed=_.__kickoff.bind(_),_._pinger.onPingResult=_._handlePingResult.bind(_),_._context.registerRTCSignalListener(function(e){return K(_,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._context.decodeRtcNotify(e),r=n.time,i=n.type,o=n.roomId,!this._invoker.isDestroyed()){t.n=1;break}return this._logger.info(ye.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),t.a(2);case 1:2===i&&o===this._roomId&&(a=this._logger.createTraceId(),this._logger.info(ye.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r));case 2:return t.a(2)}},t,this)}))}),_}return _(e,F),a(e,[{key:"_setPeerConnectionListener",value:function(){var e=this,t=this._peerConnection;t.on(Qa.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(dn.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(dn.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Qa.__INNER_ICE_CONNECTED__,function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")},this),t.on(Qa.__INNER_ICE_STATE_CHANGE__,function(t){var n=t.status,r=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,n,r)}),t.on(Qa.__INNER_SEI_CONTENT__,this._onReceiveAsrSeiContent,this)}},{key:"setCommandEventListener",value:function(){var e=this._executeCtx;e.on(fs,this._rtcpeerClosed,this),e.on(hs,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Rs,this._callAppListener.bind(this,"onUserLeave"),this),e.on(gs,this._onTrackPublish,this),e.on(ms,this._onTrackUnpublish,this),e.on(Cs,this._onAudioMuteChange,this),e.on(vs,this._onVideoMuteChange,this),e.on(Ts,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on(Is,this._dealUserAppListener,this),e.on(Ss,this._callAppListener.bind(this,"onReceiveStartASR"),this),e.on(Es,this._callAppListener.bind(this,"onReceiveStopASR"),this),e.on(Os,this._callAppListener.bind(this,"onReceiveStartSummarization"),this),e.on(bs,this._callAppListener.bind(this,"onReceiveStopSummarization"),this)}},{key:"_startPullRTCRoomStatus",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._invoker.push(new ic(e,t,this._context,n));case 1:return r.a(2)}},r,this)}))}},{key:"__innerInit",value:function(e,t,n,r,i,o,a,s){return K(this,void 0,void 0,p().m(function c(){var u,d,_;return p().w(function(c){for(;;)switch(c.n){case 0:return c.n=1,this._invoker.push(new ds(this._roomId,e,t,n,r,i,o,a,s));case 1:if(u=c.v,d=u.code,_=u.data,d===exports.RCRTCCode.SUCCESS){c.n=2;break}return c.a(2,{code:d});case 2:return this._initWithRoomData(_.offlineKickTime),c.a(2,{code:d,data:_})}},c,this)}))}},{key:"_initWithRoomData",value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}},{key:"_handlePingResult",value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var n=this._logger.createTraceId();this._logger.info(ye.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),n),this._startPullRTCRoomStatus(this._roomId,n,t)}this._callAppListener("onPing",e)}},{key:"setBitrate",value:function(e,t,n){this._logger.warn(ye.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),V("max",e,function(e){return y(e)&&e>Math.max(t||1,200)},!0),V("min",t,function(t){return y(t)&&t>=1&&(!y(e)||t<e)},!0),V("start",n,function(n){return y(n)&&n>t&&n<=e}),this._peerConnection.setBitrate(e,t,n)}},{key:"_onTrackReady",value:function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),i=this._store.getRemoteTrack(r);i?(i.__innerSetMediaStreamTrack(n),this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackReady",trackId:i.getTrackId()})),this._callAppListener("onTrackReady",i)):this._logger.warn(ye.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(n.id))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){this._logger.error(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}},{key:"_onTrackUnpublish",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map(function(e){return e.getTrackId()})})),this._callAppListener("onTrackUnpublish",e)}},{key:"__parseInnerMessage",value:function(e,t){var n=e.targetId;if(n===this._roomId){this._logger.info(ye.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var r=e.content;switch(e.messageType){case Hn.KICK:this.__kickoff(!0,r);break;case Hn.STATE:this._stateHandle(r,t);break;case Hn.MODIFY:case Hn.PUBLISH:case Hn.UNPUBLISH:case Hn.TOTAL_CONTENT_RESOURCE:this._resourceHandle(r,e.messageType,e.senderUserId,e.sentTime,t);break;case Hn.ASR_STATUS:this._invoker.push(new Ec(r.asr_status));break;case Hn.ASR_SEI:this._invoker.push(new Oc(JSON.parse(r.sei_ai_uris||[])));break;case Hn.SUMMARIZATION_STATUS:this._invoker.push(new yc(r.status,r.taskId));break;case Hn.ROOM_NOTIFY:this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case Hn.USER_NOTIFY:this._logger.warn(ye.L_OLD_DAILY_RECORD_O,"TODO: ".concat(Hn.USER_NOTIFY));break;case Hn.PK_INVITE:case Hn.PK_CANCEL_INVITE:case Hn.PK_INVITE_TIMEOUT:case Hn.PK_INVITE_ANSWER:case Hn.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case Hn.OTHER_ROOM_OFFLINE:break;default:this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,r,e.senderUserId,e.messageUId)}}else this._logger.warn(ye.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:Le.FAILED,message:"roomId is different, msg roomId-> ".concat(n,", this._roomId-> ").concat(this._roomId," ")}),t)}},{key:"__kickoff",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o=this;return p().w(function(n){for(;;)switch(n.n){case 0:if(!this._invoker.isDestroyed()){n.n=1;break}return n.a(2);case 1:this._logger.warn(ye.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(Lc),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach(function(e){e.userId===o._context.getCurrentId()&&(i=e.type,r=e.kickExtra,o._reportMediaActionLogger.reportQualityKickedData(i))}),this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:i,kickExtra:r})),this._callAppListener("onKickOff",e,i,r);case 2:return n.a(2)}},n,this)}))}},{key:"_rtcpeerClosed",value:function(){this.emit(Lc),this._leaveHandle(!0),this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}},{key:"_onReceiveAsrSeiContent",value:function(e){var t=this;e.forEach(function(e){"destLangCode"in e?t._store.getIsStartRealTranslate()&&t._store.getTranslationLang()===e.destLangCode&&t._callAppListener("onReceiveRealtimeTranslationContent",e):t._callAppListener("onReceiveASRContent",e)})}},{key:"_resourceHandle",value:function(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a;return p().w(function(o){for(;;)switch(o.n){case 0:if(a=e.uris,!e.ignore&&a){o.n=1;break}return o.a(2);case 1:this._invoker.push(new Qs(e,t,n,i,r));case 2:return o.a(2)}},o,this)}))}},{key:"_onTrackPublish",value:function(e,t,n){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map(function(e){return e.getTrackId()})})),this._callAppListener("onTrackPublish",e)}},{key:"_stateHandle",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._invoker.push(new Ys(e,t));case 1:r=n.v,i=r.data,this._dealUserAppListener(i);case 2:return n.a(2)}},n,this)}))}},{key:"_dealUserAppListener",value:function(e){var t,n,r=this,i=e.left,o=e.joined,a=e.upgrade,s=e.downgrade,c=e.offline,u=v(o),d=v(i);(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)?(null==a||a.forEach(function(e){r._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.ANCHOR})),r._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.ANCHOR)}),null==s||s.forEach(function(e){r._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.AUDIENCE})),r._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.AUDIENCE)})):(u.push.apply(u,v(a)),d.push.apply(d,v(s))),c.length&&((null===(n=this._appListener)||void 0===n?void 0:n.onUserOffline)?(this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserOffline",offline:c})),this._callAppListener("onUserOffline",c)):d.push.apply(d,v(c))),u.length>0&&(this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserJoin",allJoined:u})),this._callAppListener("onUserJoin",u)),d.length>0&&(this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserLeave",allLeft:d})),this._callAppListener("onUserLeave",d))}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"getRemoteUserIds",value:function(){return this._store.getRemoteUserIds()}},{key:"getRemoteTracks",value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach(function(n){t.push.apply(t,v(e.getRemoteTracksByUserId(n)))}),t}},{key:"getRemoteTracksByUserId",value:function(e){return this._store.getRemoteTracksByUserId(e)}},{key:"getSessionId",value:function(){return this._store.getSessionId()}},{key:"sendMessage",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this._logger.createTraceId(),this._logger.info(ye.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:e,content:t}),r),n.n=1,this._context.sendMessage(Ie.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});case 1:if(i=n.v,(o=i.code)===ke){n.n=2;break}return this._logger.error(ye.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:Le.FAILED,code:o}),r),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return this._logger.info(ye.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:Le.SUCCESSED,name:e,content:t}),r),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"setRoomAttribute",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return p().m(function o(){var a,s;return p().w(function(o){for(;;)switch(o.n){case 0:return a=r._logger.createTraceId(),r._logger.info(ye.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:r._roomId,key:e,value:t,message:n,isInner:i}),a),o.n=1,r._context.setRTCData(r._roomId,e,t,i,us.ROOM,n);case 1:if((s=o.v)===ke){o.n=2;break}return r._logger.error(ye.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.FAILED,code:s}),a),o.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return r._logger.info(ye.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,roomId:r._roomId,key:e,value:t,message:n,isInner:i}),a),o.a(2,{code:exports.RCRTCCode.SUCCESS})}},o)})()})}},{key:"deleteRoomAttributes",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return p().m(function i(){var o,a;return p().w(function(i){for(;;)switch(i.n){case 0:return o=n._logger.createTraceId(),n._logger.info(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:n._roomId,keys:e,message:t,isInner:r}),o),i.n=1,n._context.removeRTCData(n._roomId,e,r,us.ROOM,t);case 1:if((a=i.v)===ke){i.n=2;break}return n._logger.error(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.FAILED,code:a}),o),i.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return n._logger.info(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,roomId:n._roomId,keys:e,message:t,isInner:r}),o),i.a(2,{code:exports.RCRTCCode.SUCCESS})}},i)})()})}},{key:"getRoomAttributes",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e._logger.createTraceId(),e._logger.info(ye.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:e._roomId,keys:t,isInner:n}),i),r.n=1,e._context.getRTCData(e._roomId,t,n,us.ROOM);case 1:if(o=r.v,a=o.code,s=o.data,a===ke){r.n=2;break}return e._logger.error(ye.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(a),i),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e._logger.info(ye.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,data:s}),i),r.a(2,{code:exports.RCRTCCode.SUCCESS,data:s})}},r)})()})}},{key:"_setUserAttributeValue",value:function(e,t,n){return this._context.setRTCData(this._roomId,e,t,!1,us.PERSON,n)}},{key:"_deleteUserAttributes",value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,us.PERSON,t)}},{key:"_getUserAttributes",value:function(e){return this._context.getRTCData(this._roomId,e,!1,us.PERSON)}},{key:"isDestroyed",value:function(){return this._invoker.isDestroyed()}},{key:"__destroy",value:function(e){return this._leaveHandle(e)}},{key:"_muteRemoteTracksBeforeQuit",value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach(function(e){return e.mute()})}},{key:"_leaveHandle",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)switch(t.n){case 0:if(!this._invoker.isDestroyed()){t.n=1;break}return t.a(2);case 1:if(this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),!e){t.n=2;break}return t.n=2,this._context.quitRTCRoom(this._roomId);case 2:if(!this._store.isMainRoom){t.n=3;break}return t.n=3,this._quitAllPKRoom();case 3:return this._pinger.stop(),t.n=4,this._service.exit(this._store.getRTCRequestHeader());case 4:this._releasePCManager();case 5:return t.a(2)}},t,this)}))}},{key:"_releasePCManager",value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}},{key:"_onLocalTrackDestroied",value:function(e){e instanceof ln&&e.__isTiny()||this.unpublish([e])}},{key:"_onLocalTrackMuted",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._invoker.push(new ec(e));case 1:r=n.v,i=r.code,t(i);case 2:return n.a(2)}},n,this)}))}},{key:"publish",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Xs(e)))},t,this)}))}},{key:"_getPushOtherRoomsParams",value:function(){return[]}},{key:"_reTryExchange",value:function(){return this._invoker.push(new tc)}},{key:"unpublish",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new $s(e)))},t,this)}))}},{key:"_isValidResourceId",value:function(e){var t,n=Pn(e).userId;return!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find(function(t){return Nn(t)===e}))}},{key:"subscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Zs(e,void 0,void 0)))},t,this)}))}},{key:"unsubscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)if(0===t.n)return n=this._logger.createTraceId(),this._logger.info(ye.L_APP_CALL_UNSUBSCRIBE_O,void 0,n),t.a(2,this._invoker.push(new Ns(e,n)))},t,this)}))}},{key:"updateSubList",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new As(e,!0,this._logger.createTraceId())))},t,this)}))}},{key:"getLocalTrack",value:function(e){return this._peerConnection.getLocalTrack(e)}},{key:"getLocalTracks",value:function(){return this._peerConnection.getLocalTracks()}},{key:"getRemoteTrack",value:function(e){return this._store.getRemoteTrack(e)||null}},{key:"subscribedTracks",get:function(){return this._store.getSubscribedList().slice()}},{key:"registerRoomEventListener",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e,this.asrIsAvailable()&&this._executeCtx.emit(Ss);var t=this.getSummarizationStatusData();t&&(null==t?void 0:t.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._executeCtx.emit(Os,t.taskId)}},{key:"registerReportListener",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}},{key:"onAudioLevelChange",value:function(e,t){this._logger.info(ye.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}},{key:"__onReconnected",value:function(e){this._invoker.push(new oc(e))}},{key:"_onAudioMuteChange",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}},{key:"_onVideoMuteChange",value:function(e){this._logger.info(ye.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}},{key:"_registerPKMsgListener",value:function(e){this._onRecvPKMsg=e}},{key:"_quitAllPKRoom",value:function(){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)if(0===e.n)return e.a(2)},e)}))}},{key:"getClientSessionId",value:function(){return this._store.clientSessionId}},{key:"changeMediaDevice",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){return p().w(function(n){for(;;)if(0===n.n)return n.a(2,this._invoker.push(new hc(e,t)))},n,this)}))}},{key:"startASR",value:function(){return this._invoker.push(new gc(ns.OPEN))}},{key:"stopASR",value:function(){return this._invoker.push(new gc(ns.CLOSE))}},{key:"asrIsAvailable",value:function(){return this._store.getASRIsAvailable()}},{key:"setEnableASR",value:function(e){return this._invoker.push(new mc(e))}},{key:"startRealtimeTranslation",value:function(e){return this._invoker.push(new Sc(Rc.OPEN,e))}},{key:"stopRealtimeTranslation",value:function(){return this._invoker.push(new Sc(Rc.CLOSE))}},{key:"startSummarization",value:function(){return this._invoker.push(new bc(!0))}},{key:"stopSummarization",value:function(){return this._invoker.push(new bc(!1))}},{key:"getSummarizationStatusData",value:function(){return this._store.getSummarizationStatusData()}}])}(),Ac=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.MCUCONFIG_FLUSH}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f;return p().w(function(n){for(;;)switch(n.n){case 0:return s=e.context,c=e.service,u={"App-Key":s.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:s.getCurrentId(),SessionId:t.getSessionId()},n.n=1,c.setMcuConfig(u,this.data);case 1:if(d=n.v,_=d.code,l=d.res,_===exports.RCRTCCode.SUCCESS){n.n=2;break}return n.a(2,{code:_});case 2:return l.pull_url&&t.setCDNUris(JSON.parse(l.pull_url)),f=this.cdnValues,_===exports.RCRTCCode.SUCCESS&&((null===(i=null===(r=f.output)||void 0===r?void 0:r.video.normal)||void 0===i?void 0:i.width)||(null===(a=null===(o=f.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&Ms(s,t),n.a(2,{code:_,data:l})}},n,this)}))}}])}();exports.BackgroundPictureFillMode=void 0,(Cc=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[Cc.CROP=1]="CROP",Cc[Cc.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(vc=exports.MixLayoutMode||(exports.MixLayoutMode={}))[vc.CUSTOMIZE=1]="CUSTOMIZE",vc[vc.SUSPENSION=2]="SUSPENSION",vc[vc.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(Tc=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[Tc.CROP=1]="CROP",Tc[Tc.WHOLE=2]="WHOLE",function(e){e[e.AUDIO_VIDEO_ALL=0]="AUDIO_VIDEO_ALL",e[e.AUDIO_VIDEO_NO=1]="AUDIO_VIDEO_NO",e[e.AUDIO_ALL_VIDEO_NO=2]="AUDIO_ALL_VIDEO_NO",e[e.AUDIO_NO_VIDEO_ALL=3]="AUDIO_NO_VIDEO_ALL",e[e.AUDIO_VIDEO_INPUT=4]="AUDIO_VIDEO_INPUT",e[e.AUDIO_ALL_VIDEO_INPUT=5]="AUDIO_ALL_VIDEO_INPUT",e[e.AUDIO_NO_VIDEO_INPUT=6]="AUDIO_NO_VIDEO_INPUT",e[e.AUDIO_INPUT_VIDEO_ALL=7]="AUDIO_INPUT_VIDEO_ALL",e[e.AUDIO_INPUT_VIDEO_NO=8]="AUDIO_INPUT_VIDEO_NO",e[e.ROOM_AUDIO_VIDEO_APPEND=9]="ROOM_AUDIO_VIDEO_APPEND",e[e.ROOM_AUDIO_VIDEO_NOT_APPEND=10]="ROOM_AUDIO_VIDEO_NOT_APPEND",e[e.ROOM_AUDIO_APPEND=11]="ROOM_AUDIO_APPEND",e[e.ROOM_AUDIO_NOT_APPEND=12]="ROOM_AUDIO_NOT_APPEND",e[e.ROOM_VIDEO_APPEND=13]="ROOM_VIDEO_APPEND",e[e.ROOM_VIDEO_NOT_APPEND=14]="ROOM_VIDEO_NOT_APPEND"}(Ic||(Ic={}));var Nc,Pc=function(){return{version:2,mode:exports.MixLayoutMode.SUSPENSION}},Dc=function(){return a(function e(t,n,r){i(this,e),Object.defineProperty(this,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_isValidTrackId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_values",{enumerable:!0,configurable:!0,writable:!0,value:Pc()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._executeCtx.logger},[{key:"setHostVideoTrack",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=Pn(e),n=t.mediaType,r=t.tag,i=t.userId;return n!==exports.RCMediaType.VIDEO_ONLY?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=Dn(i,r),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,videoTrackId:e})),this)}},{key:"setMixLayoutMode",value:function(e){return[exports.MixLayoutMode.CUSTOMIZE,exports.MixLayoutMode.SUSPENSION,exports.MixLayoutMode.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:Le.SUCCESSED,mode:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:Le.SUCCESSED,msg:"mode: ".concat(e," is invalid")})),this)}},{key:"_addOutputValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal",r=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var i=r.video;if("normal"!==n&&"tiny"!==n)if("backgroundColor"!==n)if("exparams"!==n){if("backgroundPicture"===n){var o=i.backgroundPicture||(i.backgroundPicture={fillMode:exports.BackgroundPictureFillMode.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var a=i[n]||(i[n]={});Object.assign(a,t)}}else r.audio={bitrate:t};else r.cdn=t}},{key:"setOutputVideoResolution",value:function(e){if(!Bn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=xn(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"normal"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.SUCCESSED,resolution:e})),this}},{key:"setOutputVideoFPS",value:function(e){if(!Vn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=jn(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:Le.SUCCESSED,fps:e})),this}},{key:"setOutputVideoBitrate",value:function(e){return!y(e)||e<=0?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this):(this._addOutputValue("video",{bitrate:e},"normal"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this)}},{key:"setOutputTinyVideoResolution",value:function(e){if(!Bn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=xn(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"tiny"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.SUCCESSED,resolution:e})),this}},{key:"setOutputTinyVideoFPS",value:function(e){if(!Vn(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=jn(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:Le.SUCCESSED,fps:e})),this}},{key:"setOutputTinyVideoBitrate",value:function(e){return!y(e)||e<=0?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this):(this._addOutputValue("video",{bitrate:e},"tiny"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this)}},{key:"setOutputVideoRenderMode",value:function(e){return[exports.MixVideoRenderMode.CROP,exports.MixVideoRenderMode.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:Le.SUCCESSED,renderMode:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}},{key:"setOutputAudioBitrate",value:function(e){return y(e)&&e>0?(this._addOutputValue("audio",e),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this)}},{key:"setOutputBackgroundColor",value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?(this._addOutputValue("video",e,"backgroundColor"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:Le.SUCCESSED,color:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:Le.FAILED,msg:"params error -> color: ".concat(e)})),this)}},{key:"addOutputBackgroundPicture",value:function(e,t,n,r,i){var o,a,s;if(!D(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(e)})),this;if([t,n,r,i].some(function(e){return!y(e)||e<0||e>1}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(t,", y: ").concat(n,", w: ").concat(r,", h: ").concat(i)})),this;var c=(null===(s=null===(a=null===(o=this._values.output)||void 0===o?void 0:o.video)||void 0===a?void 0:a.backgroundPicture)||void 0===s?void 0:s.picture)||[];return c.push({uri:e,w:r,h:i,x:t,y:n}),this._addOutputValue("video",{picture:c},"backgroundPicture"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.SUCCESSED,uri:e,x:t,y:n,w:r,h:i})),this}},{key:"removeOutputBackgroundPicture",value:function(e){var t,n,r;if(!D(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(e)})),this;var i=null===(r=null===(n=null===(t=this._values.output)||void 0===t?void 0:t.video)||void 0===n?void 0:n.backgroundPicture)||void 0===r?void 0:r.picture;return i&&(i=i.filter(function(t){return t.uri!==e}),this._addOutputValue("video",{pictures:i},"backgroundPicture")),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.SUCCESSED,uri:e})),this}},{key:"clearOutputBackgroundPicture",value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}},{key:"setOutputBackgroundPictureFillMode",value:function(e){return[exports.BackgroundPictureFillMode.CROP,exports.BackgroundPictureFillMode.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.SUCCESSED,fillMode:e})),this):(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}},{key:"addPublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!L(e)||0===e.length||e.some(function(e){return!r.test(e)}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=!1;return e.forEach(function(e){i.some(function(t){return t.pushurl===e})||(o=!0,i.push({pushurl:e}))}),i.length>5?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(e.length)})),this):(o&&this._addOutputValue("cdn",i),this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.SUCCESSED,urls:e})),this)}},{key:"removePublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!L(e)||0===e.length||e.some(function(e){return!r.test(e)}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;for(var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=i.length-1;o>=0;o-=1){var a=i[o].pushurl,s=e.indexOf(a);s>=0&&(e.splice(s,1),i.splice(o,1))}return this._addOutputValue("cdn",i),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.SUCCESSED,urls:e})),this}},{key:"clearPublishStreamUrls",value:function(){return this._addOutputValue("cdn",[]),this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O),this}},{key:"addCustomizeLayoutVideo",value:function(e,t,n,r,i){if(!k(e)||!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;if(!y(t)||!y(n))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params x or y is error -> x: ".concat(t,", y: ").concat(n)})),this;if([r,i].some(function(e){return!y(e)||e<0}))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params width or height error -> width: ".concat(r,", height: ").concat(i)})),this;var o=Pn(e),a=o.userId,s=o.tag;if(o.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var c=Dn(a,s),u=this._values.input||(this._values.input={}),d=u.video||(u.video=[]);return d.some(function(e){return e.height===i&&e.width===r&&e.stream_id===c&&e.user_id===a&&e.x===t&&e.y===n})?(this._logger.warn(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"Duplicate configuration item place ignored"})),this):(d.push({user_id:a,stream_id:c,x:t,y:n,width:r,height:i}),this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,x:t,y:n,width:r,height:i})),this)}},{key:"removeCustomizeLayoutVideo",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=Pn(e),n=t.userId,r=t.tag;if(t.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var i=Dn(n,r),o=this._values.input;return(null==o?void 0:o.video)&&o.video.length>0&&(o.video=o.video.filter(function(e){return e.stream_id===i})),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this}},{key:"clearCustomizeLayoutVideo",value:function(){var e=this._values.input;return null==e||delete e.video,this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O),this}},{key:"setCustomizeInputAudio",value:function(e){var t=this;return e.some(function(e){return t._isValidTrackId(e)})?(this._logger.error(ye.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map(function(e){var t=Pn(e),n=t.userId,r=t.tag;return{stream_id:Dn(n,r),user_id:n}}),this._values.inputFilterMode=Ic.AUDIO_INPUT_VIDEO_ALL,this._logger.info(ye.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackIds:e})),this)}},{key:"addCustomizeInputAudio",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),n=t.audio||(t.audio=[]),r=Pn(e),i=r.userId,o=r.tag,a=Dn(i,o);return n.some(function(e){return e.stream_id===a&&e.user_id===i})?(this._logger.warn(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(n.push({user_id:i,stream_id:a}),this._values.inputFilterMode=Ic.AUDIO_INPUT_VIDEO_ALL,this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this)}},{key:"removeCustomizeInputAudio",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input;if(!(null==t?void 0:t.audio)||0===t.audio.length)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var n=Pn(e),r=n.userId,i=n.tag,o=Dn(r,i);return t.audio=t.audio.filter(function(e){return r!==e.user_id||o!==e.stream_id}),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this}},{key:"clearCustomizeInputAudio",value:function(){var e=this._values.input;return(null==e?void 0:e.audio)&&delete e.audio,this._values.inputFilterMode=Ic.AUDIO_VIDEO_ALL,this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O),this}},{key:"addPictureWaterMark",value:function(e,t,n,r,i,o){if(!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;if(!D(t))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([n,r,i,o].some(function(e){return!y(e)||e<0||e>1})||n+i>1||r+o>1)return this._logger.error(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(n,", y: ").concat(r,", w: ").concat(i,", h: ").concat(o)})),this;var a=Pn(e),s=a.userId,c=a.tag,u=Dn(s,c),d=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,_=d.filter(function(e){return e.streamId===u})[0];return _?_.picture.push({uri:t,w:i,h:o,x:n,y:r}):d.push({streamId:u,picture:[{uri:t,w:i,h:o,x:n,y:r}]}),this._values.waterMark.singleScreen=d,this._logger.info(ye.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,uri:t,x:n,y:r,w:i,h:o,singleScreen:d})),this}},{key:"clearPictureWaterMark",value:function(){return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen=[],this._logger.info(ye.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}},{key:"removePictureWaterMark",value:function(e,t){if(!k(e)||!this._isValidTrackId(e))return this._logger.error(ye.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var n=Pn(e),r=n.userId,i=n.tag,o=Dn(r,i);return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen.forEach(function(e){e.streamId===o&&(e.picture=e.picture.filter(function(e){return e.uri!==t}))}),this._logger.info(ye.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,uri:t})),this}},{key:"reset",value:function(){return this._values=Pc(),this._logger.info(ye.L_MCU_CONFIG_BUILDER_RESET_O),this}},{key:"flush",value:function(){return K(this,arguments,void 0,function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=JSON.parse(JSON.stringify(e._values)),n.n=1,e._invoker.push(new Ac(r,e._values));case 1:return i=n.v,o=i.code,t&&(e._values=Pc()),n.a(2,{code:o})}},n)})()})}},{key:"__innerGetValues",value:function(){return JSON.parse(JSON.stringify(this._values))}}])}();exports.RCLivingType=void 0,(Nc=exports.RCLivingType||(exports.RCLivingType={}))[Nc.VIDEO=0]="VIDEO",Nc[Nc.AUDIO=1]="AUDIO";var Uc,wc=function(){function e(t,n,o){var a;return i(this,e),a=r(this,e),Object.defineProperty(a,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return _(e,rs),a(e,[{key:"_exchangeWithPushOtherRoom",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.peer,a=e.context,o.getLocalTracks().length){r.n=1;break}return i.info(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.SUCCESSED,msg:"have not published resource"}),this.traceId),r.a(2);case 1:return s=o,c=t.getSubscribedList(),r.n=2,Ds(c,!1,s,t,a);case 2:return u=r.v,d=e.getPushOtherRooms(),u.pushOtherRooms=d,r.n=3,new ks(u,this.traceId,!0).execute(e,t,n);case 3:if((_=r.v).code===exports.RCRTCCode.SUCCESS){r.n=4;break}return i.error(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,code:_.code,pushOtherRooms:d}),this.traceId),r.a(2);case 4:if(l=_.data.data,f=l.sdp,(h=l.resultCode)===exports.RCRTCCode.SUCCESS){r.n=5;break}return i.error(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,code:h,pushOtherRooms:d}),this.traceId),r.a(2);case 5:i.info(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.SUCCESSED,pushOtherRooms:d}),this.traceId),s.setRemoteAnswer(f.sdp);case 6:return r.a(2)}},r,this)}))}},{key:"kind",get:function(){return Xa.EXCHANGE_WITH_PUSH_OTHER_ROOM}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=this.roomId,i.info(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_T,o),this.roomPKHandler){r.n=1;break}return i.error(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this.roomPKHandler.getPKInfo(o)){r.n=2;break}return i.warn(ye.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,msg:"PKInfo not exist"}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return r.n=3,this._exchangeWithPushOtherRoom(e,t,n);case 3:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Mc=function(){function e(t,n,o,a,s,c){var u;return i(this,e),u=r(this,e),Object.defineProperty(u,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"room",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"isQuitPK",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:c}),u}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.LEAVE_OTHER_ROOM}},{key:"quitRoomPK",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=e.logger,a=e.context,o.info(ye.L_QUIT_PK_T,"roomId: ".concat(t),r),this._PKInfo[t]){i.n=1;break}return o.warn(ye.L_QUIT_PK_R,"status: ".concat(Le.FAILED,", msg: pkinfo is empty"),r),i.a(2);case 1:return s=this._PKInfo[t],c=s.inviterRoomId,u=s.inviteeRoomId,d=s.inviterUserId,_=s.inviteSessionId,l={inviteeRoomId:u,inviterRoomId:c,userId:n.crtUserId},f={roomId:n.roomId,endRoomId:t,sessionId:_,content:JSON.stringify(l),keys:["".concat(c,"|").concat(d)]},i.n=2,a.endRoomPK(f);case 2:if((h=i.v)===ke){i.n=3;break}return o.error(ye.L_QUIT_PK_R,"status: ".concat(Le.FAILED,", code: ").concat(h),r),i.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 3:o.info(ye.L_QUIT_PK_R,"status: ".concat(Le.SUCCESSED),r),delete this._PKInfo[t];case 4:return i.a(2)}},i,this)}))}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:return i=e.logger,o=this.room,a=this.isQuitPK,s=o.getRoomId(),i.info(ye.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:s,isQuitPK:a}),this.traceId),r.n=1,o.__destroy(!0);case 1:return delete this._joinedPKRooms[s],r.n=2,new wc(s,this.pkHandler,this.traceId).execute(e,t,n);case 2:return a&&this.quitRoomPK(e,s,t,this.traceId),i.info(ye.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),this.traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),xc=function(){return a(function e(t,n,r,o,a,s,c,u,d,_){i(this,e),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_mainLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"_registerPKMsgListener",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_onJoinedPKRoom",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(this,"_inviteTimeout",{enumerable:!0,configurable:!0,writable:!0,value:30}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mainRoomId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()},[{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){this._logger.error(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}},{key:"_onInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r={inviterRoomId:n,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[n]=t,this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:r})),this._callAppListener("onRequestJoinOtherRoom",r)}},{key:"_onCancelInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r={inviterRoomId:n,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[n],this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:r})),this._callAppListener("onCancelRequestOtherRoom",r)}},{key:"_onInviteTimeout",value:function(e){}},{key:"_onInviteAnswer",value:function(e){var t=e.answerCode,n=e.inviteContent,r=n.inviteSessionId,i=n.inviterUserId,o=n.inviterRoomId,a=n.inviteeUserId,s=n.inviterUserAutoMix,c=n.inviteeUserAutoMix,u=n.inviteeRoomId,d={agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:u,inviteeUserId:a,extra:n.extra};this._PKInfo[u]=this._PKInfo[u]||{inviteSessionId:r,inviterRoomId:o,inviterUserId:i,inviterUserAutoMix:s,inviteeRoomId:u},this._PKInfo[u].inviteeUserAutoMix=c,this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:d})),this._callAppListener("onResponseJoinOtherRoom",d)}},{key:"createLeaveOtherRoomCommand",value:function(e,t,n){return new Mc(this,e,this._PKInfo,this._joinedPKRooms,t,n)}},{key:"_onPKEnd",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=e.inviteInfo,r=n.inviteeRoomId,i=n.inviterRoomId,o=n.userId,a=i===this._mainRoomId?r:i,s={endRoomId:a,endUserId:o},c=this._joinedPKRooms[a],u=this._logger.createTraceId(),this._logger.info(ye.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,u),!c){t.n=1;break}return t.n=1,this._invoker.push(this.createLeaveOtherRoomCommand(c,!0,u));case 1:delete this._PKInfo[a],this._logger.info(ye.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:s})),this._callAppListener("onFinishOtherRoom",s);case 2:return t.a(2)}},t,this)}))}},{key:"_onRecvPKMsg",value:function(e){var t=e.content;switch(e.messageType){case Hn.PK_INVITE:this._onInvite(t);break;case Hn.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case Hn.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case Hn.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case Hn.PK_END:this._onPKEnd(t)}}},{key:"registerRoomPKEventListener",value:function(e){this._logger.info(ye.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}},{key:"requestJoinOtherRoom",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,options:n}),i),j("inviteeRoomId",e,k,!0)&&j("inviteeUserId",t,k,!0)){r.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),i),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return o=Ra(),a=!b(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),s={inviteSessionId:o,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:a,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(null==n?void 0:n.extra)||""},c={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:o},r.n=2,this._context.requestRoomPK(c);case 2:if((u=r.v)===ke){r.n=3;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:u}),i),r.a(2,{code:u});case 3:return this._PKInfo[e]={inviteSessionId:o,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:a,inviteeRoomId:e},this._logger.info(ye.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),i),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"cancelRequestJoinOtherRoom",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,extra:n}),i),j("inviteeRoomId",e,k,!0)&&j("inviteeUserId",t,k,!0)){r.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),i),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._PKInfo[e]){r.n=2;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"The request to connect with ".concat(t," user in room ").concat(e," is not initiated")}),i),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return o={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:n||""},a={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(o)},r.n=3,this._context.cancelRoomPK(a);case 3:if((s=r.v)===ke){r.n=4;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:s}),i),r.a(2,{code:s});case 4:return this._logger.info(ye.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),i),delete this._PKInfo[e],r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"responseJoinOtherRoom",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:e,inviterUserId:t,agree:n,options:r}),o),j("inviterRoomId",e,k,!0)&&j("inviterUserId",t,k,!0)){i.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),o),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._PKInfo[e]){i.n=2;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"User ".concat(t," in room ").concat(e," did not send a request for connection")}),o),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return a=this._PKInfo[e],s=a.inviteSessionId,c=a.inviterUserAutoMix,u=!b(null==r?void 0:r.autoMix)||(null==r?void 0:r.autoMix),d={inviteSessionId:s,inviterRoomId:e,inviterUserId:t,inviterUserAutoMix:c,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:u},_=Object.assign(d,{inviterUserAutoMix:c}),l=n?Object.assign(d,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(_)}):d,!P(null==r?void 0:r.extra)&&Object.assign(l,{extra:r.extra}),f={agree:n,roomId:this._mainRoomId,inviteSessionId:s,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(l),key:"".concat(e,"|").concat(this._mainRoomId),value:JSON.stringify(d)},i.n=3,this._context.responseRoomPK(f);case 3:if((h=i.v)===ke){i.n=4;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:h}),o),i.a(2,{code:h});case 4:return this._logger.info(ye.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),o),this._PKInfo[e].inviteeUserAutoMix=u,i.a(2,{code:exports.RCRTCCode.SUCCESS})}},i,this)}))}},{key:"joinOtherRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:e}),n),j("roomId",e,k,!0)){t.n=1;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._context.getConnectionStatus()===Se.CONNECTED){t.n=2;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),n),t.a(2,{code:exports.RCRTCCode.SIGNAL_DISCONNECTED});case 2:if(!this._joinedPKRooms[e]){t.n=3;break}return this._logger.warn(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:return r=exports.RCLivingType.VIDEO,i={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},o=new Jc(this._context,this._runtime,e,this._service,this._initOptions,r,!1,!1,this._clientSessionId),t.n=4,o.__innerInit(exports.RTCMode.LIVE,void 0,r,i);case 4:if(a=t.v,(s=a.code)===exports.RCRTCCode.SUCCESS){t.n=5;break}return this._logger.error(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:s}),n),t.a(2,{code:s});case 5:return this._joinedPKRooms[e]=o,t.n=6,this._onJoinedPKRoom(e,n);case 6:return this._logger.info(ye.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),n),t.a(2,{room:o,code:exports.RCRTCCode.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()})}},t,this)}))}},{key:"leaveOtherRoom",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r;return p().w(function(n){for(;;)if(0===n.n)return r=this._logger.createTraceId(),this._logger.info(ye.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,r),n.a(2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,r)))},n,this)}))}},{key:"getPKInfo",value:function(e){return this._PKInfo[e]}},{key:"getAllPKInfo",value:function(){return this._PKInfo}},{key:"getJoinedPKRooms",value:function(){return this._joinedPKRooms}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(Uc||(Uc={}));var Bc,Vc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"enable",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.ENABLE_INNER_CDN}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.logger,o=e.context,a=this.enable,i.info(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:t.roomId,enable:a})),t.isMainRoom){r.n=1;break}return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),r.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:if(b(a)){r.n=2;break}return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> enable"})),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t.setCDNEnabel(a),s={version:2,output:{inCDNModel:a?Uc.OPEN:Uc.STOP}},r.n=3,new Ac(s,this.cdnValues).execute(e,t,n);case 3:if(c=r.v,(u=c.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:u,msg:"signal error"})),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:if(!(d=t.getCDNUris())||d.broadcast===ps.SPREAD){r.n=5;break}return i.info(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.SUCCESSED,enable:a})),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 5:return r.n=6,Ms(o,t);case 6:if(_=r.v,(l=_.code)!==exports.RCRTCCode.SUCCESS){r.n=7;break}return i.info(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.SUCCESSED,enable:a})),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 7:return i.error(ye.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:l})),r.a(2,{code:l})}},r,this)}))}}])}();!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Bc||(Bc={}));var jc,Fc,Gc=function(){function e(t,n){var o;return i(this,e),o=r(this,e),Object.defineProperty(o,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return _(e,rs),a(e,[{key:"kind",get:function(){return Xa.RTC_IDENTITY_CHANGE}},{key:"execute",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:return o=e.context,r.n=1,o.rtcIdentityChange(t.roomId,Bc.ViewerToAnchor,this.livingType);case 1:if(a=r.v,s=a.code,c=a.data,s===ke&&c){r.n=2;break}return r.a(2,{code:s});case 2:return t.initWithRoomData(c,this.traceId),t.getResourcesByUserId(t.crtUserId).length>0&&n.push(new cs),(u=null===(i=c.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value)&&t.setCDNUris(JSON.parse(u)[0]),r.a(2,{code:s,data:c})}},r,this)}))}}])}(),Jc=function(){function e(t,n,o,a,s,c,u,d,_){var l;return i(this,e),l=r(this,e,[t,n,o,exports.RTCMode.LIVE,a,s,u,d,_]),Object.defineProperty(l,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(l,"_mcuConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(l,"_roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),l._mcuConfigBuilder=new Dc(l._executeCtx,l._invoker,l._isValidResourceId.bind(l)),l}return _(e,kc),a(e,[{key:"_initRoomPKHandler",value:function(t){if(this._store.isMainRoom){var n=(r=this._roomId,i=t.roomInfo,o={},i.forEach(function(e){var t=JSON.parse(e.value),n=t.inviterRoomId,i=t.inviteeRoomId;o[r===n?i:n]=JSON.parse(e.value)}),o);this._roomPKHandler=new xc(this._invoker,n,this._context,this._runtime,this._service,this._initOptions,this,C(e,"_registerPKMsgListener",this,1).bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var r,i,o}},{key:"__innerInit",value:function(t,n,r,i,o,a){var s=this,c=Object.create(null,{__innerInit:{get:function(){return C(e,"__innerInit",s,1)}}});return K(this,void 0,void 0,p().m(function e(){var s,u,d;return p().w(function(e){for(;;)switch(e.n){case 0:if(j("livingType",r,function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO})){e.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType"}),a),e.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return e.n=2,c.__innerInit.call(this,t,n,r,i,o,a);case 2:return s=e.v,u=s.code,d=s.data,u===exports.RCRTCCode.SUCCESS&&d&&this._initRoomPKHandler(d),e.a(2,{code:u,data:d})}},e,this)}))}},{key:"__innerInitByIdentityChange",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._invoker.push(new Gc(this._livingType,e));case 1:return n=t.v,r=n.code,i=n.data,r===ke&&i?(this._initRoomPKHandler(i),this._initWithRoomData(i.offlineKickTime),this._logger.info(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomData:i}),e)):this._logger.error(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:r}),e),t.a(2,r)}},t,this)}))}},{key:"publish",value:function(t){var n=this,r=Object.create(null,{publish:{get:function(){return C(e,"publish",n,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:if(this._store.isMainRoom){e.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),e.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:return e.a(2,r.publish.call(this,t))}},e,this)}))}},{key:"unpublish",value:function(t){var n=this,r=Object.create(null,{unpublish:{get:function(){return C(e,"unpublish",n,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:if(this._store.isMainRoom){e.n=1;break}return this._logger.error(ye.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),e.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:return e.a(2,r.unpublish.call(this,t))}},e,this)}))}},{key:"_isValidResourceId",value:function(e){var t,n,r=Pn(e).userId,i=!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find(function(t){return Nn(t)===e})),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==exports.RCRTCCode.SUCCESS||!s)return i;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach(function(e){u.push.apply(u,v(e.getRemoteTracks()))}),n=u.some(function(t){return e===t.getTrackId()}),i||n}},{key:"getLivingType",value:function(){return this._livingType}},{key:"getMCUConfigBuilder",value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(ye.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"enableInnerCDN",value:function(e){return K(this,void 0,void 0,p().m(function t(){return p().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Vc(this._mcuConfigBuilder.__innerGetValues(),e)))},t,this)}))}},{key:"_resourceHandle",value:function(t,n,r,i,o){var a=this,s=Object.create(null,{_resourceHandle:{get:function(){return C(e,"_resourceHandle",a,1)}}});return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:s._resourceHandle.call(this,t,n,r,i,o);case 1:return e.a(2)}},e,this)}))}},{key:"__getCDNEnable",value:function(){var e;return!!(null===(e=this._store.getCDNUris())||void 0===e?void 0:e.enableInnerCDN)}},{key:"__getCDNPushMode",value:function(){var e;return null===(e=this._store.getCDNUris())||void 0===e?void 0:e.push_mode}},{key:"_onJoinedPKRoom",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){return p().w(function(n){for(;;)switch(n.n){case 0:this._invoker.push(new wc(e,this._roomPKHandler,t));case 1:return n.a(2)}},n,this)}))}},{key:"_getPushOtherRoomsParams",value:function(){var e=[];if(!this.isMainRoom()||!this._roomPKHandler)return e;var t=this._roomPKHandler.getJoinedPKRooms();for(var n in t){var r=t[n].getSessionId(),i=this._roomPKHandler.getPKInfo(n);if(i){var o=i.inviterUserAutoMix,a=i.inviteeUserAutoMix,s=i.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:n,sessionId:r,autoMix:c?!!o:!!a})}}return e}},{key:"getRoomPKHandler",value:function(){return this._store.isMainRoom?(this._logger.info(ye.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:Le.SUCCESSED})),{code:exports.RCRTCCode.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(ye.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:Le.SUCCESSED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_quitAllPKRoom",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n;return p().w(function(e){for(;;)switch(e.n){case 0:for(n in t=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(t[n]);this._logger.info(ye.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:Le.SUCCESSED,roomIds:Object.keys(t)}));case 1:return e.a(2)}},e,this)}))}},{key:"isMainRoom",value:function(){return this._store.isMainRoom}}])}(),Hc=function(){function e(t,n,o,a,s){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:exports.RTCMode.RTC,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return i(this,e),r(this,e,[t,n,o,c,a,s,!1,!1,Ra(),u])}return _(e,kc),a(e)}(),Kc=new(function(){return a(function e(){i(this,e),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"taskCount",{enumerable:!0,configurable:!0,writable:!0,value:0})},[{key:"checkToStart",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o,a;return p().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==this.queue.length&&!this.locked){e.n=1;break}return e.a(2);case 1:return this.locked=!0,t=this.queue.shift(),n=t.resolve,r=t.task,i=t.reject,e.p=2,e.n=3,r();case 3:o=e.v,n(o),e.n=5;break;case 4:e.p=4,a=e.v,i(a);case 5:this.locked=!1,this.checkToStart();case 6:return e.a(2)}},e,this,[[2,4]])}))}},{key:"push",value:function(e){var t=this,n=new Promise(function(n,r){t.queue.push({resolve:n,task:e,reject:r})});return this.checkToStart(),n}}])}()),qc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Kc.push(e,t)},Wc=function(){return a(function e(t,n,r){i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_liveUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_subTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:Ra()}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_subTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_fromRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._crtUserId=this._context.getCurrentId(),this._service=new Oa(n,t,r.mediaServer),this._logger=this._context.logger,this._store=new ss(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,exports.RTCMode.LIVE)},[{key:"_getReqHeaders",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._crtUserId,this._rtcToken){t.n=3;break}return t.n=1,this._context.getRTCToken(n,exports.RTCMode.LIVE,e);case 1:if(r=t.v,i=r.code,o=r.data,i===ke){t.n=2;break}return t.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:this._rtcToken=o.rtcToken;case 3:return t.a(2,{code:exports.RCRTCCode.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:this._crtUserId,RoomId:n,RoomType:exports.RTCMode.LIVE,Token:this._rtcToken,"Client-Session-Id":this._clientSessionId}})}},t,this)}))}},{key:"_clearSubscribeInfo",value:function(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,null===(e=this._pc)||void 0===e||e.destroy(),this._pc=null}},{key:"_reTryExchange",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r;return p().w(function(e){for(;;)switch(e.n){case 0:return this._fromRetry=!0,e.n=1,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);case 1:return n=e.v,(r=n.code)===exports.RCRTCCode.SUCCESS&&(null===(t=this._pc)||void 0===t||t.clearReTryExchangeTimer()),e.a(2,{code:r})}},e,this)}))}},{key:"subscribe",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return p().m(function o(){return p().w(function(o){for(;;)if(0===o.n)return o.a(2,qc(function(){return r.__subscribe(e,t,n,i)},"audience-client-sub"))},o)})()})}},{key:"__subscribe",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return p().m(function o(){var a,s,c,u,d,_,l,f,h,R,g,m,C,v;return p().w(function(o){for(;;)switch(o.n){case 0:if(r._logger.info(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:e,livingType:t,mediaType:n,subTiny:i})),s=[],!Wn(r._context.getNaviInfo())){o.n=1;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"})),o.a(2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,tracks:s});case 1:if(!r._fromRetry&&(null===(a=r._pc)||void 0===a||a.clearReTryExchangeTimer()),r._fromRetry=!1,O(e)){o.n=2;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(e)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 2:if([exports.RCLivingType.AUDIO,exports.RCLivingType.VIDEO].includes(t)){o.n=3;break}return r._logger.error("livingType is invalid: ".concat(t)),r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType: ".concat(t)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 3:if([exports.RCMediaType.AUDIO_ONLY,exports.RCMediaType.VIDEO_ONLY,exports.RCMediaType.AUDIO_VIDEO].includes(n)){o.n=4;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(n)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 4:if(!r._liveUrl||r._liveUrl===e){o.n=5;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),o.a(2,{code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s});case 5:return r._pc||(r._pc=new Qa(r._context,r._logger,r._reTryExchange.bind(r),r._crtUserId,r._store,void 0,!1),r._pc.on(Qa.__INNER_EVENT_TRACK_READY__,r._onTrackReady,r),r._pc.registerReportListener(r._reportListener),r._pc.__reportR3R4ToPolaris()),r._liveUrl=e,o.n=6,r._getReqHeaders(t);case 6:if(c=o.v,u=c.code,d=c.headers,u===exports.RCRTCCode.SUCCESS){o.n=7;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:u,msg:"getRTCToken failed"})),o.a(2,{code:u,tracks:s});case 7:return _="rc_mcu_".concat(Date.now()),l="RongCloudRTC",0===r._subTracks.length&&(r._subTracks.push(new In(r._logger,l,_),new Sn(r._logger,l,_)),r._pc.updateSubRemoteTracks(r._subTracks.slice())),o.n=8,r._pc.createOffer(!0);case 8:return f=o.v,h={sdp:f,liveUrl:e,mediaType:n,simulcast:i?Sa.TINY:Sa.NORMAL,switchstream:!1},o.n=9,r._service.broadcastSubscribe(d,h);case 9:if((R=o.v).code===exports.RCRTCCode.SUCCESS){o.n=10;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:R.code})),o.a(2,{code:R.code,tracks:s});case 10:if((g=R.data).resultCode===exports.RCRTCCode.SUCCESS){o.n=11;break}return r._logger.error(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:g.resultCode,msg:g.message})),o.a(2,{code:g.resultCode,tracks:s});case 11:return r._livingType=t,r._mediaType=n,r._subTiny=i,m=g.sdp,C=g.subscribedList,r._subscribedList=C,v=[],C.forEach(function(e){var t=e.mediaType,n=r._subTracks[t];v.push(n),n.__innerSetRemoteMuted(!0)}),r._pc.setRemoteAnswer(m.sdp),v&&r._updateTrackIdSSRCMap(m.sdp,v),r._logger.info(ye.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,liveUrl:e})),o.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:v})}},o)})()})}},{key:"_updateTrackIdSSRCMap",value:function(e,t){var n=this;t.forEach(function(t){var r=t.getTrackId(),i=Pn(r).mediaType,o=n._subscribedList.filter(function(e){return e.mediaType===i})[0].msid,a=Ws(e,o,i);n._store.setTrackIdSSRCMap(Number(a),r)})}},{key:"unsubscribe",value:function(){return K(this,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)if(0===e.n)return e.a(2,qc(function(){return t.__unsubscribe()},"audience-client-unsub"))},e)}))}},{key:"__unsubscribe",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o;return p().w(function(e){for(;;)switch(e.n){case 0:if(this._logger.info(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T,JSON.stringify({liveUrl:this._liveUrl})),null===(t=this._pc)||void 0===t||t.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl){e.n=1;break}return this._logger.warn(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),e.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return e.n=2,this._getReqHeaders();case 2:return n=e.v,r=n.headers,e.n=3,this._service.broadcastExit(r);case 3:return i=e.v,(o=i.code)!==exports.RCRTCCode.SUCCESS?this._logger.error(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:o})):(this._logger.info(ye.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),e.a(2,{code:o})}},e,this)}))}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"registerTrackEventListener",value:function(e){this._appListener=e}},{key:"_onTrackReady",value:function(e){var t,n,r=e.receiver.track,i="audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY,o=this._subTracks[i];o.__innerSetMediaStreamTrack(r);try{this._logger.info(ye.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(o.getTrackId())),null===(n=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===n||n.call(t,o)}catch(e){this._logger.error(ye.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}])}();exports.RCInnerCDNPullKind=void 0,(jc=exports.RCInnerCDNPullKind||(exports.RCInnerCDNPullKind={})).RTMP="rtmp",jc.FLV="flv",jc.HLS="hls",exports.RCInnerCDNPullIsHttps=void 0,(Fc=exports.RCInnerCDNPullIsHttps||(exports.RCInnerCDNPullIsHttps={}))[Fc.NOT_HTTPS=0]="NOT_HTTPS",Fc[Fc.HTTPS=1]="HTTPS";var zc,Yc=Object.assign(Object.assign({},xn(exports.RCResolution.W176_H144)),{frameRate:jn(exports.RCFrameRate.FPS_15)}),Qc=function(){return a(function e(t,n,r,o,a,s){var c=this,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Ra();i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_roomAnchorList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_roomRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_roomAnchorRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPulling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger,this._crtUserId=this._context.getCurrentId(),this._polarisReport=new fc(this._context,this._runtime,this._roomId,this,uc.Audience),this._reportMediaActionLogger=new lc(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new Oa(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var d=this._store=new ss(this._logger,u,t.getAppkey(),o,this._crtUserId,exports.RTCMode.LIVE),_=this._pc=new Qa(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,d,this._polarisReport,!0);this._audioLevelReport=new ts(this._store,_),_.on(Qa.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener(function(e){return K(c,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:n=this._context.decodeRtcNotify(e),r=n.time,i=n.type,o=n.roomId,1===i&&this._startPull(o,r);case 1:return t.a(2)}},t,this)}))}),this._setInitData()},[{key:"_startPull",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s;return p().w(function(n){for(;;)switch(n.n){case 0:if(!this._isPulling){n.n=1;break}return n.a(2);case 1:if(this._isPulling=!0,!(this._pullTime>t)){n.n=2;break}return this._isPulling=!1,n.a(2);case 2:return r=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),r),n.n=3,this._context.pullRTCRoomEntry(e);case 3:i=n.v,o=i.code,a=i.data,o===ke&&(this._isPulling=!1,this._pullTime=(null==a?void 0:a.syncTime)||0,s=(null==a?void 0:a.kvEntries)||[],this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(Le.SUCCESSED,", kvEntries: ").concat(JSON.stringify(s)),r),this.singalDataChange(s,e,r)),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(Le.FAILED,", code: ").concat(o),r);case 4:return n.a(2)}},n,this)}))}},{key:"_setInitData",value:function(){var e=this,t=function(e,t,n){var r=t.filter(function(e){return"RC_RTC_SESSIONID"===e.key})[0],i=r?r.value:"",o=t.filter(function(e){return"RC_ANCHOR_LIST"===e.key}).map(function(e){return JSON.parse(e.value||"[]")})[0],a=t.filter(function(e){return e.key.includes("RC_RES_")}).map(function(e){return JSON.parse(e.value||"{}")}),s=a.length?JSON.parse(a[0].mcu_uris||"[]"):[],c=[];s.forEach(function(t){var r=t.mediaType,i=t.tag,o=r===exports.RCMediaType.AUDIO_ONLY?new In(n,i,"",e):new Sn(n,i,"",e);c.push(o)});var u=[],d=[];a.forEach(function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,v(t)),t.forEach(function(e){var t=e.mediaType,r=e.tag,i=e.msid.split("_");i.pop();var o=i.join("_"),a=t===exports.RCMediaType.AUDIO_ONLY?new In(n,r,o):new Sn(n,r,o);d.push(a)})});var _=t.filter(function(e){return"RC_CDN"===e.key}).map(function(e){var t=JSON.parse(e.value||"[]");return JSON.parse(t.cdn_uris)[0]})[0];return{sessionId:i,remoteUserIds:o||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:d,remoteMCUTracks:c,remoteTracks:[].concat(d,c),CDNUris:_||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),n=t.sessionId,r=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=n,this._roomAnchorList=r,a.forEach(function(t){e._remoteTracks[t.getTrackId()]=t}),this._CDNUris=s,i.forEach(function(t){var n=t.msid.split("_")[0];e._roomAnchorRes[n]?e._roomAnchorRes[n].push(t):e._roomAnchorRes[n]=[t];var r=JSON.parse(t.uri),i=r.ssrc,o=r.resourceId;e._store.setTrackIdSSRCMap(i,o)}),o.forEach(function(t){var n=t.mediaType,r=t.tag,i=[e._roomId,r,n].join("_");e._roomRes[i]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,i)}),i.forEach(function(t){var n=Nn(t);e._roomRes[n]=t})}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed)return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}},{key:"singalDataChange",value:function(e,t,n){var r,i=this;if(t===this._roomId){var o=[],a=null===(r=e.filter(function(e){return"RC_CDN"===e.key})[0])||void 0===r?void 0:r.value;a&&this._diffCDNUris(JSON.parse(JSON.parse(a).cdn_uris)[0],n),e.forEach(function(e){var t=e.key,r=e.value,a=e.uid;if(-1!==t.indexOf("RC_RES_")){var s=JSON.parse(r||"{}"),c=JSON.parse(s.mcu_uris||"[]"),u=JSON.parse(s.uris||"[]");return o.push.apply(o,v(c)),void i._diffAnchorResource(u,a,n)}if("RC_ANCHOR_LIST"===t){var d=JSON.parse(r||"[]");i._diffAnchorList(d,n)}}),this._diffRoomResource(o,n)}else this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:Le.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),n)}},{key:"_diffAnchorList",value:function(e,t){var n=this,r=e.filter(function(e){return n._roomAnchorList.indexOf(e)<0}),i=this._roomAnchorList.filter(function(t){return e.indexOf(t)<0});r.length>0&&this._handleNewJoinedAnchor(r,t),i.length>0&&this._handleLeftedAnchor(i,t)}},{key:"_handleNewJoinedAnchor",value:function(e,t){var n;(n=this._roomAnchorList).push.apply(n,v(e)),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}},{key:"_handleLeftedAnchor",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i=this;return p().w(function(n){for(;;)switch(n.n){case 0:if(this._roomAnchorList=this._roomAnchorList.filter(function(t){return!e.includes(t)}),r=[],e.forEach(function(e){r.push.apply(r,v(i.getRemoteTracksByUserId(e))),delete i._roomAnchorRes[e]}),!r.length){n.n=2;break}return n.n=1,this.unsubscribe(r);case 1:r.forEach(function(e){return delete i._remoteTracks[e.getTrackId()]});case 2:this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e);case 3:return n.a(2)}},n,this)}))}},{key:"_diffRoomResource",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a=this;return p().w(function(n){for(;;)switch(n.n){case 0:r=[],i=[],o=[],e.forEach(function(e){var t=Nn(e),n=Pn(t),i=n.tag,s=n.mediaType,c=[a._roomId,i,s].join("_"),u=JSON.parse(e.uri).ssrc;if(a._store.setTrackIdSSRCMap(u,c),!a._remoteTracks[c]){var d=s===exports.RCMediaType.AUDIO_ONLY?new In(a._logger,i,"",a._roomId):new Sn(a._logger,i,"",a._roomId);r.push(d),a._remoteTracks[c]=d,a._roomRes[d.getTrackId()]=e}o.push(c)}),Object.keys(this._remoteTracks).forEach(function(e){o.indexOf(e)<0&&a._remoteTracks[e].isMCUTrack()&&i.push(a._remoteTracks[e])}),r.length>0&&(this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackPublish",trackIds:r.map(function(e){return e.getTrackId()})}),t),this._callAppListener("onTrackPublish",r)),i.length>0&&this._onUserUnpublish(i,"onTrackUnpublish",t);case 1:return n.a(2)}},n,this)}))}},{key:"_dealPublished",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d=this;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=e.map(Nn),o=[],a=[],t.forEach(function(t){var n=Nn(t),r=i.indexOf(n),s=Pn(n),c=s.userId,u=s.tag,_=s.mediaType,l=JSON.parse(t.uri).ssrc;d._store.setTrackIdSSRCMap(l,n),r>-1?e[r]=t:e.push(t);var p=d._remoteTracks[n];d._roomRes[n]=t,p?p.isSubscribed()&&o.push(p):(p=_===exports.RCMediaType.AUDIO_ONLY?new In(d._logger,u,c):new Sn(d._logger,u,c),d._remoteTracks[n]=p,a.push(p)),p.__innerSetRemoteMuted(0===t.state)}),!o.length){r.n=2;break}return s=o.map(function(e){return e.getTrackId()}),r.n=1,qc(function(){return d._subscribeHandle(o,!0)});case 1:c=r.v,(u=c.code)!==exports.RCRTCCode.SUCCESS&&this._logger.error(ye.L_RESUB_REPUB_RES_R,JSON.stringify({status:Le.FAILED,trackIds:s,code:u}));case 2:this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:a.map(function(e){return e.getTrackId()})}),n),this._callAppListener("onAnchorTrackPublish",a);case 3:return r.a(2)}},r,this)}))}},{key:"_dealUnpublished",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c=this;return p().w(function(r){for(;;)switch(r.n){case 0:for(i=t.map(Nn),o=e.length-1;o>=0;o-=1)a=e[o],i.includes(Nn(a))&&e.splice(o,1);return s=t.map(function(e){var t=Nn(e);return c._remoteTracks[t]}),r.n=1,this._onUserUnpublish(s,"onAnchorTrackUnpublish",n);case 1:return r.a(2)}},r,this)}))}},{key:"_dealModified",value:function(e,t,n){var r,i=e.map(Nn),o=s(t);try{for(o.s();!(r=o.n()).done;){var a=r.value,c=Nn(a);e[i.indexOf(c)].state=a.state;var u=this._remoteTracks[c];u.__innerSetRemoteMuted(0===a.state);var d=u.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:d,trackId:u.getTrackId()}),n),this._callAppListener(d,u)}}catch(e){o.e(e)}finally{o.f()}}},{key:"_diffAnchorResource",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:if(i=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),o=wn(i,e),a=o.publishedList,s=o.unpublishedList,c=o.modifiedList,!a.length){r.n=1;break}return r.n=1,this._dealPublished(i,a,n);case 1:if(!s.length){r.n=2;break}return r.n=2,this._dealUnpublished(i,s,n);case 2:c.length&&this._dealModified(i,c,n);case 3:return r.a(2)}},r,this)}))}},{key:"_onUserUnpublish",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i=this;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this.unsubscribe(e);case 1:e.forEach(function(e){i._subscribedList=i._subscribedList.filter(function(t){return t.track.getTrackId()!==e.getTrackId()}),delete i._roomRes[e.getTrackId()],e.__innerDestroy(),delete i._remoteTracks[e.getTrackId()]}),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:t,trackIds:e.map(function(e){return e.getTrackId()})}),n),this._callAppListener(t,e);case 2:return r.a(2)}},r,this)}))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}},{key:"_reTryExchange",value:function(){return K(this,void 0,void 0,p().m(function e(){var t=this;return p().w(function(e){for(;;)if(0===e.n)return e.a(2,qc(function(){return K(t,void 0,void 0,p().m(function e(){var t,n,r,i,o,a,s,c,u,d,_,l;return p().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._createSubscribeParams(this._subscribedList,{},!0);case 1:return n=e.v,r=n.reqBody,e.n=2,this._exchangeHandle(r);case 2:if((i=e.v).code===exports.RCRTCCode.SUCCESS){e.n=3;break}return e.a(2,{code:i.code});case 3:if(o=i.data,a=o.sdp,(s=o.resultCode)===exports.RCRTCCode.SUCCESS){e.n=4;break}return e.a(2,{code:s});case 4:return this._pc.clearReTryExchangeTimer(),(c=this._subscribedList.filter(function(e){return e.track.isMCUTrack()})).length>0&&(u=c[0].track.getTrackId(),d=null===(t=this._roomRes[u])||void 0===t?void 0:t.msid,_=[this._roomId,"RongCloudRTC"].join("_"),a.sdp=a.sdp.replace(new RegExp(d,"g"),_)),e.n=5,this._pc.setRemoteAnswer(a.sdp);case 5:return l=e.v,e.a(2,{code:l})}},e,this)}))},"audience-retry-exchange"))},e)}))}},{key:"_createSubscribeParams",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c=this;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._pc.createOffer(n);case 1:return i=r.v,o={resolutionInfo:[]},a={min:0,max:0},Object.keys(t).forEach(function(e){var n=t[e];[n.mediaStream,n.tinyStream].forEach(function(t,n){var r,s=1===n?[e,"tiny"].join("_"):e;i.sdp=null===(r=i.sdp)||void 0===r?void 0:r.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===n,d=u?kn(c):Yc,_=d.width,l=d.height,p=d.frameRate;o.resolutionInfo.push({trackId:c.id,simulcast:u?Sa.NORMAL:Sa.TINY,resolution:"".concat(_,"x").concat(l)});var f=$t(_,l),h=tn(p);a.min+=f.minBitrate*h,a.max+=f.maxBitrate*h}})}),s={sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map(function(e){return{simulcast:e.subTiny?Sa.TINY:Sa.NORMAL,resolution:"",uri:c._roomRes[e.track.getTrackId()].uri}})},r.a(2,{reqBody:s,dynamicBitrate:a,offer:i})}},r,this)}))}},{key:"_subscribeHandle",value:function(e){return K(this,arguments,void 0,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return p().m(function i(){var o,a,s,c,u,d;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=Date.now(),a=r?Ls.SUB:void 0,s=t._logger.createTraceId(),t._logger.info(ye.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:e.map(Zn),forceReq:n}),s),!t._assertRoomDestroyed()){i.n=1;break}return t._logger.error(ye.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),t._reportPubOrSubQualityData(o,e,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,a),i.a(2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED});case 1:if(j("tracks",e,function(){return L(e)&&e.length>0&&e.every(function(e){return e instanceof Tn||e.track instanceof Tn})},!0)){i.n=2;break}return t._logger.error(ye.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),s),t._reportPubOrSubQualityData(o,e,exports.RCRTCCode.PARAMS_ERROR,a),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t._pc.__reportR3R4ToPolaris(),t._pc.registerReportListener(t._reportListener),t._addPeerCEvent(),c=t._subscribedList.map(function(e){return Object.assign({},e)}),u=e.map(function(e){return e instanceof Tn?{track:e}:e}),d=[],u.forEach(function(e){var t=e.track.getTrackId();d.push(t);var n=c.find(function(e){return e.track.getTrackId()===t});n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:c.push(e))}),t._polarisReport.sendR2(_s.SUBSCRIBE,ls.BEGIN,d),i.a(2,t._updateSubListHandle(c,s,o,a,!0))}},i)})()})}},{key:"_addPeerCEvent",value:function(){var e=this;this._pc.on(Qa.__INNER_EVENT_TRACK_READY__,function(t){var n=t.streams[0].id,r=t.receiver.track,i=[n,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),o=e._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(r),e._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:o.getTrackId()})),e._callAppListener("onTrackReady",o)):e._logger.warn(ye.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(r.id))}),this._pc.once(Qa.__INNER_ICE_CONNECTED__,function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")},this),this._pc.on(Qa.__INNER_ICE_STATE_CHANGE__,function(t){var n=t.status,r=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,n,r)})}},{key:"_getReqHeaders",value:function(){var e=this._crtUserId;return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:exports.RTCMode.LIVE,UserId:e,"Session-Id":this._sessionId,"Client-Session-Id":this._clientSessionId}}},{key:"_exchangeHandle",value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}},{key:"_dealSubscribeResult",value:function(e,t,n){var r,i=this,o=null==t?void 0:t.map(function(e){return"".concat(e.msid,"_").concat(e.mediaType)}),a=e.filter(function(e){if(e.track.isMCUTrack()){var t=i._roomRes[e.track.getTrackId()],n="".concat(t.msid,"_").concat(t.mediaType);return o.includes(n)}return null==o?void 0:o.includes(e.track.getTrackId())}),s=null==a?void 0:a.map(function(e){return"".concat(e.track.getTrackId())}),c=e.filter(function(e){return!(null==s?void 0:s.includes(e.track.getTrackId()))}),u=function(e){var t=a.some(function(t){return t.track.getTrackId()===e});i._remoteTracks[e].__innerSetSubscribed(t)};for(var d in this._remoteTracks)u(d);return(r=this._subscribedList).splice.apply(r,[0,this._subscribedList.length].concat(v(a))),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.SUCCESSED,subSuccessTrackIds:o,failedList:c}),n),c}},{key:"_getParams",value:function(e){var t=e.map(function(e){return e instanceof Tn?{track:e}:Object.assign({},e)}),n={};return t=t.filter(function(e){var t=e.track.getTrackId();return!n[t]&&(n[t]=!0,!0)}).map(function(e){return Object.assign({},e)})}},{key:"_reportPubOrSubQualityData",value:function(e,t,n,r){r&&this._reportMediaActionLogger.reportPubOrSubQualityData(r,e,t,n,this._trackMediaMap)}},{key:"_updateSubListHandle",value:function(e,t,n,r){return K(this,arguments,void 0,function(e,t,n,r){var i=this,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return p().m(function a(){var s,c,u,d,_,l,f,h,R,g,m,C,v,T;return p().w(function(a){for(;;)switch(a.n){case 0:if(i._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(Zn),forceReq:o}),t),c=i._getParams(e),u=i._subscribedList.map(function(e){return Object.assign({},e)}),o||zs(c,u)){a.n=1;break}return i._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.SUCCESSED,msg:"repeat subscribe"}),t),a.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return i._pc.clearReTryExchangeTimer(),i._pc.updateSubRemoteTracks(c.map(function(e){return e.track})),a.n=2,i._createSubscribeParams(c,{},!1);case 2:return d=a.v,_=d.reqBody,a.n=3,i._exchangeHandle(_);case 3:if(l=a.v,u.length&&(f=[],u.forEach(function(e){f.push(e.track.getTrackId())}),null===(s=i._pc.reportParser)||void 0===s||s.clearLatestPacketsRecv(f)),e.forEach(function(e){var t=e instanceof Tn?e.getTrackId():e.track.getTrackId();i._trackMediaMap[t]=l.qualityMsList||[]}),l.code===exports.RCRTCCode.SUCCESS){a.n=4;break}return i._reportPubOrSubQualityData(n,e,l.code,r),i._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:l.code}),t),a.a(2,{code:l.code});case 4:if(h=l.data,R=h.sdp,g=h.resultCode,m=h.message,C=h.subscribedList,g===exports.RCRTCCode.SUCCESS){a.n=5;break}return i._reportPubOrSubQualityData(n,e,g,r),i._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:g,msg:m}),t),a.a(2,{code:g});case 5:return c.forEach(function(e){var t=e.track;if(t.isMCUTrack()){var n=i._roomRes[t.getTrackId()].msid,r=Pn(t.getTrackId()),o=r.tag,a=[r.userId,o].join("_");R.sdp=R.sdp.replace(new RegExp(n,"g"),a)}}),a.n=6,i._pc.setRemoteAnswer(R.sdp);case 6:if(v=a.v,i._reportPubOrSubQualityData(n,e,v,r),v===exports.RCRTCCode.SUCCESS){a.n=7;break}return i._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:v,msg:"set remote answer error"}),t),a.a(2,{code:v});case 7:return T=i._dealSubscribeResult(c,C,t),a.a(2,T.length?{code:exports.RCRTCCode.SUCCESS,failedList:T}:{code:exports.RCRTCCode.SUCCESS})}},a)})()})}},{key:"_diffCDNUris",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:if(!this._CDNUris.url||e.url){n.n=1;break}return this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoDisable"}),t),this._callAppListener("onCDNInfoDisable"),this._CDNUris=e,n.a(2);case 1:(!this._CDNUris||!this._CDNUris.url&&e.url)&&(this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoEnable",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoEnable",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),r=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,i=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,o=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(r||i||o)&&(this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoChange",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoChange",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),this._CDNUris=e;case 2:return n.a(2)}},n,this)}))}},{key:"_getCDNPlayUrl",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c,u,d,_,l,f,h,R,g,m,C;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=e.w,i=e.h,o=e.fps,a=this._initOptions.pullInnerCDNProtocol||exports.RCInnerCDNPullKind.FLV,s=this._initOptions.pullInnerCDNUseHttps===exports.RCInnerCDNPullIsHttps.NOT_HTTPS?exports.RCInnerCDNPullIsHttps.NOT_HTTPS:exports.RCInnerCDNPullIsHttps.HTTPS,this._CDNUris.url){n.n=1;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),n.a(2,{code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY});case 1:return c={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},u=[],d=this._CDNUris,_=d.w,l=void 0===_?0:_,f=d.h,l/(void 0===f?1:f)>1?(r&&u.push("w=".concat(r)),i&&u.push("h=".concat(i))):(r&&u.push("h=".concat(r)),i&&u.push("w=".concat(i))),o&&u.push("fps=".concat(o)),u.push("kind=".concat(a)),u.push("is_https=".concat(s)),h=u.join("&"),R="".concat(this._CDNUris.url,"?"),h&&(R+=h),n.n=2,this._service.getCDNResourceInfo(c,R,t);case 2:if(g=n.v,m=g.code,C=g.res,m===exports.RCRTCCode.SUCCESS){n.n=3;break}return n.a(2,{code:m});case 3:return n.a(2,{code:m,CDNPlayUrl:null==C?void 0:C.data.pull_url})}},n,this)}))}},{key:"getCDNPlayUrl",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),r),!e||Bn(e)){n.n=1;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> resolution"}),r),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(!t||Vn(t)){n.n=2;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> fps"}),r),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return i=e?xn(e):{width:null,height:null},o=i.width,a=i.height,s=t?jn(t):null,c={},o&&(c.w=o),a&&(c.h=a),s&&(c.fps=s),n.a(2,this._getCDNPlayUrl(c,r))}},n,this)}))}},{key:"subscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n=this;return p().w(function(t){for(;;)if(0===t.n)return t.a(2,qc(function(){return n._subscribeHandle(e,!1,!0)},"audience-sub"))},t)}))}},{key:"__unsubscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=Date.now(),r=Ls.UNSUB,i=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map(function(e){return e.getTrackId()})}),i),!this._assertRoomDestroyed()){t.n=1;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),i),t.a(2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED});case 1:if(j("tracks",e,function(){return L(e)&&e.length>0&&e.every(function(e){return e instanceof Tn})},!0)){t.n=2;break}return this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),i),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return o=this._subscribedList.map(function(e){return Object.assign({},e)}).filter(function(t){return e.every(function(e){return e.getTrackId()!==t.track.getTrackId()})}),this._polarisReport.sendR2(_s.SUBSCRIBE,ls.END,e.map(function(e){return e.getTrackId()})),t.a(2,this._updateSubListHandle(o,i,n,r,!1))}},t,this)}))}},{key:"unsubscribe",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n=this;return p().w(function(t){for(;;)if(0===t.n)return t.a(2,qc(function(){return n.__unsubscribe(e)},"audience-unsub"))},t)}))}},{key:"__destroy",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:if(!this._destroyed){t.n=1;break}return t.a(2);case 1:if(this._destroyed=!0,!e){t.n=2;break}return t.n=2,this._context.quitLivingRoomAsAudience(this._roomId);case 2:return t.n=3,this._service.broadcastExit(this._getReqHeaders());case 3:null===(n=this._pc)||void 0===n||n.destroy(),this._context.registerRTCSignalListener();case 4:return t.a(2)}},t,this)}))}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"getLocalTrack",value:function(e){return{}}},{key:"__onReconnected",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n;return p().w(function(e){for(;;)switch(e.n){case 0:return t=this._logger.createTraceId(),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,t),e.n=1,this._context.joinLivingRoomAsAudience(this._roomId,exports.RTCMode.LIVE);case 1:n=e.v,n.code!==ke&&this._logger.error(ye.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(Le.FAILED),t),this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(Le.SUCCESSED),t);case 2:return e.a(2)}},e,this)}))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"onAudioLevelChange",value:function(e,t){this._logger.info(ye.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._crtUserId}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getRemoteUserIds",value:function(){return this._roomAnchorList}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getRemoteTracks",value:function(){var e=this,t=[],n=[];for(var r in this._remoteTracks){if(2===n.length)break;var i=this._remoteTracks[r];i.isMCUTrack()&&n.push(i)}return this._roomAnchorList.forEach(function(n){t.push.apply(t,v(e.getRemoteTracksByUserId(n)))}),[].concat(n,t)}},{key:"getRemoteRTCTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()||e.push(n)}return e}},{key:"getRemoteMCUTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()&&e.push(n)}return e}},{key:"getCDNInfo",value:function(){return this._CDNUris.w?{resolution:"W".concat(this._CDNUris.w,"_H").concat(this._CDNUris.h),fps:"FPS_".concat(this._CDNUris.fps),CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}},{key:"getClientSessionId",value:function(){return this._clientSessionId}}])}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(zc||(zc={}));var Zc,Xc,$c=function(){function e(t){i(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isElectron",{enumerable:!0,configurable:!0,writable:!0,value:/Electron/.test(navigator.userAgent)}),this._logger=t.logger}return a(e,[{key:"_getMediaStream",value:function(e){return K(this,arguments,void 0,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"getUserMedia";return p().m(function r(){var i,o,a;return p().w(function(r){for(;;)switch(r.p=r.n){case 0:return r.p=0,i=t.setConstraintsConfig(e),r.n=1,navigator.mediaDevices[n](i);case 1:return o=r.v,r.a(2,{code:exports.RCRTCCode.SUCCESS,stream:o});case 2:if(r.p=2,a=r.v,t._logger.error(ye.L_GET_MEDIA_STREAM_E,JSON.stringify({name:a.name,message:a.message})),"Permission denied"!==a.message){r.n=3;break}return r.a(2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED});case 3:if("Permission denied by system"!==a.message){r.n=4;break}return r.a(2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED});case 4:return r.a(2,{code:"getUserMedia"===n?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED})}},r,null,[[0,2]])})()})}},{key:"_getMediaStreamErrorReason",value:function(e){var t="";return e===exports.RCRTCCode.BROWSER_PERMISSION_DENIED&&(t="Permission denied"),e===exports.RCRTCCode.SYSTEM_PERMISSION_DENIED&&(t="Permission denied by system"),t}},{key:"setConstraintsConfig",value:function(e){var t,n;if((null==e?void 0:e.audio)&&!this._isElectron){"boolean"==typeof e.audio&&(e.audio={});var r=null===(n=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===n?void 0:n.call(t);(null==r?void 0:r.noiseSuppression)&&(e.audio.noiseSuppression=!!r.noiseSuppression),(null==r?void 0:r.autoGainControl)&&(e.audio.autoGainControl=!!r.autoGainControl),(null==r?void 0:r.echoCancellation)&&(e.audio.echoCancellation=!!r.echoCancellation),this._logger.info(ye.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(r)))}return e}},{key:"createMicrophoneAudioTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:if(yn(t)){r.n=1;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(i=e._context.getCurrentId()){r.n=2;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:return r.n=3,e._getMediaStream({audio:{deviceId:(null==n?void 0:n.micphoneId)?{exact:null==n?void 0:n.micphoneId}:void 0,sampleRate:null==n?void 0:n.sampleRate,noiseSuppression:null==n?void 0:n.noiseSuppression,echoCancellation:null==n?void 0:n.echoCancellation,autoGainControl:null==n?void 0:n.autoGainControl}});case 3:if(o=r.v,a=o.stream,(s=o.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:s,msg:e._getMediaStreamErrorReason(s)})),r.a(2,{code:s});case 4:return c=a.getAudioTracks()[0],u=new gn(e._logger,t,i,c),e._logger.info(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:u.getTrackId()})),r.a(2,{code:s,track:u})}},r)})()})}},{key:"createCameraVideoTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i,o,a,s,c,u,d,_,l,f;return p().w(function(r){for(;;)switch(r.n){case 0:if(yn(t)){r.n=1;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(i=e._context.getCurrentId()){r.n=2;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:return o=Bn(null==n?void 0:n.resolution)?n.resolution:exports.RCResolution.W640_H480,a=xn(o),s=a.width,c=a.height,r.n=3,e._getMediaStream({video:{deviceId:(null==n?void 0:n.cameraId)?{exact:null==n?void 0:n.cameraId}:void 0,frameRate:jn((null==n?void 0:n.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:s,max:s},height:{ideal:c,max:c},facingMode:null==n?void 0:n.faceMode}});case 3:if(u=r.v,d=u.stream,(_=u.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:_,msg:e._getMediaStreamErrorReason(_)})),r.a(2,{code:_});case 4:return l=d.getVideoTracks()[0],r.n=5,e._applyVideoAspectRatio(l,s,c);case 5:return f=new mn(e._logger,t,i,l),e._logger.info(ye.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:f.getTrackId()})),r.a(2,{code:_,track:f})}},r)})()})}},{key:"createMicrophoneAndCameraTracks",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i,o,a,s,c,u,d,_,l,f,h,R,g,m,C;return p().w(function(r){for(;;)switch(r.n){case 0:if(o=[],yn(t)){r.n=1;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:o});case 1:if(a=e._context.getCurrentId()){r.n=2;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:o});case 2:return s=Bn(null===(i=null==n?void 0:n.video)||void 0===i?void 0:i.resolution)?n.video.resolution:exports.RCResolution.W640_H480,c=xn(s),u=c.width,d=c.height,_=null==n?void 0:n.audio,l=null==n?void 0:n.video,r.n=3,e._getMediaStream({video:{deviceId:(null==l?void 0:l.cameraId)?{exact:null==l?void 0:l.cameraId}:void 0,frameRate:jn((null==l?void 0:l.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:u,max:u},height:{ideal:d,max:d},facingMode:null==l?void 0:l.faceMode},audio:{deviceId:(null==_?void 0:_.micphoneId)?{exact:null==_?void 0:_.micphoneId}:void 0,sampleRate:null==_?void 0:_.sampleRate,noiseSuppression:null==_?void 0:_.noiseSuppression,echoCancellation:null==_?void 0:_.echoCancellation,autoGainControl:null==_?void 0:_.autoGainControl}});case 3:if(f=r.v,h=f.stream,(R=f.code)===exports.RCRTCCode.SUCCESS){r.n=4;break}return e._logger.error(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:R,msg:e._getMediaStreamErrorReason(R)})),r.a(2,{code:R,tracks:o});case 4:g=h.getTracks(),m=0;case 5:if(!(m<g.length)){r.n=9;break}if("video"!==(C=g[m]).kind){r.n=7;break}return r.n=6,e._applyVideoAspectRatio(C,u,d);case 6:o.push(new mn(e._logger,t,a,C)),r.n=8;break;case 7:o.unshift(new gn(e._logger,t,a,C));case 8:m++,r.n=5;break;case 9:return e._logger.info(ye.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:o.map(function(e){return e.getTrackId()})})),r.a(2,{code:R,tracks:o})}},r)})()})}},{key:"createScreenVideoTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){var i;return p().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,e._createScreenTracks(t,!1,ye.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,n);case 1:if((i=r.v).code!==exports.RCRTCCode.SUCCESS){r.n=2;break}return r.a(2,{code:i.code,track:i.tracks[0]});case 2:return r.a(2,i)}},r)})()})}},{key:"createScreenWithAudioTracks",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",n=arguments.length>1?arguments[1]:void 0;return p().m(function r(){return p().w(function(r){for(;;)if(0===r.n)return r.a(2,e._createScreenTracks(t,!0,ye.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,n))},r)})()})}},{key:"_createScreenTracks",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f,h,R,g;return p().w(function(i){for(;;)switch(i.n){case 0:if(yn(e)){i.n=1;break}return this._logger.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),i.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(o=this._context.getCurrentId()){i.n=2;break}return this._logger.error(n,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),i.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:if(Jn()){i.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),i.a(2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT});case 3:if(a=/macintosh|mac os x/i.test(navigator.userAgent),s=(!this._isElectron||!a)&&t,c=Bn(null==r?void 0:r.resolution)?r.resolution:exports.RCResolution.W1280_H720,!this._isElectron){i.n=5;break}return i.n=4,this._createElectronScreenStream(t,n,c,null==r?void 0:r.chromeMediaSourceId);case 4:g=i.v,i.n=7;break;case 5:return i.n=6,this._createWebScreenStream(t,c,null==r?void 0:r.frameRate);case 6:g=i.v;case 7:if(d=(u=g).stream,(_=u.code)===exports.RCRTCCode.SUCCESS){i.n=8;break}return this._logger.error(n,JSON.stringify({status:Le.FAILED,code:_,msg:this._getMediaStreamErrorReason(_)})),i.a(2,{code:_});case 8:return l=d.getVideoTracks()[0],f=new Cn(this._logger,e,o,l),h=[f],s&&(R=d.getAudioTracks()[0])&&h.push(new vn(this._logger,e,o,R)),this._logger.info(n,JSON.stringify({status:Le.SUCCESSED,trackIds:h.map(function(e){return e.getTrackId()})})),i.a(2,{code:_,tracks:h})}},i,this)}))}},{key:"_createElectronScreenStream",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_,l,f;return p().w(function(i){for(;;)switch(i.n){case 0:if(s=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&s&&e&&this._logger.warn(t,JSON.stringify({status:Le.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),c=(!this._isElectron||!s)&&e,!this._isElectron||P(r)||O(r)){i.n=1;break}return this._logger.error(t,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return u=xn(n),d=u.width,_=u.height,l={mandatory:{chromeMediaSourceId:r,chromeMediaSource:"desktop",minWidth:d,maxWidth:d,minHeight:_,maxHeight:_}},!r&&this._isElectron&&(null===(o=l.mandatory)||void 0===o||delete o.chromeMediaSourceId),f=null,c&&this._isElectron&&(null===(a=l.mandatory)||void 0===a||delete a.chromeMediaSourceId,f={mandatory:{chromeMediaSource:"desktop"}}),i.a(2,this._getMediaStream({video:l,audio:f||c},"getUserMedia"))}},i,this)}))}},{key:"_createWebScreenStream",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s;return p().w(function(r){for(;;)if(0===r.n)return i=xn(t),o=i.width,a=i.height,s={frameRate:jn(n||exports.RCFrameRate.FPS_15),width:o,height:a},r.a(2,this._getMediaStream({video:s,audio:e},"getDisplayMedia"))},r,this)}))}},{key:"createLocalAudioTrack",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:if(yn(e)){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind){n.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),n.a(2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED});case 2:if(r=this._context.getCurrentId()){n.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 3:return i=new _n(this._logger,e,r,t),this._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:i.getTrackId()})),n.a(2,{code:exports.RCRTCCode.SUCCESS,track:i})}},n,this)}))}},{key:"createLocalVideoTrack",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i;return p().w(function(n){for(;;)switch(n.n){case 0:if(yn(e)){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(t&&t instanceof MediaStreamTrack&&"video"===t.kind){n.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),n.a(2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED});case 2:if(r=this._context.getCurrentId()){n.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 3:return i=new ln(this._logger,e,r,t),this._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:i.getTrackId()})),n.a(2,{code:exports.RCRTCCode.SUCCESS,track:i})}},n,this)}))}},{key:"_validateCreateLocalFileTracks",value:function(e,t){if(!yn(e))return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!Gn())return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var n=t instanceof File?URL.createObjectURL(t):t;return D(n)||/^blob:/.test(n)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:n}:(this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}},{key:"createLocalFileTracks",value:function(t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s=this;return p().w(function(i){for(;;)switch(i.n){case 0:if((o=this._validateCreateLocalFileTracks(t,n)).code===exports.RCRTCCode.SUCCESS){i.n=1;break}return i.a(2,o);case 1:return a=this._context.getCurrentId(),i.a(2,new Promise(function(n){var i=document.createElement("video");(null==r?void 0:r.withoutAudio)&&(i.muted=!0),i.onloadedmetadata=function(){var o,c=[];try{var u=i.mozCaptureStream?"mozCaptureStream":"captureStream";o=i[u]()}catch(e){s._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),n({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:c})}var d=m(e.getTracksWithOptions(o,r),2),_=d[0],l=d[1];_&&c.push(new Rn(s._logger,t,a,_,i)),l&&c.push(new hn(s._logger,t,a,l,i)),0===c.length&&(i.pause(),i.src=""),i.onerror=null,s._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:c.map(function(e){return e.getTrackId()})})),n({code:exports.RCRTCCode.SUCCESS,tracks:c})},i.onerror=function(){s._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),n({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:[]})},i.src=o.url,i.loop=!0,i.play()}))}},i,this)}))}},{key:"createLocalTracks",value:function(t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d;return p().w(function(i){for(;;)switch(i.n){case 0:if(o=[],yn(t)){i.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),i.a(2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:o});case 1:if(n instanceof MediaStream){i.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:o});case 2:if(a=this._context.getCurrentId()){i.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),i.a(2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:o});case 3:return s=e.getTracksWithOptions(n,r),c=m(s,2),u=c[0],d=c[1],u&&o.push(new _n(this._logger,t,a,u)),d&&o.push(new ln(this._logger,t,a,d)),this._logger.info(ye.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:o.map(function(e){return e.getTrackId()})})),i.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:o})}},i,this)}))}},{key:"_applyVideoAspectRatio",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i=e.getSettings(),o=i.width,a=i.height,o!==t||a!==n){r.n=1;break}return r.a(2);case 1:return s=t/n>=1?{width:{ideal:o,max:o}}:{height:{ideal:a,max:a}},r.p=2,r.n=3,e.applyConstraints(Object.assign(Object.assign({},s),{aspectRatio:{ideal:t/n}}));case 3:this._logger.info(ye.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:Le.SUCCESSED,msg:"apply aspectRatio success -> ".concat(t," / ").concat(n)})),r.n=5;break;case 4:r.p=4,c=r.v,this._logger.warn(ye.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:Le.FAILED,msg:"apply aspectRatio error -> ".concat(JSON.stringify(c))}));case 5:return r.a(2)}},r,this,[[2,4]])}))}}],[{key:"getTracksWithOptions",value:function(e,t){var n=[];return n[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],n[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],n}}])}(),eu=function(){return a(function e(n){i(this,e),Zc.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});var r=t.ProtoBuf.loadProto(n);this.pbModules=r.build("Modules").probuf},[{key:"encode",value:function(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}},{key:"decode",value:function(e,t){try{var n=this.pbModules[e].decode(t);return q(this,Zc,"m",Xc).call(this,n)}catch(t){var r="name: ".concat(e,", stack: ").concat(t.stack);throw null===console||void 0===console||console.error("pb decode error!",r),t}}}])}();Zc=new WeakSet,Xc=function e(n){var r,i=this;if(n instanceof Array)return n.map(function(t){return q(i,Zc,"m",e).call(i,t)});if(r=n,"[object Object]"!==Object.prototype.toString.call(r))return n;if(n instanceof t.ProtoBuf.ByteBuffer)return n.toArrayBuffer();if(n instanceof t.ProtoBuf.Long)return n.toNumber();var o={};return Object.keys(n).forEach(function(t){o[t]=q(i,Zc,"m",e).call(i,n[t])}),o};var tu,nu,ru,iu,ou,au,su;!function(e){e[e.PERSON=1]="PERSON",e[e.PERSONS=2]="PERSONS",e[e.GROUP=3]="GROUP",e[e.TEMPGROUP=4]="TEMPGROUP",e[e.CUSTOMERSERVICE=5]="CUSTOMERSERVICE",e[e.NOTIFY=6]="NOTIFY",e[e.MC=7]="MC",e[e.MP=8]="MP",e[e.ULTRAGROUP=10]="ULTRAGROUP"}(tu||(tu={})),function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(nu||(nu={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(ru||(ru={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(iu||(iu={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(ou||(ou={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(au||(au={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(su||(su={})),new eu("package Modules;\nmessage probuf {\n message SetUserStatusOutput {\n optional int32 nothing=1;\n }\n message GetUserStatusInput {\n optional int32 nothing=1;\n }\n message GetUserStatusOutput {\n optional string status=1;\n optional string subUserId=2;\n }\n message SubUserStatusInput {\n repeated string userid =1;\n }\n message SubUserStatusOutput {\n optional int32 nothing=1;\n }\n message VoipDynamicInput {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n message VoipDynamicOutput {\n required string dynamicKey=1;\n }\n message NotifyMsg {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message SyncRequestMsg {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n optional int64 endTime = 8;\n optional bool compressioEnabled = 9;\n }\n message UpStreamMessage {\n required int32 sessionId = 1;\n required string classname = 2;\n required string content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13;\n optional string systemId = 16;\n optional string senderPortrait = 21;\n optional int64 optionBits = 22;\n }\n message PushExtra {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message DownStreamMessages {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n optional int64 systemTime = 5;\n optional int64 credibleStartTime = 6;\n optional int64 credibleEndTime = 7;\n optional bool compressioEnabled = 8;\n optional bytes compressedData = 9;\n }\n message ChrmDownStreamMessages {\n repeated bytes list = 1;\n required int64 syncTime = 2;\n optional bool compressioEnabled = 3;\n optional bytes compressedData = 4;\n }\n message DownStreamMessage {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required string content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19;\n optional int64 extStatus = 20;\n repeated string toUserIds = 21;\n optional int32 groupUnpush = 22;\n optional int64 optionBits = 23;\n optional string convertExt = 24;\n optional ExtMsgData extMsgData = 25;\n }\n message ExtMsgData {\n optional int64 seqId = 1;\n optional int64 sendTime = 2;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n IMAGE = 1;\n AUDIO = 2;\n VIDEO = 3;\n FILE = 4;\n SIGHT = 5;\n COMBINE_HTML = 6;\n }\n message GetQNupTokenInput {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5;\n optional string ext = 6;\n optional int64 size = 7;\n optional int32 ipType = 8;\n }\n message GetQNdownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message GetDownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4;\n optional int64 size = 5;\n optional int32 ipType = 6;\n }\n message GetQNupTokenOutput {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24;\n optional string ossConfig = 25;\n }\n message GetQNdownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message GetDownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n GROUP_SUCCESS = 0x00;\n GROUP_FAILURE = 0x01;\n }\n message ChrmInput {\n required int32 nothing = 1;\n optional string extra = 2;\n }\n message ChrmOutput {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message ChrmPullMsg {\n required int64 syncTime = 1;\n required int32 count = 2;\n optional int32 pullMsgType = 3;\n optional bool compressioEnabled = 4;\n }\n message ChrmPullMsgNew {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message RelationQryInput {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n optional bool isEraseMsgContent = 5;\n optional int64 endTime = 6;\n optional bool compressioEnabled = 7;\n optional int32 qryType = 8;\n }\n message RelationsOutput {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;\n optional int64 pullTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\n }\n message RelationInfo {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;\n optional int64 versionTime = 7;\n optional int64 remindCount = 8;\n optional int32 busChannelType = 9;\n optional UnreadMsgInfo msgInfo = 10;\n optional int32 remindMeCount = 11;\n }\n message UnreadMsgInfo {\n required string msgId = 1;\n required int64 msgTime= 2;\n optional int32 remindType= 3;\n optional string className = 4;\n }\n message QryRemindListReq {\n required string groupId = 1;\n optional string busChannel = 2;\n optional int64 msgTime = 3;\n optional int32 size = 4;\n }\n message QryRemindListResp {\n repeated UnreadMsgInfo msgInfo = 1;\n }\n message RelationInfoReadTime {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message CleanHisMsgInput {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4;\n }\n message CleanMsgBatchReq {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6; \n optional bytes compressedData = 7;\n }\n message QueryChatRoomInfoInput {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message QueryChatRoomInfoOutput {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput {\n required string id = 1;\n }\n\n message MPFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message HistoryMsgInput {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5;\n optional bool compressioEnabled = 6;\n optional bool ignoreCmd = 10;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6;\n optional bytes compressedData = 7;\n }\n message SessionsAttQryInput {\n required int32 nothing = 1;\n }\n message SessionsAttOutput {\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message SessionMsgReadInput {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;\n }\n message SessionMsgReadOutput {\n optional int32 nothing=1;\n }\n message DeleteSessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message SessionInfo {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 unreadCount = 3;\n optional string busChannel = 4;\n }\n message QuerySessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message QuerySessionsOutPut {\n repeated SessionInfo sessions = 1;\n }\n message DeleteSessionsOutput {\n optional int32 nothing=1;\n }\n message RelationDelBatchReq {\n repeated RelationOpInput relation = 1;\n optional bool cleanMsg = 2;\n }\n message RelationOpInput {\n required string conversationId = 1;\n required ChannelType conversationType = 2;\n optional string busChannel = 3;\n }\n message DeleteMsgInput {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4;\n }\n message DeleteMsg {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message SetChrmKV {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message SetChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message DeleteChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ChrmKVOutput {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ChrmKVSOutput {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ChrmKVSOutputEntity {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message QueryChrmKV {\n required int64 timestamp = 1;\n optional bool compressioEnabled = 2;\n }\n message SetUserSettingInput {\n required int64 version=1;\n required string value=2;\n optional bool ignoreVersion = 3;\n }\n message SetUserSettingOutput {\n required int64 version=1;\n required bool reserve=2;\n optional bool updateVersion = 3;\n }\n message PullUserSettingInput {\n required int64 version=1;\n optional bool reserve=2;\n optional int32 ipType = 3;\n }\n message PullUserSettingOutput {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message SessionReq {\n required int64 time = 1;\n }\n message SessionStates {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message SessionState {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;\n }\n message SessionStateItem {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n optional int64 time = 4;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n AutoTrans = 4;\n }\n message SessionStateModifyReq {\n required int64 version=1;\n repeated SessionState state= 2;\n optional bool ignoreVersion = 3;\n }\n message GroupUnpushQuery {\n optional string busChannel = 1;\n }\n message GroupUnpushSet{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message GroupUnpushResult {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message SessionStateModifyResp {\n required int64 version=1;\n optional bool updateVersion = 2;\n }\n message TypeUnpushInput {\n required ChannelType type = 1;\n required int64 version = 2;\n required int32 unpushLevel = 3;\n optional bool ignoreVersion = 4;\n }\n message TypeUnpushOutput {\n required int64 version = 1;\n optional bool updateVersion = 2;\n }\n message GrpReadReceiptMsg {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryReq {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message ReadReceipt {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string channelId = 3;\n optional int32 readType =4 ;\n repeated string msgIds= 5 ;\n optional string fromId = 6;\n }\n message QueryReceiptReq {\n optional string targetId = 1;\n optional string busChannel =2;\n optional int32 type = 3;\n repeated string msgIds = 4;\n optional int32 qryType = 5;\n optional int32 order =6;\n optional bool compress = 7;\n optional int32 readType = 8;\n optional int32 pageType = 9; \n optional int32 pageSize = 10;\n optional string pageToken = 11;\n repeated string users = 12;\n }\n message QueryReceiptBatchReq {\n repeated QueryReceipt items = 1;\n optional bool compress = 2;\n }\n message QueryReceipt {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 type = 3;\n repeated string msgIds = 4;\n }\n message ReceiptResp {\n repeated QueryReceiptRespItem resp = 1;\n optional bool compress = 2;\n optional bytes compressData = 3;\n optional string pageToken = 4;\n }\n message QueryReceiptBatchResp {\n repeated QueryReceiptBatchRespItem item = 1;\n optional bool compress = 2;\n optional bytes compressData = 3;\n }\n\n message QueryReceiptBatchRespItem {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 type = 3;\n repeated QueryReceiptRespItem msg = 4;\n }\n message QueryReceiptRespItem {\n optional string msgId = 1;\n optional int64 msgTime = 2;\n optional int32 totalCnt = 3;\n optional int64 readCnt = 4;\n repeated ReceiptUser readUser = 5;\n repeated string unreadList = 6;\n optional int64 unreadCnt = 7;\n repeated ReceiptUser unreadUser = 8;\n }\n message GrpReadReceiptQryResp {\n required int32 totalMemberNum = 1;\n repeated GrpMsgReadUser list = 2;\n }\n message GrpMsgReadUser {\n required int64 readTime = 1;\n required string userId = 2;\n }\n message SessionTagAddInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n optional bool ignoreVersion = 3;\n }\n message SessionTagItem {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message SessionTagDelInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n optional bool ignoreVersion = 3;\n }\n message SessionDisTagReq {\n repeated string tagId=1;\n }\n message UserSettingNotification {\n required int64 version=1;\n required bool reserve=2;\n }\n message ReportSDKInput {\n required string sdkInfo=1;\n }\n message ReportSDKOutput {\n optional int32 nothing=1;\n }\n message UltraGrpPullSes {\n required int64 syncTime = 1;\n optional bool isEraseMsgContent = 2;\n }\n message UltraGrpPullMsg {\n required int64 syncTime = 1;\n optional bool compressioEnabled = 2;\n }\n message MsgChangeReq {\n required string fromUserId = 1;\n required string targetId = 2;\n required ChannelType type = 3;\n required string msgUID = 4;\n required int64 msgTime = 5;\n optional string busChannel = 6;\n optional string content = 7;\n }\n message ModifyMsgResp {\n optional int64 modifyTime = 1;\n optional DownStreamMessage msg = 2;\n }\n message QueryMsgChange {\n required int64 syncTime = 1;\n optional int32 needCompress = 2;\n optional int64 onlineTime = 3;\n optional string targetId = 4;\n }\n message EventChangeList {\n repeated EventChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n optional string targetId = 4;\n optional bool isCompress = 5 ;\n }\n message EventChange {\n optional string businessId = 1;\n optional ChannelType channelType = 2;\n optional int64 time = 3;\n optional int32 changeType = 4;\n optional string originalId = 5;\n optional int64 originalTime = 6;\n optional string secondaryId = 7;\n optional bool isAdmin = 8;\n optional bool additionalMark = 9; \n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 secondaryType = 12;\n optional bool isRemindMe = 13;\n repeated string extIds = 14;\n optional int32 remindType = 15;\n optional bytes eventData = 16;\n }\n message MsgChangeList {\n repeated MsgChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n }\n message MsgChange {\n required string targetId = 1;\n required ChannelType type = 2;\n required int64 time = 3;\n required int32 changeType = 4;\n required string msgUID = 5;\n required int64 msgTime = 6;\n optional string busChannel = 7;\n optional bool isAdmin = 8;\n optional bool isDel = 9;\n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12;\n optional bool isRemindMe = 13;\n repeated string userGroupIds = 14;\n optional int32 remindType = 15;\n }\n message MsgQuery {\n required string targetId = 1;\n required ChannelType type = 2;\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo {\n required int64 msgTime = 1;\n required string msgUID = 2;\n optional string busChannel = 3;\n }\n message MsgQueryAck {\n repeated DownStreamMessage list = 1;\n repeated string notExistMsgId = 2;\n }\n message OperateStatus {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 opType = 3;\n optional string busChannel = 4;\n }\n message OperateStatusNotify {\n optional ChannelType type = 1;\n optional int64 notifyType = 2;\n repeated OperateInfo info = 3 ;\n repeated OperateSummary summary = 4 ;\n }\n message OperateInfo {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional string userId = 3;\n optional int32 opType = 4;\n optional int64 optime = 5;\n }\n \n message OperateSummary {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 count = 3;\n optional int32 opType = 4;\n }\n\n message SetRtcRoomIdInput {\n required string rtcRoomId= 1;\n }\n message SetRtcRoomIdOutput {\n required int32 nothing = 1;\n }\n message CallInfoUpStream {\n required string key= 1;\n required string dataContent=2;\n }\n message CallInfoDownStream {\n required string key= 1;\n required string dataContent=2;\n required int64 maxTime=3;\n }\n message KvInput {\n required int64 syncTime = 1;\n }\n message KvOutput {\n required int64 maxTime = 1;\n repeated KvInfo info = 2;\n }\n message KvInfo {\n required string key =1;\n required string value =2;\n }\n message ReadReceiptMsg {\n required string targetId = 1;\n required ChannelType type = 2;\n optional string busChannel = 3;\n optional string startMsgId = 4;\n optional string endMsgId = 5;\n }\n message ReceiptQryReq {\n required string msgId = 1;\n optional string busChannel = 2;\n required string targetId = 3;\n }\n message QueryReceiptResp {\n optional int32 num = 1;\n repeated ReceiptUser list = 2;\n optional int32 readCnt = 3;\n }\n message ReceiptUser {\n optional int64 receiptTime = 1;\n optional string userId = 2;\n optional string name = 3;\n optional string portrait = 4;\n optional bool mentioned= 5;\n }\n message ReceiptCntQryReq {\n optional ChannelType type = 1;\n optional string channelId = 2;\n optional string busChannel = 3;\n repeated string msgId = 4;\n }\n message ReceiptCntQryResp {\n repeated MsgReadCnt result= 1;\n }\n\n message MsgReadCnt {\n optional string msgId = 1;\n optional int32 cnt = 2;\n optional int32 tmn = 3;\n }\n message UpdateUserSubReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n optional int32 opType = 3;\n optional int32 expiry = 4;\n }\n message UserSubDetail {\n optional string subUserId = 1;\n }\n message UpdateUserSubResp {\n repeated UserSubDetail subUsers = 1;\n optional int64 subTime = 2;\n }\n message PullUserSubReq {\n optional int64 version = 1;\n optional string pageToken = 2;\n }\n message PUllUserSubResp {\n repeated UserSubList list = 1;\n optional int64 version = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message UserSubList {\n repeated UserSubDetail subUsers = 1;\n optional int32 subType = 2;\n optional int64 subTime = 3;\n optional int32 expiry = 4;\n optional int32 opType = 5;\n }\n message PullSubDataReq {\n optional int64 versionTime = 1;\n optional bool needAllData = 2;\n optional string pageToken = 3;\n }\n message PullSubDataResp {\n repeated SubDataDetail list = 1;\n optional int64 versionTime = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message SubDataDetail {\n optional string statusStr = 1;\n optional string subUserId = 2;\n repeated SubData data = 3;\n optional int32 subType = 4;\n }\n\n message SubData {\n optional int32 platformInfo = 1;\n optional int32 value = 2;\n optional int64 versionTime = 3;\n }\n message QrySubDataReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n }\n message UserProfile {\n optional int64 version = 1;\n optional string userId = 2;\n repeated ProfileInfo userProfile = 3;\n repeated ProfileInfo userExtProfile = 4;\n }\n message ProfileInfo {\n optional string key = 1;\n optional string value = 2;\n }\n message SetUserProfileResp {\n optional int64 version = 1;\n optional string key = 2;\n repeated string censorFailedFields = 3;\n }\n message PullUserProfileReq {\n repeated string userId = 1;\n }\n message UserProfiles {\n repeated UserProfile UserProfile = 1;\n }\n message UserProfileInput {\n required int32 nothing = 1;\n }\n message UserProfilePermission {\n optional int32 permission = 1;\n }\n message UserProfileOutput {\n required int32 nothing = 1;\n }\n message SearchUserProfile {\n optional string uniqueId = 1;\n }\n message ChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated ProfileInfo settingProfile = 3;\n repeated ProfileInfo extProfile = 4;\n optional ChannelBaseInfo baseInfo = 5;\n repeated string users = 6;\n }\n\n message ChannelBaseInfo {\n optional string creatorId = 1;\n optional string ownerId = 2;\n optional int64 createTime = 3;\n optional int32 memberCount = 4;\n }\n\n message ChannelsOutput {\n optional int64 operateTime = 1;\n optional int32 flag = 2;\n optional string msg = 3;\n optional int32 processCode = 4;\n optional ChannelsJoinedInfo channelInfo = 5;\n repeated ChannelsUserInfo userInfos = 6;\n optional FriendInviteInfo friendInviteInfo = 7;\n optional FriendUserInfo friendUserInfo = 8;\n repeated string censorFailedFields = 9;\n }\n\n message MultiChannels {\n optional ChannelType type = 1;\n repeated ChannelsInput list = 2;\n }\n\n message ModifyChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional QuitChannelsSetting settingInfo = 3;\n repeated string users = 4;\n optional int32 operateType = 5;\n }\n\n message QuitChannelsSetting {\n optional bool isQuit = 1;\n optional bool isDelBan = 2;\n optional bool isDelWhite = 3;\n optional bool isDelAttention = 4;\n }\n\n message ChannelsQueryInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional ChannelsPageParam page = 3;\n repeated string ids = 4;\n optional int32 roleType = 5;\n }\n\n message ChannelsPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n optional bool hasNext = 3 ;\n optional int32 total = 4 ;\n optional int32 order = 5 ;\n }\n\n message ChannelsListResult {\n optional int32 listType = 1;\n optional bytes result = 2;\n optional ChannelsPageParam page = 3;\n }\n \n message ChannelsInviteStatusInfos {\n repeated ChannelsInviteStatusInfo list = 1;\n }\n \n message ChannelsUserInfos {\n repeated ChannelsUserInfo list = 1;\n }\n \n message ChannelsJoinedInfos {\n repeated ChannelsJoinedInfo list = 1;\n }\n\n message ChannelsUserInfo {\n optional string userId = 1;\n optional ChannelsUserExtInfo ext = 2;\n optional int64 opTime = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n\n message ChannelsUserExtInfo {\n optional int32 role = 1;\n optional int64 joinTime = 2;\n optional string channelNickName = 3;\n optional string additional = 4;\n optional string remarkName = 5;\n optional bool isBan = 6;\n optional int64 banEndTime = 7;\n }\n\n message ChannelsMemberUpdateInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional string userId = 3;\n optional string channelNickName = 4;\n optional string additional = 5;\n optional int32 operateType = 6;\n }\n message ChannelsJoinedInfo {\n optional string targetId = 1;\n repeated ProfileInfo settingProfile = 2;\n repeated ProfileInfo extProfile = 3;\n optional ChannelBaseInfo baseInfo = 4;\n optional ChannelsUserExtInfo userInfo = 5;\n }\n message ChannelsInviteStatusInfo {\n optional string targetId = 1;\n optional ChannelsUserInfo joinUserInfo = 2;\n optional ChannelsUserInfo inviterInfo = 3;\n optional int32 status = 4;\n optional int32 directionType = 5;\n optional int32 joinType = 6;\n optional string detail = 7;\n optional int64 applyTime = 8;\n optional ChannelsUserInfo processInfo = 9;\n optional int64 processTime = 10;\n }\n message ChannelsMemberResponseInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 optType = 3;\n optional int32 optResult = 4;\n optional string joinUserId = 5;\n optional string inviterId = 6;\n optional string detail = 7;\n }\n message ChannelsMembersInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string userIds = 3;\n }\n message FriendInput {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string info = 3;\n }\n message FriendsOutput {\n repeated FriendOutput list = 1;\n }\n message FriendOutput {\n optional string userId = 1;\n optional int64 operateTime = 2;\n optional string flag = 3;\n }\n message FriendsInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendsCheckOutput {\n repeated FriendCheckOutput list = 1;\n }\n\n message FriendCheckOutput {\n optional string targetId = 1;\n optional int32 status = 2;\n }\n message FriendProfileInput {\n optional string targetId = 1;\n optional string remarkName = 2;\n repeated ProfileInfo extProfile = 3;\n }\n message FriendProfileOutput {\n repeated string censorFailedFields = 1;\n }\n message FriendQueryInput {\n optional int32 queryType = 1;\n optional ChannelsPageParam page = 2;\n optional int32 friendType= 3;\n }\n message FriendUserInfo {\n optional string userId = 1;\n optional int64 relationTime = 2;\n optional int32 friendType = 3;\n optional int32 flag = 4;\n optional string remarkName = 5;\n optional string name = 6;\n optional string portraitUrl = 7;\n repeated ProfileInfo extProfile = 8;\n \n }\n message FriendInviteInfo {\n optional string userId = 1;\n optional string name = 2;\n optional string portraitUrl = 3;\n optional int32 type = 4;\n optional int32 status = 5;\n optional int64 operateTime = 6;\n optional string info = 7;\n optional int32 friendType = 8;\n }\n message FriendsListInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendLevelSet {\n optional int32 level = 1;\n }\n\n message FriendPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n }\n message FriendUserInfos {\n repeated FriendUserInfo list = 1;\n }\n\n message FriendInviteInfos {\n repeated FriendInviteInfo list = 1;\n }\n \n message FriendApplyEvent {\n optional int32 applyType = 1;\n optional int32 friendType = 2;\n optional string info = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n message UpdateChannnelInfo {\n optional ChannelsJoinedInfo channelInfo = 1;\n optional ChannelsUserInfo userInfo = 2;\n }\n message UpdateUserInfo {\n optional ChannelsUserInfo updatedUserInfo = 1;\n optional ChannelsUserInfo optUserInfo = 2;\n }\n message ChannelApplyInfo {\n repeated ChannelsInviteStatusInfo statusInfo = 1;\n }\n message ChannelEventData {\n optional ChannelsUserInfo optUserInfo = 1;\n optional ChannelsJoinedInfo channelInfo = 2;\n repeated ChannelsUserInfo userInfos = 3;\n optional ChannelsJoinedInfo channelFullInfo = 4;\n }\n message FriendTypeChangeEvent {\n optional string friendId = 1;\n optional int32 friendType = 2;\n }\n message FriendUpdateEvent {\n optional string remarkname = 1;\n repeated ProfileInfo extProfile = 2;\n }\n message AddUnpushPeriodInput {\n required string startTime = 1;\n required int32 spanMinutes = 2;\n optional int32 level = 3;\n optional string timezone = 4;\n }\n message DeleteUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodOutput {\n required int32 isUnpush = 1;\n optional string startTime = 2;\n optional int32 spanMinutes = 3;\n optional int32 level = 4;\n optional string timezone = 5;\n }\n message RelationDel {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string busChannel = 3;\n optional bool cleanMsg = 4;\n }\n message MsgReadEvent {\n optional string msgId = 1;\n optional int64 msgTime = 2;\n optional int32 totalCnt = 3;\n optional int32 readCnt = 4;\n optional int32 unreadCnt = 5;\n repeated ReceiptUser readList =6;\n }\n message ConvertMsgInput {\n optional int32 businessType = 1;\n optional bytes businessInfo = 2;\n }\n message SpeechToTextInfo {\n optional string msgId = 1;\n optional string objectName = 2;\n optional string content = 3;\n optional int32 sampleRate = 4;\n optional int32 channelNumber = 5;\n optional string format = 6;\n optional string extra = 7;\n }\n message ConvertMsgOutput {\n optional int32 businessType = 1;\n optional bytes businessResult = 2;\n }\n message SpeechToTextResult {\n optional string result = 1;\n optional string message = 2;\n }\n message TransReq {\n repeated TransInfo transInfos = 1;\n optional int32 model = 2;\n optional bool forceTrans = 3;\n }\n message TransResp {\n repeated TransResult results = 1;\n optional int32 model = 2;\n }\n message TransInfo {\n optional string messageUID = 1;\n optional int32 transType = 2;\n optional string text = 3;\n optional string transFileUrl = 4;\n optional string sourceLan = 5;\n optional string targetLan = 6;\n optional int32 inputSource = 7;\n }\n message TransResult {\n optional string messageUID = 1;\n optional string transResult = 2;\n optional string sourceLan = 3;\n optional string targetLan = 4;\n optional int32 code = 5;\n optional int32 inputSource = 6;\n }\n message PullModifyMsgReq { \n optional int64 pullVersion = 1;\n optional bool compress = 2;\n repeated int32 modifyType = 3;\n }\n message PullModifyMsgResp {\n repeated ModifyMsg msg = 1;\n optional int64 nextVersion = 2;\n optional bool finished = 3;\n optional bool compress = 4;\n optional bytes compressedData = 5;\n }\n message ModifyMsg {\n optional int32 modifyType = 1;\n optional DownStreamMessage msg = 2;\n }\n enum JoinType {\n KICK = 0;\n REFUSE = 1;\n COEXIST = 2;\n }\n enum TargetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message SetUserStatusInput {\n optional int32 status=1;\n }\n message MCFollowInput {\n required string state = 1;\n }\n message RtcQueryListInput {\n optional int32 order=1;\n }\n message RtcKeyDeleteInput {\n repeated string key=1;\n }\n message RtcValueInfo {\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo {\n required string userId=1;\n repeated RtcValueInfo userData=2;\n }\n message RtcUserListOutput {\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4;\n repeated RtcKVEntity entries = 5;\n optional int64 syncTime = 6;\n optional int32 offlineKickTime = 7;\n }\n message RtcRoomInfoOutput {\n optional string roomId = 1;\n repeated RtcValueInfo roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message RtcInput {\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4;\n optional IdentityChangeType identityChangeType = 5;\n optional JoinType joinType = 6;\n repeated RtcValueInfo innerDatas = 7;\n repeated RtcValueInfo outerDatas = 8;\n }\n message RtcQryOutput {\n repeated RtcValueInfo outInfo=1;\n }\n message RtcDataInput {\n required bool interior=1;\n required TargetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message RtcSetDataInput {\n required bool interior=1;\n required TargetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message RtcUserSetDataInput {\n repeated RtcValueInfo valueInfo = 1;\n required string objectName = 2;\n repeated RtcValueInfo content = 3;\n }\n message RtcQryInput {\n required bool isInterior=1;\n required TargetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput {\n repeated string key=1;\n required bool isInterior=2;\n required TargetType target=3;\n }\n message RtcOutput {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message RtcTokenOutput {\n required string rtcToken=1;\n }\n message RtcSetOutDataInput {\n required TargetType target=1;\n repeated RtcValueInfo valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message RtcQryUserOutDataInput {\n repeated string userId = 1;\n }\n message RtcUserOutDataOutput {\n repeated RtcUserInfo user = 1;\n }\n message RtcNotifyMsg {\n required int32 type= 1;\n optional int64 time= 2;\n optional string roomId=3;\n }\n message RtcPullKV {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message RtcKVOutput {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType {\n AnchorToViewer = 1;\n ViewerToAnchor = 2;\n }\n message RtcQueryUserJoinedInput {\n required string userId = 1;\n }\n message RtcJoinedInfo {\n required string deviceId = 1;\n required string roomId = 2;\n optional int64 joinTime = 3;\n }\n message RtcQueryUserJoinedOutput {\n repeated RtcJoinedInfo info = 1;\n }\n message RtcViewerJoinedOutput {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;\n optional int64 syncTime = 3;\n }\n message RtcInviteInput {\n required string invitedUserId=1;\n optional int32 timeoutTime=2;\n required string invitedRoomId=3;\n required string inviteInfo=4;\n required string inviteSessionId= 5;\n }\n message RtcCancelInviteInput {\n required string invitedUserId=1;\n required string invitedRoomId=2;\n required string inviteInfo=3;\n required string inviteSessionId=4;\n }\n message RtcInviteAnswerInput {\n required string inviteUserId=1;\n required int32 answerCode=2;\n required string inviteRoomId=3;\n required string inviteSessionId=4;\n required string content=5;\n optional string key=6;\n optional string value=7;\n }\n message RtcEndInviteInput {\n required string inviteRoomId=1;\n required string inviteSessionId=2;\n required string inviteContent=3;\n repeated string inviteRoomKeys=4;\n }\n}\n");var cu,uu,du=function(){return a(function e(t){i(this,e),Object.defineProperty(this,"pbCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pbCodec=new eu(t)},[{key:"encode",value:function(e,t,n){return n?t:this.pbCodec.encode(e,t)}},{key:"decode",value:function(e,t){return this.pbCodec.decode(e,t)}}])}(),_u="rtcRJoin_data",lu="rtcRExit",pu="rtcRInfo",fu="rtcUData",hu="rtcUDel",Ru="rtcSetData",gu="userSetData",mu="rtcQryData",Cu="rtcDelData",vu="rtcToken",Tu="rtcUserState",Iu="rtcUList",Su="viewerJoinR",Eu="viewerExitR",Ou="rtcPullKv",bu="rtcIdentityChange",yu="rtcInvite",Lu="rtcCancelInvite",ku="rtcInviteAnswer",Au="rtcEndInvite",Nu="rtcQueryJoined",Pu="rtcPullRoomStatus",Du="reportsdk",Uu="rtcPing";!function(e){e.RtcInput="RtcInput",e.RtcOutput="RtcOutput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcRoomStatusInput="RtcRoomStatusInput",e.RtcRoomStatusOutput="RtcRoomStatusOutput",e.RtcReportSDKInput="RtcReportSDKInput",e.RtcPBPolaris="RCRTCPBPolaris",e.RtcPBR1Info="RCRTCPBR1Info",e.RtcPBR2Info="RCRTCPBR2Info",e.RtcPBR3Info="RCRTCPBR3Info",e.RtcPBR4Info="RCRTCPBR4Info",e.RtcPBStatusInfo="RCRTCPBStatusInfo",e.RtcPBStreamInfo="RCRTCPBStreamInfo",e.AsrTextMsg="AsrTextMsg",e.AsrResTextMsg="AsrResTextMsg"}(uu||(uu={})),c(c(c(c(c(c(c(c(c(c(cu={},uu.RtcInput,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"]),uu.RtcOutput,["version"]),uu.RtcUserListOutput,["users","token","sessionId","roomInfo","version"]),uu.SetUserStatusInput,["status"]),uu.RtcSetDataInput,["interior","target","key","value","objectName","content"]),uu.RtcUserSetDataInput,["valueInfo","objectName","content"]),uu.RtcDataInput,["interior","target","key","objectName","content"]),uu.RtcSetOutDataInput,["target","valueInfo","objectName","content"]),uu.MCFollowInput,["state"]),uu.RtcTokenOutput,["rtcToken"]),c(c(c(c(c(c(c(c(c(c(cu,uu.RtcQryOutput,["outInfo"]),uu.RtcQryUserOutDataInput,["userId"]),uu.RtcUserOutDataOutput,["user"]),uu.RtcQueryListInput,["order"]),uu.RtcRoomInfoOutput,["roomId","roomData","userCount","list"]),uu.RtcValueInfo,["key","value"]),uu.RtcKeyDeleteInput,["key"]),uu.RtcNotifyMsg,["type","time","roomId"]),uu.RtcPullKV,["timestamp","roomId"]),uu.RtcKVOutput,["entries","bFullUpdate","syncTime"]),c(c(c(c(c(c(c(c(c(c(cu,uu.RtcQueryUserJoinedInput,["userId"]),uu.RtcQueryUserJoinedOutput,["info"]),uu.RtcInviteInput,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),uu.RtcCancelInviteInput,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),uu.RtcInviteAnswerInput,["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),uu.RtcEndInviteInput,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),uu.RtcRoomStatusInput,["version"]),uu.RtcRoomStatusOutput,["bFullStatus","version","usersData","roomStatus"]),uu.RtcReportSDKInput,["sdkInfo"]),uu.RtcPBPolaris,["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"]),c(c(c(c(c(c(c(c(cu,uu.RtcPBR1Info,["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"]),uu.RtcPBR2Info,["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"]),uu.RtcPBR3Info,["info"]),uu.RtcPBR4Info,["info"]),uu.RtcPBStatusInfo,["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"]),uu.RtcPBStreamInfo,["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"]),uu.AsrTextMsg,["bms","t","isEnd","msgId","lang"]),uu.AsrResTextMsg,["type","uid","asr"]);var wu,Mu="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(uu.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(uu.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(uu.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(uu.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(uu.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(uu.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(uu.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(uu.RtcRoomStatusOutput,"{ // rtc 和 living room 拉房间资源状态返回的数据\n required bool bFullStatus =1; //标识此次给的数据是否是全量数据\n required int64 version =2; //当前获取后房间的最大版本号\n repeated RtcUserInfo usersData=3;//如果是全量数据,这个不为空,给的是房间全部的人以及发布的资源\n repeated RtcRoomStatus roomStatus=4;//房间增量数据\n }\n message RtcRoomStatus{ //房间状态变动\n required string userId = 1;//用户ID\n required int32 event = 2;//房间状态变更的event(人员加入/退出/离线/发布资源) (0:加入;1:离开;2:离线;3:资源变动) \n required int64 time = 3;//本次变更的版本号\n repeated RtcValueInfo userData = 4;//用户变更的资源(event为0或者3时可能有值)\n optional int32 switchRoleType = 5;//如果是切换角色导致的加入房间或退出房间的类型\n optional string extra = 6;\n }\n message ").concat(uu.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n repeated string codeFormat = 8; //当前房间用户支持的编码交集\n optional int64 roomCreateTime = 9;//房间创建时间\n optional int64 userJoinTime = 10;//用户加入房间\n optional int64 version = 11;//当前房间的版本号\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(uu.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(uu.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(uu.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(uu.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(uu.RtcQryOutput,"{\n repeated ").concat(uu.RtcValueInfo," outInfo=1;\n }\n message ").concat(uu.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(uu.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(uu.RtcUserSetDataInput," {\n repeated ").concat(uu.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(uu.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(uu.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(uu.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(uu.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(uu.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(uu.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(uu.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(uu.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(uu.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(uu.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(uu.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(uu.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n optional string sessionId=4;\n optional int64 roomCreateTime = 5;//房间创建时间\n optional int64 userJoinTime = 6;//用户加入房间\n }\n message ").concat(uu.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(uu.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(uu.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(uu.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(uu.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(uu.RtcPBPolaris," {\n required string type = 1;//上报数据类型 R1-R4\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int32 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional ").concat(uu.RtcPBR1Info," r1Info = 10;\n optional ").concat(uu.RtcPBR2Info," r2Info = 11;\n optional ").concat(uu.RtcPBR3Info," r3Info = 12;\n optional ").concat(uu.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(uu.RtcPBR1Info," {\n required int64 joinTime = 1;//用户加入房间的时间\n required string rtcVersion = 2;//Rtc版本号\n required string imVersion = 3;//IM SDK 版本\n required string platform = 4;//平台(如:Android、iOS、Web)\n required string device = 5; //设备信息(手机名称+型号)\n required string os = 6;//系统版本(手机系统版本)\n optional string browserName = 7; //浏览器名称, 没有用 -1 表示\n optional string browserVersion = 8;//浏览器版本, 没有用 -1 表示\n optional int64 receiveTime = 9; // 发送数据的时间\n }\n message ").concat(uu.RtcPBR2Info," {\n required int64 joinTime = 1;\n required int64 sendTime = 2;\n required string rtcActionType = 3;//发布类型 subscribe : 订阅 publish : 发布\n required string rtcActionStatus = 4;//发布状态 begin : 开始 tend : 结束\n repeated string trackId = 5;\n optional int64 receiveTime = 6; // 发送数据的时间\n }\n message ").concat(uu.RtcPBR3Info," {\n required ").concat(uu.RtcPBStatusInfo," info = 1;\n }\n message ").concat(uu.RtcPBR4Info," {\n required ").concat(uu.RtcPBStatusInfo," info = 1;\n }\n message ").concat(uu.RtcPBStatusInfo," {\n optional int64 joinTime = 1;//用户加入房间的时间\n optional int64 receiveTime = 2;//用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理\n optional int64 totalBitRate = 3;//总码率\n optional float appCPUUsage = 4;//APP CPU占用率\n optional float systemCPUUsage = 5;////系统 CPU占用率\n optional float systemCPUFrequency = 6;//系统CPU频率 (安卓8.0以上)\n optional string networkStatus = 7;//实时网络状态(2g、3g、4g、wifi)\n optional int32 googleRTTNetwork = 8;//Goog rtt 网络延迟\n optional string ipAddress = 9;//ip地址\n optional string useReceiveBroadBand = 10; //可接收带宽(单位: bit)\n optional string useSendBroadBand = 11;//可用发送带宽(单位: bit)\n optional string packetLossCount = 12;//丢包数\n repeated ").concat(uu.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(uu.RtcPBStreamInfo," {\n required string trackId = 1;\n optional string codeName = 2;//编解码名称\n optional string volume = 3;//音频播放音量\n optional int32 samplingRate = 4; //音频采样率\n optional float bitRate = 5;//下行码率\n optional float packetLossRate = 6;\n optional int32 frameRate = 7;//视频接收帧率(单位:fps)\n optional string resolution = 8;//视频分辨率(格式:640*480)\n optional int64 blockTime = 9;//接收卡顿(间隔时间, 单位: ms)\n optional int32 jitterData = 10;//jitter数据抖动\n optional string nAckCount = 11;//nack数量\n optional string pliCount = 12; //PLI请求数\n optional int64 googleRTTTotalTime = 13; //googRtt往返时长\n optional int32 isReceiveFirstFrameRate = 14;//第一个关键帧是否正常收到\n optional string codeType = 15;//编码方式\n optional int32 isEnabled = 16; //当前流的状态是否可用\n }\n // ---- 北极星数据上报 -------\n message ").concat(uu.AsrTextMsg," {\n optional int32 bms = 1; //开始转写的时间(毫秒)\n optional string t = 2; //翻译的内容\n optional bool isEnd = 3; //是否监测到完整语句\n optional string msgId = 4; //该消息的ID, 跟转写的msgId 需要一样;\n optional string lang = 5; //翻译的目标语言码\n }\n message ").concat(uu.AsrResTextMsg," {\n optional int32 type = 1; //1 为语音识别,后续会扩展其它类型\n required string uid = 2; //对应转写的用户Id\n repeated ").concat(uu.AsrTextMsg," asr = 3; //识别出的结果列表\n }\n}\n"),xu=function(e,t,n,r,i,o,a){var s=i?Object.keys(i).map(function(t){return e.encode(uu.RtcValueInfo,{key:t,value:i[t]},!0)}):void 0,c=o?Object.keys(o).map(function(t){return e.encode(uu.RtcValueInfo,{key:t,value:o[t]},!0)}):void 0;return e.encode(uu.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:c,supportNtf:a})},Bu=function(e,t){var n=e.decode(uu.RtcUserListOutput,t),r=n.users,i=n.token,o=n.sessionId,a=n.roomInfo,s=n.entries,c=n.offlineKickTime,u=void 0===c?60:c,d=n.codeFormat,_=n.roomCreateTime,l=n.userJoinTime,p=n.version,f={};return H(r,function(e){var t=e.userId,n=e.userData,r={};H(n,function(e){var t=e.key,n=e.value;r[t]=n}),f[t]=r}),{users:f,token:i,sessionId:o,roomInfo:a,kvEntries:s,offlineKickTime:u,codeFormat:d,roomCreateTime:Xn(_),userJoinTime:Xn(l),version:p}},Vu=function(e,t,n){var r=t.type,i=t.appKey,o=t.sessionId,a=t.roomId,s=t.roomCreateTime,c=t.userId,u=t.userRole,d=t.joinTime,_=t.signalDataCenter,l=t.r1Info,p=t.r2Info,f=t.r3Info,h=t.r4Info,R={type:r,appKey:i,sessionId:o,roomId:a,roomCreateTime:s,userId:c,userRole:u,joinTime:d,signalDataCenter:_};if(n===_c.R1&&l){var g=e.encode(uu.RtcPBR1Info,l,!0);return e.encode(uu.RtcPBPolaris,Object.assign(Object.assign({},R),{r1Info:g}))}if(n===_c.R2&&p){var m=e.encode(uu.RtcPBR2Info,p,!0);return e.encode(uu.RtcPBPolaris,Object.assign(Object.assign({},R),{r2Info:m}))}if(n===_c.R3&&f){var C=f.info,v=C.streams,T=Array.isArray(v)&&v.map(function(t){return t&&e.encode(uu.RtcPBStreamInfo,t,!0)}),I=e.encode(uu.RtcPBStatusInfo,Object.assign(Object.assign({},C),{streams:T}),!0),S=e.encode(uu.RtcPBR3Info,{info:I},!0);return e.encode(uu.RtcPBPolaris,Object.assign(Object.assign({},R),{r3Info:S}))}if(n===_c.R4&&h){var E=h.info,O=E.streams,b=Array.isArray(O)&&O.map(function(t){return t&&e.encode(uu.RtcPBStreamInfo,t,!0)}),y=e.encode(uu.RtcPBStatusInfo,Object.assign(Object.assign({},E),{streams:b}),!0),L=e.encode(uu.RtcPBR4Info,{info:y},!0);return e.encode(uu.RtcPBPolaris,Object.assign(Object.assign({},R),{r4Info:L}))}return{}};!function(e){e[e.SUBTITLE=1]="SUBTITLE",e[e.TRANSLATION=2]="TRANSLATION"}(wu||(wu={}));var ju,Fu=function(){return a(function e(t){i(this,e),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:new du(Mu)})},[{key:"logger",get:function(){return this.context.logger}},{key:"joinRTCRoom",value:function(e,t,n,r,i,o,a){return K(this,void 0,void 0,p().m(function s(){var c,u,d,_,l,f,h,R,g,m,C,v,T,I,S;return p().w(function(s){for(;;)switch(s.n){case 0:return c=xu(this.codec,t,n,r,i,o,a),s.n=1,this.context.rtcSignaling(e,_u,!0,c);case 1:if(u=s.v,d=u.code,_=u.buffer,d!==ke||!_){s.n=2;break}return l=Bu(this.codec,_),h=(f=l).users,R=f.token,g=f.sessionId,m=f.roomInfo,C=f.kvEntries,v=f.offlineKickTime,T=f.roomCreateTime,I=f.userJoinTime,S=f.version,this.roomCreateTime=T,this.userJoinTime=I,s.a(2,{code:d,data:{users:h,token:R,sessionId:g,roomInfo:m,kvEntries:C,offlineKickTime:v,version:S}});case 2:return s.a(2,{code:d,data:l})}},s,this)}))}},{key:"quitRTCRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.SetUserStatusInput,{status:0}),t.n=1,this.context.rtcSignaling(e,lu,!0,n);case 1:return r=t.v,i=r.code,t.a(2,i)}},t,this)}))}},{key:"getRTCRoomInfo",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,pu,!0,n);case 1:return r=t.v,i=r.code,o=r.buffer,i===ke&&o&&(a=this.codec.decode(uu.RtcRoomInfoOutput,o)),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"getRTCUserInfoList",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,fu,!0,n);case 1:return r=t.v,i=r.code,o=r.buffer,i===ke&&o&&(s=Bu(this.codec,o),a={users:s.users}),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"getRTCUserInfo",value:function(e){throw new Error("Method not implemented.")}},{key:"removeRTCUserInfo",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this.codec.encode(uu.RtcKeyDeleteInput,{key:t}),n.n=1,this.context.rtcSignaling(e,hu,!1,r);case 1:return i=n.v,o=i.code,n.a(2,o)}},n,this)}))}},{key:"setRTCData",value:function(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u;return p().w(function(a){for(;;)switch(a.n){case 0:return s=this.codec.encode(uu.RtcSetDataInput,{interior:r,target:i,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),a.n=1,this.context.rtcSignaling(e,Ru,!1,s);case 1:return c=a.v,u=c.code,a.a(2,u)}},a,this)}))}},{key:"setRTCTotalRes",value:function(e,t,n,r,i,o){return K(this,void 0,void 0,p().m(function a(){var s,c,u,d,_=this;return p().w(function(a){for(;;)switch(a.n){case 0:return s={objectName:r,content:[],valueInfo:[this.codec.encode(uu.RtcValueInfo,{key:"uris",value:n},!0)]},t.forEach(function(e){var t=_.codec.encode(uu.RtcValueInfo,{key:e.name,value:e.content},!0);s.content.push(t)}),i&&s.valueInfo.push(this.codec.encode(uu.RtcValueInfo,{key:"mcu_uris",value:i},!0)),o&&s.valueInfo.push(this.codec.encode(uu.RtcValueInfo,{key:"cdn_uris",value:o},!0)),c=this.codec.encode(uu.RtcUserSetDataInput,s),a.n=1,this.context.rtcSignaling(e,gu,!0,c);case 1:return u=a.v,d=u.code,a.a(2,d)}},a,this)}))}},{key:"setRTCCDNUris",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a;return p().w(function(r){for(;;)switch(r.n){case 0:return i=this.codec.encode(uu.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(uu.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),r.n=1,this.context.rtcSignaling(e,gu,!0,i);case 1:return o=r.v,a=o.code,r.a(2,a)}},r,this)}))}},{key:"getRTCData",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u,d,_;return p().w(function(i){for(;;)switch(i.n){case 0:return o=this.codec.encode(uu.RtcDataInput,{interior:n,target:r,key:t}),i.n=1,this.context.rtcSignaling(e,mu,!0,o);case 1:if(a=i.v,s=a.code,c=a.buffer,s===ke&&c){i.n=2;break}return i.a(2,{code:s});case 2:return u=this.codec.decode(uu.RtcQryOutput,c),d=u.outInfo,_={},d.forEach(function(e){_[e.key]=e.value}),i.a(2,{code:s,data:_})}},i,this)}))}},{key:"removeRTCData",value:function(e,t,n,r,i){return K(this,void 0,void 0,p().m(function o(){var a,s,c;return p().w(function(o){for(;;)switch(o.n){case 0:return a=this.codec.encode(uu.RtcDataInput,{interior:n,target:r,key:t,objectName:(null==i?void 0:i.name)||"",content:(null==i?void 0:i.content)||""}),o.n=1,this.context.rtcSignaling(e,Cu,!1,a);case 1:return s=o.v,c=s.code,o.a(2,c)}},o,this)}))}},{key:"setRTCOutData",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:throw new Error("JSEngine's method not implemented.");case 1:return e.a(2)}},e)}))}},{key:"getRTCOutData",value:function(e,t){return K(this,void 0,void 0,p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:throw new Error("JSEngine's method not implemented.");case 1:return e.a(2)}},e)}))}},{key:"getRTCToken",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u;return p().w(function(r){for(;;)switch(r.n){case 0:return i=xu(this.codec,t,n),r.n=1,this.context.rtcSignaling(e,vu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke&&s){r.n=2;break}return r.a(2,{code:a});case 2:return c=this.codec.decode(uu.RtcTokenOutput,s),u=c.rtcToken,r.a(2,{code:a,data:{rtcToken:u}})}},r,this)}))}},{key:"setRTCState",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this.codec.encode(uu.MCFollowInput,{state:t}),n.n=1,this.context.rtcSignaling(e,Tu,!0,r);case 1:return i=n.v,o=i.code,n.a(2,o)}},n,this)}))}},{key:"setRTCStateByHttp",value:function(e,t,n,r){return K(this,void 0,void 0,p().m(function i(){var o,a,s,c,u;return p().w(function(i){for(;;)switch(i.p=i.n){case 0:return a=Vu(this.codec,n,r),s=e,/^https:\/\//.test(e)||(s="https://".concat(e)),i.p=1,i.n=2,t.httpReq({url:"".concat(s,"/rtc/logserver/polaris"),body:a,method:U.POST,headers:{jwt:(null===(o=this.context.getNaviInfo())||void 0===o?void 0:o.jwtToken)||""},timeout:2e3});case 2:if((c=i.v).data){i.n=3;break}throw new Error("http request fail");case 3:return u=JSON.parse(c.data).resultCode,i.a(2,u);case 4:return i.p=4,i.v,i.a(2,dc.REPORT_FAIL)}},i,this,[[1,4]])}))}},{key:"getRTCUserList",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,Iu,!0,n);case 1:if(r=t.v,i=r.code,o=r.buffer,i===ke&&o){t.n=2;break}return t.a(2,{code:i});case 2:return a=Bu(this.codec,o),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c,u,d,_,l;return p().w(function(r){for(;;)switch(r.n){case 0:return i=xu(this.codec,t,n),r.n=1,this.context.rtcSignaling(e,Su,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke&&s){r.n=2;break}return r.a(2,{code:a});case 2:return c=this.codec.decode(uu.RtcViewerJoinedOutput,s),u=c.rtcToken,d=c.entries,_=c.roomCreateTime,l=c.userJoinTime,this.roomCreateTime=Xn(_),this.userJoinTime=Xn(l),r.a(2,{code:a,data:{token:u,kvEntries:d}})}},r,this)}))}},{key:"quitLivingRoomAsAudience",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.SetUserStatusInput,{status:0}),t.n=1,this.context.rtcSignaling(e,Eu,!0,n);case 1:return r=t.v,i=r.code,t.a(2,i)}},t,this)}))}},{key:"rtcIdentityChange",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:return i=this.codec.encode(uu.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),r.n=1,this.context.rtcSignaling(e,bu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke&&s){r.n=2;break}return r.a(2,{code:a});case 2:return c=Bu(this.codec,s),r.a(2,{code:a,data:c})}},r,this)}))}},{key:"requestRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u,d;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteTimeout,a=e.inviteInfo,s=e.roomId,c=this.codec.encode(uu.RtcInviteInput,{invitedRoomId:n,invitedUserId:r,inviteSessionId:i,timeoutTime:o,inviteInfo:a}),t.n=1,this.context.rtcSignaling(s,yu,!0,c);case 1:return u=t.v,d=u.code,t.a(2,d)}},t,this)}))}},{key:"cancelRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(uu.RtcCancelInviteInput,{invitedRoomId:n,invitedUserId:r,inviteSessionId:i,inviteInfo:o}),t.n=1,this.context.rtcSignaling(a,Lu,!0,s);case 1:return c=t.v,u=c.code,t.a(2,u)}},t,this)}))}},{key:"responseRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u,d,_,l;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,o=e.content,a=e.key,s=e.value,c=e.agree,u=e.roomId,d=this.codec.encode(uu.RtcInviteAnswerInput,{inviteUserId:n,inviteRoomId:r,inviteSessionId:i,content:o,key:a,value:s,answerCode:c?1:0}),t.n=1,this.context.rtcSignaling(u,ku,!0,d);case 1:return _=t.v,l=_.code,t.a(2,l)}},t,this)}))}},{key:"endRoomPK",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c,u;return p().w(function(t){for(;;)switch(t.n){case 0:return n=e.endRoomId,r=e.sessionId,i=e.content,o=e.keys,a=e.roomId,s=this.codec.encode(uu.RtcEndInviteInput,{inviteRoomId:n,inviteSessionId:r,inviteContent:i,inviteRoomKeys:o}),t.n=1,this.context.rtcSignaling(a,Au,!0,s);case 1:return c=t.v,u=c.code,t.a(2,u)}},t,this)}))}},{key:"getRTCJoinedUserInfo",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.RtcQueryUserJoinedInput,{userId:e}),t.n=1,this.context.rtcSignaling("",Nu,!0,n);case 1:if(r=t.v,i=r.code,o=r.buffer,i===ke&&o){t.n=2;break}return t.a(2,{code:i});case 2:return a=this.codec.decode(uu.RtcQueryUserJoinedOutput,o).info||[],t.a(2,{code:i,data:a.map(function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Xn(e.joinTime)}})})}},t,this)}))}},{key:"pullRTCRoomEntry",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s,c;return p().w(function(t){for(;;)switch(t.n){case 0:return n=this.codec.encode(uu.RtcPullKV,{timestamp:0,roomId:e}),t.n=1,this.context.rtcSignaling(e,Ou,!0,n);case 1:if(r=t.v,i=r.code,o=r.buffer,i===ke){t.n=2;break}return t.a(2,{code:i});case 2:return a=this.codec.decode(uu.RtcKVOutput,o),s=a.entries,c=a.syncTime,s=(s||[]).map(function(e){return Object.assign(Object.assign({},e),{timestamp:Xn(e.timestamp)})}),t.a(2,{code:i,data:{kvEntries:s,syncTime:Xn(c)}})}},t,this)}))}},{key:"pullRTCRoomStatus",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s;return p().w(function(n){for(;;)switch(n.n){case 0:return r=this.codec.encode(uu.RtcRoomStatusInput,{version:t}),n.n=1,this.context.rtcSignaling(e,Pu,!0,r);case 1:if(i=n.v,o=i.code,a=i.buffer,o===ke){n.n=2;break}return n.a(2,{code:o});case 2:return s=this.codec.decode(uu.RtcRoomStatusOutput,a),n.a(2,{code:o,data:s})}},n,this)}))}},{key:"decodeRtcNotify",value:function(e){var t=this.codec.decode(uu.RtcNotifyMsg,e),n=t.time,r=t.type,i=t.roomId;return{time:Xn(n),type:r,roomId:i}}},{key:"getCurrentId",value:function(){return this.context.getCurrentId()}},{key:"getNaviInfo",value:function(){return this.context.getNaviInfo()}},{key:"getConnectionStatus",value:function(){return this.context.getConnectionStatus()}},{key:"getAppkey",value:function(){return this.context.getAppkey()}},{key:"webRtcPing",value:function(e,t,n){return K(this,void 0,void 0,p().m(function r(){var i,o,a,s,c;return p().w(function(r){for(;;)switch(r.n){case 0:return i=this.codec.encode(uu.RtcInput,{roomType:t,broadcastType:n}),r.n=1,this.context.rtcSignaling(e,Uu,!0,i);case 1:if(o=r.v,a=o.code,s=o.buffer,a===ke){r.n=2;break}return r.a(2,{code:a});case 2:return(c=this.codec.decode(uu.RtcOutput,s)).version=Xn(c.version),r.a(2,{code:a,data:c})}},r,this)}))}},{key:"rtcPing",value:function(e,t,n){var r,i;return/Electron/.test(navigator.userAgent)?null===(i=(r=this.context).rtcPingResVersion)||void 0===i?void 0:i.call(r,e,t,n):this.webRtcPing(e,t,n)}},{key:"sendMessage",value:function(e,t,n){return this.context.sendMessage(e,t,n)}},{key:"registerRTCSignalListener",value:function(e){this.context.registerRTCSignalListener(e)}},{key:"registerConnectionStateChangeListener",value:function(e){var t,n;null===(n=(t=this.context).registerConnectionStateChangeListener)||void 0===n||n.call(t,e)}},{key:"registerDisconnectListener",value:function(e){var t,n;null===(n=(t=this.context).registerDisconnectListener)||void 0===n||n.call(t,e)}},{key:"registerDestroyListener",value:function(e){var t,n;null===(n=(t=this.context).registerDestroyListener)||void 0===n||n.call(t,e)}},{key:"registerMessageListener",value:function(e){var t,n;null===(n=(t=this.context).registerMessageListener)||void 0===n||n.call(t,e)}},{key:"getCoreVersion",value:function(){return this.context.getCoreVersion()}},{key:"getPluginContext",value:function(){return this.context}},{key:"reportSDKInfo",value:function(e){var t=this.codec.encode(uu.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Du,!0,t)}},{key:"decodeAsrText",value:function(e,t){var n;try{n=this.codec.decode(uu.AsrResTextMsg,e)}catch(n){console.error("decodeAsrText error",{error:n,seiFrameData:e.join(","),seiOriginData:t.join(",")})}var r=n||{asr:[]},i=r.type,o=r.uid;return r.asr.map(function(e){var t=e.bms,n=e.t,r=e.isEnd,a=e.msgId,s=e.lang,c={userID:o,timeUTC:t,msg:n,msgId:a,isEnd:r};return i===wu.SUBTITLE?c:Object.assign(Object.assign({},c),{destLangCode:s})})}}])}(),Gu=function(){function e(t,n,o){var a,s,c;return i(this,e),a=r(this,e,[t]),Object.defineProperty(a,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_options",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Ha.setSdpSemantics(o.sdpSemantics||"unified-plan",a._logger),a._service=new Oa(a._runtime,a._context,a._options.mediaServer,a._options.timeout),a._context.registerConnectionStateChangeListener(a._onIMStatusChange.bind(a)),a._context.registerDestroyListener(a._onIMUninit.bind(a)),a._context.registerMessageListener(a._handleMessage.bind(a)),null===(c=(s=a._context.getPluginContext()).setOnnavidatachange)||void 0===c||c.call(s,a.naviDataChange.bind(a)),a}return _(e,$c),a(e,[{key:"_handleMessage",value:function(e){if(e.conversationType!==Ie.RTC_ROOM)return!1;var t=this._logger.createTraceId();this._crtRoom instanceof Jc&&this._getJoinedPKRoomList().forEach(function(n){n.__parseInnerMessage(e,t)});return this._logger.info(ye.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:Le.SUCCESSED,message:e}),t),this._crtRoom?(this._crtRoom.__parseInnerMessage(e,t),!0):(this._logger.warn(ye.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:Le.FAILED,message:"the crtRoom is empty"}),t),!0)}},{key:"naviDataChange",value:function(e){this._logger.info(ye.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.clearMSList(),this._service.isNededDetector()&&this._service.detectorMediaSever()}},{key:"_getJoinedPKRoomList",value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,n=e.roomPKHandler;if(t===exports.RCRTCCode.SUCCESS&&n){var r=n.getJoinedPKRooms()||{};return Object.values(r)}return[]}},{key:"getPluginContext",value:function(){return this._context.getPluginContext()}},{key:"getCurrentId",value:function(){return this._context.getCurrentId()}},{key:"joinCrossRTCRoom",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this;return arguments.length>4&&void 0!==arguments[4]||exports.RTCMode.CROSS_MUTI,p().m(function i(){return p().w(function(i){for(;;)if(0===i.n)return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),i.a(2,r.joinRTCRoomWithOptions(e,{joinType:t,userData:n,mode:exports.RTCMode.CROSS_MUTI}))},i)})()})}},{key:"joinRTCRoom",value:function(e,t,n){return K(this,arguments,void 0,function(e,t,n){var r=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:exports.RTCMode.RTC;return p().m(function o(){return p().w(function(o){for(;;)if(0===o.n)return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),o.a(2,r.joinRTCRoomWithOptions(e,{mode:i,joinType:t,userData:n}))},o)})()})}},{key:"joinRTCRoomWithOptions",value:function(e,t){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s=this;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),!this._crtRoom){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),n.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 1:return i=this._crtRoom=new Hc(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt),n.n=2,i.__innerInit((null==t?void 0:t.mode)||exports.RTCMode.RTC,null==t?void 0:t.joinType,void 0,void 0,null==t?void 0:t.userData,r,null==t?void 0:t.srcLanguage,null==t?void 0:t.nickName);case 2:if(o=n.v,(a=o.code)===exports.RCRTCCode.SUCCESS){n.n=3;break}return this._crtRoom=null,n.a(2,{code:a});case 3:return i.once(Lc,function(){s._crtRoom=null}),n.a(2,{code:a,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()})}},n,this)}))}},{key:"joinLivingRoom",value:function(e,t,n,r){return K(this,arguments,void 0,function(e,t,n,r){var i=this;return p().m(function o(){var a,s,c,u,d;return p().w(function(o){for(;;)switch(o.n){case 0:if(a=i._logger.createTraceId(),i._logger.info(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:n,outerUserDatas:r}),a),!i._crtRoom){o.n=1;break}return i._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),a),o.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 1:return s=i._crtRoom=new Jc(i._context,i._runtime,e,i._service,i._options,t,!1,!0),o.n=2,s.__innerInit(exports.RTCMode.LIVE,n,t,void 0,r,a);case 2:if(c=o.v,(u=c.code)===exports.RCRTCCode.SUCCESS){o.n=3;break}return i._crtRoom=null,o.a(2,{code:u});case 3:return s.once(Lc,function(){i._crtRoom=null}),d={code:u,room:s,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},s.__getCDNPushMode()===zc.MANUAL&&Object.assign(d,{CDNEnable:s.__getCDNEnable()}),o.a(2,d)}},o)})()})}},{key:"getAudienceClient",value:function(e){return this._audience||(this._audience=new Wc(this._context,this._runtime,this._options)),this._logger.info(ye.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}},{key:"_onIMStatusChange",value:function(e,t){if(this._logger.info(ye.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:e,code:t,desc:Se[e]})),e===Se.SUSPENDED&&40001===t&&this._service.clearMSList(),e===Se.DISCONNECTED){if(this._crtRoom){var n=exports.RCKickReason.IM_DISCONNECTED;40002===t?n=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:t===Ae&&(n=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:n}]})}}else if(e===Se.CONNECTED){if(this._service.isNededDetector()&&this._service.detectorMediaSever(),this._crtRoom instanceof Jc)this._getJoinedPKRoomList().forEach(function(e){e.__onReconnected()});this._crtRoom&&this._crtRoom.__onReconnected()}}},{key:"_onIMUninit",value:function(){var e;this._logger.info(ye.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"TODO -> on IM client ondestroy"})),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}},{key:"leaveRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r;return p().w(function(t){for(;;)switch(t.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),r),this._crtRoom){t.n=1;break}return this._logger.warn(ye.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:Le.FAILED,msg:"Room does not exist, without leave"}),r),t.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return t.n=2,this._crtRoom.__destroy(!0);case 2:return this._service.isNededDetector()&&this._service.detectorMediaSever(),this._logger.info(ye.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomId:null===(n=this._crtRoom)||void 0===n?void 0:n.getRoomId()}),r),this._crtRoom=null,t.a(2,{code:exports.RCRTCCode.SUCCESS})}},t,this)}))}},{key:"joinLivingRoomAsAudience",value:function(e,t,n){return K(this,void 0,void 0,p().m(function n(){var r,i,o,a,s,c;return p().w(function(n){for(;;)switch(n.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e,livingType:t}),r),this._service.isNededDetector()&&this._service.detectorMediaSever(),!Wn(this._context.getNaviInfo())){n.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),r),n.a(2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR});case 1:if(j("roomId",e,k,!0)&&j("livingType",t,function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO})){n.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),r),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){n.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),n.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:if(this._service.getMsList().length){n.n=4;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),r),n.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 4:return n.n=5,this._context.joinLivingRoomAsAudience(e,exports.RTCMode.LIVE,t);case 5:if(i=n.v,o=i.code,a=i.data,o===ke){n.n=6;break}return this._logger.error(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:o,msg:"signal error -> audience join room"}),r),n.a(2,{code:exports.RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED});case 6:return s=Ra(),c=new Qc(this._context,this._runtime,this._options,e,a,t,s),this._crtAudienceLivingRoom=c,this._logger.info(ye.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.SUCCESSED,roomData:a}),r),n.a(2,{room:c,code:exports.RCRTCCode.SUCCESS,userIds:c.getRemoteUserIds(),RTCTracks:c.getRemoteRTCTracks(),MCUTracks:c.getRemoteMCUTracks(),CDNUris:c.getCDNInfo()})}},n,this)}))}},{key:"leaveLivingRoomAsAudience",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e.getRoomId(),userId:this._context.getCurrentId()}),n),this._crtAudienceLivingRoom){t.n=1;break}return this._logger.warn(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,msg:"Room does not exist, without leave"}),n),t.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this._crtAudienceLivingRoom===e){t.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t.n=3,this._crtAudienceLivingRoom.__destroy(!0);case 3:return this._crtAudienceLivingRoom=null,this._logger.info(ye.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.SUCCESSED}),n),t.a(2,{code:exports.RCRTCCode.SUCCESS})}},t,this)}))}},{key:"upgradeToAnchorRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s=this;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,n),j("room",e,function(){return e instanceof Qc},!0)){t.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(r=e.getRoomId(),!this._crtRoom){t.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:r}),n),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 2:return i=this._crtRoom=new Jc(this._context,this._runtime,r,this._service,this._options,e.livingType,!0,!0,e.getClientSessionId()),t.n=3,i.__innerInitByIdentityChange(n);case 3:if((o=t.v)===ke){t.n=4;break}return this._crtRoom=null,t.a(2,{code:o});case 4:return i.once(Lc,function(){s._crtRoom=null}),t.n=5,this._crtAudienceLivingRoom.__destroy(!1);case 5:return this._crtAudienceLivingRoom=null,a={room:i,code:exports.RCRTCCode.SUCCESS,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()},i.__getCDNPushMode()===zc.MANUAL&&Object.assign(a,{CDNEnable:i.__getCDNEnable()}),t.a(2,a)}},t,this)}))}},{key:"downgradeToAudienceRoom",value:function(e){return K(this,void 0,void 0,p().m(function t(){var n,r,i,o,a,s;return p().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:e._roomId,userId:this._context.getCurrentId()}),n),e.isMainRoom()){t.n=1;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),n),t.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:if(j("room",e,function(){return e instanceof Jc},!0)){t.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),n),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){t.n=3;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:return t.n=4,this._context.rtcIdentityChange(e._roomId,Bc.AnchorToViewer,e.getLivingType());case 4:if(r=t.v,i=r.code,o=r.data,i===ke){t.n=5;break}return this._logger.error(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),n),t.a(2,{code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED});case 5:return this._logger.info(ye.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomData:o}),n),a=e.getClientSessionId(),s=new Qc(this._context,this._runtime,this._options,e._roomId,o,e.getLivingType(),a),this._crtAudienceLivingRoom=s,this._crtRoom.__destroy(!1),this._crtRoom=null,t.a(2,{room:s,code:exports.RCRTCCode.SUCCESS,userIds:s.getRemoteUserIds(),RTCTracks:s.getRemoteRTCTracks(),MCUTracks:s.getRemoteMCUTracks(),CDNUris:s.getCDNInfo()})}},t,this)}))}},{key:"getJoinedRoomInfo",value:function(){return K(this,void 0,void 0,p().m(function e(){var t,n,r,i,o;return p().w(function(e){for(;;)switch(e.n){case 0:return t=this._logger.createTraceId(),n=this._context.getCurrentId(),this._logger.error(ye.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:n}),t),e.n=1,this._context.getRTCJoinedUserInfo(n);case 1:if(r=e.v,i=r.code,o=r.data,i===ke){e.n=2;break}return this._logger.error(ye.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:Le.FAILED,code:i}),t),e.a(2,{code:i});case 2:return this._logger.info(ye.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:Le.SUCCESSED,roomInfo:o}),t),e.a(2,{code:exports.RCRTCCode.SUCCESS,data:o})}},e,this)}))}},{key:"generateSummarization",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return p().m(function s(){var c,u,d,_,l,f,h;return p().w(function(s){for(;;)switch(s.n){case 0:if(c=n._logger.createTraceId(),n._logger.info(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T,JSON.stringify({roomId:e,taskId:t,startTime:r,endTime:i,config:o,contentBlock:a}),c),j("roomId",e,k,!0)){s.n=1;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(j("taskId",t,k,!0)){s.n=2;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(y(r)&&!(r<0)){s.n=3;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(y(i)&&!(i<0)){s.n=4;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(j("config",o,A,!0)){s.n=5;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:return u=$n(o),d=u.isValid,_=u.key,d||n._logger.warn(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config.".concat(_)}),c),s.n=6,n._service.generateSummarization(e,t,r,i,o,a,c);case 6:if(l=s.v,f=l.code,h=l.msg,f===exports.RCRTCCode.SUCCESS){s.n=7;break}return n._logger.error(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:f,msg:h}),c),s.a(2,{code:f});case 7:return n._logger.info(ye.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.SUCCESSED}),c),s.a(2,{code:f})}},s)})()})}},{key:"getASRContent",value:function(e,t){return K(this,arguments,void 0,function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return p().m(function s(){var c,u,d,_;return p().w(function(s){for(;;)switch(s.n){case 0:if(c=n._logger.createTraceId(),n._logger.info(ye.L_RTC_CLIENT_GET_ASR_CONTENT_T,JSON.stringify({roomId:e,taskId:t,startTime:r,endTime:i,destLang:a,contentBlock:o}),c),j("roomId",e,k,!0)){s.n=1;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(j("taskId",t,k,!0)){s.n=2;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(y(r)&&!(r<0)){s.n=3;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(y(i)&&!(i<0)){s.n=4;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(j("destLang",a,O,!1)){s.n=5;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> destLang"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:return s.n=6,n._service.getASRContent(e,t,r,i,o,c,a);case 6:if(u=s.v,d=u.code,_=u.msg,d===exports.RCRTCCode.SUCCESS){s.n=7;break}return n._logger.error(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:d,msg:_}),c),s.a(2,{code:d});case 7:return n._logger.info(ye.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.SUCCESSED}),c),s.a(2,{code:d})}},s)})()})}}],[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=n.logger;if(i.warn(ye.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.1-nctest-alpha.2",Commit:"8fce545011e12c14297e7be6c2a9af6f2103063c","browserInfo.browser":Fn.browser,"browserInfo.supportsUnifiedPlan":Fn.supportsUnifiedPlan,"browserInfo.version":Fn.version})),V("options",t,E.OBJECT,!0),V("options.mediaServer",t.mediaServer,function(e){return!(!D(e)||"https:"===location.protocol&&!/^https/.test(e))}),V("options.timeout",t.timeout,function(e){return y(e)&&e>=5e3&&e<=3e4}),V("options.pingGap",t.pingGap,function(e){return y(e)&&e>=3e3&&e<=1e4}),t.AAAWorklet){V("options.AAAWorklet",t.AAAWorklet,E.OBJECT,!0);var o=t.AAAWorklet,a=o.scriptUrl,s=o.wasmUrl;V("AAAWorklet.scriptUrl",a,E.STRING,!0),V("AAAWorklet.wasmUrl",s,E.STRING,!0),un.SCRIPT_URL=a,un.WASM_URL=s}return t.encryptor&&(V("options.encrypt",t.encryptor,E.OBJECT,!0),V("options.encrypt.decodeAudio",t.encryptor.decodeAudio,function(e){return"function"==typeof e},!0),V("options.encrypt.decodeVideo",t.encryptor.decodeVideo,function(e){return"function"==typeof e},!0),V("options.encrypt.encodeAudio",t.encryptor.encodeAudio,function(e){return"function"==typeof e},!0),V("options.encrypt.encodeVideo",t.encryptor.encodeVideo,function(e){return"function"==typeof e},!0),Ba.init(t.encryptor,i)),e._instance||(e._instance=new e(new Fu(n),r,t)),e._instance}}])}();Object.defineProperty(Gu,"_instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.RTCJoinType=void 0,(ju=exports.RTCJoinType||(exports.RTCJoinType={}))[ju.KICK=0]="KICK",ju[ju.REFUSE=1]="REFUSE",e.VersionManage.add("rtclib","5.36.1-nctest-alpha.2");var Ju={tag:"RCRTC",verify:function(){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("26.1.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '","26.1.0","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(e){var t=function(e){const t={logger:(de.RTC,n=e.createLogger("RCRTC","RTC"),new pe({writeLog(e,t,r,i){switch(e){case ue.Debug:n.debug(t,r,i);break;case ue.Info:n.info(t,r,i);break;case ue.Warn:n.warn(t,r,i);break;case ue.Error:n.error(t,r,i);break;case ue.STATISTICS:n.__statistics(t,r,i);break;default:n.info(t,r,i)}},setOutputLevel(e){n.setOutputLevel(e)}})),rtcSignaling(t,n,r,i){return K(this,void 0,void 0,function*(){const o=yield e.rtcSignaling(t,n,r,i);return{code:Te.errorCode.toCommon(null==o?void 0:o.code),buffer:null==o?void 0:o.buffer}})},registerRTCSignalListener(t){e.registerRTCSignalListener(t)},sendGroupCallSignalInfo(t,n,r){return K(this,void 0,void 0,function*(){const i=yield e.setCallInfo(t,n,r);return{code:Te.errorCode.toCommon(i.code),data:i.data}})},registerGroupCallSignalInfoListener(t){e.onCallInfo=e=>{t(e)}},setOnnavidatachange(t){const n=t?e=>{const n=Te.naviInfo.toCommon(e);t(n)}:void 0;e.onnavidatachange=n},refetchNaviInfo:e.refetchNaviInfo?()=>K(this,void 0,void 0,function*(){yield e.refetchNaviInfo()}):void 0,registerConnectionStateChangeListener(t){e.onconnectionstatechange=(e,n)=>{t(Te.connectionStatus.toCommon(e),Te.errorCode.toCommon(null!=n?n:0))}},registerDisconnectListener(t){e.ondisconnect=t},registerDestroyListener(t){e.ondestroy=t},registerMessageListener(t){const n=t?e=>t(Te.receivedMessage.toCommon(e)):void 0;e.onmessage=n},sendMessage(t,n,r){return K(this,void 0,void 0,function*(){const i=Te.conversationType.toNative(t),o=Te.sendMsgOptions.toNative(r),a=yield e.sendMessage(i,n,o);return{code:Te.errorCode.toCommon(a.code),data:void 0!==a.data?Te.receivedMessage.toCommon(a.data):void 0}})},getCurrentId:()=>e.getCurrentId(),getNaviInfo(){const t=e.getNaviInfo();return null!=t?Te.naviInfo.toCommon(t):null},getConnectionStatus:()=>Te.connectionStatus.toCommon(e.getConnectionStatus()),getAppkey:()=>e.getAppkey(),getCoreVersion:()=>e.getCoreVersion(),registerMessageType(t,n,r,i){e.registerMessageType(t,n,r,i)}};var n;return e.rtcPingResVersion&&(t.rtcPingResVersion=(t,n,r)=>K(this,void 0,void 0,function*(){const i=yield e.rtcPingResVersion(t,n,r);return{code:Te.errorCode.toCommon(i.code),data:i.data}})),t}(e);return t.logger.warn(ye.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.1-nctest-alpha.2",Commit:"8fce545011e12c14297e7be6c2a9af6f2103063c","browserInfo.browser":Fn.browser,"browserInfo.supportsUnifiedPlan":Fn.supportsUnifiedPlan,"browserInfo.version":Fn.version})),new Gu(new Fu(t),le,{})}},Hu={transResolution:xn,transFrameRate:jn,parseTrackId:Pn,ifSupportLocalFileTrack:Gn,ifSupportScreenShare:Jn};exports.RCAbstractRoom=kc,exports.RCAudienceClient=Wc,exports.RCAudienceLivingRoom=Qc,exports.RCCameraVideoTrack=mn,exports.RCLivingRoom=Jc,exports.RCLocalAudioTrack=_n,exports.RCLocalFileAudioTrack=Rn,exports.RCLocalFileTrack=pn,exports.RCLocalFileVideoTrack=hn,exports.RCLocalTrack=dn,exports.RCLocalVideoTrack=ln,exports.RCMCUConfigBuilder=Dc,exports.RCMediaStreamCapture=$c,exports.RCMicphoneAudioTrack=gn,exports.RCRTCClient=Gu,exports.RCRTCRoom=Hc,exports.RCRemoteAudioTrack=In,exports.RCRemoteTrack=Tn,exports.RCRemoteVideoTrack=Sn,exports.RCScreenAudioTrack=vn,exports.RCScreenVideoTrack=Cn,exports.RCTag={DEFAULT:"RongCloudRTC"},exports.RCTrack=on,exports.device=nn,exports.helper=Hu,exports.installer=Ju;
|
|
3
|
+
var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var c=n&&n.prototype instanceof s?n:s,u=Object.create(c.prototype);return f(u,"_invoke",function(r,n,i){var o,s,c,u=0,l=i||[],d=!1,_={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,r){return o=t,s=0,c=e,_.n=r,a}};function f(r,n){for(s=r,c=n,t=0;!d&&u&&!i&&t<l.length;t++){var i,o=l[t],f=_.p,h=o[2];r>3?(i=h===n)&&(c=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=r<2&&f<o[1])?(s=0,_.v=n,_.n=o[1]):f<h&&(i=r<3||o[0]>n||n>h)&&(o[4]=r,o[5]=n,_.n=h,s=0))}if(i||r>1)return a;throw d=!0,n}return function(i,l,h){if(u>1)throw TypeError("Generator is already running");for(d&&1===l&&f(l,h),s=l,c=h;(t=s<2?e:c)||!d;){o||(s?s<3?(s>1&&(_.n=-1),f(s,c)):_.n=c:_.v=c);try{if(u=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(d=_.n<0)?c:r.call(n,_))!==a)break}catch(t){o=e,s=1,c=t}finally{u=1}}return{value:t,done:d}}}(r,i,o),!0),u}var a={};function s(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(f(t={},n,function(){return this}),t),d=u.prototype=s.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,f(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=u,f(d,"constructor",u),f(u,"constructor",c),c.displayName="GeneratorFunction",f(u,i,"GeneratorFunction"),f(d),f(d,i,"Generator"),f(d,n,function(){return this}),f(d,"toString",function(){return"[object Generator]"}),(_=function(){return{w:o,m:h}})()}function f(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}f=function(e,t,r,n){function o(t,r){f(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},f(e,t,r,n)}function h(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function p(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||E(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t,r,n){var i=c(u(1&n?e.prototype:e),t,r);return 2&n&&"function"==typeof i?function(e){return i.apply(r,e)}:i}function v(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||E(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function E(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function I(e){var t="function"==typeof Map?new Map:void 0;return I=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(d())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var i=new(e.bind.apply(e,n));return r&&g(i,r.prototype),i}(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g(r,e)},I(e)}require("@nexconn/chat");var S,y=function(e){return"string"==typeof e},b=function(e){return"boolean"==typeof e},O=function(e){return"number"==typeof e&&!Number.isNaN(e)},L=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},k=function(e){return y(e)&&e.length>0},A=function(e){return"[object Object]"===Object.prototype.toString.call(e)},N=function(e){return"function"==typeof e},w=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},P=function(e){return y(e)&&/https?:\/\//.test(e)};!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK"}(S||(S={}));var D,U,M,x=s(s(s(s(s(s(s({},S.STRING,k),S.ONLY_STRING,y),S.NUMBER,O),S.BOOLEAN,function(e){return"boolean"==typeof e}),S.OBJECT,A),S.ARRAY,L),S.CALLBACK,function(e){var t=!0;return A(e)||(t=!1),(e=e||{}).onSuccess&&!N(e.onSuccess)&&(t=!1),e.onError&&!N(e.onError)&&(t=!1),t}),B=function(){function e(t){var i;return n(this,e),(i=r(this,e,[t])).name="RCAssertError",i}return l(e,I(Error)),o(e)}(),V=function(e,t,r){if(!j(e,t,r,arguments.length>3&&void 0!==arguments[3]&&arguments[3]))throw new B("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},j=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];r=x[r]||r;var i=n?r(t):w(t)||null==t||r(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},F=function(){return o(function e(){n(this,e),Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:{}})},[{key:"on",value:function(e,t,r){var n=this._map[e]||(this._map[e]=[]);n.some(function(e){return e.listener===t&&e.target===r})||n.push({listener:t,target:r})}},{key:"once",value:function(e,t,r){var n=this._map[e]||(this._map[e]=[]);n.some(function(e){return e.listener===t&&e.target===r})||n.push({listener:t,target:r,once:!0})}},{key:"off",value:function(e,t,r){var n=this._map[e];n&&((n=n.filter(function(e){return e.listener!==t||e.target!==r})).length?this._map[e]=n:delete this._map[e])}},{key:"emit",value:function(e){var t=this._map[e];if(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0;o<t.length;o+=1){var a=t[o],s=a.target,c=a.once,u=a.listener;c&&(t.splice(o,1),o-=1);try{u.call.apply(u,[s].concat(n))}catch(e){null===console||void 0===console||console.error(e)}}}}},{key:"removeAll",value:function(e){delete this._map[e]}},{key:"clear",value:function(){Object.keys(this._map).forEach(this.removeAll,this)}}])}();function G(e,t){var r;if(!e)return"";var n="undefined"!=typeof window&&"https:"===(null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.protocol);return/^https?:\/\//.test(e)?n?e.replace(/^https?:\/\//i,"https://"):e:t!==M.HTTP||n?"https://".concat(e):"http://".concat(e)}!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(D||(D={})),function(e){e.WIFI="wifi",e.FOUR_G="4g",e.THREE_G="3g",e.TWO_G="2g",e.FIVE_G="2g",e.THREE_GENT="3gnet",e.UNKONWN="unknown"}(U||(U={})),function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(M||(M={}));var J,H=function(e,t,r){var n=null==r?void 0:r.isReverse;A(e)&&function(){for(var r in e)t(e[r],r,e)}(),(L(e)||y(e))&&function(){if(n)for(var r=e.length-1;r>=0;r--)t(e[r],r);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()};function K(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}c((n=n.apply(e,t||[])).next())})}function q(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}!function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(J||(J={})),"function"==typeof SuppressedError&&SuppressedError;var Y=function(){return o(function e(t,r){var i=this;n(this,e),Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_onCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._promise=new Promise(function(e){i._resolve=e,t(i._onResolve.bind(i))}),this._onCancel=r},[{key:"_onResolve",value:function(e){this._resolve(e)}},{key:"result",value:function(){return this._promise}},{key:"abort",value:function(){this._onCancel(this._onResolve.bind(this))}}])}();function W(e){var t=e.method||D.GET,r=e.timeout||6e4,n=e.headers,i=e.query,o=e.body,a=e.onProgress,s=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var r=Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).filter(function(e){return!!e});return r.length?[e,r.join("&")].join("?"):e}(e.url,i),c=new XMLHttpRequest;if(c.open(t,s),n&&c.setRequestHeader)for(var u in n)c.setRequestHeader(u,n[u]);return function(e,t,r,n){return new Y(function(i){e.onreadystatechange=function(){4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},n&&(e.upload.onprogress=function(e){return n(e)}),0!==t&&setTimeout(function(){e.abort(),i({status:e.status})},t),e.send(r)},function(t){e.abort(),t({status:-1})})}(c,r,o,a)}var z,Q,Z,X=function(){return o(function e(t,r,i){n(this,e),Object.defineProperty(this,"isOk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"msg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isOk=0===t,this.code=t,this.msg=r,this.data=i},[{key:"next",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOk){t.n=1;break}return t.a(2,e(this.data));case 1:return t.a(2,this.wipe())}},t,this)}))}},{key:"or",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)switch(t.n){case 0:if(!this.isOk){t.n=1;break}return t.a(2,this);case 1:return t.a(2,e(this.code))}},t,this)}))}},{key:"orSync",value:function(e){return this.isOk?this:e(this.code)}},{key:"trans",value:function(e){return this.isOk?$(e(this.data)):this.wipe()}},{key:"tryTrans",value:function(e){return this.isOk?e(this.data):this.wipe()}},{key:"errmsg",value:function(){return JSON.stringify({code:this.code,msg:this.msg})}},{key:"wipe",value:function(){return this.isOk?$(void 0,this.msg):ee(this.code,this.msg)}}])}(),$=function(e,t){return new X(0,t||"success",e)},ee=function(e,t,r){return new X(e,t||"fail: ".concat(e),r)},te=function(){var e,t=new Promise(function(t){e=t});return{resolve:e,promise:t}},re=function(){return o(function e(t){n(this,e),z.add(this),Q.set(this,void 0),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,Q,t,"f"),this._logger=t.logger},[{key:"open",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return e=e.sort(function(e,t){return t.weight-e.weight}),t.a(2,q(this,z,"m",Z).call(this,e,q(this,Q,"f")))},t,this)}))}}])}();Q=new WeakMap,z=new WeakSet,Z=function e(t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(0!==t.length){n.n=1;break}return n.a(2,ee(39005,"All addrs failed"));case 1:return i=t.shift(),o=G(i.addr,i.protocol),o="".concat(o,"/v3/message/get_stream.json?sdkVersion=","5.36.1-nctest-alpha.3","&platform=Websocket&messageUID=").concat(r.msgUId),this._logger.info("L-req_stream_msg_content-O","try open -> ".concat(o)),n.n=2,this._openHandler(o,r);case 2:return a=n.v,n.a(2,a.or(function(n){return K(s,void 0,void 0,_().m(function i(){return _().w(function(i){for(;;)switch(i.n){case 0:if(-1!==n){i.n=1;break}return i.a(2,q(this,z,"m",e).call(this,t,r));case 1:return i.a(2,a)}},i,this)}))}))}},n,this)}))};var ne=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,re),o(e,[{key:"_openHandler",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s=this;return _().w(function(r){for(;;)if(0===r.n)return n=te(),i=n.resolve,o=n.promise,(a=new XMLHttpRequest).open("GET",e,!0),a.timeout=t.timeout,a.ontimeout=function(){s._logger.warn("L-req_stream_msg_content-E","timeout -> ".concat(e)),i(ee(-1,"timeout"))},a.onreadystatechange=function(r){if(a.readyState===XMLHttpRequest.HEADERS_RECEIVED){var n=a.getResponseHeader("Content-Type"),o=null==n?void 0:n.startsWith("text/event-stream");if(200===a.status&&o){i($());var c=0;a.onprogress=function(e){var r=a.response.slice(c);c=a.response.length,t.onRawContent(r)},a.onerror=function(r){s._logger.warn("L-req_stream_msg_content-E","network error in transit -> ".concat(e)),a.onprogress=null,a.abort(),t.onNetworkError(39005)}}else a.onloadend=function(){var e=JSON.parse(a.response);i(ee(e.code,e.message))}}},a.onerror=function(t){s._logger.warn("L-req_stream_msg_content-E","req fail -> ".concat(e)),i(ee(-1))},a.setRequestHeader("Content-Type","application/json;charset=UTF-8"),a.setRequestHeader("App-Key",t.appkey),a.setRequestHeader("Authorization","Bearer ".concat(t.token)),a.send(),r.a(2,o)},r)}))}}])}(),ie=!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],r=0,n=t.length;r<n;r++)if(!e[t[r]])return!1;return!0}(uni));var oe=null,ae=function(e){return K(void 0,void 0,void 0,_().m(function t(){var r;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,de.getNetworkType();case 1:r=t.v,oe({status:"online"===e.type,type:r});case 2:return t.a(2)}},t)}))};var se,ce,ue,le,de={tag:"browser",httpReq:function(e){return W(e).result()},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:ie,createWebSocket:function(e,t){var r=new WebSocket(e,t);return r.binaryType="arraybuffer",Promise.resolve($({id:Date.now(),onClose:function(e){r.onclose=function(t){var r=t.code,n=t.reason;e(r,n)}},onError:function(e){r.onerror=e},onMessage:function(e){r.onmessage=function(t){e(t.data)}},onOpen:function(e){r.onopen=e},send:function(e){r.send(e)},close:function(e,t){r.close()}}))},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:U.UNKONWN},t=e.type,r=e.effectiveType,n=t||r||U.UNKONWN;return Promise.resolve(n)},setNetworkStatusListener:function(e){oe=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",ae),window.addEventListener("online",ae))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",ae),window.removeEventListener("online",ae)),oe=null},createSSEClient:function(e){return $(new ne(e))},getApiVer:function(){var e=de.runtimeInfo,t=e.type,r=e.version;return"|".concat(t,"|").concat(r)},get runtimeInfo(){var e,t,r=navigator.userAgent,n={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var i in n)if(n.hasOwnProperty(i)){var o=r.match(n[i]);if(o){t=i,e=o[1]||o[2];break}}return{type:t||"Unknown",version:e||"Unknown"}}},_e=de;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=2]="GROUP",e[e.SYSTEM=3]="SYSTEM",e[e.CUSTOM=4]="CUSTOM",e[e.RTC_ROOM=7]="RTC_ROOM"}(se||(se={})),function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ce||(ce={})),function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.STATISTICS=6]="STATISTICS"}(ue||(ue={})),function(e){e.RTC="RTC",e.CallPlus="CallPlus"}(le||(le={}));class fe{constructor(e){Object.defineProperty(this,"_writer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:0})}debug(e,t,r){this._writer.writeLog(ue.Debug,e,null!=t?t:"",r)}info(e,t,r){this._writer.writeLog(ue.Info,e,null!=t?t:"",r)}warn(e,t,r){this._writer.writeLog(ue.Warn,e,null!=t?t:"",r)}error(e,t,r){this._writer.writeLog(ue.Error,e,null!=t?t:"",r)}createTraceId(){return""+ ++this._traceId}setOutputLevel(e){this._writer.setOutputLevel(e)}__statistics(e,t,r){this._writer.writeLog(ue.STATISTICS,e,null!=t?t:"",r)}}const he={toCommon:e=>e,toNative:e=>e},pe={[e.ConversationType.PRIVATE]:se.PRIVATE,[e.ConversationType.GROUP]:se.GROUP,[e.ConversationType.SYSTEM]:se.SYSTEM,[e.ConversationType.CHATROOM]:se.CUSTOM,[e.ConversationType.APP_PUBLIC_SERVICE]:se.RTC_ROOM,[e.ConversationType.RTC_ROOM]:se.RTC_ROOM},ge={[se.PRIVATE]:e.ConversationType.PRIVATE,[se.GROUP]:e.ConversationType.GROUP,[se.SYSTEM]:e.ConversationType.SYSTEM,[se.CUSTOM]:e.ConversationType.CHATROOM,[se.RTC_ROOM]:e.ConversationType.APP_PUBLIC_SERVICE},Re={toCommon(e){var t;return null!==(t=pe[e])&&void 0!==t?t:e},toNative(e){var t;return null!==(t=ge[e])&&void 0!==t?t:e}},me={[e.RCConnectionStatus.CONNECTED]:ce.CONNECTED,[e.RCConnectionStatus.CONNECTING]:ce.CONNECTING,[e.RCConnectionStatus.DISCONNECTED]:ce.DISCONNECTED,[e.RCConnectionStatus.SUSPENDED]:ce.SUSPENDED},ve={[ce.DISCONNECTED]:e.RCConnectionStatus.DISCONNECTED,[ce.CONNECTING]:e.RCConnectionStatus.CONNECTING,[ce.CONNECTED]:e.RCConnectionStatus.CONNECTED,[ce.SUSPENDED]:e.RCConnectionStatus.SUSPENDED},Te={toNative:e=>Object.assign({},e)},Ce={errorCode:he,conversationType:Re,connectionStatus:{toCommon(e){var t;return null!==(t=me[e])&&void 0!==t?t:e},toNative(e){var t;return null!==(t=ve[e])&&void 0!==t?t:e}},sendMsgOptions:Te,receivedMessage:{toCommon:e=>e},naviInfo:{toCommon(e){var t,r,n;return{voipCallInfo:null!==(t=e.voipCallInfo)&&void 0!==t?t:void 0,rtcAISwitch:e.rtcAISwitch,jwtToken:null!==(r=e.jwtToken)&&void 0!==r?r:e.jwt,logServer:e.logServer,dataCenter:null!==(n=e.dataCenter)&&void 0!==n?n:e.dc,openGzip:e.openGzip,ipType:e.ipType}}}};var Ee,Ie,Se,ye;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=2]="GROUP",e[e.SYSTEM=3]="SYSTEM",e[e.CUSTOM=4]="CUSTOM",e[e.RTC_ROOM=7]="RTC_ROOM"}(Ee||(Ee={})),function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(Ie||(Ie={})),function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e[e.STATISTICS=6]="STATISTICS"}(Se||(Se={})),function(e){e.RTC="RTC",e.CallPlus="CallPlus"}(ye||(ye={}));var be,Oe,Le,ke=0,Ae=2,Ne=-1;exports.RCRTCCode=void 0,(be=exports.RCRTCCode||(exports.RCRTCCode={}))[be.SUCCESS=1e4]="SUCCESS",be[be.PB_ERROR=40001]="PB_ERROR",be[be.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",be[be.PARAMS_ERROR=50001]="PARAMS_ERROR",be[be.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",be[be.NOT_IN_ROOM=50003]="NOT_IN_ROOM",be[be.SERVICE_INVALID=50004]="SERVICE_INVALID",be[be.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",be[be.ASR_NOT_AVAILABLE=50034]="ASR_NOT_AVAILABLE",be[be.ASR_NOT_START=50035]="ASR_NOT_START",be[be.SIGNAL_ERROR=53001]="SIGNAL_ERROR",be[be.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",be[be.REQUEST_FAILED=53004]="REQUEST_FAILED",be[be.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",be[be.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",be[be.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",be[be.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",be[be.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",be[be.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",be[be.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",be[be.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",be[be.INVALID_TAGS=53014]="INVALID_TAGS",be[be.INVALID_USER_ID=53015]="INVALID_USER_ID",be[be.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",be[be.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",be[be.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",be[be.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",be[be.TRACK_NOT_READY=53020]="TRACK_NOT_READY",be[be.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",be[be.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",be[be.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",be[be.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",be[be.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",be[be.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",be[be.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",be[be.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",be[be.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",be[be.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",be[be.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",be[be.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",be[be.JWT_TIME_OUT=1004]="JWT_TIME_OUT",be[be.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",be[be.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",be[be.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",be[be.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",be[be.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",function(e){e.L_INDEX_INSTALL_RTC_PLUGIN_O="L-index_install_rtc_plugin-O",e.L_RTC_CLIENT_IM_CONNECTION_STATE_S="L-rtc_client_im_connection_state-S",e.L_RTC_CLIENT_MESSAGE_O="L-rtc_client_message-O",e.L_RTC_CLIENT_DESTROY_S="L-rtc_client_destroy-S",e.L_RTC_CLIENT_JOIN_RTC_ROOM_T="L-rtc_client_join_rtc_room-T",e.L_RTC_CLIENT_JOIN_RTC_ROOM_O="L-rtc_client_join_rtc_room-O",e.L_RTC_CLIENT_JOIN_RTC_ROOM_R="L-rtc_client_join_rtc_room-R",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_T="L-rtc_client_join_living_room-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_R="L-rtc_client_join_living_room-R",e.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O="L-rtc_client_get_audience_client-O",e.L_RTC_CLIENT_LEAVE_ROOM_T="L-rtc_client_leave_room-T",e.L_RTC_CLIENT_LEAVE_ROOM_R="L-rtc_client_leave_room-R",e.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O="L-rtc_client_create_microphone_audio_track-O",e.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O="L-rtc_client_create_camera_video_track-O",e.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O="L-rtc_client_create_microphone_and_camera_tracks-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O="L-rtc_client_create_screen_video_track-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O="L-rtc_client_create_screen_video_and_audio_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O="L-rtc_client_create_local_audio_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O="L-rtc_client_create_local_video_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O="L-rtc_client_create_local_file_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O="L-rtc_client_create_local_tracks-O",e.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O="L-rtc_client_apply_video_aspect_ratio-O",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_join_living_room_as_audience-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_join_living_room_as_audience_R",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_leave_living_room_as_audience-T",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_leave_living_room_as_audience-R",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T="L-rtc_client_upgrade_to_anchor_room-T",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R="L-rtc_client_upgrade_to_anchor_room-R",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T="L-rtc_client_downgrade_to_audience_room-T",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R="L-rtc_client_downgrade_to_audience_room-R",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T="L-rtc_client_get_joined_room_info-T",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R="L-rtc_client_get_joined_room_info-R",e.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T="L-rtc_client_generate_summarization-T",e.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R="L-rtc_client_generate_summarization-R",e.L_RTC_CLIENT_GET_ASR_CONTENT_T="L-rtc_client_get_asr_content-T",e.L_RTC_CLIENT_GET_ASR_CONTENT_R="L-rtc_client_get_asr_content-R",e.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O="L-audinence_client_call_onTrackReady-O",e.L_AUDIENCE_CLIENT_SUBSCRIBE_T="L-audinence_client_subscribe-T",e.L_AUDIENCE_CLIENT_SUBSCRIBE_R="L-audinence_client_subscribe-R",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T="L-audinence_client_unsubscribe-T",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R="L-audinence_client_unsubscribe-R",e.L_PINGER_START_O="L-pinger_start-O",e.L_PINGER_STOP_O="L-pinger_stop-O",e.L_PINGER_SEND_RTCPING_E="L-pinger_send_rtcping-E",e.L_ABSTRACT_ROOM_SEND_MESSAGE_T="L-abstract_room_send_message-T",e.L_ABSTRACT_ROOM_SEND_MESSAGE_R="L-abstract_room_send_message-R",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T="L-abstract_room_set_room_attribute-T",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R="L-abstract_room_set_room_attribute_R",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T="L-abstract_room_delete_room_attribute_T",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R="L-abstract_room_delete_room_attribute_R",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T="L-abstract_room_get_room_attribute_T",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R="L-abstract_room_get_room_attribute_R",e.L_ABSTRACT_ROOM_PUBLISH_T="L-abstract_room_publish-T",e.L_ABSTRACT_ROOM_PUBLISH_R="L-abstract_room_publish-R",e.L_ABSTRACT_ROOM_PUBLISH_E="L-abstract_room_publish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_T="L-abstract_room_unpublish-T",e.L_ABSTRACT_ROOM_UNPUBLISH_R="L-abstract_room_unpublish-R",e.L_ABSTRACT_ROOM_UNPUBLISH_E="L-abstract_room_unpublish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_P="L-abstract_room_unpublish-P",e.L_ABSTRACT_ROOM_SUBSCRIBE_T="L-abstract_room_subscribe-T",e.L_ABSTRACT_ROOM_SUBSCRIBE_R="L-abstract_room_subscribe-R",e.L_ABSTRACT_ROOM_SUBSCRIBE_E="L-abstract_room_subscribe-E",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_T="L-abstract_room_unsubscribe-T",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_R="L-abstract_room_unsubscribe-R",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_E="L-abstract_room_unsubscribe-E",e.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_T="L-abstract_room_set_src_language-T",e.L_ABSTRACT_ROOM_SET_SRC_LANGUAGE_R="L-abstract_room_set_src_language-R",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T="L-abstract_room_operate_asr_status-T",e.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R="L-abstract_room_operate_asr_status-R",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T="L-abstract_room_set_enable_asr-T",e.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R="L-abstract_room_set_enable_asr-R",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T="L-abstract_room_operate_realtime_translation-T",e.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R="L-abstract_room_operate_realtime_translation-R",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T="L-abstract_room_operate_summarization-T",e.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R="L-abstract_room_operate_summarization-R",e.L_APP_CALL_UNSUBSCRIBE_O="L-app_call_unsubscribe-O",e.L_USER_LEFT_UNSUBSCRIBE_O="L-user_left_unsubscribe-O",e.L_RES_UNPUB_UNSUBSCRIBE_O="L-res_unpub_unsubscribe-O",e.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O="L-abstract_room_register_room_event_listener-O",e.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O="L-abstract_room_register_report_listener-O",e.L_ABSTRACT_ROOM_AUDIO_LEVEL_O="L-abstract_room_audio_level-O",e.L_ABSTRACT_ROOM_IM_RECONNECTED_T="L-abstract_room_im_reconnected-T",e.L_ABSTRACT_ROOM_IM_RECONNECTED_R="L-abstract_room_im_reconnected-R",e.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O="L-abstract_room_call_app_listener-O",e.L_ABSTRACT_ROOM_SETBITRATE_O="L-abstract_room_setBitrate-O",e.L_ABSTRACT_ROOM_ONTRACKREADY_O="L-abstract_room_onTrackReady-O",e.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O="L-abstract_room_receive_message-O",e.L_ABSTRACT_ROOM_ONKICKOFF_O="L-abstract_room_onKickoff-O",e.L_LIVING_ROOM_RECONNECTED_T="L-living_room_reconnected-T",e.L_LIVING_ROOM_RECONNECTED_R="L-living_room_reconnected-R",e.L_LIVING_ROOM_ENABLE_INNER_CDN_T="L-living_room_enable_inner_cdn-T",e.L_LIVING_ROOM_ENABLE_INNER_CDN_R="L-living_room_enable_inner_cdn-R",e.L_LIVING_ROOM_SPREAD_CDN_INFO_T="L-living_room_spread_cdn_info-T",e.L_LIVING_ROOM_SPREAD_CDN_INFO_R="L-living_room_spread_cdn_info-R",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T="L-living_room_set_room_cdn_info-T",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R="L-living_room_set_room_cdn_info-R",e.L_LIVING_ROOM_JOINED_PK_ROOM_T="L-living_room_joined_pk_room-T",e.L_LIVING_ROOM_JOINED_PK_ROOM_R="L-living_room_joined_pk_room-R",e.L_LIVING_ROOM_LEAVE_PK_ROOM_T="L-living_room_leave_pk_room-T",e.L_LIVING_ROOM_LEAVE_PK_ROOM_R="L-living_room_leave_pk_room-R",e.L_APP_CALL_LEAVE_PK_ROOM_O="L-app_call_leave_pk_room-O",e.L_QUIT_PK_LEAVE_PK_ROOM_O="L-quit_pk_leave_pk_room-O",e.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O="L-living_room_get_room_pk_handler-O",e.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O="L-living_room_get_mcu_config_builder-O",e.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O="L-living_room_quit_all_pk_room-O",e.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O="L-living_pk_handler_register_room_pk_event_listener-O",e.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O="L-living_pk_handler_call_app_listener-O",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_request_join_other_room-T",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_request_join_other_room-R",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_cancel_request_join_other_room-T",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_cancel_request_join_other_room-R",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T="L-living_pk_handler_response_join_other_room-T",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R="L-living_pk_handler_response_join_other_room-R",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T="L-living_pk_handler_join_other_room-T",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R="L-living_pk_handler_join_other_room-R",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_T="L-living_pk_handler_leave_other_room-T",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_R="L-living_pk_handler_leave_other_room-R",e.L_QUIT_PK_T="L-quit_pk-T",e.L_QUIT_PK_R="L-quit_pk-R",e.L_EXCHANGE_WITH_PUSHOTHERROOM_T="L-exchange_with_pushotherroom-T",e.L_EXCHANGE_WITH_PUSHOTHERROOM_R="L-exchange_with_pushotherroom-R",e.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O="L-audience_living_room_call_app_listener-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_O="L-audience_living_room_pull_kvEntries-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R",e.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P="L-audience_living_room_singal_data_change-P",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T="L-audience_living_room_get_cdn_play_url-T",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R="L-audience_living_room_get_cdn_play_url-R",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T="L-audience_living_room_subscribe-T",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R="L-audience_living_room_subscribe-R",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T="L-audience_living_room_unsubscribe-T",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R="L-audience_living_room_unsubscribe-R",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T="L-audience_living_room_update_subscribeList-T",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R="L-audience_living_room_update_subscribeList-R",e.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O="L-audience_living_room_onTrackReady-O",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R="L-audience_living_room_im_reconnected-R",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T="L-audience_living_room_im_reconnected-T",e.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O="L-mcu_config_builder_set_host_video_track-O",e.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O="L-mcu_config_builder_set_mix_layout_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O="L-mcu_config_builder_set_output_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_tiny_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O="L-mcu_config_builder_set_output_tiny_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_tiny_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O="L-mcu_config_builder_set_output_video_render_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O="L-mcu_config_builder_set_output_audio_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O="L-mcu_config_builder_set_output_background_color-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_add_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_remove_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_clear_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O="L-mcu_config_builder_set_output_background_picture-fill-mode-O",e.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_add_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_remove_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_clear_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_add_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_remove_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_clear_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_set_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_add_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_remove_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_clear_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_RESET_O="L-mcu_config_builder_reset-O",e.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O="L-mcu_config_builder_add_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O="L-mcu_config_builder_remove_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_CLEAR_SINGLE_WATER_MARK_O="L-mcu_config_builder_clear_single_water_mark-O",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_T="L-media_service_set_mcu_config-T",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_R="L-media_service_set_mcu_config-R",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T="L-media_service_get_cnd_resource_info-T",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R="L-media_service_get_cnd_resource_info-R",e.L_MEDIA_SERVICE_MSLIST_CHANGE_O="L-media_service_msList_change-O",e.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O="L-media_service_parse_navi_callvoip_info-O",e.L_MEDIA_SERVICE_REQUEST_T="L-media_service_request-T",e.L_MEDIA_SERVICE_REQUEST_R="L-media_service_request-R",e.L_LOCAL_TRACK_DESTROY_O="L-loacl_track_destroy-O",e.L_LOCAL_TRACK_SET_BITRATE_O="L-loacl_track_set_bitrate-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_O="L-loacl_track_set_local_muted-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T="L-loacl_track_set_local_muted_spread-T",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R="L-loacl_track_set_local_muted_spread-R",e.L_TRACK_PLAY_O="L-track_play-O",e.L_TRACK_PLAY_E="L-track_play-E",e.L_TRACK_LOAD_START_O="L-track_load_start-O",e.L_TRACK_DURATION_CHANGE_O="L-track_duration_change-O",e.L_TRACK_LOADED_META_DATA_O="L-track_loaded_meta_data-O",e.L_TRACK_LOADED_DATA_O="L-track_loaded_data-O",e.L_TRACK_ABORT_O="L-track_abort-O",e.L_TRACK_VOLUME_CHANGE_O="L-track_volume_change-O",e.L_TRACK_CANPLAY_O="L-track_canplay-O",e.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O="L-abstract_stat_parser_format_rtc_state_report-O",e.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O="L-a_sdp_strategy_set_sdp_semantics-O",e.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O="L-a_sdp_strategy_set_remote_answer-O",e.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O="L-rtc_peer_connection_add_local_track-O",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S="L-rtc_peer_connection_ice_connection_state-S",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R="L-rtc_peer_connection_ice_connection_state_report-R",e.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S="L-rtc_peer_connection_connection_state-S",e.L_RTC_PEER_CONNECTION_SET_BITRATE_O="L-rtc_peer_connection_set_bitrate-O",e.L_RTC_PEER_CONNECTION_CREATE_OFFER_O="L-rtc_peer_connection_create_offer-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O="L-rtc_peer_connection_remove_local_track_by_id-O",e.L_RTC_PEER_CONNECTION_REMOVE_ALL_LOCAL_TRACK_O="L-rtc_peer_connection_remove_all_local_track-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O="L-rtc_peer_connection_remove_local_track-O",e.L_RTC_PEER_CONNECTION_DESTROY_O="L-rtc_peer_connection_destroy-O",e.L_RTC_SET_RECOMMEND_BITRATE_O="L_rtc_set_recommend_bitrate_O",e.L_RTC_3ANOISE_NODE_O="L_RTC_AAAnoiseNode_O",e.L_RTC_3ANOISE_NODE_E="L_RTC_AAAnoiseNode_E",e.L_RTC_3ANOISE_NODE_STOP_O="L_RTC_AAAnoiseNode_Stop_O",e.L_QS_JOIN_ROOM_S="RTC-joinRoomRtc-S",e.L_QS_SUBSCRIBE_S="RTC-subscribe-S",e.L_QS_UNSUBSCRIBE_S="RTC-unsubscribe-S",e.L_QS_PUBLISH_S="RTC-publishRtc-S",e.L_QS_UNPUBLISH_S="RTC-unpublishRtc-S",e.L_QS_ICE_STATUS_S="RTC-iceStatus-S",e.L_QS_KICKED_S="RTC-forcedOffline-S",e.L_QS_PUB_ICE_STATUS_S="RTC-pubIceConnected-S",e.L_QS_SUB_ICE_STATUS_S="RTC-subIceConnected-S",e.L_QS_RECV_PUB_MSG_S="RTC-recvPubMsg-S",e.L_SET_ENCODER_PREFERENCES_S="RTC-set_Encoder_Preferences-S",e.L_RTCNTF_PULL_ROOM_STATUS_O="L-rtcntf_pull_room_status-O",e.L_RTCPING_PULL_ROOM_STATUS_O="L-rtcping_pull_room_status-O",e.L_PULL_ROOM_STATUS_T="L-pull_room_status-T",e.L_PULL_ROOM_STATUS_R="L-pull_room_status-R",e.L_OLD_DAILY_RECORD_O="L-old_daily_record-O",e.L_REMOTE_USER_JOINED_RESOURCES_O="L-remote_user_joined_resources-O",e.L_REMOTE_USER_STATE_HANDLE_O="L-remote_user_state_handle-O",e.L_UPDATE_SUBSCRIBELIST_COMMAND_T="L-update_subscribeList_command-T",e.L_UPDATE_SUBSCRIBELIST_COMMAND_P="L-update_subscribeList_command-P",e.L_UPDATE_SUBSCRIBELIST_COMMAND_R="L-update_subscribeList_command-R",e.L_RTC_CLIENT_NAVI_CHANGE_O="L-rtc_client_navi_change-O",e.L_UNPUBLISH_PREV_COMMAND_T="L-unpublish_prev_command-T",e.L_UNPUBLISH_PREV_COMMAND_R="L-unpublish_prev_command-R",e.L_RETRY_EXCHANGE_COMMAND_T="L-retry_exchange_command-T",e.L_RETRY_EXCHANGE_SPREAD_T="L-retry_exchange_spread-T",e.L_RETRY_EXCHANGE_SPREAD_R="L-retry_exchange_spread-R",e.L_PARSE_USERSTATE_COMMAND_R="L-parse_userstate_command-R",e.L_RESUB_REPUB_RES_R="L-resub_repub_res-R",e.L_PARSE_ROOMDATA_URIS_R="L-parse_roomdata_uris-R",e.L_SET_AUDIO_CONSTRAINTS_O="L-set_audio_constraints-O",e.L_FUNCTION_IS_UNAVAILABLE="L-function_is_unavailable",e.L_CLEAR_UNSUBSCRIBE_LIST_O="L-clear_unsubscribe_list-O",e.L_INVOKER_PUSH_O="L-invoker_push-O",e.L_INVOKER_EXECUTE_T="L-invoker_execute-T",e.L_INVOKER_EXECUTE_R="L-invoker_execute-R",e.L_INVOKER_DESTROY_O="L-invoker_destroy-R",e.L_PARSE_VOIP_SERVER_CONF_E="L_PARSE_VOIP_SERVER_CONF_E",e.L_GET_MEDIA_STREAM_E="L_GET_MEDIA_STREAM_E",e.L_INNER_SET_TRACK_O="L_INNER_SET_TRACK_O",e.A_APPLY_3A_NOISE_WORKLET_T="A-apply_3a_noise_worklet-T",e.A_APPLY_3A_NOISE_WORKLET_R="A-apply_3a_noise_worklet-R",e.L_ENCRYPTOR_ENCODE_E="L-encryptor_encode-E",e.L_ENCRYPTOR_DECODE_E="L-encryptor_decode-E",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T="L-rtc_client_change_media_device-T",e.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R="L-rtc_client_change_media_device-R"}(Oe||(Oe={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(Le||(Le={}));let we=!0,Pe=!0;function De(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Ue(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Me(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(we=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function xe(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Pe=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Be(){if("object"==typeof window){if(we)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Ve(e,t){Pe&&console.warn(e+" is deprecated, please use "+t+" instead.")}function je(e){return"[object Object]"===Object.prototype.toString.call(e)}function Fe(e){return je(e)?Object.keys(e).reduce(function(t,r){const n=je(e[r]),i=n?Fe(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})},{}):e}function Ge(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach(n=>{n.endsWith("Id")?Ge(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach(t=>{Ge(e,e.get(t),r)})}))}function Je(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)}),o.forEach(t=>{e.forEach(r=>{r.type===n&&r.trackId===t.id&&Ge(e,r,i)})}),i}const He=Be;function Ke(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach(e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then(r=>{let a=(r=r.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=n(e.video),He("chrome: "+JSON.stringify(e)),i(e)})}e.video=n(e.video)}return He("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,e=>{r.webkitGetUserMedia(e,t,e=>{n&&n(o(e))})})}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(o(e))))}}}function qe(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ye(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Ue(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function We(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ze(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{r[t]=e.stat(t)}),t[r.id]=r}),t},o=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])}).then(r,n)}}function Qe(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Je(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Ue(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>Je(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach(r=>{r.track===e&&(t?n=!0:t=r)}),this.getReceivers().forEach(t=>(t.track===e&&(r?n=!0:r=t),t.track===e)),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Ze(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function Xe(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Ze(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then(e=>o(this,e))}};e.RTCPeerConnection.prototype[t]=n[t]});const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(t=>e.track===t)&&(t=this._streams[r])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function $e(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]})}function et(e,t){Ue(e,"negotiationneeded",e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e})}var tt=Object.freeze({__proto__:null,shimMediaStream:qe,shimOnTrack:Ye,shimGetSendersWithDtmf:We,shimGetStats:ze,shimSenderReceiverGetStats:Qe,shimAddTrackRemoveTrackWithNative:Ze,shimAddTrackRemoveTrack:Xe,shimPeerConnection:$e,fixNegotiationNeeded:et,shimGetUserMedia:Ke,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then(t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var rt,nt,it=(rt=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},t.splitSections=function(e){return e.split("\nm=").map(function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"})},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter(function(e){return 0===e.indexOf(r)})},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach(function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)}),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach(function(e){r.headerExtensions.push(t.parseExtmap(e))}),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach(function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)});var i=0;return r.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach(function(e){n+=t.writeExtmap(e)}),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}}),0===n.length&&c&&n.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach(function(e){e.maxBitrate=l})),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map(function(e){return t.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,n,i){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t},rt(nt={exports:{}},nt.exports),nt.exports);function ot(e,t,r,n,i){var o=it.writeRtpDescription(e.kind,t);if(o+=it.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=it.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(n?n.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+it.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+it.localCName+"\r\n"),o}function at(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},i=function(e,t,r,i){var o=n(e.parameters.apt,r),a=n(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach(function(n){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(n.name.toLowerCase()===a.name.toLowerCase()&&n.clockRate===a.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&a.parameters.apt&&!i(n,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(n.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter(function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}}),r}function st(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function ct(e,t){var r=e.getRemoteCandidates().find(function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type});return r||e.addRemoteCandidate(t),!r}function ut(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var lt=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function n(t,r,n,i){var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=i,e.setTimeout(function(){t._dispatchEvent("track",o)})}var i=function(r){var n=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){n[e]=i[e].bind(i)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw ut("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof n;return i&&(n=[n]),n=n.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)}),delete e.url,e.urls=i?n[0]:n,!!n.length}})}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=it.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport,n.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(n),n},i.prototype.addTrack=function(t,r){if(this._isClosed)throw ut("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find(function(e){return e.track===t}))throw ut("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(n=this.transceivers[i]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),n.track=t,n.stream=r,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},i.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach(function(t){r.addTrack(t,e)});else{var n=e.clone();e.getTracks().forEach(function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",function(e){r.enabled=e.enabled})}),n.getTracks().forEach(function(e){r.addTrack(e,n)})}},i.prototype.removeTrack=function(t){if(this._isClosed)throw ut("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find(function(e){return e.rtpSender===t});if(!r)throw ut("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var r=t.getSenders().find(function(t){return t.track===e});r&&t.removeTrack(r)})},i.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},i.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},i.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;i.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,r){var n=this,i=this.transceivers[r].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),i.onlocalcandidate=function(e){if(!(n.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=it.writeCandidate(a);o.candidate=Object.assign(o.candidate,it.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=it.getMediaSections(n._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",n._localDescription.sdp=it.getDescription(n._localDescription.sdp)+u.join("");var l=n.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),s||n._dispatchEvent("icecandidate",o),l&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout(function(){o.forEach(function(e){i.onlocalcandidate(e)})},0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,r,n){var i=at(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:it.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,r,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(ut("TypeError",'Unsupported type "'+e.type+'"'));if(!st("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(ut("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=it.splitSections(e.sdp),r=t.shift(),t.forEach(function(e,t){var r=it.parseRtpParameters(e);n.transceivers[t].localCapabilities=r}),n.transceivers.forEach(function(e,t){n._gather(e.mid,t)});else if("answer"===e.type){t=it.splitSections(n._remoteDescription.sdp),r=t.shift();var i=it.matchPrefix(r,"a=ice-lite").length>0;t.forEach(function(e,t){var o=n.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(it.isRejected(e)&&0===it.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var d=it.getIceParameters(e,r),_=it.getDtlsParameters(e,r);i&&(_.role="server"),n.usingBundle&&0!==t||(n._gather(o.mid,t),"new"===s.state&&s.start(a,d,i?"controlling":"controlled"),"new"===c.state&&c.start(_));var f=at(u,l);n._transceive(o,f.codecs.length>0,!1)}})}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(ut("TypeError",'Unsupported type "'+i.type+'"'));if(!st("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(ut("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach(function(e){a[e.id]=e});var s=[],c=it.splitSections(i.sdp),u=c.shift(),l=it.matchPrefix(u,"a=ice-lite").length>0,d=it.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var _=it.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!_&&_.substr(14).split(" ").indexOf("trickle")>=0,c.forEach(function(n,c){var _=it.splitLines(n),f=it.getKind(n),h=it.isRejected(n)&&0===it.matchPrefix(n,"a=bundle-only").length,p=_[0].substr(2).split(" ")[2],g=it.getDirection(n,u),R=it.parseMsid(n),m=it.getMid(n)||it.generateIdentifier();if(h||"application"===f&&("DTLS/SCTP"===p||"UDP/DTLS/SCTP"===p))o.transceivers[c]={mid:m,kind:f,protocol:p,rejected:!0};else{var v,T,C,E,I,S,y,b,O;!h&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(f,!0));var L,k,A=it.parseRtpParameters(n);h||(L=it.getIceParameters(n,u),(k=it.getDtlsParameters(n,u)).role="client"),y=it.parseRtpEncodingParameters(n);var N=it.parseRtcpParameters(n),w=it.matchPrefix(n,"a=end-of-candidates",u).length>0,P=it.matchPrefix(n,"a=candidate:").map(function(e){return it.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===i.type||"answer"===i.type)&&!h&&d&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||h){if("answer"===i.type&&!h){T=(v=o.transceivers[c]).iceGatherer,C=v.iceTransport,E=v.dtlsTransport,I=v.rtpReceiver,S=v.sendEncodingParameters,b=v.localCapabilities,o.transceivers[c].recvEncodingParameters=y,o.transceivers[c].remoteCapabilities=A,o.transceivers[c].rtcpParameters=N,P.length&&"new"===C.state&&(!l&&!w||d&&0!==c?P.forEach(function(e){ct(v.iceTransport,e)}):C.setRemoteCandidates(P)),d&&0!==c||("new"===C.state&&C.start(T,L,"controlling"),"new"===E.state&&E.start(k)),!at(v.localCapabilities,v.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&v.sendEncodingParameters[0].rtx&&delete v.sendEncodingParameters[0].rtx,o._transceive(v,"sendrecv"===g||"recvonly"===g,"sendrecv"===g||"sendonly"===g),!I||"sendrecv"!==g&&"sendonly"!==g?delete v.rtpReceiver:(O=I.track,R?(a[R.stream]||(a[R.stream]=new e.MediaStream),r(O,a[R.stream]),s.push([O,I,a[R.stream]])):(a.default||(a.default=new e.MediaStream),r(O,a.default),s.push([O,I,a.default])))}}else{(v=o.transceivers[c]||o._createTransceiver(f)).mid=m,v.iceGatherer||(v.iceGatherer=o._createIceGatherer(c,d)),P.length&&"new"===v.iceTransport.state&&(!w||d&&0!==c?P.forEach(function(e){ct(v.iceTransport,e)}):v.iceTransport.setRemoteCandidates(P)),b=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(b.codecs=b.codecs.filter(function(e){return"rtx"!==e.name})),S=v.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var D,U=!1;if("sendrecv"===g||"sendonly"===g){if(U=!v.rtpReceiver,I=v.rtpReceiver||new e.RTCRtpReceiver(v.dtlsTransport,f),U)O=I.track,R&&"-"===R.stream||(R?(a[R.stream]||(a[R.stream]=new e.MediaStream,Object.defineProperty(a[R.stream],"id",{get:function(){return R.stream}})),Object.defineProperty(O,"id",{get:function(){return R.track}}),D=a[R.stream]):(a.default||(a.default=new e.MediaStream),D=a.default)),D&&(r(O,D),v.associatedRemoteMediaStreams.push(D)),s.push([O,I,D])}else v.rtpReceiver&&v.rtpReceiver.track&&(v.associatedRemoteMediaStreams.forEach(function(t){var r=t.getTracks().find(function(e){return e.id===v.rtpReceiver.track.id});r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)}),v.associatedRemoteMediaStreams=[]);v.localCapabilities=b,v.remoteCapabilities=A,v.rtpReceiver=I,v.rtcpParameters=N,v.sendEncodingParameters=S,v.recvEncodingParameters=y,o._transceive(o.transceivers[c],!1,U)}}}),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach(function(t){var r=a[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout(function(){o._dispatchEvent("addstream",i)})}s.forEach(function(e){var t=e[0],i=e[1];r.id===e[2].id&&n(o,t,i,[r])})}}),s.forEach(function(e){e[2]||n(o,e[0],e[1],[])}),e.setTimeout(function(){o&&o.transceivers&&o.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++}),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},i.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(ut("InvalidStateError","Can not call createOffer after close"));var n=r.transceivers.filter(function(e){return"audio"===e.kind}).length,i=r.transceivers.filter(function(e){return"video"===e.kind}).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(n=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach(function(e){"audio"===e.kind?--n<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)});n>0||i>0;)n>0&&(r._createTransceiver("audio"),n--),i>0&&(r._createTransceiver("video"),i--);var a=it.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach(function(n,i){var o=n.track,a=n.kind,s=n.mid||it.generateIdentifier();n.mid=s,n.iceGatherer||(n.iceGatherer=r._createIceGatherer(i,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter(function(e){return"rtx"!==e.name})),c.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),c.headerExtensions.forEach(function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var u=n.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=c,n.sendEncodingParameters=u}),"max-compat"!==r._config.bundlePolicy&&(a+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",r.transceivers.forEach(function(e,t){a+=ot(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,a+="a="+it.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))});var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(ut("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(ut("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var n=it.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(n+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),n+="a=ice-options:trickle\r\n";var i=it.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach(function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?n+="m=application 0 DTLS/SCTP 5000\r\n":n+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;if(e.stream)"audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=at(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,n+=ot(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(n+="a=rtcp-rsize\r\n")}});var o=new e.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(n,i){if(!r._remoteDescription)return i(ut("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<r.transceivers.length;a++)if(r.transceivers[a].mid===e.sdpMid){o=a;break}var s=r.transceivers[o];if(!s)return i(ut("OperationError","Can not add ICE candidate"));if(s.rejected)return n();var c=Object.keys(e.candidate).length>0?it.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return n();if(c.component&&1!==c.component)return n();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!ct(s.iceTransport,c))return i(ut("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=it.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=it.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var l=0;l<r.transceivers.length&&(r.transceivers[l].rejected||(r.transceivers[l].iceTransport.addRemoteCandidate({}),(t=it.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=it.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);n()})},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)}),!r)throw ut("InvalidAccessError","Invalid selector.");return r.getStats()}var n=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(t){e[t]&&n.push(e[t].getStats())})}),Promise.all(n).then(function(e){var t=new Map;return e.forEach(function(e){e.forEach(function(e){t.set(e.id,e)})}),t})};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then(function(e){var t=new Map;return Object.keys(e).forEach(function(r){var n;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[r]).type]||n.type,t.set(r,e[r])}),t})}}});var o=["createOffer","createAnswer"];return o.forEach(function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then(function(t){"function"==typeof e[0]&&e[0].apply(null,[t])},function(t){"function"==typeof e[1]&&e[1].apply(null,[t])}):t.apply(this,arguments)}}),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(t){"function"==typeof e[2]&&e[2].apply(null,[t])}):t.apply(this,arguments)}}),["getStats"].forEach(function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):t.apply(this,arguments)}}),i};function dt(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function _t(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function ft(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=lt(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e){let t=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let r=e.urls||e.url;e.url&&!e.urls&&Ve("RTCIceServer.url","RTCIceServer.urls");const n="string"==typeof r;return n&&(r=[r]),r=r.filter(e=>{if(0===e.indexOf("stun:"))return!1;const r=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return r&&!t?(t=!0,!0):r&&!t}),delete e.url,e.urls=n?r[0]:r,!!r.length}})}(e.iceServers,t.version),Be("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function ht(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var pt=Object.freeze({__proto__:null,shimPeerConnection:ft,shimReplaceTrack:ht,shimGetUserMedia:dt,shimGetDisplayMedia:_t});function gt(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Ve("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function Rt(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function mt(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]});const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(i,o)}}function vt(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Tt(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Ue(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Ct(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Ve("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Et(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function It(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return n})}function St(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function yt(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function bt(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ot=Object.freeze({__proto__:null,shimOnTrack:Rt,shimPeerConnection:mt,shimSenderGetStats:vt,shimReceiverGetStats:Tt,shimRemoveStream:Ct,shimRTCDataChannel:Et,shimAddTransceiver:It,shimGetParameters:St,shimCreateOffer:yt,shimCreateAnswer:bt,shimGetUserMedia:gt,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Lt(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>t.call(this,r,e)),e.getVideoTracks().forEach(r=>t.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function kt(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)})}),t.apply(e,arguments)}}}function At(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){const n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}function Nt(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(wt(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function wt(e){return e&&void 0!==e.video?Object.assign({},e,{video:Fe(e.video)}):e}function Pt(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(Ve("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Dt(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Ut(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function Mt(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xt=Object.freeze({__proto__:null,shimLocalStreamsAPI:Lt,shimRemoteStreamsAPI:kt,shimCallbacksAPI:At,shimGetUserMedia:Nt,shimConstraints:wt,shimRTCIceServerUrls:Pt,shimTrackEventTransceiver:Dt,shimCreateOfferLegacy:Ut,shimAudioContext:Mt});function Bt(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=it.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Ue(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Vt(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=it.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=it.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),r=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r}(e),n=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=it.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],e);let i;i=0===r&&0===n?Number.POSITIVE_INFINITY:0===r||0===n?Math.max(r,n):Math.min(r,n);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return r.apply(this,arguments)}}function jt(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},Ue(e,"datachannel",e=>(t(e.channel,e.target),e))}function Ft(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function Gt(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Jt(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var Ht=Object.freeze({__proto__:null,shimRTCIceCandidate:Bt,shimMaxMessageSize:Vt,shimSendThrowTypeError:jt,shimConnectionState:Ft,removeExtmapAllowMixed:Gt,shimAddIceCandidateNullOrEmpty:Jt});const Kt=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=Be,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=De(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=De(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=De(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=De(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:Ht,extractVersion:De,disableLog:Me,disableWarnings:xe};switch(n.browser){case"chrome":if(!tt||!$e||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=tt,Jt(e,n),Ke(e,n),qe(e),$e(e,n),Ye(e),Xe(e,n),We(e),ze(e),Qe(e),et(e,n),Bt(e),Ft(e),Vt(e,n),jt(e),Gt(e,n);break;case"firefox":if(!Ot||!mt||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=Ot,Jt(e,n),gt(e,n),mt(e,n),Rt(e),Ct(e),vt(e),Tt(e),Et(e),It(e),St(e),yt(e),bt(e),Bt(e),Ft(e),Vt(e,n),jt(e);break;case"edge":if(!pt||!ft||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),i;r("adapter.js shimming edge."),i.browserShim=pt,dt(e),_t(e),ft(e,n),ht(e),Vt(e,n),jt(e);break;case"safari":if(!xt||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=xt,Jt(e,n),Pt(e),Ut(e),At(e),Lt(e),kt(e),Dt(e),Nt(e),Mt(e),Bt(e),Vt(e,n),jt(e),Gt(e,n);break;default:r("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var qt,Yt,Wt,zt;exports.RCFrameRate=void 0,(qt=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",qt.FPS_15="FPS_15",qt.FPS_24="FPS_24",qt.FPS_30="FPS_30",exports.RCResolution=void 0,(Yt=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",Yt.W176_H144="W176_H144",Yt.W180_H180="W180_H180",Yt.W240_H180="W240_H180",Yt.W240_H240="W240_H240",Yt.W256_H144="W256_H144",Yt.W320_H180="W320_H180",Yt.W320_H240="W320_H240",Yt.W360_H360="W360_H360",Yt.W480_H360="W480_H360",Yt.W480_H480="W480_H480",Yt.W640_H360="W640_H360",Yt.W640_H480="W640_H480",Yt.W720_H480="W720_H480",Yt.W848_H480="W848_H480",Yt.W960_H720="W960_H720",Yt.W1280_H720="W1280_H720",Yt.W1920_H1080="W1920_H1080",Yt.W144_H176="W144_H176",Yt.W144_H256="W144_H256",Yt.W180_H240="W180_H240",Yt.W180_H320="W180_H320",Yt.W240_H320="W240_H320",Yt.W360_H480="W360_H480",Yt.W360_H640="W360_H640",Yt.W480_H640="W480_H640",Yt.W480_H720="W480_H720",Yt.W480_H848="W480_H848",Yt.W720_H1280="W720_H1280",Yt.W720_H960="W720_H960",Yt.W1080_H1920="W1080_H1920",exports.RCMediaType=void 0,(Wt=exports.RCMediaType||(exports.RCMediaType={}))[Wt.AUDIO_ONLY=0]="AUDIO_ONLY",Wt[Wt.VIDEO_ONLY=1]="VIDEO_ONLY",Wt[Wt.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Qt,Zt=(s(s(s(s(s(s(s(s(s(s(zt={},exports.RCResolution.W176_H132,{width:176,height:132,maxBitrate:150,minBitrate:80}),exports.RCResolution.W176_H144,{width:176,height:144,maxBitrate:150,minBitrate:80}),exports.RCResolution.W180_H180,{width:180,height:180,maxBitrate:200,minBitrate:100}),exports.RCResolution.W240_H180,{width:240,height:180,maxBitrate:240,minBitrate:120}),exports.RCResolution.W240_H240,{width:240,height:240,maxBitrate:280,minBitrate:120}),exports.RCResolution.W256_H144,{width:256,height:144,maxBitrate:240,minBitrate:120}),exports.RCResolution.W320_H180,{width:320,height:180,maxBitrate:280,minBitrate:120}),exports.RCResolution.W320_H240,{width:320,height:240,maxBitrate:400,minBitrate:120}),exports.RCResolution.W360_H360,{width:360,height:360,maxBitrate:520,minBitrate:140}),exports.RCResolution.W480_H360,{width:480,height:360,maxBitrate:650,minBitrate:150}),s(s(s(s(s(s(s(s(s(s(zt,exports.RCResolution.W480_H480,{width:480,height:480,maxBitrate:800,minBitrate:180}),exports.RCResolution.W640_H360,{width:640,height:360,maxBitrate:800,minBitrate:180}),exports.RCResolution.W640_H480,{width:640,height:480,maxBitrate:900,minBitrate:200}),exports.RCResolution.W720_H480,{width:720,height:480,maxBitrate:1e3,minBitrate:200}),exports.RCResolution.W848_H480,{width:848,height:480,maxBitrate:1860,minBitrate:200}),exports.RCResolution.W960_H720,{width:960,height:720,maxBitrate:2e3,minBitrate:250}),exports.RCResolution.W1280_H720,{width:1280,height:720,maxBitrate:2200,minBitrate:250}),exports.RCResolution.W1920_H1080,{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}),exports.RCResolution.W144_H176,{width:144,height:176,maxBitrate:150,minBitrate:80}),exports.RCResolution.W144_H256,{width:144,height:256,maxBitrate:240,minBitrate:120}),s(s(s(s(s(s(s(s(s(s(zt,exports.RCResolution.W180_H240,{width:180,height:240,maxBitrate:240,minBitrate:120}),exports.RCResolution.W180_H320,{width:180,height:320,maxBitrate:280,minBitrate:120}),exports.RCResolution.W240_H320,{width:240,height:320,maxBitrate:400,minBitrate:120}),exports.RCResolution.W360_H480,{width:360,height:480,maxBitrate:650,minBitrate:150}),exports.RCResolution.W360_H640,{width:360,height:640,maxBitrate:800,minBitrate:180}),exports.RCResolution.W480_H640,{width:480,height:640,maxBitrate:900,minBitrate:200}),exports.RCResolution.W480_H720,{width:480,height:720,maxBitrate:1e3,minBitrate:200}),exports.RCResolution.W480_H848,{width:480,height:848,maxBitrate:1860,minBitrate:930}),exports.RCResolution.W720_H1280,{width:720,height:1280,maxBitrate:2200,minBitrate:250}),exports.RCResolution.W720_H960,{width:720,height:960,maxBitrate:2760,minBitrate:910}),s(zt,exports.RCResolution.W1080_H1920,{width:1080,height:1920,maxBitrate:4e3,minBitrate:400})),Xt=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},$t=function(e,t){e=Xt(e),t=Xt(t);var r=Zt["W".concat(e,"_H").concat(t)];if(r)return r;var n=e*t;return Object.keys(Zt).map(function(e){return Zt[e]}).sort(function(e,t){return e.height*e.width-t.width*t.height}).filter(function(e){return e.height*e.width>=n})[0]||Zt.W1920_H1080},er={10:1,15:1,24:1.5,30:1.5},tr=function(e){var t=Number.MAX_VALUE,r=1;for(var n in er){var i=Math.abs(e-parseInt(n));i<t&&(t=i,r=er[n])}return r},rr={getCameras:function(){return K(void 0,void 0,void 0,_().m(function e(){var t;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"videoinput"===e.kind}))}},e)}))},getMicrophones:function(){return K(void 0,void 0,void 0,_().m(function e(){var t;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"audioinput"===e.kind}))}},e)}))},getSpeakers:function(){return K(void 0,void 0,void 0,_().m(function e(){var t;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,navigator.mediaDevices.enumerateDevices();case 1:return t=e.v,e.a(2,t.filter(function(e){return"audiooutput"===e.kind}))}},e)}))}};!function(e){e.AUDIO="audio",e.VIDEO="video"}(Qt||(Qt={}));var nr,ir=function(){function e(t,i,o,a,s,c){var u;return n(this,e),u=r(this,e),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(u,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u._streamId=[u._userId||u._roomId,u._tag].join("_"),u._id=[u._streamId,u.isAudioTrack()?0:1].join("_"),u}return l(e,F),o(e,[{key:"getStreamId",value:function(){return this._streamId}},{key:"getTrackId",value:function(){return this._id}},{key:"getUserId",value:function(){return this._userId}},{key:"__innerGetMediaStreamTrack",value:function(){return this._msTrack}},{key:"streamTrack",get:function(){return this._msTrack}},{key:"getTag",value:function(){return this._tag}},{key:"isLocalTrack",value:function(){return this._isLocalTrack}},{key:"isVideoTrack",value:function(){return"video"===this._kind}},{key:"isAudioTrack",value:function(){return"audio"===this._kind}},{key:"isReady",value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}},{key:"__innerSetMediaStreamTrack",value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,r=t.getTracks()[0];r&&t.removeTrack(r),this._isLocalTrack||this._logger.warn(Oe.L_INNER_SET_TRACK_O,"trackId: ".concat(this._id,", track: ").concat(e?e.id:"undefined")),e?t.addTrack(e):this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.pause(),this._element.srcObject=null)}},{key:"_setLocalMuted",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,t.a(2,exports.RCRTCCode.SUCCESS)},t,this)}))}},{key:"mute",value:function(){return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)if(0===e.n)return e.a(2,this._setLocalMuted(!0))},e,this)}))}},{key:"unmute",value:function(){return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)if(0===e.n)return e.a(2,this._setLocalMuted(!1))},e,this)}))}},{key:"isLocalMuted",value:function(){return this._localMuted}},{key:"isMCUTrack",value:function(){return Boolean(this._roomId)}},{key:"isOwnerMuted",value:function(){return this._remoteMuted}},{key:"_validateVolume",value:function(e){if(null==e?void 0:e.volume){if(!O(null==e?void 0:e.volume))return this._logger.error(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==e?void 0:e.volume)<0&&(e.volume=0,this._logger.warn(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,msg:"params error -> options.volume < 0",tips:"the valid range of options.volume is 0-100, the value of volume has been set 0"}))),(null==e?void 0:e.volume)>100&&(e.volume=100,this._logger.warn(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,msg:"params error -> options.volume > 100",tips:"the valid range of options.volume is 0-100, the value of volume has been set 100"})))}}},{key:"_validatePlayOptions",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i;return _().w(function(r){for(;;)switch(r.n){case 0:if(this._msTrack){r.n=1;break}return this._logger.error(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),r.a(2,{code:exports.RCRTCCode.TRACK_NOT_READY});case 1:if("ended"===this._msTrack.readyState&&this._logger.warn(Oe.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),!(n=this._validateVolume(t))){r.n=2;break}return r.a(2,n);case 2:if(!(null==t?void 0:t.audioDeviceId)){r.n=4;break}return r.n=3,rr.getSpeakers();case 3:if(i=r.v.map(function(e){return e.deviceId}),i.includes(t.audioDeviceId)){r.n=4;break}return this._logger.error(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))){r.n=5;break}return this._logger.error(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),r.a(2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT});case 5:return r.a(2)}},r,this)}))}},{key:"_setPlayAttrs",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n;return _().w(function(r){for(;;)switch(r.n){case 0:if(e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e){r.n=1;break}return r.n=1,this._element.setSinkId(t.audioDeviceId);case 1:e||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=t.volume/100),null===(n=this._element)||void 0===n||n.setAttribute(this.DataTrackId,this.getTrackId());case 2:return r.a(2)}},r,this)}))}},{key:"play",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o=this;return _().w(function(r){for(;;)switch(r.n){case 0:return this._logger.info(Oe.L_TRACK_PLAY_O,JSON.stringify({elementId:null==e?void 0:e.id,trackId:this._id,kind:this._kind,options:t?{volume:null==t?void 0:t.volume,audioDeviceId:t.audioDeviceId}:void 0})),r.n=1,this._validatePlayOptions(e,t);case 1:if(!(n=r.v)){r.n=2;break}return r.a(2,n);case 2:return i=this.isVideoTrack(),this._element=i?e:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t;o._logger.info(Oe.L_TRACK_LOAD_START_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.ondurationchange=function(e){var t;o._logger.info(Oe.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onloadedmetadata=function(e){var t;o._logger.info(Oe.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onloadeddata=function(e){var t;o._logger.info(Oe.L_TRACK_LOADED_DATA_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.onabort=function(e){var t;o._logger.info(Oe.L_TRACK_ABORT_O,JSON.stringify({status:Le.INFO,kind:o._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(o._id)}))},this._element.oncanplay=function(e){return K(o,void 0,void 0,_().m(function r(){var n,o,a;return _().w(function(r){for(;;)switch(r.p=r.n){case 0:if(this._logger.info(Oe.L_TRACK_CANPLAY_O,JSON.stringify({status:Le.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(n=e.target)||void 0===n?void 0:n.id,", trackId: ").concat(this._id)})),r.p=1,!(null==t?void 0:t.audioDeviceId)||i){r.n=2;break}return r.n=2,this._element.setSinkId(t.audioDeviceId);case 2:return r.n=3,null===(o=this._element)||void 0===o?void 0:o.play();case 3:r.n=6;break;case 4:if(r.p=4,"No permission to use requested device"!==(a=r.v).message){r.n=5;break}return this._logger.error(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,kind:this._kind,code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(a.message)})),r.a(2);case 5:this._logger.error(Oe.L_TRACK_PLAY_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.TRACK_PLAY_ERROR,kind:this._kind,msg:"play error, error msg: ".concat(a.message)}));case 6:return r.a(2)}},r,this,[[1,4]])}))},this._element.onvolumechange=function(e){var t,r,n=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));o._logger.info(Oe.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:Le.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", volume: ").concat(n,", trackId: ").concat(o._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,r.n=3,this._setPlayAttrs(i,t);case 3:return r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"__innerDestroy",value:function(){this.__innerSetMediaStreamTrack(void 0)}},{key:"__releaseMediaElement",value:function(){this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.remove(),this._element.srcObject=null)}},{key:"_validateVideoNodeName",value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}])}();exports.RCAudioBitrate=void 0,(nr=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",nr.Music="Music",nr.MusicHigh="MusicHigh";var or,ar=s(s(s({},exports.RCAudioBitrate.Music,{max:64,min:64}),exports.RCAudioBitrate.MusicHigh,{max:128,min:128}),exports.RCAudioBitrate.Speech,{max:32,min:32});exports.RCVideoBitrate=void 0,(or=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",or.LEVEL1="LEVEL1",or.LEVEL2="LEVEL2",or.LEVEL3="LEVEL3",or.LEVEL4="LEVEL4",or.LEVEL5="LEVEL5";var sr=s(s(s(s(s(s({},exports.RCVideoBitrate.LEVEL0,{max:150,min:80}),exports.RCVideoBitrate.LEVEL1,{max:280,min:120}),exports.RCVideoBitrate.LEVEL2,{max:650,min:150}),exports.RCVideoBitrate.LEVEL3,{max:1e3,min:200}),exports.RCVideoBitrate.LEVEL4,{max:2200,min:250}),exports.RCVideoBitrate.LEVEL5,{max:4e3,min:400}),cr=function(){function e(){n(this,e)}return o(e,null,[{key:"apply3ANoiseWorklet",value:function(t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u;return _().w(function(r){for(;;)switch(r.p=r.n){case 0:return n=new AudioContext({sampleRate:44100}),r.p=1,r.n=2,n.audioWorklet.addModule(e.SCRIPT_URL);case 2:return r.n=3,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"});case 3:return o=r.v,r.n=4,o.arrayBuffer();case 4:i=r.v,r.n=6;break;case 5:return r.p=5,r.v,r.a(2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED});case 6:return a=n.createMediaStreamSource(new MediaStream([t])),s=new AudioWorkletNode(n,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:i}}),c=n.createMediaStreamDestination(),a.connect(s).connect(c),u=c.stream.getAudioTracks()[0],e._maps.set(t.id,n),r.a(2,{code:exports.RCRTCCode.SUCCESS,track:u})}},r,null,[[1,5]])}))}},{key:"release3ANoiseWorklet",value:function(t){var r=e._maps.get(t.id);r&&(r.close(),e._maps.delete(t.id))}}])}();Object.defineProperty(cr,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(cr,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(cr,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map});var ur=function(){function e(t,i,o,a,s){var c;return n(this,e),c=r(this,e,[t,i,o,a,!0]),Object.defineProperty(c,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c.__innerSetMediaStreamTrack(s),s.onended=function(){s.onended=null,c._onTrackEnded()},c}return l(e,ir),o(e,[{key:"_onTrackEnded",value:function(){this.emit(e.EVENT_LOCAL_TRACK_END,this),this.removeAll(e.EVENT_LOCAL_TRACK_END)}},{key:"_setLocalMuted",value:function(t){var r=this;return new Promise(function(n){var i=r._localMuted!==t;m(e,"_setLocalMuted",r,3)([t]),r._remoteMuted=r._localMuted,i&&r._isPublished?r.emit(e.__INNER_EVENT_MUTED_CHANGE__,r,n):n(exports.RCRTCCode.SUCCESS),r._logger.info(Oe.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:t,trackId:r._id}))})}},{key:"__innerSetPublished",value:function(e){this._isPublished=e}},{key:"isPublished",value:function(){return this._isPublished}},{key:"destroy",value:function(){var t,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._isDestroyed||(this._logger.info(Oe.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(t=this._msTrack)||void 0===t||t.stop(),m(e,"__innerDestroy",this,3)([]),this.isAudioTrack()&&m(e,"__releaseMediaElement",this,3)([]),this._isPublished&&r&&this.emit(e.__INNER_EVENT_DESTROY__,this))}},{key:"isDestroyed",value:function(){return this._isDestroyed}},{key:"setBitrate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!O(e)||!O(t)||!O(r)||e<=0||t<=0||e<t?this._logger.error(Oe.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> max: ".concat(e,",min: ").concat(t,", start: ").concat(r),trackId:this._id})):(this._logger.info(Oe.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,max:e,min:t,start:r,trackId:this._id})),this._bitrateInfo={max:e,min:t,start:r})}},{key:"getBitrate",value:function(){var e,t,r,n,i,o,a,s=0,c=0,u=0;if((null===(e=this._msTrack)||void 0===e?void 0:e.kind)===Qt.VIDEO){var l=kr(this._msTrack);s=l.min,c=l.max}else if((null===(t=this._msTrack)||void 0===t?void 0:t.kind)===Qt.AUDIO){var d={min:32,max:32};s=d.min,c=d.max}return(null===(r=this._bitrateInfo)||void 0===r?void 0:r.max)&&(u=.7*(null===(n=this._bitrateInfo)||void 0===n?void 0:n.max)),{min:(null===(i=this._bitrateInfo)||void 0===i?void 0:i.min)||s,max:(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)||c,start:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.start)||u}}},{key:"getSettings",value:function(){var e;return null===(e=this._msTrack)||void 0===e?void 0:e.getSettings()}}])}();Object.defineProperty(ur,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(ur,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(ur,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"});var lr=function(){function e(t,i,o,a){return n(this,e),r(this,e,[t,i,o,"audio",a])}return l(e,ur),o(e,[{key:"setRecommendBitrate",value:function(e){if(j("audioBitrate",e,function(e){return e in exports.RCAudioBitrate})){var t=ar[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(Oe.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}},{key:"setBitrate",value:function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*t||1:s;m(e,"setBitrate",this,3)([t,a,c])}}])}(),dr=function(){function e(t,i,o,a){var s,c=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return n(this,e),s=r(this,e,[t,i,o,"video",a]),Object.defineProperty(s,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:c}),s}return l(e,ur),o(e,[{key:"__isTiny",value:function(){return this._isTiny}},{key:"getStreamId",value:function(){var t=m(e,"getStreamId",this,3)([]);return this._isTiny?"".concat(t,"_tiny"):t}},{key:"getTrackId",value:function(){var t=m(e,"getTrackId",this,3)([]);return this._isTiny?"".concat(t,"_tiny"):t}},{key:"setRecommendBitrate",value:function(e){if(j("videoBitrate",e,function(e){return e in exports.RCVideoBitrate})){var t=sr[e];this.setBitrate(t.max,t.min,t.start||.7*t.max)}else this._logger.warn(Oe.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}},{key:"setBitrate",value:function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*t||1:s;m(e,"setBitrate",this,3)([t,a,c])}}])}(),_r=function(){function e(t,i,o,a,s,c){var u;return n(this,e),u=r(this,e,[t,i,o,a,s]),Object.defineProperty(u,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:c}),e._innerSetMapping(u.getTrackId(),c),u}return l(e,ur),o(e,[{key:"destroy",value:function(){this.isAudioTrack()&&this.mute(),e._innerRemoveMapping(this.getTrackId(),this._resource),m(e,"destroy",this,3)([])}}],[{key:"_innerSetMapping",value:function(e,t){var r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}},{key:"_innerRemoveMapping",value:function(e,t){var r,n,i=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter(function(t){return t!==e});i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(n=t.parentNode)||void 0===n||n.removeChild(t))}}])}();Object.defineProperty(_r,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map});var fr,hr=function(){function e(t,i,o,a,s){return n(this,e),r(this,e,[t,i,o,"video",a,s])}return l(e,_r),o(e)}(),pr=function(){function e(t,i,o,a,s){return n(this,e),r(this,e,[t,i,o,"audio",a,s])}return l(e,_r),o(e,[{key:"_setLocalMuted",value:function(t){var r=this,n=Object.create(null,{_setLocalMuted:{get:function(){return m(e,"_setLocalMuted",r,1)}}});return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)if(0===e.n)return this._resource&&(this._resource.muted=t),e.a(2,n._setLocalMuted.call(this,t))},e,this)}))}},{key:"play",value:function(){return K(this,void 0,void 0,_().m(function e(){var t;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._setLocalMuted(!1);case 1:return t=e.v,e.a(2,{code:t})}},e,this)}))}}])}(),gr=function(){function e(){var t;return n(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),t}return l(e,lr),o(e,[{key:"apply3ANoiseWorklet",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n;return _().w(function(e){for(;;)switch(e.n){case 0:if(this._logger.info(Oe.A_APPLY_3A_NOISE_WORKLET_T),!this._originTrack){e.n=1;break}return this._logger.warn(Oe.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"3A noise module already applied"})),e.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this._msTrack&&!this.isDestroyed()){e.n=2;break}return this._logger.warn(Oe.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"track not ready"})),e.a(2,{code:exports.RCRTCCode.TRACK_NOT_READY});case 2:if(!this.isPublished()){e.n=3;break}return this._logger.warn(Oe.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"track already published"})),e.a(2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH});case 3:return e.n=4,cr.apply3ANoiseWorklet(this._msTrack);case 4:if(t=e.v,r=t.code,n=t.track,r===exports.RCRTCCode.SUCCESS&&n){e.n=5;break}return this._logger.warn(Oe.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.FAILED,msg:"apply 3A noise module failed: ".concat(r),SCRIPT_URL:cr.SCRIPT_URL,WASM_URL:cr.WASM_URL})),e.a(2,{code:r});case 5:return this._originTrack=this._msTrack,this._msTrack=n,this._logger.info(Oe.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:Le.SUCCESSED})),e.a(2,{code:exports.RCRTCCode.SUCCESS})}},e,this)}))}},{key:"__innerSetMediaStreamTrack",value:function(t){!t&&this._originTrack&&(cr.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),m(e,"__innerSetMediaStreamTrack",this,3)([t])}},{key:"replaceInnerTrack",value:function(e){}}])}(),Rr=function(){function e(t,i,o,a){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return n(this,e),r(this,e,[t,i,o,a,s])}return l(e,dr),o(e,[{key:"replaceInnerTrack",value:function(e){}}])}(),mr=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,dr),o(e,[{key:"_onTrackEnded",value:function(){m(e,"_onTrackEnded",this,3)([]),this.isPublished()&&this.emit(ur.__INNER_EVENT_DESTROY__,this)}}])}(),vr=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,lr),o(e,[{key:"_onTrackEnded",value:function(){m(e,"_onTrackEnded",this,3)([]),this.isPublished()&&this.emit(ur.__INNER_EVENT_DESTROY__,this)}}])}(),Tr=function(){function e(t,i,o,a,s){var c;return n(this,e),c=r(this,e,[t,i,o,a,!1,s]),Object.defineProperty(c,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),c}return l(e,ir),o(e,[{key:"__innerSetRemoteMuted",value:function(e){this._remoteMuted=e}},{key:"__innerSetSubscribed",value:function(e){this._isSubscribed=e}},{key:"isSubscribed",value:function(){return this._isSubscribed}}])}(),Cr=function(){function e(t,i,o,a){return n(this,e),r(this,e,[t,i,o,"audio",a])}return l(e,Tr),o(e,[{key:"_setLocalMuted",value:function(t){var r=jr.browser,n=jr.version;return this._element&&n&&/chrome/i.test(r)&&n>=130&&(this._element.muted=t),m(e,"_setLocalMuted",this,3)([t])}},{key:"getVolume",value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}])}(),Er=function(){function e(t,i,o,a){var s;return n(this,e),s=r(this,e,[t,i,o,"video",a]),Object.defineProperty(s,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return l(e,Tr),o(e,[{key:"__innerSetIsTinyTrack",value:function(e){this._isSubTiny=e}},{key:"isSubTiny",value:function(){return this._isSubTiny}}])}();exports.RCRTCGenerateSummarizationFormat=void 0,(fr=exports.RCRTCGenerateSummarizationFormat||(exports.RCRTCGenerateSummarizationFormat={}))[fr.MARK_DOWN=0]="MARK_DOWN",fr[fr.JSON=1]="JSON";var Ir,Sr=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},yr=function(e){return JSON.stringify(e)},br=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},Or=function(e){if(void 0===e)return 0;if(O(e))return e;var t=e;return t.exact||t.ideal||t.max||0},Lr=function(e){var t=e.getSettings(),r=e.getConstraints();return{width:Or(r.width)||t.width||0,height:Or(r.height)||t.height||0,frameRate:t.frameRate||Or(r.frameRate)}},kr=function(e){var t=Lr(e),r=t.width,n=t.height,i=t.frameRate,o=$t(r||1920,n||1080),a=tr(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},Ar=function(e){return[e.msid,e.mediaType].join("_")},Nr=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},wr=function(e,t){return[e,t].join("_")},Pr=function(e){return e.map(function(e){return Object.assign({},e)})},Dr=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e.slice();var n=[],i=[],o=[];return t.forEach(function(t){var i=Ar(t),a=e.findIndex(function(e){return Ar(e)===i});if(r&&(a=e.findIndex(function(e){return e.uri===t.uri})),-1!==a){var s=e[a];s.uri!==t.uri?n.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else n.push(t)}),i.push.apply(i,v(e)),{publishedList:n,unpublishedList:i,modifiedList:o}},Ur=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,n=+e,i=[];do{var o=n%r;n=(n-o)/r,i.unshift(t[o])}while(n);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},Mr=function(e){if(Zt[e]){var t=Zt[e];return{width:t.width,height:t.height}}var r=R(e.split("_").map(function(e){return parseInt(e.replace(/[^\d]/g,""))}),2);return{width:r[0],height:r[1]}},xr=function(e){return!!exports.RCResolution[e]},Br=function(e){return!!exports.RCFrameRate[e]},Vr=function(e){return parseInt(e.replace("FPS_",""))},jr={browser:(Ir=Kt.browserDetails).browser,version:Ir.version,supportsUnifiedPlan:!1!==Ir.supportsUnifiedPlan};function Fr(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Gr(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var Jr,Hr,Kr=function(e){return"[object Null]"===Object.prototype.toString.call(e)},qr=function(e){return 1===e.type},Yr=function(e,t){var r=0;return e.forEach(function(e){var n=e instanceof ur?e.getTrackId():e.track.getTrackId();t.getLocalTrack(n)||(e instanceof ur?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))}),r},Wr=function(e,t,r,n){var i={},o=Object.keys(e.users);return o.length&&o.forEach(function(o){var a=[],s=e.users[o];if(s.extra){var c=JSON.parse(s.extra).roomId;if(t!==c)return}if(s.uris)try{a.push.apply(a,v(JSON.parse(s.uris)))}catch(e){r.warn(Oe.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(o,", userData: ").concat(s),n)}i[o]=a}),i},zr=function(e,t){for(var r=!1,n=0,i=0;i<t.length;i++){var o=t[i];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){r=!0,n=i;break}}return{isInclude:r,index:n}},Qr=function(e){return e instanceof ir?e.getTrackId():e.track.getTrackId()},Zr=function(e){if(!A(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)},Xr=function(e){if("destLang"in e&&!y(e.destLang))return{isValid:!1,key:"destLang"};if("customPrompt"in e&&!y(e.customPrompt))return{isValid:!1,key:"customPrompt"};if("enableSummarization"in e&&!b(e.enableSummarization))return{isValid:!1,key:"enableSummarization"};if("enableSummarizationDetails"in e&&!b(e.enableSummarizationDetails))return{isValid:!1,key:"enableSummarizationDetails"};if("enableChapterSummary"in e&&!b(e.enableChapterSummary))return{isValid:!1,key:"enableChapterSummary"};if("enableTodoList"in e&&!b(e.enableTodoList))return{isValid:!1,key:"enableTodoList"};if("enableHashtag"in e&&!b(e.enableHashtag))return{isValid:!1,key:"enableHashtag"};if("format"in e&&void 0===exports.RCRTCGenerateSummarizationFormat[e.format])return{isValid:!1,key:"format"};var t=e.enableSummarization||e.enableSummarizationDetails||e.enableChapterSummary||e.enableTodoList||e.enableHashtag;return e.customPrompt||t?{isValid:!0,key:""}:{isValid:!1,key:"at least one of the summary features must be enabled"}};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline",e.ROOM_TASK_FINISH="RCRTC:roomTaskFinish",e.ASR_STATUS="RCRTC:AsrStatus",e.ASR_SEI="RCRTC:PublishSeiAi",e.SUMMARIZATION_STATUS="RCRTC:Summarization"}(Jr||(Jr={})),exports.RCRTCPingResult=void 0,(Hr=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",Hr.FAIL="Fail";var $r=function(){return o(function e(t,r,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;n(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_latestTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onPingResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger},[{key:"start",value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(Oe.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}},{key:"_sendPing",value:function(){var e=this;return new Promise(function(t){e._context.rtcPing(e._roomId,e._roomMode).then(t),setTimeout(t,5e3,{code:Ne})})}},{key:"_checkAlive",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c=this;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this._context.logger,n=r.createTraceId(),t.n=1,this._sendPing();case 1:if(i=t.v,o=i.code,a=i.data,this._started){t.n=2;break}return t.a(2);case 2:if(s=Date.now(),o!==ke){t.n=3;break}return this._latestTimestamp=s,this.onPingResult(exports.RCRTCPingResult.SUCCESS,a.version),this._timer=setTimeout(function(){return c._checkAlive(e)},this._gap),t.a(2);case 3:if(r.error(Oe.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:o}),n),this.onPingResult(exports.RCRTCPingResult.FAIL),!(40003===o||s-this._latestTimestamp>e)){t.n=4;break}return this.stop(),this.onFailed(40003===o),t.a(2);case 4:this._timer=setTimeout(function(){return c._checkAlive(e)},this._gap);case 5:return t.a(2)}},t,this)}))}},{key:"stop",value:function(){this._started&&(this._logger.info(Oe.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}])}();function en(e){let t=e.length;for(;--t>=0;)e[t]=0}const tn=256,rn=286,nn=30,on=15,an=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),sn=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),cn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),un=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ln=new Array(576);en(ln);const dn=new Array(60);en(dn);const _n=new Array(512);en(_n);const fn=new Array(256);en(fn);const hn=new Array(29);en(hn);const pn=new Array(nn);function gn(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let Rn,mn,vn;function Tn(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}en(pn);const Cn=e=>e<256?_n[e]:_n[256+(e>>>7)],En=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},In=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,En(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},Sn=(e,t,r)=>{In(e,r[2*t],r[2*t+1])},yn=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},bn=(e,t,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=on;i++)a=a+r[i-1]<<1,n[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=yn(n[t]++,t))}},On=e=>{let t;for(t=0;t<rn;t++)e.dyn_ltree[2*t]=0;for(t=0;t<nn;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ln=e=>{e.bi_valid>8?En(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},kn=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},An=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&kn(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!kn(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},Nn=(e,t,r)=>{let n,i,o,a,s=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+s++],n+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===n?Sn(e,i,t):(o=fn[i],Sn(e,o+tn+1,t),a=an[o],0!==a&&(i-=hn[o],In(e,i,a)),n--,o=Cn(n),Sn(e,o,r),a=sn[o],0!==a&&(n-=pn[o],In(e,n,a)))}while(s<e.sym_next);Sn(e,256,t)},wn=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)An(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],An(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*c]=r[2*a]+r[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=c,e.heap[1]=c++,An(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,_,f,h,p=0;for(_=0;_<=on;_++)e.bl_count[_]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],_=r[2*r[2*l+1]+1]+1,_>c&&(_=c,p++),r[2*l+1]=_,l>n||(e.bl_count[_]++,f=0,l>=s&&(f=a[l-s]),h=r[2*l],e.opt_len+=h*(_+f),o&&(e.static_len+=h*(i[2*l+1]+f)));if(0!==p){do{for(_=c-1;0===e.bl_count[_];)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(_=c;0!==_;_--)for(l=e.bl_count[_];0!==l;)d=e.heap[--u],d>n||(r[2*d+1]!==_&&(e.opt_len+=(_-r[2*d+1])*r[2*d],r[2*d+1]=_),l--)}})(e,t),bn(r,u,e.bl_count)},Pn=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},Dn=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{Sn(e,i,e.bl_tree)}while(0!==--s);else 0!==i?(i!==o&&(Sn(e,i,e.bl_tree),s--),Sn(e,16,e.bl_tree),In(e,s-3,2)):s<=10?(Sn(e,17,e.bl_tree),In(e,s-3,3)):(Sn(e,18,e.bl_tree),In(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}};let Un=!1;const Mn=(e,t,r,n)=>{In(e,0+(n?1:0),3),Ln(e),En(e,r),En(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var xn=(e,t,r,n)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<tn;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),wn(e,e.l_desc),wn(e,e.d_desc),a=(e=>{let t;for(Pn(e,e.dyn_ltree,e.l_desc.max_code),Pn(e,e.dyn_dtree,e.d_desc.max_code),wn(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*un[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Mn(e,t,r,n):4===e.strategy||o===i?(In(e,2+(n?1:0),3),Nn(e,ln,dn)):(In(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(In(e,t-257,5),In(e,r-1,5),In(e,n-4,4),i=0;i<n;i++)In(e,e.bl_tree[2*un[i]+1],3);Dn(e,e.dyn_ltree,t-1),Dn(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Nn(e,e.dyn_ltree,e.dyn_dtree)),On(e),n&&Ln(e)},Bn={_tr_init:e=>{Un||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(hn[n]=r,e=0;e<1<<an[n];e++)fn[r++]=n;for(fn[r-1]=n,i=0,n=0;n<16;n++)for(pn[n]=i,e=0;e<1<<sn[n];e++)_n[i++]=n;for(i>>=7;n<nn;n++)for(pn[n]=i<<7,e=0;e<1<<sn[n]-7;e++)_n[256+i++]=n;for(t=0;t<=on;t++)o[t]=0;for(e=0;e<=143;)ln[2*e+1]=8,e++,o[8]++;for(;e<=255;)ln[2*e+1]=9,e++,o[9]++;for(;e<=279;)ln[2*e+1]=7,e++,o[7]++;for(;e<=287;)ln[2*e+1]=8,e++,o[8]++;for(bn(ln,287,o),e=0;e<nn;e++)dn[2*e+1]=5,dn[2*e]=yn(e,5);Rn=new gn(ln,an,257,rn,on),mn=new gn(dn,sn,0,nn,on),vn=new gn(new Array(0),cn,0,19,7)})(),Un=!0),e.l_desc=new Tn(e.dyn_ltree,Rn),e.d_desc=new Tn(e.dyn_dtree,mn),e.bl_desc=new Tn(e.bl_tree,vn),e.bi_buf=0,e.bi_valid=0,On(e)},_tr_stored_block:Mn,_tr_flush_block:xn,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(fn[r]+tn+1)]++,e.dyn_dtree[2*Cn(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{In(e,2,3),Sn(e,256,ln),(e=>{16===e.bi_valid?(En(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Vn=(e,t,r,n)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+t[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const jn=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var Fn=(e,t,r,n)=>{const i=jn,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return-1^e},Gn={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Jn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Hn,_tr_stored_block:Kn,_tr_flush_block:qn,_tr_tally:Yn,_tr_align:Wn}=Bn,{Z_NO_FLUSH:zn,Z_PARTIAL_FLUSH:Qn,Z_FULL_FLUSH:Zn,Z_FINISH:Xn,Z_BLOCK:$n,Z_OK:ei,Z_STREAM_END:ti,Z_STREAM_ERROR:ri,Z_DATA_ERROR:ni,Z_BUF_ERROR:ii,Z_DEFAULT_COMPRESSION:oi,Z_FILTERED:ai,Z_HUFFMAN_ONLY:si,Z_RLE:ci,Z_FIXED:ui,Z_DEFAULT_STRATEGY:li,Z_UNKNOWN:di,Z_DEFLATED:_i}=Jn,fi=258,hi=262,pi=42,gi=113,Ri=666,mi=(e,t)=>(e.msg=Gn[t],t),vi=e=>2*e-(e>4?9:0),Ti=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ci=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let Ei=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const Ii=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},Si=(e,t)=>{qn(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ii(e.strm)},yi=(e,t)=>{e.pending_buf[e.pending++]=t},bi=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Oi=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=Vn(e.adler,t,i,r):2===e.state.wrap&&(e.adler=Fn(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},Li=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-hi?e.strstart-(e.w_size-hi):0,u=e.window,l=e.w_mask,d=e.prev,_=e.strstart+fi;let f=u[o+a-1],h=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,u[r+a]===h&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<_);if(n=fi-(_-o),o=_-fi,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],h=u[o+a]}}}while((t=d[t&l])>c&&0!==--i);return a<=e.lookahead?a:e.lookahead},ki=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-hi)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ci(e),n+=t),0===e.strm.avail_in)break;if(r=Oi(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ei(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ei(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<hi&&0!==e.strm.avail_in)},Ai=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==Xn||t===zn||r!==n+e.strm.avail_in))break;a=t===Xn&&r===n+e.strm.avail_in?1:0,Kn(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Ii(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(Oi(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==zn&&t!==Xn&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Oi(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===Xn)&&t!==zn&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,a=t===Xn&&0===e.strm.avail_in&&r===n?1:0,Kn(e,e.block_start,r,a),e.block_start+=r,Ii(e.strm)),a?3:1)},Ni=(e,t)=>{let r,n;for(;;){if(e.lookahead<hi){if(ki(e),e.lookahead<hi&&t===zn)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-hi&&(e.match_length=Li(e,r)),e.match_length>=3)if(n=Yn(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+1]);else n=Yn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Si(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Xn?(Si(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Si(e,!1),0===e.strm.avail_out)?1:2},wi=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<hi){if(ki(e),e.lookahead<hi&&t===zn)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-hi&&(e.match_length=Li(e,r),e.match_length<=5&&(e.strategy===ai||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Yn(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Ei(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!==--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Si(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Yn(e,0,e.window[e.strstart-1]),n&&Si(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Yn(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Xn?(Si(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Si(e,!1),0===e.strm.avail_out)?1:2};function Pi(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const Di=[new Pi(0,0,0,0,Ai),new Pi(4,4,8,4,Ni),new Pi(4,5,16,8,Ni),new Pi(4,6,32,32,Ni),new Pi(4,4,16,16,wi),new Pi(8,16,32,32,wi),new Pi(8,16,128,128,wi),new Pi(8,32,128,256,wi),new Pi(32,128,258,1024,wi),new Pi(32,258,258,4096,wi)];function Ui(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_i,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ti(this.dyn_ltree),Ti(this.dyn_dtree),Ti(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Ti(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ti(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Mi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==pi&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==gi&&t.status!==Ri?1:0},xi=e=>{if(Mi(e))return mi(e,ri);e.total_in=e.total_out=0,e.data_type=di;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?pi:gi,e.adler=2===t.wrap?0:1,t.last_flush=-2,Hn(t),ei},Bi=e=>{const t=xi(e);var r;return t===ei&&((r=e.state).window_size=2*r.w_size,Ti(r.head),r.max_lazy_match=Di[r.level].max_lazy,r.good_match=Di[r.level].good_length,r.nice_match=Di[r.level].nice_length,r.max_chain_length=Di[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Vi=(e,t,r,n,i,o)=>{if(!e)return ri;let a=1;if(t===oi&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==_i||n<8||n>15||t<0||t>9||o<0||o>ui||8===n&&1!==a)return mi(e,ri);8===n&&(n=9);const s=new Ui;return e.state=s,s.strm=e,s.status=pi,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,Bi(e)};var ji={deflateInit:(e,t)=>Vi(e,t,_i,15,8,li),deflateInit2:Vi,deflateReset:Bi,deflateResetKeep:xi,deflateSetHeader:(e,t)=>Mi(e)||2!==e.state.wrap?ri:(e.state.gzhead=t,ei),deflate:(e,t)=>{if(Mi(e)||t>$n||t<0)return e?mi(e,ri):ri;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===Ri&&t!==Xn)return mi(e,0===e.avail_out?ii:ri);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(Ii(e),0===e.avail_out)return r.last_flush=-1,ei}else if(0===e.avail_in&&vi(t)<=vi(n)&&t!==Xn)return mi(e,ii);if(r.status===Ri&&0!==e.avail_in)return mi(e,ii);if(r.status===pi&&0===r.wrap&&(r.status=gi),r.status===pi){let t=_i+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=si||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,bi(r,t),0!==r.strstart&&(bi(r,e.adler>>>16),bi(r,65535&e.adler)),e.adler=1,r.status=gi,Ii(e),0!==r.pending)return r.last_flush=-1,ei}if(57===r.status)if(e.adler=0,yi(r,31),yi(r,139),yi(r,8),r.gzhead)yi(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),yi(r,255&r.gzhead.time),yi(r,r.gzhead.time>>8&255),yi(r,r.gzhead.time>>16&255),yi(r,r.gzhead.time>>24&255),yi(r,9===r.level?2:r.strategy>=si||r.level<2?4:0),yi(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(yi(r,255&r.gzhead.extra.length),yi(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Fn(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(yi(r,0),yi(r,0),yi(r,0),yi(r,0),yi(r,0),yi(r,9===r.level?2:r.strategy>=si||r.level<2?4:0),yi(r,3),r.status=gi,Ii(e),0!==r.pending)return r.last_flush=-1,ei;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=Fn(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,Ii(e),0!==r.pending)return r.last_flush=-1,ei;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=Fn(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Fn(e.adler,r.pending_buf,r.pending-n,n)),Ii(e),0!==r.pending)return r.last_flush=-1,ei;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,yi(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Fn(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Fn(e.adler,r.pending_buf,r.pending-n,n)),Ii(e),0!==r.pending)return r.last_flush=-1,ei;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,yi(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Fn(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Ii(e),0!==r.pending))return r.last_flush=-1,ei;yi(r,255&e.adler),yi(r,e.adler>>8&255),e.adler=0}if(r.status=gi,Ii(e),0!==r.pending)return r.last_flush=-1,ei}if(0!==e.avail_in||0!==r.lookahead||t!==zn&&r.status!==Ri){let n=0===r.level?Ai(r,t):r.strategy===si?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ki(e),0===e.lookahead)){if(t===zn)return 1;break}if(e.match_length=0,r=Yn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Si(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Xn?(Si(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Si(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===ci?((e,t)=>{let r,n,i,o;const a=e.window;for(;;){if(e.lookahead<=fi){if(ki(e),e.lookahead<=fi&&t===zn)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+fi;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=fi-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Yn(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Yn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Si(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Xn?(Si(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Si(e,!1),0===e.strm.avail_out)?1:2})(r,t):Di[r.level].func(r,t);if(3!==n&&4!==n||(r.status=Ri),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),ei;if(2===n&&(t===Qn?Wn(r):t!==$n&&(Kn(r,0,0,!1),t===Zn&&(Ti(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Ii(e),0===e.avail_out))return r.last_flush=-1,ei}return t!==Xn?ei:r.wrap<=0?ti:(2===r.wrap?(yi(r,255&e.adler),yi(r,e.adler>>8&255),yi(r,e.adler>>16&255),yi(r,e.adler>>24&255),yi(r,255&e.total_in),yi(r,e.total_in>>8&255),yi(r,e.total_in>>16&255),yi(r,e.total_in>>24&255)):(bi(r,e.adler>>>16),bi(r,65535&e.adler)),Ii(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?ei:ti)},deflateEnd:e=>{if(Mi(e))return ri;const t=e.state.status;return e.state=null,t===gi?mi(e,ni):ei},deflateSetDictionary:(e,t)=>{let r=t.length;if(Mi(e))return ri;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==pi||n.lookahead)return ri;if(1===i&&(e.adler=Vn(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(Ti(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,ki(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=Ei(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,ki(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,n.wrap=i,ei},deflateInfo:"pako deflate (from Nodeca project)"};const Fi=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Gi=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Fi(r,t)&&(e[t]=r[t])}}return e},Ji=e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r};let Hi=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Hi=!1}const Ki=new Uint8Array(256);for(let e=0;e<256;e++)Ki[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Ki[254]=Ki[254]=1;var qi=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},Yi=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=Ki[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Hi)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},Wi=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Ki[e[r]]>t?r:t};var zi=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Qi=Object.prototype.toString,{Z_NO_FLUSH:Zi,Z_SYNC_FLUSH:Xi,Z_FULL_FLUSH:$i,Z_FINISH:eo,Z_OK:to,Z_STREAM_END:ro,Z_DEFAULT_COMPRESSION:no,Z_DEFAULT_STRATEGY:io,Z_DEFLATED:oo}=Jn;function ao(e){this.options=Gi({level:no,method:oo,chunkSize:16384,windowBits:15,memLevel:8,strategy:io},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zi,this.strm.avail_out=0;let r=ji.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==to)throw new Error(Gn[r]);if(t.header&&ji.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?qi(t.dictionary):"[object ArrayBuffer]"===Qi.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=ji.deflateSetDictionary(this.strm,e),r!==to)throw new Error(Gn[r]);this._dict_set=!0}}function so(e,t){const r=new ao(t);if(r.push(e,!0),r.err)throw r.msg||Gn[r.err];return r.result}ao.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?eo:Zi,"string"==typeof e?r.input=qi(e):"[object ArrayBuffer]"===Qi.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===Xi||o===$i)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=ji.deflate(r,o),i===ro)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=ji.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===to;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},ao.prototype.onData=function(e){this.chunks.push(e)},ao.prototype.onEnd=function(e){e===to&&(this.result=Ji(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var co={Deflate:ao,deflate:so,deflateRaw:function(e,t){return(t=t||{}).raw=!0,so(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,so(e,t)},constants:Jn};const uo=16209;var lo=function(e,t){let r,n,i,o,a,s,c,u,l,d,_,f,h,p,g,R,m,v,T,C,E,I,S,y;const b=e.state;r=e.next_in,S=e.input,n=r+(e.avail_in-5),i=e.next_out,y=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=b.dmax,c=b.wsize,u=b.whave,l=b.wnext,d=b.window,_=b.hold,f=b.bits,h=b.lencode,p=b.distcode,g=(1<<b.lenbits)-1,R=(1<<b.distbits)-1;e:do{f<15&&(_+=S[r++]<<f,f+=8,_+=S[r++]<<f,f+=8),m=h[_&g];t:for(;;){if(v=m>>>24,_>>>=v,f-=v,v=m>>>16&255,0===v)y[i++]=65535&m;else{if(!(16&v)){if(64&v){if(32&v){b.mode=16191;break e}e.msg="invalid literal/length code",b.mode=uo;break e}m=h[(65535&m)+(_&(1<<v)-1)];continue t}for(T=65535&m,v&=15,v&&(f<v&&(_+=S[r++]<<f,f+=8),T+=_&(1<<v)-1,_>>>=v,f-=v),f<15&&(_+=S[r++]<<f,f+=8,_+=S[r++]<<f,f+=8),m=p[_&R];;){if(v=m>>>24,_>>>=v,f-=v,v=m>>>16&255,16&v){if(C=65535&m,v&=15,f<v&&(_+=S[r++]<<f,f+=8,f<v&&(_+=S[r++]<<f,f+=8)),C+=_&(1<<v)-1,C>s){e.msg="invalid distance too far back",b.mode=uo;break e}if(_>>>=v,f-=v,v=i-o,C>v){if(v=C-v,v>u&&b.sane){e.msg="invalid distance too far back",b.mode=uo;break e}if(E=0,I=d,0===l){if(E+=c-v,v<T){T-=v;do{y[i++]=d[E++]}while(--v);E=i-C,I=y}}else if(l<v){if(E+=c+l-v,v-=l,v<T){T-=v;do{y[i++]=d[E++]}while(--v);if(E=0,l<T){v=l,T-=v;do{y[i++]=d[E++]}while(--v);E=i-C,I=y}}}else if(E+=l-v,v<T){T-=v;do{y[i++]=d[E++]}while(--v);E=i-C,I=y}for(;T>2;)y[i++]=I[E++],y[i++]=I[E++],y[i++]=I[E++],T-=3;T&&(y[i++]=I[E++],T>1&&(y[i++]=I[E++]))}else{E=i-C;do{y[i++]=y[E++],y[i++]=y[E++],y[i++]=y[E++],T-=3}while(T>2);T&&(y[i++]=y[E++],T>1&&(y[i++]=y[E++]))}break}if(64&v){e.msg="invalid distance code",b.mode=uo;break e}m=p[(65535&m)+(_&(1<<v)-1)]}}break}}while(r<n&&i<a);T=f>>3,r-=T,f-=T<<3,_&=(1<<f)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<a?a-i+257:257-(i-a),b.hold=_,b.bits=f};const _o=15,fo=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ho=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),po=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),go=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Ro=(e,t,r,n,i,o,a,s)=>{const c=s.bits;let u,l,d,_,f,h,p=0,g=0,R=0,m=0,v=0,T=0,C=0,E=0,I=0,S=0,y=null;const b=new Uint16Array(16),O=new Uint16Array(16);let L,k,A,N=null;for(p=0;p<=_o;p++)b[p]=0;for(g=0;g<n;g++)b[t[r+g]]++;for(v=c,m=_o;m>=1&&0===b[m];m--);if(v>m&&(v=m),0===m)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(R=1;R<m&&0===b[R];R++);for(v<R&&(v=R),E=1,p=1;p<=_o;p++)if(E<<=1,E-=b[p],E<0)return-1;if(E>0&&(0===e||1!==m))return-1;for(O[1]=0,p=1;p<_o;p++)O[p+1]=O[p]+b[p];for(g=0;g<n;g++)0!==t[r+g]&&(a[O[t[r+g]]++]=g);if(0===e?(y=N=a,h=20):1===e?(y=fo,N=ho,h=257):(y=po,N=go,h=0),S=0,g=0,p=R,f=o,T=v,C=0,d=-1,I=1<<v,_=I-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){L=p-C,a[g]+1<h?(k=0,A=a[g]):a[g]>=h?(k=N[a[g]-h],A=y[a[g]-h]):(k=96,A=0),u=1<<p-C,l=1<<T,R=l;do{l-=u,i[f+(S>>C)+l]=L<<24|k<<16|A}while(0!==l);for(u=1<<p-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,g++,0===--b[p]){if(p===m)break;p=t[r+a[g]]}if(p>v&&(S&_)!==d){for(0===C&&(C=v),f+=R,T=p-C,E=1<<T;T+C<m&&(E-=b[T+C],!(E<=0));)T++,E<<=1;if(I+=1<<T,1===e&&I>852||2===e&&I>592)return 1;d=S&_,i[d]=v<<24|T<<16|f-o}}return 0!==S&&(i[f+S]=p-C<<24|64<<16),s.bits=v,0};const{Z_FINISH:mo,Z_BLOCK:vo,Z_TREES:To,Z_OK:Co,Z_STREAM_END:Eo,Z_NEED_DICT:Io,Z_STREAM_ERROR:So,Z_DATA_ERROR:yo,Z_MEM_ERROR:bo,Z_BUF_ERROR:Oo,Z_DEFLATED:Lo}=Jn,ko=16180,Ao=16190,No=16191,wo=16192,Po=16194,Do=16199,Uo=16200,Mo=16206,xo=16209,Bo=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Vo(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const jo=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<ko||t.mode>16211?1:0},Fo=e=>{if(jo(e))return So;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=ko,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Co},Go=e=>{if(jo(e))return So;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Fo(e)},Jo=(e,t)=>{let r;if(jo(e))return So;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?So:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Go(e))},Ho=(e,t)=>{if(!e)return So;const r=new Vo;e.state=r,r.strm=e,r.window=null,r.mode=ko;const n=Jo(e,t);return n!==Co&&(e.state=null),n};let Ko,qo,Yo=!0;const Wo=e=>{if(Yo){Ko=new Int32Array(512),qo=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ro(1,e.lens,0,288,Ko,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ro(2,e.lens,0,32,qo,0,e.work,{bits:5}),Yo=!1}e.lencode=Ko,e.lenbits=9,e.distcode=qo,e.distbits=5},zo=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Qo={inflateReset:Go,inflateReset2:Jo,inflateResetKeep:Fo,inflateInit:e=>Ho(e,15),inflateInit2:Ho,inflate:(e,t)=>{let r,n,i,o,a,s,c,u,l,d,_,f,h,p,g,R,m,v,T,C,E,I,S=0;const y=new Uint8Array(4);let b,O;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(jo(e)||!e.output||!e.input&&0!==e.avail_in)return So;r=e.state,r.mode===No&&(r.mode=wo),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,d=s,_=c,I=Co;e:for(;;)switch(r.mode){case ko:if(0===r.wrap){r.mode=wo;break}for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,y[0]=255&u,y[1]=u>>>8&255,r.check=Fn(r.check,y,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=xo;break}if((15&u)!==Lo){e.msg="unknown compression method",r.mode=xo;break}if(u>>>=4,l-=4,E=8+(15&u),0===r.wbits&&(r.wbits=E),E>15||E>r.wbits){e.msg="invalid window size",r.mode=xo;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:No,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==Lo){e.msg="unknown compression method",r.mode=xo;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=xo;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(y[0]=255&u,y[1]=u>>>8&255,r.check=Fn(r.check,y,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(y[0]=255&u,y[1]=u>>>8&255,y[2]=u>>>16&255,y[3]=u>>>24&255,r.check=Fn(r.check,y,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(y[0]=255&u,y[1]=u>>>8&255,r.check=Fn(r.check,y,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(y[0]=255&u,y[1]=u>>>8&255,r.check=Fn(r.check,y,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(f=r.length,f>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+f),E)),512&r.flags&&4&r.wrap&&(r.check=Fn(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Fn(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&4&r.wrap&&(r.check=Fn(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=xo;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=No;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}e.adler=r.check=Bo(u),u=0,l=0,r.mode=Ao;case Ao:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,Io;e.adler=r.check=1,r.mode=No;case No:if(t===vo||t===To)break e;case wo:if(r.last){u>>>=7&l,l-=7&l,r.mode=Mo;break}for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(Wo(r),r.mode=Do,t===To){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=xo}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=xo;break}if(r.length=65535&u,u=0,l=0,r.mode=Po,t===To)break e;case Po:r.mode=16195;case 16195:if(f=r.length,f){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;i.set(n.subarray(o,o+f),a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=No;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=xo;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.lens[L[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,b={bits:r.lenbits},I=Ro(0,r.lens,0,19,r.lencode,0,r.work,b),r.lenbits=b.bits,I){e.msg="invalid code lengths set",r.mode=xo;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;S=r.lencode[u&(1<<r.lenbits)-1],g=S>>>24,R=S>>>16&255,m=65535&S,!(g<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(m<16)u>>>=g,l-=g,r.lens[r.have++]=m;else{if(16===m){for(O=g+2;l<O;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(u>>>=g,l-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=xo;break}E=r.lens[r.have-1],f=3+(3&u),u>>>=2,l-=2}else if(17===m){for(O=g+3;l<O;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=g,l-=g,E=0,f=3+(7&u),u>>>=3,l-=3}else{for(O=g+7;l<O;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=g,l-=g,E=0,f=11+(127&u),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=xo;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===xo)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=xo;break}if(r.lenbits=9,b={bits:r.lenbits},I=Ro(1,r.lens,0,r.nlen,r.lencode,0,r.work,b),r.lenbits=b.bits,I){e.msg="invalid literal/lengths set",r.mode=xo;break}if(r.distbits=6,r.distcode=r.distdyn,b={bits:r.distbits},I=Ro(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,b),r.distbits=b.bits,I){e.msg="invalid distances set",r.mode=xo;break}if(r.mode=Do,t===To)break e;case Do:r.mode=Uo;case Uo:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,lo(e,_),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===No&&(r.back=-1);break}for(r.back=0;S=r.lencode[u&(1<<r.lenbits)-1],g=S>>>24,R=S>>>16&255,m=65535&S,!(g<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(R&&!(240&R)){for(v=g,T=R,C=m;S=r.lencode[C+((u&(1<<v+T)-1)>>v)],g=S>>>24,R=S>>>16&255,m=65535&S,!(v+g<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=g,l-=g,r.back+=g,r.length=m,0===R){r.mode=16205;break}if(32&R){r.back=-1,r.mode=No;break}if(64&R){e.msg="invalid literal/length code",r.mode=xo;break}r.extra=15&R,r.mode=16201;case 16201:if(r.extra){for(O=r.extra;l<O;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;S=r.distcode[u&(1<<r.distbits)-1],g=S>>>24,R=S>>>16&255,m=65535&S,!(g<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(!(240&R)){for(v=g,T=R,C=m;S=r.distcode[C+((u&(1<<v+T)-1)>>v)],g=S>>>24,R=S>>>16&255,m=65535&S,!(v+g<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=g,l-=g,r.back+=g,64&R){e.msg="invalid distance code",r.mode=xo;break}r.offset=m,r.extra=15&R,r.mode=16203;case 16203:if(r.extra){for(O=r.extra;l<O;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=xo;break}r.mode=16204;case 16204:if(0===c)break e;if(f=_-c,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=xo;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),p=r.window}else p=i,h=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=p[h++]}while(--f);0===r.length&&(r.mode=Uo);break;case 16205:if(0===c)break e;i[a++]=r.length,c--,r.mode=Uo;break;case Mo:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=n[o++]<<l,l+=8}if(_-=c,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?Fn(r.check,i,_,a-_):Vn(r.check,i,_,a-_)),_=c,4&r.wrap&&(r.flags?u:Bo(u))!==r.check){e.msg="incorrect data check",r.mode=xo;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=xo;break}u=0,l=0}r.mode=16208;case 16208:I=Eo;break e;case xo:I=yo;break e;case 16210:return bo;default:return So}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,(r.wsize||_!==e.avail_out&&r.mode<xo&&(r.mode<Mo||t!==mo))&&zo(e,e.output,e.next_out,_-e.avail_out),d-=e.avail_in,_-=e.avail_out,e.total_in+=d,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?Fn(r.check,i,_,e.next_out-_):Vn(r.check,i,_,e.next_out-_)),e.data_type=r.bits+(r.last?64:0)+(r.mode===No?128:0)+(r.mode===Do||r.mode===Po?256:0),(0===d&&0===_||t===mo)&&I===Co&&(I=Oo),I},inflateEnd:e=>{if(jo(e))return So;let t=e.state;return t.window&&(t.window=null),e.state=null,Co},inflateGetHeader:(e,t)=>{if(jo(e))return So;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Co):So},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return jo(e)?So:(n=e.state,0!==n.wrap&&n.mode!==Ao?So:n.mode===Ao&&(i=1,i=Vn(i,t,r,0),i!==n.check)?yo:(o=zo(e,t,r,r),o?(n.mode=16210,bo):(n.havedict=1,Co)))},inflateInfo:"pako inflate (from Nodeca project)"};var Zo=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Xo=Object.prototype.toString,{Z_NO_FLUSH:$o,Z_FINISH:ea,Z_OK:ta,Z_STREAM_END:ra,Z_NEED_DICT:na,Z_STREAM_ERROR:ia,Z_DATA_ERROR:oa,Z_MEM_ERROR:aa}=Jn;function sa(e){this.options=Gi({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zi,this.strm.avail_out=0;let r=Qo.inflateInit2(this.strm,t.windowBits);if(r!==ta)throw new Error(Gn[r]);if(this.header=new Zo,Qo.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=qi(t.dictionary):"[object ArrayBuffer]"===Xo.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Qo.inflateSetDictionary(this.strm,t.dictionary),r!==ta)))throw new Error(Gn[r])}sa.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?ea:$o,"[object ArrayBuffer]"===Xo.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Qo.inflate(r,a),o===na&&i&&(o=Qo.inflateSetDictionary(r,i),o===ta?o=Qo.inflate(r,a):o===oa&&(o=na));r.avail_in>0&&o===ra&&r.state.wrap>0&&0!==e[r.next_in];)Qo.inflateReset(r),o=Qo.inflate(r,a);switch(o){case ia:case oa:case na:case aa:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===ra))if("string"===this.options.to){let e=Wi(r.output,r.next_out),t=r.next_out-e,i=Yi(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==ta||0!==s){if(o===ra)return o=Qo.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},sa.prototype.onData=function(e){this.chunks.push(e)},sa.prototype.onEnd=function(e){e===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ji(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:ca,deflate:ua,deflateRaw:la,gzip:da}=co;var _a=da;var fa,ha=-1,pa="RongCloudSEIAI",ga=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},Ra=function(e,t){return e+Math.floor(Math.random()*(t-e))},ma=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(jr.browser,"|").concat(jr.version),ClientVersion:"5.36.1-nctest-alpha.3","Client-Session-Id":ga(),"Request-Id":Date.now().toString()}},va=function(e,t,r){return K(void 0,void 0,void 0,_().m(function n(){var i,o;return _().w(function(n){for(;;)if(0===n.n)return i=[],o=r.jwtToken||"",n.a(2,new Promise(function(r,n){e.forEach(function(e){return K(void 0,void 0,void 0,_().m(function n(){var a,s,c;return _().w(function(n){for(;;)switch(n.n){case 0:return a=e.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(a,"/rtc/detector/ping?t=").concat(Ra(1e3,9999)),c={jwt:o},n.n=1,t.httpReq({url:s,body:JSON.stringify(c),timeout:5e3,method:D.POST});case 1:200===n.v.status&&i.push(e.clusterId),r(i);case 2:return n.a(2)}},n)}))})}))},n)}))},Ta=function(e,t){var r,n;if(!t)return"";try{n=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(Oe.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===n.strategy)return"";var i=null===(r=n.callEngine)||void 0===r?void 0:r.filter(function(e){return 4===e.engineType});if(!i||0===i.length)return"";var o=i[0];return o.detectorManager?o.detectorManager:""},Ca=function(e,t,r){return K(void 0,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d;return _().w(function(n){for(;;)switch(n.n){case 0:return i=Ta(t,r),o=r.jwtToken||"",a=120,s=0,c=r.ipType||0,u={jwt:o,ipType:c},n.n=1,e.httpReq({url:"".concat(i,"/rtc/detector/servers"),body:JSON.stringify(u),headers:ma(),method:D.POST});case 1:return l=n.v,d=l.data&&JSON.parse(l.data).detectorAddrs||[],a=l.data&&JSON.parse(l.data).clientDetectMinute,s=l.data&&JSON.parse(l.data).resultCode,n.a(2,{detectoraddrs:d,clientDetectMinute:a,status:s})}},n)}))};exports.RCRTCOperateSummarizationType=void 0,(fa=exports.RCRTCOperateSummarizationType||(exports.RCRTCOperateSummarizationType={})).OPEN="2",fa.CLOSE="1";function Ea(e){var t=e.method||D.GET,r=e.timeout||6e4,n=e.headers,i=e.query,o=e.body,a=e.onProgress,s=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var r=Object.keys(t).map(function(e){return"".concat(e,"=").concat(t[e])}).filter(function(e){return!!e});return r.length?[e,r.join("&")].join("?"):e}(e.url,i),c=new XMLHttpRequest;if(c.open(t,s),n&&c.setRequestHeader)for(var u in n)c.setRequestHeader(u,n[u]);return function(e,t,r,n){return new Promise(function(i){e.onreadystatechange=function(){n?2===e.readyState?i({data:e.responseText,status:e.status,xhr:e}):4===e.readyState?n(e.responseText,!0):3===e.readyState&&n(e.responseText,!1):4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},0!==t&&setTimeout(function(){e.abort(),i({status:e.status})},t),e.send(r)})}(c,r,o,a)}var Ia,Sa=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(jr.browser,"|").concat(jr.version),ClientVersion:"5.36.1-nctest-alpha.3","Client-Session-Id":ga(),"Request-Id":Date.now().toString()}},ya=function(){function e(t,r,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;n(this,e),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_failedMs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clusterId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_configUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_msList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_qualityMsList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,r.getConnectionStatus()===Ie.CONNECTED&&this.isNededDetector()&&this.detectorMediaSever()}return o(e,[{key:"isNededDetector",value:function(){var t=this._context.getNaviInfo();if(!t)return!1;var r=Ta(this._logger,t),n=t.jwtToken||"",i=Date.now(),o=!1;return 0===e.detectorTime?o=!1:e.detectValidMinute+e.detectorTime<i&&(o=!0),!(!r||!n||this._msUrl||o)}},{key:"detectorMediaSever",value:function(){this.clearMSList();var e=this._context.getNaviInfo();this._startDetector(e)}},{key:"_startDetector",value:function(t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s;return _().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Ca(this._runtime,this._logger,t);case 1:if(i=r.v,o=i.detectoraddrs,a=i.clientDetectMinute,i.status!==exports.RCRTCCode.JWT_TIME_OUT){r.n=3;break}return s=this._context.getPluginContext(),r.n=2,null===(n=s.refetchNaviInfo)||void 0===n?void 0:n.call(s);case 2:return this.detectorMediaSever(),r.a(2);case 3:if(!o.length){r.n=5;break}return r.n=4,va(o,this._runtime,t);case 4:e.msInDetector=r.v;case 5:e.detectorTime=Date.now(),e.detectValidMinute=60*a*1e3;case 6:return r.a(2)}},r,this)}))}},{key:"clearMSList",value:function(){this._msList.length=0}},{key:"getMsList",value:function(){return this._msUrl?[this._msUrl]:(this._sortMediaServiceList(),v(this._msList))}},{key:"_sortMediaServiceList",value:function(){var t=e.msInDetector[0],r=e.msInDetector.slice(1),n=function(e,t){var r,n;if(!e)return[];try{n=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(Oe.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===n.strategy)return[];var i=null===(r=n.callEngine)||void 0===r?void 0:r.filter(function(e){return 4===e.engineType});if(!i||0===i.length)return[];var o=i[0],a=[];return o.mediaServer&&a.push(o.mediaServer.replace(/^(https?:\/\/)?/,"https://")),o.backupMediaServer&&o.backupMediaServer.forEach(function(e){a.push(e.replace(/^(https?:\/\/)?/,"https://"))}),a}(this._context.getNaviInfo(),this._logger),i=n[0],o=n.slice(1),a=[this._clusterId,t,i].concat(v(r),v(o)).filter(function(e){return!!e}).map(function(e){return e.replace(/^(https?:\/\/)?/,"https://")});this._msList=v(new Set(a)),this._logger.info(Oe.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList)))}},{key:"_openGzip",value:function(e,t){for(var r=JSON.stringify(t),n=r.length,i=new Uint8Array(n),o=0;o<n;o++)i[o]=r.charCodeAt(o);var a;return{headers:e=Object.assign(Object.assign({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=_a(i,a)}}},{key:"_dealRequestSuccessResult",value:function(e){var t=JSON.parse(e);return t.rtcFinger&&(this._rtcFinger=t.rtcFinger),t.clusterId&&(this._clusterId!==t.clusterId&&this.clearMSList(),this._clusterId=t.clusterId),{code:exports.RCRTCCode.SUCCESS,data:t,qualityMsList:this._qualityMsList}}},{key:"_request",value:function(e,t,r,n,i,o){return K(this,void 0,void 0,_().m(function a(){var s,c,u,l,d,f,h,p,g,R,m,v,T,C,E,I,S;return _().w(function(a){for(;;)switch(a.n){case 0:if(this._qualityMsList=[],c=(s={headers:t,body:r}).headers,u=s.body,0!==(l=this.getMsList()).length){a.n=1;break}return this._logger.error(Oe.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),n),a.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 1:this._rtcFinger&&(u.rtcFinger=this._rtcFinger),d=0;case 2:if(!(d<l.length)){a.n=10;break}if(f=Date.now(),h="".concat(l[d]).concat(e),p=Sa(),g=Object.assign(Object.assign({},p),c),R=/x-www-form-urlencoded/.test(g["Content-Type"])?u:JSON.stringify(u),m=p["Request-Id"],this._logger.info(Oe.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:h,"Request-Id":m}),n),v=void 0,T={url:h,body:R,headers:g,method:D.POST,timeout:this._timeout},!o){a.n=4;break}return a.n=3,Ea(Object.assign(Object.assign({},T),{onProgress:o}));case 3:v=a.v,a.n=6;break;case 4:return a.n=5,this._runtime.httpReq(Object.assign({},T));case 5:v=a.v;case 6:if(E=(C=v).status,I=C.data,S=C.xhr,i&&this._qualityMsList.push({rsdur:Date.now()-f,rsid:m,rscod:200===E?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:h}),200!==E){a.n=8;break}if(this._logger.info(Oe.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.SUCCESSED,url:h}),n),!o){a.n=7;break}return a.a(2,{code:exports.RCRTCCode.SUCCESS,data:S});case 7:return a.a(2,this._dealRequestSuccessResult(I));case 8:this._logger.error(Oe.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:Le.FAILED,msg:"request error -> Request-Id: ".concat(m,", status: ").concat(E,", url: ").concat(h),timeout:this._timeout}),n);case 9:d+=1,a.n=2;break;case 10:return a.a(2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList})}},a,this)}))}},{key:"exchange",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s;return _().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,this._request("/exchange",e,t,r,n);case 1:return(a=i.v).code===exports.RCRTCCode.SUCCESS&&(null===(o=a.data)||void 0===o?void 0:o.resultCode)===exports.RCRTCCode.SUCCESS&&(s=a.data.urls)&&(this._configUrl=s.configUrl),i.a(2,a)}},i,this)}))}},{key:"exit",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this._logger.createTraceId(),t.n=1,this._request("/exit",e,{},r);case 1:return n=t.v,i=n.code,t.a(2,i)}},t,this)}))}},{key:"broadcastSubscribe",value:function(e,t){var r=this._logger.createTraceId();return this._request("/broadcast/subscribe",e,t,r,!0)}},{key:"broadcastExit",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this._logger.createTraceId(),t.n=1,this._request("/broadcast/exit",e,{},r,!0);case 1:return n=t.v,i=n.code,t.a(2,{code:i})}},t,this)}))}},{key:"setMcuConfig",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d,f,h;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(Oe.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:t}),n),this._configUrl){r.n=1;break}return this._logger.error(Oe.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),n),r.a(2,{code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND});case 1:return i="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),o=Sa(),a=Object.assign(Object.assign({},o),e),s=JSON.stringify(t),c=o["Request-Id"],r.n=2,this._runtime.httpReq({url:i,headers:a,body:s,method:D.POST});case 2:if(u=r.v,l=u.status,d=u.data,200!==l){r.n=3;break}return f=JSON.parse(d),(h=f.resultCode)===exports.RCRTCCode.SUCCESS?this._logger.info(Oe.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.SUCCESSED,"Request-Id":c}),n):this._logger.warn(Oe.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:h,"Request-Id":c}),n),r.a(2,{code:h,res:f});case 3:return this._logger.error(Oe.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(c,", status: ").concat(l,", url: ").concat(i)}),n),r.a(2,{code:exports.RCRTCCode.REQUEST_FAILED})}},r,this)}))}},{key:"getCDNResourceInfo",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l;return _().w(function(n){for(;;)switch(n.n){case 0:return i=Sa(),o=Object.assign(Object.assign({},i),e),a=i["Request-Id"],this._logger.info(Oe.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(a,", url: ").concat(t),r),n.n=1,this._runtime.httpReq({url:t,headers:o,method:D.GET});case 1:if(s=n.v,c=s.status,u=s.data,200!==c){n.n=2;break}return l=JSON.parse(u),this._logger.info(Oe.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:Le.SUCCESSED,cdnPlayerUrl:null==l?void 0:l.data.pull_url}),r),n.a(2,{code:l.resultCode,res:l});case 2:return this._logger.info(Oe.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REQUEST_FAILED}),r),n.a(2,{code:exports.RCRTCCode.REQUEST_FAILED})}},n,this)}))}},{key:"updateASRStatus",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i;return _().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._request("/rtc/media/v1/asr/update",e,t,r);case 1:return i=n.v,n.a(2,i)}},n,this)}))}},{key:"operateRealtimeTranslation",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i;return _().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._request("/rtc/media/v1/asr/translation",e,t,r);case 1:return i=n.v,n.a(2,i)}},n,this)}))}},{key:"operateSummarization",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o;return _().w(function(n){for(;;)switch(n.n){case 0:return i="/rtc/media/v1/ai/room/sum/".concat(t.status===exports.RCRTCOperateSummarizationType.OPEN?"start":"stop"),n.n=1,this._request(i,e,t,r);case 1:return o=n.v,n.a(2,o)}},n,this)}))}},{key:"generateSummarization",value:function(e,t,r,n,i,o,a){return K(this,void 0,void 0,_().m(function s(){var c,u,l,d,f,h,p;return _().w(function(s){for(;;)switch(s.n){case 0:return c={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:r,endTime:n,config:{summarization:i.enableSummarization,summarizationDetails:i.enableSummarizationDetails,chapterSummary:i.enableChapterSummary,todoList:i.enableTodoList,hashtag:i.enableHashtag,language:i.destLang,format:i.format,custom:i.customPrompt}},s.n=1,this._request("/rtc/media/v1/ai/room/sum/gen",c,u,a,!1,function(e,t){o(e,t)});case 1:if(l=s.v,d=l.code,f=l.data,h=null==f?void 0:f.getResponseHeader("x-code"),p=null==f?void 0:f.getResponseHeader("x-msg"),d!==exports.RCRTCCode.SUCCESS||!h||Number(h)===exports.RCRTCCode.SUCCESS){s.n=2;break}return s.a(2,{code:Number(h),msg:p});case 2:return s.a(2,{code:d})}},s,this)}))}},{key:"getASRContent",value:function(e,t,r,n,i,o,a){return K(this,void 0,void 0,_().m(function s(){var c,u,l,d,f,h,p;return _().w(function(s){for(;;)switch(s.n){case 0:return c={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:r,endTime:n,language:a},s.n=1,this._request("/rtc/media/v1/ai/room/sum/asr",c,u,o,!1,function(e,t){i(e,t)});case 1:if(l=s.v,d=l.code,f=l.data,h=null==f?void 0:f.getResponseHeader("x-code"),p=null==f?void 0:f.getResponseHeader("x-msg"),d!==exports.RCRTCCode.SUCCESS||!h||Number(h)===exports.RCRTCCode.SUCCESS){s.n=2;break}return s.a(2,{code:Number(h),msg:p});case 2:return s.a(2,{code:d})}},s,this)}))}}])}();Object.defineProperty(ya,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(ya,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(ya,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(Ia||(Ia={}));var ba,Oa=function(e,t){return Math.round(8*t/e)},La=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=Math.pow(10,t);return Math.round(e*r)/r},ka=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},Aa=function(e,t,r,n){if(0===t)return 0;if(!r||!n)return La(e/t,3);var i=t-n;if(0===i)return 0;var o=e-r;return o<0||i<0?0:La(o/i,3)},Na=function(e){var t=e.jitter,r=e.rtt,n=e.packetsLostRate;return!Kr(t)||!Kr(r)||0!==n};!function(e){e.TRACK="track",e.STREAM="stream",e.MEDIASOURCE="media-source",e.INBOUNDRTP="inbound-rtp",e.OUTBOUNDRTP="outbound-rtp",e.REMOTEINBOUNDRTP="remote-inbound-rtp",e.PEERCONNECTION="peer-connection",e.TRANSPORT="transport",e.CERTIFICATE="certificate",e.CANDIDATEPAIR="candidate-pair",e.REMOTECANDIDATE="remote-candidate",e.LOCALCANDIDATE="local-candidate"}(ba||(ba={}));var wa=function(){return o(function e(t,r,i,o,a,s){n(this,e),Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_latestPacketsSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestPacketsRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}})},[{key:"getTrackIdByMid",value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}},{key:"updateBytesSent",value:function(e,t,r){var n,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];n=t-o.bytesSent,i=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else n=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return Oa(i,n)}},{key:"updateBytesRecv",value:function(e,t,r){var n,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];n=t-o.bytesRecv,i=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else n=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return Oa(i,n)}},{key:"updateSenderPacketsLost",value:function(e,t,r){var n;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var i=this._latestPacketsSent[e],o=i.packetsLost,a=i.packetsSent;n=Aa(t,r,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:r}else n=Aa(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return n}},{key:"updateReceiverPacketsLost",value:function(e,t,r){var n;if(this._latestPacketsRecv[e]){var i=this._latestPacketsRecv[e],o=i.packetsLost,a=i.packetsRecv;n=Aa(t,r+t,o,a+o)}else n=Aa(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},n}},{key:"clearLatestpacketsSent",value:function(e){var t=this;e.forEach(function(e){if(parseInt(e.split("_").pop())===exports.RCMediaType.VIDEO_ONLY){var r="".concat(e,"_tiny");delete t._latestPacketsSent[r],delete t._latestBytesSent[r]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]})}},{key:"clearLatestPacketsRecv",value:function(e){var t=this;e.forEach(function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]})}},{key:"parseRTCStatsReport",value:function(e){var t,r={},n=a(e.entries());try{for(n.s();!(t=n.n()).done;){var i=R(t.value,2),o=i[0],s=i[1];/codec/gi.test(s)&&o.includes("RTCCodec_")||(r[o]=s)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"formatRCRTCStateReport",value:function(e){var t={senders:[],receivers:[]};return this._logger.info(Oe.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:Le.SUCCESSED,stats:e,reports:t})),t}},{key:"isValidTranceiver",value:function(e,t){var r,n,i="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(n=this._rtcPeerConn.currentRemoteDescription)||void 0===n?void 0:n.sdp,o=e.ssrc;return!(null==i?void 0:i.split("\r\nm=").some(function(e){return e.includes(o)&&e.includes("a=inactive")}))}},{key:"formatStateData",value:function(e){return Object.values(e).reduce(function(e,t){return t.type===ba.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===ba.INBOUNDRTP?(e.inbound.push(t),e):t.type===ba.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===ba.TRANSPORT?(e.transport.push(t),e):t.type===ba.PEERCONNECTION?(e.connection.push(t),e):e},{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}])}(),Pa=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,wa),o(e,[{key:"formatRCRTCStateReport",value:function(e){var t=this.formatStateData(e),r=t.outbound,n=t.remoteInbound,i=t.inbound,o=t.transport,a=t.connection,s={senders:[],receivers:[]},c=Math.floor(a[0].timestamp);s.timestamp=c;var u=0,l=0,d=this.pickOutbound(r,e,u,c,l);u=d.totalPacketsLost,l=d.bitrateSend,s.senders=d.senders,n.length>0&&s.senders.length>0&&this.pickRemoteInbound(n,s.senders,e);var _=0,f=this.pickInbound(i,e,u,c,_);if(u=f.totalPacketsLost,_=f.bitrateRecv,s.receivers=f.receivers,o.length>0){var h=o[0];this.pickRtcTransport(h,e,s,_,l,u)}return s}},{key:"pickRtcTransport",value:function(e,t,r,n,i,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,l=s.currentRoundTripTime,d=s.localCandidateId,_=s.remoteCandidateId,f=t[d],h=f.ip,p=f.port,g=f.networkType,R=t[_],m=R.ip,v=R.port,T=R.protocol;r.iceCandidatePair={IP:h,port:p,networkType:g,remoteIP:m,remotePort:v,protocol:T,bitrateRecv:n,bitrateSend:i,rtt:1e3*l,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},r.receivers.forEach(function(e){e.rtt=1e3*l})}}},{key:"pickRemoteInbound",value:function(e,t,r){var n=this;e.forEach(function(e){var i,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter(function(e){return e.id===o})[0];if(u&&!Na(u)){var l=null===(i=n._store)||void 0===i?void 0:i.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var d=n._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=n.updateSenderPacketsLost(l,c,d)}})}},{key:"_getOutboundVideoAttrs",value:function(e,t,r,n,i){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[n])||void 0===o?void 0:o.frameWidth)||t[i].width,l=(null===(a=t[n])||void 0===a?void 0:a.frameHeight)||t[i].height,c=(null===(s=t[i])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:l}}},{key:"pickOutbound",value:function(e,t,r,n,i){var o=this,a=[];return e.forEach(function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"outbound-rtp")){var c=e.id,u=e.kind,l=e.mediaSourceId,d=e.remoteId,_=e.packetsSent,f=e.bytesSent,h=e.encoderImplementation,p=e.pliCount,g=e.nackCount,R=e.mid,m=e.trackId;if(void 0!==R&&(m=o.getTrackIdByMid(R)),m){var v=o._getOutboundVideoAttrs(e,t,u,m,l),T=v.frameRate,C=v.frameWidth,E=v.frameHeight,I=t[d],S=null,y=null,b=0;I&&(S=I.jitter,y=I.roundTripTime,b=I.packetsLost),r+=b;var O=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(O){var L=l?t[l].audioLevel:t[m].audioLevel,k=0;!o._latestPacketsSent[O]&&(o._latestPacketsSent[O]={}),I?k=o.updateSenderPacketsLost(O,b,_):o._latestPacketsSent[O].crtPacketsSent=_;var A=o.updateBytesSent(O,f,n);A<0&&(A=0),i+=A,a.push({id:c,trackId:O,kind:u,packetsLostRate:k,remoteResource:!1,audioLevel:L||0===L?ka(L):null,frameWidth:C,frameHeight:E,frameRate:T,bitrate:A,jitter:S?Math.round(1e3*S):S,rtt:y?Math.round(1e3*y):y,encoderImplementation:h,pliCount:p,nackCount:g,googFirsSent:ha,samplingRate:ha,googRenderDelayMs:ha,trackState:ha})}}}}),{totalPacketsLost:r,bitrateSend:i,senders:a}}},{key:"_getInboundMediaAttrs",value:function(e,t,r,n,i){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===i?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[n].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[n].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[n].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}},{key:"pickInbound",value:function(e,t,r,n,i){var o=this,a=[];return e.forEach(function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"inbound-rtp")){var c=e.packetsLost,u=e.packetsReceived,l=e.jitter,d=e.bytesReceived,_=e.framesPerSecond,f=e.kind,h=e.codecImplementationName,p=e.nackCount,g=e.pliCount,R=e.mid,m=e.id,v=e.trackId;if(void 0!==R&&(v=o.getTrackIdByMid(R)),v){var T=o._getInboundMediaAttrs(e,t,v,m,f),C=T.frameWidth,E=T.frameHeight,I=T.audioLevel;r+=c;var S=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),y=o.updateReceiverPacketsLost(S,c,u),b=o.updateBytesRecv(S,d,n);b<0&&(b=0),i+=b,a.push({trackId:S,kind:f,packetsLostRate:y,remoteResource:!0,audioLevel:I||0===I?ka(I):null,frameWidth:C,frameHeight:E,frameRate:_,bitrate:b,jitter:l?Math.round(1e3*l):0,codecImplementationName:h,nackCount:p,pliCount:g,rtt:null,samplingRate:ha,googFirsReceived:ha,googRenderDelayMs:ha,trackState:ha})}}}),{totalPacketsLost:r,bitrateRecv:i,receivers:a}}}])}(),Da=function(){function e(){var t;return n(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return l(e,wa),o(e,[{key:"_pickSenderData",value:function(e,t,r){var n;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var i=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,l=e.pliCount,d=e.remoteId,_=d?t[d]:{jitter:null,roundTripTime:null,packetsLost:0},f=_.jitter,h=_.roundTripTime,p=_.packetsLost,g=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=p;var R=0;!this._latestPacketsSent[g]&&(this._latestPacketsSent[g]={}),d?R=this.updateSenderPacketsLost(g,p,a):this._latestPacketsSent[g].crtPacketsSent=a;var m=0;"video"===i?s&&(m=Math.floor(s/1e3)):m=this.updateBytesSent(g,o,this._reportsData.timestamp),m<0&&(m=0),this._bitrateSend+=m,this._reportsData.senders.push({trackId:g,kind:i,packetsLostRate:R,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:m,jitter:f?Math.round(1e3*f):null,rtt:h,encoderImplementation:null,pliCount:l,nackCount:u,googFirsSent:ha,samplingRate:ha,googRenderDelayMs:ha,trackState:ha})}}},{key:"_addSenderData",value:function(e,t){var r,n=t.localId,i=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[n].ssrc),o=this._reportsData.senders.filter(function(e){return e.trackId===i})[0];o&&Na(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(i,t.packetsLost,this._latestPacketsSent[i].crtPacketsSent))}},{key:"_pickReceiverData",value:function(e,t){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var n=e.packetsLost,i=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,l=e.nackCount,d=e.pliCount,_=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=n;var f=this.updateReceiverPacketsLost(_,n,o),h=0;"video"===c?u&&(h=Math.floor(u/1e3)):h=this.updateBytesRecv(_,i,this._reportsData.timestamp),h<0&&(h=0),this._bitrateRecv+=h,this._reportsData.receivers.push({trackId:_,kind:c,packetsLostRate:f,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:h,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:l,pliCount:d,rtt:null,samplingRate:ha,googFirsReceived:ha,googRenderDelayMs:ha,trackState:ha})}}},{key:"_pickIceCandidatePair",value:function(e,t){var r=e[t.localCandidateId],n=r.address,i=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:n,port:i,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}},{key:"formatRCRTCStateReport",value:function(e){var t=+new Date;for(var r in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var n=e[r],i=n.type;"outbound-rtp"===i&&this._pickSenderData(n,e,i),"remote-inbound-rtp"===i&&this._addSenderData(e,n),"inbound-rtp"===i&&this._pickReceiverData(n,i),"candidate-pair"===i&&"succeeded"===n.state&&this._pickIceCandidatePair(e,n)}return this._reportsData}}])}(),Ua=function(){function e(){var t;return n(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return l(e,wa),o(e,[{key:"_pickReceiverData",value:function(e,t){var r=this;e.forEach(function(e){var t;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"inbound-rtp")){var n=e.packetsLost,i=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.kind,c=e.nackCount,u=e.pliCount,l=e.audioLevel,d=e.frameHeight,_=e.frameWidth,f=null===(t=r._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(f){r._totalPacketsLost+=n;var h=r.updateReceiverPacketsLost(f,n,i),p=r.updateBytesRecv(f,a,r._reportsData.timestamp);p<0&&(p=0),r._bitrateRecv+=p,r._reportsData.receivers.push({trackId:f,kind:s,packetsLostRate:h,remoteResource:!0,audioLevel:l||0===l?ka(l):null,frameWidth:_,frameHeight:d,frameRate:null,bitrate:p,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:ha,googFirsReceived:ha,googRenderDelayMs:ha,trackState:ha})}}})}},{key:"_pickSenderData",value:function(e,t){var r=this;e.forEach(function(e){var n;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var i=null===(n=r._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,l=e.frameHeight,d=e.frameWidth,_=e.codecId,f=e.remoteId,h=e.packetsSent;if(i){var p=t[f],g=null,R=null,m=0;p&&(g=p.jitter,R=p.roundTripTime,m=p.packetsLost),r._totalPacketsLost+=m;var v=0;!r._latestPacketsSent[i]&&(r._latestPacketsSent[i]={}),p?v=r.updateSenderPacketsLost(i,m,h):r._latestPacketsSent[i].crtPacketsSent=h;var T=r.updateBytesSent(i,a,r._reportsData.timestamp);T<0&&(T=0),r._bitrateSend+=T,r._reportsData.senders.push({trackId:i,kind:o,packetsLostRate:v,remoteResource:!1,audioLevel:u||0===u?ka(u):null,frameWidth:d,frameHeight:l,frameRate:null,bitrate:T,jitter:g?Math.round(1e3*g):g,rtt:R?Math.round(1e3*R):R,encoderImplementation:t[_].mimeType,pliCount:s,nackCount:c,googFirsSent:ha,samplingRate:ha,googRenderDelayMs:ha,trackState:ha})}}})}},{key:"_pickIceCandidatePair",value:function(e,t){var r=e.selectedCandidatePairId;if(r){var n=t[r],i=n.availableOutgoingBitrate,o=n.availableIncomingBitrate,a=n.currentRoundTripTime,s=n.localCandidateId,c=n.remoteCandidateId,u=t[s],l=u.address,d=u.port,_=t[c],f=_.address,h=_.port,p=_.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:d,networkType:null,remoteIP:f,remotePort:h,protocol:p,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:i,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach(function(e){e.rtt=1e3*a})}}},{key:"formatRCRTCStateReport",value:function(e){var t=this.formatStateData(e),r=t.outbound,n=t.inbound,i=t.transport,o=t.connection;this._reportsData={senders:[],receivers:[]};var a=Math.floor(o[0].timestamp);if(this._reportsData.timestamp=a,this._totalPacketsLost=0,this._bitrateSend=0,this._bitrateRecv=0,this._pickSenderData(r,e),this._pickReceiverData(n,e),i.length>0){var s=i[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}])}(),Ma=function(){function e(t,r,i){n(this,e),Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"SDPHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"videoStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"audioStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]});var o=this.getStreamIndex();this.spliteStreams(o)}return o(e,[{key:"videoSdps",get:function(){return this.videoStreams.slice()}},{key:"audioSdps",get:function(){return this.audioStreams.slice()}},{key:"getStreamIndex",value:function(){for(var e=/m=(?:video|audio)/gim,t=new Set([0]),r=e.exec(this.SDP);null!==r;)t.add(null==r?void 0:r.index),r=e.exec(this.SDP);return t.add(this.SDP.length),v(t)}},{key:"spliteStreams",value:function(e){this.SDPHeader=this.SDP.substring(e[0],e[1]).replace(/\r\ns=-/g,"\r\ns=".concat((new Date).valueOf()));for(var t=1;t<e.length;t++){var r=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(r)?this.videoStreams.push(r):this.audioStreams.push(r)}}},{key:"setHeaderBitrate",value:function(t){this.SDPHeader=this.SDPHeader.replace(/(\r\ns=[^\r\n]+)/gi,"$1\r\nc=IN IP4 0.0.0.0\r\nb=AS:".concat(t*e.KBitrate,"\r\nb=TIAS:").concat(t*e.KBitrate*850))}},{key:"setAudiosBitrate",value:function(e){var t=this;return this.audioStreams=this.audioStreams.map(function(r){return t.setAudioItemBitrate(r,e)}),this}},{key:"setAudioBitrateWithStreamId",value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map(function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n}),this}},{key:"setAudioBitrateWithMid",value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map(function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n}),this}},{key:"setAudioItemBitrate",value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var n=["$1","maxaveragebitrate=".concat(r.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,n.join(";"))}return this.addAudioBlineAS(t,r)}},{key:"addAudioBlineAS",value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}},{key:"setVideosBitrate",value:function(e){var t=this;return this.videoStreams=this.videoStreams.map(function(r){return t.setVideoItemBitrate(r,e)}),this}},{key:"setVideoBitrateWithStreamId",value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map(function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n}),this}},{key:"setVideoBitrateWithMid",value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map(function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n}),this}},{key:"setVideoItemBitrate",value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var n=["$1","x-google-max-bitrate=".concat(r.max*e.KBitrate),"x-google-min-bitrate=".concat(r.min*e.KBitrate),"x-google-start-bitrate=".concat(r.start||r.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,n.join(";"))}return this.addVideoBlineAS(t,r)}},{key:"addVideoBlineAS",value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}},{key:"clearnSsrcWithMid",value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map(function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n}),this.videoStreams=this.videoStreams.map(function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n}),this}},{key:"clearSSRC",value:function(e,t){if(t===Fa.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Fa.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Fa.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}],[{key:"trimBlankLine",value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}},{key:"clearInactiveOrRecvonly",value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}])}();Object.defineProperty(Ma,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1});var xa,Ba=function(){return o(function e(){n(this,e)},null,[{key:"init",value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}},{key:"isInit",value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}},{key:"decodeAudio",value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(Oe.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"encodeAudio",value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(Oe.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"decodeVideo",value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(Oe.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}},{key:"encodeVideo",value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(Oe.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}])}();!function(e){e[e.NB=0]="NB",e[e.MB=1]="MB",e[e.WB=2]="WB",e[e.SWB=3]="SWB",e[e.FB=4]="FB"}(xa||(xa={})),xa.NB,xa.NB,xa.NB,xa.NB,xa.MB,xa.MB,xa.MB,xa.MB,xa.WB,xa.WB,xa.WB,xa.WB,xa.SWB,xa.SWB,xa.FB,xa.FB,xa.NB,xa.NB,xa.NB,xa.NB,xa.WB,xa.WB,xa.WB,xa.WB,xa.SWB,xa.SWB,xa.SWB,xa.SWB,xa.FB,xa.FB,xa.FB,xa.FB;var Va=function(){function e(){n(this,e)}return o(e,null,[{key:"splitSections",value:function(e){return e.split("\nm=").map(function(e,t){var r=t>0?"m=".concat(e):e;return"".concat(r.trim(),"\r\n")})}},{key:"getMediaSections",value:function(t){var r=e.splitSections(t);return r.shift(),r}},{key:"parseExtmap",value:function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}}},{key:"splitLines",value:function(e){return e.trim().split("\n").map(function(e){return e.trim()})}},{key:"parseMLine",value:function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}}},{key:"matchPrefix",value:function(t,r){return e.splitLines(t).filter(function(e){return 0===e.indexOf(r)})}},{key:"parseMsid",value:function(t){var r,n=e.matchPrefix(t,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=e.matchPrefix(t,"a=ssrc:").map(function(t){return e.parseSsrcMedia(t)}).filter(function(e){return"msid"===e.attribute});return i.length>0&&i[0].value?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:{stream:"",track:""}}},{key:"parseSsrcMedia",value:function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r}},{key:"getMid",value:function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)}},{key:"splitNaluData",value:function(e){var t=new Uint8Array(e),r=0;if(this.isIFrame(t)){var n=t.join(","),i=n.indexOf("0,0,0,1,101");-1===i&&(i=n.indexOf("0,0,0,1,37")),r=n.substring(0,i).split(",").length-1+4+8}else r=12;return{header:t.slice(0,r),payloadData:t.slice(r)}}},{key:"deal0x03",value:function(e,t){var r=[];return r="encode"===t?e.join(",").replaceAll(",0,0,1,",",0,0,3,1,").split(",").map(function(e){return Number(e)}):e.join(",").replaceAll(",0,0,3,1,",",0,0,1,").split(",").map(function(e){return Number(e)}),new Uint8Array(r)}},{key:"isIFrame",value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}},{key:"parsePayloadTypes",value:function(t){var r=e.getMediaSections(t).find(function(t){return"audio"===e.parseMLine(t).kind});if(r){var n=r.match(/a=rtpmap:(\d+)\s+(\S+)/g);n&&(e.payloadTypeCodecMap=n.map(function(e){var t=e.match(/a=rtpmap:(\d+)\s+(\w+)/);return t?{payloadType:Number(t[1]),codec:t[2]}:null}).filter(function(e){return!!e}))}}}])}();Object.defineProperty(Va,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]});var ja,Fa;function Ga(e,t){for(var r=0,n=t;n<e.length;){var i=e[n];if(r+=i,n++,255!==i)break}return{value:r,nextOffset:n}}function Ja(e,t){if(t>=e.length)return null;var r=Ga(e,t),n=r.value,i=r.nextOffset,o=Ga(e,i),a=o.value;if(i=o.nextOffset,a<16)return null;if(i+a>e.length)return null;var s=e.slice(i,i+16),c=i+16,u=a-16,l=e.slice(c,c+u);return l.length>=2&&0===l[l.length-2]&&128===l[l.length-1]?l=l.slice(0,l.length-2):l.length>=1&&128===l[l.length-1]&&(l=l.slice(0,l.length-1)),5===n?{payloadSize:a,uuid:s,content:l}:null}!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(ja||(ja={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(Fa||(Fa={}));var Ha=function(){function e(t,r,i,o){n(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_onReceiveSeiListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return o(e,[{key:"setReceiveSeiListener",value:function(e){this._onReceiveSeiListener=e}},{key:"getOutboundVideoInfo",value:function(){var e=[];for(var t in this._outboundStreams){var r=this._outboundStreams[t].getVideoTracks()[0];if(r){var n=/_tiny$/.test(t),i=Lr(r),o=i.width,a=i.height;e.push({trackId:r.id,simulcast:n?Ia.TINY:Ia.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}},{key:"setRemoteAnswer",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r;return _().w(function(t){for(;;)switch(t.p=t.n){case 0:return e=Ma.trimBlankLine(e),t.p=1,t.n=2,this._peer.setRemoteDescription({type:"answer",sdp:e});case 2:t.n=4;break;case 3:return t.p=3,r=t.v,this._logger.info(Oe.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:Le.FAILED,msg:r})),t.a(2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED);case 4:return this._logger.info(Oe.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:Le.SUCCESSED,sdp:e})),t.a(2,exports.RCRTCCode.SUCCESS)}},t,this,[[1,3]])}))}},{key:"getStatParsr",value:function(e,t,r,n){return/chrome/i.test(jr.browser)?new Pa(this,e,this._logger,t,r,n):/Firefox/i.test(jr.browser)?new Da(this,e,this._logger,t,r,n):/Safari/i.test(jr.browser)?new Ua(this,e,this._logger,t,r,n):null}},{key:"getTrackIdByMid",value:function(e){return null}},{key:"resetSdp",value:function(e){return Ma.trimBlankLine(e)}},{key:"_setupSenderTransform",value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}},{key:"_setupReceiverTransform",value:function(e){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}},{key:"_encodeVideoFrame",value:function(e){var t=Va.splitNaluData(e),r=t.header,n=t.payloadData,i=Ba.encodeVideo(n),o=Va.deal0x03(i,"encode");return new Uint8Array([].concat(v(r),v(o))).buffer}},{key:"_decodeVideoFrame",value:function(e){var t,r=new Uint8Array(e),n=r.join(",").indexOf("0,0,0,1,6,5");if(-1!==n&&r.join(",").includes("84,128,131,151,240,35,71,75,183,247,79,50,181,78,6,172")){var i=r.join(",").slice(n);return null===(t=this._onReceiveSeiListener)||void 0===t||t.call(this,i),e}if(!this._useEncrypt)return e;var o=Va.splitNaluData(e),a=o.header,s=o.payloadData,c=Va.deal0x03(s,"decode"),u=Ba.decodeVideo(c);return new Uint8Array([].concat(v(a),v(u))).buffer}},{key:"_handleAudioREDFrame",value:function(e,t){var r=function(e){for(var t=[],r=0;;){var n,i=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(i?(a=0,s=e.byteLength-(t.length>0?t.map(function(e){return 4+e.block.byteLength}).reduce(function(e,t){return e+t}):0)-1,c=e.slice(r,r+1),r+=1):(a=(e[r+1]<<6)+(e[r+2]>>2),s=((3&e[r+2])<<8)+e[r+3],c=e.slice(r,r+4),r+=4),n=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:n,isPrimary:i,blockPType:o}),i)break}return t.forEach(function(t){var n=t.block.byteLength,i=e.slice(r,r+n);t.block.set(i),r+=n}),t}(new Uint8Array(e)),n=[],i=[],o=0;r.forEach(function(e){var r="decode"===t?Ba.decodeAudio(e.block):Ba.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=R(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+r.byteLength>>8,c=255&r.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=r,o+=e.block.byteLength+e.header.byteLength,n.push(e.header),i.push(e.block)});var a=new Uint8Array(o),s=0;return[].concat(n,i).forEach(function(e){a.set(e,s),s+=e.byteLength}),a.buffer}},{key:"_handleOpusFrame",value:function(e,t){var r=new Uint8Array(e);return("encode"===t?Ba.encodeAudio(r):Ba.decodeAudio(r)).buffer}},{key:"_encodeRtpChunk",value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(n);else{var i=t.getMetadata().payloadType,o=Va.payloadTypeCodecMap.filter(function(e){return e.payloadType===i})[0].codec;"red"===o?t.data=this._handleAudioREDFrame(n,"encode"):"opus"===o?t.data=this._handleOpusFrame(n,"encode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}r.enqueue(t)}},{key:"_decodeRtpChunk",value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(n);else if(this._useEncrypt){var i=t.getMetadata().payloadType,o=Va.payloadTypeCodecMap.filter(function(e){return e.payloadType===i})[0].codec;"red"===o?t.data=this._handleAudioREDFrame(n,"decode"):"opus"===o?t.data=this._handleOpusFrame(n,"decode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}r.enqueue(t)}}],[{key:"setSdpSemantics",value:function(e,t){var r=jr.browser,n=jr.version,i=jr.supportsUnifiedPlan;if(t.info(Oe.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:i,browser:r,version:n})),i)return/chrome/i.test(r)?n?void(this._sdpSemantics=n>92?"unified-plan":n<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=n<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}},{key:"getSdpSemantics",value:function(){return e._sdpSemantics}}])}(),Ka=function(){function e(t,i){var o;return n(this,e),o=r(this,e,[i,ja.PLANB,t]),Object.defineProperty(o,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,Ma),o(e,[{key:"stringify",value:function(){var e=[this.SDPHeader];[].concat(v(this.audioStreams),v(this.videoStreams)).forEach(function(t){var r=t.match(/\ba=mid:(video|audio)\b/),n=Ma.clearInactiveOrRecvonly(t);r&&r[1]===Qt.AUDIO&&(e[1]=n),r&&r[1]===Qt.VIDEO&&(e[2]=n)});var t=e.join("");return Ma.trimBlankLine(t)}},{key:"setAudioBitrateWithStreamId",value:function(e,t){return this._logger.warn(Oe.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}},{key:"setVideoBitrateWithStreamId",value:function(e,t){return this._logger.warn(Oe.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}])}(),qa=function(){function e(){var t;return n(this,e),t=r(this,e,arguments),Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return l(e,Ha),o(e,[{key:"addLocalTrack",value:function(e){this._localTracks.every(function(t){return t.getTrackId()!==e.getTrackId()})&&this._localTracks.push(e);var t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),n=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);n.getTracks().forEach(function(e){e.kind===r.kind&&n.removeTrack(e)}),n.addTrack(r);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(r):(this.senders[i]=this._peer.addTrack(r,n),Object.defineProperty(r,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}))}},{key:"removeLocalTrack",value:function(e){var t=this._localTracks.findIndex(function(t){return t===e});t>=0&&this._localTracks.splice(t,1);var r=e.getTrackId(),n=this.senders[r];n&&(n.replaceTrack(null),this._peer.removeTrack(n),delete this.senders[r])}},{key:"updateSubRemoteTracks",value:function(e){}},{key:"updateRecvTransceiverMap",value:function(e,t){}},{key:"setBitrate",value:function(e,t,r){}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 1:for(n in r=t.v,this._outboundStreams)i=this._outboundStreams[n].id,r.sdp=r.sdp.replace(new RegExp(i,"g"),n);return r.sdp&&(r.sdp=this.resetSdp(r.sdp)),t.n=2,this._peer.setLocalDescription(r);case 2:return t.a(2,{type:"offer",semantics:"plan-b",sdp:r.sdp})}},t,this)}))}},{key:"setRemoteAnswer",value:function(t){return t=this.resetSdp(t),m(e,"setRemoteAnswer",this,3)([t])}},{key:"_getMaxRangeBitrate",value:function(e){var t=this._localTracks.filter(function(t){return e===exports.RCMediaType.AUDIO_ONLY?t.isAudioTrack():t.isVideoTrack()}),r={max:0,min:0};return t.forEach(function(e){var t=e.getBitrate(),n=t.min,i=t.max,o=t.start;r.max=r.max<i?i:r.max,r.min=r.min>n?n:r.min,r.max===i?r.start=o:r.start=.7*r.max}),r}},{key:"resetSdp",value:function(e){var t=new Ka(this._logger,e),r=this._getMaxRangeBitrate(exports.RCMediaType.VIDEO_ONLY),n=this._getMaxRangeBitrate(exports.RCMediaType.AUDIO_ONLY);return t.setAudiosBitrate(n),t.setVideosBitrate(r),t.stringify()}}])}(),Ya=function(){function e(t,i){return n(this,e),r(this,e,[i,ja.UNIFIEDPLAN,t])}return l(e,Ma),o(e,[{key:"stringify",value:function(){var e=[this.SDPHeader];[].concat(v(this.audioStreams),v(this.videoStreams)).forEach(function(t){var r=t.match(/\ba=mid:(\d+)\b/);r&&r[1]&&(e[+r[1]+1]=t)}),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return Ma.trimBlankLine(t)}}])}(),Wa=function(){function e(){n(this,e),Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return o(e,[{key:"push",value:function(e,t){return this.__streams.set(e,t),t}},{key:"pickup",value:function(e){return this.__streams.get(e)}},{key:"delete",value:function(e){return this.__streams.delete(e)}},{key:"streams",get:function(){var e,t=new Map,r=a(this.__streams.keys());try{for(r.s();!(e=r.n()).done;){var n=e.value;t.set(n,this.pickup(n))}}catch(e){r.e(e)}finally{r.f()}return t}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}])}(),za=function(){function e(){var t;return n(this,e),t=r(this,e,arguments),Object.defineProperty(t,"_sendTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_recvAudio",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvVideo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_subedTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"midMsid",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t}return l(e,Ha),o(e,[{key:"setBitrate",value:function(e,t,r){this._logger.warn(Oe.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}},{key:"getTrackIdByMid",value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var r in this._recvTransceiver){if(this._recvTransceiver[r].mid===e)return r}return null}},{key:"addLocalTrack",value:function(e){var t,r=e.getTrackId(),n=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[n]||(this._outboundStreams[n]=new MediaStream);o.getTracks().forEach(function(e){e.kind===i.kind&&o.removeTrack(e)}),o.addTrack(i);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(i),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}Wa.getInstance().push(r,{msid:n,id:this._outboundStreams[n].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}},{key:"removeLocalTrack",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.getTrackId(),n=e.getStreamId();delete this._localTracks[r];var i=this._sendTransceiver[r];if(i){"closed"!==this._peer.connectionState&&(i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null));var o=this._outboundStreams[n];(e.isAudioTrack()?o.getAudioTracks():o.getVideoTracks()).forEach(function(e){return o.removeTrack(e)});var a=this._sendTransceiver["".concat(r,"_tiny")];if(a&&"inactive"!==a.direction&&t&&"closed"!==this._peer.connectionState){a.direction="inactive";var s=a.sender,c=s.track;this._peer.removeTrack(s),s.replaceTrack(null),this._outboundStreams["".concat(n,"_tiny")].removeTrack(c),c.stop()}}}},{key:"updateRecvTransceiverMap",value:function(e,t){var r=Nr(e).mediaType;this._recvTransceiver[e]=t;var n=r===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=n.findIndex(function(e){return e===t});i>=0&&n.splice(i,1)}},{key:"updateSubRemoteTracks",value:function(e){var t=this,r=e.slice(),n=this._subedTracks.slice();this._subedTracks=e.slice();for(var i=function(){var e=r[o],t=n.findIndex(function(t){return t===e});t>=0&&(r.splice(o,1),n.splice(t,1))},o=r.length-1;o>=0;o-=1)i();n.length&&n.forEach(function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var n=t._recvTransceiver[r];n&&(n.direction="inactive")});var a={audio:0,video:0};r.length&&r.forEach(function(e){var r=e.isAudioTrack()?"audio":"video",n=t._recvTransceiver[e.getTrackId()];n?n.direction="recvonly":a[r]+=1});for(var s=this._recvAudio.length;s<a.audio;s+=1){var c=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(c),this._setupReceiverTransform(c.receiver)}for(var u=this._recvVideo.length;u<a.video;u+=1){var l=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(l),this._setupReceiverTransform(l.receiver)}}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._peer.createOffer({iceRestart:e});case 1:for(i in r=t.v,n=r.sdp,this._outboundStreams)o=this._outboundStreams[i].id,n=n.replace(new RegExp(o,"g"),i);return n=(n=this.resetOfferSdp(n)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),r.sdp=n,t.n=2,this._peer.setLocalDescription(r);case 2:return t.a(2,{type:"offer",semantics:"unified-plan",sdp:n})}},t,this)}))}},{key:"setRemoteAnswer",value:function(t){t=this.resetAnswerSdp(t);var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(t)&&(t=t.replace(r,"\r\n")),m(e,"setRemoteAnswer",this,3)([t])}},{key:"_genarateMid",value:function(e,t,r){var n=null;return Va.getMediaSections(e).forEach(function(e){Va.parseExtmap(e);var i=Va.parseMLine(e).kind,o=Va.parseMsid(e).stream,a=Va.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===i&&a&&(n=a)}),n}},{key:"_setSenderTransceiverBitrate",value:function(e,t,r,n){var i=this._localTracks[t],o=null==i?void 0:i.getBitrate();n===Qt.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),n===Qt.VIDEO&&o&&e.setVideoBitrateWithMid(o,r)}},{key:"_resetSenderTransceiver",value:function(e,t){var r;for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=null===(r=i.sender.track)||void 0===r?void 0:r.kind,a=i.direction,s=i.mid;s||(s=this._genarateMid(e,n,o)),s&&(a===Fa.SENDONLY&&this._setSenderTransceiverBitrate(t,n,s,o),a===Fa.INACTIVE&&t.clearnSsrcWithMid(s,Fa.INACTIVE))}}},{key:"_resetRecvTransceiver",value:function(e){for(var t in this._recvTransceiver){var r=this._recvTransceiver[t],n=r.direction,i=r.mid;i&&n===Fa.INACTIVE&&e.clearnSsrcWithMid(i,Fa.RECVONLY)}}},{key:"resetOfferSdp",value:function(e){var t=new Ya(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}},{key:"resetAnswerSdp",value:function(e){var t,r=new Ya(this._logger,e);for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=i.mid;if(o){var a=this._localTracks[n],s=null==a?void 0:a.getBitrate(),c=null===(t=i.sender.track)||void 0===t?void 0:t.kind;c===Qt.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===Qt.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}])}(),Qa=function(){function e(t,i,o,a,s,c){var u,l=arguments.length>6&&void 0!==arguments[6]&&arguments[6],d=arguments.length>7&&void 0!==arguments[7]&&arguments[7];n(this,e),u=r(this,e),Object.defineProperty(u,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_store",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(u,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(u,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(u,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var _=Ha.getSdpSemantics(),f="unified-plan"===_&&d&&"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams&&Ba.isInit(),h=u._rtcPeerConn=new RTCPeerConnection({sdpSemantics:_,encodedInsertableStreams:f});return u._sdpStrategy="plan-b"===_?new qa(t,u._logger,h,!1):new za(t,u._logger,h,f),u._sdpStrategy.setReceiveSeiListener(u._decodeSeiData.bind(u)),u._rtcPeerConn.oniceconnectionstatechange=u._onICEConnectionStateChange.bind(u),u._rtcPeerConn.onconnectionstatechange=u._onConnectionStateChange.bind(u),u._rtcPeerConn.ontrack=u._onTrackReady.bind(u),u.reportParser=u._sdpStrategy.getStatParsr(u._rtcPeerConn,_,u._currentUserId,u._store),u}return l(e,F),o(e,[{key:"getLocalTracks",value:function(){return Object.values(this.pubLocalTracks)}},{key:"_decodeSeiData",value:function(t){var r=t.split(",").map(function(e){return Number(e)}),n=function(e){if(e.length>=4&&0===e[0]&&0===e[1]&&(1===e[2]||0===e[2]&&1===e[3]))for(var t=0;t+4<e.length;)if(0===e[t]&&0===e[t+1]&&(1===e[t+2]||0===e[t+2]&&1===e[t+3])){var r=t+(1===e[t+2]?3:4);if(r>=e.length)break;if(6==(31&e[r])){var n=Ja(e,r+1);if(n)return{payloadSize:n.payloadSize,content:n.content}}t=r+1}else t++;else for(var i=0;i+4<=e.length;){var o=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3];if(o<=0||i+4+o>e.length)break;var a=i+4;if(6==(31&e[a])){var s=a+1,c=Ja(e.subarray(s,i+4+o),0);if(c)return{payloadSize:c.payloadSize,content:c.content}}i+=4+o}return null}(new Uint8Array(r));if(null==n?void 0:n.content.length){var i=this._context.decodeAsrText(n.content,r);i.length&&this.emit(e.__INNER_SEI_CONTENT__,i)}}},{key:"_onConnectionStateChange",value:function(){this._logger.info(Oe.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}},{key:"startAutoExecute",value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout(function(){t._reportHandle(),t.startAutoExecute(e)},e)}},{key:"stopAutoExecute",value:function(){clearTimeout(this._reportStatsTimer)}},{key:"_onICEConnectionStateChange",value:function(){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a;return _().w(function(t){for(;;)switch(t.n){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(Oe.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),t.n=1,this._getStatsData();case 1:o=t.v,a=o?this._createRCRTCStateReport(o).iceCandidatePair:null,this.emit(e.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:a}),"connected"===i?(this.emit(e.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==i&&"disconnected"!==i||this._handleRetry();try{null===(n=null===(r=this._reportListener)||void 0===r?void 0:r.onICEConnectionStateChange)||void 0===n||n.call(r,i)}catch(e){this._logger.error(Oe.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:Le.FAILED,mag:e}))}case 2:return t.a(2)}},t,this)}))}},{key:"_handleRetry",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n=this;return _().w(function(e){for(;;)switch(e.n){case 0:if(!this._inRetry){e.n=1;break}return e.a(2);case 1:return this.clearReTryExchangeTimer(),this._inRetry=!0,e.n=2,this._reTryExchange();case 2:if(t=e.v,r=t.code,this._inRetry=!1,r!==exports.RCRTCCode.SUCCESS){e.n=3;break}return e.a(2);case 3:this._reTryExchangeTimer=setTimeout(function(){return n._handleRetry()},15e3);case 4:return e.a(2)}},e,this)}))}},{key:"_onTrackReady",value:function(t){if(t.streams.length){var r=t.streams[0].id,n=t.receiver.track,i=[r,"audio"===n.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");Object.defineProperty(n,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(i,t.transceiver),Nr(i).tag!==pa&&this.emit(e.__INNER_EVENT_TRACK_READY__,t)}}},{key:"setBitrate",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){return _().w(function(n){for(;;)switch(n.n){case 0:this._sdpStrategy.setBitrate(e,t,r),this._logger.info(Oe.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,max:e,min:t,start:r}));case 1:return n.a(2)}},n,this)}))}},{key:"createOffer",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._sdpStrategy.createOffer(e);case 1:return r=t.v,this._logger.info(Oe.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({offerSDP:r.sdp,sdpDemantics:r.semantics})),t.a(2,r)}},t,this)}))}},{key:"setRemoteAnswer",value:function(e){return K(this,arguments,void 0,function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return _().m(function n(){var i;return _().w(function(n){for(;;)if(0===n.n)return Va.parsePayloadTypes(null===(i=t._rtcPeerConn.localDescription)||void 0===i?void 0:i.sdp),t._firstConnectFromPub=r,n.a(2,t._sdpStrategy.setRemoteAnswer(e))},n)})()})}},{key:"getLocalTrack",value:function(e){return this.pubLocalTracks[e]||null}},{key:"addLocalTrack",value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(ur.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(ur.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(ur.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(ur.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(Oe.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,"trackId: ".concat(e.getTrackId()))}},{key:"removeLocalTrackById",value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(Oe.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(Oe.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:Le.FAILED,msg:"track not found",trackId:e}))}},{key:"removeAllLocalTrack",value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach(function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)})}},{key:"removeLocalTrack",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.getTrackId();delete this.pubLocalTracks[r],this._sdpStrategy.removeLocalTrack(e,t),e.__innerSetPublished(!1),e.off(ur.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(ur.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var n="".concat(r,"_tiny"),i=this.getLocalTrack(n);i&&t&&(this._sdpStrategy.removeLocalTrack(i,t),delete this.pubLocalTracks[n],i.destroy()),this._logger.info(Oe.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:r}))}},{key:"_updateRecvTransceiverMap",value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}},{key:"updateSubRemoteTracks",value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}},{key:"getOutboundVideoInfo",value:function(){return this._sdpStrategy.getOutboundVideoInfo()}},{key:"_onLocalTrackMuted",value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&(r.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(ur.__INNER_EVENT_MUTED_CHANGE__,e,t)}},{key:"_onLocalTrackDestroied",value:function(e){this.emit(ur.__INNER_EVENT_DESTROY__,e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"_createSenderReport",value:function(e){return e.filter(function(e){return e.trackId}).map(function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),Object.assign({},t)})}},{key:"_createReceiverReport",value:function(e){return e.filter(function(e){return e.trackId}).map(function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),Object.assign({},t)})}},{key:"_createRCRTCStateReport",value:function(e){var t=e.timestamp,r=e.iceCandidatePair,n=e.senders,i=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)Kr(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(n),receivers:this._createReceiverReport(i)}}},{key:"_getStatsData",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n,i,o;return _().w(function(e){for(;;)switch(e.n){case 0:return this._formatStatsData=null,n=null,e.n=1,this._rtcPeerConn.getStats();case 1:return i=e.v,n=null===(t=this.reportParser)||void 0===t?void 0:t.parseRTCStatsReport(i),o=null===(r=this.reportParser)||void 0===r?void 0:r.formatRCRTCStateReport(n),this._formatStatsData=o,e.a(2,o)}},e,this)}))}},{key:"_reportHandle",value:function(){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c,u,l;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._getStatsData();case 1:if(s=t.v){t.n=2;break}return t.a(2);case 2:c=this._createRCRTCStateReport(s);try{null===(n=null===(r=this._reportListener)||void 0===r?void 0:r.onStateReport)||void 0===n||n.call(r,JSON.parse(JSON.stringify(c)))}catch(e){this._logger.error(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(u=[].concat(v(s.receivers),v(s.senders)).filter(function(e){return"audio"===e.kind}).map(function(e){return{trackId:e.trackId,audioLevel:e.audioLevel}}),this.emit(e.__INNER_AUDIOLEVEL_CHANGE__,u),this._isRoomAudience&&(null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)){l=this._getLiveAudioState();try{l.length&&(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onReportLiveAudioStates)||void 0===a||a.call(o,l))}catch(e){this._logger.error(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}case 3:return t.a(2)}},t,this)}))}},{key:"_getLiveAudioState",value:function(){var e=this,t=[];return this._rtcPeerConn.getReceivers().forEach(function(e){var r=e.getContributingSources();r.length&&t.push.apply(t,v(r))}),t.map(function(t){var r=t.source,n=t.audioLevel,i=e._store.getTrackIdBySSRC(r);if(!i)return{};var o=Nr(i).userId;return{audioLevel:ka(n),userId:o,trackId:i}}).filter(function(e){return!!e.userId})}},{key:"_sendR3R4Data",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n,i,o,a,s,c;return _().w(function(e){for(;;)switch(e.n){case 0:if(o=this._formatStatsData){e.n=1;break}return e.a(2);case 1:if(s=(a=o).senders,c=a.receivers,console.log("sendR3R4: senderTrackId: ".concat(null===(t=s[0])||void 0===t?void 0:t.trackId,", receiverTrackId: ").concat(null===(r=c[0])||void 0===r?void 0:r.trackId)),!s.length){e.n=2;break}return e.n=2,null===(n=this._polarisReport)||void 0===n?void 0:n.sendR3Data(o);case 2:if(!c.length){e.n=3;break}return e.n=3,null===(i=this._polarisReport)||void 0===i?void 0:i.sendR4Data(o);case 3:s.length=0,c.length=0,o=null;case 4:return e.a(2)}},e,this)}))}},{key:"__reportR3R4ToPolaris",value:function(){return K(this,void 0,void 0,_().m(function e(){var t=this;return _().w(function(e){for(;;)switch(e.n){case 0:if(!this._isDestroyed){e.n=1;break}return e.a(2);case 1:clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout(function(){return K(t,void 0,void 0,_().m(function e(){var t=this;return _().w(function(e){for(;;)switch(e.n){case 0:if(!this._isDestroyed){e.n=1;break}return e.a(2);case 1:this._sendR3R4Data().then(function(){t.__reportR3R4ToPolaris()});case 2:return e.a(2)}},e,this)}))},2e3);case 2:return e.a(2)}},e,this)}))}},{key:"getRTCPeerConn",value:function(){return this._rtcPeerConn}},{key:"destroy",value:function(){this.clear(),this.clearReTryExchangeTimer(),clearTimeout(this._reportR3R4ToPolarisTimer),this.stopAutoExecute(),this.registerReportListener(null),this._rtcPeerConn.close(),this._isDestroyed=!0,this.reportParser=null,this._logger.info(Oe.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:Le.SUCCESSED}))}},{key:"clearReTryExchangeTimer",value:function(){clearTimeout(this._reTryExchangeTimer),this._reTryExchangeTimer=null}},{key:"isDestroyed",value:function(){return this._isDestroyed}}])}();Object.defineProperty(Qa,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(Qa,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(Qa,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(Qa,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),Object.defineProperty(Qa,"__INNER_SEI_CONTENT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-sei-content"});var Za,Xa,$a,es,ts=function(){return o(function e(t,r){n(this,e),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})},[{key:"audioLevelReport",value:function(e){var t=this;if(this._audioLevelChangeHandler){var r=[];e.forEach(function(e){var n=Nr(e.trackId).userId,i=t._store.crtUserId===n?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);i&&r.push({track:i,audioLevel:e.audioLevel||0})}),this._audioLevelChangeHandler(r)}}},{key:"onAudioLevelChange",value:function(e){this._audioLevelChangeHandler=e}}])}();exports.RCRTCLiveRole=void 0,(Za=exports.RCRTCLiveRole||(exports.RCRTCLiveRole={}))[Za.ANCHOR=1]="ANCHOR",Za[Za.AUDIENCE=2]="AUDIENCE",function(e){e.UNPUBLISH_PREV="UnpublishPrevCommand",e.PULL_RTCROOM_STATUS="PullRTCRoomStatusCommand",e.JOINROOM="JoinRoomCommand",e.PARSE_REMOTERES="ParseRemoteResCommand",e.PARSE_USERSTATE="ParseUserStateCommand",e.LOCAL_TRACK_MUTE="LocalTrackMuteCommand",e.PUBLISH="PublishCommand",e.RETRY_EXCHANGE="RetryExchangeCommand",e.UNPUBLISH="UnpublishCommand",e.SUBSCRIBE="SubscribeCommand",e.UNSUBSCRIBE="UnsubscribeCommand",e.UPDATE_SUBSCRIBE_LIST="UpdateSubscribeListCommand",e.ON_SIGNAL_RECONNECTED="OnSignalReconnectedCommand",e.LEAVE_OTHER_ROOM="LeaveOtherRoomCommand",e.RTC_IDENTITY_CHANGE="RTCIdentityChangeCommand",e.ENABLE_INNER_CDN="EnableInnerCDNCommand",e.EXCHANGE_WITH_PUSH_OTHER_ROOM="ExchangeWithPushOtherRoomCommand",e.MCUCONFIG_FLUSH="MCUConfigFlushCommand",e.UNKNOWN="Unknown"}(Xa||(Xa={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}($a||($a={})),function(e){e[e.Destroy=40400]="Destroy"}(es||(es={}));var rs,ns=function(){return o(function e(){n(this,e)},[{key:"priority",get:function(){return $a.LOW}},{key:"kind",get:function(){return Xa.UNKNOWN}}])}(),is=function(){return o(function e(t,r,i,o){n(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_busy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1})},[{key:"_next",value:function(){this._busy=!1,this._execute()}},{key:"_execute",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n,i,o,a,s;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this._isDestroyed&&!this._busy&&0!==this._queue.length){e.n=1;break}return e.a(2);case 1:return this._busy=!0,t=this._queue.shift(),r=t.command,n=t.resolve,o=this._logger.createTraceId(),e.p=2,this._logger.info(Oe.L_INVOKER_EXECUTE_T,"kind: ".concat(r.kind,", length: ").concat(this._queue.length),o),e.n=3,r.execute(this._context,this._store,this);case 3:i=e.v,e.n=5;break;case 4:return e.p=4,s=e.v,console.error(s),this._logger.error(Oe.L_INVOKER_EXECUTE_R,r.kind,o),this._next(),e.a(2);case 5:(a=i.code)!==exports.RCRTCCode.SUCCESS&&a!==ke?this._logger.warn(Oe.L_INVOKER_EXECUTE_R,"code: ".concat(a,", kind: ").concat(r.kind),o):this._logger.info(Oe.L_INVOKER_EXECUTE_R,"kind: ".concat(r.kind,", Done"),o),n(i),this._next();case 6:return e.a(2)}},e,this,[[2,4]])}))}},{key:"push",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r=this;return _().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){if(r._logger.info(Oe.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:r._isDestroyed,kind:e.kind,length:r._queue.length})),r._isDestroyed)t({code:exports.RCRTCCode.NOT_IN_ROOM});else{var n=e.priority;if(n===$a.LOW)r._queue.push({command:e,resolve:t});else{var i=r._queue.findIndex(function(e){return e.command.priority<n}),o=-1===i?r._queue.length-1:i;r._queue.splice(o,0,{command:e,resolve:t})}setTimeout(function(){r._execute()},0)}}))},t)}))}},{key:"isDestroyed",value:function(){return this._isDestroyed}},{key:"destroy",value:function(){var e=this;this._isDestroyed||(this._logger.info(Oe.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach(function(t){t.resolve({code:e.abortCode})}),this._queue.length=0)}}])}(),os=function(){function e(t,i){return n(this,e),r(this,e,[t.logger,t,i,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED])}return l(e,is),o(e,[{key:"store",get:function(){return this._context.store}},{key:"destroy",value:function(){m(e,"destroy",this,3)([]),this._store.removeRemoteTracks()}}])}();!function(e){e.VOID="0",e.OPEN="2",e.CLOSE="1"}(rs||(rs={}));var as=function(){return o(function e(t,r,i,o,a,s,c,u){n(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_roomResources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_collectSubscribeList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_CDNEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_trackIdSSRCMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_roomStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_supportNtf",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_asrStatus",{enumerable:!0,configurable:!0,writable:!0,value:rs.VOID}),Object.defineProperty(this,"_asrEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_isStartRealTranslate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_translationLang",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_summarizationStatusData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_nickName",{enumerable:!0,configurable:!0,writable:!0,value:""})},[{key:"getResourcesByUserId",value:function(e){return this._roomResources[e]||this._asrSeiUris[e]}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var r in this._remoteTracks){var n=this._remoteTracks[r];n.getUserId()===e&&t.push(n)}return t}},{key:"getRemoteTracks",value:function(){return this._remoteTracks}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getAllUserIds",value:function(){return Object.keys(this._roomResources)}},{key:"getRemoteUserIds",value:function(){var e=this;return this.getAllUserIds().filter(function(t){return t!==e.crtUserId})}},{key:"getSubscribedList",value:function(){return this._subscribedList}},{key:"getCollectSubscribeList",value:function(){return this._collectSubscribeList}},{key:"getPublishedResourceByTrackId",value:function(e){var t=Nr(e),r=t.tag,n=t.userId;return r===pa?this._asrSeiUris[n][0]:this._roomResources[n].find(function(t){return Ar(t)===e})}},{key:"getToken",value:function(){return this._token}},{key:"getCDNEnable",value:function(){return this._CDNEnable}},{key:"getCDNUris",value:function(){return this._CDNUris}},{key:"getRoomStatusVersion",value:function(){return this._roomStatusVersion}},{key:"getTrackIdBySSRC",value:function(e){return this._trackIdSSRCMap.get(e)}},{key:"getRTCRequestHeader",value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}},{key:"getSupportNtf",value:function(){return this._supportNtf}},{key:"getASRIsAvailable",value:function(){return!!this.getASRSeiUris().length}},{key:"getASRStatus",value:function(){return this._asrStatus}},{key:"getASREnable",value:function(){return this._asrEnable}},{key:"getSrcLanguage",value:function(){return this._srcLanguage}},{key:"getASRSeiUris",value:function(){var e=Object.values(this._asrSeiUris);return e.length?e[0]:[]}},{key:"getIsStartRealTranslate",value:function(){return this._isStartRealTranslate}},{key:"getTranslationLang",value:function(){return this._translationLang}},{key:"getSummarizationStatusData",value:function(){return this._summarizationStatusData||null}},{key:"getNickName",value:function(){return this._nickName}}])}(),ss=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,as),o(e,[{key:"_updateTrackIdSSRCMap",value:function(){var e=this;Object.values(this._roomResources).forEach(function(t){t.forEach(function(t){var r=JSON.parse(t.uri),n=r.ssrc,i=r.resourceId;e._trackIdSSRCMap.set(n,i)})})}},{key:"setTrackIdSSRCMap",value:function(e,t){this._trackIdSSRCMap.set(e,t)}},{key:"_initRemoteTracks",value:function(){var e=this;for(var t in this._roomResources){var r=this._roomResources[t];t!==this.crtUserId&&0!==r.length&&r.forEach(function(t){var r=Ar(t),n=Nr(r),i=n.tag,o=n.userId,a=n.mediaType===exports.RCMediaType.AUDIO_ONLY?new Cr(e._logger,i,o):new Er(e._logger,i,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[r]=a})}}},{key:"initWithRoomData",value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=Zr(e.version),this._roomResources=Wr(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(Oe.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}},{key:"assignRoomData",value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}},{key:"setResourcesByUserId",value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}},{key:"removeRemoteTrack",value:function(e){delete this._remoteTracks[e]}},{key:"removeResourcesByUserId",value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}},{key:"addRemoteTrack",value:function(e){this._remoteTracks[e.getTrackId()]=e}},{key:"removeRemoteTracks",value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach(function(e){e.isAudioTrack()&&e.__releaseMediaElement()}),this._remoteTracks={})}},{key:"setCDNEnabel",value:function(e){this._CDNEnable=e}},{key:"setCDNUris",value:function(e){this._CDNUris=e}},{key:"resetSubscribedList",value:function(e){var t;(t=this._subscribedList).splice.apply(t,[0,this._subscribedList.length].concat(v(e))),this.resetCollectSubscribeList(e)}},{key:"resetCollectSubscribeList",value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,[0,this._collectSubscribeList.length].concat(v(e)))}},{key:"setRoomStatusVersion",value:function(e){this._roomStatusVersion=Zr(e)}},{key:"setASRStatus",value:function(e){this._asrStatus=e}},{key:"setASREnable",value:function(e){this._asrEnable=e}},{key:"setSrcLanguage",value:function(e){this._srcLanguage=e}},{key:"setASRSeiUris",value:function(e){if(e.length){var t=e[0].msid.split("_")[0];this._asrSeiUris[t]=e}else this._asrSeiUris={}}},{key:"addSeiRemoteTrack",value:function(e){var t=e[0].msid.split("_"),r=t.pop(),n=t[0],i=new Er(this._logger,r,n);this.addRemoteTrack(i)}},{key:"removeSeiRemoteTrack",value:function(){if(this.getASRSeiUris().length){var e=this.getASRSeiUris()[0],t=e.msid,r=e.mediaType,n="".concat(t,"_").concat(r);this.removeRemoteTrack(n)}}},{key:"setIsStartRealTranslate",value:function(e){this._isStartRealTranslate=e}},{key:"setTranslationLang",value:function(e){this._translationLang=e}},{key:"setSummarizationStatusData",value:function(e){this._summarizationStatusData=e}},{key:"setNickName",value:function(e){this._nickName=e}}])}(),cs=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.UNPUBLISH_PREV}},{key:"execute",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c;return _().w(function(r){for(;;)switch(r.n){case 0:return n=e.logger,i=e.context,o=t.getResourcesByUserId(t.crtUserId),a=o.slice(),o.length=0,s=n.createTraceId(),n.info(Oe.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:a}),s),r.n=1,i.setRTCTotalRes(t.roomId,[Sr(Jr.UNPUBLISH,a)],yr([]),Jr.TOTAL_CONTENT_RESOURCE,yr([]));case 1:return(c=r.v)!==ke?n.error(Oe.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:Le.FAILED,code:c}),s):n.info(Oe.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:Le.SUCCESSED}),s),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r)}))}}])}();exports.RTCMode=void 0,function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL"}(exports.RTCMode||(exports.RTCMode={}));var us,ls=function(){function e(t,i,o,a,s,c,u,l,d){var _;return n(this,e),_=r(this,e),Object.defineProperty(_,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(_,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(_,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(_,"srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"nickName",{enumerable:!0,configurable:!0,writable:!0,value:d}),_}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.JOINROOM}},{key:"_getResultTag",value:function(){var e=Oe.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===exports.RTCMode.LIVE&&(e=Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}},{key:"_validateParams",value:function(e,t,r){var n=this;if(e.getConnectionStatus()!==Ie.CONNECTED)return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(qr(e.getNaviInfo()))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),this.traceId),{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR};if(!j("roomId",this.roomId,k,!0))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!j("roomType",this.roomType,function(e){return void 0!==exports.RTCMode[e]}))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!j("outerUserDatas",this.outerUserDatas,A,!1))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every(function(e){return j("outerUserDatas.".concat(e),n.outerUserDatas[e],y,!0)}))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.nickName&&(!j("nickName",this.nickName,y,!0)||this.nickName.length>64))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> nickName"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.srcLanguage&&(!j("srcLanguage",this.srcLanguage,y,!0)||this.srcLanguage.length>50))return t.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> srcLanguage"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g,R,m,v,T,C,E,I,S,y,b,O;return _().w(function(n){for(;;)switch(n.n){case 0:if(c=Date.now(),u=e.context,l=e.service,d=e.logger,f=e.reportMediaActionLogger,h=this._getResultTag(),p=this._validateParams(u,d,h),(g=p.code)===exports.RCRTCCode.SUCCESS){n.n=1;break}return n.a(2,{code:g});case 1:if(l.getMsList().length){n.n=2;break}return d.error(h,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),n.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 2:return R=t.getSupportNtf(),n.n=3,u.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,R);case 3:if(m=n.v,v=m.code,T=m.data,f.reportQualityJoinRoomData(c,v,this.roomType,null==T?void 0:T.sessionId),v===ke&&T){n.n=4;break}return C=40032===v?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:v,d.error(h,JSON.stringify({status:Le.FAILED,code:C,msg:"joinRoom failed"}),this.traceId),n.a(2,{code:C});case 4:return t.initWithRoomData(T,this.traceId),this.nickName&&t.setNickName(this.nickName),this.srcLanguage&&t.setSrcLanguage(this.srcLanguage),t.getResourcesByUserId(t.crtUserId).length>0&&r.push(new cs),(E=null===(i=T.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value)&&t.setCDNUris(JSON.parse(E)[0]),(I=null===(o=T.roomInfo.filter(function(e){return"asr_status"===e.key})[0])||void 0===o?void 0:o.value)&&t.setASRStatus(I),(S=null===(a=T.roomInfo.filter(function(e){return"sei_ai_uris"===e.key})[0])||void 0===a?void 0:a.value)&&(y=JSON.parse(S)).length&&(t.setASRSeiUris(y),t.addSeiRemoteTrack(y)),(b=null===(s=T.roomInfo.filter(function(e){return"summarization"===e.key})[0])||void 0===s?void 0:s.value)&&(O=JSON.parse(b),t.setSummarizationStatusData(O)),d.info(h,JSON.stringify({status:Le.SUCCESSED,userId:t.crtUserId,roomId:this.roomId,sessionId:T.sessionId}),this.traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS,data:T})}},n,this)}))}}])}();!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(us||(us={}));var ds,_s,fs,hs="PEER_CONNECTION_CLOSED_BY_EXCEPTION",ps="USER_JOIN",gs="USER_LEAVE",Rs="TRACKS_PUBLISH",ms="TRACKS_UNPUBLISH",vs="AUDIO_MUTE_CHANGE",Ts="VIDEO_MUTE_CHANGE",Cs="CDN_ENABLE_CHANGE",Es="USER_STATE_CHANGE",Is="ASR_SEI_PUBLISH",Ss="ASR_SEI_UNPUBLISH",ys="SUMMARIZATION_START",bs="SUMMARIZATION_STOP",Os=function(){function e(t,i,o,a,s,c,u,l){var d;return n(this,e),d=r(this,e),Object.defineProperty(d,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(d,"service",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(d,"context",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(d,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(d,"peer",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(d,"store",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(d,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(d,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(d,"getPushOtherRooms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),d}return l(e,F),o(e)}();!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(ds||(ds={})),function(e){e.BEGIN="begin",e.END="end"}(_s||(_s={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(fs||(fs={}));var Ls,ks=function(){function e(t,i,o){var a;return n(this,e),a=r(this,e),Object.defineProperty(a,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return l(e,ns),o(e,[{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d,f,h;return _().w(function(r){for(;;)switch(r.n){case 0:return i=e.service,o=e.context,r.n=1,i.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas);case 1:return a=r.v,s=a.code,c=a.data,u=a.qualityMsList,l={code:s,data:{data:c,qualityMsList:u}},d=null===(n=null==c?void 0:c.urls)||void 0===n?void 0:n.pull_url,t.roomMode===exports.RTCMode.LIVE&&d&&(f=JSON.parse(d),t.setCDNUris(f),(null==f?void 0:f.broadcast)===fs.SPREAD&&(t.setCDNEnabel(!0),h=Object.assign(Object.assign({},f),{enableInnerCDN:!0}),Us(o,t.roomId,h))),r.a(2,l)}},r,this)}))}}])}();!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(Ls||(Ls={}));var As=function(){function e(t,i,o){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ls.SUB,c=arguments.length>4?arguments[4]:void 0;return n(this,e),a=r(this,e),Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(a,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(a,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(a,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),a}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.UPDATE_SUBSCRIBE_LIST}},{key:"_dealSubscribeResult",value:function(e,t,r,n){var i=null==n?void 0:n.map(function(e){return"".concat(e.msid,"_").concat(e.mediaType)}),o=r.filter(function(e){return null==i?void 0:i.includes(e.track.getTrackId())}),a=r.filter(function(e){return!(null==i?void 0:i.includes(e.track.getTrackId()))});t.info(Oe.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,subSuccessTrackIds:i,failedList:a}),this.traceId);var s=e.getRemoteTracks(),c=function(e){var t=o.some(function(t){return t.track.getTrackId()===e});s[e].__innerSetSubscribed(t);var r=o.some(function(t){return t.track.getTrackId()===e&&t.subTiny});s[e].isVideoTrack()&&s[e].__innerSetIsTinyTrack(r)};for(var u in s)c(u);return e.resetSubscribedList(o),a}},{key:"_getParams",value:function(e,t,r){var n=this,i=r.map(function(e){return e instanceof Tr?{track:e}:Object.assign({},e)}),o={};return i=i.filter(function(r){var i=r.track.getTrackId();return e.getRemoteTrack(i)?!o[i]&&(o[i]=!0,!0):(t.warn(Oe.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(i),n.traceId),!1)}).map(function(e){return Object.assign({},e)})}},{key:"_validateParams",value:function(e,t){return j("tracks",t,function(){return L(t)&&t.every(function(e){return e instanceof Tr||e.track instanceof Tr})},!0)?{code:exports.RCRTCCode.SUCCESS}:(e.warn(Oe.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}},{key:"_reportPubOrSubQualityData",value:function(e,t,r){(null==r?void 0:r.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,r,t,this._trackMediaMap)}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g,R,m,v,T,C,E,I,S,y,b,O=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.peer,a=e.reportMediaActionLogger,s=e.context,this._actionStartTime=Date.now(),c=this.tracks,u=this.forceReq,l=t.roomId,i.info(Oe.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(l,", forceReq: ").concat(u,", trackIds: ").concat(c.map(Qr)),this.traceId),d=this._validateParams(i,c),(f=d.code)===exports.RCRTCCode.SUCCESS){n.n=1;break}return n.a(2,{code:f});case 1:if(h=this._getParams(t,i,c),p=t.getSubscribedList().map(function(e){return Object.assign({},e)}),u){n.n=3;break}if(Ws(h,p)){n.n=2;break}return i.warn(Oe.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:p.length&&(g=p.map(function(e){return e.track}),i.warn(Oe.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:g.map(function(e){return e.getTrackId()})}),this.traceId),R=t.getSubscribedList().filter(function(e){return g.every(function(t){return t.getTrackId()!==e.track.getTrackId()})}),t.resetSubscribedList(R));case 3:return o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),o.updateSubRemoteTracks(h.map(function(e){return e.track})),n.n=4,Ps(h,!1,o,t,s);case 4:return(m=n.v).pushOtherRooms=e.getPushOtherRooms(),n.n=5,new ks(m,this.traceId,!0).execute(e,t,r);case 5:if(v=n.v,c.forEach(function(e){var t=e instanceof Tr?e.getTrackId():e.track.getTrackId();O._trackMediaMap[t]=v.data.qualityMsList||[]}),T=this.fromCommand===Ls.SUB?c:this.unsubTracks,v.code===exports.RCRTCCode.SUCCESS){n.n=6;break}return this._reportPubOrSubQualityData(a,v.code,T),i.error(Oe.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:v.code}),this.traceId),n.a(2,{code:v.code});case 6:if(C=v.data.data,E=C.sdp,I=C.resultCode,S=C.subscribedList,I===exports.RCRTCCode.SUCCESS){n.n=7;break}return this._reportPubOrSubQualityData(a,I,T),i.error(Oe.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:Le.FAILED,code:I}),this.traceId),n.a(2,{code:I});case 7:return a.setPubOrSubSuccessTime(Date.now()),n.n=8,o.setRemoteAnswer(E.sdp);case 8:if(y=n.v,this._reportPubOrSubQualityData(a,y,T),y===exports.RCRTCCode.SUCCESS){n.n=9;break}return n.a(2,{code:y});case 9:return b=this._dealSubscribeResult(t,i,h,S),n.a(2,b.length?{code:exports.RCRTCCode.SUCCESS,data:b}:{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),Ns=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.UNSUBSCRIBE}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.polarisReport,a=this.tracks,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof Tr})},!0)){n.n=1;break}return i.warn(Oe.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return i.info(Oe.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:a.map(Qr)}),this.traceId),s=t.getSubscribedList().map(function(e){return Object.assign({},e)}).filter(function(e){return a.every(function(t){return t.getTrackId()!==e.track.getTrackId()})}),o.sendR2(ds.SUBSCRIBE,_s.END,a.map(function(e){return e.getTrackId()})),n.a(2,new As(s,!1,this.traceId,Ls.UNSUB,this.tracks).execute(e,t,r))}},n,this)}))}}])}(),ws=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),i}return l(e,ns),o(e,[{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a;return _().w(function(n){for(;;)switch(n.n){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(Oe.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),n.n=1,new Ns(o,a).execute(e,t,r);case 1:return o.forEach(function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())}),e.emit(ms,o),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}();function Ps(e,t,r,n,i){return K(this,void 0,void 0,_().m(function o(){var a,s,c,u,l,d,f;return _().w(function(o){for(;;)switch(o.n){case 0:return s=(null===(a=i.getNaviInfo())||void 0===a?void 0:a.ipType)||0,o.n=1,r.createOffer(t);case 1:return c=o.v,u=n.getSrcLanguage(),l=n.getNickName(),d={resolutionInfo:r.getOutboundVideoInfo()},u&&Object.assign(d,{srcLanguage:u}),l&&Object.assign(d,{nickName:l}),f={asr_status:n.getASRStatus(),ipType:s,sdp:c,extend:JSON.stringify(d),subscribeList:e.filter(function(e){var t=e.track.getTrackId(),r=Nr(t).userId,i=n.getResourcesByUserId(r);if(!i)return!1;var o=i.filter(function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)}).length;return o}).map(function(e){return{simulcast:e.subTiny?Ia.TINY:Ia.NORMAL,resolution:"",uri:n.getPublishedResourceByTrackId(e.track.getTrackId()).uri}}),switchstream:!1},o.a(2,f)}},o)}))}function Ds(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o;return _().w(function(n){for(;;)switch(n.n){case 0:return i=e.logger.createTraceId(),e.logger.info(Oe.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:r}),i),n.n=1,e.setRTCCDNUris(t,Jr.TOTAL_CONTENT_RESOURCE,JSON.stringify([r]));case 1:if((o=n.v)===ke){n.n=2;break}return e.logger.error(Oe.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(Le.FAILED,", code: ").concat(o),i),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e.logger.info(Oe.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(Le.SUCCESSED),i),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n)}))}function Us(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o;return _().w(function(n){for(;;)switch(n.n){case 0:return i=e.logger.createTraceId(),e.logger.info(Oe.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(r),i),n.n=1,e.setRTCData(t,"cdn_uris",JSON.stringify([r]),!0,us.ROOM);case 1:if((o=n.v)===ke){n.n=2;break}return e.logger.error(Oe.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(Le.FAILED,", code: ").concat(o),i),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e.logger.info(Oe.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(Le.SUCCESSED),i),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n)}))}function Ms(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a;return _().w(function(r){for(;;)switch(r.n){case 0:return n=t.roomId,i=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),r.n=1,Promise.all([Ds(e,n,i),Us(e,n,i)]);case 1:return o=r.v,a=o.every(function(e){return e.code===exports.RCRTCCode.SUCCESS}),r.a(2,a?{code:exports.RCRTCCode.SUCCESS}:{code:exports.RCRTCCode.SIGNAL_ERROR})}},r)}))}var xs=function(e,t,r,n){return K(void 0,void 0,void 0,_().m(function i(){var o,a,s,c,u,l;return _().w(function(i){for(;;)switch(i.n){case 0:o=e.crtUserId,u=h(n);case 1:if((l=u()).done){i.n=4;break}if((a=l.value)!==o){i.n=2;break}return i.a(3,1);case 2:if(!(s=n[a]).length){i.n=3;break}return c=s.map(function(t){return e.getRemoteTrack(Ar(t))}),i.n=3,new ws(c).execute(t,e,r);case 3:i.n=1;break;case 4:return i.a(2)}},i)}))},Bs=function(e,t,r){var n=t.logger;Object.keys(r).forEach(function(i){var o=r[i];if(0!==o.length){var a=o.map(function(t){var r=Ar(t),i=Nr(r),o=i.userId,a=i.tag,s=i.mediaType===exports.RCMediaType.AUDIO_ONLY?new Cr(n,a,o):new Er(n,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s});a.length&&t.emit(Rs,a)}})},Vs=function(e,t,r){Object.keys(r).forEach(function(n){r[n].forEach(function(r){var n=Ar(r),i=e.getRemoteTrack(n);i.__innerSetRemoteMuted(0===r.state),i.isAudioTrack()?t.emit(vs,i):t.emit(Ts,i)})})};function js(e,t,r,n,i,o){return K(this,void 0,void 0,_().m(function a(){var s,c,u,l,d,f,h,p,g,R,m,v,T,C,E,I,S,y,b;return _().w(function(a){for(;;)switch(a.n){case 0:s=r.logger,c=t.roomId,u=t.roomMode,l=[],d={},f={},h={},p=Wr(e,c,s,o),g=Object.keys(p),R=t.getAllUserIds(),m=g.length-1;case 1:if(!(m>=0)){a.n=4;break}if(v=g[m],-1!==(T=R.indexOf(v))){a.n=2;break}return l.push(v),d[v]=Pr(p[v]),a.a(3,3);case 2:C=t.getResourcesByUserId(v),E=p[v],I=Dr(C,E,!0),S=I.publishedList,y=I.modifiedList,b=I.unpublishedList,d[v]=Pr(S),f[v]=Pr(b),h[v]=Pr(y),R.splice(T,1);case 3:m-=1,a.n=1;break;case 4:if(R.length&&R.forEach(function(e){t.removeResourcesByUserId(e)}),t.assignRoomData(p),!R.length){a.n=6;break}return a.n=5,Gs(R,r,t,n,o);case 5:r.emit(gs,R);case 6:return l.length&&r.emit(ps,l),a.n=7,xs(t,r,n,f);case 7:Bs(t,r,d),Vs(t,r,h),u===J.LIVE&&Fs(r,t,s,i);case 8:return a.a(2)}},a)}))}function Fs(e,t,r,n){var i;if(n){var o=JSON.parse(n),a=(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN)!==o.enableInnerCDN;t.setCDNUris(o),a&&e.emit(Cs,o.enableInnerCDN)}else r.warn(Oe.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,code:"",msg:"cdn_uris not found"}))}function Gs(e,t,r,n,i){return K(this,void 0,void 0,_().m(function o(){var a,s;return _().w(function(o){for(;;)switch(o.n){case 0:if(a=[],s=[],e.forEach(function(e){a.push.apply(a,v(r.getRemoteTracksByUserId(e))),s.push(e)}),!a.length){o.n=2;break}return o.n=1,new Ns(a,i).execute(t,r,n);case 1:a.forEach(function(e){return r.removeRemoteTrack(e.getTrackId())});case 2:s.length&&s.forEach(function(e){return r.removeResourcesByUserId(e)});case 3:return o.a(2)}},o)}))}function Js(e){var t,r=e.userId,n=e.userData,i=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=n.filter(function(e){return"extra"===e.key})[0])||void 0===t?void 0:t.value,state:i,switchRoleType:o}]}}function Hs(e){var t,r,n=e.userId,i=e.userData,o=function(e){return e.some(function(e){return"uris"===e.key||"cdn_uris"===e.key})}(i);if(o){var a=null===(t=i.filter(function(e){return"uris"===e.key})[0])||void 0===t?void 0:t.value,s=null===(r=i.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===r?void 0:r.value;return{userId:n,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}function Ks(e){var t={users:{}},r="";return e.forEach(function(e){var n,i,o=e.userId,a=e.userData;t.users[o]={};var s=null===(n=a.filter(function(e){return"uris"===e.key})[0])||void 0===n?void 0:n.value,c=null===(i=a.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value;r=c||r,t.users[o]={uris:s}}),{urisData:t,CDNUris:r&&JSON.stringify(JSON.parse(r)[0])}}var qs,Ys=function(e,t,r){var n=e.split("\r\nm"),i=r===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=n.filter(function(e){return e.includes("=".concat(i))&&e.includes(t)})[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},Ws=function(e,t){var r=!1;return e.forEach(function(e){var n=t.findIndex(function(t){return t.track.getTrackId()===e.track.getTrackId()});-1!==n?t.splice(n,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0}),t.length&&(r=!0),r},zs=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.PARSE_USERSTATE}},{key:"priority",get:function(){return $a.NORMAL}},{key:"_isPKRoomUser",value:function(e,t){var r,n=a(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i.extra&&i.extra.roomId!==e.roomId)return!0;if(1===Number(i.state)&&!e.getRemoteUserIds().includes(i.userId))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"_dealAddUser",value:function(e,t,r,n,i){var o=e.getResourcesByUserId(i);o||(n?r.upgrade.push(i):r.joined.push(i),t.info(Oe.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(n?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(i,o||[])}},{key:"_dealReduceUser",value:function(e,t,r,n,i){e.info(Oe.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user ".concat(n?"downgrade":"left")}),this.traceId),n?t.downgrade.push(i):1!==Number(r)?t.offline.push(i):t.left.push(i)}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o={joined:[],left:[],offline:[],upgrade:[],downgrade:[]},0!==(a=this.msgContent.users).length){n.n=1;break}return n.a(2,{code:exports.RCRTCCode.SUCCESS,data:o});case 1:if(!this._isPKRoomUser(t,a)){n.n=2;break}return n.a(2,{code:exports.RCRTCCode.SUCCESS,data:o});case 2:if(a.forEach(function(e){var r=e.userId;0===Number(e.state)?c._dealAddUser(t,i,o,e.switchRoleType,r):c._dealReduceUser(i,o,e.state,e.switchRoleType,r)}),!(s=[].concat(v(o.left),v(o.downgrade),v(o.offline))).length){n.n=3;break}return n.n=3,Gs(s,e,t,r,this.traceId);case 3:return n.a(2,{code:exports.RCRTCCode.SUCCESS,data:o})}},n,this)}))}}])}(),Qs=function(){function e(t,i,o,a,s){var c;return n(this,e),c=r(this,e),Object.defineProperty(c,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(c,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(c,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),c}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.PARSE_REMOTERES}},{key:"priority",get:function(){return $a.NORMAL}},{key:"_dealPublishList",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.reportMediaActionLogger,a=this._nowResources.map(Ar),s=[],c=[],this._publishedList.forEach(function(e){var r=Ar(e),n=a.indexOf(r),o=Nr(r),u=o.userId,l=o.tag,d=o.mediaType;n>-1?f._nowResources[n]=e:f._nowResources.push(e);var _=t.getRemoteTrack(r);_?_.isSubscribed()&&s.push(_):(_=d===exports.RCMediaType.AUDIO_ONLY?new Cr(i,l,u):new Er(i,l,u),t.addRemoteTrack(_),c.push(_)),_.__innerSetRemoteMuted(0===e.state)}),!s.length){n.n=2;break}return u=s.map(function(e){return e.getTrackId()}),n.n=1,new As(s,!0,this.traceId).execute(e,t,r);case 1:l=n.v,(d=l.code)!==exports.RCRTCCode.SUCCESS&&i.error(Oe.L_RESUB_REPUB_RES_R,JSON.stringify({status:Le.FAILED,trackIds:u,code:d}),this.traceId);case 2:c.length&&e.emit(Rs,c),o.reportQualityRecvPubMsgData(this.sentTime,this.senderId);case 3:return n.a(2)}},n,this)}))}},{key:"_dealUnpublishList",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s;return _().w(function(n){for(;;)switch(n.n){case 0:for(i=this._unpublishedList.map(Ar),o=this._nowResources.length-1;o>=0;o-=1)a=this._nowResources[o],i.includes(Ar(a))&&this._nowResources.splice(o,1);return s=this._unpublishedList.map(function(e){var r=Ar(e);return t.getRemoteTrack(r)}),n.n=1,new ws(s).execute(e,t,r);case 1:return n.a(2)}},n,this)}))}},{key:"_dealModifiedList",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,s,c,u,l;return _().w(function(r){for(;;)switch(r.n){case 0:n=this._nowResources.map(Ar),i=a(this._modifiedList);try{for(i.s();!(o=i.n()).done;)s=o.value,c=Ar(s),u=n.indexOf(c),this._nowResources[u].state=s.state,(l=t.getRemoteTrack(c)).__innerSetRemoteMuted(0===s.state),l.isAudioTrack()?e.emit(vs,l):e.emit(Ts,l)}catch(e){i.e(e)}finally{i.f()}case 1:return r.a(2)}},r,this)}))}},{key:"_updateCDNUris",value:function(e,t){var r,n,i=this.msgContent.cdn_uris[0],o=(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN)!==i.enableInnerCDN;t.setCDNUris(i),o&&e.emit(Cs,!!(null===(n=t.getCDNUris())||void 0===n?void 0:n.enableInnerCDN))}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p;return _().w(function(n){for(;;)switch(n.n){case 0:if(l=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],f=this.senderId,h=this.messageType,t.getRemoteUserIds().includes(f)){n.n=1;break}return n.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:this._nowResources=t.getResourcesByUserId(f)||[],p=h,n.n=p===Jr.MODIFY?2:p===Jr.PUBLISH?3:p===Jr.UNPUBLISH?4:p===Jr.TOTAL_CONTENT_RESOURCE?5:6;break;case 2:return(i=this._modifiedList).push.apply(i,v(l)),n.a(3,6);case 3:return(o=this._publishedList).push.apply(o,v(l)),n.a(3,6);case 4:return(a=this._unpublishedList).push.apply(a,v(l)),n.a(3,6);case 5:return d=Dr(this._nowResources,l),(s=this._publishedList).push.apply(s,v(d.publishedList)),(c=this._unpublishedList).push.apply(c,v(d.unpublishedList)),(u=this._modifiedList).push.apply(u,v(d.modifiedList)),n.a(3,6);case 6:if(!this._publishedList.length){n.n=7;break}return n.n=7,this._dealPublishList(e,t,r);case 7:if(!this._unpublishedList.length){n.n=8;break}return n.n=8,this._dealUnpublishList(e,t,r);case 8:if(!this._modifiedList.length){n.n=9;break}return n.n=9,this._dealModifiedList(e,t);case 9:if(t.setResourcesByUserId(f,this._nowResources),t.roomMode===exports.RTCMode.LIVE){n.n=10;break}return n.a(2,{code:exports.RCRTCCode.SUCCESS});case 10:if(this.msgContent.cdn_uris){n.n=11;break}return n.a(2,{code:exports.RCRTCCode.SUCCESS});case 11:return this._updateCDNUris(e,t),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),Zs=function(){function e(t,i,o){var a;return n(this,e),a=r(this,e),Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.SUBSCRIBE}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.polarisReport,a=this.tracks,s=this.forceReq,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof Tr||e.track instanceof Tr})},!0)){n.n=1;break}return i.error(Oe.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(i.info(Oe.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:a.map(Qr),forceReq:s}),this.traceId),c=t.getSubscribedList().map(function(e){return Object.assign({},e)}),u=a.map(function(e){return e instanceof Tr?{track:e}:e}),l=!1,d=[],u.forEach(function(e){var t=e.track.getTrackId();d.push(t);var r=c.find(function(e){return e.track.getTrackId()===t});r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:c.push(e),l=!0)}),l||s){n.n=2;break}return i.warn(Oe.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,msg:"repeat subscribe"}),this.traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return o.sendR2(ds.SUBSCRIBE,_s.BEGIN,d),n.a(2,new As(c,!0,this.traceId).execute(e,t,r))}},n,this)}))}}])}(),Xs=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(i,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),i}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.PUBLISH}},{key:"_removePubFailedTracks",value:function(e,t){e.forEach(function(e){var r=e instanceof ur?e:e.track;t.removeLocalTrackById(r.getTrackId())})}},{key:"_addLocalTracks",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,s,c,u,l,d,f,h,p,g,R,m,v,T,C;return _().w(function(r){for(;;)switch(r.p=r.n){case 0:n=[],i=a(e),r.p=1,i.s();case 2:if((o=i.n()).done){r.n=9;break}if(s=o.value,u=(c=s instanceof ur?{pubTiny:!1,track:s}:s).track,l=c.pubTiny,!u.isVideoTrack()){r.n=7;break}if(!l){r.n=7;break}return d=void 0,r.p=3,d=u.__innerGetMediaStreamTrack().clone(),f=l.frameRate||exports.RCFrameRate.FPS_15,h=l.resolution||exports.RCResolution.W176_H144,p=Mr(h),g=p.width,R=p.height,m=Vr(f),r.n=4,d.applyConstraints({width:g,height:R,frameRate:m});case 4:r.n=6;break;case 5:return r.p=5,T=r.v,null==d||d.stop(),this._logger.warn(Oe.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(u.getTrackId(),", msg: ").concat(T.message),this._traceId),r.a(3,9);case 6:v=new dr(this._logger,u.getTag(),u.getUserId(),d,!0),n.push(v),t.addLocalTrack(v),r.n=7;break;case 7:t.addLocalTrack(u);case 8:r.n=2;break;case 9:r.n=11;break;case 10:r.p=10,C=r.v,i.e(C);case 11:return r.p=11,i.f(),r.f(11);case 12:return r.a(2,n)}},r,this,[[3,5],[1,10,11,12]])}))}},{key:"__publish",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h,p,g,R,m,v=this;return _().w(function(i){for(;;)switch(i.n){case 0:if(o=e.peer,a=e.reportMediaActionLogger,s=e.context,t.roomId,c=[],r.forEach(function(e){var t=(e instanceof ur?{track:e}:e).track;c.push(t)}),r.sort(function(e,t){return(e instanceof ur?{track:e}:e).track.getBitrate().max-(t instanceof ur?{track:t}:t).track.getBitrate().max}),!(o.getLocalTracks().length+Yr(r,o)>10)){i.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(Qr),msg:"publish track limit exceeded"}),this._traceId),i.a(2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:c});case 1:return i.n=2,this._addLocalTracks(r,o);case 2:return u=i.v,o.clearReTryExchangeTimer(),l=t.getSubscribedList(),i.n=3,Ps(l,!1,o,t,s);case 3:return(d=i.v).pushOtherRooms=e.getPushOtherRooms(),i.n=4,new ks(d,this._traceId,!0).execute(e,t,n);case 4:if(f=i.v,c.forEach(function(e){var t=e.getTrackId();v._trackMediaMap[t]=f.data.qualityMsList||[]}),f.code===exports.RCRTCCode.SUCCESS){i.n=5;break}return a.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,c,f.code,this._trackMediaMap),this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,tracks:r.map(Qr),code:f.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,o),i.a(2,{code:f.code,tracks:c});case 5:if(h=f.data.data,p=h.sdp,g=h.resultCode,R=h.message,g===exports.RCRTCCode.SUCCESS){i.n=6;break}return a.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,c,g,this._trackMediaMap),this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,trackIds:r.map(Qr),code:g,msg:"exchange inner failed: ".concat(R)}),this._traceId),this._removePubFailedTracks(r,o),i.a(2,{code:g,tracks:c});case 6:return a.setPubOrSubSuccessTime(Date.now()),i.n=7,o.setRemoteAnswer(p.sdp,!0);case 7:if((m=i.v)===exports.RCRTCCode.SUCCESS){i.n=8;break}return a.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,c,m,this._trackMediaMap),this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,trackIds:r.map(Qr),code:m,msg:"set remote answer error"}),this._traceId),i.a(2,{code:m,tracks:c});case 8:return u.length&&this._updateTinyTrackIdSSRCMap(t,d.sdp.sdp,u),i.a(2,Object.assign(Object.assign({code:g},f.data),{tracks:c}))}},i,this)}))}},{key:"_updateTinyTrackIdSSRCMap",value:function(e,t,r){r.forEach(function(r){var n=Ys(t,r.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(n),r.getTrackId())})}},{key:"_dealPublishRes",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g,R,m,T,C,E,I,S,y,b,O,L,k;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=r.polarisReport,o=r.context,a=r.peer,s=r.reportMediaActionLogger,c=t.crtUserId,u=t.roomId,l="",d=t.getResourcesByUserId(c),f=v(d),h=[],p=e.tracks,e.code===exports.RCRTCCode.SUCCESS){n.n=1;break}return n.a(2,{code:e.code});case 1:return g=e.data,R=g.publishList,m=g.urls,T=g.mcuPublishList,l=null==m?void 0:m.liveUrl,R.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:a.getLocalTrack(Ar(e)).isLocalMuted()?0:1},e)}).forEach(function(e){var t=zr(e,f),r=t.isInclude,n=t.index;r?f.splice(n,1,e):f.push(e)}),C=(null==T?void 0:T.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)}))||[],h=C,E=Dr(d,f),I=E.publishedList,S=Object.assign(Object.assign({},t.getCDNUris()),{enableInnerCDN:t.getCDNEnable()}),y=S&&S.broadcast===fs.SPREAD?JSON.stringify([S]):"",b=Date.now(),n.n=2,o.setRTCTotalRes(u,[Sr(Jr.PUBLISH,I)],yr(f),Jr.TOTAL_CONTENT_RESOURCE,yr(h),y);case 2:if(O=n.v,s.reportPubOrSubQualityData(Ls.PUB,this._actionStartTime,p,O,this._trackMediaMap,[{dur:Date.now()-b,cod:O}]),O===ke){n.n=3;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:O,msg:"send publish streams notification failed"}),this._traceId),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 3:return t.setResourcesByUserId(c,f),L=I.map(function(e){return Ar(e)}),i.sendR2(ds.PUBLISH,_s.BEGIN,L),I.forEach(function(e){a.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)}),k={code:exports.RCRTCCode.SUCCESS},l&&(k.liveUrl=l),n.a(2,k)}},n,this)}))}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.peer,this._traceId=i.createTraceId(),this._logger=i,this._actionStartTime=Date.now(),a=this.tracks,j("tracks",a,function(){return L(a)&&a.length>0&&a.every(function(e){return e instanceof ur||e.track instanceof ur})},!0)){n.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._logger.info(Oe.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:a.map(Qr)})),(a=a.filter(function(e){var t=(e instanceof ur?{track:e}:e).track,r=t.isDestroyed();return r&&u._logger.warn(Oe.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),u._traceId),!r})).length){n.n=2;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),n.a(2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID});case 2:return o.__reportR3R4ToPolaris(),o.clearReTryExchangeTimer(),n.n=3,this.__publish(e,t,a,r);case 3:return s=n.v,n.n=4,this._dealPublishRes(s,t,e);case 4:return c=n.v,n.a(2,c)}},n,this)}))}}])}(),$s=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(i,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),i}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.UNPUBLISH}},{key:"__unpublish",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h,p,g,R,m,v=this;return _().w(function(i){for(;;)switch(i.n){case 0:if(o=e.peer,a=e.polarisReport,s=e.logger,c=e.reportMediaActionLogger,u=e.context,l=n.map(function(e){return e.getTrackId()}),0!==l.map(t.getPublishedResourceByTrackId.bind(t)).filter(function(e){return!!e}).length){i.n=1;break}return i.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:n});case 1:return l.forEach(function(e){return o.removeLocalTrackById(e)}),a.sendR2(ds.PUBLISH,_s.END,l),o.clearReTryExchangeTimer(),d=t.getSubscribedList(),i.n=2,Ps(d,!1,o,t,u);case 2:return f=i.v,(h=e.getPushOtherRooms()).length&&(f.pushOtherRooms=h),i.n=3,new ks(f,this._traceId,!0).execute(e,t,r);case 3:if(p=i.v,n.forEach(function(e){var t=e.getTrackId();v._trackMediaMap[t]=p.data.qualityMsList||[]}),p.code===exports.RCRTCCode.SUCCESS){i.n=4;break}return c.reportPubOrSubQualityData(Ls.UNPUB,this._actionStartTime,n,p.code,this._trackMediaMap),s.error(Oe.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:Le.FAILED,code:p.code,trackIds:n.map(Qr),msg:"exchange failed"}),this._traceId),i.a(2,{code:p.code,tracks:n});case 4:if(g=p.data.data,R=g.resultCode,m=g.message,R===exports.RCRTCCode.SUCCESS){i.n=5;break}return c.reportPubOrSubQualityData(Ls.UNPUB,this._actionStartTime,n,p.data.data.resultCode,this._trackMediaMap),s.error(Oe.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:Le.FAILED,code:R,trackIds:n.map(Qr),msg:"exchange inner failed: ".concat(m)}),this._traceId),i.a(2,{code:R,tracks:n});case 5:return i.a(2,Object.assign(Object.assign({code:p.code},p.data),{tracks:n}))}},i,this)}))}},{key:"_dealUnpublishRes",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g,R,m,T,C,E,I,S,y;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.context,o=e.logger,a=e.peer,s=e.reportMediaActionLogger,c=i.getCurrentId(),u=t.roomId,l=[],d=[],f=r.tracks,h=r.code,p=r.data,h===exports.RCRTCCode.SUCCESS){n.n=1;break}return o.error(Oe.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:h,msg:"unpublish failed"}),this._traceId),n.a(2,{code:h});case 1:if(p){n.n=2;break}return o.info(Oe.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.SUCCESSED,msg:"unpublish list is empty "})),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return g=p.mcuPublishList,R=f.map(function(e){return e.getTrackId()}),m=R.map(t.getPublishedResourceByTrackId.bind(t)).filter(function(e){return!!e}),l.push.apply(l,v(m)),T=g?g.map(function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)}):[],d=T,C=t.getResourcesByUserId(c),E=C.filter(function(e){return!l.includes(e)}),I=Date.now(),n.n=3,i.setRTCTotalRes(u,[Sr(Jr.UNPUBLISH,l)],yr(E),Jr.TOTAL_CONTENT_RESOURCE,yr(d));case 3:if(S=n.v,s.reportPubOrSubQualityData(Ls.UNPUB,this._actionStartTime,f,S,this._trackMediaMap,[{dur:Date.now()-I,cod:S}]),S===ke){n.n=4;break}return o.error(Oe.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.FAILED,code:S,msg:"send unpublish notification failed"}),this._traceId),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:return o.info(Oe.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.SUCCESSED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:R}),this._traceId),y=r.data.sdp,n.n=5,a.setRemoteAnswer(y.sdp);case 5:return t.setResourcesByUserId(c,E),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,this._actionStartTime=Date.now(),o=t.crtUserId,a=this.tracks,this._traceId=i.createTraceId(),j("tracks",a,function(){return a.every(function(e){return e.getUserId()===o&&e instanceof ur})},!0)){n.n=1;break}return i.error(Oe.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return i.info(Oe.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:a.map(Qr)})),n.n=2,this.__unpublish(e,t,r,a);case 2:return s=n.v,n.n=3,this._dealUnpublishRes(e,t,s);case 3:return c=n.v,n.a(2,c)}},n,this)}))}}])}(),ec=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),i}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.LOCAL_TRACK_MUTE}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,s,c,u,l,d,f,h,g,R,m,v,T,C;return _().w(function(r){for(;;)switch(r.p=r.n){case 0:n=e.logger,i=e.context,o=this.localTrack,s=o.getTrackId(),c=t.crtUserId,u=t.roomId,l=!o.isLocalMuted(),d=n.createTraceId(),n.info(Oe.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:l,trackId:this.localTrack.getTrackId()}),d),f=[{resourceId:s,enabled:l}],h=t.getResourcesByUserId(c),g=[],R=a(h),r.p=1,v=_().m(function e(){var t,r,n,i;return _().w(function(e){for(;;)switch(e.n){case 0:if(t=m.value,r=Ar(t),n=f.findIndex(function(e){return e.resourceId===r}),!(n>=0)){e.n=1;break}return i=f[n].enabled,t.state=i?1:0,g.push(t),e.a(2,1);case 1:return e.a(2)}},e)}),R.s();case 2:if((m=R.n()).done){r.n=5;break}return r.d(p(v()),3);case 3:if(!r.v){r.n=4;break}return r.a(3,5);case 4:r.n=2;break;case 5:r.n=7;break;case 6:r.p=6,C=r.v,R.e(C);case 7:return r.p=7,R.f(),r.f(7);case 8:return r.n=9,i.setRTCTotalRes(u,[Sr(Jr.MODIFY,g)],yr(h),Jr.TOTAL_CONTENT_RESOURCE);case 9:if((T=r.v)===ke){r.n=10;break}return n.error(Oe.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:Le.FAILED,code:T,msg:"signal error"}),d),r.a(2,{code:T});case 10:return n.info(Oe.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:Le.SUCCESSED}),d),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this,[[1,6,7,8]])}))}}])}(),tc=function(){function e(){return n(this,e),r(this,e,arguments)}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.RETRY_EXCHANGE}},{key:"priority",get:function(){return $a.HIGH}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g,R,m,v,T;return _().w(function(n){for(;;)switch(n.n){case 0:return i=e.logger,o=e.peer,a=e.context,s=i.createTraceId(),i.info(Oe.L_RETRY_EXCHANGE_COMMAND_T),c=a.getCurrentId(),u=t.getSubscribedList(),n.n=1,Ps(u,!0,o,t,a);case 1:return(l=n.v).pushOtherRooms=e.getPushOtherRooms(),n.n=2,new ks(l,s).execute(e,t,r);case 2:if((d=n.v).code===exports.RCRTCCode.SUCCESS){n.n=3;break}return n.a(2,{code:d.code});case 3:if(f=d.data.data,h=f.sdp,(p=f.resultCode)===exports.RCRTCCode.SUCCESS){n.n=4;break}return n.a(2,{code:p});case 4:return o.clearReTryExchangeTimer(),n.n=5,o.setRemoteAnswer(h.sdp);case 5:if((g=n.v)===exports.RCRTCCode.SUCCESS){n.n=6;break}return n.a(2,{code:g});case 6:if(R=d.data.data.publishList||[],m=this._diffPublishListChange(R,t,o,c),v=m.plus,T=m.minus,!v.length&&!T.length){n.n=7;break}return n.n=7,this._spreadPublishListUri(e,c,v,T,s);case 7:return n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"_diffPublishListChange",value:function(e,t,r,n){var i=t.getResourcesByUserId(n),o=JSON.parse(JSON.stringify(i));e.forEach(function(e){var t,n=e.mediaType,i=e.msid,a=o.findIndex(function(e){var t=e.mediaType,r=e.msid;return n===t&&i===r});if(-1===a){var s=Object.assign({tag:i.split("_").pop(),state:(null===(t=r.getLocalTrack(Ar(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(s)}else o[a].uri=e.uri});var a=Dr(i,o,!0),s=a.publishedList,c=a.unpublishedList;return t.setResourcesByUserId(n,o),{plus:s,minus:c}}},{key:"_spreadPublishListUri",value:function(e,t,r,n,i){return K(this,void 0,void 0,_().m(function o(){var a,s,c,u;return _().w(function(o){for(;;)switch(o.n){case 0:return a=e.store,s=e.logger,c=a.getResourcesByUserId(t),s.info(Oe.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:r,minus:n,allPublishList:c}),i),u=[],n.length&&u.push(Sr(Jr.UNPUBLISH,n)),r.length&&u.push(Sr(Jr.PUBLISH,r)),o.n=1,e.context.setRTCTotalRes(a.roomId,u,yr(c),Jr.TOTAL_CONTENT_RESOURCE);case 1:o.v===ke?s.info(Oe.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(Le.SUCCESSED),i):s.error(Oe.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(Le.FAILED),i);case 2:return o.a(2)}},o)}))}}])}();!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(qs||(qs={}));var rc,nc,ic=function(){function e(t,i,o,a){var s;return n(this,e),s=r(this,e),Object.defineProperty(s,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_context",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.PULL_RTCROOM_STATUS}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,s,c,u,l,d,f,h,p,g,R,m,v,T,C,E,I,S,y,b,O;return _().w(function(n){for(;;)switch(n.p=n.n){case 0:if(i=e.logger,o=t.getRoomStatusVersion(),i.info(Oe.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:o}),this._traceId),!(this._targetPullVersion&&this._targetPullVersion<=o)){n.n=1;break}return i.info(Oe.L_PULL_ROOM_STATUS_R,JSON.stringify({status:Le.SUCCESSED,msg:"the roomData has been pulled",localVersion:o,targetPullVersion:this._targetPullVersion}),this._traceId),n.a(2,{code:ke});case 1:return n.n=2,this._context.pullRTCRoomStatus(this._roomId,o);case 2:if(s=n.v,c=s.code,u=s.data,c===ke){n.n=3;break}return i.info(Oe.L_PULL_ROOM_STATUS_R,JSON.stringify({status:Le.FAILED,code:c}),this._traceId),n.a(2,{code:c});case 3:if(l=u.bFullStatus,d=u.version,f=u.usersData,h=u.roomStatus,i.info(Oe.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:l,version:Zr(d),usersData:f,roomStatus:h}),this._traceId),t.setRoomStatusVersion(d),!l){n.n=5;break}return p=Ks(f),g=p.urisData,R=p.CDNUris,n.n=4,js(g,t,e,r,R,this._traceId);case 4:return n.a(2,{code:c});case 5:m=a(h),n.p=6,m.s();case 7:if((v=m.n()).done){n.n=14;break}if((T=v.value).event!==qs.RESOURCECHANGE){n.n=11;break}if(C=Hs(T)){n.n=8;break}return n.a(3,13);case 8:if(E=C.content,(I=C.userId)!==t.crtUserId){n.n=9;break}return n.a(3,13);case 9:return n.n=10,new Qs(E,Jr.TOTAL_CONTENT_RESOURCE,I,this._traceId).execute(e,t,r);case 10:n.n=13;break;case 11:return S=Js(T),n.n=12,new zs(S,this._traceId).execute(e,t,r);case 12:y=n.v,b=y.data,e.emit(Es,b);case 13:n.n=7;break;case 14:n.n=16;break;case 15:n.p=15,O=n.v,m.e(O);case 16:return n.p=16,m.f(),n.f(16);case 17:return n.a(2,{code:c})}},n,this,[[6,15,16,17]])}))}}])}(),oc=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),i}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.ON_SIGNAL_RECONNECTED}},{key:"priority",get:function(){return $a.HIGH}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.peer,a=e.context,s=t.roomId,c=t.roomMode,u=i.createTraceId(),i.info(Oe.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,u),"closed"!==o.getRTCPeerConn().connectionState){n.n=1;break}return i.error(Oe.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",u),e.emit(hs),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return n.n=2,a.rtcPing(s,c);case 2:if(l=n.v,40001!==l.code){n.n=5;break}return n.n=3,this._joinRoom(e,t,r,u);case 3:if(n.v!==ke){n.n=4;break}return n.n=4,this._restoreMediaServer(e,t,r);case 4:n.n=6;break;case 5:return n.n=6,new ic(s,u,a).execute(e,t,r);case 6:return n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"_joinRoom",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h,p,g,R,m,v,T,C,E,I,S,y,b;return _().w(function(i){for(;;)switch(i.n){case 0:return u=e.context,l=e.logger,i.n=1,u.joinRTCRoom(t.roomId,t.roomMode,this.livingType);case 1:if(d=i.v,f=d.code,h=d.data,f===ke){i.n=2;break}return l.error(Oe.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,code:f,msg:"im reconnect joinRTCRoom failed"}),n),i.a(2);case 2:if(h){i.n=3;break}return l.info(Oe.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),n),i.a(2);case 3:return p=null===(o=h.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===o?void 0:o.value,i.n=4,js(h,t,e,r,p,n);case 4:return(g=null===(a=h.roomInfo.filter(function(e){return"asr_status"===e.key})[0])||void 0===a?void 0:a.value)&&t.setASRStatus(g),R=null===(s=h.roomInfo.filter(function(e){return"sei_ai_uris"===e.key})[0])||void 0===s?void 0:s.value,m=t.getASRIsAvailable(),R&&((v=JSON.parse(R)).length?(m||e.emit(Is),t.setASRSeiUris(v),T=v[0],C=T.msid,E=T.mediaType,I="".concat(C,"_").concat(E),!t.getRemoteTrack(I)&&t.addSeiRemoteTrack(v)):(m&&e.emit(Ss),t.removeSeiRemoteTrack(),t.setASRSeiUris(v))),(S=null===(c=h.roomInfo.filter(function(e){return"summarization"===e.key})[0])||void 0===c?void 0:c.value)&&(y=JSON.parse(S),(b=t.getSummarizationStatusData())&&b.status!==y.status&&e.emit(y.status===exports.RCRTCOperateSummarizationType.OPEN?ys:bs,y.taskId),t.setSummarizationStatusData(y)),l.info(Oe.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:Le.SUCCESSED,roomData:h}),n),i.a(2,f)}},i,this)}))}},{key:"_restoreMediaServer",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.peer.getLocalTracks(),o=Object.values(t.getRemoteTracks()).filter(function(e){return!!e.isSubscribed()}),!i.length){n.n=1;break}return n.n=1,new Xs(i).execute(e,t,r);case 1:if(i.length||!o.length){n.n=2;break}return n.n=2,new Zs(o,!0).execute(e,t,r);case 2:return n.a(2)}},n)}))}}])}(),ac=1,sc=5;!function(e){e[e.new=0]="new",e[e.checking=1]="checking",e[e.connected=2]="connected",e[e.completed=3]="completed",e[e.failed=4]="failed",e[e.disconnected=5]="disconnected",e[e.closed=6]="closed"}(rc||(rc={})),exports.RCKickReason=void 0,(nc=exports.RCKickReason||(exports.RCKickReason={}))[nc.SERVER_KICK=1]="SERVER_KICK",nc[nc.OTHER_KICK=2]="OTHER_KICK",nc[nc.IM_DISCONNECTED=3]="IM_DISCONNECTED",nc[nc.IM_LOGOUT=4]="IM_LOGOUT",nc[nc.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED";var cc,uc,lc,dc,_c=function(){return o(function e(t,r,i,o){var a=this;n(this,e),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_baseReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_networkReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pubOrSubSuccessTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_peerCStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reportQualityJoinRoomData",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t,r,n){a._baseReportData=Object.assign(a._baseReportData,{snid:n});var i=Object.assign(Object.assign(Object.assign({},a._baseReportData),a._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});a._logger.__statistics(Oe.L_QS_JOIN_ROOM_S,JSON.stringify(i))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}},[{key:"reportQualityKickedData",value:function(e){var t=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?sc:ac});this._logger.__statistics(Oe.L_QS_KICKED_S,JSON.stringify(t))}},{key:"reportPubOrSubQualityData",value:function(e,t,r,n,i,o){var a=this;r.forEach(function(r){var s,c,u=r instanceof ur||r instanceof Tr?r:r.track,l=u.getTrackId(),d=Nr(l).mediaType,_=!1;_=u instanceof ur?!!u.isVideoTrack()&&(null===(c=(s=u).__isTiny)||void 0===c?void 0:c.call(s)):r.subTiny||!1;var f=Object.assign(Object.assign(Object.assign({},a._baseReportData),a._networkReportData),{resid:l,mtp:d,smct:_?Ia.TINY:Ia.NORMAL,stp:"Rongcloud"!==u.getTag()?1:0,cod:n,msas:i?i[l]:[],sigs:o,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":a._logger.__statistics(Oe.L_QS_PUBLISH_S,JSON.stringify(f));break;case"unpub":a._logger.__statistics(Oe.L_QS_UNPUBLISH_S,JSON.stringify(f));break;case"sub":a._logger.__statistics(Oe.L_QS_SUBSCRIBE_S,JSON.stringify(f));break;case"unsub":a._logger.__statistics(Oe.L_QS_UNSUBSCRIBE_S,JSON.stringify(f))}})}},{key:"reportQualityRecvPubMsgData",value:function(e,t){var r=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(Oe.L_QS_RECV_PUB_MSG_S,JSON.stringify(r))}},{key:"setPubOrSubSuccessTime",value:function(e){this._pubOrSubSuccessTime=e}},{key:"reportIceFirstConnectData",value:function(e){var t=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?Oe.L_QS_PUB_ICE_STATUS_S:Oe.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(r,JSON.stringify(t))}},{key:"recordQualityIceStatusData",value:function(e,t,r){var n=this._peerCStatus||{},i=n.status,o=n.time;if(o){var a=e.IP,s=e.port,c=e.networkType,u=e.remoteIP,l=e.remotePort,d=Object.assign(Object.assign(Object.assign({},this._baseReportData),this._networkReportData),{dur:r-o,time:r,pices:rc[i],ices:rc[t],rcdts:[{ip:"".concat(u,":").concat(l)}],lcdts:[{ip:"".concat(a,":").concat(s),nttp:c}],cncdts:[]});this._logger.__statistics(Oe.L_QS_ICE_STATUS_S,JSON.stringify(d)),this._peerCStatus={status:t,time:r}}else this._peerCStatus={status:t,time:r}}}])}();!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(cc||(cc={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(uc||(uc={})),function(e){e[e.NOT_REPORT=-1]="NOT_REPORT",e[e.REPORT_SUCCESS=1e4]="REPORT_SUCCESS",e[e.REPORT_FAIL=0]="REPORT_FAIL",e[e.PB_ERROR=40001]="PB_ERROR"}(lc||(lc={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(dc||(dc={}));var fc,hc=function(){return o(function e(t,r,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:uc.MeetingOrAnchor;n(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:a})},[{key:"_send",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)switch(t.n){case 0:if(this._context.getConnectionStatus()===Ie.CONNECTED){t.n=1;break}return t.a(2,lc.NOT_REPORT);case 1:return t.n=2,this._context.setRTCState(this._roomId,e);case 2:if(t.v!==ke){t.n=3;break}return t.a(2,lc.REPORT_SUCCESS);case 3:return t.a(2,lc.REPORT_FAIL)}},t,this)}))}},{key:"_getClientID",value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=Ur(),this._runtime.localStorage.setItem(e,t)),t}},{key:"_getRealResourceId",value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}},{key:"_getPolarisTrackId",value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var n=r.pop(),i=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n,i].join("_")}else{var a=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",s=r.pop();t=[r.join("_"),s,a].join("_")}return t}},{key:"_getBaseData",value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||ha,bitrateRecv:(null==e?void 0:e.bitrateRecv)||ha,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||ha,localAddress:"".concat((null==e?void 0:e.IP)||ha,":").concat(null==e?void 0:e.port),remoteAddress:"".concat(null==e?void 0:e.remoteIP,":").concat(null==e?void 0:e.remotePort),receiveBand:(null==e?void 0:e.availableIncomingBitrate)||ha,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||ha,packetsLost:(null==e?void 0:e.totalPacketsLost)||ha,deviceId:this._context.getCurrentId()}}},{key:"_getAudioLevel",value:function(e){return e||0===e?e:ha}},{key:"_getBitrate",value:function(e){return e||0===e?e:ha}},{key:"_getPacketsLostRate",value:function(e){return e||0===e?e:ha}},{key:"_getFrameRate",value:function(e){return e||ha}},{key:"_getResolution",value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(ha)}},{key:"_getJitter",value:function(e){return e||ha}},{key:"_getNackCount",value:function(e){return e||0===e?e:ha}},{key:"_getPliCount",value:function(e){return e||0===e?e:ha}},{key:"_getRTT",value:function(e){return e||ha}},{key:"_getTrackState",value:function(e,t){var r=e?this._crtRTCRoom.getLocalTrack(t):this._crtRTCRoom.getRemoteTrack(t);return(null==r?void 0:r.isLocalMuted())?cc.DISABLE:cc.ENABLE}},{key:"sendR3Data",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s=this;return _().w(function(t){for(;;)switch(t.n){case 0:return r=e.iceCandidatePair,n=e.senders,i=this._getBaseData(r),o="R3\t".concat(i.bitrateSend,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),a=n.map(function(e){var t=e.trackId,r=e.audioLevel,n=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,a=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,f=e.pliCount,h=e.rtt,p=e.googFirsSent,g=e.encoderImplementation,R=s._getPolarisTrackId(t),m=s._getRealResourceId(t);return{trackId:R,googCodecName:g||String(ha),audioLevel:s._getAudioLevel(r),bitrate:s._getBitrate(i),packetsLostRate:s._getPacketsLostRate(o),frameRate:s._getFrameRate(a),resolution:s._getResolution(c,u),jitter:s._getJitter(d),nackCount:s._getNackCount(_),pliCount:s._getPliCount(f),rtt:s._getRTT(h),googFirsSent:p,samplingRate:n,googRenderDelayMs:l,encoderImplementation:g||String(ha),trackState:s._getTrackState(!0,m)}}),o+=a.map(function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)}).join("\n"),t.n=1,this._send("".concat(o,"\r").concat(this._userRole));case 1:if(t.v===lc.REPORT_SUCCESS){t.n=2;break}return t.a(2,lc.REPORT_FAIL);case 2:return t.a(2,lc.REPORT_SUCCESS)}},t,this)}))}},{key:"sendR4Data",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s=this;return _().w(function(t){for(;;)switch(t.n){case 0:return r=e.iceCandidatePair,n=e.receivers,i=this._getBaseData(r),o="R4\t".concat(i.bitrateRecv,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),a=n.filter(function(e){return!!e.trackId}).map(function(e){var t=e.trackId,r=e.audioLevel,n=e.samplingRate,i=e.bitrate,o=e.packetsLostRate,a=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,f=e.pliCount,h=e.rtt,p=e.googFirsReceived,g=e.codecImplementationName,R=s._getPolarisTrackId(t),m=s._getRealResourceId(t);return{trackId:R,googCodecName:g||String(ha),audioLevel:s._getAudioLevel(r),bitrate:s._getBitrate(i),packetsLostRate:s._getPacketsLostRate(o),frameRate:s._getFrameRate(a),resolution:s._getResolution(c,u),jitter:s._getJitter(d),nackCount:s._getNackCount(_),pliCount:s._getPliCount(f),rtt:s._getRTT(h),googFirsReceived:p,samplingRate:n,googRenderDelayMs:l,codecImplementationName:g||String(ha),trackState:s._getTrackState(!1,m)}}),o+=a.map(function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)}).join("\n"),t.n=1,this._send("".concat(o,"\r").concat(this._userRole));case 1:if(t.v===lc.REPORT_SUCCESS){t.n=2;break}return t.a(2,lc.REPORT_FAIL);case 2:return t.a(2,lc.REPORT_SUCCESS)}},t,this)}))}},{key:"sendR1",value:function(){var e,t=this._context.getCoreVersion(),r=(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platformn)||navigator.platform,n=jr.browser,i=jr.version,o=this._getClientID(),a="R1\t".concat("5.36.1-nctest-alpha.3","\t").concat(t,"\t").concat("web","\t").concat(r,"\t").concat(-1,"\t").concat(n,"\t").concat(i,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}},{key:"sendR2",value:function(e,t,r){var n=this._getClientID(),i="R2\t".concat(e,"\t").concat(t,"\t").concat(n,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(i)}}])}(),pc=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"oldTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"newTrack",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.peer,o=e.logger,this.oldTrack&&this.newTrack){n.n=1;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack or newTrack is empty"),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(![Rr,gr].every(function(e){return!(g.oldTrack instanceof e)})){n.n=2;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(![Rr,gr].every(function(e){return!(g.newTrack instanceof e)})){n.n=3;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"newTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(a=this.oldTrack.getSettings(),s=this.newTrack.getSettings(),c=this.oldTrack.getTrackId(),u=this.newTrack.getTrackId(),l=this.oldTrack.isAudioTrack()?"audio":"video",d=this.newTrack.isAudioTrack()?"audio":"video",o.info(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T,JSON.stringify({oldTrackId:c,newTrackId:u,oldSettings:a,newSettings:s})),this.oldTrack.isPublished()){n.n=4;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not published"),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(c===u){n.n=5;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack trackId are different, oldTrackId: ".concat(c,", newTrackId: ").concat(u)),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:if(l===d){n.n=6;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack are not the same kind, oldTrackKind: ".concat(l,", newTrackKind: ").concat(d)),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 6:if((null==a?void 0:a.deviceId)!==(null==s?void 0:s.deviceId)){n.n=7;break}return o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack deviceId are the same, oldDeviceId: ".concat(null==a?void 0:a.deviceId,", newDeviceId: ").concat(null==s?void 0:s.deviceId)),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 7:if(i.addLocalTrack(this.newTrack),f=(null==a?void 0:a.width)!==(null==s?void 0:s.width)||(null==a?void 0:a.height)!==(null==s?void 0:s.height)||(null==a?void 0:a.frameRate)!==(null==s?void 0:s.frameRate),h=i.getLocalTrack("".concat(this.oldTrack.getTrackId(),"_tiny")),f){n.n=8;break}return h&&h.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 8:return n.n=9,(new tc).execute(e,t,r);case 9:if((p=n.v).code===exports.RCRTCCode.SUCCESS){n.n=10;break}return i.removeLocalTrack(this.newTrack,!1),i.addLocalTrack(this.oldTrack),this.newTrack.destroy(),o.error(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"negotiation failed, code: ".concat(p.code)),n.a(2,{code:p.code});case 10:return h&&h.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(Oe.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),n.a(2,{code:p.code})}},n,this)}))}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(fc||(fc={}));var gc,Rc=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return l(e,ns),o(e,[{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d,f;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=e.logger,i=e.context,o=e.service,this._traceId=n.createTraceId(),this._logger=n,this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T,"type: ".concat(this._type),this._traceId),(null==(a=i.getNaviInfo())?void 0:a.rtcAISwitch)!==fc.CLOSE){r.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(this._type!==t.getASRStatus()){r.n=2;break}return this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return s=t.roomId,r.n=3,i.setRTCData(s,"asr_status",this._type.toString(),!0,us.ROOM,{name:Jr.ASR_STATUS,content:JSON.stringify({asr_status:this._type.toString()})});case 3:if((c=r.v)===ke){r.n=4;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:c}),this._traceId),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:return t.setASRStatus(this._type),r.n=5,o.updateASRStatus(t.getRTCRequestHeader(),{asr_status:this._type},this._traceId);case 5:if(u=r.v,l=u.code,d=u.data,l===exports.RCRTCCode.SUCCESS&&((null==d?void 0:d.resultCode)===exports.RCRTCCode.SUCCESS||42200===(null==d?void 0:d.resultCode))){r.n=6;break}return f=l!==exports.RCRTCCode.SUCCESS?l:null==d?void 0:d.resultCode,this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:f}),this._traceId),r.a(2,{code:f});case 6:return this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),mc=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"_enable",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return l(e,ns),o(e,[{key:"_updateSubSei",value:function(e,t,r,n){var i="".concat(e[0].msid,"_").concat(e[0].mediaType),o=r.getRemoteTrack(i);return this._enable?new Zs([o]).execute(t,r,n):new Ns([o],this._traceId).execute(t,r,n)}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.context,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(Oe.L_ABSTRACT_ROOM_SET_ENABLE_ASR_T,"enable: ".concat(this._enable),this._traceId),t.setASREnable(this._enable),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)!==fc.CLOSE){n.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),n.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if((s=t.getASRSeiUris()).length){n.n=2;break}return this._logger.info(Oe.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS,asrSeiUrisLength:0}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return n.n=3,this._updateSubSei(s,e,t,r);case 3:if(c=n.v,(u=c.code)===exports.RCRTCCode.SUCCESS){n.n=4;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:u}),this._traceId),n.a(2,{code:u});case 4:return this._logger.info(Oe.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(gc||(gc={}));var vc,Tc,Cc,Ec,Ic=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_destLanguage",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o}return l(e,ns),o(e,[{key:"_operateWithRetry",value:function(e,t){return K(this,arguments,void 0,function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3e3;return _().m(function o(){var a,s,c,u;return _().w(function(o){for(;;)switch(o.p=o.n){case 0:a=1;case 1:if(!(a<=n)){o.n=8;break}return o.p=2,o.n=3,t.operateRealtimeTranslation(e.getRTCRequestHeader(),{status:r._status},r._traceId);case 3:if(s=o.v,c=s.code,s.data,c!==exports.RCRTCCode.SUCCESS){o.n=4;break}return o.a(2);case 4:console.warn("第 ".concat(a," 次调用失败,code=").concat(c)),o.n=6;break;case 5:o.p=5,u=o.v,console.error("第 ".concat(a," 次调用异常:"),u);case 6:if(!(a<n)){o.n=7;break}return o.n=7,new Promise(function(e){setTimeout(e,i)});case 7:a++,o.n=1;break;case 8:return o.a(2)}},o,null,[[2,5]])})()})}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=e.logger,i=e.service,o=e.context,this._traceId=n.createTraceId(),this._logger=n,this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_T,JSON.stringify({status:this._status,destLanguage:this._destLanguage}),this._traceId),(null==(a=o.getNaviInfo())?void 0:a.rtcAISwitch)!==fc.CLOSE){r.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(this._status!==gc.OPEN){r.n=3;break}if(this._destLanguage){r.n=2;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.PARAMS_ERROR}),this._traceId),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(t.getASRSeiUris().length){r.n=3;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_START});case 3:return s={status:this._status},this._destLanguage&&(s.destLanguage=this._destLanguage),r.n=4,i.operateRealtimeTranslation(t.getRTCRequestHeader(),s,this._traceId);case 4:if(c=r.v,u=c.code,l=c.data,this._status!==gc.CLOSE){r.n=5;break}return t.setIsStartRealTranslate(!1),this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),u!==exports.RCRTCCode.SUCCESS&&this._operateWithRetry(t,i),r.a(2,{code:exports.RCRTCCode.SUCCESS});case 5:if(u===exports.RCRTCCode.SUCCESS&&(null==l?void 0:l.resultCode)===exports.RCRTCCode.SUCCESS){r.n=6;break}return d=u!==exports.RCRTCCode.SUCCESS?u:null==l?void 0:l.resultCode,this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:d}),this._traceId),r.a(2,{code:d});case 6:return t.setIsStartRealTranslate(!0),this._destLanguage&&t.setTranslationLang(this._destLanguage),this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}}])}(),Sc=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),i}return l(e,ns),o(e,[{key:"execute",value:function(e,t){return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)if(0===e.n)return t.setASRStatus(this._type),e.a(2,{code:exports.RCRTCCode.SUCCESS})},e,this)}))}}])}(),yc=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:t}),i}return l(e,ns),o(e,[{key:"_setEnableAsr",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i;return _().w(function(n){for(;;)switch(n.n){case 0:if(!(i=t.getASREnable())){n.n=2;break}return n.n=1,new mc(this._asrSeiUris.length>0).execute(e,t,r);case 1:t.setASREnable(i);case 2:return n.a(2)}},n,this)}))}},{key:"_onPublish",value:function(e,t,r){e.emit(Is),t.setASRSeiUris(this._asrSeiUris),t.addSeiRemoteTrack(this._asrSeiUris),this._setEnableAsr(e,t,r)}},{key:"_onUnPublish",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){return _().w(function(n){for(;;)switch(n.n){case 0:return e.emit(Ss),n.n=1,this._setEnableAsr(e,t,r);case 1:t.removeSeiRemoteTrack(),t.setASRSeiUris(this._asrSeiUris);case 2:return n.a(2)}},n,this)}))}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){return _().w(function(n){for(;;)if(0===n.n)return this._asrSeiUris.length?this._onPublish(e,t,r):this._onUnPublish(e,t,r),n.a(2,{code:exports.RCRTCCode.SUCCESS})},n,this)}))}}])}(),bc=function(){function e(t){var i;return n(this,e),i=r(this,e),Object.defineProperty(i,"_isStart",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return l(e,ns),o(e,[{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d,f;return _().w(function(r){for(;;)switch(r.n){case 0:if(o=e.logger,a=e.context,s=e.service,this._traceId=o.createTraceId(),this._logger=o,this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T,"isStart: ".concat(this._isStart),this._traceId),(null==(c=a.getNaviInfo())?void 0:c.rtcAISwitch)!==fc.CLOSE){r.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE});case 1:if(t.getASRSeiUris().length){r.n=2;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),r.a(2,{code:exports.RCRTCCode.ASR_NOT_START});case 2:if(!((null===(n=t.getSummarizationStatusData())||void 0===n?void 0:n.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._isStart||(null===(i=t.getSummarizationStatusData())||void 0===i?void 0:i.status)===exports.RCRTCOperateSummarizationType.CLOSE&&!this._isStart)){r.n=3;break}return this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId});case 3:return u={status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE},r.n=4,s.operateSummarization(t.getRTCRequestHeader(),u,this._traceId);case 4:if(l=r.v,d=l.code,f=l.data,d===exports.RCRTCCode.SUCCESS){r.n=5;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:d}),this._traceId),r.a(2,{code:d});case 5:return t.setSummarizationStatusData({taskId:f.taskId,status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE}),this._logger.info(Oe.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:null==f?void 0:f.taskId}),this._traceId),r.a(2,{code:exports.RCRTCCode.SUCCESS,taskId:null==f?void 0:f.taskId})}},r,this)}))}}])}(),Oc=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"_taskId",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"execute",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){return _().w(function(r){for(;;)if(0===r.n)return t.setSummarizationStatusData({status:this._status,taskId:this._taskId}),e.emit(this._status===exports.RCRTCOperateSummarizationType.OPEN?ys:bs,this._taskId),r.a(2,{code:exports.RCRTCCode.SUCCESS})},r,this)}))}}])}(),Lc="evt-leave",kc=function(){function e(t,i,o,a,s,c,u,l){var d,f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:ga(),h=arguments.length>9&&void 0!==arguments[9]&&arguments[9];n(this,e),d=r(this,e),Object.defineProperty(d,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(d,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(d,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(d,"_service",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(d,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(d,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(d,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(d,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(d,"_onRecvPKMsg",{enumerable:!0,configurable:!0,writable:!0,value:null});var p=d._logger=d._context.logger;d._reportMediaActionLogger=new _c(p,d._roomId,d._clientSessionId,d._context.getCurrentId()),d._polarisReport=new hc(d._context,d._runtime,d._roomId,d);var g=d._context.getCurrentId(),R=new ss(p,f,d._context.getAppkey(),o,g,a,u,l),m=d._peerConnection=new Qa(t,p,d._reTryExchange.bind(d),g,R,d._polarisReport,!1,h);d._setPeerConnectionListener();var v=d._executeCtx=new Os(p,d._service,t,i,m,R,d._polarisReport,d._reportMediaActionLogger);return v.getPushOtherRooms=function(){return d._getPushOtherRoomsParams()},d.setCommandEventListener(),d._invoker=new os(v,R),d._store=d._invoker.store,d._audioLevelReport=new ts(d._store,m),m.on(Qa.__INNER_AUDIOLEVEL_CHANGE__,d._audioLevelReport.audioLevelReport,d._audioLevelReport),d._pinger=new $r(d._context,d._roomId,a,d._initOptions.pingGap),d._pinger.onFailed=d.__kickoff.bind(d),d._pinger.onPingResult=d._handlePingResult.bind(d),d._context.registerRTCSignalListener(function(e){return K(d,void 0,void 0,_().m(function t(){var r,n,i,o,a;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=this._context.decodeRtcNotify(e),n=r.time,i=r.type,o=r.roomId,!this._invoker.isDestroyed()){t.n=1;break}return this._logger.info(Oe.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:n,roomId:o})),t.a(2);case 1:2===i&&o===this._roomId&&(a=this._logger.createTraceId(),this._logger.info(Oe.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,n));case 2:return t.a(2)}},t,this)}))}),d}return l(e,F),o(e,[{key:"_setPeerConnectionListener",value:function(){var e=this,t=this._peerConnection;t.on(Qa.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(ur.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(ur.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Qa.__INNER_ICE_CONNECTED__,function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")},this),t.on(Qa.__INNER_ICE_STATE_CHANGE__,function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}),t.on(Qa.__INNER_SEI_CONTENT__,this._onReceiveAsrSeiContent,this)}},{key:"setCommandEventListener",value:function(){var e=this._executeCtx;e.on(hs,this._rtcpeerClosed,this),e.on(ps,this._callAppListener.bind(this,"onUserJoin"),this),e.on(gs,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Rs,this._onTrackPublish,this),e.on(ms,this._onTrackUnpublish,this),e.on(vs,this._onAudioMuteChange,this),e.on(Ts,this._onVideoMuteChange,this),e.on(Cs,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on(Es,this._dealUserAppListener,this),e.on(Is,this._callAppListener.bind(this,"onReceiveStartASR"),this),e.on(Ss,this._callAppListener.bind(this,"onReceiveStopASR"),this),e.on(ys,this._callAppListener.bind(this,"onReceiveStartSummarization"),this),e.on(bs,this._callAppListener.bind(this,"onReceiveStopSummarization"),this)}},{key:"_startPullRTCRoomStatus",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){return _().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._invoker.push(new ic(e,t,this._context,r));case 1:return n.a(2)}},n,this)}))}},{key:"__innerInit",value:function(e,t,r,n,i,o,a,s){return K(this,void 0,void 0,_().m(function c(){var u,l,d;return _().w(function(c){for(;;)switch(c.n){case 0:return c.n=1,this._invoker.push(new ls(this._roomId,e,t,r,n,i,o,a,s));case 1:if(u=c.v,l=u.code,d=u.data,l===exports.RCRTCCode.SUCCESS){c.n=2;break}return c.a(2,{code:l});case 2:return this._initWithRoomData(d.offlineKickTime),c.a(2,{code:l,data:d})}},c,this)}))}},{key:"_initWithRoomData",value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}},{key:"_handlePingResult",value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var r=this._logger.createTraceId();this._logger.info(Oe.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),r),this._startPullRTCRoomStatus(this._roomId,r,t)}this._callAppListener("onPing",e)}},{key:"setBitrate",value:function(e,t,r){this._logger.warn(Oe.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),V("max",e,function(e){return O(e)&&e>Math.max(t||1,200)},!0),V("min",t,function(t){return O(t)&&t>=1&&(!O(e)||t<e)},!0),V("start",r,function(r){return O(r)&&r>t&&r<=e}),this._peerConnection.setBitrate(e,t,r)}},{key:"_onTrackReady",value:function(e){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),i=this._store.getRemoteTrack(n);i?(i.__innerSetMediaStreamTrack(r),this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackReady",trackId:i.getTrackId()})),this._callAppListener("onTrackReady",i)):this._logger.warn(Oe.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}},{key:"_callAppListener",value:function(e){var t,r=null===(t=this._appListener)||void 0===t?void 0:t[e];if(r)try{for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r.apply(void 0,i)}catch(e){this._logger.error(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}},{key:"_onTrackUnpublish",value:function(e){this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map(function(e){return e.getTrackId()})})),this._callAppListener("onTrackUnpublish",e)}},{key:"__parseInnerMessage",value:function(e,t){var r=e.targetId;if(r===this._roomId){this._logger.info(Oe.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var n=e.content;switch(e.messageType){case Jr.KICK:this.__kickoff(!0,n);break;case Jr.STATE:this._stateHandle(n,t);break;case Jr.MODIFY:case Jr.PUBLISH:case Jr.UNPUBLISH:case Jr.TOTAL_CONTENT_RESOURCE:this._resourceHandle(n,e.messageType,e.senderUserId,e.sentTime,t);break;case Jr.ASR_STATUS:this._invoker.push(new Sc(n.asr_status));break;case Jr.ASR_SEI:this._invoker.push(new yc(JSON.parse(n.sei_ai_uris||[])));break;case Jr.SUMMARIZATION_STATUS:this._invoker.push(new Oc(n.status,n.taskId));break;case Jr.ROOM_NOTIFY:this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case Jr.USER_NOTIFY:this._logger.warn(Oe.L_OLD_DAILY_RECORD_O,"TODO: ".concat(Jr.USER_NOTIFY));break;case Jr.PK_INVITE:case Jr.PK_CANCEL_INVITE:case Jr.PK_INVITE_TIMEOUT:case Jr.PK_INVITE_ANSWER:case Jr.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case Jr.OTHER_ROOM_OFFLINE:break;default:this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,n,e.senderUserId,e.messageUId)}}else this._logger.warn(Oe.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:Le.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}},{key:"__kickoff",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o=this;return _().w(function(r){for(;;)switch(r.n){case 0:if(!this._invoker.isDestroyed()){r.n=1;break}return r.a(2);case 1:this._logger.warn(Oe.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(Lc),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach(function(e){e.userId===o._context.getCurrentId()&&(i=e.type,n=e.kickExtra,o._reportMediaActionLogger.reportQualityKickedData(i))}),this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:i,kickExtra:n})),this._callAppListener("onKickOff",e,i,n);case 2:return r.a(2)}},r,this)}))}},{key:"_rtcpeerClosed",value:function(){this.emit(Lc),this._leaveHandle(!0),this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}},{key:"_onReceiveAsrSeiContent",value:function(e){var t=this;e.forEach(function(e){"destLangCode"in e?t._store.getIsStartRealTranslate()&&t._store.getTranslationLang()===e.destLangCode&&t._callAppListener("onReceiveRealtimeTranslationContent",e):t._callAppListener("onReceiveASRContent",e)})}},{key:"_resourceHandle",value:function(e,t,r,n,i){return K(this,void 0,void 0,_().m(function o(){var a;return _().w(function(o){for(;;)switch(o.n){case 0:if(a=e.uris,!e.ignore&&a){o.n=1;break}return o.a(2);case 1:this._invoker.push(new Qs(e,t,r,i,n));case 2:return o.a(2)}},o,this)}))}},{key:"_onTrackPublish",value:function(e,t,r){this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map(function(e){return e.getTrackId()})})),this._callAppListener("onTrackPublish",e)}},{key:"_stateHandle",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i;return _().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._invoker.push(new zs(e,t));case 1:n=r.v,i=n.data,this._dealUserAppListener(i);case 2:return r.a(2)}},r,this)}))}},{key:"_dealUserAppListener",value:function(e){var t,r,n=this,i=e.left,o=e.joined,a=e.upgrade,s=e.downgrade,c=e.offline,u=v(o),l=v(i);(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)?(null==a||a.forEach(function(e){n._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.ANCHOR})),n._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.ANCHOR)}),null==s||s.forEach(function(e){n._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.AUDIENCE})),n._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.AUDIENCE)})):(u.push.apply(u,v(a)),l.push.apply(l,v(s))),c.length&&((null===(r=this._appListener)||void 0===r?void 0:r.onUserOffline)?(this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserOffline",offline:c})),this._callAppListener("onUserOffline",c)):l.push.apply(l,v(c))),u.length>0&&(this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserJoin",allJoined:u})),this._callAppListener("onUserJoin",u)),l.length>0&&(this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onUserLeave",allLeft:l})),this._callAppListener("onUserLeave",l))}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"getRemoteUserIds",value:function(){return this._store.getRemoteUserIds()}},{key:"getRemoteTracks",value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach(function(r){t.push.apply(t,v(e.getRemoteTracksByUserId(r)))}),t}},{key:"getRemoteTracksByUserId",value:function(e){return this._store.getRemoteTracksByUserId(e)}},{key:"getSessionId",value:function(){return this._store.getSessionId()}},{key:"sendMessage",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o;return _().w(function(r){for(;;)switch(r.n){case 0:return n=this._logger.createTraceId(),this._logger.info(Oe.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:e,content:t}),n),r.n=1,this._context.sendMessage(Ee.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});case 1:if(i=r.v,(o=i.code)===ke){r.n=2;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:Le.FAILED,code:o}),n),r.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return this._logger.info(Oe.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:Le.SUCCESSED,name:e,content:t}),n),r.a(2,{code:exports.RCRTCCode.SUCCESS})}},r,this)}))}},{key:"setRoomAttribute",value:function(e,t,r){return K(this,arguments,void 0,function(e,t,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _().m(function o(){var a,s;return _().w(function(o){for(;;)switch(o.n){case 0:return a=n._logger.createTraceId(),n._logger.info(Oe.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:n._roomId,key:e,value:t,message:r,isInner:i}),a),o.n=1,n._context.setRTCData(n._roomId,e,t,i,us.ROOM,r);case 1:if((s=o.v)===ke){o.n=2;break}return n._logger.error(Oe.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.FAILED,code:s}),a),o.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return n._logger.info(Oe.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,roomId:n._roomId,key:e,value:t,message:r,isInner:i}),a),o.a(2,{code:exports.RCRTCCode.SUCCESS})}},o)})()})}},{key:"deleteRoomAttributes",value:function(e,t){return K(this,arguments,void 0,function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _().m(function i(){var o,a;return _().w(function(i){for(;;)switch(i.n){case 0:return o=r._logger.createTraceId(),r._logger.info(Oe.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:r._roomId,keys:e,message:t,isInner:n}),o),i.n=1,r._context.removeRTCData(r._roomId,e,n,us.ROOM,t);case 1:if((a=i.v)===ke){i.n=2;break}return r._logger.error(Oe.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.FAILED,code:a}),o),i.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return r._logger.info(Oe.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,roomId:r._roomId,keys:e,message:t,isInner:n}),o),i.a(2,{code:exports.RCRTCCode.SUCCESS})}},i)})()})}},{key:"getRoomAttributes",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return _().m(function n(){var i,o,a,s;return _().w(function(n){for(;;)switch(n.n){case 0:return i=e._logger.createTraceId(),e._logger.info(Oe.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:e._roomId,keys:t,isInner:r}),i),n.n=1,e._context.getRTCData(e._roomId,t,r,us.ROOM);case 1:if(o=n.v,a=o.code,s=o.data,a===ke){n.n=2;break}return e._logger.error(Oe.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(a),i),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:return e._logger.info(Oe.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:Le.SUCCESSED,data:s}),i),n.a(2,{code:exports.RCRTCCode.SUCCESS,data:s})}},n)})()})}},{key:"_setUserAttributeValue",value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,us.PERSON,r)}},{key:"_deleteUserAttributes",value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,us.PERSON,t)}},{key:"_getUserAttributes",value:function(e){return this._context.getRTCData(this._roomId,e,!1,us.PERSON)}},{key:"isDestroyed",value:function(){return this._invoker.isDestroyed()}},{key:"__destroy",value:function(e){return this._leaveHandle(e)}},{key:"_muteRemoteTracksBeforeQuit",value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach(function(e){return e.mute()})}},{key:"_leaveHandle",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)switch(t.n){case 0:if(!this._invoker.isDestroyed()){t.n=1;break}return t.a(2);case 1:if(this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),!e){t.n=2;break}return t.n=2,this._context.quitRTCRoom(this._roomId);case 2:if(!this._store.isMainRoom){t.n=3;break}return t.n=3,this._quitAllPKRoom();case 3:return this._pinger.stop(),t.n=4,this._service.exit(this._store.getRTCRequestHeader());case 4:this._releasePCManager();case 5:return t.a(2)}},t,this)}))}},{key:"_releasePCManager",value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}},{key:"_onLocalTrackDestroied",value:function(e){e instanceof dr&&e.__isTiny()||this.unpublish([e])}},{key:"_onLocalTrackMuted",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i;return _().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this._invoker.push(new ec(e));case 1:n=r.v,i=n.code,t(i);case 2:return r.a(2)}},r,this)}))}},{key:"publish",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Xs(e)))},t,this)}))}},{key:"_getPushOtherRoomsParams",value:function(){return[]}},{key:"_reTryExchange",value:function(){return this._invoker.push(new tc)}},{key:"unpublish",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new $s(e)))},t,this)}))}},{key:"_isValidResourceId",value:function(e){var t,r=Nr(e).userId;return!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find(function(t){return Ar(t)===e}))}},{key:"subscribe",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Zs(e,void 0,void 0)))},t,this)}))}},{key:"unsubscribe",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r;return _().w(function(t){for(;;)if(0===t.n)return r=this._logger.createTraceId(),this._logger.info(Oe.L_APP_CALL_UNSUBSCRIBE_O,void 0,r),t.a(2,this._invoker.push(new Ns(e,r)))},t,this)}))}},{key:"updateSubList",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new As(e,!0,this._logger.createTraceId())))},t,this)}))}},{key:"getLocalTrack",value:function(e){return this._peerConnection.getLocalTrack(e)}},{key:"getLocalTracks",value:function(){return this._peerConnection.getLocalTracks()}},{key:"getRemoteTrack",value:function(e){return this._store.getRemoteTrack(e)||null}},{key:"subscribedTracks",get:function(){return this._store.getSubscribedList().slice()}},{key:"registerRoomEventListener",value:function(e){this._logger.info(Oe.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e,this.asrIsAvailable()&&this._executeCtx.emit(Is);var t=this.getSummarizationStatusData();t&&(null==t?void 0:t.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._executeCtx.emit(ys,t.taskId)}},{key:"registerReportListener",value:function(e){this._logger.info(Oe.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}},{key:"onAudioLevelChange",value:function(e,t){this._logger.info(Oe.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}},{key:"__onReconnected",value:function(e){this._invoker.push(new oc(e))}},{key:"_onAudioMuteChange",value:function(e){this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}},{key:"_onVideoMuteChange",value:function(e){this._logger.info(Oe.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:Le.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}},{key:"_registerPKMsgListener",value:function(e){this._onRecvPKMsg=e}},{key:"_quitAllPKRoom",value:function(){return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)if(0===e.n)return e.a(2)},e)}))}},{key:"getClientSessionId",value:function(){return this._store.clientSessionId}},{key:"changeMediaDevice",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){return _().w(function(r){for(;;)if(0===r.n)return r.a(2,this._invoker.push(new pc(e,t)))},r,this)}))}},{key:"startASR",value:function(){return this._invoker.push(new Rc(rs.OPEN))}},{key:"stopASR",value:function(){return this._invoker.push(new Rc(rs.CLOSE))}},{key:"asrIsAvailable",value:function(){return this._store.getASRIsAvailable()}},{key:"setEnableASR",value:function(e){return this._invoker.push(new mc(e))}},{key:"startRealtimeTranslation",value:function(e){return this._invoker.push(new Ic(gc.OPEN,e))}},{key:"stopRealtimeTranslation",value:function(){return this._invoker.push(new Ic(gc.CLOSE))}},{key:"startSummarization",value:function(){return this._invoker.push(new bc(!0))}},{key:"stopSummarization",value:function(){return this._invoker.push(new bc(!1))}},{key:"getSummarizationStatusData",value:function(){return this._store.getSummarizationStatusData()}}])}(),Ac=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.MCUCONFIG_FLUSH}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d,f,h;return _().w(function(r){for(;;)switch(r.n){case 0:return s=e.context,c=e.service,u={"App-Key":s.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:s.getCurrentId(),SessionId:t.getSessionId()},r.n=1,c.setMcuConfig(u,this.data);case 1:if(l=r.v,d=l.code,f=l.res,d===exports.RCRTCCode.SUCCESS){r.n=2;break}return r.a(2,{code:d});case 2:return f.pull_url&&t.setCDNUris(JSON.parse(f.pull_url)),h=this.cdnValues,d===exports.RCRTCCode.SUCCESS&&((null===(i=null===(n=h.output)||void 0===n?void 0:n.video.normal)||void 0===i?void 0:i.width)||(null===(a=null===(o=h.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&Ms(s,t),r.a(2,{code:d,data:f})}},r,this)}))}}])}();exports.BackgroundPictureFillMode=void 0,(vc=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[vc.CROP=1]="CROP",vc[vc.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(Tc=exports.MixLayoutMode||(exports.MixLayoutMode={}))[Tc.CUSTOMIZE=1]="CUSTOMIZE",Tc[Tc.SUSPENSION=2]="SUSPENSION",Tc[Tc.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(Cc=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[Cc.CROP=1]="CROP",Cc[Cc.WHOLE=2]="WHOLE",function(e){e[e.AUDIO_VIDEO_ALL=0]="AUDIO_VIDEO_ALL",e[e.AUDIO_VIDEO_NO=1]="AUDIO_VIDEO_NO",e[e.AUDIO_ALL_VIDEO_NO=2]="AUDIO_ALL_VIDEO_NO",e[e.AUDIO_NO_VIDEO_ALL=3]="AUDIO_NO_VIDEO_ALL",e[e.AUDIO_VIDEO_INPUT=4]="AUDIO_VIDEO_INPUT",e[e.AUDIO_ALL_VIDEO_INPUT=5]="AUDIO_ALL_VIDEO_INPUT",e[e.AUDIO_NO_VIDEO_INPUT=6]="AUDIO_NO_VIDEO_INPUT",e[e.AUDIO_INPUT_VIDEO_ALL=7]="AUDIO_INPUT_VIDEO_ALL",e[e.AUDIO_INPUT_VIDEO_NO=8]="AUDIO_INPUT_VIDEO_NO",e[e.ROOM_AUDIO_VIDEO_APPEND=9]="ROOM_AUDIO_VIDEO_APPEND",e[e.ROOM_AUDIO_VIDEO_NOT_APPEND=10]="ROOM_AUDIO_VIDEO_NOT_APPEND",e[e.ROOM_AUDIO_APPEND=11]="ROOM_AUDIO_APPEND",e[e.ROOM_AUDIO_NOT_APPEND=12]="ROOM_AUDIO_NOT_APPEND",e[e.ROOM_VIDEO_APPEND=13]="ROOM_VIDEO_APPEND",e[e.ROOM_VIDEO_NOT_APPEND=14]="ROOM_VIDEO_NOT_APPEND"}(Ec||(Ec={}));var Nc,wc=function(){return{version:2,mode:exports.MixLayoutMode.SUSPENSION}},Pc=function(){return o(function e(t,r,i){n(this,e),Object.defineProperty(this,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_isValidTrackId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_values",{enumerable:!0,configurable:!0,writable:!0,value:wc()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._executeCtx.logger},[{key:"setHostVideoTrack",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=Nr(e),r=t.mediaType,n=t.tag,i=t.userId;return r!==exports.RCMediaType.VIDEO_ONLY?(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=wr(i,n),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,videoTrackId:e})),this)}},{key:"setMixLayoutMode",value:function(e){return[exports.MixLayoutMode.CUSTOMIZE,exports.MixLayoutMode.SUSPENSION,exports.MixLayoutMode.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:Le.SUCCESSED,mode:e})),this):(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:Le.SUCCESSED,msg:"mode: ".concat(e," is invalid")})),this)}},{key:"_addOutputValue",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal",n=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var i=n.video;if("normal"!==r&&"tiny"!==r)if("backgroundColor"!==r)if("exparams"!==r){if("backgroundPicture"===r){var o=i.backgroundPicture||(i.backgroundPicture={fillMode:exports.BackgroundPictureFillMode.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var a=i[r]||(i[r]={});Object.assign(a,t)}}else n.audio={bitrate:t};else n.cdn=t}},{key:"setOutputVideoResolution",value:function(e){if(!xr(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=Mr(e),r=t.width,n=t.height;return this._addOutputValue("video",{width:r,height:n},"normal"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.SUCCESSED,resolution:e})),this}},{key:"setOutputVideoFPS",value:function(e){if(!Br(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Vr(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:Le.SUCCESSED,fps:e})),this}},{key:"setOutputVideoBitrate",value:function(e){return!O(e)||e<=0?(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this):(this._addOutputValue("video",{bitrate:e},"normal"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this)}},{key:"setOutputTinyVideoResolution",value:function(e){if(!xr(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=Mr(e),r=t.width,n=t.height;return this._addOutputValue("video",{width:r,height:n},"tiny"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:Le.SUCCESSED,resolution:e})),this}},{key:"setOutputTinyVideoFPS",value:function(e){if(!Br(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Vr(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:Le.SUCCESSED,fps:e})),this}},{key:"setOutputTinyVideoBitrate",value:function(e){return!O(e)||e<=0?(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this):(this._addOutputValue("video",{bitrate:e},"tiny"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this)}},{key:"setOutputVideoRenderMode",value:function(e){return[exports.MixVideoRenderMode.CROP,exports.MixVideoRenderMode.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:Le.SUCCESSED,renderMode:e})),this):(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}},{key:"setOutputAudioBitrate",value:function(e){return O(e)&&e>0?(this._addOutputValue("audio",e),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:Le.SUCCESSED,bitrate:e})),this):(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> bitrate: ".concat(e)})),this)}},{key:"setOutputBackgroundColor",value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?(this._addOutputValue("video",e,"backgroundColor"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:Le.SUCCESSED,color:e})),this):(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:Le.FAILED,msg:"params error -> color: ".concat(e)})),this)}},{key:"addOutputBackgroundPicture",value:function(e,t,r,n,i){var o,a,s;if(!P(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(e)})),this;if([t,r,n,i].some(function(e){return!O(e)||e<0||e>1}))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(t,", y: ").concat(r,", w: ").concat(n,", h: ").concat(i)})),this;var c=(null===(s=null===(a=null===(o=this._values.output)||void 0===o?void 0:o.video)||void 0===a?void 0:a.backgroundPicture)||void 0===s?void 0:s.picture)||[];return c.push({uri:e,w:n,h:i,x:t,y:r}),this._addOutputValue("video",{picture:c},"backgroundPicture"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.SUCCESSED,uri:e,x:t,y:r,w:n,h:i})),this}},{key:"removeOutputBackgroundPicture",value:function(e){var t,r,n;if(!P(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(e)})),this;var i=null===(n=null===(r=null===(t=this._values.output)||void 0===t?void 0:t.video)||void 0===r?void 0:r.backgroundPicture)||void 0===n?void 0:n.picture;return i&&(i=i.filter(function(t){return t.uri!==e}),this._addOutputValue("video",{pictures:i},"backgroundPicture")),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:Le.SUCCESSED,uri:e})),this}},{key:"clearOutputBackgroundPicture",value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}},{key:"setOutputBackgroundPictureFillMode",value:function(e){return[exports.BackgroundPictureFillMode.CROP,exports.BackgroundPictureFillMode.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.SUCCESSED,fillMode:e})),this):(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}},{key:"addPublishStreamUrls",value:function(e){var t,r,n=/^rtmp:\/\/.+/;if(!L(e)||0===e.length||e.some(function(e){return!n.test(e)}))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;var i=(null===(r=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===r?void 0:r.concat())||[],o=!1;return e.forEach(function(e){i.some(function(t){return t.pushurl===e})||(o=!0,i.push({pushurl:e}))}),i.length>5?(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:Le.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(e.length)})),this):(o&&this._addOutputValue("cdn",i),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.SUCCESSED,urls:e})),this)}},{key:"removePublishStreamUrls",value:function(e){var t,r,n=/^rtmp:\/\/.+/;if(!L(e)||0===e.length||e.some(function(e){return!n.test(e)}))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.FAILED,msg:"params error -> urls: ".concat(e.join(","))})),this;for(var i=(null===(r=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===r?void 0:r.concat())||[],o=i.length-1;o>=0;o-=1){var a=i[o].pushurl,s=e.indexOf(a);s>=0&&(e.splice(s,1),i.splice(o,1))}return this._addOutputValue("cdn",i),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:Le.SUCCESSED,urls:e})),this}},{key:"clearPublishStreamUrls",value:function(){return this._addOutputValue("cdn",[]),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O),this}},{key:"addCustomizeLayoutVideo",value:function(e,t,r,n,i){if(!k(e)||!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;if(!O(t)||!O(r))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params x or y is error -> x: ".concat(t,", y: ").concat(r)})),this;if([n,i].some(function(e){return!O(e)||e<0}))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params width or height error -> width: ".concat(n,", height: ").concat(i)})),this;var o=Nr(e),a=o.userId,s=o.tag;if(o.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var c=wr(a,s),u=this._values.input||(this._values.input={}),l=u.video||(u.video=[]);return l.some(function(e){return e.height===i&&e.width===n&&e.stream_id===c&&e.user_id===a&&e.x===t&&e.y===r})?(this._logger.warn(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"Duplicate configuration item place ignored"})),this):(l.push({user_id:a,stream_id:c,x:t,y:r,width:n,height:i}),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,x:t,y:r,width:n,height:i})),this)}},{key:"removeCustomizeLayoutVideo",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=Nr(e),r=t.userId,n=t.tag;if(t.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var i=wr(r,n),o=this._values.input;return(null==o?void 0:o.video)&&o.video.length>0&&(o.video=o.video.filter(function(e){return e.stream_id===i})),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this}},{key:"clearCustomizeLayoutVideo",value:function(){var e=this._values.input;return null==e||delete e.video,this._logger.info(Oe.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O),this}},{key:"setCustomizeInputAudio",value:function(e){var t=this;return e.some(function(e){return t._isValidTrackId(e)})?(this._logger.error(Oe.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map(function(e){var t=Nr(e),r=t.userId,n=t.tag;return{stream_id:wr(r,n),user_id:r}}),this._values.inputFilterMode=Ec.AUDIO_INPUT_VIDEO_ALL,this._logger.info(Oe.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackIds:e})),this)}},{key:"addCustomizeInputAudio",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),r=t.audio||(t.audio=[]),n=Nr(e),i=n.userId,o=n.tag,a=wr(i,o);return r.some(function(e){return e.stream_id===a&&e.user_id===i})?(this._logger.warn(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(r.push({user_id:i,stream_id:a}),this._values.inputFilterMode=Ec.AUDIO_INPUT_VIDEO_ALL,this._logger.info(Oe.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this)}},{key:"removeCustomizeInputAudio",value:function(e){if(!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input;if(!(null==t?void 0:t.audio)||0===t.audio.length)return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var r=Nr(e),n=r.userId,i=r.tag,o=wr(n,i);return t.audio=t.audio.filter(function(e){return n!==e.user_id||o!==e.stream_id}),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:Le.SUCCESSED,trackId:e})),this}},{key:"clearCustomizeInputAudio",value:function(){var e=this._values.input;return(null==e?void 0:e.audio)&&delete e.audio,this._values.inputFilterMode=Ec.AUDIO_VIDEO_ALL,this._logger.info(Oe.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O),this}},{key:"addPictureWaterMark",value:function(e,t,r,n,i,o){if(!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;if(!P(t))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([r,n,i,o].some(function(e){return!O(e)||e<0||e>1})||r+i>1||n+o>1)return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(r,", y: ").concat(n,", w: ").concat(i,", h: ").concat(o)})),this;var a=Nr(e),s=a.userId,c=a.tag,u=wr(s,c),l=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,d=l.filter(function(e){return e.streamId===u})[0];return d?d.picture.push({uri:t,w:i,h:o,x:r,y:n}):l.push({streamId:u,picture:[{uri:t,w:i,h:o,x:r,y:n}]}),this._values.waterMark.singleScreen=l,this._logger.info(Oe.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,uri:t,x:r,y:n,w:i,h:o,singleScreen:l})),this}},{key:"clearPictureWaterMark",value:function(){return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen=[],this._logger.info(Oe.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}},{key:"removePictureWaterMark",value:function(e,t){if(!k(e)||!this._isValidTrackId(e))return this._logger.error(Oe.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var r=Nr(e),n=r.userId,i=r.tag,o=wr(n,i);return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen.forEach(function(e){e.streamId===o&&(e.picture=e.picture.filter(function(e){return e.uri!==t}))}),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:Le.SUCCESSED,trackId:e,uri:t})),this}},{key:"reset",value:function(){return this._values=wc(),this._logger.info(Oe.L_MCU_CONFIG_BUILDER_RESET_O),this}},{key:"flush",value:function(){return K(this,arguments,void 0,function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return _().m(function r(){var n,i,o;return _().w(function(r){for(;;)switch(r.n){case 0:return n=JSON.parse(JSON.stringify(e._values)),r.n=1,e._invoker.push(new Ac(n,e._values));case 1:return i=r.v,o=i.code,t&&(e._values=wc()),r.a(2,{code:o})}},r)})()})}},{key:"__innerGetValues",value:function(){return JSON.parse(JSON.stringify(this._values))}}])}();exports.RCLivingType=void 0,(Nc=exports.RCLivingType||(exports.RCLivingType={}))[Nc.VIDEO=0]="VIDEO",Nc[Nc.AUDIO=1]="AUDIO";var Dc,Uc=function(){function e(t,i,o){var a;return n(this,e),a=r(this,e),Object.defineProperty(a,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return l(e,ns),o(e,[{key:"_exchangeWithPushOtherRoom",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f,h,p;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.peer,a=e.context,o.getLocalTracks().length){n.n=1;break}return i.info(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.SUCCESSED,msg:"have not published resource"}),this.traceId),n.a(2);case 1:return s=o,c=t.getSubscribedList(),n.n=2,Ps(c,!1,s,t,a);case 2:return u=n.v,l=e.getPushOtherRooms(),u.pushOtherRooms=l,n.n=3,new ks(u,this.traceId,!0).execute(e,t,r);case 3:if((d=n.v).code===exports.RCRTCCode.SUCCESS){n.n=4;break}return i.error(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,code:d.code,pushOtherRooms:l}),this.traceId),n.a(2);case 4:if(f=d.data.data,h=f.sdp,(p=f.resultCode)===exports.RCRTCCode.SUCCESS){n.n=5;break}return i.error(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,code:p,pushOtherRooms:l}),this.traceId),n.a(2);case 5:i.info(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.SUCCESSED,pushOtherRooms:l}),this.traceId),s.setRemoteAnswer(h.sdp);case 6:return n.a(2)}},n,this)}))}},{key:"kind",get:function(){return Xa.EXCHANGE_WITH_PUSH_OTHER_ROOM}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=this.roomId,i.info(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_T,o),this.roomPKHandler){n.n=1;break}return i.error(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this.roomPKHandler.getPKInfo(o)){n.n=2;break}return i.warn(Oe.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:Le.FAILED,msg:"PKInfo not exist"}),this.traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 2:return n.n=3,this._exchangeWithPushOtherRoom(e,t,r);case 3:return n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),Mc=function(){function e(t,i,o,a,s,c){var u;return n(this,e),u=r(this,e),Object.defineProperty(u,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"room",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"isQuitPK",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:c}),u}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.LEAVE_OTHER_ROOM}},{key:"quitRoomPK",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h,p;return _().w(function(i){for(;;)switch(i.n){case 0:if(o=e.logger,a=e.context,o.info(Oe.L_QUIT_PK_T,"roomId: ".concat(t),n),this._PKInfo[t]){i.n=1;break}return o.warn(Oe.L_QUIT_PK_R,"status: ".concat(Le.FAILED,", msg: pkinfo is empty"),n),i.a(2);case 1:return s=this._PKInfo[t],c=s.inviterRoomId,u=s.inviteeRoomId,l=s.inviterUserId,d=s.inviteSessionId,f={inviteeRoomId:u,inviterRoomId:c,userId:r.crtUserId},h={roomId:r.roomId,endRoomId:t,sessionId:d,content:JSON.stringify(f),keys:["".concat(c,"|").concat(l)]},i.n=2,a.endRoomPK(h);case 2:if((p=i.v)===ke){i.n=3;break}return o.error(Oe.L_QUIT_PK_R,"status: ".concat(Le.FAILED,", code: ").concat(p),n),i.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 3:o.info(Oe.L_QUIT_PK_R,"status: ".concat(Le.SUCCESSED),n),delete this._PKInfo[t];case 4:return i.a(2)}},i,this)}))}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s;return _().w(function(n){for(;;)switch(n.n){case 0:return i=e.logger,o=this.room,a=this.isQuitPK,s=o.getRoomId(),i.info(Oe.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:s,isQuitPK:a}),this.traceId),n.n=1,o.__destroy(!0);case 1:return delete this._joinedPKRooms[s],n.n=2,new Uc(s,this.pkHandler,this.traceId).execute(e,t,r);case 2:return a&&this.quitRoomPK(e,s,t,this.traceId),i.info(Oe.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),this.traceId),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}}])}(),xc=function(){return o(function e(t,r,i,o,a,s,c,u,l,d){n(this,e),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_mainLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"_registerPKMsgListener",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_onJoinedPKRoom",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"_inviteTimeout",{enumerable:!0,configurable:!0,writable:!0,value:30}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mainRoomId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()},[{key:"_callAppListener",value:function(e){var t,r=null===(t=this._appListener)||void 0===t?void 0:t[e];if(r)try{for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r.apply(void 0,i)}catch(e){this._logger.error(Oe.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}},{key:"_onInvite",value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,n={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[r]=t,this._logger.info(Oe.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:n})),this._callAppListener("onRequestJoinOtherRoom",n)}},{key:"_onCancelInvite",value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,n={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[r],this._logger.info(Oe.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:n})),this._callAppListener("onCancelRequestOtherRoom",n)}},{key:"_onInviteTimeout",value:function(e){}},{key:"_onInviteAnswer",value:function(e){var t=e.answerCode,r=e.inviteContent,n=r.inviteSessionId,i=r.inviterUserId,o=r.inviterRoomId,a=r.inviteeUserId,s=r.inviterUserAutoMix,c=r.inviteeUserAutoMix,u=r.inviteeRoomId,l={agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:u,inviteeUserId:a,extra:r.extra};this._PKInfo[u]=this._PKInfo[u]||{inviteSessionId:n,inviterRoomId:o,inviterUserId:i,inviterUserAutoMix:s,inviteeRoomId:u},this._PKInfo[u].inviteeUserAutoMix=c,this._logger.info(Oe.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:l})),this._callAppListener("onResponseJoinOtherRoom",l)}},{key:"createLeaveOtherRoomCommand",value:function(e,t,r){return new Mc(this,e,this._PKInfo,this._joinedPKRooms,t,r)}},{key:"_onPKEnd",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c,u;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=e.inviteInfo,n=r.inviteeRoomId,i=r.inviterRoomId,o=r.userId,a=i===this._mainRoomId?n:i,s={endRoomId:a,endUserId:o},c=this._joinedPKRooms[a],u=this._logger.createTraceId(),this._logger.info(Oe.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,u),!c){t.n=1;break}return t.n=1,this._invoker.push(this.createLeaveOtherRoomCommand(c,!0,u));case 1:delete this._PKInfo[a],this._logger.info(Oe.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:s})),this._callAppListener("onFinishOtherRoom",s);case 2:return t.a(2)}},t,this)}))}},{key:"_onRecvPKMsg",value:function(e){var t=e.content;switch(e.messageType){case Jr.PK_INVITE:this._onInvite(t);break;case Jr.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case Jr.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case Jr.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case Jr.PK_END:this._onPKEnd(t)}}},{key:"registerRoomPKEventListener",value:function(e){this._logger.info(Oe.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}},{key:"requestJoinOtherRoom",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=this._logger.createTraceId(),this._logger.info(Oe.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,options:r}),i),j("inviteeRoomId",e,k,!0)&&j("inviteeUserId",t,k,!0)){n.n=1;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),i),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return o=ga(),a=!b(null==r?void 0:r.autoMix)||(null==r?void 0:r.autoMix),s={inviteSessionId:o,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:a,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(null==r?void 0:r.extra)||""},c={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:o},n.n=2,this._context.requestRoomPK(c);case 2:if((u=n.v)===ke){n.n=3;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:u}),i),n.a(2,{code:u});case 3:return this._PKInfo[e]={inviteSessionId:o,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:a,inviteeRoomId:e},this._logger.info(Oe.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),i),n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"cancelRequestJoinOtherRoom",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=this._logger.createTraceId(),this._logger.info(Oe.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:e,inviteeUserId:t,extra:r}),i),j("inviteeRoomId",e,k,!0)&&j("inviteeUserId",t,k,!0)){n.n=1;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),i),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._PKInfo[e]){n.n=2;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"The request to connect with ".concat(t," user in room ").concat(e," is not initiated")}),i),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return o={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:r||""},a={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(o)},n.n=3,this._context.cancelRoomPK(a);case 3:if((s=n.v)===ke){n.n=4;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:s}),i),n.a(2,{code:s});case 4:return this._logger.info(Oe.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),i),delete this._PKInfo[e],n.a(2,{code:exports.RCRTCCode.SUCCESS})}},n,this)}))}},{key:"responseJoinOtherRoom",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h,p;return _().w(function(i){for(;;)switch(i.n){case 0:if(o=this._logger.createTraceId(),this._logger.info(Oe.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:e,inviterUserId:t,agree:r,options:n}),o),j("inviterRoomId",e,k,!0)&&j("inviterUserId",t,k,!0)){i.n=1;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),o),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._PKInfo[e]){i.n=2;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"User ".concat(t," in room ").concat(e," did not send a request for connection")}),o),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return a=this._PKInfo[e],s=a.inviteSessionId,c=a.inviterUserAutoMix,u=!b(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),l={inviteSessionId:s,inviterRoomId:e,inviterUserId:t,inviterUserAutoMix:c,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:u},d=Object.assign(l,{inviterUserAutoMix:c}),f=r?Object.assign(l,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(d)}):l,!w(null==n?void 0:n.extra)&&Object.assign(f,{extra:n.extra}),h={agree:r,roomId:this._mainRoomId,inviteSessionId:s,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(f),key:"".concat(e,"|").concat(this._mainRoomId),value:JSON.stringify(l)},i.n=3,this._context.responseRoomPK(h);case 3:if((p=i.v)===ke){i.n=4;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:p}),o),i.a(2,{code:p});case 4:return this._logger.info(Oe.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),o),this._PKInfo[e].inviteeUserAutoMix=u,i.a(2,{code:exports.RCRTCCode.SUCCESS})}},i,this)}))}},{key:"joinOtherRoom",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(Oe.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:e}),r),j("roomId",e,k,!0)){t.n=1;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),r),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(this._context.getConnectionStatus()===Ie.CONNECTED){t.n=2;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),r),t.a(2,{code:exports.RCRTCCode.SIGNAL_DISCONNECTED});case 2:if(!this._joinedPKRooms[e]){t.n=3;break}return this._logger.warn(Oe.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:return n=exports.RCLivingType.VIDEO,i={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},o=new Jc(this._context,this._runtime,e,this._service,this._initOptions,n,!1,!1,this._clientSessionId),t.n=4,o.__innerInit(exports.RTCMode.LIVE,void 0,n,i);case 4:if(a=t.v,(s=a.code)===exports.RCRTCCode.SUCCESS){t.n=5;break}return this._logger.error(Oe.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.FAILED,code:s}),r),t.a(2,{code:s});case 5:return this._joinedPKRooms[e]=o,t.n=6,this._onJoinedPKRoom(e,r);case 6:return this._logger.info(Oe.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:Le.SUCCESSED}),r),t.a(2,{room:o,code:exports.RCRTCCode.SUCCESS,userIds:o.getRemoteUserIds(),tracks:o.getRemoteTracks()})}},t,this)}))}},{key:"leaveOtherRoom",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n;return _().w(function(r){for(;;)if(0===r.n)return n=this._logger.createTraceId(),this._logger.info(Oe.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,n),r.a(2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,n)))},r,this)}))}},{key:"getPKInfo",value:function(e){return this._PKInfo[e]}},{key:"getAllPKInfo",value:function(){return this._PKInfo}},{key:"getJoinedPKRooms",value:function(){return this._joinedPKRooms}}])}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(Dc||(Dc={}));var Bc,Vc=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"enable",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.ENABLE_INNER_CDN}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.logger,o=e.context,a=this.enable,i.info(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:t.roomId,enable:a})),t.isMainRoom){n.n=1;break}return i.error(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),n.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:if(b(a)){n.n=2;break}return i.error(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> enable"})),n.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t.setCDNEnabel(a),s={version:2,output:{inCDNModel:a?Dc.OPEN:Dc.STOP}},n.n=3,new Ac(s,this.cdnValues).execute(e,t,r);case 3:if(c=n.v,(u=c.code)===exports.RCRTCCode.SUCCESS){n.n=4;break}return i.error(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:u,msg:"signal error"})),n.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 4:if(!(l=t.getCDNUris())||l.broadcast===fs.SPREAD){n.n=5;break}return i.info(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.SUCCESSED,enable:a})),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 5:return n.n=6,Ms(o,t);case 6:if(d=n.v,(f=d.code)!==exports.RCRTCCode.SUCCESS){n.n=7;break}return i.info(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.SUCCESSED,enable:a})),n.a(2,{code:exports.RCRTCCode.SUCCESS});case 7:return i.error(Oe.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:Le.FAILED,code:f})),n.a(2,{code:f})}},n,this)}))}}])}();!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Bc||(Bc={}));var jc,Fc,Gc=function(){function e(t,i){var o;return n(this,e),o=r(this,e),Object.defineProperty(o,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return l(e,ns),o(e,[{key:"kind",get:function(){return Xa.RTC_IDENTITY_CHANGE}},{key:"execute",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u;return _().w(function(n){for(;;)switch(n.n){case 0:return o=e.context,n.n=1,o.rtcIdentityChange(t.roomId,Bc.ViewerToAnchor,this.livingType);case 1:if(a=n.v,s=a.code,c=a.data,s===ke&&c){n.n=2;break}return n.a(2,{code:s});case 2:return t.initWithRoomData(c,this.traceId),t.getResourcesByUserId(t.crtUserId).length>0&&r.push(new cs),(u=null===(i=c.roomInfo.filter(function(e){return"cdn_uris"===e.key})[0])||void 0===i?void 0:i.value)&&t.setCDNUris(JSON.parse(u)[0]),n.a(2,{code:s,data:c})}},n,this)}))}}])}(),Jc=function(){function e(t,i,o,a,s,c,u,l,d){var _;return n(this,e),_=r(this,e,[t,i,o,exports.RTCMode.LIVE,a,s,u,l,d]),Object.defineProperty(_,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(_,"_mcuConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),_._mcuConfigBuilder=new Pc(_._executeCtx,_._invoker,_._isValidResourceId.bind(_)),_}return l(e,kc),o(e,[{key:"_initRoomPKHandler",value:function(t){if(this._store.isMainRoom){var r=(n=this._roomId,i=t.roomInfo,o={},i.forEach(function(e){var t=JSON.parse(e.value),r=t.inviterRoomId,i=t.inviteeRoomId;o[n===r?i:r]=JSON.parse(e.value)}),o);this._roomPKHandler=new xc(this._invoker,r,this._context,this._runtime,this._service,this._initOptions,this,m(e,"_registerPKMsgListener",this,1).bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var n,i,o}},{key:"__innerInit",value:function(t,r,n,i,o,a){var s=this,c=Object.create(null,{__innerInit:{get:function(){return m(e,"__innerInit",s,1)}}});return K(this,void 0,void 0,_().m(function e(){var s,u,l;return _().w(function(e){for(;;)switch(e.n){case 0:if(j("livingType",n,function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO})){e.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType"}),a),e.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return e.n=2,c.__innerInit.call(this,t,r,n,i,o,a);case 2:return s=e.v,u=s.code,l=s.data,u===exports.RCRTCCode.SUCCESS&&l&&this._initRoomPKHandler(l),e.a(2,{code:u,data:l})}},e,this)}))}},{key:"__innerInitByIdentityChange",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i;return _().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._invoker.push(new Gc(this._livingType,e));case 1:return r=t.v,n=r.code,i=r.data,n===ke&&i?(this._initRoomPKHandler(i),this._initWithRoomData(i.offlineKickTime),this._logger.info(Oe.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomData:i}),e)):this._logger.error(Oe.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:n}),e),t.a(2,n)}},t,this)}))}},{key:"publish",value:function(t){var r=this,n=Object.create(null,{publish:{get:function(){return m(e,"publish",r,1)}}});return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)switch(e.n){case 0:if(this._store.isMainRoom){e.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),e.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:return e.a(2,n.publish.call(this,t))}},e,this)}))}},{key:"unpublish",value:function(t){var r=this,n=Object.create(null,{unpublish:{get:function(){return m(e,"unpublish",r,1)}}});return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)switch(e.n){case 0:if(this._store.isMainRoom){e.n=1;break}return this._logger.error(Oe.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),e.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:return e.a(2,n.unpublish.call(this,t))}},e,this)}))}},{key:"_isValidResourceId",value:function(e){var t,r,n=Nr(e).userId,i=!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find(function(t){return Ar(t)===e})),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==exports.RCRTCCode.SUCCESS||!s)return i;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach(function(e){u.push.apply(u,v(e.getRemoteTracks()))}),r=u.some(function(t){return e===t.getTrackId()}),i||r}},{key:"getLivingType",value:function(){return this._livingType}},{key:"getMCUConfigBuilder",value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(Oe.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"enableInnerCDN",value:function(e){return K(this,void 0,void 0,_().m(function t(){return _().w(function(t){for(;;)if(0===t.n)return t.a(2,this._invoker.push(new Vc(this._mcuConfigBuilder.__innerGetValues(),e)))},t,this)}))}},{key:"_resourceHandle",value:function(t,r,n,i,o){var a=this,s=Object.create(null,{_resourceHandle:{get:function(){return m(e,"_resourceHandle",a,1)}}});return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)switch(e.n){case 0:s._resourceHandle.call(this,t,r,n,i,o);case 1:return e.a(2)}},e,this)}))}},{key:"__getCDNEnable",value:function(){var e;return!!(null===(e=this._store.getCDNUris())||void 0===e?void 0:e.enableInnerCDN)}},{key:"__getCDNPushMode",value:function(){var e;return null===(e=this._store.getCDNUris())||void 0===e?void 0:e.push_mode}},{key:"_onJoinedPKRoom",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){return _().w(function(r){for(;;)switch(r.n){case 0:this._invoker.push(new Uc(e,this._roomPKHandler,t));case 1:return r.a(2)}},r,this)}))}},{key:"_getPushOtherRoomsParams",value:function(){var e=[];if(!this.isMainRoom()||!this._roomPKHandler)return e;var t=this._roomPKHandler.getJoinedPKRooms();for(var r in t){var n=t[r].getSessionId(),i=this._roomPKHandler.getPKInfo(r);if(i){var o=i.inviterUserAutoMix,a=i.inviteeUserAutoMix,s=i.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:r,sessionId:n,autoMix:c?!!o:!!a})}}return e}},{key:"getRoomPKHandler",value:function(){return this._store.isMainRoom?(this._logger.info(Oe.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:Le.SUCCESSED})),{code:exports.RCRTCCode.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(Oe.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:Le.SUCCESSED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_quitAllPKRoom",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r;return _().w(function(e){for(;;)switch(e.n){case 0:for(r in t=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(t[r]);this._logger.info(Oe.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:Le.SUCCESSED,roomIds:Object.keys(t)}));case 1:return e.a(2)}},e,this)}))}},{key:"isMainRoom",value:function(){return this._store.isMainRoom}}])}(),Hc=function(){function e(t,i,o,a,s){var c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:exports.RTCMode.RTC,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return n(this,e),r(this,e,[t,i,o,c,a,s,!1,!1,ga(),u])}return l(e,kc),o(e)}(),Kc=new(function(){return o(function e(){n(this,e),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"taskCount",{enumerable:!0,configurable:!0,writable:!0,value:0})},[{key:"checkToStart",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n,i,o,a;return _().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==this.queue.length&&!this.locked){e.n=1;break}return e.a(2);case 1:return this.locked=!0,t=this.queue.shift(),r=t.resolve,n=t.task,i=t.reject,e.p=2,e.n=3,n();case 3:o=e.v,r(o),e.n=5;break;case 4:e.p=4,a=e.v,i(a);case 5:this.locked=!1,this.checkToStart();case 6:return e.a(2)}},e,this,[[2,4]])}))}},{key:"push",value:function(e){var t=this,r=new Promise(function(r,n){t.queue.push({resolve:r,task:e,reject:n})});return this.checkToStart(),r}}])}()),qc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Kc.push(e,t)},Yc=function(){return o(function e(t,r,i){n(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_liveUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_subTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:ga()}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_subTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_fromRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._crtUserId=this._context.getCurrentId(),this._service=new ya(r,t,i.mediaServer),this._logger=this._context.logger,this._store=new ss(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,exports.RTCMode.LIVE)},[{key:"_getReqHeaders",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=this._crtUserId,this._rtcToken){t.n=3;break}return t.n=1,this._context.getRTCToken(r,exports.RTCMode.LIVE,e);case 1:if(n=t.v,i=n.code,o=n.data,i===ke){t.n=2;break}return t.a(2,{code:exports.RCRTCCode.SIGNAL_ERROR});case 2:this._rtcToken=o.rtcToken;case 3:return t.a(2,{code:exports.RCRTCCode.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:this._crtUserId,RoomId:r,RoomType:exports.RTCMode.LIVE,Token:this._rtcToken,"Client-Session-Id":this._clientSessionId}})}},t,this)}))}},{key:"_clearSubscribeInfo",value:function(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,null===(e=this._pc)||void 0===e||e.destroy(),this._pc=null}},{key:"_reTryExchange",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n;return _().w(function(e){for(;;)switch(e.n){case 0:return this._fromRetry=!0,e.n=1,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);case 1:return r=e.v,(n=r.code)===exports.RCRTCCode.SUCCESS&&(null===(t=this._pc)||void 0===t||t.clearReTryExchangeTimer()),e.a(2,{code:n})}},e,this)}))}},{key:"subscribe",value:function(e,t,r){return K(this,arguments,void 0,function(e,t,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _().m(function o(){return _().w(function(o){for(;;)if(0===o.n)return o.a(2,qc(function(){return n.__subscribe(e,t,r,i)},"audience-client-sub"))},o)})()})}},{key:"__subscribe",value:function(e,t,r){return K(this,arguments,void 0,function(e,t,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _().m(function o(){var a,s,c,u,l,d,f,h,p,g,R,m,v,T;return _().w(function(o){for(;;)switch(o.n){case 0:if(n._logger.info(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:e,livingType:t,mediaType:r,subTiny:i})),s=[],!qr(n._context.getNaviInfo())){o.n=1;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"})),o.a(2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,tracks:s});case 1:if(!n._fromRetry&&(null===(a=n._pc)||void 0===a||a.clearReTryExchangeTimer()),n._fromRetry=!1,y(e)){o.n=2;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(e)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 2:if([exports.RCLivingType.AUDIO,exports.RCLivingType.VIDEO].includes(t)){o.n=3;break}return n._logger.error("livingType is invalid: ".concat(t)),n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType: ".concat(t)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 3:if([exports.RCMediaType.AUDIO_ONLY,exports.RCMediaType.VIDEO_ONLY,exports.RCMediaType.AUDIO_VIDEO].includes(r)){o.n=4;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(r)})),o.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s});case 4:if(!n._liveUrl||n._liveUrl===e){o.n=5;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),o.a(2,{code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s});case 5:return n._pc||(n._pc=new Qa(n._context,n._logger,n._reTryExchange.bind(n),n._crtUserId,n._store,void 0,!1),n._pc.on(Qa.__INNER_EVENT_TRACK_READY__,n._onTrackReady,n),n._pc.registerReportListener(n._reportListener),n._pc.__reportR3R4ToPolaris()),n._liveUrl=e,o.n=6,n._getReqHeaders(t);case 6:if(c=o.v,u=c.code,l=c.headers,u===exports.RCRTCCode.SUCCESS){o.n=7;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:u,msg:"getRTCToken failed"})),o.a(2,{code:u,tracks:s});case 7:return d="rc_mcu_".concat(Date.now()),f="RongCloudRTC",0===n._subTracks.length&&(n._subTracks.push(new Cr(n._logger,f,d),new Er(n._logger,f,d)),n._pc.updateSubRemoteTracks(n._subTracks.slice())),o.n=8,n._pc.createOffer(!0);case 8:return h=o.v,p={sdp:h,liveUrl:e,mediaType:r,simulcast:i?Ia.TINY:Ia.NORMAL,switchstream:!1},o.n=9,n._service.broadcastSubscribe(l,p);case 9:if((g=o.v).code===exports.RCRTCCode.SUCCESS){o.n=10;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:g.code})),o.a(2,{code:g.code,tracks:s});case 10:if((R=g.data).resultCode===exports.RCRTCCode.SUCCESS){o.n=11;break}return n._logger.error(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:R.resultCode,msg:R.message})),o.a(2,{code:R.resultCode,tracks:s});case 11:return n._livingType=t,n._mediaType=r,n._subTiny=i,m=R.sdp,v=R.subscribedList,n._subscribedList=v,T=[],v.forEach(function(e){var t=e.mediaType,r=n._subTracks[t];T.push(r),r.__innerSetRemoteMuted(!0)}),n._pc.setRemoteAnswer(m.sdp),T&&n._updateTrackIdSSRCMap(m.sdp,T),n._logger.info(Oe.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,liveUrl:e})),o.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:T})}},o)})()})}},{key:"_updateTrackIdSSRCMap",value:function(e,t){var r=this;t.forEach(function(t){var n=t.getTrackId(),i=Nr(n).mediaType,o=r._subscribedList.filter(function(e){return e.mediaType===i})[0].msid,a=Ys(e,o,i);r._store.setTrackIdSSRCMap(Number(a),n)})}},{key:"unsubscribe",value:function(){return K(this,void 0,void 0,_().m(function e(){var t=this;return _().w(function(e){for(;;)if(0===e.n)return e.a(2,qc(function(){return t.__unsubscribe()},"audience-client-unsub"))},e)}))}},{key:"__unsubscribe",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n,i,o;return _().w(function(e){for(;;)switch(e.n){case 0:if(this._logger.info(Oe.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T,JSON.stringify({liveUrl:this._liveUrl})),null===(t=this._pc)||void 0===t||t.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl){e.n=1;break}return this._logger.warn(Oe.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),e.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return e.n=2,this._getReqHeaders();case 2:return r=e.v,n=r.headers,e.n=3,this._service.broadcastExit(n);case 3:return i=e.v,(o=i.code)!==exports.RCRTCCode.SUCCESS?this._logger.error(Oe.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:o})):(this._logger.info(Oe.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:Le.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),e.a(2,{code:o})}},e,this)}))}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"registerTrackEventListener",value:function(e){this._appListener=e}},{key:"_onTrackReady",value:function(e){var t,r,n=e.receiver.track,i="audio"===n.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY,o=this._subTracks[i];o.__innerSetMediaStreamTrack(n);try{this._logger.info(Oe.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(o.getTrackId())),null===(r=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===r||r.call(t,o)}catch(e){this._logger.error(Oe.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}])}();exports.RCInnerCDNPullKind=void 0,(jc=exports.RCInnerCDNPullKind||(exports.RCInnerCDNPullKind={})).RTMP="rtmp",jc.FLV="flv",jc.HLS="hls",exports.RCInnerCDNPullIsHttps=void 0,(Fc=exports.RCInnerCDNPullIsHttps||(exports.RCInnerCDNPullIsHttps={}))[Fc.NOT_HTTPS=0]="NOT_HTTPS",Fc[Fc.HTTPS=1]="HTTPS";var Wc,zc=Object.assign(Object.assign({},Mr(exports.RCResolution.W176_H144)),{frameRate:Vr(exports.RCFrameRate.FPS_15)}),Qc=function(){return o(function e(t,r,i,o,a,s){var c=this,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ga();n(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_roomAnchorList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_roomRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_roomAnchorRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPulling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger,this._crtUserId=this._context.getCurrentId(),this._polarisReport=new hc(this._context,this._runtime,this._roomId,this,uc.Audience),this._reportMediaActionLogger=new _c(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new ya(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var l=this._store=new ss(this._logger,u,t.getAppkey(),o,this._crtUserId,exports.RTCMode.LIVE),d=this._pc=new Qa(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,l,this._polarisReport,!0);this._audioLevelReport=new ts(this._store,d),d.on(Qa.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener(function(e){return K(c,void 0,void 0,_().m(function t(){var r,n,i,o;return _().w(function(t){for(;;)switch(t.n){case 0:r=this._context.decodeRtcNotify(e),n=r.time,i=r.type,o=r.roomId,1===i&&this._startPull(o,n);case 1:return t.a(2)}},t,this)}))}),this._setInitData()},[{key:"_startPull",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s;return _().w(function(r){for(;;)switch(r.n){case 0:if(!this._isPulling){r.n=1;break}return r.a(2);case 1:if(this._isPulling=!0,!(this._pullTime>t)){r.n=2;break}return this._isPulling=!1,r.a(2);case 2:return n=this._logger.createTraceId(),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),n),r.n=3,this._context.pullRTCRoomEntry(e);case 3:i=r.v,o=i.code,a=i.data,o===ke&&(this._isPulling=!1,this._pullTime=(null==a?void 0:a.syncTime)||0,s=(null==a?void 0:a.kvEntries)||[],this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(Le.SUCCESSED,", kvEntries: ").concat(JSON.stringify(s)),n),this.singalDataChange(s,e,n)),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(Le.FAILED,", code: ").concat(o),n);case 4:return r.a(2)}},r,this)}))}},{key:"_setInitData",value:function(){var e=this,t=function(e,t,r){var n=t.filter(function(e){return"RC_RTC_SESSIONID"===e.key})[0],i=n?n.value:"",o=t.filter(function(e){return"RC_ANCHOR_LIST"===e.key}).map(function(e){return JSON.parse(e.value||"[]")})[0],a=t.filter(function(e){return e.key.includes("RC_RES_")}).map(function(e){return JSON.parse(e.value||"{}")}),s=a.length?JSON.parse(a[0].mcu_uris||"[]"):[],c=[];s.forEach(function(t){var n=t.mediaType,i=t.tag,o=n===exports.RCMediaType.AUDIO_ONLY?new Cr(r,i,"",e):new Er(r,i,"",e);c.push(o)});var u=[],l=[];a.forEach(function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,v(t)),t.forEach(function(e){var t=e.mediaType,n=e.tag,i=e.msid.split("_");i.pop();var o=i.join("_"),a=t===exports.RCMediaType.AUDIO_ONLY?new Cr(r,n,o):new Er(r,n,o);l.push(a)})});var d=t.filter(function(e){return"RC_CDN"===e.key}).map(function(e){var t=JSON.parse(e.value||"[]");return JSON.parse(t.cdn_uris)[0]})[0];return{sessionId:i,remoteUserIds:o||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:l,remoteMCUTracks:c,remoteTracks:[].concat(l,c),CDNUris:d||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),r=t.sessionId,n=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=r,this._roomAnchorList=n,a.forEach(function(t){e._remoteTracks[t.getTrackId()]=t}),this._CDNUris=s,i.forEach(function(t){var r=t.msid.split("_")[0];e._roomAnchorRes[r]?e._roomAnchorRes[r].push(t):e._roomAnchorRes[r]=[t];var n=JSON.parse(t.uri),i=n.ssrc,o=n.resourceId;e._store.setTrackIdSSRCMap(i,o)}),o.forEach(function(t){var r=t.mediaType,n=t.tag,i=[e._roomId,n,r].join("_");e._roomRes[i]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,i)}),i.forEach(function(t){var r=Ar(t);e._roomRes[r]=t})}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed)return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}},{key:"singalDataChange",value:function(e,t,r){var n,i=this;if(t===this._roomId){var o=[],a=null===(n=e.filter(function(e){return"RC_CDN"===e.key})[0])||void 0===n?void 0:n.value;a&&this._diffCDNUris(JSON.parse(JSON.parse(a).cdn_uris)[0],r),e.forEach(function(e){var t=e.key,n=e.value,a=e.uid;if(-1!==t.indexOf("RC_RES_")){var s=JSON.parse(n||"{}"),c=JSON.parse(s.mcu_uris||"[]"),u=JSON.parse(s.uris||"[]");return o.push.apply(o,v(c)),void i._diffAnchorResource(u,a,r)}if("RC_ANCHOR_LIST"===t){var l=JSON.parse(n||"[]");i._diffAnchorList(l,r)}}),this._diffRoomResource(o,r)}else this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:Le.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),r)}},{key:"_diffAnchorList",value:function(e,t){var r=this,n=e.filter(function(e){return r._roomAnchorList.indexOf(e)<0}),i=this._roomAnchorList.filter(function(t){return e.indexOf(t)<0});n.length>0&&this._handleNewJoinedAnchor(n,t),i.length>0&&this._handleLeftedAnchor(i,t)}},{key:"_handleNewJoinedAnchor",value:function(e,t){var r;(r=this._roomAnchorList).push.apply(r,v(e)),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}},{key:"_handleLeftedAnchor",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i=this;return _().w(function(r){for(;;)switch(r.n){case 0:if(this._roomAnchorList=this._roomAnchorList.filter(function(t){return!e.includes(t)}),n=[],e.forEach(function(e){n.push.apply(n,v(i.getRemoteTracksByUserId(e))),delete i._roomAnchorRes[e]}),!n.length){r.n=2;break}return r.n=1,this.unsubscribe(n);case 1:n.forEach(function(e){return delete i._remoteTracks[e.getTrackId()]});case 2:this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e);case 3:return r.a(2)}},r,this)}))}},{key:"_diffRoomResource",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a=this;return _().w(function(r){for(;;)switch(r.n){case 0:n=[],i=[],o=[],e.forEach(function(e){var t=Ar(e),r=Nr(t),i=r.tag,s=r.mediaType,c=[a._roomId,i,s].join("_"),u=JSON.parse(e.uri).ssrc;if(a._store.setTrackIdSSRCMap(u,c),!a._remoteTracks[c]){var l=s===exports.RCMediaType.AUDIO_ONLY?new Cr(a._logger,i,"",a._roomId):new Er(a._logger,i,"",a._roomId);n.push(l),a._remoteTracks[c]=l,a._roomRes[l.getTrackId()]=e}o.push(c)}),Object.keys(this._remoteTracks).forEach(function(e){o.indexOf(e)<0&&a._remoteTracks[e].isMCUTrack()&&i.push(a._remoteTracks[e])}),n.length>0&&(this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackPublish",trackIds:n.map(function(e){return e.getTrackId()})}),t),this._callAppListener("onTrackPublish",n)),i.length>0&&this._onUserUnpublish(i,"onTrackUnpublish",t);case 1:return r.a(2)}},r,this)}))}},{key:"_dealPublished",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l=this;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=e.map(Ar),o=[],a=[],t.forEach(function(t){var r=Ar(t),n=i.indexOf(r),s=Nr(r),c=s.userId,u=s.tag,d=s.mediaType,_=JSON.parse(t.uri).ssrc;l._store.setTrackIdSSRCMap(_,r),n>-1?e[n]=t:e.push(t);var f=l._remoteTracks[r];l._roomRes[r]=t,f?f.isSubscribed()&&o.push(f):(f=d===exports.RCMediaType.AUDIO_ONLY?new Cr(l._logger,u,c):new Er(l._logger,u,c),l._remoteTracks[r]=f,a.push(f)),f.__innerSetRemoteMuted(0===t.state)}),!o.length){n.n=2;break}return s=o.map(function(e){return e.getTrackId()}),n.n=1,qc(function(){return l._subscribeHandle(o,!0)});case 1:c=n.v,(u=c.code)!==exports.RCRTCCode.SUCCESS&&this._logger.error(Oe.L_RESUB_REPUB_RES_R,JSON.stringify({status:Le.FAILED,trackIds:s,code:u}));case 2:this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:a.map(function(e){return e.getTrackId()})}),r),this._callAppListener("onAnchorTrackPublish",a);case 3:return n.a(2)}},n,this)}))}},{key:"_dealUnpublished",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c=this;return _().w(function(n){for(;;)switch(n.n){case 0:for(i=t.map(Ar),o=e.length-1;o>=0;o-=1)a=e[o],i.includes(Ar(a))&&e.splice(o,1);return s=t.map(function(e){var t=Ar(e);return c._remoteTracks[t]}),n.n=1,this._onUserUnpublish(s,"onAnchorTrackUnpublish",r);case 1:return n.a(2)}},n,this)}))}},{key:"_dealModified",value:function(e,t,r){var n,i=e.map(Ar),o=a(t);try{for(o.s();!(n=o.n()).done;){var s=n.value,c=Ar(s);e[i.indexOf(c)].state=s.state;var u=this._remoteTracks[c];u.__innerSetRemoteMuted(0===s.state);var l=u.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:l,trackId:u.getTrackId()}),r),this._callAppListener(l,u)}}catch(e){o.e(e)}finally{o.f()}}},{key:"_diffAnchorResource",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c;return _().w(function(n){for(;;)switch(n.n){case 0:if(i=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),o=Dr(i,e),a=o.publishedList,s=o.unpublishedList,c=o.modifiedList,!a.length){n.n=1;break}return n.n=1,this._dealPublished(i,a,r);case 1:if(!s.length){n.n=2;break}return n.n=2,this._dealUnpublished(i,s,r);case 2:c.length&&this._dealModified(i,c,r);case 3:return n.a(2)}},n,this)}))}},{key:"_onUserUnpublish",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i=this;return _().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this.unsubscribe(e);case 1:e.forEach(function(e){i._subscribedList=i._subscribedList.filter(function(t){return t.track.getTrackId()!==e.getTrackId()}),delete i._roomRes[e.getTrackId()],e.__innerDestroy(),delete i._remoteTracks[e.getTrackId()]}),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:t,trackIds:e.map(function(e){return e.getTrackId()})}),r),this._callAppListener(t,e);case 2:return n.a(2)}},n,this)}))}},{key:"_callAppListener",value:function(e){var t,r=null===(t=this._appListener)||void 0===t?void 0:t[e];if(r)try{for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r.apply(void 0,i)}catch(e){this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}},{key:"_reTryExchange",value:function(){return K(this,void 0,void 0,_().m(function e(){var t=this;return _().w(function(e){for(;;)if(0===e.n)return e.a(2,qc(function(){return K(t,void 0,void 0,_().m(function e(){var t,r,n,i,o,a,s,c,u,l,d,f;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._createSubscribeParams(this._subscribedList,{},!0);case 1:return r=e.v,n=r.reqBody,e.n=2,this._exchangeHandle(n);case 2:if((i=e.v).code===exports.RCRTCCode.SUCCESS){e.n=3;break}return e.a(2,{code:i.code});case 3:if(o=i.data,a=o.sdp,(s=o.resultCode)===exports.RCRTCCode.SUCCESS){e.n=4;break}return e.a(2,{code:s});case 4:return this._pc.clearReTryExchangeTimer(),(c=this._subscribedList.filter(function(e){return e.track.isMCUTrack()})).length>0&&(u=c[0].track.getTrackId(),l=null===(t=this._roomRes[u])||void 0===t?void 0:t.msid,d=[this._roomId,"RongCloudRTC"].join("_"),a.sdp=a.sdp.replace(new RegExp(l,"g"),d)),e.n=5,this._pc.setRemoteAnswer(a.sdp);case 5:return f=e.v,e.a(2,{code:f})}},e,this)}))},"audience-retry-exchange"))},e)}))}},{key:"_createSubscribeParams",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c=this;return _().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,this._pc.createOffer(r);case 1:return i=n.v,o={resolutionInfo:[]},a={min:0,max:0},Object.keys(t).forEach(function(e){var r=t[e];[r.mediaStream,r.tinyStream].forEach(function(t,r){var n,s=1===r?[e,"tiny"].join("_"):e;i.sdp=null===(n=i.sdp)||void 0===n?void 0:n.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===r,l=u?Lr(c):zc,d=l.width,_=l.height,f=l.frameRate;o.resolutionInfo.push({trackId:c.id,simulcast:u?Ia.NORMAL:Ia.TINY,resolution:"".concat(d,"x").concat(_)});var h=$t(d,_),p=tr(f);a.min+=h.minBitrate*p,a.max+=h.maxBitrate*p}})}),s={sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map(function(e){return{simulcast:e.subTiny?Ia.TINY:Ia.NORMAL,resolution:"",uri:c._roomRes[e.track.getTrackId()].uri}})},n.a(2,{reqBody:s,dynamicBitrate:a,offer:i})}},n,this)}))}},{key:"_subscribeHandle",value:function(e){return K(this,arguments,void 0,function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _().m(function i(){var o,a,s,c,u,l;return _().w(function(i){for(;;)switch(i.n){case 0:if(o=Date.now(),a=n?Ls.SUB:void 0,s=t._logger.createTraceId(),t._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:e.map(Qr),forceReq:r}),s),!t._assertRoomDestroyed()){i.n=1;break}return t._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),t._reportPubOrSubQualityData(o,e,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,a),i.a(2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED});case 1:if(j("tracks",e,function(){return L(e)&&e.length>0&&e.every(function(e){return e instanceof Tr||e.track instanceof Tr})},!0)){i.n=2;break}return t._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),s),t._reportPubOrSubQualityData(o,e,exports.RCRTCCode.PARAMS_ERROR,a),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t._pc.__reportR3R4ToPolaris(),t._pc.registerReportListener(t._reportListener),t._addPeerCEvent(),c=t._subscribedList.map(function(e){return Object.assign({},e)}),u=e.map(function(e){return e instanceof Tr?{track:e}:e}),l=[],u.forEach(function(e){var t=e.track.getTrackId();l.push(t);var r=c.find(function(e){return e.track.getTrackId()===t});r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:c.push(e))}),t._polarisReport.sendR2(ds.SUBSCRIBE,_s.BEGIN,l),i.a(2,t._updateSubListHandle(c,s,o,a,!0))}},i)})()})}},{key:"_addPeerCEvent",value:function(){var e=this;this._pc.on(Qa.__INNER_EVENT_TRACK_READY__,function(t){var r=t.streams[0].id,n=t.receiver.track,i=[r,"audio"===n.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),o=e._remoteTracks[i];o?(o.__innerSetMediaStreamTrack(n),e._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:o.getTrackId()})),e._callAppListener("onTrackReady",o)):e._logger.warn(Oe.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(n.id))}),this._pc.once(Qa.__INNER_ICE_CONNECTED__,function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")},this),this._pc.on(Qa.__INNER_ICE_STATE_CHANGE__,function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)})}},{key:"_getReqHeaders",value:function(){var e=this._crtUserId;return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:exports.RTCMode.LIVE,UserId:e,"Session-Id":this._sessionId,"Client-Session-Id":this._clientSessionId}}},{key:"_exchangeHandle",value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}},{key:"_dealSubscribeResult",value:function(e,t,r){var n,i=this,o=null==t?void 0:t.map(function(e){return"".concat(e.msid,"_").concat(e.mediaType)}),a=e.filter(function(e){if(e.track.isMCUTrack()){var t=i._roomRes[e.track.getTrackId()],r="".concat(t.msid,"_").concat(t.mediaType);return o.includes(r)}return null==o?void 0:o.includes(e.track.getTrackId())}),s=null==a?void 0:a.map(function(e){return"".concat(e.track.getTrackId())}),c=e.filter(function(e){return!(null==s?void 0:s.includes(e.track.getTrackId()))}),u=function(e){var t=a.some(function(t){return t.track.getTrackId()===e});i._remoteTracks[e].__innerSetSubscribed(t)};for(var l in this._remoteTracks)u(l);return(n=this._subscribedList).splice.apply(n,[0,this._subscribedList.length].concat(v(a))),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.SUCCESSED,subSuccessTrackIds:o,failedList:c}),r),c}},{key:"_getParams",value:function(e){var t=e.map(function(e){return e instanceof Tr?{track:e}:Object.assign({},e)}),r={};return t=t.filter(function(e){var t=e.track.getTrackId();return!r[t]&&(r[t]=!0,!0)}).map(function(e){return Object.assign({},e)})}},{key:"_reportPubOrSubQualityData",value:function(e,t,r,n){n&&this._reportMediaActionLogger.reportPubOrSubQualityData(n,e,t,r,this._trackMediaMap)}},{key:"_updateSubListHandle",value:function(e,t,r,n){return K(this,arguments,void 0,function(e,t,r,n){var i=this,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return _().m(function a(){var s,c,u,l,d,f,h,p,g,R,m,v,T,C;return _().w(function(a){for(;;)switch(a.n){case 0:if(i._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(Qr),forceReq:o}),t),c=i._getParams(e),u=i._subscribedList.map(function(e){return Object.assign({},e)}),o||Ws(c,u)){a.n=1;break}return i._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.SUCCESSED,msg:"repeat subscribe"}),t),a.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return i._pc.clearReTryExchangeTimer(),i._pc.updateSubRemoteTracks(c.map(function(e){return e.track})),a.n=2,i._createSubscribeParams(c,{},!1);case 2:return l=a.v,d=l.reqBody,a.n=3,i._exchangeHandle(d);case 3:if(f=a.v,u.length&&(h=[],u.forEach(function(e){h.push(e.track.getTrackId())}),null===(s=i._pc.reportParser)||void 0===s||s.clearLatestPacketsRecv(h)),e.forEach(function(e){var t=e instanceof Tr?e.getTrackId():e.track.getTrackId();i._trackMediaMap[t]=f.qualityMsList||[]}),f.code===exports.RCRTCCode.SUCCESS){a.n=4;break}return i._reportPubOrSubQualityData(r,e,f.code,n),i._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:f.code}),t),a.a(2,{code:f.code});case 4:if(p=f.data,g=p.sdp,R=p.resultCode,m=p.message,v=p.subscribedList,R===exports.RCRTCCode.SUCCESS){a.n=5;break}return i._reportPubOrSubQualityData(r,e,R,n),i._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:R,msg:m}),t),a.a(2,{code:R});case 5:return c.forEach(function(e){var t=e.track;if(t.isMCUTrack()){var r=i._roomRes[t.getTrackId()].msid,n=Nr(t.getTrackId()),o=n.tag,a=[n.userId,o].join("_");g.sdp=g.sdp.replace(new RegExp(r,"g"),a)}}),a.n=6,i._pc.setRemoteAnswer(g.sdp);case 6:if(T=a.v,i._reportPubOrSubQualityData(r,e,T,n),T===exports.RCRTCCode.SUCCESS){a.n=7;break}return i._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:Le.FAILED,code:T,msg:"set remote answer error"}),t),a.a(2,{code:T});case 7:return C=i._dealSubscribeResult(c,v,t),a.a(2,C.length?{code:exports.RCRTCCode.SUCCESS,failedList:C}:{code:exports.RCRTCCode.SUCCESS})}},a)})()})}},{key:"_diffCDNUris",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o;return _().w(function(r){for(;;)switch(r.n){case 0:if(!this._CDNUris.url||e.url){r.n=1;break}return this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoDisable"}),t),this._callAppListener("onCDNInfoDisable"),this._CDNUris=e,r.a(2);case 1:(!this._CDNUris||!this._CDNUris.url&&e.url)&&(this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoEnable",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoEnable",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),n=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,i=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,o=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(n||i||o)&&(this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoChange",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoChange",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),this._CDNUris=e;case 2:return r.a(2)}},r,this)}))}},{key:"_getCDNPlayUrl",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c,u,l,d,f,h,p,g,R,m,v;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=e.w,i=e.h,o=e.fps,a=this._initOptions.pullInnerCDNProtocol||exports.RCInnerCDNPullKind.FLV,s=this._initOptions.pullInnerCDNUseHttps===exports.RCInnerCDNPullIsHttps.NOT_HTTPS?exports.RCInnerCDNPullIsHttps.NOT_HTTPS:exports.RCInnerCDNPullIsHttps.HTTPS,this._CDNUris.url){r.n=1;break}return this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),r.a(2,{code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY});case 1:return c={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},u=[],l=this._CDNUris,d=l.w,f=void 0===d?0:d,h=l.h,f/(void 0===h?1:h)>1?(n&&u.push("w=".concat(n)),i&&u.push("h=".concat(i))):(n&&u.push("h=".concat(n)),i&&u.push("w=".concat(i))),o&&u.push("fps=".concat(o)),u.push("kind=".concat(a)),u.push("is_https=".concat(s)),p=u.join("&"),g="".concat(this._CDNUris.url,"?"),p&&(g+=p),r.n=2,this._service.getCDNResourceInfo(c,g,t);case 2:if(R=r.v,m=R.code,v=R.res,m===exports.RCRTCCode.SUCCESS){r.n=3;break}return r.a(2,{code:m});case 3:return r.a(2,{code:m,CDNPlayUrl:null==v?void 0:v.data.pull_url})}},r,this)}))}},{key:"getCDNPlayUrl",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),n),!e||xr(e)){r.n=1;break}return this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> resolution"}),n),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(!t||Br(t)){r.n=2;break}return this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> fps"}),n),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return i=e?Mr(e):{width:null,height:null},o=i.width,a=i.height,s=t?Vr(t):null,c={},o&&(c.w=o),a&&(c.h=a),s&&(c.fps=s),r.a(2,this._getCDNPlayUrl(c,n))}},r,this)}))}},{key:"subscribe",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r=this;return _().w(function(t){for(;;)if(0===t.n)return t.a(2,qc(function(){return r._subscribeHandle(e,!1,!0)},"audience-sub"))},t)}))}},{key:"__unsubscribe",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=Date.now(),n=Ls.UNSUB,i=this._logger.createTraceId(),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map(function(e){return e.getTrackId()})}),i),!this._assertRoomDestroyed()){t.n=1;break}return this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),i),t.a(2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED});case 1:if(j("tracks",e,function(){return L(e)&&e.length>0&&e.every(function(e){return e instanceof Tr})},!0)){t.n=2;break}return this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),i),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return o=this._subscribedList.map(function(e){return Object.assign({},e)}).filter(function(t){return e.every(function(e){return e.getTrackId()!==t.track.getTrackId()})}),this._polarisReport.sendR2(ds.SUBSCRIBE,_s.END,e.map(function(e){return e.getTrackId()})),t.a(2,this._updateSubListHandle(o,i,r,n,!1))}},t,this)}))}},{key:"unsubscribe",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r=this;return _().w(function(t){for(;;)if(0===t.n)return t.a(2,qc(function(){return r.__unsubscribe(e)},"audience-unsub"))},t)}))}},{key:"__destroy",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r;return _().w(function(t){for(;;)switch(t.n){case 0:if(!this._destroyed){t.n=1;break}return t.a(2);case 1:if(this._destroyed=!0,!e){t.n=2;break}return t.n=2,this._context.quitLivingRoomAsAudience(this._roomId);case 2:return t.n=3,this._service.broadcastExit(this._getReqHeaders());case 3:null===(r=this._pc)||void 0===r||r.destroy(),this._context.registerRTCSignalListener();case 4:return t.a(2)}},t,this)}))}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"getLocalTrack",value:function(e){return{}}},{key:"__onReconnected",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r;return _().w(function(e){for(;;)switch(e.n){case 0:return t=this._logger.createTraceId(),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,t),e.n=1,this._context.joinLivingRoomAsAudience(this._roomId,exports.RTCMode.LIVE);case 1:r=e.v,r.code!==ke&&this._logger.error(Oe.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(Le.FAILED),t),this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(Le.SUCCESSED),t);case 2:return e.a(2)}},e,this)}))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"onAudioLevelChange",value:function(e,t){this._logger.info(Oe.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._crtUserId}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getRemoteUserIds",value:function(){return this._roomAnchorList}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var r in this._remoteTracks){var n=this._remoteTracks[r];n.getUserId()===e&&t.push(n)}return t}},{key:"getRemoteTracks",value:function(){var e=this,t=[],r=[];for(var n in this._remoteTracks){if(2===r.length)break;var i=this._remoteTracks[n];i.isMCUTrack()&&r.push(i)}return this._roomAnchorList.forEach(function(r){t.push.apply(t,v(e.getRemoteTracksByUserId(r)))}),[].concat(r,t)}},{key:"getRemoteRTCTracks",value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()||e.push(r)}return e}},{key:"getRemoteMCUTracks",value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()&&e.push(r)}return e}},{key:"getCDNInfo",value:function(){return this._CDNUris.w?{resolution:"W".concat(this._CDNUris.w,"_H").concat(this._CDNUris.h),fps:"FPS_".concat(this._CDNUris.fps),CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}},{key:"getClientSessionId",value:function(){return this._clientSessionId}}])}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(Wc||(Wc={}));var Zc,Xc,$c=function(){function e(t){n(this,e),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isElectron",{enumerable:!0,configurable:!0,writable:!0,value:/Electron/.test(navigator.userAgent)}),this._logger=t.logger}return o(e,[{key:"_getMediaStream",value:function(e){return K(this,arguments,void 0,function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"getUserMedia";return _().m(function n(){var i,o,a;return _().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,i=t.setConstraintsConfig(e),n.n=1,navigator.mediaDevices[r](i);case 1:return o=n.v,n.a(2,{code:exports.RCRTCCode.SUCCESS,stream:o});case 2:if(n.p=2,a=n.v,t._logger.error(Oe.L_GET_MEDIA_STREAM_E,JSON.stringify({name:a.name,message:a.message})),"Permission denied"!==a.message){n.n=3;break}return n.a(2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED});case 3:if("Permission denied by system"!==a.message){n.n=4;break}return n.a(2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED});case 4:return n.a(2,{code:"getUserMedia"===r?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED})}},n,null,[[0,2]])})()})}},{key:"_getMediaStreamErrorReason",value:function(e){var t="";return e===exports.RCRTCCode.BROWSER_PERMISSION_DENIED&&(t="Permission denied"),e===exports.RCRTCCode.SYSTEM_PERMISSION_DENIED&&(t="Permission denied by system"),t}},{key:"setConstraintsConfig",value:function(e){var t,r;if((null==e?void 0:e.audio)&&!this._isElectron){"boolean"==typeof e.audio&&(e.audio={});var n=null===(r=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===r?void 0:r.call(t);(null==n?void 0:n.noiseSuppression)&&(e.audio.noiseSuppression=!!n.noiseSuppression),(null==n?void 0:n.autoGainControl)&&(e.audio.autoGainControl=!!n.autoGainControl),(null==n?void 0:n.echoCancellation)&&(e.audio.echoCancellation=!!n.echoCancellation),this._logger.info(Oe.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(n)))}return e}},{key:"createMicrophoneAudioTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",r=arguments.length>1?arguments[1]:void 0;return _().m(function n(){var i,o,a,s,c,u;return _().w(function(n){for(;;)switch(n.n){case 0:if(br(t)){n.n=1;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(i=e._context.getCurrentId()){n.n=2;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:return n.n=3,e._getMediaStream({audio:{deviceId:(null==r?void 0:r.micphoneId)?{exact:null==r?void 0:r.micphoneId}:void 0,sampleRate:null==r?void 0:r.sampleRate,noiseSuppression:null==r?void 0:r.noiseSuppression,echoCancellation:null==r?void 0:r.echoCancellation,autoGainControl:null==r?void 0:r.autoGainControl}});case 3:if(o=n.v,a=o.stream,(s=o.code)===exports.RCRTCCode.SUCCESS){n.n=4;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:s,msg:e._getMediaStreamErrorReason(s)})),n.a(2,{code:s});case 4:return c=a.getAudioTracks()[0],u=new gr(e._logger,t,i,c),e._logger.info(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:u.getTrackId()})),n.a(2,{code:s,track:u})}},n)})()})}},{key:"createCameraVideoTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",r=arguments.length>1?arguments[1]:void 0;return _().m(function n(){var i,o,a,s,c,u,l,d,f,h;return _().w(function(n){for(;;)switch(n.n){case 0:if(br(t)){n.n=1;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(i=e._context.getCurrentId()){n.n=2;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:return o=xr(null==r?void 0:r.resolution)?r.resolution:exports.RCResolution.W640_H480,a=Mr(o),s=a.width,c=a.height,n.n=3,e._getMediaStream({video:{deviceId:(null==r?void 0:r.cameraId)?{exact:null==r?void 0:r.cameraId}:void 0,frameRate:Vr((null==r?void 0:r.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:s,max:s},height:{ideal:c,max:c},facingMode:null==r?void 0:r.faceMode}});case 3:if(u=n.v,l=u.stream,(d=u.code)===exports.RCRTCCode.SUCCESS){n.n=4;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:d,msg:e._getMediaStreamErrorReason(d)})),n.a(2,{code:d});case 4:return f=l.getVideoTracks()[0],n.n=5,e._applyVideoAspectRatio(f,s,c);case 5:return h=new Rr(e._logger,t,i,f),e._logger.info(Oe.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:h.getTrackId()})),n.a(2,{code:d,track:h})}},n)})()})}},{key:"createMicrophoneAndCameraTracks",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",r=arguments.length>1?arguments[1]:void 0;return _().m(function n(){var i,o,a,s,c,u,l,d,f,h,p,g,R,m,v;return _().w(function(n){for(;;)switch(n.n){case 0:if(o=[],br(t)){n.n=1;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),n.a(2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:o});case 1:if(a=e._context.getCurrentId()){n.n=2;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),n.a(2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:o});case 2:return s=xr(null===(i=null==r?void 0:r.video)||void 0===i?void 0:i.resolution)?r.video.resolution:exports.RCResolution.W640_H480,c=Mr(s),u=c.width,l=c.height,d=null==r?void 0:r.audio,f=null==r?void 0:r.video,n.n=3,e._getMediaStream({video:{deviceId:(null==f?void 0:f.cameraId)?{exact:null==f?void 0:f.cameraId}:void 0,frameRate:Vr((null==f?void 0:f.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:u,max:u},height:{ideal:l,max:l},facingMode:null==f?void 0:f.faceMode},audio:{deviceId:(null==d?void 0:d.micphoneId)?{exact:null==d?void 0:d.micphoneId}:void 0,sampleRate:null==d?void 0:d.sampleRate,noiseSuppression:null==d?void 0:d.noiseSuppression,echoCancellation:null==d?void 0:d.echoCancellation,autoGainControl:null==d?void 0:d.autoGainControl}});case 3:if(h=n.v,p=h.stream,(g=h.code)===exports.RCRTCCode.SUCCESS){n.n=4;break}return e._logger.error(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.FAILED,code:g,msg:e._getMediaStreamErrorReason(g)})),n.a(2,{code:g,tracks:o});case 4:R=p.getTracks(),m=0;case 5:if(!(m<R.length)){n.n=9;break}if("video"!==(v=R[m]).kind){n.n=7;break}return n.n=6,e._applyVideoAspectRatio(v,u,l);case 6:o.push(new Rr(e._logger,t,a,v)),n.n=8;break;case 7:o.unshift(new gr(e._logger,t,a,v));case 8:m++,n.n=5;break;case 9:return e._logger.info(Oe.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:o.map(function(e){return e.getTrackId()})})),n.a(2,{code:g,tracks:o})}},n)})()})}},{key:"createScreenVideoTrack",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",r=arguments.length>1?arguments[1]:void 0;return _().m(function n(){var i;return _().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,e._createScreenTracks(t,!1,Oe.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,r);case 1:if((i=n.v).code!==exports.RCRTCCode.SUCCESS){n.n=2;break}return n.a(2,{code:i.code,track:i.tracks[0]});case 2:return n.a(2,i)}},n)})()})}},{key:"createScreenWithAudioTracks",value:function(){return K(this,arguments,void 0,function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",r=arguments.length>1?arguments[1]:void 0;return _().m(function n(){return _().w(function(n){for(;;)if(0===n.n)return n.a(2,e._createScreenTracks(t,!0,Oe.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,r))},n)})()})}},{key:"_createScreenTracks",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h,p,g,R;return _().w(function(i){for(;;)switch(i.n){case 0:if(br(e)){i.n=1;break}return this._logger.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),i.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(o=this._context.getCurrentId()){i.n=2;break}return this._logger.error(r,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),i.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 2:if(Gr()){i.n=3;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),i.a(2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT});case 3:if(a=/macintosh|mac os x/i.test(navigator.userAgent),s=(!this._isElectron||!a)&&t,c=xr(null==n?void 0:n.resolution)?n.resolution:exports.RCResolution.W1280_H720,!this._isElectron){i.n=5;break}return i.n=4,this._createElectronScreenStream(t,r,c,null==n?void 0:n.chromeMediaSourceId);case 4:R=i.v,i.n=7;break;case 5:return i.n=6,this._createWebScreenStream(t,c,null==n?void 0:n.frameRate);case 6:R=i.v;case 7:if(l=(u=R).stream,(d=u.code)===exports.RCRTCCode.SUCCESS){i.n=8;break}return this._logger.error(r,JSON.stringify({status:Le.FAILED,code:d,msg:this._getMediaStreamErrorReason(d)})),i.a(2,{code:d});case 8:return f=l.getVideoTracks()[0],h=new mr(this._logger,e,o,f),p=[h],s&&(g=l.getAudioTracks()[0])&&p.push(new vr(this._logger,e,o,g)),this._logger.info(r,JSON.stringify({status:Le.SUCCESSED,trackIds:p.map(function(e){return e.getTrackId()})})),i.a(2,{code:d,tracks:p})}},i,this)}))}},{key:"_createElectronScreenStream",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d,f,h;return _().w(function(i){for(;;)switch(i.n){case 0:if(s=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&s&&e&&this._logger.warn(t,JSON.stringify({status:Le.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),c=(!this._isElectron||!s)&&e,!this._isElectron||w(n)||y(n)){i.n=1;break}return this._logger.error(t,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:return u=Mr(r),l=u.width,d=u.height,f={mandatory:{chromeMediaSourceId:n,chromeMediaSource:"desktop",minWidth:l,maxWidth:l,minHeight:d,maxHeight:d}},!n&&this._isElectron&&(null===(o=f.mandatory)||void 0===o||delete o.chromeMediaSourceId),h=null,c&&this._isElectron&&(null===(a=f.mandatory)||void 0===a||delete a.chromeMediaSourceId,h={mandatory:{chromeMediaSource:"desktop"}}),i.a(2,this._getMediaStream({video:f,audio:h||c},"getUserMedia"))}},i,this)}))}},{key:"_createWebScreenStream",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s;return _().w(function(n){for(;;)if(0===n.n)return i=Mr(t),o=i.width,a=i.height,s={frameRate:Vr(r||exports.RCFrameRate.FPS_15),width:o,height:a},n.a(2,this._getMediaStream({video:s,audio:e},"getDisplayMedia"))},n,this)}))}},{key:"createLocalAudioTrack",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i;return _().w(function(r){for(;;)switch(r.n){case 0:if(br(e)){r.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind){r.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),r.a(2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED});case 2:if(n=this._context.getCurrentId()){r.n=3;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 3:return i=new lr(this._logger,e,n,t),this._logger.info(Oe.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:i.getTrackId()})),r.a(2,{code:exports.RCRTCCode.SUCCESS,track:i})}},r,this)}))}},{key:"createLocalVideoTrack",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i;return _().w(function(r){for(;;)switch(r.n){case 0:if(br(e)){r.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),r.a(2,{code:exports.RCRTCCode.INVALID_TAGS});case 1:if(t&&t instanceof MediaStreamTrack&&"video"===t.kind){r.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),r.a(2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED});case 2:if(n=this._context.getCurrentId()){r.n=3;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),r.a(2,{code:exports.RCRTCCode.INVALID_USER_ID});case 3:return i=new dr(this._logger,e,n,t),this._logger.info(Oe.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:Le.SUCCESSED,trackId:i.getTrackId()})),r.a(2,{code:exports.RCRTCCode.SUCCESS,track:i})}},r,this)}))}},{key:"_validateCreateLocalFileTracks",value:function(e,t){if(!br(e))return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!Fr())return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var r=t instanceof File?URL.createObjectURL(t):t;return P(r)||/^blob:/.test(r)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:r}:(this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}},{key:"createLocalFileTracks",value:function(t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s=this;return _().w(function(i){for(;;)switch(i.n){case 0:if((o=this._validateCreateLocalFileTracks(t,r)).code===exports.RCRTCCode.SUCCESS){i.n=1;break}return i.a(2,o);case 1:return a=this._context.getCurrentId(),i.a(2,new Promise(function(r){var i=document.createElement("video");(null==n?void 0:n.withoutAudio)&&(i.muted=!0),i.onloadedmetadata=function(){var o,c=[];try{var u=i.mozCaptureStream?"mozCaptureStream":"captureStream";o=i[u]()}catch(e){s._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:c})}var l=R(e.getTracksWithOptions(o,n),2),d=l[0],_=l[1];d&&c.push(new pr(s._logger,t,a,d,i)),_&&c.push(new hr(s._logger,t,a,_,i)),0===c.length&&(i.pause(),i.src=""),i.onerror=null,s._logger.info(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:c.map(function(e){return e.getTrackId()})})),r({code:exports.RCRTCCode.SUCCESS,tracks:c})},i.onerror=function(){s._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:[]})},i.src=o.url,i.loop=!0,i.play()}))}},i,this)}))}},{key:"createLocalTracks",value:function(t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l;return _().w(function(i){for(;;)switch(i.n){case 0:if(o=[],br(t)){i.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),i.a(2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:o});case 1:if(r instanceof MediaStream){i.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),i.a(2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:o});case 2:if(a=this._context.getCurrentId()){i.n=3;break}return this._logger.error(Oe.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),i.a(2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:o});case 3:return s=e.getTracksWithOptions(r,n),c=R(s,2),u=c[0],l=c[1],u&&o.push(new lr(this._logger,t,a,u)),l&&o.push(new dr(this._logger,t,a,l)),this._logger.info(Oe.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:Le.SUCCESSED,trackIds:o.map(function(e){return e.getTrackId()})})),i.a(2,{code:exports.RCRTCCode.SUCCESS,tracks:o})}},i,this)}))}},{key:"_applyVideoAspectRatio",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c;return _().w(function(n){for(;;)switch(n.p=n.n){case 0:if(i=e.getSettings(),o=i.width,a=i.height,o!==t||a!==r){n.n=1;break}return n.a(2);case 1:return s=t/r>=1?{width:{ideal:o,max:o}}:{height:{ideal:a,max:a}},n.p=2,n.n=3,e.applyConstraints(Object.assign(Object.assign({},s),{aspectRatio:{ideal:t/r}}));case 3:this._logger.info(Oe.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:Le.SUCCESSED,msg:"apply aspectRatio success -> ".concat(t," / ").concat(r)})),n.n=5;break;case 4:n.p=4,c=n.v,this._logger.warn(Oe.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:Le.FAILED,msg:"apply aspectRatio error -> ".concat(JSON.stringify(c))}));case 5:return n.a(2)}},n,this,[[2,4]])}))}}],[{key:"getTracksWithOptions",value:function(e,t){var r=[];return r[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],r[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],r}}])}(),eu=function(){var e,t={},r=function(e){var t=function(e,r,i){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===r&&(r=t.DEFAULT_ENDIAN),void 0===i&&(i=t.DEFAULT_NOASSERT),!i){if((e|=0)<0)throw RangeError("Illegal capacity");r=!!r,i=!!i}this.buffer=0===e?n:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=r,this.noAssert=i};t.VERSION="5.0.1",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var r=t.prototype;r.__isByteBuffer__,Object.defineProperty(r,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var n=new ArrayBuffer(0),i=String.fromCharCode;function o(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function a(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+i.apply(String,e);e.length+arguments.length>1024&&(t.push(i.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function s(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<<s)-1,u=c>>1,l=-7,d=r?i-1:0,_=r?-1:1,f=e[t+d];for(d+=_,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=_,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+d],d+=_,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)}function c(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,_=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,h=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?_/c:_*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+f]=255&a,f+=h,a/=256,u-=8);e[r+f-h]|=128*p}t.accessor=function(){return Uint8Array},t.allocate=function(e,r,n){return new t(e,r,n)},t.concat=function(e,r,n,i){"boolean"!=typeof r&&"string"==typeof r||(i=n,n=r,r=void 0);for(var o,a=0,s=0,c=e.length;s<c;++s)t.isByteBuffer(e[s])||(e[s]=t.wrap(e[s],r)),(o=e[s].limit-e[s].offset)>0&&(a+=o);if(0===a)return new t(0,n,i);var u,l=new t(a,n,i);for(s=0;s<c;)(o=(u=e[s++]).limit-u.offset)<=0||(l.view.set(u.view.subarray(u.offset,u.limit),l.offset),l.offset+=o);return l.limit=l.offset,l.offset=0,l},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,n,i,o){if("string"!=typeof n&&(o=i,i=n,n=void 0),"string"==typeof e)switch(void 0===n&&(n="utf8"),n){case"base64":return t.fromBase64(e,i);case"hex":return t.fromHex(e,i);case"binary":return t.fromBinary(e,i);case"utf8":return t.fromUTF8(e,i);case"debug":return t.fromDebug(e,i);default:throw Error("Unsupported encoding: "+n)}if(null===e||"object"!==C(e))throw TypeError("Illegal buffer");var a;if(t.isByteBuffer(e))return(a=r.clone.call(e)).markedOffset=-1,a;if(e instanceof Uint8Array)a=new t(0,i,o),e.length>0&&(a.buffer=e.buffer,a.offset=e.byteOffset,a.limit=e.byteOffset+e.byteLength,a.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)a=new t(0,i,o),e.byteLength>0&&(a.buffer=e,a.offset=0,a.limit=e.byteLength,a.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");(a=new t(e.length,i,o)).limit=e.length;for(var s=0;s<e.length;++s)a.view[s]=e[s]}return a},r.writeBitSet=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n,i=t,o=e.length,a=o>>3,s=0;for(t+=this.writeVarint32(o,t);a--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(s<o){var c=0;for(n=0;s<o;)n|=(1&!!e[s++])<<c++;this.writeByte(n,t++)}return r?(this.offset=t,this):t-i},r.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var r,n=this.readVarint32(e),i=n.value,o=i>>3,a=0,s=[];for(e+=n.length;o--;)r=this.readByte(e++),s[a++]=!!(1&r),s[a++]=!!(2&r),s[a++]=!!(4&r),s[a++]=!!(8&r),s[a++]=!!(16&r),s[a++]=!!(32&r),s[a++]=!!(64&r),s[a++]=!!(128&r);if(a<i){var c=0;for(r=this.readByte(e++);a<i;)s[a++]=!!(r>>c++&1)}return t&&(this.offset=e),s},r.readBytes=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var n=this.slice(t,t+e);return r&&(this.offset+=e),n},r.writeBytes=r.append,r.writeInt8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeByte=r.writeInt8,r.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return 128&~r||(r=-(255-r+1)),t&&(this.offset+=1),r},r.readByte=r.readInt8,r.writeUint8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeUInt8=r.writeUint8,r.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return t&&(this.offset+=1),r},r.readUInt8=r.readUint8,r.writeInt16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeShort=r.writeInt16,r.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),32768&~r||(r=-(65535-r+1)),t&&(this.offset+=2),r},r.readShort=r.readInt16,r.writeUint16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeUInt16=r.writeUint16,r.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),t&&(this.offset+=2),r},r.readUInt16=r.readUint16,r.writeInt32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeInt=r.writeInt32,r.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),r|=0,t&&(this.offset+=4),r},r.readInt=r.readInt32,r.writeUint32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeUInt32=r.writeUint32,r.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),t&&(this.offset+=4),r},r.readUInt32=r.readUint32,e&&(r.writeInt64=function(t,r){var n=void 0===r;if(n&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var i=this.buffer.byteLength;r>i&&this.resize((i*=2)>r?i:r),r-=8;var o=t.low,a=t.high;return this.littleEndian?(this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o,r+=4,this.view[r+3]=a>>>24&255,this.view[r+2]=a>>>16&255,this.view[r+1]=a>>>8&255,this.view[r]=255&a):(this.view[r]=a>>>24&255,this.view[r+1]=a>>>16&255,this.view[r+2]=a>>>8&255,this.view[r+3]=255&a,r+=4,this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o),n&&(this.offset+=8),this},r.writeLong=r.writeInt64,r.readInt64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var n=0,i=0;this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0);var o=new e(n,i,!1);return r&&(this.offset+=8),o},r.readLong=r.readInt64,r.writeUint64=function(t,r){var n=void 0===r;if(n&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var i=this.buffer.byteLength;r>i&&this.resize((i*=2)>r?i:r),r-=8;var o=t.low,a=t.high;return this.littleEndian?(this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o,r+=4,this.view[r+3]=a>>>24&255,this.view[r+2]=a>>>16&255,this.view[r+1]=a>>>8&255,this.view[r]=255&a):(this.view[r]=a>>>24&255,this.view[r+1]=a>>>16&255,this.view[r+2]=a>>>8&255,this.view[r+3]=255&a,r+=4,this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o),n&&(this.offset+=8),this},r.writeUInt64=r.writeUint64,r.readUint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var n=0,i=0;this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0);var o=new e(n,i,!0);return r&&(this.offset+=8),o},r.readUInt64=r.readUint64),r.writeFloat32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=4,c(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},r.writeFloat=r.writeFloat32,r.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=s(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),r},r.readFloat=r.readFloat32,r.writeFloat64=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var n=this.buffer.byteLength;return t>n&&this.resize((n*=2)>t?n:t),t-=8,c(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},r.writeDouble=r.writeFloat64,r.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var r=s(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),r},r.readDouble=r.readFloat64,t.MAX_VARINT32_BYTES=5,t.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},t.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},t.zigZagDecode32=function(e){return e>>>1^-(1&e)},r.writeVarint32=function(e,r){var n=void 0===r;if(n&&(r=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var i,o=t.calculateVarint32(e);r+=o;var a=this.buffer.byteLength;for(r>a&&this.resize((a*=2)>r?a:r),r-=o,e>>>=0;e>=128;)i=127&e|128,this.view[r++]=i,e>>>=7;return this.view[r++]=e,n?(this.offset=r,this):o},r.writeVarint32ZigZag=function(e,r){return this.writeVarint32(t.zigZagEncode32(e),r)},r.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,n=0,i=0;do{if(!this.noAssert&&e>this.limit){var o=Error("Truncated");throw o.truncated=!0,o}r=this.view[e++],n<5&&(i|=(127&r)<<7*n),++n}while(128&r);return i|=0,t?(this.offset=e,i):{value:i,length:n}},r.readVarint32ZigZag=function(e){var r=this.readVarint32(e);return"object"===C(r)?r.value=t.zigZagDecode32(r.value):r=t.zigZagDecode32(r),r},e&&(t.MAX_VARINT64_BYTES=10,t.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var r=t.toInt()>>>0,n=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==n?r<16384?r<128?1:2:r<1<<21?3:4:n<16384?n<128?5:6:n<1<<21?7:8:i<128?9:10},t.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},t.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},r.writeVarint64=function(r,n){var i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"==typeof r)r=e.fromNumber(r);else if("string"==typeof r)r=e.fromString(r);else if(!(r&&r instanceof e))throw TypeError("Illegal value: "+r+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}"number"==typeof r?r=e.fromNumber(r,!1):"string"==typeof r?r=e.fromString(r,!1):!1!==r.unsigned&&(r=r.toSigned());var o=t.calculateVarint64(r),a=r.toInt()>>>0,s=r.shiftRightUnsigned(28).toInt()>>>0,c=r.shiftRightUnsigned(56).toInt()>>>0;n+=o;var u=this.buffer.byteLength;switch(n>u&&this.resize((u*=2)>n?u:n),n-=o,o){case 10:this.view[n+9]=c>>>7&1;case 9:this.view[n+8]=9!==o?128|c:127&c;case 8:this.view[n+7]=8!==o?s>>>21|128:s>>>21&127;case 7:this.view[n+6]=7!==o?s>>>14|128:s>>>14&127;case 6:this.view[n+5]=6!==o?s>>>7|128:s>>>7&127;case 5:this.view[n+4]=5!==o?128|s:127&s;case 4:this.view[n+3]=4!==o?a>>>21|128:a>>>21&127;case 3:this.view[n+2]=3!==o?a>>>14|128:a>>>14&127;case 2:this.view[n+1]=2!==o?a>>>7|128:a>>>7&127;case 1:this.view[n]=1!==o?128|a:127&a}return i?(this.offset+=o,this):o},r.writeVarint64ZigZag=function(e,r){return this.writeVarint64(t.zigZagEncode64(e),r)},r.readVarint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var n=t,i=0,o=0,a=0,s=0;if(i=127&(s=this.view[t++]),128&s&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(a=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(a|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");var c=e.fromBits(i|o<<28,o>>>4|a<<24,!1);return r?(this.offset=t,c):{value:c,length:t-n}},r.readVarint64ZigZag=function(r){var n=this.readVarint64(r);return n&&n.value instanceof e?n.value=t.zigZagDecode64(n.value):n=t.zigZagDecode64(n),n}),r.writeCString=function(e,t){var r=void 0===t;r&&(t=this.offset);var n,i=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(n=0;n<i;++n)if(0===e.charCodeAt(n))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}i=l.calculateUTF16asUTF8(o(e))[1],t+=i+1;var a=this.buffer.byteLength;return t>a&&this.resize((a*=2)>t?a:t),t-=i+1,l.encodeUTF16toUTF8(o(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,r?(this.offset=t,this):i},r.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,n=e,i=-1;return l.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=a(),!0),t?(this.offset=e,r()):{string:r(),length:e-n}},r.writeIString=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n,i=t;n=l.calculateUTF16asUTF8(o(e),this.noAssert)[1],t+=4+n;var a=this.buffer.byteLength;if(t>a&&this.resize((a*=2)>t?a:t),t-=4+n,this.littleEndian?(this.view[t+3]=n>>>24&255,this.view[t+2]=n>>>16&255,this.view[t+1]=n>>>8&255,this.view[t]=255&n):(this.view[t]=n>>>24&255,this.view[t+1]=n>>>16&255,this.view[t+2]=n>>>8&255,this.view[t+3]=255&n),t+=4,l.encodeUTF16toUTF8(o(e),function(e){this.view[t++]=e}.bind(this)),t!==i+4+n)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+n));return r?(this.offset=t,this):t-i},r.readIString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var n=e,i=this.readUint32(e),o=this.readUTF8String(i,t.METRICS_BYTES,e+=4);return e+=o.length,r?(this.offset=e,o.string):{string:o.string,length:e-n}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",r.writeUTF8String=function(e,t){var r,n=void 0===t;if(n&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i=t;r=l.calculateUTF16asUTF8(o(e))[1],t+=r;var a=this.buffer.byteLength;return t>a&&this.resize((a*=2)>t?a:t),t-=r,l.encodeUTF16toUTF8(o(e),function(e){this.view[t++]=e}.bind(this)),n?(this.offset=t,this):t-i},r.writeString=r.writeUTF8String,t.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(o(e))[0]},t.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(o(e))[1]},t.calculateString=t.calculateUTF8Bytes,r.readUTF8String=function(e,r,n){"number"==typeof r&&(n=r,r=void 0);var i=void 0===n;if(i&&(n=this.offset),void 0===r&&(r=t.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}var o,s=0,c=n;if(r===t.METRICS_CHARS){if(o=a(),l.decodeUTF8(function(){return s<e&&n<this.limit?this.view[n++]:null}.bind(this),function(e){++s,l.UTF8toUTF16(e,o)}),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=n,o()):{string:o(),length:n-c}}if(r===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+"+e+") <= "+this.buffer.byteLength)}var u=n+e;if(l.decodeUTF8toUTF16(function(){return n<u?this.view[n++]:null}.bind(this),o=a(),this.noAssert),n!==u)throw RangeError("Illegal range: Truncated data, "+n+" == "+u);return i?(this.offset=n,o()):{string:o(),length:n-c}}throw TypeError("Unsupported metrics: "+r)},r.readString=r.readUTF8String,r.writeVString=function(e,r){var n=void 0===r;if(n&&(r=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var i,a,s=r;i=l.calculateUTF16asUTF8(o(e),this.noAssert)[1],a=t.calculateVarint32(i),r+=a+i;var c=this.buffer.byteLength;if(r>c&&this.resize((c*=2)>r?c:r),r-=a+i,r+=this.writeVarint32(i,r),l.encodeUTF16toUTF8(o(e),function(e){this.view[r++]=e}.bind(this)),r!==s+i+a)throw RangeError("Illegal range: Truncated data, "+r+" == "+(r+i+a));return n?(this.offset=r,this):r-s},r.readVString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var n=e,i=this.readVarint32(e),o=this.readUTF8String(i.value,t.METRICS_BYTES,e+=i.length);return e+=o.length,r?(this.offset=e,o.string):{string:o.string,length:e-n}},r.append=function(e,r,n){"number"!=typeof r&&"string"==typeof r||(n=r,r=void 0);var i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var o=e.limit-e.offset;if(o<=0)return this;n+=o;var a=this.buffer.byteLength;return n>a&&this.resize((a*=2)>n?a:n),n-=o,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=o,i&&(this.offset+=o),this},r.appendTo=function(e,t){return e.append(this,t),this},r.assert=function(e){return this.noAssert=!e,this},r.capacity=function(){return this.buffer.byteLength},r.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},r.clone=function(e){var r=new t(0,this.littleEndian,this.noAssert);return e?(r.buffer=new ArrayBuffer(this.buffer.byteLength),r.view=new Uint8Array(r.buffer)):(r.buffer=this.buffer,r.view=this.view),r.offset=this.offset,r.markedOffset=this.markedOffset,r.limit=this.limit,r},r.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var r=t-e;if(0===r)return this.buffer=n,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var i=new ArrayBuffer(r),o=new Uint8Array(i);return o.set(this.view.subarray(e,t)),this.buffer=i,this.view=o,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=r,this},r.copy=function(e,r){if(void 0===e&&(e=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,e<0||e>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}if(e===r)return new t(0,this.littleEndian,this.noAssert);var n=r-e,i=new t(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=e),this.copyTo(i,0,e,r),i},r.copyTo=function(e,r,n,i){var o,a;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(r=(a=void 0===r)?e.offset:0|r,n=(o=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,r<0||r>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+r+" <= "+e.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);var s=i-n;return 0===s?e:(e.ensureCapacity(r+s),e.view.set(this.view.subarray(n,i),r),o&&(this.offset+=s),a&&(e.offset+=s),this)},r.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},r.fill=function(e,t,r){var n=void 0===t;if(n&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(t>=r)return this;for(;t<r;)this.view[t++]=e;return n&&(this.offset=t),this},r.flip=function(){return this.limit=this.offset,this.offset=0,this},r.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},r.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},r.LE=function(e){return this.littleEndian=void 0===e||!!e,this},r.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},r.prepend=function(e,r,n){"number"!=typeof r&&"string"==typeof r||(n=r,r=void 0);var i=void 0===n;if(i&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var o=e.limit-e.offset;if(o<=0)return this;var a=o-n;if(a>0){var s=new ArrayBuffer(this.buffer.byteLength+a),c=new Uint8Array(s);c.set(this.view.subarray(n,this.buffer.byteLength),o),this.buffer=s,this.view=c,this.offset+=a,this.markedOffset>=0&&(this.markedOffset+=a),this.limit+=a,n+=a}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),n-o),e.offset=e.limit,i&&(this.offset-=o),this},r.prependTo=function(e,t){return e.prepend(this,t),this},r.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},r.remaining=function(){return this.limit-this.offset},r.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},r.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),r=new Uint8Array(t);r.set(this.view),this.buffer=t,this.view=r}return this},r.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},r.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},r.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r=this.clone();return r.offset=e,r.limit=t,r},r.toBuffer=function(e){var t=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(!e&&0===t&&r===this.buffer.byteLength)return this.buffer;if(t===r)return n;var i=new ArrayBuffer(r-t);return new Uint8Array(i).set(new Uint8Array(this.buffer).subarray(t,r),0),i},r.toArrayBuffer=r.toBuffer,r.toString=function(e,t,r){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(r=t=e="utf8"),e){case"utf8":return this.toUTF8(t,r);case"base64":return this.toBase64(t,r);case"hex":return this.toHex(t,r);case"binary":return this.toBinary(t,r);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var u=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[],n=0,i=t.length;n<i;++n)r[t[n]]=n;return e.encode=function(e,r){for(var n,i;null!==(n=e());)r(t[n>>2&63]),i=(3&n)<<4,null!==(n=e())?(r(t[63&((i|=n>>4&15)|n>>4&15)]),i=(15&n)<<2,null!==(n=e())?(r(t[63&(i|n>>6&3)]),r(t[63&n])):(r(t[63&i]),r(61))):(r(t[63&i]),r(61),r(61))},e.decode=function(e,t){var n,i,o;function a(e){throw Error("Illegal character code: "+e)}for(;null!==(n=e());)if(void 0===(i=r[n])&&a(n),null!==(n=e())&&(void 0===(o=r[n])&&a(n),t(i<<2>>>0|(48&o)>>4),null!==(n=e()))){if(void 0===(i=r[n])){if(61===n)break;a(n)}if(t((15&o)<<4>>>0|(60&i)>>2),null!==(n=e())){if(void 0===(o=r[n])){if(61===n)break;a(n)}t((3&i)<<6>>>0|o)}}},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},e}();r.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return e<t?this.view[e++]:null}.bind(this),r=a()),r()},t.fromBase64=function(e,r){if("string"!=typeof e)throw TypeError("str");var n=new t(e.length/4*3,r),i=0;return u.decode(o(e),function(e){n.view[i++]=e}),n.limit=i,n},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},r.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var r=[],n=[];e<t;)r.push(this.view[e++]),r.length>=1024&&(n.push(String.fromCharCode.apply(String,r)),r=[]);return n.join("")+String.fromCharCode.apply(String,r)},t.fromBinary=function(e,r){if("string"!=typeof e)throw TypeError("str");for(var n,i=0,o=e.length,a=new t(o,r);i<o;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);a.view[i++]=n}return a.limit=o,a},r.toDebug=function(e){for(var t,r=-1,n=this.buffer.byteLength,i="",o="",a="";r<n;){if(-1!==r&&(i+=(t=this.view[r])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++r,e&&r>0&&r%16==0&&r!==n){for(;i.length<51;)i+=" ";a+=i+o+"\n",i=o=""}r===this.offset&&r===this.limit?i+=r===this.markedOffset?"!":"|":r===this.offset?i+=r===this.markedOffset?"[":"<":r===this.limit?i+=r===this.markedOffset?"]":">":i+=r===this.markedOffset?"'":e||0!==r&&r!==n?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";a+=i+o+"\n"}return e?a:i},t.fromDebug=function(e,r,n){for(var i,o,a=e.length,s=new t((a+1)/3|0,r,n),c=0,u=0,l=!1,d=!1,_=!1,f=!1,h=!1;c<a;){switch(i=e.charAt(c++)){case"!":if(!n){if(d||_||f){h=!0;break}d=_=f=!0}s.offset=s.markedOffset=s.limit=u,l=!1;break;case"|":if(!n){if(d||f){h=!0;break}d=f=!0}s.offset=s.limit=u,l=!1;break;case"[":if(!n){if(d||_){h=!0;break}d=_=!0}s.offset=s.markedOffset=u,l=!1;break;case"<":if(!n){if(d){h=!0;break}d=!0}s.offset=u,l=!1;break;case"]":if(!n){if(f||_){h=!0;break}f=_=!0}s.limit=s.markedOffset=u,l=!1;break;case">":if(!n){if(f){h=!0;break}f=!0}s.limit=u,l=!1;break;case"'":if(!n){if(_){h=!0;break}_=!0}s.markedOffset=u,l=!1;break;case" ":l=!1;break;default:if(!n&&l){h=!0;break}if(o=parseInt(i+e.charAt(c++),16),!n&&(isNaN(o)||o<0||o>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=o,l=!0}if(h)throw TypeError("Illegal str: Invalid symbol at "+c)}if(!n){if(!d||!f)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+a)}return s},r.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var r,n=new Array(t-e);e<t;)(r=this.view[e++])<16?n.push("0",r.toString(16)):n.push(r.toString(16));return n.join("")},t.fromHex=function(e,r,n){if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var i,o=e.length,a=new t(o/2|0,r),s=0,c=0;s<o;s+=2){if(i=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");a.view[c++]=i}return a.limit=c,a};var l=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<128?t(127&r):r<2048?(t(r>>6&31|192),t(63&r|128)):r<65536?(t(r>>12&15|224),t(r>>6&63|128),t(63&r|128)):(t(r>>18&7|240),t(r>>12&63|128),t(r>>6&63|128),t(63&r|128)),r=null},decodeUTF8:function(e,t){for(var r,n,i,o,a=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(r=e());)if(128&r)if(192==(224&r))null===(n=e())&&a([r,n]),t((31&r)<<6|63&n);else if(224==(240&r))(null===(n=e())||null===(i=e()))&&a([r,n,i]),t((15&r)<<12|(63&n)<<6|63&i);else{if(240!=(248&r))throw RangeError("Illegal starting byte: "+r);(null===(n=e())||null===(i=e())||null===(o=e()))&&a([r,n,i,o]),t((7&r)<<18|(63&n)<<12|(63&i)<<6|63&o)}else t(r)},UTF16toUTF8:function(e,t){for(var r,n=null;null!==(r=null!==n?n:e());)r>=55296&&r<=57343&&null!==(n=e())&&n>=56320&&n<=57343?(t(1024*(r-55296)+n-56320+65536),n=null):t(r);null!==n&&t(n)},UTF8toUTF16:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<=65535?t(r):(t(55296+((r-=65536)>>10)),t(r%1024+56320)),r=null},encodeUTF16toUTF8:function(t,r){e.UTF16toUTF8(t,function(t){e.encodeUTF8(t,r)})},decodeUTF8toUTF16:function(t,r){e.decodeUTF8(t,function(t){e.UTF8toUTF16(t,r)})},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,r=0;null!==(t=e());)r+=t<128?1:t<2048?2:t<65536?3:4;return r},calculateUTF16asUTF8:function(t){var r=0,n=0;return e.UTF16toUTF8(t,function(e){++r,n+=e<128?1:e<2048?2:e<65536?3:4}),[r,n]}};return e}();return r.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),r=a())}catch(r){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},t.fromUTF8=function(e,r,n){if(!n&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new t(l.calculateUTF16asUTF8(o(e),!0)[1],r,n),a=0;return l.encodeUTF16toUTF8(o(e),function(e){i.view[a++]=e}),i.limit=a,i},t}(function(){function e(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function t(e){return!0===(e&&e.__isLong__)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var r={},n={};function i(e,t){var i,o,s;return t?(s=0<=(e>>>=0)&&e<256)&&(o=n[e])?o:(i=a(e,(0|e)<0?-1:0,!0),s&&(n[e]=i),i):(s=-128<=(e|=0)&&e<128)&&(o=r[e])?o:(i=a(e,e<0?-1:0,!1),s&&(r[e]=i),i)}function o(e,t){if(isNaN(e)||!isFinite(e))return t?p:h;if(t){if(e<0)return p;if(e>=d)return T}else{if(e<=-_)return C;if(e+1>=_)return v}return e<0?o(-e,t).neg():a(e%l|0,e/l|0,t)}function a(t,r,n){return new e(t,r,n)}e.fromInt=i,e.fromNumber=o,e.fromBits=a;var s=Math.pow;function c(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return h;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return c(e.substring(1),t,r).neg();for(var i=o(s(r,8)),a=h,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),d=parseInt(e.substring(u,u+l),r);if(l<8){var _=o(s(r,l));a=a.mul(_).add(o(d))}else a=(a=a.mul(i)).add(o(d))}return a.unsigned=t,a}function u(t){return t instanceof e?t:"number"==typeof t?o(t):"string"==typeof t?c(t):a(t.low,t.high,t.unsigned)}e.fromString=c,e.fromValue=u;var l=4294967296,d=l*l,_=d/2,f=i(1<<24),h=i(0);e.ZERO=h;var p=i(0,!0);e.UZERO=p;var g=i(1);e.ONE=g;var R=i(1,!0);e.UONE=R;var m=i(-1);e.NEG_ONE=m;var v=a(-1,2147483647,!1);e.MAX_VALUE=v;var T=a(-1,-1,!0);e.MAX_UNSIGNED_VALUE=T;var C=a(0,-2147483648,!1);e.MIN_VALUE=C;var E=e.prototype;return E.toInt=function(){return this.unsigned?this.low>>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},E.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(C)){var t=o(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=o(s(e,6),this.unsigned),a=this,c="";;){var u=a.div(i),l=(a.sub(u.mul(i)).toInt()>>>0).toString(e);if((a=u).isZero())return l+c;for(;l.length<6;)l="0"+l;c=""+l+c}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},E.isZero=function(){return 0===this.high&&0===this.low},E.isNegative=function(){return!this.unsigned&&this.high<0},E.isPositive=function(){return this.unsigned||this.high>=0},E.isOdd=function(){return!(1&~this.low)},E.isEven=function(){return!(1&this.low)},E.equals=function(e){return t(e)||(e=u(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},E.eq=E.equals,E.notEquals=function(e){return!this.eq(e)},E.neq=E.notEquals,E.lessThan=function(e){return this.comp(e)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(e){return this.comp(e)<=0},E.lte=E.lessThanOrEqual,E.greaterThan=function(e){return this.comp(e)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(e){return this.comp(e)>=0},E.gte=E.greaterThanOrEqual,E.compare=function(e){if(t(e)||(e=u(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(g)},E.neg=E.negate,E.add=function(e){t(e)||(e=u(e));var r=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,c=65535&e.high,l=e.low>>>16,d=0,_=0,f=0,h=0;return f+=(h+=o+(65535&e.low))>>>16,_+=(f+=i+l)>>>16,d+=(_+=n+c)>>>16,d+=r+s,a((f&=65535)<<16|(h&=65535),(d&=65535)<<16|(_&=65535),this.unsigned)},E.subtract=function(e){return t(e)||(e=u(e)),this.add(e.neg())},E.sub=E.subtract,E.multiply=function(e){if(this.isZero())return h;if(t(e)||(e=u(e)),e.isZero())return h;if(this.eq(C))return e.isOdd()?C:h;if(e.eq(C))return this.isOdd()?C:h;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(f)&&e.lt(f))return o(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,n=65535&this.high,i=this.low>>>16,s=65535&this.low,c=e.high>>>16,l=65535&e.high,d=e.low>>>16,_=65535&e.low,p=0,g=0,R=0,m=0;return R+=(m+=s*_)>>>16,g+=(R+=i*_)>>>16,R&=65535,g+=(R+=s*d)>>>16,p+=(g+=n*_)>>>16,g&=65535,p+=(g+=i*d)>>>16,g&=65535,p+=(g+=s*l)>>>16,p+=r*_+n*d+i*l+s*c,a((R&=65535)<<16|(m&=65535),(p&=65535)<<16|(g&=65535),this.unsigned)},E.mul=E.multiply,E.divide=function(e){if(t(e)||(e=u(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?p:h;var r,n,i;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return p;if(e.gt(this.shru(1)))return R;i=p}else{if(this.eq(C))return e.eq(g)||e.eq(m)?C:e.eq(C)?g:(r=this.shr(1).div(e).shl(1)).eq(h)?e.isNegative()?g:m:(n=this.sub(e.mul(r)),i=r.add(n.div(e)));if(e.eq(C))return this.unsigned?p:h;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();i=h}for(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:s(2,a-48),l=o(r),d=l.mul(e);d.isNegative()||d.gt(n);)d=(l=o(r-=c,this.unsigned)).mul(e);l.isZero()&&(l=g),i=i.add(l),n=n.sub(d)}return i},E.div=E.divide,E.modulo=function(e){return t(e)||(e=u(e)),this.sub(this.div(e).mul(e))},E.mod=E.modulo,E.not=function(){return a(~this.low,~this.high,this.unsigned)},E.and=function(e){return t(e)||(e=u(e)),a(this.low&e.low,this.high&e.high,this.unsigned)},E.or=function(e){return t(e)||(e=u(e)),a(this.low|e.low,this.high|e.high,this.unsigned)},E.xor=function(e){return t(e)||(e=u(e)),a(this.low^e.low,this.high^e.high,this.unsigned)},E.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?a(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):a(0,this.low<<e-32,this.unsigned)},E.shl=E.shiftLeft,E.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?a(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):a(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var r=this.high;return e<32?a(this.low>>>e|r<<32-e,r>>>e,this.unsigned):a(32===e?r:r>>>e-32,0,this.unsigned)},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},E.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},E.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},E.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e}());return t.ByteBuffer=r,t.Long=r.Long||null,t.VERSION="5.0.3",t.WIRE_TYPES={},t.WIRE_TYPES.VARINT=0,t.WIRE_TYPES.BITS64=1,t.WIRE_TYPES.LDELIM=2,t.WIRE_TYPES.STARTGROUP=3,t.WIRE_TYPES.ENDGROUP=4,t.WIRE_TYPES.BITS32=5,t.PACKABLE_WIRE_TYPES=[t.WIRE_TYPES.VARINT,t.WIRE_TYPES.BITS64,t.WIRE_TYPES.BITS32],t.TYPES={int32:{name:"int32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.ZERO:void 0},uint64:{name:"uint64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.UZERO:void 0},sint64:{name:"sint64",wireType:t.WIRE_TYPES.VARINT,defaultValue:t.Long?t.Long.ZERO:void 0},bool:{name:"bool",wireType:t.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:t.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:t.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:t.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:t.WIRE_TYPES.BITS64,defaultValue:t.Long?t.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:t.WIRE_TYPES.BITS64,defaultValue:t.Long?t.Long.ZERO:void 0},float:{name:"float",wireType:t.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:t.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:t.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:t.WIRE_TYPES.STARTGROUP,defaultValue:null}},t.MAP_KEY_TYPES=[t.TYPES.int32,t.TYPES.sint32,t.TYPES.sfixed32,t.TYPES.uint32,t.TYPES.fixed32,t.TYPES.int64,t.TYPES.sint64,t.TYPES.sfixed64,t.TYPES.uint64,t.TYPES.fixed64,t.TYPES.bool,t.TYPES.string,t.TYPES.bytes],t.ID_MIN=1,t.ID_MAX=536870911,t.convertFieldsToCamelCase=!1,t.populateAccessors=!0,t.populateDefaults=!0,t.Util=((e={}).IS_NODE=!("object"!==("undefined"==typeof process?"undefined":C(process))||process+""!="[object process]"||process.browser),e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,function(e,t){return t.toUpperCase()})},e),t.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,FQTYPEREF:/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,NUMBER:/^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,NUMBER_DEC:/^(?:[1-9][0-9]*|0)$/,NUMBER_HEX:/^0[xX][0-9a-fA-F]+$/,NUMBER_OCT:/^0[0-7]+$/,NUMBER_FLT:/^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,BOOL:/^(?:true|false)$/i,ID:/^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,NEGID:/^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,WHITESPACE:/\s/,STRING:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,STRING_DQ:/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,STRING_SQ:/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g},t.DotProto=function(e,t){var r={},n=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},i=n.prototype;i._readString=function(){var e='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;e.lastIndex=this.index-1;var r=e.exec(this.source);if(!r)throw Error("unterminated string");return this.index=e.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,r[1]},i.next=function(){if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();var e,r,n;do{for(e=!1;t.WHITESPACE.test(n=this.source.charAt(this.index));)if("\n"===n&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(n=this.source.charAt(this.index)))return"/";do{if("\n"===n&&++this.line,++this.index===this.source.length)return null;r=n,n=this.source.charAt(this.index)}while("*"!==r||"/"!==n);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;var i=this.index;if(t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;var o=this.source.substring(this.index,this.index=i);return'"'!==o&&"'"!==o||(this._stringOpen=o),o},i.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},i.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},i.omit=function(e){return this.peek()===e&&(this.next(),!0)},i.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},r.Tokenizer=n;var o=function(e){this.tn=new n(e),this.proto3=!1},a=o.prototype;function s(e,r){var n=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))n=parseInt(e);else if(t.NUMBER_HEX.test(e))n=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);n=parseInt(e.substring(1),8)}if(n=i*n|0,!r&&n<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return n}function c(e){var r=1;if("-"==e.charAt(0)&&(r=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return r*parseInt(e,10);if(t.NUMBER_HEX.test(e))return r*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return r*parseInt(e.substring(1),8);if("inf"===e)return r*(1/0);if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return r*parseFloat(e);throw Error("illegal number value: "+(r<0?"-":"")+e)}function u(e,t,r){void 0===e[t]?e[t]=r:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(r))}return a.parse=function(){var e,r,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");("public"===(e=this.tn.peek())||(r="weak"===e))&&this.tn.next(),e=this._readString(),this.tn.skip(";"),r||n.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},a._readString=function(){var e,t,r="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);r+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return r},a._readValue=function(e){var r=this.tn.peek();if('"'===r||"'"===r)return this._readString();if(this.tn.next(),t.NUMBER.test(r))return c(r);if(t.BOOL.test(r))return"true"===r.toLowerCase();if(e&&t.TYPEREF.test(r))return r;throw Error("illegal value: "+r)},a._parseOption=function(e,r){var n=this.tn.next(),i=!1;if("("===n&&(i=!0,n=this.tn.next()),!t.TYPEREF.test(n))throw Error("illegal option name: "+n);var o=n;i&&(this.tn.skip(")"),o="("+o+")",n=this.tn.peek(),t.FQTYPEREF.test(n)&&(o+=n,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,o),r||this.tn.skip(";")},a._parseOptionValue=function(e,r){var n=this.tn.peek();if("{"!==n)u(e.options,r,this._readValue(!0));else for(this.tn.skip("{");"}"!==(n=this.tn.next());){if(!t.NAME.test(n))throw Error("illegal option name: "+r+"."+n);this.tn.omit(":")?u(e.options,r+"."+n,this._readValue(!0)):this._parseOptionValue(e,r+"."+n)}},a._parseService=function(e){var r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);var n={name:r,rpc:{},options:{}};for(this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},a._parseServiceRPC=function(e){var r="rpc",n=this.tn.next();if(!t.NAME.test(n))throw Error("illegal rpc service method name: "+n);var i=n,o={request:null,response:null,request_stream:!1,response_stream:!1,options:{}};if(this.tn.skip("("),"stream"===(n=this.tn.next()).toLowerCase()&&(o.request_stream=!0,n=this.tn.next()),!t.TYPEREF.test(n))throw Error("illegal rpc service request type: "+n);if(o.request=n,this.tn.skip(")"),"returns"!==(n=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+n);if(this.tn.skip("("),"stream"===(n=this.tn.next()).toLowerCase()&&(o.response_stream=!0,n=this.tn.next()),o.response=n,this.tn.skip(")"),"{"===(n=this.tn.peek())){for(this.tn.next();"}"!==(n=this.tn.next());){if("option"!==n)throw Error("illegal rpc service token: "+n);this._parseOption(o)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[r]&&(e[r]={}),e[r][i]=o},a._parseMessage=function(e,r){var n=!!r,i=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(i))throw Error("illegal "+(n?"group":"message")+" name: "+i);for(o.name=i,n&&(this.tn.skip("="),r.id=s(this.tn.next()),o.isGroup=!0),"["===(i=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(o,i);else if("oneof"===i)this._parseMessageOneOf(o);else if("enum"===i)this._parseEnum(o);else if("message"===i)this._parseMessage(o);else if("option"===i)this._parseOption(o);else if("service"===i)this._parseService(o);else if("extensions"===i)o.hasOwnProperty("extensions")?o.extensions=o.extensions.concat(this._parseExtensionRanges()):o.extensions=this._parseExtensionRanges();else if("reserved"===i)this._parseIgnored();else if("extend"===i)this._parseExtend(o);else{if(!t.TYPEREF.test(i))throw Error("illegal message token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(o,"optional",i)}return this.tn.omit(";"),e.messages.push(o),o},a._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},a._parseMessageField=function(e,r,n){if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);var i,o={rule:r,type:"",name:"",options:{},id:0};if("map"===r){if(n)throw Error("illegal type: "+n);if(this.tn.skip("<"),i=this.tn.next(),!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.keytype=i,this.tn.skip(","),i=this.tn.next(),!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field: "+i);if(o.type=i,this.tn.skip(">"),i=this.tn.next(),!t.NAME.test(i))throw Error("illegal message field name: "+i);o.name=i,this.tn.skip("="),o.id=s(this.tn.next()),"["===(i=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(n=void 0!==n?n:this.tn.next())){var a=this._parseMessage(e,o);if(!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(n)&&!t.TYPEREF.test(n))throw Error("illegal message field type: "+n);if(o.type=n,i=this.tn.next(),!t.NAME.test(i))throw Error("illegal message field name: "+i);o.name=i,this.tn.skip("="),o.id=s(this.tn.next()),"["===(i=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},a._parseMessageOneOf=function(e){var r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal oneof name: "+r);var n,i=r,o=[];for(this.tn.skip("{");"}"!==(r=this.tn.next());)(n=this._parseMessageField(e,"optional",r)).oneof=i,o.push(n.id);this.tn.omit(";"),e.oneofs[i]=o},a._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},a._parseEnum=function(e){var r={name:"",values:[],options:{}},n=this.tn.next();if(!t.NAME.test(n))throw Error("illegal name: "+n);for(r.name=n,this.tn.skip("{");"}"!==(n=this.tn.next());)if("option"===n)this._parseOption(r);else{if(!t.NAME.test(n))throw Error("illegal name: "+n);this.tn.skip("=");var i={name:n,id:s(this.tn.next(),!0)};"["===(n=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},a._parseExtensionRanges=function(){var t,r,n,i=[];do{for(r=[];;){switch(t=this.tn.next()){case"min":n=e.ID_MIN;break;case"max":n=e.ID_MAX;break;default:n=c(t)}if(r.push(n),2===r.length)break;if("to"!==this.tn.peek()){r.push(n);break}this.tn.next()}i.push(r)}while(this.tn.omit(","));return this.tn.skip(";"),i},a._parseExtend=function(e){var r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);var n={ref:r,fields:[]};for(this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},a.toString=function(){return"Parser at line "+this.tn.line},r.Parser=o,r}(t,t.Lang),t.Reflect=function(e){var t={},n=function(e,t,r){this.builder=e,this.parent=t,this.name=r,this.className},i=n.prototype;i.fqn=function(){for(var e=this.name,t=this;;){if(null==(t=t.parent))break;e=t.name+"."+e}return e},i.toString=function(e){return(e?this.className+" ":"")+this.fqn()},i.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},t.T=n;var o=function(e,t,r,i,o){n.call(this,e,t,r),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=o||"proto2"},a=o.prototype=Object.create(n.prototype);a.getChildren=function(e){if(null==(e=e||null))return this.children.slice();for(var t=[],r=0,n=this.children.length;r<n;++r)this.children[r]instanceof e&&t.push(this.children[r]);return t},a.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof l.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof l.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},a.getChild=function(e){for(var t="number"==typeof e?"id":"name",r=0,n=this.children.length;r<n;++r)if(this.children[r][t]===e)return this.children[r];return null},a.resolve=function(e,r){var n,i="string"==typeof e?e.split("."):e,o=this,a=0;if(""===i[a]){for(;null!==o.parent;)o=o.parent;a++}do{do{if(!(o instanceof t.Namespace)){o=null;break}if(!(n=o.getChild(i[a]))||!(n instanceof t.T)||r&&!(n instanceof t.Namespace)){o=null;break}o=n,a++}while(a<i.length);if(null!=o)break;if(null!==this.parent)return this.parent.resolve(e,r)}while(null!=o);return o},a.qn=function(e){var r=[],n=e;do{r.unshift(n.name),n=n.parent}while(null!==n);for(var i=1;i<=r.length;i++){var o=r.slice(r.length-i);if(e===this.resolve(o,e instanceof t.Namespace))return o.join(".")}return e.fqn()},a.build=function(){for(var e,t={},r=this.children,n=0,i=r.length;n<i;++n)(e=r[n])instanceof o&&(t[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(t,"$options",{value:this.buildOpt()}),t},a.buildOpt=function(){for(var e={},t=Object.keys(this.options),r=0,n=t.length;r<n;++r){var i=t[r],o=this.options[t[r]];e[i]=o}return e},a.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},t.Namespace=o;var s=function(t,r,n,i,o){if(this.type=t,this.resolvedType=r,this.isMapKey=n,this.syntax=i,this.name=o,n&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},c=s.prototype;function u(t,r){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===r?t.unsigned:r);if("string"==typeof t)return e.Long.fromString(t,r||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,r||!1);throw Error("not convertible to Long")}s.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new r(0):t.defaultValue},c.toString=function(){return(this.name||"")+(this.isMapKey?"map":"value")+" element"},c.verifyValue=function(t){var n=this;function i(e,t){throw Error("Illegal value for "+n.toString(!0)+" of type "+n.type.name+": "+e+" ("+t+")")}switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof t||t==t&&t%1!=0)&&i(C(t),"not an integer"),t>4294967295?0|t:t;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof t||t==t&&t%1!=0)&&i(C(t),"not an integer"),t<0?t>>>0:t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return u(t,!1)}catch(e){i(C(t),e.message)}else i(C(t),"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return u(t,!0)}catch(e){i(C(t),e.message)}else i(C(t),"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof t&&i(C(t),"not a boolean"),t;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof t&&i(C(t),"not a number"),t;case e.TYPES.string:return"string"==typeof t||t&&t instanceof String||i(C(t),"not a string"),""+t;case e.TYPES.bytes:return r.isByteBuffer(t)?t:r.wrap(t,"base64");case e.TYPES.enum:var o=this.resolvedType.getChildren(e.Reflect.Enum.Value);for(s=0;s<o.length;s++){if(o[s].name==t)return o[s].id;if(o[s].id==t)return o[s].id}if("proto3"===this.syntax)return("number"!=typeof t||t==t&&t%1!=0)&&i(C(t),"not an integer"),(t>4294967295||t<0)&&i(C(t),"not in range for uint32"),t;i(t,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(t&&"object"===C(t)||i(C(t),"object expected"),t instanceof this.resolvedType.clazz)return t;if(t instanceof e.Builder.Message){var a={};for(var s in t)t.hasOwnProperty(s)&&(a[s]=t[s]);t=a}return new this.resolvedType.clazz(t)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+t+" (undefined type "+this.type+")")},c.calculateLength=function(t,n){if(null===n)return 0;var i;switch(this.type){case e.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case e.TYPES.uint32:return r.calculateVarint32(n);case e.TYPES.sint32:return r.calculateVarint32(r.zigZagEncode32(n));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return r.calculateVarint64(n);case e.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return r.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return i=r.calculateUTF8Bytes(n),r.calculateVarint32(i)+i;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return i=this.resolvedType.calculate(n),r.calculateVarint32(i)+i;case e.TYPES.group:return(i=this.resolvedType.calculate(n))+r.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},c.encodeValue=function(t,n,i){if(null===n)return i;switch(this.type){case e.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case e.TYPES.uint32:i.writeVarint32(n);break;case e.TYPES.sint32:i.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:i.writeUint32(n);break;case e.TYPES.sfixed32:i.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(n);break;case e.TYPES.sint64:i.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:i.writeUint64(n);break;case e.TYPES.sfixed64:i.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case e.TYPES.enum:i.writeVarint32(n);break;case e.TYPES.float:i.writeFloat32(n);break;case e.TYPES.double:i.writeFloat64(n);break;case e.TYPES.string:i.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");var o=n.offset;i.writeVarint32(n.remaining()),i.append(n),n.offset=o;break;case e.TYPES.message:var a=(new r).LE();this.resolvedType.encode(n,a),i.writeVarint32(a.offset),i.append(a.flip());break;case e.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},c.decode=function(t,r,n){if(r!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(o=t.readVarint32(),t.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+t.remaining());return(i=t.clone()).limit=i.offset+o,t.offset+=o,i;case e.TYPES.message:return o=t.readVarint32(),this.resolvedType.decode(t,o);case e.TYPES.group:return this.resolvedType.decode(t,-1,n)}throw Error("[INTERNAL] Illegal decode type")},c.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return r.fromBinary(t)}},c.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},t.Element=s;var l=function(e,t,r,n,i,a){o.call(this,e,t,r,n,a),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},d=l.prototype=Object.create(o.prototype);function _(t,r){var n=r.readVarint32(),i=7&n,o=n>>>3;switch(i){case e.WIRE_TYPES.VARINT:do{n=r.readUint8()}while(!(128&~n));break;case e.WIRE_TYPES.BITS64:r.offset+=8;break;case e.WIRE_TYPES.LDELIM:n=r.readVarint32(),r.offset+=n;break;case e.WIRE_TYPES.STARTGROUP:_(o,r);break;case e.WIRE_TYPES.ENDGROUP:if(o===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:r.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+i)}return!0}d.build=function(t){if(this.clazz&&!t)return this.clazz;var n=function(e,t){var n=t.getChildren(e.Reflect.Message.Field),i=t.getChildren(e.Reflect.Message.OneOf),o=function(a,s){e.Builder.Message.call(this);for(var c=0,u=i.length;c<u;++c)this[i[c].name]=null;for(c=0,u=n.length;c<u;++c){var l=n[c];this[l.name]=l.repeated?[]:l.map?new e.Map(l):null,!l.required&&"proto3"!==t.syntax||null===l.defaultValue||(this[l.name]=l.defaultValue)}var d;if(arguments.length>0)if(1!==arguments.length||null===a||"object"!==C(a)||!("function"!=typeof a.encode||a instanceof o)||Array.isArray(a)||a instanceof e.Map||r.isByteBuffer(a)||a instanceof ArrayBuffer||e.Long&&a instanceof e.Long)for(c=0,u=arguments.length;c<u;++c)void 0!==(d=arguments[c])&&this.$set(n[c].name,d);else this.$set(a)},a=o.prototype=Object.create(e.Builder.Message.prototype);a.add=function(r,n,i){var o=t._fieldsByName[r];if(!i){if(!o)throw Error(this+"#"+r+" is undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+r+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+r+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[r]&&(this[r]=[]),this[r].push(n),this},a.$add=a.add,a.set=function(r,n,i){if(r&&"object"===C(r)){for(var o in i=n,r)r.hasOwnProperty(o)&&void 0!==(n=r[o])&&void 0===t._oneofsByName[o]&&this.$set(o,n,i);return this}var a=t._fieldsByName[r];if(i)this[r]=n;else{if(!a)throw Error(this+"#"+r+" is not a field: undefined");if(!(a instanceof e.Reflect.Message.Field))throw Error(this+"#"+r+" is not a field: "+a.toString(!0));this[a.name]=n=a.verifyValue(n)}if(a&&a.oneof){var s=this[a.oneof.name];null!==n?(null!==s&&s!==a.name&&(this[s]=null),this[a.oneof.name]=a.name):s===r&&(this[a.oneof.name]=null)}return this},a.$set=a.set,a.get=function(r,n){if(n)return this[r];var i=t._fieldsByName[r];if(!(i&&i instanceof e.Reflect.Message.Field))throw Error(this+"#"+r+" is not a field: undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+r+" is not a field: "+i.toString(!0));return this[i.name]},a.$get=a.get;for(var s=0;s<n.length;s++){var c=n[s];c instanceof e.Reflect.Message.ExtensionField||t.builder.options.populateAccessors&&function(e){var r=e.originalName.replace(/(_[a-zA-Z])/g,function(e){return e.toUpperCase().replace("_","")});r=r.substring(0,1).toUpperCase()+r.substring(1);var n=e.originalName.replace(/([A-Z])/g,function(e){return"_"+e}),i=function(t,r){return this[e.name]=r?t:e.verifyValue(t),this},o=function(){return this[e.name]};null===t.getChild("set"+r)&&(a["set"+r]=i),null===t.getChild("set_"+n)&&(a["set_"+n]=i),null===t.getChild("get"+r)&&(a["get"+r]=o),null===t.getChild("get_"+n)&&(a["get_"+n]=o)}(c)}function u(t,n,i,o){if(null===t||"object"!==C(t)){if(o&&o instanceof e.Reflect.Enum){var a=e.Reflect.Enum.getName(o.object,t);if(null!==a)return a}return t}if(r.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return i?t.toString():e.Long.fromValue(t);var s;if(Array.isArray(t))return s=[],t.forEach(function(e,t){s[t]=u(e,n,i,o)}),s;if(s={},t instanceof e.Map){for(var c=t.entries(),l=c.next();!l.done;l=c.next())s[t.keyElem.valueToString(l.value[0])]=u(l.value[1],n,i,t.valueElem.resolvedType);return s}var d=t.$type,_=void 0;for(var f in t)t.hasOwnProperty(f)&&(d&&(_=d.getChild(f))?s[f]=u(t[f],n,i,_.resolvedType):s[f]=u(t[f],n,i));return s}return a.encode=function(e,n){"boolean"==typeof e&&(n=e,e=void 0);var i=!1;e||(e=new r,i=!0);var o=e.littleEndian;try{return t.encode(this,e.LE(),n),(i?e.flip():e).LE(o)}catch(t){throw e.LE(o),t}},o.encode=function(e,t,r){return new o(e).encode(t,r)},a.calculate=function(){return t.calculate(this)},a.encodeDelimited=function(e,n){var i=!1;e||(e=new r,i=!0);var o=(new r).LE();return t.encode(this,o,n).flip(),e.writeVarint32(o.remaining()),e.append(o),i?e.flip():e},a.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},a.toArrayBuffer=a.encodeAB,a.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},a.toBuffer=a.encodeNB,a.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},a.toBase64=a.encode64,a.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},a.toHex=a.encodeHex,a.toRaw=function(e,t){return u(this,!!e,!!t,this.$type)},a.encodeJSON=function(){return JSON.stringify(u(this,!0,!0,this.$type))},o.decode=function(e,n,i){"string"==typeof n&&(i=n,n=-1),"string"==typeof e?e=r.wrap(e,i||"base64"):r.isByteBuffer(e)||(e=r.wrap(e));var o=e.littleEndian;try{var a=t.decode(e.LE(),n);return e.LE(o),a}catch(t){throw e.LE(o),t}},o.decodeDelimited=function(e,n){if("string"==typeof e?e=r.wrap(e,n||"base64"):r.isByteBuffer(e)||(e=r.wrap(e)),e.remaining()<1)return null;var i=e.offset,o=e.readVarint32();if(e.remaining()<o)return e.offset=i,null;try{var a=t.decode(e.slice(e.offset,e.offset+o).LE());return e.offset+=o,a}catch(t){throw e.offset+=o,t}},o.decode64=function(e){return o.decode(e,"base64")},o.decodeHex=function(e){return o.decode(e,"hex")},o.decodeJSON=function(e){return new o(JSON.parse(e))},a.toString=function(){return t.toString()},Object.defineProperty&&(Object.defineProperty(o,"$options",{value:t.buildOpt()}),Object.defineProperty(a,"$options",{value:o.$options}),Object.defineProperty(o,"$type",{value:t}),Object.defineProperty(a,"$type",{value:t})),o}(e,this);this._fields=[],this._fieldsById={},this._fieldsByName={},this._oneofsByName={};for(var i,o=0,a=this.children.length;o<a;o++)if((i=this.children[o])instanceof g||i instanceof l||i instanceof v){if(n.hasOwnProperty(i.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+i.toString(!0)+" cannot override static property '"+i.name+"'");n[i.name]=i.build()}else if(i instanceof l.Field)i.build(),this._fields.push(i),this._fieldsById[i.id]=i,this._fieldsByName[i.name]=i;else if(i instanceof l.OneOf)this._oneofsByName[i.name]=i;else if(!(i instanceof l.OneOf||i instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=n},d.encode=function(e,t,r){for(var n,i,o=null,a=0,s=this._fields.length;a<s;++a)i=e[(n=this._fields[a]).name],n.required&&null===i?null===o&&(o=n):n.encode(r?i:n.verifyValue(i),t,e);if(null!==o){var c=Error("Missing at least one required field for "+this.toString(!0)+": "+o);throw c.encoded=t,c}return t},d.calculate=function(e){for(var t,r,n=0,i=0,o=this._fields.length;i<o;++i){if(r=e[(t=this._fields[i]).name],t.required&&null===r)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);n+=t.calculate(r,e)}return n},d.decode=function(t,r,n){"number"!=typeof r&&(r=-1);for(var i,o,a,s,c=t.offset,u=new this.clazz;t.offset<c+r||-1===r&&t.remaining()>0;){if(a=(i=t.readVarint32())>>>3,(o=7&i)===e.WIRE_TYPES.ENDGROUP){if(a!==n)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(n?n+" expected":"not a group")+")");break}if(s=this._fieldsById[a]){if(s.repeated&&!s.options.packed)u[s.name].push(s.decode(o,t));else if(s.map){var l=s.decode(o,t);u[s.name].set(l[0],l[1])}else if(u[s.name]=s.decode(o,t),s.oneof){var d=u[s.oneof.name];null!==d&&d!==s.name&&(u[d]=null),u[s.oneof.name]=s.name}}else switch(o){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:var f=t.readVarint32();t.offset+=f;break;case e.WIRE_TYPES.STARTGROUP:for(;_(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+o)}}for(var h=0,p=this._fields.length;h<p;++h)if(null===u[(s=this._fields[h]).name])if("proto3"===this.syntax)u[s.name]=s.defaultValue;else{if(s.required){var g=Error("Missing at least one required field for "+this.toString(!0)+": "+s.name);throw g.decoded=u,g}e.populateDefaults&&null!==s.defaultValue&&(u[s.name]=s.defaultValue)}return u},t.Message=l;var f=function(t,r,i,o,a,s,c,u,d,_){n.call(this,t,r,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=o||null,this.type=a,this.resolvedType=null,this.id=c,this.options=u||{},this.defaultValue=null,this.oneof=d||null,this.syntax=_||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof l.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},h=f.prototype=Object.create(n.prototype);h.build=function(){this.element=new s(this.type,this.resolvedType,!1,this.syntax,this.name),this.map&&(this.keyElement=new s(this.keyType,void 0,!0,this.syntax,this.name)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=s.defaultFieldValue(this.type)},h.verifyValue=function(t,r){r=r||!1;var n,i=this;function o(e,t){throw Error("Illegal value for "+i.toString(!0)+" of type "+i.type.name+": "+e+" ("+t+")")}if(null===t)return this.required&&o(C(t),"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&o(C(t),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!r){Array.isArray(t)||(t=[t]);var a=[];for(n=0;n<t.length;n++)a.push(this.element.verifyValue(t[n]));return a}return this.map&&!r?t instanceof e.Map?t:(t instanceof Object||o(C(t),"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&o(C(t),"no array expected"),this.element.verifyValue(t))},h.hasWirePresence=function(t,r){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&r[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},h.encode=function(t,n,i){if(null===this.type||"object"!==C(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{var o;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1);var a=n.offset;for(o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);var s=n.offset-a,c=r.calculateVarint32(s);if(c>1){var u=n.slice(a,n.offset);a+=c-1,n.offset=a,n.append(u)}n.writeVarint32(s,a-c)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach(function(t,i,o){var a=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(a),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)},this):this.hasWirePresence(t,i)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},h.calculate=function(t,n){if(t=this.verifyValue(t),null===this.type||"object"!==C(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;var i=0;try{var o,a;if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),a=0,o=0;o<t.length;o++)a+=this.element.calculateLength(this.id,t[o]);i+=r.calculateVarint32(a),i+=a}else for(o=0;o<t.length;o++)i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t[o]);else this.map?t.forEach(function(t,n,o){var a=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=r.calculateVarint32(a),i+=a},this):this.hasWirePresence(t,n)&&(i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return i},h.decode=function(t,r,n){var i,o;if(!(!this.map&&t==this.type.wireType||!n&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!n){o=r.readVarint32(),o=r.offset+o;for(var a=[];r.offset<o;)a.push(this.decode(this.type.wireType,r,!0));return a}if(this.map){var c=s.defaultFieldValue(this.keyType);if(i=s.defaultFieldValue(this.type),o=r.readVarint32(),r.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+r.remaining());var u=r.clone();for(u.limit=u.offset+o,r.offset+=o;u.remaining()>0;){var l=u.readVarint32();t=7&l;var d=l>>>3;if(1===d)c=this.keyElement.decode(u,t,d);else{if(2!==d)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,t,d)}}return[c,i]}return this.element.decode(r,t,this.id)},t.Message.Field=f;var p=function(e,t,r,n,i,o,a){f.call(this,e,t,r,null,n,i,o,a),this.extension};p.prototype=Object.create(f.prototype),t.Message.ExtensionField=p;t.Message.OneOf=function(e,t,r){n.call(this,e,t,r),this.fields=[]};var g=function(e,t,r,n,i){o.call(this,e,t,r,n,i),this.className="Enum",this.object=null};g.getName=function(e,t){for(var r,n=Object.keys(e),i=0;i<n.length;++i)if(e[r=n[i]]===t)return r;return null},(g.prototype=Object.create(o.prototype)).build=function(t){if(this.object&&!t)return this.object;for(var r=new e.Builder.Enum,n=this.getChildren(g.Value),i=0,o=n.length;i<o;++i)r[n[i].name]=n[i].id;return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=r},t.Enum=g;var R=function(e,t,r,i){n.call(this,e,t,r),this.className="Enum.Value",this.id=i};R.prototype=Object.create(n.prototype),t.Enum.Value=R;var m=function(e,t,r,i){n.call(this,e,t,r),this.field=i};m.prototype=Object.create(n.prototype),t.Extension=m;var v=function(e,t,r,n){o.call(this,e,t,r,n),this.className="Service",this.clazz=null};(v.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){for(var n=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,r){setTimeout(r.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},i=n.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod),a=0;a<o.length;a++)(function(e){i[e.name]=function(n,i){try{try{n=e.resolvedRequestType.clazz.decode(r.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!==C(n))throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,function(r,n){if(r)i(r);else{null===n&&(n="");try{n=e.resolvedResponseType.clazz.decode(n)}catch(e){}n&&n instanceof e.resolvedResponseType.clazz?i(null,n):i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}})}catch(e){setTimeout(i.bind(this,e),0)}},n[e.name]=function(t,r,i){new n(t)[e.name](r,i)},Object.defineProperty&&(Object.defineProperty(n[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(i[e.name],"$options",{value:n[e.name].$options}))})(o[a]);return Object.defineProperty&&(Object.defineProperty(n,"$options",{value:t.buildOpt()}),Object.defineProperty(i,"$options",{value:n.$options}),Object.defineProperty(n,"$type",{value:t}),Object.defineProperty(i,"$type",{value:t})),n}(e,this)},t.Service=v;var T=function(e,t,r,i){n.call(this,e,t,r),this.className="Service.Method",this.options=i||{}};(T.prototype=Object.create(n.prototype)).buildOpt=a.buildOpt,t.Service.Method=T;var E=function(e,t,r,n,i,o,a,s){T.call(this,e,t,r,s),this.className="Service.RPCMethod",this.requestName=n,this.responseName=i,this.requestStream=o,this.responseStream=a,this.resolvedRequestType=null,this.resolvedResponseType=null};return E.prototype=Object.create(T.prototype),t.Service.RPCMethod=E,t}(t),t.Builder=function(e,t,r){var n=function(e){this.ns=new r.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},i=n.prototype;function o(e){e.messages&&e.messages.forEach(function(t){t.syntax=e.syntax,o(t)}),e.enums&&e.enums.forEach(function(t){t.syntax=e.syntax})}return n.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},n.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},n.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},n.isService=function(e){return!("string"!=typeof e.name||"object"!==C(e.rpc)||!e.rpc)},n.isExtend=function(e){return"string"==typeof e.ref},i.reset=function(){return this.ptr=this.ns,this},i.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach(function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new r.Namespace(this,this.ptr,e)),this.ptr=t},this),this},i.create=function(t){if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(var i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){var o=t.shift();if(n.isMessage(o)){var a=new r.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),s={};o.oneofs&&Object.keys(o.oneofs).forEach(function(e){a.addChild(s[e]=new r.Message.OneOf(this,a,e))},this),o.fields&&o.fields.forEach(function(e){if(null!==a.getChild(0|e.id))throw Error("duplicate or invalid field id in "+a.name+": "+e.id);if(e.options&&"object"!==C(e.options))throw Error("illegal field options in "+a.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=s[e.oneof]))throw Error("illegal oneof in "+a.name+"#"+e.name+": "+e.oneof);e=new r.Message.Field(this,a,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),a.addChild(e)},this);var c=[];if(o.enums&&o.enums.forEach(function(e){c.push(e)}),o.messages&&o.messages.forEach(function(e){c.push(e)}),o.services&&o.services.forEach(function(e){c.push(e)}),o.extensions&&("number"==typeof o.extensions[0]?a.extensions=[o.extensions]:a.extensions=o.extensions),this.ptr.addChild(a),c.length>0){i.push(t),t=c,c=null,this.ptr=a,a=null;continue}c=null}else if(n.isEnum(o))a=new r.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach(function(e){a.addChild(new r.Enum.Value(this,a,e.name,e.id))},this),this.ptr.addChild(a);else if(n.isService(o))a=new r.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach(function(e){var t=o.rpc[e];a.addChild(new r.Service.RPCMethod(this,a,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))},this),this.ptr.addChild(a);else{if(!n.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(a=this.ptr.resolve(o.ref,!0))o.fields.forEach(function(t){if(null!==a.getChild(0|t.id))throw Error("duplicate extended field id in "+a.name+": "+t.id);if(a.extensions){var n=!1;if(a.extensions.forEach(function(e){t.id>=e[0]&&t.id<=e[1]&&(n=!0)}),!n)throw Error("illegal extended field id in "+a.name+": "+t.id+" (not within valid ranges)")}var i=t.name;this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i));var o=new r.Message.ExtensionField(this,a,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),s=new r.Extension(this,this.ptr,t.name,o);o.extension=s,this.ptr.addChild(s),a.addChild(o)},this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,a=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},i.import=function(t,r){var n="/";if("string"==typeof r){if(e.Util.IS_NODE&&(r=require("path").resolve(r)),!0===this.files[r])return this.reset();this.files[r]=!0}else if("object"===C(r)){var i,a=r.root;if(e.Util.IS_NODE&&(a=require("path").resolve(a)),(a.indexOf("\\")>=0||r.file.indexOf("\\")>=0)&&(n="\\"),i=e.Util.IS_NODE?require("path").join(a,r.file):a+n+r.file,!0===this.files[i])return this.reset();this.files[i]=!0}if(t.imports&&t.imports.length>0){var s,c=!1;"object"===C(r)?(this.importRoot=r.root,c=!0,s=this.importRoot,r=r.file,(s.indexOf("\\")>=0||r.indexOf("\\")>=0)&&(n="\\")):"string"==typeof r?this.importRoot?s=this.importRoot:r.indexOf("/")>=0?""===(s=r.replace(/\/[^\/]*$/,""))&&(s="/"):r.indexOf("\\")>=0?(s=r.replace(/\\[^\\]*$/,""),n="\\"):s=".":s=null;for(var u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!s)throw Error("cannot determine import root");var l=t.imports[u];if("google/protobuf/descriptor.proto"===l)continue;if(l=e.Util.IS_NODE?require("path").join(s,l):s+n+l,!0===this.files[l])continue;/\.proto$/i.test(l)&&!e.DotProto&&(l=l.replace(/\.proto$/,".json"));var d=e.Util.fetch(l);if(null===d)throw Error("failed to import '"+l+"' in '"+r+"': file not found");/\.json$/i.test(l)?this.import(JSON.parse(d+""),l):this.import(e.DotProto.Parser.parse(d),l)}else r?/\.(\w+)$/.test(r)?this.import(t.imports[u],r.replace(/^(.+)\.(\w+)$/,function(e,t,r){return t+"_import"+u+"."+r})):this.import(t.imports[u],r+"_import"+u):this.import(t.imports[u]);c&&(this.importRoot=null)}t.package&&this.define(t.package),t.syntax&&o(t);var _=this.ptr;return t.options&&Object.keys(t.options).forEach(function(e){_.options[e]=t.options[e]}),t.messages&&(this.create(t.messages),this.ptr=_),t.enums&&(this.create(t.enums),this.ptr=_),t.services&&(this.create(t.services),this.ptr=_),t.extends&&this.create(t.extends),this.reset()},i.resolveAll=function(){var n;if(null==this.ptr||"object"===C(this.ptr.type))return this;if(this.ptr instanceof r.Namespace)this.ptr.children.forEach(function(e){this.ptr=e,this.resolveAll()},this);else if(this.ptr instanceof r.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(n=(this.ptr instanceof r.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=n,n instanceof r.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==n.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(n instanceof r.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=n.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}"proto3"===this.ptr.syntax&&this.ptr.repeated&&void 0===this.ptr.options.packed&&-1!==e.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType)&&(this.ptr.options.packed=!0)}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((n=this.ptr.parent.resolve(this.ptr.requestName,!0))&&n instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=n,!((n=this.ptr.parent.resolve(this.ptr.responseName,!0))&&n instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=n}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+C(this.ptr)+": "+this.ptr);return this.reset()},i.build=function(e){if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(var t="string"==typeof e?e.split("."):e,r=this.result,n=0;n<t.length;n++){if(!r[t[n]]){r=null;break}r=r[t[n]]}return r},i.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},i.toString=function(){return"Builder"},n.Message=function(){},n.Enum=function(){},n.Service=function(){},n}(t,t.Lang,t.Reflect),t.Map=function(e,t){var r=function(e,r){if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),r)for(var n=Object.keys(r),i=0;i<n.length;i++){var o=this.keyElem.valueFromString(n[i]),a=this.valueElem.verifyValue(r[n[i]]);this.map[this.keyElem.valueToString(o)]={key:o,value:a}}},n=r.prototype;function i(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}return n.clear=function(){this.map={}},n.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),r=t in this.map;return delete this.map[t],r},n.entries=function(){for(var e,t=[],r=Object.keys(this.map),n=0;n<r.length;n++)t.push([(e=this.map[r[n]]).key,e.value]);return i(t)},n.keys=function(){for(var e=[],t=Object.keys(this.map),r=0;r<t.length;r++)e.push(this.map[t[r]].key);return i(e)},n.values=function(){for(var e=[],t=Object.keys(this.map),r=0;r<t.length;r++)e.push(this.map[t[r]].value);return i(e)},n.forEach=function(e,t){for(var r,n=Object.keys(this.map),i=0;i<n.length;i++)e.call(t,(r=this.map[n[i]]).value,r.key,this)},n.set=function(e,t){var r=this.keyElem.verifyValue(e),n=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(r)]={key:r,value:n},this},n.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));if(t in this.map)return this.map[t].value},n.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,t.Reflect),t.loadProto=function(e,r,n){return("string"==typeof r||r&&"string"==typeof r.file&&"string"==typeof r.root)&&(n=r,r=void 0),t.loadJson(t.DotProto.Parser.parse(e),r,n)},t.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=t.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=t.populateAccessors),new t.Builder(e)},t.loadJson=function(e,r,n){return("string"==typeof r||r&&"string"==typeof r.file&&"string"==typeof r.root)&&(n=r,r=null),r&&"object"===C(r)||(r=t.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),r.import(e,n),r.resolveAll(),r},t}(),tu=function(){return o(function e(t){n(this,e),Zc.add(this),Object.defineProperty(this,"pbModules",{enumerable:!0,configurable:!0,writable:!0,value:void 0});var r=eu.loadProto(t);this.pbModules=r.build("Modules").probuf},[{key:"encode",value:function(e,t){return this.pbModules[e].encode(t).toArrayBuffer()}},{key:"decode",value:function(e,t){try{var r=this.pbModules[e].decode(t);return q(this,Zc,"m",Xc).call(this,r)}catch(t){var n="name: ".concat(e,", stack: ").concat(t.stack);throw null===console||void 0===console||console.error("pb decode error!",n),t}}}])}();Zc=new WeakSet,Xc=function e(t){var r,n=this;if(t instanceof Array)return t.map(function(t){return q(n,Zc,"m",e).call(n,t)});if(r=t,"[object Object]"!==Object.prototype.toString.call(r))return t;if(t instanceof eu.ByteBuffer)return t.toArrayBuffer();if(t instanceof eu.Long)return t.toNumber();var i={};return Object.keys(t).forEach(function(r){i[r]=q(n,Zc,"m",e).call(n,t[r])}),i};var ru,nu,iu,ou,au,su,cu;!function(e){e[e.PERSON=1]="PERSON",e[e.PERSONS=2]="PERSONS",e[e.GROUP=3]="GROUP",e[e.TEMPGROUP=4]="TEMPGROUP",e[e.CUSTOMERSERVICE=5]="CUSTOMERSERVICE",e[e.NOTIFY=6]="NOTIFY",e[e.MC=7]="MC",e[e.MP=8]="MP",e[e.ULTRAGROUP=10]="ULTRAGROUP"}(ru||(ru={})),function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(nu||(nu={})),function(e){e[e.GROUP_SUCCESS=0]="GROUP_SUCCESS",e[e.GROUP_FAILURE=1]="GROUP_FAILURE"}(iu||(iu={})),function(e){e[e.IsSilent=1]="IsSilent",e[e.IsTop=2]="IsTop",e[e.Tags=3]="Tags",e[e.AutoTrans=4]="AutoTrans"}(ou||(ou={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(au||(au={})),function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(su||(su={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(cu||(cu={})),new tu("package Modules;\nmessage probuf {\n message SetUserStatusOutput {\n optional int32 nothing=1;\n }\n message GetUserStatusInput {\n optional int32 nothing=1;\n }\n message GetUserStatusOutput {\n optional string status=1;\n optional string subUserId=2;\n }\n message SubUserStatusInput {\n repeated string userid =1;\n }\n message SubUserStatusOutput {\n optional int32 nothing=1;\n }\n message VoipDynamicInput {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n message VoipDynamicOutput {\n required string dynamicKey=1;\n }\n message NotifyMsg {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message SyncRequestMsg {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n optional int64 endTime = 8;\n optional bool compressioEnabled = 9;\n }\n message UpStreamMessage {\n required int32 sessionId = 1;\n required string classname = 2;\n required string content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13;\n optional string systemId = 16;\n optional string senderPortrait = 21;\n optional int64 optionBits = 22;\n }\n message PushExtra {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message DownStreamMessages {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n optional int64 systemTime = 5;\n optional int64 credibleStartTime = 6;\n optional int64 credibleEndTime = 7;\n optional bool compressioEnabled = 8;\n optional bytes compressedData = 9;\n }\n message ChrmDownStreamMessages {\n repeated bytes list = 1;\n required int64 syncTime = 2;\n optional bool compressioEnabled = 3;\n optional bytes compressedData = 4;\n }\n message DownStreamMessage {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required string content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19;\n optional int64 extStatus = 20;\n repeated string toUserIds = 21;\n optional int32 groupUnpush = 22;\n optional int64 optionBits = 23;\n optional string convertExt = 24;\n optional ExtMsgData extMsgData = 25;\n }\n message ExtMsgData {\n optional int64 seqId = 1;\n optional int64 sendTime = 2;\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n IMAGE = 1;\n AUDIO = 2;\n VIDEO = 3;\n FILE = 4;\n SIGHT = 5;\n COMBINE_HTML = 6;\n }\n message GetQNupTokenInput {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5;\n optional string ext = 6;\n optional int64 size = 7;\n optional int32 ipType = 8;\n }\n message GetQNdownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message GetDownloadUrlInput {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4;\n optional int64 size = 5;\n optional int32 ipType = 6;\n }\n message GetQNupTokenOutput {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24;\n optional string ossConfig = 25;\n }\n message GetQNdownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message GetDownloadUrlOutput {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n GROUP_SUCCESS = 0x00;\n GROUP_FAILURE = 0x01;\n }\n message ChrmInput {\n required int32 nothing = 1;\n optional string extra = 2;\n }\n message ChrmOutput {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message ChrmPullMsg {\n required int64 syncTime = 1;\n required int32 count = 2;\n optional int32 pullMsgType = 3;\n optional bool compressioEnabled = 4;\n }\n message ChrmPullMsgNew {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message RelationQryInput {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n optional bool isEraseMsgContent = 5;\n optional int64 endTime = 6;\n optional bool compressioEnabled = 7;\n optional int32 qryType = 8;\n }\n message RelationsOutput {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;\n optional int64 pullTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\n }\n message RelationInfo {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;\n optional int64 versionTime = 7;\n optional int64 remindCount = 8;\n optional int32 busChannelType = 9;\n optional UnreadMsgInfo msgInfo = 10;\n optional int32 remindMeCount = 11;\n }\n message UnreadMsgInfo {\n required string msgId = 1;\n required int64 msgTime= 2;\n optional int32 remindType= 3;\n optional string className = 4;\n }\n message QryRemindListReq {\n required string groupId = 1;\n optional string busChannel = 2;\n optional int64 msgTime = 3;\n optional int32 size = 4;\n }\n message QryRemindListResp {\n repeated UnreadMsgInfo msgInfo = 1;\n }\n message RelationInfoReadTime {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message CleanHisMsgInput {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4;\n }\n message CleanMsgBatchReq {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6; \n optional bytes compressedData = 7;\n }\n message QueryChatRoomInfoInput {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message QueryChatRoomInfoOutput {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput {\n required string id = 1;\n }\n\n message MPFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message HistoryMsgInput {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5;\n optional bool compressioEnabled = 6;\n optional bool ignoreCmd = 10;\n }\n\n message HistoryMsgOuput {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n optional int64 credibleStartTime = 4;\n optional int64 credibleEndTime = 5;\n optional bool compressioEnabled = 6;\n optional bytes compressedData = 7;\n }\n message SessionsAttQryInput {\n required int32 nothing = 1;\n }\n message SessionsAttOutput {\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message SessionMsgReadInput {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;\n }\n message SessionMsgReadOutput {\n optional int32 nothing=1;\n }\n message DeleteSessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message SessionInfo {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 unreadCount = 3;\n optional string busChannel = 4;\n }\n message QuerySessionsInput {\n repeated SessionInfo sessions = 1;\n }\n message QuerySessionsOutPut {\n repeated SessionInfo sessions = 1;\n }\n message DeleteSessionsOutput {\n optional int32 nothing=1;\n }\n message RelationDelBatchReq {\n repeated RelationOpInput relation = 1;\n optional bool cleanMsg = 2;\n }\n message RelationOpInput {\n required string conversationId = 1;\n required ChannelType conversationType = 2;\n optional string busChannel = 3;\n }\n message DeleteMsgInput {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4;\n }\n message DeleteMsg {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message SetChrmKV {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message SetChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message DeleteChrmKVS {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ChrmKVOutput {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n optional bool compressioEnabled = 4; \n optional bytes compressedData = 5;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message ChrmKVSOutput {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ChrmKVSOutputEntity {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message QueryChrmKV {\n required int64 timestamp = 1;\n optional bool compressioEnabled = 2;\n }\n message SetUserSettingInput {\n required int64 version=1;\n required string value=2;\n optional bool ignoreVersion = 3;\n }\n message SetUserSettingOutput {\n required int64 version=1;\n required bool reserve=2;\n optional bool updateVersion = 3;\n }\n message PullUserSettingInput {\n required int64 version=1;\n optional bool reserve=2;\n optional int32 ipType = 3;\n }\n message PullUserSettingOutput {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message SessionReq {\n required int64 time = 1;\n }\n message SessionStates {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message SessionState {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;\n }\n message SessionStateItem {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n optional int64 time = 4;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n AutoTrans = 4;\n }\n message SessionStateModifyReq {\n required int64 version=1;\n repeated SessionState state= 2;\n optional bool ignoreVersion = 3;\n }\n message GroupUnpushQuery {\n optional string busChannel = 1;\n }\n message GroupUnpushSet{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message GroupUnpushResult {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message SessionStateModifyResp {\n required int64 version=1;\n optional bool updateVersion = 2;\n }\n message TypeUnpushInput {\n required ChannelType type = 1;\n required int64 version = 2;\n required int32 unpushLevel = 3;\n optional bool ignoreVersion = 4;\n }\n message TypeUnpushOutput {\n required int64 version = 1;\n optional bool updateVersion = 2;\n }\n message GrpReadReceiptMsg {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message GrpReadReceiptQryReq {\n repeated string msgId=1;\n optional string channelId = 2;\n }\n message ReadReceipt {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string channelId = 3;\n optional int32 readType =4 ;\n repeated string msgIds= 5 ;\n optional string fromId = 6;\n }\n message QueryReceiptReq {\n optional string targetId = 1;\n optional string busChannel =2;\n optional int32 type = 3;\n repeated string msgIds = 4;\n optional int32 qryType = 5;\n optional int32 order =6;\n optional bool compress = 7;\n optional int32 readType = 8;\n optional int32 pageType = 9; \n optional int32 pageSize = 10;\n optional string pageToken = 11;\n repeated string users = 12;\n }\n message QueryReceiptBatchReq {\n repeated QueryReceipt items = 1;\n optional bool compress = 2;\n }\n message QueryReceipt {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 type = 3;\n repeated string msgIds = 4;\n }\n message ReceiptResp {\n repeated QueryReceiptRespItem resp = 1;\n optional bool compress = 2;\n optional bytes compressData = 3;\n optional string pageToken = 4;\n }\n message QueryReceiptBatchResp {\n repeated QueryReceiptBatchRespItem item = 1;\n optional bool compress = 2;\n optional bytes compressData = 3;\n }\n\n message QueryReceiptBatchRespItem {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 type = 3;\n repeated QueryReceiptRespItem msg = 4;\n }\n message QueryReceiptRespItem {\n optional string msgId = 1;\n optional int64 msgTime = 2;\n optional int32 totalCnt = 3;\n optional int64 readCnt = 4;\n repeated ReceiptUser readUser = 5;\n repeated string unreadList = 6;\n optional int64 unreadCnt = 7;\n repeated ReceiptUser unreadUser = 8;\n }\n message GrpReadReceiptQryResp {\n required int32 totalMemberNum = 1;\n repeated GrpMsgReadUser list = 2;\n }\n message GrpMsgReadUser {\n required int64 readTime = 1;\n required string userId = 2;\n }\n message SessionTagAddInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n optional bool ignoreVersion = 3;\n }\n message SessionTagItem {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message SessionTagDelInput {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n optional bool ignoreVersion = 3;\n }\n message SessionDisTagReq {\n repeated string tagId=1;\n }\n message UserSettingNotification {\n required int64 version=1;\n required bool reserve=2;\n }\n message ReportSDKInput {\n required string sdkInfo=1;\n }\n message ReportSDKOutput {\n optional int32 nothing=1;\n }\n message UltraGrpPullSes {\n required int64 syncTime = 1;\n optional bool isEraseMsgContent = 2;\n }\n message UltraGrpPullMsg {\n required int64 syncTime = 1;\n optional bool compressioEnabled = 2;\n }\n message MsgChangeReq {\n required string fromUserId = 1;\n required string targetId = 2;\n required ChannelType type = 3;\n required string msgUID = 4;\n required int64 msgTime = 5;\n optional string busChannel = 6;\n optional string content = 7;\n }\n message ModifyMsgResp {\n optional int64 modifyTime = 1;\n optional DownStreamMessage msg = 2;\n }\n message QueryMsgChange {\n required int64 syncTime = 1;\n optional int32 needCompress = 2;\n optional int64 onlineTime = 3;\n optional string targetId = 4;\n }\n message EventChangeList {\n repeated EventChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n optional string targetId = 4;\n optional bool isCompress = 5 ;\n }\n message EventChange {\n optional string businessId = 1;\n optional ChannelType channelType = 2;\n optional int64 time = 3;\n optional int32 changeType = 4;\n optional string originalId = 5;\n optional int64 originalTime = 6;\n optional string secondaryId = 7;\n optional bool isAdmin = 8;\n optional bool additionalMark = 9; \n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 secondaryType = 12;\n optional bool isRemindMe = 13;\n repeated string extIds = 14;\n optional int32 remindType = 15;\n optional bytes eventData = 16;\n }\n message MsgChangeList {\n repeated MsgChange list = 1;\n required int64 syncTime = 2;\n optional bool hasNext = 3 ;\n }\n message MsgChange {\n required string targetId = 1;\n required ChannelType type = 2;\n required int64 time = 3;\n required int32 changeType = 4;\n required string msgUID = 5;\n required int64 msgTime = 6;\n optional string busChannel = 7;\n optional bool isAdmin = 8;\n optional bool isDel = 9;\n optional string operatorId = 10;\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12;\n optional bool isRemindMe = 13;\n repeated string userGroupIds = 14;\n optional int32 remindType = 15;\n }\n message MsgQuery {\n required string targetId = 1;\n required ChannelType type = 2;\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo {\n required int64 msgTime = 1;\n required string msgUID = 2;\n optional string busChannel = 3;\n }\n message MsgQueryAck {\n repeated DownStreamMessage list = 1;\n repeated string notExistMsgId = 2;\n }\n message OperateStatus {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 opType = 3;\n optional string busChannel = 4;\n }\n message OperateStatusNotify {\n optional ChannelType type = 1;\n optional int64 notifyType = 2;\n repeated OperateInfo info = 3 ;\n repeated OperateSummary summary = 4 ;\n }\n message OperateInfo {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional string userId = 3;\n optional int32 opType = 4;\n optional int64 optime = 5;\n }\n \n message OperateSummary {\n optional string targetId = 1;\n optional string busChannel = 2;\n optional int32 count = 3;\n optional int32 opType = 4;\n }\n\n message SetRtcRoomIdInput {\n required string rtcRoomId= 1;\n }\n message SetRtcRoomIdOutput {\n required int32 nothing = 1;\n }\n message CallInfoUpStream {\n required string key= 1;\n required string dataContent=2;\n }\n message CallInfoDownStream {\n required string key= 1;\n required string dataContent=2;\n required int64 maxTime=3;\n }\n message KvInput {\n required int64 syncTime = 1;\n }\n message KvOutput {\n required int64 maxTime = 1;\n repeated KvInfo info = 2;\n }\n message KvInfo {\n required string key =1;\n required string value =2;\n }\n message ReadReceiptMsg {\n required string targetId = 1;\n required ChannelType type = 2;\n optional string busChannel = 3;\n optional string startMsgId = 4;\n optional string endMsgId = 5;\n }\n message ReceiptQryReq {\n required string msgId = 1;\n optional string busChannel = 2;\n required string targetId = 3;\n }\n message QueryReceiptResp {\n optional int32 num = 1;\n repeated ReceiptUser list = 2;\n optional int32 readCnt = 3;\n }\n message ReceiptUser {\n optional int64 receiptTime = 1;\n optional string userId = 2;\n optional string name = 3;\n optional string portrait = 4;\n optional bool mentioned= 5;\n }\n message ReceiptCntQryReq {\n optional ChannelType type = 1;\n optional string channelId = 2;\n optional string busChannel = 3;\n repeated string msgId = 4;\n }\n message ReceiptCntQryResp {\n repeated MsgReadCnt result= 1;\n }\n\n message MsgReadCnt {\n optional string msgId = 1;\n optional int32 cnt = 2;\n optional int32 tmn = 3;\n }\n message UpdateUserSubReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n optional int32 opType = 3;\n optional int32 expiry = 4;\n }\n message UserSubDetail {\n optional string subUserId = 1;\n }\n message UpdateUserSubResp {\n repeated UserSubDetail subUsers = 1;\n optional int64 subTime = 2;\n }\n message PullUserSubReq {\n optional int64 version = 1;\n optional string pageToken = 2;\n }\n message PUllUserSubResp {\n repeated UserSubList list = 1;\n optional int64 version = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message UserSubList {\n repeated UserSubDetail subUsers = 1;\n optional int32 subType = 2;\n optional int64 subTime = 3;\n optional int32 expiry = 4;\n optional int32 opType = 5;\n }\n message PullSubDataReq {\n optional int64 versionTime = 1;\n optional bool needAllData = 2;\n optional string pageToken = 3;\n }\n message PullSubDataResp {\n repeated SubDataDetail list = 1;\n optional int64 versionTime = 2;\n optional bool hasNext = 3;\n optional string pageToken = 4;\n optional bool isFull = 5;\n }\n message SubDataDetail {\n optional string statusStr = 1;\n optional string subUserId = 2;\n repeated SubData data = 3;\n optional int32 subType = 4;\n }\n\n message SubData {\n optional int32 platformInfo = 1;\n optional int32 value = 2;\n optional int64 versionTime = 3;\n }\n message QrySubDataReq {\n optional int32 subType = 1;\n repeated UserSubDetail subUsers = 2;\n }\n message UserProfile {\n optional int64 version = 1;\n optional string userId = 2;\n repeated ProfileInfo userProfile = 3;\n repeated ProfileInfo userExtProfile = 4;\n }\n message ProfileInfo {\n optional string key = 1;\n optional string value = 2;\n }\n message SetUserProfileResp {\n optional int64 version = 1;\n optional string key = 2;\n repeated string censorFailedFields = 3;\n }\n message PullUserProfileReq {\n repeated string userId = 1;\n }\n message UserProfiles {\n repeated UserProfile UserProfile = 1;\n }\n message UserProfileInput {\n required int32 nothing = 1;\n }\n message UserProfilePermission {\n optional int32 permission = 1;\n }\n message UserProfileOutput {\n required int32 nothing = 1;\n }\n message SearchUserProfile {\n optional string uniqueId = 1;\n }\n message ChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated ProfileInfo settingProfile = 3;\n repeated ProfileInfo extProfile = 4;\n optional ChannelBaseInfo baseInfo = 5;\n repeated string users = 6;\n }\n\n message ChannelBaseInfo {\n optional string creatorId = 1;\n optional string ownerId = 2;\n optional int64 createTime = 3;\n optional int32 memberCount = 4;\n }\n\n message ChannelsOutput {\n optional int64 operateTime = 1;\n optional int32 flag = 2;\n optional string msg = 3;\n optional int32 processCode = 4;\n optional ChannelsJoinedInfo channelInfo = 5;\n repeated ChannelsUserInfo userInfos = 6;\n optional FriendInviteInfo friendInviteInfo = 7;\n optional FriendUserInfo friendUserInfo = 8;\n repeated string censorFailedFields = 9;\n }\n\n message MultiChannels {\n optional ChannelType type = 1;\n repeated ChannelsInput list = 2;\n }\n\n message ModifyChannelsInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional QuitChannelsSetting settingInfo = 3;\n repeated string users = 4;\n optional int32 operateType = 5;\n }\n\n message QuitChannelsSetting {\n optional bool isQuit = 1;\n optional bool isDelBan = 2;\n optional bool isDelWhite = 3;\n optional bool isDelAttention = 4;\n }\n\n message ChannelsQueryInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional ChannelsPageParam page = 3;\n repeated string ids = 4;\n optional int32 roleType = 5;\n }\n\n message ChannelsPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n optional bool hasNext = 3 ;\n optional int32 total = 4 ;\n optional int32 order = 5 ;\n }\n\n message ChannelsListResult {\n optional int32 listType = 1;\n optional bytes result = 2;\n optional ChannelsPageParam page = 3;\n }\n \n message ChannelsInviteStatusInfos {\n repeated ChannelsInviteStatusInfo list = 1;\n }\n \n message ChannelsUserInfos {\n repeated ChannelsUserInfo list = 1;\n }\n \n message ChannelsJoinedInfos {\n repeated ChannelsJoinedInfo list = 1;\n }\n\n message ChannelsUserInfo {\n optional string userId = 1;\n optional ChannelsUserExtInfo ext = 2;\n optional int64 opTime = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n\n message ChannelsUserExtInfo {\n optional int32 role = 1;\n optional int64 joinTime = 2;\n optional string channelNickName = 3;\n optional string additional = 4;\n optional string remarkName = 5;\n optional bool isBan = 6;\n optional int64 banEndTime = 7;\n }\n\n message ChannelsMemberUpdateInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional string userId = 3;\n optional string channelNickName = 4;\n optional string additional = 5;\n optional int32 operateType = 6;\n }\n message ChannelsJoinedInfo {\n optional string targetId = 1;\n repeated ProfileInfo settingProfile = 2;\n repeated ProfileInfo extProfile = 3;\n optional ChannelBaseInfo baseInfo = 4;\n optional ChannelsUserExtInfo userInfo = 5;\n }\n message ChannelsInviteStatusInfo {\n optional string targetId = 1;\n optional ChannelsUserInfo joinUserInfo = 2;\n optional ChannelsUserInfo inviterInfo = 3;\n optional int32 status = 4;\n optional int32 directionType = 5;\n optional int32 joinType = 6;\n optional string detail = 7;\n optional int64 applyTime = 8;\n optional ChannelsUserInfo processInfo = 9;\n optional int64 processTime = 10;\n }\n message ChannelsMemberResponseInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n optional int32 optType = 3;\n optional int32 optResult = 4;\n optional string joinUserId = 5;\n optional string inviterId = 6;\n optional string detail = 7;\n }\n message ChannelsMembersInput {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string userIds = 3;\n }\n message FriendInput {\n optional string targetId = 1;\n optional int32 type = 2;\n optional string info = 3;\n }\n message FriendsOutput {\n repeated FriendOutput list = 1;\n }\n message FriendOutput {\n optional string userId = 1;\n optional int64 operateTime = 2;\n optional string flag = 3;\n }\n message FriendsInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendsCheckOutput {\n repeated FriendCheckOutput list = 1;\n }\n\n message FriendCheckOutput {\n optional string targetId = 1;\n optional int32 status = 2;\n }\n message FriendProfileInput {\n optional string targetId = 1;\n optional string remarkName = 2;\n repeated ProfileInfo extProfile = 3;\n }\n message FriendProfileOutput {\n repeated string censorFailedFields = 1;\n }\n message FriendQueryInput {\n optional int32 queryType = 1;\n optional ChannelsPageParam page = 2;\n optional int32 friendType= 3;\n }\n message FriendUserInfo {\n optional string userId = 1;\n optional int64 relationTime = 2;\n optional int32 friendType = 3;\n optional int32 flag = 4;\n optional string remarkName = 5;\n optional string name = 6;\n optional string portraitUrl = 7;\n repeated ProfileInfo extProfile = 8;\n \n }\n message FriendInviteInfo {\n optional string userId = 1;\n optional string name = 2;\n optional string portraitUrl = 3;\n optional int32 type = 4;\n optional int32 status = 5;\n optional int64 operateTime = 6;\n optional string info = 7;\n optional int32 friendType = 8;\n }\n message FriendsListInput {\n repeated string targetId = 1;\n optional int32 type = 2;\n }\n message FriendLevelSet {\n optional int32 level = 1;\n }\n\n message FriendPageParam {\n optional int32 size = 1;\n optional string pageToken = 2;\n }\n message FriendUserInfos {\n repeated FriendUserInfo list = 1;\n }\n\n message FriendInviteInfos {\n repeated FriendInviteInfo list = 1;\n }\n \n message FriendApplyEvent {\n optional int32 applyType = 1;\n optional int32 friendType = 2;\n optional string info = 3;\n optional string name = 4;\n optional string portraitUrl = 5;\n }\n message UpdateChannnelInfo {\n optional ChannelsJoinedInfo channelInfo = 1;\n optional ChannelsUserInfo userInfo = 2;\n }\n message UpdateUserInfo {\n optional ChannelsUserInfo updatedUserInfo = 1;\n optional ChannelsUserInfo optUserInfo = 2;\n }\n message ChannelApplyInfo {\n repeated ChannelsInviteStatusInfo statusInfo = 1;\n }\n message ChannelEventData {\n optional ChannelsUserInfo optUserInfo = 1;\n optional ChannelsJoinedInfo channelInfo = 2;\n repeated ChannelsUserInfo userInfos = 3;\n optional ChannelsJoinedInfo channelFullInfo = 4;\n }\n message FriendTypeChangeEvent {\n optional string friendId = 1;\n optional int32 friendType = 2;\n }\n message FriendUpdateEvent {\n optional string remarkname = 1;\n repeated ProfileInfo extProfile = 2;\n }\n message AddUnpushPeriodInput {\n required string startTime = 1;\n required int32 spanMinutes = 2;\n optional int32 level = 3;\n optional string timezone = 4;\n }\n message DeleteUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodInput {\n required int32 nothing = 1;\n }\n message QueryUnpushPeriodOutput {\n required int32 isUnpush = 1;\n optional string startTime = 2;\n optional int32 spanMinutes = 3;\n optional int32 level = 4;\n optional string timezone = 5;\n }\n message RelationDel {\n optional string targetId = 1;\n optional ChannelType type = 2;\n repeated string busChannel = 3;\n optional bool cleanMsg = 4;\n }\n message MsgReadEvent {\n optional string msgId = 1;\n optional int64 msgTime = 2;\n optional int32 totalCnt = 3;\n optional int32 readCnt = 4;\n optional int32 unreadCnt = 5;\n repeated ReceiptUser readList =6;\n }\n message ConvertMsgInput {\n optional int32 businessType = 1;\n optional bytes businessInfo = 2;\n }\n message SpeechToTextInfo {\n optional string msgId = 1;\n optional string objectName = 2;\n optional string content = 3;\n optional int32 sampleRate = 4;\n optional int32 channelNumber = 5;\n optional string format = 6;\n optional string extra = 7;\n }\n message ConvertMsgOutput {\n optional int32 businessType = 1;\n optional bytes businessResult = 2;\n }\n message SpeechToTextResult {\n optional string result = 1;\n optional string message = 2;\n }\n message TransReq {\n repeated TransInfo transInfos = 1;\n optional int32 model = 2;\n optional bool forceTrans = 3;\n }\n message TransResp {\n repeated TransResult results = 1;\n optional int32 model = 2;\n }\n message TransInfo {\n optional string messageUID = 1;\n optional int32 transType = 2;\n optional string text = 3;\n optional string transFileUrl = 4;\n optional string sourceLan = 5;\n optional string targetLan = 6;\n optional int32 inputSource = 7;\n }\n message TransResult {\n optional string messageUID = 1;\n optional string transResult = 2;\n optional string sourceLan = 3;\n optional string targetLan = 4;\n optional int32 code = 5;\n optional int32 inputSource = 6;\n }\n message PullModifyMsgReq { \n optional int64 pullVersion = 1;\n optional bool compress = 2;\n repeated int32 modifyType = 3;\n }\n message PullModifyMsgResp {\n repeated ModifyMsg msg = 1;\n optional int64 nextVersion = 2;\n optional bool finished = 3;\n optional bool compress = 4;\n optional bytes compressedData = 5;\n }\n message ModifyMsg {\n optional int32 modifyType = 1;\n optional DownStreamMessage msg = 2;\n }\n enum JoinType {\n KICK = 0;\n REFUSE = 1;\n COEXIST = 2;\n }\n enum TargetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message SetUserStatusInput {\n optional int32 status=1;\n }\n message MCFollowInput {\n required string state = 1;\n }\n message RtcQueryListInput {\n optional int32 order=1;\n }\n message RtcKeyDeleteInput {\n repeated string key=1;\n }\n message RtcValueInfo {\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo {\n required string userId=1;\n repeated RtcValueInfo userData=2;\n }\n message RtcUserListOutput {\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4;\n repeated RtcKVEntity entries = 5;\n optional int64 syncTime = 6;\n optional int32 offlineKickTime = 7;\n }\n message RtcRoomInfoOutput {\n optional string roomId = 1;\n repeated RtcValueInfo roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message RtcInput {\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4;\n optional IdentityChangeType identityChangeType = 5;\n optional JoinType joinType = 6;\n repeated RtcValueInfo innerDatas = 7;\n repeated RtcValueInfo outerDatas = 8;\n }\n message RtcQryOutput {\n repeated RtcValueInfo outInfo=1;\n }\n message RtcDataInput {\n required bool interior=1;\n required TargetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message RtcSetDataInput {\n required bool interior=1;\n required TargetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message RtcUserSetDataInput {\n repeated RtcValueInfo valueInfo = 1;\n required string objectName = 2;\n repeated RtcValueInfo content = 3;\n }\n message RtcQryInput {\n required bool isInterior=1;\n required TargetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput {\n repeated string key=1;\n required bool isInterior=2;\n required TargetType target=3;\n }\n message RtcOutput {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message RtcTokenOutput {\n required string rtcToken=1;\n }\n message RtcSetOutDataInput {\n required TargetType target=1;\n repeated RtcValueInfo valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message RtcQryUserOutDataInput {\n repeated string userId = 1;\n }\n message RtcUserOutDataOutput {\n repeated RtcUserInfo user = 1;\n }\n message RtcNotifyMsg {\n required int32 type= 1;\n optional int64 time= 2;\n optional string roomId=3;\n }\n message RtcPullKV {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message RtcKVOutput {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType {\n AnchorToViewer = 1;\n ViewerToAnchor = 2;\n }\n message RtcQueryUserJoinedInput {\n required string userId = 1;\n }\n message RtcJoinedInfo {\n required string deviceId = 1;\n required string roomId = 2;\n optional int64 joinTime = 3;\n }\n message RtcQueryUserJoinedOutput {\n repeated RtcJoinedInfo info = 1;\n }\n message RtcViewerJoinedOutput {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;\n optional int64 syncTime = 3;\n }\n message RtcInviteInput {\n required string invitedUserId=1;\n optional int32 timeoutTime=2;\n required string invitedRoomId=3;\n required string inviteInfo=4;\n required string inviteSessionId= 5;\n }\n message RtcCancelInviteInput {\n required string invitedUserId=1;\n required string invitedRoomId=2;\n required string inviteInfo=3;\n required string inviteSessionId=4;\n }\n message RtcInviteAnswerInput {\n required string inviteUserId=1;\n required int32 answerCode=2;\n required string inviteRoomId=3;\n required string inviteSessionId=4;\n required string content=5;\n optional string key=6;\n optional string value=7;\n }\n message RtcEndInviteInput {\n required string inviteRoomId=1;\n required string inviteSessionId=2;\n required string inviteContent=3;\n repeated string inviteRoomKeys=4;\n }\n}\n");var uu,lu,du=function(){return o(function e(t){n(this,e),Object.defineProperty(this,"pbCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pbCodec=new tu(t)},[{key:"encode",value:function(e,t,r){return r?t:this.pbCodec.encode(e,t)}},{key:"decode",value:function(e,t){return this.pbCodec.decode(e,t)}}])}(),_u="rtcRJoin_data",fu="rtcRExit",hu="rtcRInfo",pu="rtcUData",gu="rtcUDel",Ru="rtcSetData",mu="userSetData",vu="rtcQryData",Tu="rtcDelData",Cu="rtcToken",Eu="rtcUserState",Iu="rtcUList",Su="viewerJoinR",yu="viewerExitR",bu="rtcPullKv",Ou="rtcIdentityChange",Lu="rtcInvite",ku="rtcCancelInvite",Au="rtcInviteAnswer",Nu="rtcEndInvite",wu="rtcQueryJoined",Pu="rtcPullRoomStatus",Du="reportsdk",Uu="rtcPing";!function(e){e.RtcInput="RtcInput",e.RtcOutput="RtcOutput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcRoomStatusInput="RtcRoomStatusInput",e.RtcRoomStatusOutput="RtcRoomStatusOutput",e.RtcReportSDKInput="RtcReportSDKInput",e.RtcPBPolaris="RCRTCPBPolaris",e.RtcPBR1Info="RCRTCPBR1Info",e.RtcPBR2Info="RCRTCPBR2Info",e.RtcPBR3Info="RCRTCPBR3Info",e.RtcPBR4Info="RCRTCPBR4Info",e.RtcPBStatusInfo="RCRTCPBStatusInfo",e.RtcPBStreamInfo="RCRTCPBStreamInfo",e.AsrTextMsg="AsrTextMsg",e.AsrResTextMsg="AsrResTextMsg"}(lu||(lu={})),s(s(s(s(s(s(s(s(s(s(uu={},lu.RtcInput,["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"]),lu.RtcOutput,["version"]),lu.RtcUserListOutput,["users","token","sessionId","roomInfo","version"]),lu.SetUserStatusInput,["status"]),lu.RtcSetDataInput,["interior","target","key","value","objectName","content"]),lu.RtcUserSetDataInput,["valueInfo","objectName","content"]),lu.RtcDataInput,["interior","target","key","objectName","content"]),lu.RtcSetOutDataInput,["target","valueInfo","objectName","content"]),lu.MCFollowInput,["state"]),lu.RtcTokenOutput,["rtcToken"]),s(s(s(s(s(s(s(s(s(s(uu,lu.RtcQryOutput,["outInfo"]),lu.RtcQryUserOutDataInput,["userId"]),lu.RtcUserOutDataOutput,["user"]),lu.RtcQueryListInput,["order"]),lu.RtcRoomInfoOutput,["roomId","roomData","userCount","list"]),lu.RtcValueInfo,["key","value"]),lu.RtcKeyDeleteInput,["key"]),lu.RtcNotifyMsg,["type","time","roomId"]),lu.RtcPullKV,["timestamp","roomId"]),lu.RtcKVOutput,["entries","bFullUpdate","syncTime"]),s(s(s(s(s(s(s(s(s(s(uu,lu.RtcQueryUserJoinedInput,["userId"]),lu.RtcQueryUserJoinedOutput,["info"]),lu.RtcInviteInput,["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"]),lu.RtcCancelInviteInput,["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"]),lu.RtcInviteAnswerInput,["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"]),lu.RtcEndInviteInput,["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"]),lu.RtcRoomStatusInput,["version"]),lu.RtcRoomStatusOutput,["bFullStatus","version","usersData","roomStatus"]),lu.RtcReportSDKInput,["sdkInfo"]),lu.RtcPBPolaris,["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"]),s(s(s(s(s(s(s(s(uu,lu.RtcPBR1Info,["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"]),lu.RtcPBR2Info,["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"]),lu.RtcPBR3Info,["info"]),lu.RtcPBR4Info,["info"]),lu.RtcPBStatusInfo,["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"]),lu.RtcPBStreamInfo,["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"]),lu.AsrTextMsg,["bms","t","isEnd","msgId","lang"]),lu.AsrResTextMsg,["type","uid","asr"]);var Mu,xu="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(lu.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(lu.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(lu.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(lu.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(lu.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(lu.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(lu.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(lu.RtcRoomStatusOutput,"{ // rtc 和 living room 拉房间资源状态返回的数据\n required bool bFullStatus =1; //标识此次给的数据是否是全量数据\n required int64 version =2; //当前获取后房间的最大版本号\n repeated RtcUserInfo usersData=3;//如果是全量数据,这个不为空,给的是房间全部的人以及发布的资源\n repeated RtcRoomStatus roomStatus=4;//房间增量数据\n }\n message RtcRoomStatus{ //房间状态变动\n required string userId = 1;//用户ID\n required int32 event = 2;//房间状态变更的event(人员加入/退出/离线/发布资源) (0:加入;1:离开;2:离线;3:资源变动) \n required int64 time = 3;//本次变更的版本号\n repeated RtcValueInfo userData = 4;//用户变更的资源(event为0或者3时可能有值)\n optional int32 switchRoleType = 5;//如果是切换角色导致的加入房间或退出房间的类型\n optional string extra = 6;\n }\n message ").concat(lu.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n repeated string codeFormat = 8; //当前房间用户支持的编码交集\n optional int64 roomCreateTime = 9;//房间创建时间\n optional int64 userJoinTime = 10;//用户加入房间\n optional int64 version = 11;//当前房间的版本号\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(lu.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(lu.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(lu.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(lu.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(lu.RtcQryOutput,"{\n repeated ").concat(lu.RtcValueInfo," outInfo=1;\n }\n message ").concat(lu.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(lu.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(lu.RtcUserSetDataInput," {\n repeated ").concat(lu.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(lu.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(lu.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(lu.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(lu.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(lu.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(lu.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(lu.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(lu.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(lu.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(lu.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(lu.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(lu.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n optional string sessionId=4;\n optional int64 roomCreateTime = 5;//房间创建时间\n optional int64 userJoinTime = 6;//用户加入房间\n }\n message ").concat(lu.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(lu.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(lu.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(lu.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(lu.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(lu.RtcPBPolaris," {\n required string type = 1;//上报数据类型 R1-R4\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int32 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional ").concat(lu.RtcPBR1Info," r1Info = 10;\n optional ").concat(lu.RtcPBR2Info," r2Info = 11;\n optional ").concat(lu.RtcPBR3Info," r3Info = 12;\n optional ").concat(lu.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(lu.RtcPBR1Info," {\n required int64 joinTime = 1;//用户加入房间的时间\n required string rtcVersion = 2;//Rtc版本号\n required string imVersion = 3;//IM SDK 版本\n required string platform = 4;//平台(如:Android、iOS、Web)\n required string device = 5; //设备信息(手机名称+型号)\n required string os = 6;//系统版本(手机系统版本)\n optional string browserName = 7; //浏览器名称, 没有用 -1 表示\n optional string browserVersion = 8;//浏览器版本, 没有用 -1 表示\n optional int64 receiveTime = 9; // 发送数据的时间\n }\n message ").concat(lu.RtcPBR2Info," {\n required int64 joinTime = 1;\n required int64 sendTime = 2;\n required string rtcActionType = 3;//发布类型 subscribe : 订阅 publish : 发布\n required string rtcActionStatus = 4;//发布状态 begin : 开始 tend : 结束\n repeated string trackId = 5;\n optional int64 receiveTime = 6; // 发送数据的时间\n }\n message ").concat(lu.RtcPBR3Info," {\n required ").concat(lu.RtcPBStatusInfo," info = 1;\n }\n message ").concat(lu.RtcPBR4Info," {\n required ").concat(lu.RtcPBStatusInfo," info = 1;\n }\n message ").concat(lu.RtcPBStatusInfo," {\n optional int64 joinTime = 1;//用户加入房间的时间\n optional int64 receiveTime = 2;//用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理\n optional int64 totalBitRate = 3;//总码率\n optional float appCPUUsage = 4;//APP CPU占用率\n optional float systemCPUUsage = 5;////系统 CPU占用率\n optional float systemCPUFrequency = 6;//系统CPU频率 (安卓8.0以上)\n optional string networkStatus = 7;//实时网络状态(2g、3g、4g、wifi)\n optional int32 googleRTTNetwork = 8;//Goog rtt 网络延迟\n optional string ipAddress = 9;//ip地址\n optional string useReceiveBroadBand = 10; //可接收带宽(单位: bit)\n optional string useSendBroadBand = 11;//可用发送带宽(单位: bit)\n optional string packetLossCount = 12;//丢包数\n repeated ").concat(lu.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(lu.RtcPBStreamInfo," {\n required string trackId = 1;\n optional string codeName = 2;//编解码名称\n optional string volume = 3;//音频播放音量\n optional int32 samplingRate = 4; //音频采样率\n optional float bitRate = 5;//下行码率\n optional float packetLossRate = 6;\n optional int32 frameRate = 7;//视频接收帧率(单位:fps)\n optional string resolution = 8;//视频分辨率(格式:640*480)\n optional int64 blockTime = 9;//接收卡顿(间隔时间, 单位: ms)\n optional int32 jitterData = 10;//jitter数据抖动\n optional string nAckCount = 11;//nack数量\n optional string pliCount = 12; //PLI请求数\n optional int64 googleRTTTotalTime = 13; //googRtt往返时长\n optional int32 isReceiveFirstFrameRate = 14;//第一个关键帧是否正常收到\n optional string codeType = 15;//编码方式\n optional int32 isEnabled = 16; //当前流的状态是否可用\n }\n // ---- 北极星数据上报 -------\n message ").concat(lu.AsrTextMsg," {\n optional int32 bms = 1; //开始转写的时间(毫秒)\n optional string t = 2; //翻译的内容\n optional bool isEnd = 3; //是否监测到完整语句\n optional string msgId = 4; //该消息的ID, 跟转写的msgId 需要一样;\n optional string lang = 5; //翻译的目标语言码\n }\n message ").concat(lu.AsrResTextMsg," {\n optional int32 type = 1; //1 为语音识别,后续会扩展其它类型\n required string uid = 2; //对应转写的用户Id\n repeated ").concat(lu.AsrTextMsg," asr = 3; //识别出的结果列表\n }\n}\n"),Bu=function(e,t,r,n,i,o,a){var s=i?Object.keys(i).map(function(t){return e.encode(lu.RtcValueInfo,{key:t,value:i[t]},!0)}):void 0,c=o?Object.keys(o).map(function(t){return e.encode(lu.RtcValueInfo,{key:t,value:o[t]},!0)}):void 0;return e.encode(lu.RtcInput,{roomType:t,broadcastType:r,joinType:n,innerDatas:s,outerDatas:c,supportNtf:a})},Vu=function(e,t){var r=e.decode(lu.RtcUserListOutput,t),n=r.users,i=r.token,o=r.sessionId,a=r.roomInfo,s=r.entries,c=r.offlineKickTime,u=void 0===c?60:c,l=r.codeFormat,d=r.roomCreateTime,_=r.userJoinTime,f=r.version,h={};return H(n,function(e){var t=e.userId,r=e.userData,n={};H(r,function(e){var t=e.key,r=e.value;n[t]=r}),h[t]=n}),{users:h,token:i,sessionId:o,roomInfo:a,kvEntries:s,offlineKickTime:u,codeFormat:l,roomCreateTime:Zr(d),userJoinTime:Zr(_),version:f}},ju=function(e,t,r){var n=t.type,i=t.appKey,o=t.sessionId,a=t.roomId,s=t.roomCreateTime,c=t.userId,u=t.userRole,l=t.joinTime,d=t.signalDataCenter,_=t.r1Info,f=t.r2Info,h=t.r3Info,p=t.r4Info,g={type:n,appKey:i,sessionId:o,roomId:a,roomCreateTime:s,userId:c,userRole:u,joinTime:l,signalDataCenter:d};if(r===dc.R1&&_){var R=e.encode(lu.RtcPBR1Info,_,!0);return e.encode(lu.RtcPBPolaris,Object.assign(Object.assign({},g),{r1Info:R}))}if(r===dc.R2&&f){var m=e.encode(lu.RtcPBR2Info,f,!0);return e.encode(lu.RtcPBPolaris,Object.assign(Object.assign({},g),{r2Info:m}))}if(r===dc.R3&&h){var v=h.info,T=v.streams,C=Array.isArray(T)&&T.map(function(t){return t&&e.encode(lu.RtcPBStreamInfo,t,!0)}),E=e.encode(lu.RtcPBStatusInfo,Object.assign(Object.assign({},v),{streams:C}),!0),I=e.encode(lu.RtcPBR3Info,{info:E},!0);return e.encode(lu.RtcPBPolaris,Object.assign(Object.assign({},g),{r3Info:I}))}if(r===dc.R4&&p){var S=p.info,y=S.streams,b=Array.isArray(y)&&y.map(function(t){return t&&e.encode(lu.RtcPBStreamInfo,t,!0)}),O=e.encode(lu.RtcPBStatusInfo,Object.assign(Object.assign({},S),{streams:b}),!0),L=e.encode(lu.RtcPBR4Info,{info:O},!0);return e.encode(lu.RtcPBPolaris,Object.assign(Object.assign({},g),{r4Info:L}))}return{}};!function(e){e[e.SUBTITLE=1]="SUBTITLE",e[e.TRANSLATION=2]="TRANSLATION"}(Mu||(Mu={}));var Fu,Gu=function(){return o(function e(t){n(this,e),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:new du(xu)})},[{key:"logger",get:function(){return this.context.logger}},{key:"joinRTCRoom",value:function(e,t,r,n,i,o,a){return K(this,void 0,void 0,_().m(function s(){var c,u,l,d,f,h,p,g,R,m,v,T,C,E,I;return _().w(function(s){for(;;)switch(s.n){case 0:return c=Bu(this.codec,t,r,n,i,o,a),s.n=1,this.context.rtcSignaling(e,_u,!0,c);case 1:if(u=s.v,l=u.code,d=u.buffer,l!==ke||!d){s.n=2;break}return f=Vu(this.codec,d),p=(h=f).users,g=h.token,R=h.sessionId,m=h.roomInfo,v=h.kvEntries,T=h.offlineKickTime,C=h.roomCreateTime,E=h.userJoinTime,I=h.version,this.roomCreateTime=C,this.userJoinTime=E,s.a(2,{code:l,data:{users:p,token:g,sessionId:R,roomInfo:m,kvEntries:v,offlineKickTime:T,version:I}});case 2:return s.a(2,{code:l,data:f})}},s,this)}))}},{key:"quitRTCRoom",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.SetUserStatusInput,{status:0}),t.n=1,this.context.rtcSignaling(e,fu,!0,r);case 1:return n=t.v,i=n.code,t.a(2,i)}},t,this)}))}},{key:"getRTCRoomInfo",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,hu,!0,r);case 1:return n=t.v,i=n.code,o=n.buffer,i===ke&&o&&(a=this.codec.decode(lu.RtcRoomInfoOutput,o)),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"getRTCUserInfoList",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,pu,!0,r);case 1:return n=t.v,i=n.code,o=n.buffer,i===ke&&o&&(s=Vu(this.codec,o),a={users:s.users}),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"getRTCUserInfo",value:function(e){throw new Error("Method not implemented.")}},{key:"removeRTCUserInfo",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o;return _().w(function(r){for(;;)switch(r.n){case 0:return n=this.codec.encode(lu.RtcKeyDeleteInput,{key:t}),r.n=1,this.context.rtcSignaling(e,gu,!1,n);case 1:return i=r.v,o=i.code,r.a(2,o)}},r,this)}))}},{key:"setRTCData",value:function(e,t,r,n,i,o){return K(this,void 0,void 0,_().m(function a(){var s,c,u;return _().w(function(a){for(;;)switch(a.n){case 0:return s=this.codec.encode(lu.RtcSetDataInput,{interior:n,target:i,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),a.n=1,this.context.rtcSignaling(e,Ru,!1,s);case 1:return c=a.v,u=c.code,a.a(2,u)}},a,this)}))}},{key:"setRTCTotalRes",value:function(e,t,r,n,i,o){return K(this,void 0,void 0,_().m(function a(){var s,c,u,l,d=this;return _().w(function(a){for(;;)switch(a.n){case 0:return s={objectName:n,content:[],valueInfo:[this.codec.encode(lu.RtcValueInfo,{key:"uris",value:r},!0)]},t.forEach(function(e){var t=d.codec.encode(lu.RtcValueInfo,{key:e.name,value:e.content},!0);s.content.push(t)}),i&&s.valueInfo.push(this.codec.encode(lu.RtcValueInfo,{key:"mcu_uris",value:i},!0)),o&&s.valueInfo.push(this.codec.encode(lu.RtcValueInfo,{key:"cdn_uris",value:o},!0)),c=this.codec.encode(lu.RtcUserSetDataInput,s),a.n=1,this.context.rtcSignaling(e,mu,!0,c);case 1:return u=a.v,l=u.code,a.a(2,l)}},a,this)}))}},{key:"setRTCCDNUris",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a;return _().w(function(n){for(;;)switch(n.n){case 0:return i=this.codec.encode(lu.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(lu.RtcValueInfo,{key:"cdn_uris",value:r},!0)}),n.n=1,this.context.rtcSignaling(e,mu,!0,i);case 1:return o=n.v,a=o.code,n.a(2,a)}},n,this)}))}},{key:"getRTCData",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u,l,d;return _().w(function(i){for(;;)switch(i.n){case 0:return o=this.codec.encode(lu.RtcDataInput,{interior:r,target:n,key:t}),i.n=1,this.context.rtcSignaling(e,vu,!0,o);case 1:if(a=i.v,s=a.code,c=a.buffer,s===ke&&c){i.n=2;break}return i.a(2,{code:s});case 2:return u=this.codec.decode(lu.RtcQryOutput,c),l=u.outInfo,d={},l.forEach(function(e){d[e.key]=e.value}),i.a(2,{code:s,data:d})}},i,this)}))}},{key:"removeRTCData",value:function(e,t,r,n,i){return K(this,void 0,void 0,_().m(function o(){var a,s,c;return _().w(function(o){for(;;)switch(o.n){case 0:return a=this.codec.encode(lu.RtcDataInput,{interior:r,target:n,key:t,objectName:(null==i?void 0:i.name)||"",content:(null==i?void 0:i.content)||""}),o.n=1,this.context.rtcSignaling(e,Tu,!1,a);case 1:return s=o.v,c=s.code,o.a(2,c)}},o,this)}))}},{key:"setRTCOutData",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)switch(e.n){case 0:throw new Error("JSEngine's method not implemented.");case 1:return e.a(2)}},e)}))}},{key:"getRTCOutData",value:function(e,t){return K(this,void 0,void 0,_().m(function e(){return _().w(function(e){for(;;)switch(e.n){case 0:throw new Error("JSEngine's method not implemented.");case 1:return e.a(2)}},e)}))}},{key:"getRTCToken",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u;return _().w(function(n){for(;;)switch(n.n){case 0:return i=Bu(this.codec,t,r),n.n=1,this.context.rtcSignaling(e,Cu,!0,i);case 1:if(o=n.v,a=o.code,s=o.buffer,a===ke&&s){n.n=2;break}return n.a(2,{code:a});case 2:return c=this.codec.decode(lu.RtcTokenOutput,s),u=c.rtcToken,n.a(2,{code:a,data:{rtcToken:u}})}},n,this)}))}},{key:"setRTCState",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o;return _().w(function(r){for(;;)switch(r.n){case 0:return n=this.codec.encode(lu.MCFollowInput,{state:t}),r.n=1,this.context.rtcSignaling(e,Eu,!0,n);case 1:return i=r.v,o=i.code,r.a(2,o)}},r,this)}))}},{key:"setRTCStateByHttp",value:function(e,t,r,n){return K(this,void 0,void 0,_().m(function i(){var o,a,s,c,u;return _().w(function(i){for(;;)switch(i.p=i.n){case 0:return a=ju(this.codec,r,n),s=e,/^https:\/\//.test(e)||(s="https://".concat(e)),i.p=1,i.n=2,t.httpReq({url:"".concat(s,"/rtc/logserver/polaris"),body:a,method:D.POST,headers:{jwt:(null===(o=this.context.getNaviInfo())||void 0===o?void 0:o.jwtToken)||""},timeout:2e3});case 2:if((c=i.v).data){i.n=3;break}throw new Error("http request fail");case 3:return u=JSON.parse(c.data).resultCode,i.a(2,u);case 4:return i.p=4,i.v,i.a(2,lc.REPORT_FAIL)}},i,this,[[1,4]])}))}},{key:"getRTCUserList",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.RtcQueryListInput,{order:2}),t.n=1,this.context.rtcSignaling(e,Iu,!0,r);case 1:if(n=t.v,i=n.code,o=n.buffer,i===ke&&o){t.n=2;break}return t.a(2,{code:i});case 2:return a=Vu(this.codec,o),t.a(2,{code:i,data:a})}},t,this)}))}},{key:"joinLivingRoomAsAudience",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c,u,l,d,f;return _().w(function(n){for(;;)switch(n.n){case 0:return i=Bu(this.codec,t,r),n.n=1,this.context.rtcSignaling(e,Su,!0,i);case 1:if(o=n.v,a=o.code,s=o.buffer,a===ke&&s){n.n=2;break}return n.a(2,{code:a});case 2:return c=this.codec.decode(lu.RtcViewerJoinedOutput,s),u=c.rtcToken,l=c.entries,d=c.roomCreateTime,f=c.userJoinTime,this.roomCreateTime=Zr(d),this.userJoinTime=Zr(f),n.a(2,{code:a,data:{token:u,kvEntries:l}})}},n,this)}))}},{key:"quitLivingRoomAsAudience",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.SetUserStatusInput,{status:0}),t.n=1,this.context.rtcSignaling(e,yu,!0,r);case 1:return n=t.v,i=n.code,t.a(2,i)}},t,this)}))}},{key:"rtcIdentityChange",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c;return _().w(function(n){for(;;)switch(n.n){case 0:return i=this.codec.encode(lu.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:r,identityChangeType:t,needSysChatroom:!1}),n.n=1,this.context.rtcSignaling(e,Ou,!0,i);case 1:if(o=n.v,a=o.code,s=o.buffer,a===ke&&s){n.n=2;break}return n.a(2,{code:a});case 2:return c=Vu(this.codec,s),n.a(2,{code:a,data:c})}},n,this)}))}},{key:"requestRoomPK",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c,u,l;return _().w(function(t){for(;;)switch(t.n){case 0:return r=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,o=e.inviteTimeout,a=e.inviteInfo,s=e.roomId,c=this.codec.encode(lu.RtcInviteInput,{invitedRoomId:r,invitedUserId:n,inviteSessionId:i,timeoutTime:o,inviteInfo:a}),t.n=1,this.context.rtcSignaling(s,Lu,!0,c);case 1:return u=t.v,l=u.code,t.a(2,l)}},t,this)}))}},{key:"cancelRoomPK",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c,u;return _().w(function(t){for(;;)switch(t.n){case 0:return r=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(lu.RtcCancelInviteInput,{invitedRoomId:r,invitedUserId:n,inviteSessionId:i,inviteInfo:o}),t.n=1,this.context.rtcSignaling(a,ku,!0,s);case 1:return c=t.v,u=c.code,t.a(2,u)}},t,this)}))}},{key:"responseRoomPK",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c,u,l,d,f;return _().w(function(t){for(;;)switch(t.n){case 0:return r=e.inviteUserId,n=e.inviteRoomId,i=e.inviteSessionId,o=e.content,a=e.key,s=e.value,c=e.agree,u=e.roomId,l=this.codec.encode(lu.RtcInviteAnswerInput,{inviteUserId:r,inviteRoomId:n,inviteSessionId:i,content:o,key:a,value:s,answerCode:c?1:0}),t.n=1,this.context.rtcSignaling(u,Au,!0,l);case 1:return d=t.v,f=d.code,t.a(2,f)}},t,this)}))}},{key:"endRoomPK",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c,u;return _().w(function(t){for(;;)switch(t.n){case 0:return r=e.endRoomId,n=e.sessionId,i=e.content,o=e.keys,a=e.roomId,s=this.codec.encode(lu.RtcEndInviteInput,{inviteRoomId:r,inviteSessionId:n,inviteContent:i,inviteRoomKeys:o}),t.n=1,this.context.rtcSignaling(a,Nu,!0,s);case 1:return c=t.v,u=c.code,t.a(2,u)}},t,this)}))}},{key:"getRTCJoinedUserInfo",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.RtcQueryUserJoinedInput,{userId:e}),t.n=1,this.context.rtcSignaling("",wu,!0,r);case 1:if(n=t.v,i=n.code,o=n.buffer,i===ke&&o){t.n=2;break}return t.a(2,{code:i});case 2:return a=this.codec.decode(lu.RtcQueryUserJoinedOutput,o).info||[],t.a(2,{code:i,data:a.map(function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Zr(e.joinTime)}})})}},t,this)}))}},{key:"pullRTCRoomEntry",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s,c;return _().w(function(t){for(;;)switch(t.n){case 0:return r=this.codec.encode(lu.RtcPullKV,{timestamp:0,roomId:e}),t.n=1,this.context.rtcSignaling(e,bu,!0,r);case 1:if(n=t.v,i=n.code,o=n.buffer,i===ke){t.n=2;break}return t.a(2,{code:i});case 2:return a=this.codec.decode(lu.RtcKVOutput,o),s=a.entries,c=a.syncTime,s=(s||[]).map(function(e){return Object.assign(Object.assign({},e),{timestamp:Zr(e.timestamp)})}),t.a(2,{code:i,data:{kvEntries:s,syncTime:Zr(c)}})}},t,this)}))}},{key:"pullRTCRoomStatus",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s;return _().w(function(r){for(;;)switch(r.n){case 0:return n=this.codec.encode(lu.RtcRoomStatusInput,{version:t}),r.n=1,this.context.rtcSignaling(e,Pu,!0,n);case 1:if(i=r.v,o=i.code,a=i.buffer,o===ke){r.n=2;break}return r.a(2,{code:o});case 2:return s=this.codec.decode(lu.RtcRoomStatusOutput,a),r.a(2,{code:o,data:s})}},r,this)}))}},{key:"decodeRtcNotify",value:function(e){var t=this.codec.decode(lu.RtcNotifyMsg,e),r=t.time,n=t.type,i=t.roomId;return{time:Zr(r),type:n,roomId:i}}},{key:"getCurrentId",value:function(){return this.context.getCurrentId()}},{key:"getNaviInfo",value:function(){return this.context.getNaviInfo()}},{key:"getConnectionStatus",value:function(){return this.context.getConnectionStatus()}},{key:"getAppkey",value:function(){return this.context.getAppkey()}},{key:"webRtcPing",value:function(e,t,r){return K(this,void 0,void 0,_().m(function n(){var i,o,a,s,c;return _().w(function(n){for(;;)switch(n.n){case 0:return i=this.codec.encode(lu.RtcInput,{roomType:t,broadcastType:r}),n.n=1,this.context.rtcSignaling(e,Uu,!0,i);case 1:if(o=n.v,a=o.code,s=o.buffer,a===ke){n.n=2;break}return n.a(2,{code:a});case 2:return(c=this.codec.decode(lu.RtcOutput,s)).version=Zr(c.version),n.a(2,{code:a,data:c})}},n,this)}))}},{key:"rtcPing",value:function(e,t,r){var n,i;return/Electron/.test(navigator.userAgent)?null===(i=(n=this.context).rtcPingResVersion)||void 0===i?void 0:i.call(n,e,t,r):this.webRtcPing(e,t,r)}},{key:"sendMessage",value:function(e,t,r){return this.context.sendMessage(e,t,r)}},{key:"registerRTCSignalListener",value:function(e){this.context.registerRTCSignalListener(e)}},{key:"registerConnectionStateChangeListener",value:function(e){var t,r;null===(r=(t=this.context).registerConnectionStateChangeListener)||void 0===r||r.call(t,e)}},{key:"registerDisconnectListener",value:function(e){var t,r;null===(r=(t=this.context).registerDisconnectListener)||void 0===r||r.call(t,e)}},{key:"registerDestroyListener",value:function(e){var t,r;null===(r=(t=this.context).registerDestroyListener)||void 0===r||r.call(t,e)}},{key:"registerMessageListener",value:function(e){var t,r;null===(r=(t=this.context).registerMessageListener)||void 0===r||r.call(t,e)}},{key:"getCoreVersion",value:function(){return this.context.getCoreVersion()}},{key:"getPluginContext",value:function(){return this.context}},{key:"reportSDKInfo",value:function(e){var t=this.codec.encode(lu.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Du,!0,t)}},{key:"decodeAsrText",value:function(e,t){var r;try{r=this.codec.decode(lu.AsrResTextMsg,e)}catch(r){console.error("decodeAsrText error",{error:r,seiFrameData:e.join(","),seiOriginData:t.join(",")})}var n=r||{asr:[]},i=n.type,o=n.uid;return n.asr.map(function(e){var t=e.bms,r=e.t,n=e.isEnd,a=e.msgId,s=e.lang,c={userID:o,timeUTC:t,msg:r,msgId:a,isEnd:n};return i===Mu.SUBTITLE?c:Object.assign(Object.assign({},c),{destLangCode:s})})}}])}(),Ju=function(){function e(t,i,o){var a,s,c;return n(this,e),a=r(this,e,[t]),Object.defineProperty(a,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"_options",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Ha.setSdpSemantics(o.sdpSemantics||"unified-plan",a._logger),a._service=new ya(a._runtime,a._context,a._options.mediaServer,a._options.timeout),a._context.registerConnectionStateChangeListener(a._onIMStatusChange.bind(a)),a._context.registerDestroyListener(a._onIMUninit.bind(a)),a._context.registerMessageListener(a._handleMessage.bind(a)),null===(c=(s=a._context.getPluginContext()).setOnnavidatachange)||void 0===c||c.call(s,a.naviDataChange.bind(a)),a}return l(e,$c),o(e,[{key:"_handleMessage",value:function(e){if(e.conversationType!==Ee.RTC_ROOM)return!1;var t=this._logger.createTraceId();this._crtRoom instanceof Jc&&this._getJoinedPKRoomList().forEach(function(r){r.__parseInnerMessage(e,t)});return this._logger.info(Oe.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:Le.SUCCESSED,message:e}),t),this._crtRoom?(this._crtRoom.__parseInnerMessage(e,t),!0):(this._logger.warn(Oe.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:Le.FAILED,message:"the crtRoom is empty"}),t),!0)}},{key:"naviDataChange",value:function(e){this._logger.info(Oe.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.clearMSList(),this._service.isNededDetector()&&this._service.detectorMediaSever()}},{key:"_getJoinedPKRoomList",value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,r=e.roomPKHandler;if(t===exports.RCRTCCode.SUCCESS&&r){var n=r.getJoinedPKRooms()||{};return Object.values(n)}return[]}},{key:"getPluginContext",value:function(){return this._context.getPluginContext()}},{key:"getCurrentId",value:function(){return this._context.getCurrentId()}},{key:"joinCrossRTCRoom",value:function(e,t,r){return K(this,arguments,void 0,function(e,t,r){var n=this;return arguments.length>4&&void 0!==arguments[4]||exports.RTCMode.CROSS_MUTI,_().m(function i(){return _().w(function(i){for(;;)if(0===i.n)return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),i.a(2,n.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:exports.RTCMode.CROSS_MUTI}))},i)})()})}},{key:"joinRTCRoom",value:function(e,t,r){return K(this,arguments,void 0,function(e,t,r){var n=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:exports.RTCMode.RTC;return _().m(function o(){return _().w(function(o){for(;;)if(0===o.n)return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),o.a(2,n.joinRTCRoomWithOptions(e,{mode:i,joinType:t,userData:r}))},o)})()})}},{key:"joinRTCRoomWithOptions",value:function(e,t){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s=this;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(Oe.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),n),!this._crtRoom){r.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),r.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 1:return i=this._crtRoom=new Hc(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt),r.n=2,i.__innerInit((null==t?void 0:t.mode)||exports.RTCMode.RTC,null==t?void 0:t.joinType,void 0,void 0,null==t?void 0:t.userData,n,null==t?void 0:t.srcLanguage,null==t?void 0:t.nickName);case 2:if(o=r.v,(a=o.code)===exports.RCRTCCode.SUCCESS){r.n=3;break}return this._crtRoom=null,r.a(2,{code:a});case 3:return i.once(Lc,function(){s._crtRoom=null}),r.a(2,{code:a,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()})}},r,this)}))}},{key:"joinLivingRoom",value:function(e,t,r,n){return K(this,arguments,void 0,function(e,t,r,n){var i=this;return _().m(function o(){var a,s,c,u,l;return _().w(function(o){for(;;)switch(o.n){case 0:if(a=i._logger.createTraceId(),i._logger.info(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:r,outerUserDatas:n}),a),!i._crtRoom){o.n=1;break}return i._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),a),o.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 1:return s=i._crtRoom=new Jc(i._context,i._runtime,e,i._service,i._options,t,!1,!0),o.n=2,s.__innerInit(exports.RTCMode.LIVE,r,t,void 0,n,a);case 2:if(c=o.v,(u=c.code)===exports.RCRTCCode.SUCCESS){o.n=3;break}return i._crtRoom=null,o.a(2,{code:u});case 3:return s.once(Lc,function(){i._crtRoom=null}),l={code:u,room:s,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},s.__getCDNPushMode()===Wc.MANUAL&&Object.assign(l,{CDNEnable:s.__getCDNEnable()}),o.a(2,l)}},o)})()})}},{key:"getAudienceClient",value:function(e){return this._audience||(this._audience=new Yc(this._context,this._runtime,this._options)),this._logger.info(Oe.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}},{key:"_onIMStatusChange",value:function(e,t){if(this._logger.info(Oe.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:e,code:t,desc:Ie[e]})),e===Ie.SUSPENDED&&40001===t&&this._service.clearMSList(),e===Ie.DISCONNECTED){if(this._crtRoom){var r=exports.RCKickReason.IM_DISCONNECTED;40002===t?r=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:t===Ae&&(r=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:r}]})}}else if(e===Ie.CONNECTED){if(this._service.isNededDetector()&&this._service.detectorMediaSever(),this._crtRoom instanceof Jc)this._getJoinedPKRoomList().forEach(function(e){e.__onReconnected()});this._crtRoom&&this._crtRoom.__onReconnected()}}},{key:"_onIMUninit",value:function(){var e;this._logger.info(Oe.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"TODO -> on IM client ondestroy"})),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}},{key:"leaveRoom",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n;return _().w(function(t){for(;;)switch(t.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(Oe.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),n),this._crtRoom){t.n=1;break}return this._logger.warn(Oe.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:Le.FAILED,msg:"Room does not exist, without leave"}),n),t.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:return t.n=2,this._crtRoom.__destroy(!0);case 2:return this._service.isNededDetector()&&this._service.detectorMediaSever(),this._logger.info(Oe.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomId:null===(r=this._crtRoom)||void 0===r?void 0:r.getRoomId()}),n),this._crtRoom=null,t.a(2,{code:exports.RCRTCCode.SUCCESS})}},t,this)}))}},{key:"joinLivingRoomAsAudience",value:function(e,t,r){return K(this,void 0,void 0,_().m(function r(){var n,i,o,a,s,c;return _().w(function(r){for(;;)switch(r.n){case 0:if(n=this._logger.createTraceId(),this._logger.info(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e,livingType:t}),n),this._service.isNededDetector()&&this._service.detectorMediaSever(),!qr(this._context.getNaviInfo())){r.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),n),r.a(2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR});case 1:if(j("roomId",e,k,!0)&&j("livingType",t,function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO})){r.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),n),r.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){r.n=3;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),n),r.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:if(this._service.getMsList().length){r.n=4;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),n),r.a(2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER});case 4:return r.n=5,this._context.joinLivingRoomAsAudience(e,exports.RTCMode.LIVE,t);case 5:if(i=r.v,o=i.code,a=i.data,o===ke){r.n=6;break}return this._logger.error(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:o,msg:"signal error -> audience join room"}),n),r.a(2,{code:exports.RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED});case 6:return s=ga(),c=new Qc(this._context,this._runtime,this._options,e,a,t,s),this._crtAudienceLivingRoom=c,this._logger.info(Oe.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.SUCCESSED,roomData:a}),n),r.a(2,{room:c,code:exports.RCRTCCode.SUCCESS,userIds:c.getRemoteUserIds(),RTCTracks:c.getRemoteRTCTracks(),MCUTracks:c.getRemoteMCUTracks(),CDNUris:c.getCDNInfo()})}},r,this)}))}},{key:"leaveLivingRoomAsAudience",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(Oe.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e.getRoomId(),userId:this._context.getCurrentId()}),r),this._crtAudienceLivingRoom){t.n=1;break}return this._logger.warn(Oe.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,msg:"Room does not exist, without leave"}),r),t.a(2,{code:exports.RCRTCCode.SUCCESS});case 1:if(this._crtAudienceLivingRoom===e){t.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:return t.n=3,this._crtAudienceLivingRoom.__destroy(!0);case 3:return this._crtAudienceLivingRoom=null,this._logger.info(Oe.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:Le.SUCCESSED}),r),t.a(2,{code:exports.RCRTCCode.SUCCESS})}},t,this)}))}},{key:"upgradeToAnchorRoom",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s=this;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(Oe.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,r),j("room",e,function(){return e instanceof Qc},!0)){t.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(n=e.getRoomId(),!this._crtRoom){t.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:n}),r),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 2:return i=this._crtRoom=new Jc(this._context,this._runtime,n,this._service,this._options,e.livingType,!0,!0,e.getClientSessionId()),t.n=3,i.__innerInitByIdentityChange(r);case 3:if((o=t.v)===ke){t.n=4;break}return this._crtRoom=null,t.a(2,{code:o});case 4:return i.once(Lc,function(){s._crtRoom=null}),t.n=5,this._crtAudienceLivingRoom.__destroy(!1);case 5:return this._crtAudienceLivingRoom=null,a={room:i,code:exports.RCRTCCode.SUCCESS,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()},i.__getCDNPushMode()===Wc.MANUAL&&Object.assign(a,{CDNEnable:i.__getCDNEnable()}),t.a(2,a)}},t,this)}))}},{key:"downgradeToAudienceRoom",value:function(e){return K(this,void 0,void 0,_().m(function t(){var r,n,i,o,a,s;return _().w(function(t){for(;;)switch(t.n){case 0:if(r=this._logger.createTraceId(),this._logger.info(Oe.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:e._roomId,userId:this._context.getCurrentId()}),r),e.isMainRoom()){t.n=1;break}return this._logger.error(Oe.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),r),t.a(2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM});case 1:if(j("room",e,function(){return e instanceof Jc},!0)){t.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),t.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){t.n=3;break}return this._logger.error(Oe.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),t.a(2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM});case 3:return t.n=4,this._context.rtcIdentityChange(e._roomId,Bc.AnchorToViewer,e.getLivingType());case 4:if(n=t.v,i=n.code,o=n.data,i===ke){t.n=5;break}return this._logger.error(Oe.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),r),t.a(2,{code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED});case 5:return this._logger.info(Oe.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:Le.SUCCESSED,roomData:o}),r),a=e.getClientSessionId(),s=new Qc(this._context,this._runtime,this._options,e._roomId,o,e.getLivingType(),a),this._crtAudienceLivingRoom=s,this._crtRoom.__destroy(!1),this._crtRoom=null,t.a(2,{room:s,code:exports.RCRTCCode.SUCCESS,userIds:s.getRemoteUserIds(),RTCTracks:s.getRemoteRTCTracks(),MCUTracks:s.getRemoteMCUTracks(),CDNUris:s.getCDNInfo()})}},t,this)}))}},{key:"getJoinedRoomInfo",value:function(){return K(this,void 0,void 0,_().m(function e(){var t,r,n,i,o;return _().w(function(e){for(;;)switch(e.n){case 0:return t=this._logger.createTraceId(),r=this._context.getCurrentId(),this._logger.error(Oe.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:r}),t),e.n=1,this._context.getRTCJoinedUserInfo(r);case 1:if(n=e.v,i=n.code,o=n.data,i===ke){e.n=2;break}return this._logger.error(Oe.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:Le.FAILED,code:i}),t),e.a(2,{code:i});case 2:return this._logger.info(Oe.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:Le.SUCCESSED,roomInfo:o}),t),e.a(2,{code:exports.RCRTCCode.SUCCESS,data:o})}},e,this)}))}},{key:"generateSummarization",value:function(e,t){return K(this,arguments,void 0,function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return _().m(function s(){var c,u,l,d,f,h,p;return _().w(function(s){for(;;)switch(s.n){case 0:if(c=r._logger.createTraceId(),r._logger.info(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T,JSON.stringify({roomId:e,taskId:t,startTime:n,endTime:i,config:o,contentBlock:a}),c),j("roomId",e,k,!0)){s.n=1;break}return r._logger.error(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(j("taskId",t,k,!0)){s.n=2;break}return r._logger.error(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(O(n)&&!(n<0)){s.n=3;break}return r._logger.error(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(O(i)&&!(i<0)){s.n=4;break}return r._logger.error(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(j("config",o,A,!0)){s.n=5;break}return r._logger.error(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:return u=Xr(o),l=u.isValid,d=u.key,l||r._logger.warn(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config.".concat(d)}),c),s.n=6,r._service.generateSummarization(e,t,n,i,o,a,c);case 6:if(f=s.v,h=f.code,p=f.msg,h===exports.RCRTCCode.SUCCESS){s.n=7;break}return r._logger.error(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.FAILED,code:h,msg:p}),c),s.a(2,{code:h});case 7:return r._logger.info(Oe.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:Le.SUCCESSED}),c),s.a(2,{code:h})}},s)})()})}},{key:"getASRContent",value:function(e,t){return K(this,arguments,void 0,function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return _().m(function s(){var c,u,l,d;return _().w(function(s){for(;;)switch(s.n){case 0:if(c=r._logger.createTraceId(),r._logger.info(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_T,JSON.stringify({roomId:e,taskId:t,startTime:n,endTime:i,destLang:a,contentBlock:o}),c),j("roomId",e,k,!0)){s.n=1;break}return r._logger.error(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 1:if(j("taskId",t,k,!0)){s.n=2;break}return r._logger.error(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 2:if(O(n)&&!(n<0)){s.n=3;break}return r._logger.error(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 3:if(O(i)&&!(i<0)){s.n=4;break}return r._logger.error(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 4:if(j("destLang",a,y,!1)){s.n=5;break}return r._logger.error(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> destLang"}),c),s.a(2,{code:exports.RCRTCCode.PARAMS_ERROR});case 5:return s.n=6,r._service.getASRContent(e,t,n,i,o,c,a);case 6:if(u=s.v,l=u.code,d=u.msg,l===exports.RCRTCCode.SUCCESS){s.n=7;break}return r._logger.error(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.FAILED,code:l,msg:d}),c),s.a(2,{code:l});case 7:return r._logger.info(Oe.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:Le.SUCCESSED}),c),s.a(2,{code:l})}},s)})()})}}],[{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=r.logger;if(i.warn(Oe.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.1-nctest-alpha.3",Commit:"c96e5775862767fb76abb0c16a37ad4961f58f6a","browserInfo.browser":jr.browser,"browserInfo.supportsUnifiedPlan":jr.supportsUnifiedPlan,"browserInfo.version":jr.version})),V("options",t,S.OBJECT,!0),V("options.mediaServer",t.mediaServer,function(e){return!(!P(e)||"https:"===location.protocol&&!/^https/.test(e))}),V("options.timeout",t.timeout,function(e){return O(e)&&e>=5e3&&e<=3e4}),V("options.pingGap",t.pingGap,function(e){return O(e)&&e>=3e3&&e<=1e4}),t.AAAWorklet){V("options.AAAWorklet",t.AAAWorklet,S.OBJECT,!0);var o=t.AAAWorklet,a=o.scriptUrl,s=o.wasmUrl;V("AAAWorklet.scriptUrl",a,S.STRING,!0),V("AAAWorklet.wasmUrl",s,S.STRING,!0),cr.SCRIPT_URL=a,cr.WASM_URL=s}return t.encryptor&&(V("options.encrypt",t.encryptor,S.OBJECT,!0),V("options.encrypt.decodeAudio",t.encryptor.decodeAudio,function(e){return"function"==typeof e},!0),V("options.encrypt.decodeVideo",t.encryptor.decodeVideo,function(e){return"function"==typeof e},!0),V("options.encrypt.encodeAudio",t.encryptor.encodeAudio,function(e){return"function"==typeof e},!0),V("options.encrypt.encodeVideo",t.encryptor.encodeVideo,function(e){return"function"==typeof e},!0),Ba.init(t.encryptor,i)),e._instance||(e._instance=new e(new Gu(r),n,t)),e._instance}}])}();Object.defineProperty(Ju,"_instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.RTCJoinType=void 0,(Fu=exports.RTCJoinType||(exports.RTCJoinType={}))[Fu.KICK=0]="KICK",Fu[Fu.REFUSE=1]="REFUSE",e.VersionManage.add("rtclib","5.36.1-nctest-alpha.3");var Hu={tag:"RCRTC",verify:function(){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("26.1.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '","26.1.0","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(e){var t=function(e){const t={logger:(le.RTC,r=e.createLogger("RCRTC","RTC"),new fe({writeLog(e,t,n,i){switch(e){case ue.Debug:r.debug(t,n,i);break;case ue.Info:r.info(t,n,i);break;case ue.Warn:r.warn(t,n,i);break;case ue.Error:r.error(t,n,i);break;case ue.STATISTICS:r.__statistics(t,n,i);break;default:r.info(t,n,i)}},setOutputLevel(e){r.setOutputLevel(e)}})),rtcSignaling(t,r,n,i){return K(this,void 0,void 0,function*(){const o=yield e.rtcSignaling(t,r,n,i);return{code:Ce.errorCode.toCommon(null==o?void 0:o.code),buffer:null==o?void 0:o.buffer}})},registerRTCSignalListener(t){e.registerRTCSignalListener(t)},sendGroupCallSignalInfo(t,r,n){return K(this,void 0,void 0,function*(){const i=yield e.setCallInfo(t,r,n);return{code:Ce.errorCode.toCommon(i.code),data:i.data}})},registerGroupCallSignalInfoListener(t){e.onCallInfo=e=>{t(e)}},setOnnavidatachange(t){const r=t?e=>{const r=Ce.naviInfo.toCommon(e);t(r)}:void 0;e.onnavidatachange=r},refetchNaviInfo:e.refetchNaviInfo?()=>K(this,void 0,void 0,function*(){yield e.refetchNaviInfo()}):void 0,registerConnectionStateChangeListener(t){e.onconnectionstatechange=(e,r)=>{t(Ce.connectionStatus.toCommon(e),Ce.errorCode.toCommon(null!=r?r:0))}},registerDisconnectListener(t){e.ondisconnect=t},registerDestroyListener(t){e.ondestroy=t},registerMessageListener(t){const r=t?e=>t(Ce.receivedMessage.toCommon(e)):void 0;e.onmessage=r},sendMessage(t,r,n){return K(this,void 0,void 0,function*(){const i=Ce.conversationType.toNative(t),o=Ce.sendMsgOptions.toNative(n),a=yield e.sendMessage(i,r,o);return{code:Ce.errorCode.toCommon(a.code),data:void 0!==a.data?Ce.receivedMessage.toCommon(a.data):void 0}})},getCurrentId:()=>e.getCurrentId(),getNaviInfo(){const t=e.getNaviInfo();return null!=t?Ce.naviInfo.toCommon(t):null},getConnectionStatus:()=>Ce.connectionStatus.toCommon(e.getConnectionStatus()),getAppkey:()=>e.getAppkey(),getCoreVersion:()=>e.getCoreVersion(),registerMessageType(t,r,n,i){e.registerMessageType(t,r,n,i)}};var r;return e.rtcPingResVersion&&(t.rtcPingResVersion=(t,r,n)=>K(this,void 0,void 0,function*(){const i=yield e.rtcPingResVersion(t,r,n);return{code:Ce.errorCode.toCommon(i.code),data:i.data}})),t}(e);return t.logger.warn(Oe.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.36.1-nctest-alpha.3",Commit:"c96e5775862767fb76abb0c16a37ad4961f58f6a","browserInfo.browser":jr.browser,"browserInfo.supportsUnifiedPlan":jr.supportsUnifiedPlan,"browserInfo.version":jr.version})),new Ju(new Gu(t),_e,{})}},Ku={transResolution:Mr,transFrameRate:Vr,parseTrackId:Nr,ifSupportLocalFileTrack:Fr,ifSupportScreenShare:Gr};exports.RCAbstractRoom=kc,exports.RCAudienceClient=Yc,exports.RCAudienceLivingRoom=Qc,exports.RCCameraVideoTrack=Rr,exports.RCLivingRoom=Jc,exports.RCLocalAudioTrack=lr,exports.RCLocalFileAudioTrack=pr,exports.RCLocalFileTrack=_r,exports.RCLocalFileVideoTrack=hr,exports.RCLocalTrack=ur,exports.RCLocalVideoTrack=dr,exports.RCMCUConfigBuilder=Pc,exports.RCMediaStreamCapture=$c,exports.RCMicphoneAudioTrack=gr,exports.RCRTCClient=Ju,exports.RCRTCRoom=Hc,exports.RCRemoteAudioTrack=Cr,exports.RCRemoteTrack=Tr,exports.RCRemoteVideoTrack=Er,exports.RCScreenAudioTrack=vr,exports.RCScreenVideoTrack=mr,exports.RCTag={DEFAULT:"RongCloudRTC"},exports.RCTrack=ir,exports.device=rr,exports.helper=Ku,exports.installer=Hu;
|