@rongcloud/plugin-rtc 5.36.1-nctest-alpha.3 → 5.38.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -3
- package/dist/index.d.ts +95 -36
- package/dist/index.esm.js +2 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
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
|
-
/*! 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,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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,n,o,a=function(){return a=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function s(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function c(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function d(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,exports.RCRTCCode=void 0,(i=exports.RCRTCCode||(exports.RCRTCCode={}))[i.SUCCESS=1e4]="SUCCESS",i[i.PB_ERROR=40001]="PB_ERROR",i[i.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",i[i.PARAMS_ERROR=50001]="PARAMS_ERROR",i[i.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",i[i.NOT_IN_ROOM=50003]="NOT_IN_ROOM",i[i.SERVICE_INVALID=50004]="SERVICE_INVALID",i[i.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",i[i.ASR_NOT_AVAILABLE=50034]="ASR_NOT_AVAILABLE",i[i.ASR_NOT_START=50035]="ASR_NOT_START",i[i.SIGNAL_ERROR=53001]="SIGNAL_ERROR",i[i.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",i[i.REQUEST_FAILED=53004]="REQUEST_FAILED",i[i.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",i[i.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",i[i.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",i[i.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",i[i.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",i[i.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",i[i.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",i[i.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",i[i.INVALID_TAGS=53014]="INVALID_TAGS",i[i.INVALID_USER_ID=53015]="INVALID_USER_ID",i[i.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",i[i.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",i[i.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",i[i.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",i[i.TRACK_NOT_READY=53020]="TRACK_NOT_READY",i[i.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",i[i.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",i[i.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",i[i.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",i[i.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",i[i.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",i[i.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",i[i.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",i[i.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",i[i.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",i[i.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",i[i.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",i[i.JWT_TIME_OUT=1004]="JWT_TIME_OUT",i[i.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",i[i.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",i[i.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",i[i.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",i[i.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_A_SDP_STRATEGY_SET_SENDER_TRANSFORM_O="L-a_sdp_strategy_set_sender_transform-O",e.L_A_SDP_STRATEGY_SET_RECEIVER_TRANSFORM_O="L-a_sdp_strategy_set_receiver_transform-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"}(n||(n={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(o||(o={}));let _=!0,p=!0;function f(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function h(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.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 i=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,i])},Object.defineProperty(i,"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 R(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(_=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function b(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(p=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function g(){if("object"==typeof window){if(_)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function m(e,t){p&&console.warn(e+" is deprecated, please use "+t+" instead.")}function C(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e){return C(e)?Object.keys(e).reduce((function(t,r){const i=C(e[r]),n=i?v(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function T(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?T(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{T(e,e.get(t),r)}))})))}function O(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===i&&r.trackId===t.id&&T(e,r,n)}))})),n}const S=g;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=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 i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(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=i(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=i(e.video),S("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return S("chrome: "+JSON.stringify(e)),n(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,i){n(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(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 I(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function y(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 i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else h(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function L(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,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.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 i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.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 A(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=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 n=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 i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])})).then(r,i)}}function P(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=>O(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}),h(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>O(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,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||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 N(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 i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};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 i=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=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]})),n.apply(this,arguments)}}function w(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return N(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 i=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}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.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 i=[].slice.call(arguments,1);if(1!==i.length||!i[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 n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[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]=i[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 i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.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 D(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],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function k(e,t){h(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var U=Object.freeze({__proto__:null,shimMediaStream:I,shimOnTrack:y,shimGetSendersWithDtmf:L,shimGetStats:A,shimSenderReceiverGetStats:P,shimAddTrackRemoveTrackWithNative:N,shimAddTrackRemoveTrack:w,shimPeerConnection:D,fixNegotiationNeeded:k,shimGetUserMedia:E,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 i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var M,x,j=(M=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]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:r[t[i]]=t[i+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={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].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 i=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.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)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+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 i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.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:[]},i=t.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],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 i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));var n=0;return r.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),i+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){var r,i=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.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]),n.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}),i.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&c&&i.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,i.forEach((function(e){e.maxBitrate=l}))),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,i=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(r=parseInt(n[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:i.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,i){var n=void 0!==r?r:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,i,n){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"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:"+n.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 i=t.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].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),i=0;i<r.length;i++)if(r[i].length<2||"="!==r[i].charAt(1))return!1;return!0},e.exports=t},M(x={exports:{}},x.exports),x.exports);function B(e,t,r,i,n){var o=j.writeRtpDescription(e.kind,t);if(o+=j.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=j.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":n||"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:"+(i?i.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:"+j.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+j.localCName+"\r\n"),o}function V(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=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]},n=function(e,t,r,n){var o=i(e.parameters.apt,r),a=i(t.parameters.apt,n);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(i){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(i.name.toLowerCase()===a.name.toLowerCase()&&i.clockRate===a.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&a.parameters.apt&&!n(i,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(i.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var i=0;i<t.headerExtensions.length;i++){var n=t.headerExtensions[i];if(e.uri===n.uri){r.headerExtensions.push(n);break}}})),r}function F(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 J(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 G(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 H=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function i(t,r,i,n){var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=n,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var n=function(r){var i=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){i[e]=n[e].bind(n)})),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 G("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 i=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof i;return n&&(i=[i]),i=i.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=n?i[0]:i,!!i.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=j.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(n.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(n.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},n.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,i={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)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();i.iceTransport=n.iceTransport,i.dtlsTransport=n.dtlsTransport}return t||this.transceivers.push(i),i},n.prototype.addTrack=function(t,r){if(this._isClosed)throw G("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i;if(this.transceivers.find((function(e){return e.track===t})))throw G("InvalidAccessError","Track already exists.");for(var n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==t.kind||(i=this.transceivers[n]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),i.track=t,i.stream=r,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},n.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var i=e.clone();e.getTracks().forEach((function(e,t){var r=i.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),i.getTracks().forEach((function(e){r.addTrack(e,i)}))}},n.prototype.removeTrack=function(t){if(this._isClosed)throw G("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 G("InvalidAccessError","Sender was not created by this connection.");var i=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},n.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)}))},n.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},n.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},n.prototype._createIceGatherer=function(t,r){var i=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"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;n.state=r?"completed":"gathering",null!==i.transceivers[t].bufferedCandidateEvents&&i.transceivers[t].bufferedCandidateEvents.push(e)},n.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),n},n.prototype._gather=function(t,r){var i=this,n=this.transceivers[r].iceGatherer;if(!n.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,n.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),n.onlocalcandidate=function(e){if(!(i.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"!==n.state&&"gathering"!==n.state||(n.state="completed");else{"new"===n.state&&(n.state="gathering"),a.component=1,a.ufrag=n.getLocalParameters().usernameFragment;var c=j.writeCandidate(a);o.candidate=Object.assign(o.candidate,j.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=j.getMediaSections(i._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",i._localDescription.sdp=j.getDescription(i._localDescription.sdp)+u.join("");var l=i.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==i.iceGatheringState&&(i.iceGatheringState="gathering",i._emitGatheringStateChange()),s||i._dispatchEvent("icecandidate",o),l&&(i._dispatchEvent("icecandidate",new Event("icecandidate")),i.iceGatheringState="complete",i._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){n.onlocalcandidate(e)}))}),0)}},n.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var i=new e.RTCDtlsTransport(r);return i.ondtlsstatechange=function(){t._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:i}},n.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 i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},n.prototype._transceive=function(e,r,i){var n=V(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(n.encodings=e.sendEncodingParameters,n.rtcp={cname:j.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(n.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(n)),i&&e.rtpReceiver&&n.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?n.encodings=e.recvEncodingParameters:n.encodings=[{}],n.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(n.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(n.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(n))},n.prototype.setLocalDescription=function(e){var t,r,i=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(G("TypeError",'Unsupported type "'+e.type+'"'));if(!F("setLocalDescription",e.type,i.signalingState)||i._isClosed)return Promise.reject(G("InvalidStateError","Can not set local "+e.type+" in state "+i.signalingState));if("offer"===e.type)t=j.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=j.parseRtpParameters(e);i.transceivers[t].localCapabilities=r})),i.transceivers.forEach((function(e,t){i._gather(e.mid,t)}));else if("answer"===e.type){t=j.splitSections(i._remoteDescription.sdp),r=t.shift();var n=j.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=i.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(j.isRejected(e)&&0===j.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var d=j.getIceParameters(e,r),_=j.getDtlsParameters(e,r);n&&(_.role="server"),i.usingBundle&&0!==t||(i._gather(o.mid,t),"new"===s.state&&s.start(a,d,n?"controlling":"controlled"),"new"===c.state&&c.start(_));var p=V(u,l);i._transceive(o,p.codecs.length>0,!1)}}))}return i._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?i._updateSignalingState("have-local-offer"):i._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(n){var o=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(G("TypeError",'Unsupported type "'+n.type+'"'));if(!F("setRemoteDescription",n.type,o.signalingState)||o._isClosed)return Promise.reject(G("InvalidStateError","Can not set remote "+n.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=j.splitSections(n.sdp),u=c.shift(),l=j.matchPrefix(u,"a=ice-lite").length>0,d=j.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var _=j.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!_&&_.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(i,c){var _=j.splitLines(i),p=j.getKind(i),f=j.isRejected(i)&&0===j.matchPrefix(i,"a=bundle-only").length,h=_[0].substr(2).split(" ")[2],R=j.getDirection(i,u),b=j.parseMsid(i),g=j.getMid(i)||j.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===h||"UDP/DTLS/SCTP"===h))o.transceivers[c]={mid:g,kind:p,protocol:h,rejected:!0};else{var m,C,v,T,O,S,E,I,y;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var L,A,P=j.parseRtpParameters(i);f||(L=j.getIceParameters(i,u),(A=j.getDtlsParameters(i,u)).role="client"),E=j.parseRtpEncodingParameters(i);var N=j.parseRtcpParameters(i),w=j.matchPrefix(i,"a=end-of-candidates",u).length>0,D=j.matchPrefix(i,"a=candidate:").map((function(e){return j.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===n.type||"answer"===n.type)&&!f&&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"!==n.type||f){if("answer"===n.type&&!f){C=(m=o.transceivers[c]).iceGatherer,v=m.iceTransport,T=m.dtlsTransport,O=m.rtpReceiver,S=m.sendEncodingParameters,I=m.localCapabilities,o.transceivers[c].recvEncodingParameters=E,o.transceivers[c].remoteCapabilities=P,o.transceivers[c].rtcpParameters=N,D.length&&"new"===v.state&&(!l&&!w||d&&0!==c?D.forEach((function(e){J(m.iceTransport,e)})):v.setRemoteCandidates(D)),d&&0!==c||("new"===v.state&&v.start(C,L,"controlling"),"new"===T.state&&T.start(A)),!V(m.localCapabilities,m.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&m.sendEncodingParameters[0].rtx&&delete m.sendEncodingParameters[0].rtx,o._transceive(m,"sendrecv"===R||"recvonly"===R,"sendrecv"===R||"sendonly"===R),!O||"sendrecv"!==R&&"sendonly"!==R?delete m.rtpReceiver:(y=O.track,b?(a[b.stream]||(a[b.stream]=new e.MediaStream),r(y,a[b.stream]),s.push([y,O,a[b.stream]])):(a.default||(a.default=new e.MediaStream),r(y,a.default),s.push([y,O,a.default])))}}else{(m=o.transceivers[c]||o._createTransceiver(p)).mid=g,m.iceGatherer||(m.iceGatherer=o._createIceGatherer(c,d)),D.length&&"new"===m.iceTransport.state&&(!w||d&&0!==c?D.forEach((function(e){J(m.iceTransport,e)})):m.iceTransport.setRemoteCandidates(D)),I=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(I.codecs=I.codecs.filter((function(e){return"rtx"!==e.name}))),S=m.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var k,U=!1;if("sendrecv"===R||"sendonly"===R){if(U=!m.rtpReceiver,O=m.rtpReceiver||new e.RTCRtpReceiver(m.dtlsTransport,p),U)y=O.track,b&&"-"===b.stream||(b?(a[b.stream]||(a[b.stream]=new e.MediaStream,Object.defineProperty(a[b.stream],"id",{get:function(){return b.stream}})),Object.defineProperty(y,"id",{get:function(){return b.track}}),k=a[b.stream]):(a.default||(a.default=new e.MediaStream),k=a.default)),k&&(r(y,k),m.associatedRemoteMediaStreams.push(k)),s.push([y,O,k])}else m.rtpReceiver&&m.rtpReceiver.track&&(m.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===m.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),m.associatedRemoteMediaStreams=[]);m.localCapabilities=I,m.remoteCapabilities=P,m.rtpReceiver=O,m.rtcpParameters=N,m.sendEncodingParameters=S,m.recvEncodingParameters=E,o._transceive(o.transceivers[c],!1,U)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===n.type?"active":"passive"),o._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.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 n=new Event("addstream");n.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",n)}))}s.forEach((function(e){var t=e[0],n=e[1];r.id===e[2].id&&i(o,t,n,[r])}))}})),s.forEach((function(e){e[2]||i(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()},n.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")},n.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},n.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))},n.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)}},n.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)}},n.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(G("InvalidStateError","Can not call createOffer after close"));var i=r.transceivers.filter((function(e){return"audio"===e.kind})).length,n=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&&(i=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(n=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--n<0&&(e.wantReceive=!1)}));i>0||n>0;)i>0&&(r._createTransceiver("audio"),i--),n>0&&(r._createTransceiver("video"),n--);var a=j.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(i,n){var o=i.track,a=i.kind,s=i.mid||j.generateIdentifier();i.mid=s,i.iceGatherer||(i.iceGatherer=r._createIceGatherer(n,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"),i.remoteCapabilities&&i.remoteCapabilities.codecs&&i.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(i.remoteCapabilities&&i.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=i.sendEncodingParameters||[{ssrc:1001*(2*n+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),i.wantReceive&&(i.rtpReceiver=new e.RTCRtpReceiver(i.dtlsTransport,a)),i.localCapabilities=c,i.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+=B(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="+j.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)},n.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(G("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(G("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var i=j.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(i+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),i+="a=ice-options:trickle\r\n";var n=j.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>n)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?i+="m=application 0 DTLS/SCTP 5000\r\n":i+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?i+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(i+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(i+="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=V(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,i+=B(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(i+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:i});return Promise.resolve(o)},n.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(i,n){if(!r._remoteDescription)return n(G("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 n(G("OperationError","Can not add ICE candidate"));if(s.rejected)return i();var c=Object.keys(e.candidate).length>0?j.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return i();if(c.component&&1!==c.component)return i();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!J(s.iceTransport,c))return n(G("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=j.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=j.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=j.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=j.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);i()}))},n.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 G("InvalidAccessError","Invalid selector.");return r.getStats()}var i=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&i.push(e[t].getStats())}))})),Promise.all(i).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 i=r.prototype.getStats;r.prototype.getStats=function(){return i.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var i;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(i=e[r]).type]||i.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=n.prototype[e];n.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=n.prototype[e];n.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=n.prototype[e];n.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)}})),n};function K(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 W(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 z(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=H(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&&m("RTCIceServer.url","RTCIceServer.urls");const i="string"==typeof r;return i&&(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=i?r[0]:r,!!r.length}}))}(e.iceServers,t.version),g("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function Y(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var q=Object.freeze({__proto__:null,shimPeerConnection:z,shimReplaceTrack:Y,shimGetUserMedia:K,shimGetDisplayMedia:W});function Z(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){m("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(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)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.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 Q(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 X(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],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then((e=>{if(t.version<53&&!n)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(n,o)}}function $(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 ee(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}),h(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function te(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){m("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function re(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ie(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 i=t.apply(this,arguments);if(r){const{sender:t}=i,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 i})}function ne(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 oe(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 ae(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 se=Object.freeze({__proto__:null,shimOnTrack:Q,shimPeerConnection:X,shimSenderGetStats:$,shimReceiverGetStats:ee,shimRemoveStream:te,shimRTCDataChannel:re,shimAddTransceiver:ie,shimGetParameters:ne,shimCreateOffer:oe,shimCreateAnswer:ae,shimGetUserMedia:Z,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 ce(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 ue(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 le(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let s=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=s,s=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=s,s=function(e,t,r){const i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=s}function de(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(_e(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function _e(e){return e&&void 0!==e.video?Object.assign({},e,{video:v(e.video)}):e}function pe(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 i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(m("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):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 fe(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 he(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 Re(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var be=Object.freeze({__proto__:null,shimLocalStreamsAPI:ce,shimRemoteStreamsAPI:ue,shimCallbacksAPI:le,shimGetUserMedia:de,shimConstraints:_e,shimRTCIceServerUrls:pe,shimTrackEventTransceiver:fe,shimCreateOfferLegacy:he,shimAudioContext:Re});function ge(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),i=j.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,h(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function me(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=j.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=j.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),i=function(e,r){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=j.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i}(arguments[0],e);let n;n=0===r&&0===i?Number.POSITIVE_INFINITY:0===r||0===i?Math.max(r,i):Math.min(r,i);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>n}),this._sctp=o}return r.apply(this,arguments)}}function Ce(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>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},h(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ve(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 Te(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 Oe(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 Se=Object.freeze({__proto__:null,shimRTCIceCandidate:ge,shimMaxMessageSize:me,shimSendThrowTypeError:Ce,shimConnectionState:ve,removeExtmapAllowMixed:Te,shimAddIceCandidateNullOrEmpty:Oe});const Ee=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=g,i=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=f(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=f(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=f(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=f(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),n={browserDetails:i,commonShim:Se,extractVersion:f,disableLog:R,disableWarnings:b};switch(i.browser){case"chrome":if(!U||!D||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),n;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),n;r("adapter.js shimming chrome."),n.browserShim=U,Oe(e,i),E(e,i),I(e),D(e,i),y(e),w(e,i),L(e),A(e),P(e),k(e,i),ge(e),ve(e),me(e,i),Ce(e),Te(e,i);break;case"firefox":if(!se||!X||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),n;r("adapter.js shimming firefox."),n.browserShim=se,Oe(e,i),Z(e,i),X(e,i),Q(e),te(e),$(e),ee(e),re(e),ie(e),ne(e),oe(e),ae(e),ge(e),ve(e),me(e,i),Ce(e);break;case"edge":if(!q||!z||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),n;r("adapter.js shimming edge."),n.browserShim=q,K(e),W(e),z(e,i),Y(e),me(e,i),Ce(e);break;case"safari":if(!be||!t.shimSafari)return r("Safari shim is not included in this adapter release."),n;r("adapter.js shimming safari."),n.browserShim=be,Oe(e,i),pe(e),he(e),le(e),ce(e),ue(e),fe(e),de(e),Re(e),ge(e),me(e,i),Ce(e),Te(e,i);break;default:r("Unsupported browser!")}return n}({window:"undefined"==typeof window?void 0:window});var Ie,ye,Le,Ae;exports.RCFrameRate=void 0,(Ie=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",Ie.FPS_15="FPS_15",Ie.FPS_24="FPS_24",Ie.FPS_30="FPS_30",exports.RCResolution=void 0,(ye=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",ye.W176_H144="W176_H144",ye.W180_H180="W180_H180",ye.W240_H180="W240_H180",ye.W240_H240="W240_H240",ye.W256_H144="W256_H144",ye.W320_H180="W320_H180",ye.W320_H240="W320_H240",ye.W360_H360="W360_H360",ye.W480_H360="W480_H360",ye.W480_H480="W480_H480",ye.W640_H360="W640_H360",ye.W640_H480="W640_H480",ye.W720_H480="W720_H480",ye.W848_H480="W848_H480",ye.W960_H720="W960_H720",ye.W1280_H720="W1280_H720",ye.W1920_H1080="W1920_H1080",ye.W144_H176="W144_H176",ye.W144_H256="W144_H256",ye.W180_H240="W180_H240",ye.W180_H320="W180_H320",ye.W240_H320="W240_H320",ye.W360_H480="W360_H480",ye.W360_H640="W360_H640",ye.W480_H640="W480_H640",ye.W480_H720="W480_H720",ye.W480_H848="W480_H848",ye.W720_H1280="W720_H1280",ye.W720_H960="W720_H960",ye.W1080_H1920="W1080_H1920",exports.RCMediaType=void 0,(Le=exports.RCMediaType||(exports.RCMediaType={}))[Le.AUDIO_ONLY=0]="AUDIO_ONLY",Le[Le.VIDEO_ONLY=1]="VIDEO_ONLY",Le[Le.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Pe,Ne=((Ae={})[exports.RCResolution.W176_H132]={width:176,height:132,maxBitrate:150,minBitrate:80},Ae[exports.RCResolution.W176_H144]={width:176,height:144,maxBitrate:150,minBitrate:80},Ae[exports.RCResolution.W180_H180]={width:180,height:180,maxBitrate:200,minBitrate:100},Ae[exports.RCResolution.W240_H180]={width:240,height:180,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W240_H240]={width:240,height:240,maxBitrate:280,minBitrate:120},Ae[exports.RCResolution.W256_H144]={width:256,height:144,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W320_H180]={width:320,height:180,maxBitrate:280,minBitrate:120},Ae[exports.RCResolution.W320_H240]={width:320,height:240,maxBitrate:400,minBitrate:120},Ae[exports.RCResolution.W360_H360]={width:360,height:360,maxBitrate:520,minBitrate:140},Ae[exports.RCResolution.W480_H360]={width:480,height:360,maxBitrate:650,minBitrate:150},Ae[exports.RCResolution.W480_H480]={width:480,height:480,maxBitrate:800,minBitrate:180},Ae[exports.RCResolution.W640_H360]={width:640,height:360,maxBitrate:800,minBitrate:180},Ae[exports.RCResolution.W640_H480]={width:640,height:480,maxBitrate:900,minBitrate:200},Ae[exports.RCResolution.W720_H480]={width:720,height:480,maxBitrate:1e3,minBitrate:200},Ae[exports.RCResolution.W848_H480]={width:848,height:480,maxBitrate:1860,minBitrate:200},Ae[exports.RCResolution.W960_H720]={width:960,height:720,maxBitrate:2e3,minBitrate:250},Ae[exports.RCResolution.W1280_H720]={width:1280,height:720,maxBitrate:2200,minBitrate:250},Ae[exports.RCResolution.W1920_H1080]={width:1920,height:1080,maxBitrate:4e3,minBitrate:400},Ae[exports.RCResolution.W144_H176]={width:144,height:176,maxBitrate:150,minBitrate:80},Ae[exports.RCResolution.W144_H256]={width:144,height:256,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W180_H240]={width:180,height:240,maxBitrate:240,minBitrate:120},Ae[exports.RCResolution.W180_H320]={width:180,height:320,maxBitrate:280,minBitrate:120},Ae[exports.RCResolution.W240_H320]={width:240,height:320,maxBitrate:400,minBitrate:120},Ae[exports.RCResolution.W360_H480]={width:360,height:480,maxBitrate:650,minBitrate:150},Ae[exports.RCResolution.W360_H640]={width:360,height:640,maxBitrate:800,minBitrate:180},Ae[exports.RCResolution.W480_H640]={width:480,height:640,maxBitrate:900,minBitrate:200},Ae[exports.RCResolution.W480_H720]={width:480,height:720,maxBitrate:1e3,minBitrate:200},Ae[exports.RCResolution.W480_H848]={width:480,height:848,maxBitrate:1860,minBitrate:930},Ae[exports.RCResolution.W720_H1280]={width:720,height:1280,maxBitrate:2200,minBitrate:250},Ae[exports.RCResolution.W720_H960]={width:720,height:960,maxBitrate:2760,minBitrate:910},Ae[exports.RCResolution.W1080_H1920]={width:1080,height:1920,maxBitrate:4e3,minBitrate:400},Ae),we=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},De=function(e,t){e=we(e),t=we(t);var r=Ne["W".concat(e,"_H").concat(t)];if(r)return r;var i=e*t;return Object.keys(Ne).map((function(e){return Ne[e]})).sort((function(e,t){return e.height*e.width-t.width*t.height})).filter((function(e){return e.height*e.width>=i}))[0]||Ne.W1920_H1080},ke={10:1,15:1,24:1.5,30:1.5},Ue=function(e){var t=Number.MAX_VALUE,r=1;for(var i in ke){var n=Math.abs(e-parseInt(i));n<t&&(t=n,r=ke[i])}return r},Me={getCameras:function(){return s(void 0,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"videoinput"===e.kind}))]}}))}))},getMicrophones:function(){return s(void 0,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audioinput"===e.kind}))]}}))}))},getSpeakers:function(){return s(void 0,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audiooutput"===e.kind}))]}}))}))}};!function(e){e.AUDIO="audio",e.VIDEO="video"}(Pe||(Pe={}));var xe,je,Be,Ve=function(t){function i(e,r,i,n,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(s,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s._streamId=[s._userId||s._roomId,s._tag].join("_"),s._id=[s._streamId,s.isAudioTrack()?0:1].join("_"),s}return r(i,t),Object.defineProperty(i.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._streamId}}),Object.defineProperty(i.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._id}}),Object.defineProperty(i.prototype,"getUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userId}}),Object.defineProperty(i.prototype,"__innerGetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msTrack}}),Object.defineProperty(i.prototype,"streamTrack",{get:function(){return this._msTrack},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"getTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._tag}}),Object.defineProperty(i.prototype,"isLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isLocalTrack}}),Object.defineProperty(i.prototype,"isVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"video"===this._kind}}),Object.defineProperty(i.prototype,"isAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"audio"===this._kind}}),Object.defineProperty(i.prototype,"isReady",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}}),Object.defineProperty(i.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,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(n.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)}}),Object.defineProperty(i.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,[2,exports.RCRTCCode.SUCCESS]}))}))}}),Object.defineProperty(i.prototype,"mute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._setLocalMuted(!0)]}))}))}}),Object.defineProperty(i.prototype,"unmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._setLocalMuted(!1)]}))}))}}),Object.defineProperty(i.prototype,"isLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._localMuted}}),Object.defineProperty(i.prototype,"isMCUTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Boolean(this._roomId)}}),Object.defineProperty(i.prototype,"isOwnerMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteMuted}}),Object.defineProperty(i.prototype,"_validateVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t?void 0:t.volume){if(!e.isNumber(null==t?void 0:t.volume))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==t?void 0:t.volume)<0&&(t.volume=0,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:o.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==t?void 0:t.volume)>100&&(t.volume=100,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:o.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"})))}}}),Object.defineProperty(i.prototype,"_validatePlayOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){switch(a.label){case 0:return this._msTrack?("ended"===this._msTrack.readyState&&this._logger.warn(n.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),(r=this._validateVolume(t))?[2,r]:(null==t?void 0:t.audioDeviceId)?[4,Me.getSpeakers()]:[3,2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]);case 1:if(i=a.sent().map((function(e){return e.deviceId})),!i.includes(t.audioDeviceId))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}];a.label=2;case 2:return!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))?[2]:(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),[2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT}])}}))}))}}),Object.defineProperty(i.prototype,"_setPlayAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e?[3,2]:[4,this._element.setSinkId(t.audioDeviceId)];case 1:i.sent(),i.label=2;case 2:return 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()),[2]}}))}))}}),Object.defineProperty(i.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a=this;return c(this,(function(u){switch(u.label){case 0:return this._logger.info(n.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})),[4,this._validatePlayOptions(e,t)];case 1:return(r=u.sent())?[2,r]:(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;a._logger.info(n.L_TRACK_LOAD_START_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.ondurationchange=function(e){var t;a._logger.info(n.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onloadedmetadata=function(e){var t;a._logger.info(n.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onloadeddata=function(e){var t;a._logger.info(n.L_TRACK_LOADED_DATA_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onabort=function(e){var t;a._logger.info(n.L_TRACK_ABORT_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.oncanplay=function(e){return s(a,void 0,void 0,(function(){var r,a,s;return c(this,(function(c){switch(c.label){case 0:this._logger.info(n.L_TRACK_CANPLAY_O,JSON.stringify({status:o.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(a=e.target)||void 0===a?void 0:a.id,", trackId: ").concat(this._id)})),c.label=1;case 1:return c.trys.push([1,5,,6]),!(null==t?void 0:t.audioDeviceId)||i?[3,3]:[4,this._element.setSinkId(t.audioDeviceId)];case 2:c.sent(),c.label=3;case 3:return[4,null===(s=this._element)||void 0===s?void 0:s.play()];case 4:return c.sent(),[3,6];case 5:return"No permission to use requested device"===(r=c.sent()).message?(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,kind:this._kind,code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(r.message)})),[2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.TRACK_PLAY_ERROR,kind:this._kind,msg:"play error, error msg: ".concat(r.message)})),[3,6]);case 6:return[2]}}))}))},this._element.onvolumechange=function(e){var t,r,i=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));a._logger.info(n.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:o.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", volume: ").concat(i,", trackId: ").concat(a._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,[4,this._setPlayAttrs(i,t)]);case 2:return u.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"__innerDestroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.__innerSetMediaStreamTrack(void 0)}}),Object.defineProperty(i.prototype,"__releaseMediaElement",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.remove(),this._element.srcObject=null)}}),Object.defineProperty(i.prototype,"_validateVideoNodeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}),i}(e.EventEmitter);exports.RCAudioBitrate=void 0,(Be=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",Be.Music="Music",Be.MusicHigh="MusicHigh";var Fe,Je=((xe={})[exports.RCAudioBitrate.Music]={max:64,min:64},xe[exports.RCAudioBitrate.MusicHigh]={max:128,min:128},xe[exports.RCAudioBitrate.Speech]={max:32,min:32},xe);exports.RCVideoBitrate=void 0,(Fe=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",Fe.LEVEL1="LEVEL1",Fe.LEVEL2="LEVEL2",Fe.LEVEL3="LEVEL3",Fe.LEVEL4="LEVEL4",Fe.LEVEL5="LEVEL5";var Ge,He=((je={})[exports.RCVideoBitrate.LEVEL0]={max:150,min:80},je[exports.RCVideoBitrate.LEVEL1]={max:280,min:120},je[exports.RCVideoBitrate.LEVEL2]={max:650,min:150},je[exports.RCVideoBitrate.LEVEL3]={max:1e3,min:200},je[exports.RCVideoBitrate.LEVEL4]={max:2200,min:250},je[exports.RCVideoBitrate.LEVEL5]={max:4e3,min:400},je),Ke=function(){function e(){}return Object.defineProperty(e,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:r=new AudioContext({sampleRate:44100}),c.label=1;case 1:return c.trys.push([1,5,,6]),[4,r.audioWorklet.addModule(e.SCRIPT_URL)];case 2:return c.sent(),[4,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"})];case 3:return[4,c.sent().arrayBuffer()];case 4:return i=c.sent(),[3,6];case 5:return c.sent(),[2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED}];case 6:return n=r.createMediaStreamSource(new MediaStream([t])),o=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:i}}),a=r.createMediaStreamDestination(),n.connect(o).connect(a),s=a.stream.getAudioTracks()[0],e._maps.set(t.id,r),[2,{code:exports.RCRTCCode.SUCCESS,track:s}]}}))}))}}),Object.defineProperty(e,"release3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e._maps.get(t.id);r&&(r.close(),e._maps.delete(t.id))}}),Object.defineProperty(e,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(e,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(e,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),e}(),We=function(t){function i(e,r,i,n,o){var a=t.call(this,e,r,i,n,!0)||this;return Object.defineProperty(a,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a.__innerSetMediaStreamTrack(o),o.onended=function(){o.onended=null,a._onTrackEnded()},a}return r(i,t),Object.defineProperty(i.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(i.EVENT_LOCAL_TRACK_END,this),this.removeAll(i.EVENT_LOCAL_TRACK_END)}}),Object.defineProperty(i.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;return new Promise((function(o){var a=r._localMuted!==e;t.prototype._setLocalMuted.call(r,e),r._remoteMuted=r._localMuted,a&&r._isPublished?r.emit(i.__INNER_EVENT_MUTED_CHANGE__,r,o):o(exports.RCRTCCode.SUCCESS),r._logger.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:e,trackId:r._id}))}))}}),Object.defineProperty(i.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPublished=e}}),Object.defineProperty(i.prototype,"isPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPublished}}),Object.defineProperty(i.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;void 0===e&&(e=!0),this._isDestroyed||(this._logger.info(n.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(r=this._msTrack)||void 0===r||r.stop(),t.prototype.__innerDestroy.call(this),this.isAudioTrack()&&t.prototype.__releaseMediaElement.call(this),this._isPublished&&e&&this.emit(i.__INNER_EVENT_DESTROY__,this))}}),Object.defineProperty(i.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=0),!e.isNumber(t)||!e.isNumber(r)||!e.isNumber(i)||t<=0||r<=0||t<r?this._logger.error(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> max: ".concat(t,",min: ").concat(r,", start: ").concat(i),trackId:this._id})):(this._logger.info(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:o.SUCCESSED,max:t,min:r,start:i,trackId:this._id})),this._bitrateInfo={max:t,min:r,start:i})}}),Object.defineProperty(i.prototype,"getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,i,n,o,a,s,c,u=0,l=0,d=0;return(null===(r=this._msTrack)||void 0===r?void 0:r.kind)===Pe.VIDEO?(u=(e=lt(this._msTrack)).min,l=e.max):(null===(i=this._msTrack)||void 0===i?void 0:i.kind)===Pe.AUDIO&&(u=(t={min:32,max:32}).min,l=t.max),(null===(n=this._bitrateInfo)||void 0===n?void 0:n.max)&&(d=.7*(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)),{min:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.min)||u,max:(null===(s=this._bitrateInfo)||void 0===s?void 0:s.max)||l,start:(null===(c=this._bitrateInfo)||void 0===c?void 0:c.start)||d}}}),Object.defineProperty(i.prototype,"getSettings",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._msTrack)||void 0===e?void 0:e.getSettings()}}),Object.defineProperty(i,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(i,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(i,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"}),i}(Ve),ze=function(t){function i(e,r,i,n){return t.call(this,e,r,i,"audio",n)||this}return r(i,t),Object.defineProperty(i.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("audioBitrate",t,(function(e){return e in exports.RCAudioBitrate}))){var r=Je[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=l(r,2),o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),i}(We),Ye=function(t){function i(e,r,i,n,o){void 0===o&&(o=!1);var a=t.call(this,e,r,i,"video",n)||this;return Object.defineProperty(a,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return r(i,t),Object.defineProperty(i.prototype,"__isTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isTiny}}),Object.defineProperty(i.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getStreamId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(i.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getTrackId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(i.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("videoBitrate",t,(function(e){return e in exports.RCVideoBitrate}))){var r=He[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=l(r,2),o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),i}(We),qe=function(e){function t(r,i,n,o,a,s){var c=e.call(this,r,i,n,o,a)||this;return Object.defineProperty(c,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:s}),t._innerSetMapping(c.getTrackId(),s),c}return r(t,e),Object.defineProperty(t,"_innerSetMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}}),Object.defineProperty(t,"_innerRemoveMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter((function(t){return t!==e}));n&&n.length>0?this._mapping.set(t,n):(this._mapping.delete(t),t.pause(),t.src="",null===(i=t.parentNode)||void 0===i||i.removeChild(t))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAudioTrack()&&this.mute(),t._innerRemoveMapping(this.getTrackId(),this._resource),e.prototype.destroy.call(this)}}),Object.defineProperty(t,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t}(We),Ze=function(e){function t(t,r,i,n,o){return e.call(this,t,r,i,"video",n,o)||this}return r(t,e),t}(qe),Qe=function(e){function t(t,r,i,n,o){return e.call(this,t,r,i,"audio",n,o)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._resource&&(this._resource.muted=t),[2,e.prototype._setLocalMuted.call(this,t)]}))}))}}),Object.defineProperty(t.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this._setLocalMuted(!1)];case 1:return[2,{code:e.sent()}]}}))}))}}),t}(qe),Xe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),t}return r(t,e),Object.defineProperty(t.prototype,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t,r;return c(this,(function(i){switch(i.label){case 0:return this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_T),this._originTrack?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"3A noise module already applied"})),[2,{code:exports.RCRTCCode.SUCCESS}]):!this._msTrack||this.isDestroyed()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"track not ready"})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]):this.isPublished()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"track already published"})),[2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH}]):[4,Ke.apply3ANoiseWorklet(this._msTrack)];case 1:return e=i.sent(),t=e.code,r=e.track,t===exports.RCRTCCode.SUCCESS&&r?(this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.SUCCESSED})),[2,{code:exports.RCRTCCode.SUCCESS}]):(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"apply 3A noise module failed: ".concat(t),SCRIPT_URL:Ke.SCRIPT_URL,WASM_URL:Ke.WASM_URL})),[2,{code:t}])}}))}))}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){!t&&this._originTrack&&(Ke.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),Object.defineProperty(t.prototype,"replaceInnerTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),t}(ze),$e=function(e){function t(t,r,i,n,o){return void 0===o&&(o=!1),e.call(this,t,r,i,n,o)||this}return r(t,e),Object.defineProperty(t.prototype,"replaceInnerTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),t}(Ye),et=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(We.__INNER_EVENT_DESTROY__,this)}}),t}(Ye),tt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(We.__INNER_EVENT_DESTROY__,this)}}),t}(ze),rt=function(e){function t(t,r,i,n,o){var a=e.call(this,t,r,i,n,!1,o)||this;return Object.defineProperty(a,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a}return r(t,e),Object.defineProperty(t.prototype,"__innerSetRemoteMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteMuted=e}}),Object.defineProperty(t.prototype,"__innerSetSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubscribed=e}}),Object.defineProperty(t.prototype,"isSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubscribed}}),t}(Ve),it=function(e){function t(t,r,i,n){return e.call(this,t,r,i,"audio",n)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=vt.browser,i=vt.version;return this._element&&i&&/chrome/i.test(r)&&i>=130&&(this._element.muted=t),e.prototype._setLocalMuted.call(this,t)}}),Object.defineProperty(t.prototype,"getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}),t}(rt),nt=function(e){function t(t,r,i,n){var o=e.call(this,t,r,i,"video",n)||this;return Object.defineProperty(o,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),o}return r(t,e),Object.defineProperty(t.prototype,"__innerSetIsTinyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubTiny=e}}),Object.defineProperty(t.prototype,"isSubTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubTiny}}),t}(rt);exports.RCRTCGenerateSummarizationFormat=void 0,(Ge=exports.RCRTCGenerateSummarizationFormat||(exports.RCRTCGenerateSummarizationFormat={}))[Ge.MARK_DOWN=0]="MARK_DOWN",Ge[Ge.JSON=1]="JSON";var ot=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},at=function(e){return JSON.stringify(e)},st=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},ct=function(t){if(void 0===t)return 0;if(e.isNumber(t))return t;var r=t;return r.exact||r.ideal||r.max||0},ut=function(e){var t=e.getSettings(),r=e.getConstraints();return{width:ct(r.width)||t.width||0,height:ct(r.height)||t.height||0,frameRate:t.frameRate||ct(r.frameRate)}},lt=function(e){var t=ut(e),r=t.width,i=t.height,n=t.frameRate,o=De(r||1920,i||1080),a=Ue(n);return{min:o.minBitrate*a,max:o.maxBitrate*a}},dt=function(e){return[e.msid,e.mediaType].join("_")},_t=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},pt=function(e,t){return[e,t].join("_")},ft=function(e){return e.map((function(e){return a({},e)}))},ht=function(e,t,r){void 0===r&&(r=!1),e=e.slice();var i=[],n=[],o=[];return t.forEach((function(t){var n=dt(t),a=e.findIndex((function(e){return dt(e)===n}));if(r&&(a=e.findIndex((function(e){return e.uri===t.uri}))),-1!==a){var s=e[a];s.uri!==t.uri?i.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else i.push(t)})),n.push.apply(n,d([],l(e),!1)),{publishedList:i,unpublishedList:n,modifiedList:o}},Rt=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,i=+e,n=[];do{var o=i%r;i=(i-o)/r,n.unshift(t[o])}while(i);return n.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},bt=function(e){if(Ne[e]){var t=Ne[e];return{width:t.width,height:t.height}}var r=l(e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),2);return{width:r[0],height:r[1]}},gt=function(e){return!!exports.RCResolution[e]},mt=function(e){return!!exports.RCFrameRate[e]},Ct=function(e){return parseInt(e.replace("FPS_",""))},vt=function(){var e=Ee.browserDetails;return{browser:e.browser,version:e.version,supportsUnifiedPlan:!1!==e.supportsUnifiedPlan}}();function Tt(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Ot(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var St,Et,It=function(e){return"[object Null]"===Object.prototype.toString.call(e)},yt=function(e){return 1===e.type},Lt=function(e,t,r,i){var o={},a=Object.keys(e.users);return a.length&&a.forEach((function(a){var s=[],c=e.users[a];if(c.extra){var u=JSON.parse(c.extra).roomId;if(t!==u)return}if(c.uris)try{s.push.apply(s,d([],l(JSON.parse(c.uris)),!1))}catch(e){r.warn(n.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(a,", userData: ").concat(c),i)}o[a]=s})),o},At=function(e){return e instanceof Ve?e.getTrackId():e.track.getTrackId()},Pt=function(t){if(!e.isObject(t)||void 0===t.low||void 0===t.high)return t;var r=t.low;return r<0&&(r+=4294967296),r=r.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(r.length,"}$")),r),16)},Nt=function(){return"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams};!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"}(St||(St={})),exports.RCRTCPingResult=void 0,(Et=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",Et.FAIL="Fail";var wt=function(){function t(e,t,r,i){void 0===i&&(i=5e3),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:i}),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}return Object.defineProperty(t.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(n.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}}),Object.defineProperty(t.prototype,"_sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=this;return new Promise((function(r){t._context.rtcPing(t._roomId,t._roomMode).then(r),setTimeout(r,5e3,{code:e.ErrorCode.TIMEOUT})}))}}),Object.defineProperty(t.prototype,"_checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,o,a,s,u,l=this;return c(this,(function(c){switch(c.label){case 0:return r=this._context.logger,i=r.createTraceId(),[4,this._sendPing()];case 1:return o=c.sent(),a=o.code,s=o.data,this._started?(u=Date.now(),a===e.ErrorCode.SUCCESS?(this._latestTimestamp=u,this.onPingResult(exports.RCRTCPingResult.SUCCESS,s.version),this._timer=setTimeout((function(){return l._checkAlive(t)}),this._gap),[2]):(r.error(n.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:a}),i),this.onPingResult(exports.RCRTCPingResult.FAIL),40003===a||u-this._latestTimestamp>t?(this.stop(),this.onFailed(40003===a),[2]):(this._timer=setTimeout((function(){return l._checkAlive(t)}),this._gap),[2]))):[2]}}))}))}}),Object.defineProperty(t.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._started&&(this._logger.info(n.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}),t}();function Dt(e){let t=e.length;for(;--t>=0;)e[t]=0}const kt=256,Ut=286,Mt=30,xt=15,jt=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]),Bt=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]),Vt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ft=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jt=new Array(576);Dt(Jt);const Gt=new Array(60);Dt(Gt);const Ht=new Array(512);Dt(Ht);const Kt=new Array(256);Dt(Kt);const Wt=new Array(29);Dt(Wt);const zt=new Array(Mt);function Yt(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let qt,Zt,Qt;function Xt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Dt(zt);const $t=e=>e<256?Ht[e]:Ht[256+(e>>>7)],er=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},tr=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,er(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)},rr=(e,t,r)=>{tr(e,r[2*t],r[2*t+1])},ir=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},nr=(e,t,r)=>{const i=new Array(16);let n,o,a=0;for(n=1;n<=xt;n++)a=a+r[n-1]<<1,i[n]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=ir(i[t]++,t))}},or=e=>{let t;for(t=0;t<Ut;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Mt;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},ar=e=>{e.bi_valid>8?er(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},sr=(e,t,r,i)=>{const n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]},cr=(e,t,r)=>{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n<e.heap_len&&sr(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!sr(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i},ur=(e,t,r)=>{let i,n,o,a,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,n=e.pending_buf[e.sym_buf+s++],0===i?rr(e,n,t):(o=Kt[n],rr(e,o+kt+1,t),a=jt[o],0!==a&&(n-=Wt[o],tr(e,n,a)),i--,o=$t(i),rr(e,o,r),a=Bt[o],0!==a&&(i-=zt[o],tr(e,i,a)))}while(s<e.sym_next);rr(e,256,t)},lr=(e,t)=>{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=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--,n&&(e.static_len-=i[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)cr(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],cr(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++,cr(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=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,_,p,f,h=0;for(_=0;_<=xt;_++)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,h++),r[2*l+1]=_,l>i||(e.bl_count[_]++,p=0,l>=s&&(p=a[l-s]),f=r[2*l],e.opt_len+=f*(_+p),o&&(e.static_len+=f*(n[2*l+1]+p)));if(0!==h){do{for(_=c-1;0===e.bl_count[_];)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(_=c;0!==_;_--)for(l=e.bl_count[_];0!==l;)d=e.heap[--u],d>i||(r[2*d+1]!==_&&(e.opt_len+=(_-r[2*d+1])*r[2*d],r[2*d+1]=_),l--)}})(e,t),nr(r,u,e.bl_count)},dr=(e,t,r)=>{let i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))},_r=(e,t,r)=>{let i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{rr(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(rr(e,n,e.bl_tree),s--),rr(e,16,e.bl_tree),tr(e,s-3,2)):s<=10?(rr(e,17,e.bl_tree),tr(e,s-3,3)):(rr(e,18,e.bl_tree),tr(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}};let pr=!1;const fr=(e,t,r,i)=>{tr(e,0+(i?1:0),3),ar(e),er(e,r),er(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var hr=(e,t,r,i)=>{let n,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<kt;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),lr(e,e.l_desc),lr(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),lr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Ft[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?fr(e,t,r,i):4===e.strategy||o===n?(tr(e,2+(i?1:0),3),ur(e,Jt,Gt)):(tr(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for(tr(e,t-257,5),tr(e,r-1,5),tr(e,i-4,4),n=0;n<i;n++)tr(e,e.bl_tree[2*Ft[n]+1],3);_r(e,e.dyn_ltree,t-1),_r(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),ur(e,e.dyn_ltree,e.dyn_dtree)),or(e),i&&ar(e)},Rr={_tr_init:e=>{pr||((()=>{let e,t,r,i,n;const o=new Array(16);for(r=0,i=0;i<28;i++)for(Wt[i]=r,e=0;e<1<<jt[i];e++)Kt[r++]=i;for(Kt[r-1]=i,n=0,i=0;i<16;i++)for(zt[i]=n,e=0;e<1<<Bt[i];e++)Ht[n++]=i;for(n>>=7;i<Mt;i++)for(zt[i]=n<<7,e=0;e<1<<Bt[i]-7;e++)Ht[256+n++]=i;for(t=0;t<=xt;t++)o[t]=0;for(e=0;e<=143;)Jt[2*e+1]=8,e++,o[8]++;for(;e<=255;)Jt[2*e+1]=9,e++,o[9]++;for(;e<=279;)Jt[2*e+1]=7,e++,o[7]++;for(;e<=287;)Jt[2*e+1]=8,e++,o[8]++;for(nr(Jt,287,o),e=0;e<Mt;e++)Gt[2*e+1]=5,Gt[2*e]=ir(e,5);qt=new Yt(Jt,jt,257,Ut,xt),Zt=new Yt(Gt,Bt,0,Mt,xt),Qt=new Yt(new Array(0),Vt,0,19,7)})(),pr=!0),e.l_desc=new Xt(e.dyn_ltree,qt),e.d_desc=new Xt(e.dyn_dtree,Zt),e.bl_desc=new Xt(e.bl_tree,Qt),e.bi_buf=0,e.bi_valid=0,or(e)},_tr_stored_block:fr,_tr_flush_block:hr,_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*(Kt[r]+kt+1)]++,e.dyn_dtree[2*$t(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{tr(e,2,3),rr(e,256,Jt),(e=>{16===e.bi_valid?(er(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 br=(e,t,r,i)=>{let n=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,o=o+n|0}while(--a);n%=65521,o%=65521}return n|o<<16};const gr=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var mr=(e,t,r,i)=>{const n=gr,o=i+r;e^=-1;for(let r=i;r<o;r++)e=e>>>8^n[255&(e^t[r])];return~e},Cr={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"},vr={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:Tr,_tr_stored_block:Or,_tr_flush_block:Sr,_tr_tally:Er,_tr_align:Ir}=Rr,{Z_NO_FLUSH:yr,Z_PARTIAL_FLUSH:Lr,Z_FULL_FLUSH:Ar,Z_FINISH:Pr,Z_BLOCK:Nr,Z_OK:wr,Z_STREAM_END:Dr,Z_STREAM_ERROR:kr,Z_DATA_ERROR:Ur,Z_BUF_ERROR:Mr,Z_DEFAULT_COMPRESSION:xr,Z_FILTERED:jr,Z_HUFFMAN_ONLY:Br,Z_RLE:Vr,Z_FIXED:Fr,Z_DEFAULT_STRATEGY:Jr,Z_UNKNOWN:Gr,Z_DEFLATED:Hr}=vr,Kr=258,Wr=262,zr=42,Yr=113,qr=666,Zr=(e,t)=>(e.msg=Cr[t],t),Qr=e=>2*e-(e>4?9:0),Xr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},$r=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let ei=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const ti=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))},ri=(e,t)=>{Sr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ti(e.strm)},ii=(e,t)=>{e.pending_buf[e.pending++]=t},ni=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},oi=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=br(e.adler,t,n,r):2===e.state.wrap&&(e.adler=mr(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},ai=(e,t)=>{let r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-Wr?e.strstart-(e.w_size-Wr):0,u=e.window,l=e.w_mask,d=e.prev,_=e.strstart+Kr;let p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,u[r+a]===f&&u[r+a-1]===p&&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(i=Kr-(_-o),o=_-Kr,i>a){if(e.match_start=t,a=i,i>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=d[t&l])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead},si=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Wr)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),$r(e),i+=t),0===e.strm.avail_in)break;if(r=oi(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=ei(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=ei(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Wr&&0!==e.strm.avail_in)},ci=(e,t)=>{let r,i,n,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,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r<o&&(0===r&&t!==Pr||t===yr||r!==i+e.strm.avail_in))break;a=t===Pr&&r===i+e.strm.avail_in?1:0,Or(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,ti(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),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!==yr&&t!==Pr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(n=e.window_size-e.strstart,e.strm.avail_in>n&&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++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(oi(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,o=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=o||(i||t===Pr)&&t!==yr&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===Pr&&0===e.strm.avail_in&&r===i?1:0,Or(e,e.block_start,r,a),e.block_start+=r,ti(e.strm)),a?3:1)},ui=(e,t)=>{let r,i;for(;;){if(e.lookahead<Wr){if(si(e),e.lookahead<Wr&&t===yr)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-Wr&&(e.match_length=ai(e,r)),e.match_length>=3)if(i=Er(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 i=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ri(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Pr?(ri(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ri(e,!1),0===e.strm.avail_out)?1:2},li=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<Wr){if(si(e),e.lookahead<Wr&&t===yr)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-Wr&&(e.match_length=ai(e,r),e.match_length<=5&&(e.strategy===jr||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=Er(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(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++,i&&(ri(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Er(e,0,e.window[e.strstart-1]),i&&ri(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&&(i=Er(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Pr?(ri(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ri(e,!1),0===e.strm.avail_out)?1:2};function di(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const _i=[new di(0,0,0,0,ci),new di(4,4,8,4,ui),new di(4,5,16,8,ui),new di(4,6,32,32,ui),new di(4,4,16,16,li),new di(8,16,32,32,li),new di(8,16,128,128,li),new di(8,32,128,256,li),new di(32,128,258,1024,li),new di(32,258,258,4096,li)];function pi(){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=Hr,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),Xr(this.dyn_ltree),Xr(this.dyn_dtree),Xr(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),Xr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Xr(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 fi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==zr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Yr&&t.status!==qr?1:0},hi=e=>{if(fi(e))return Zr(e,kr);e.total_in=e.total_out=0,e.data_type=Gr;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?zr:Yr,e.adler=2===t.wrap?0:1,t.last_flush=-2,Tr(t),wr},Ri=e=>{const t=hi(e);var r;return t===wr&&((r=e.state).window_size=2*r.w_size,Xr(r.head),r.max_lazy_match=_i[r.level].max_lazy,r.good_match=_i[r.level].good_length,r.nice_match=_i[r.level].nice_length,r.max_chain_length=_i[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},bi=(e,t,r,i,n,o)=>{if(!e)return kr;let a=1;if(t===xr&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==Hr||i<8||i>15||t<0||t>9||o<0||o>Fr||8===i&&1!==a)return Zr(e,kr);8===i&&(i=9);const s=new pi;return e.state=s,s.strm=e,s.status=zr,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+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<<n+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,Ri(e)};var gi={deflateInit:(e,t)=>bi(e,t,Hr,15,8,Jr),deflateInit2:bi,deflateReset:Ri,deflateResetKeep:hi,deflateSetHeader:(e,t)=>fi(e)||2!==e.state.wrap?kr:(e.state.gzhead=t,wr),deflate:(e,t)=>{if(fi(e)||t>Nr||t<0)return e?Zr(e,kr):kr;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===qr&&t!==Pr)return Zr(e,0===e.avail_out?Mr:kr);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if(ti(e),0===e.avail_out)return r.last_flush=-1,wr}else if(0===e.avail_in&&Qr(t)<=Qr(i)&&t!==Pr)return Zr(e,Mr);if(r.status===qr&&0!==e.avail_in)return Zr(e,Mr);if(r.status===zr&&0===r.wrap&&(r.status=Yr),r.status===zr){let t=Hr+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=Br||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ni(r,t),0!==r.strstart&&(ni(r,e.adler>>>16),ni(r,65535&e.adler)),e.adler=1,r.status=Yr,ti(e),0!==r.pending)return r.last_flush=-1,wr}if(57===r.status)if(e.adler=0,ii(r,31),ii(r,139),ii(r,8),r.gzhead)ii(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)),ii(r,255&r.gzhead.time),ii(r,r.gzhead.time>>8&255),ii(r,r.gzhead.time>>16&255),ii(r,r.gzhead.time>>24&255),ii(r,9===r.level?2:r.strategy>=Br||r.level<2?4:0),ii(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ii(r,255&r.gzhead.extra.length),ii(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=mr(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(ii(r,0),ii(r,0),ii(r,0),ii(r,0),ii(r,0),ii(r,9===r.level?2:r.strategy>=Br||r.level<2?4:0),ii(r,3),r.status=Yr,ti(e),0!==r.pending)return r.last_flush=-1,wr;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=mr(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,ti(e),0!==r.pending)return r.last_flush=-1,wr;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=mr(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,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=mr(e.adler,r.pending_buf,r.pending-i,i)),ti(e),0!==r.pending)return r.last_flush=-1,wr;i=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ii(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>i&&(e.adler=mr(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=mr(e.adler,r.pending_buf,r.pending-i,i)),ti(e),0!==r.pending)return r.last_flush=-1,wr;i=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ii(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>i&&(e.adler=mr(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(ti(e),0!==r.pending))return r.last_flush=-1,wr;ii(r,255&e.adler),ii(r,e.adler>>8&255),e.adler=0}if(r.status=Yr,ti(e),0!==r.pending)return r.last_flush=-1,wr}if(0!==e.avail_in||0!==r.lookahead||t!==yr&&r.status!==qr){let i=0===r.level?ci(r,t):r.strategy===Br?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(si(e),0===e.lookahead)){if(t===yr)return 1;break}if(e.match_length=0,r=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(ri(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Pr?(ri(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ri(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===Vr?((e,t)=>{let r,i,n,o;const a=e.window;for(;;){if(e.lookahead<=Kr){if(si(e),e.lookahead<=Kr&&t===yr)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){o=e.strstart+Kr;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=Kr-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Er(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Er(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(ri(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Pr?(ri(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ri(e,!1),0===e.strm.avail_out)?1:2})(r,t):_i[r.level].func(r,t);if(3!==i&&4!==i||(r.status=qr),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),wr;if(2===i&&(t===Lr?Ir(r):t!==Nr&&(Or(r,0,0,!1),t===Ar&&(Xr(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),ti(e),0===e.avail_out))return r.last_flush=-1,wr}return t!==Pr?wr:r.wrap<=0?Dr:(2===r.wrap?(ii(r,255&e.adler),ii(r,e.adler>>8&255),ii(r,e.adler>>16&255),ii(r,e.adler>>24&255),ii(r,255&e.total_in),ii(r,e.total_in>>8&255),ii(r,e.total_in>>16&255),ii(r,e.total_in>>24&255)):(ni(r,e.adler>>>16),ni(r,65535&e.adler)),ti(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?wr:Dr)},deflateEnd:e=>{if(fi(e))return kr;const t=e.state.status;return e.state=null,t===Yr?Zr(e,Ur):wr},deflateSetDictionary:(e,t)=>{let r=t.length;if(fi(e))return kr;const i=e.state,n=i.wrap;if(2===n||1===n&&i.status!==zr||i.lookahead)return kr;if(1===n&&(e.adler=br(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(Xr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.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,si(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=ei(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,si(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,i.wrap=n,wr},deflateInfo:"pako deflate (from Nodeca project)"};const mi=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ci=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)mi(r,t)&&(e[t]=r[t])}}return e},vi=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,i=0,n=e.length;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r};let Ti=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ti=!1}const Oi=new Uint8Array(256);for(let e=0;e<256;e++)Oi[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Oi[254]=Oi[254]=1;var Si=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)r=e.charCodeAt(n),55296==(64512&r)&&n+1<a&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,n=0;o<s;n++)r=e.charCodeAt(n),55296==(64512&r)&&n+1<a&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),n++)),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},Ei=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const o=new Array(2*r);for(n=0,i=0;i<r;){let t=e[i++];if(t<128){o[n++]=t;continue}let a=Oi[t];if(a>4)o[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<r;)t=t<<6|63&e[i++],a--;a>1?o[n++]=65533:t<65536?o[n++]=t:(t-=65536,o[n++]=55296|t>>10&1023,o[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ti)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r})(o,n)},Ii=(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+Oi[e[r]]>t?r: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 Li=Object.prototype.toString,{Z_NO_FLUSH:Ai,Z_SYNC_FLUSH:Pi,Z_FULL_FLUSH:Ni,Z_FINISH:wi,Z_OK:Di,Z_STREAM_END:ki,Z_DEFAULT_COMPRESSION:Ui,Z_DEFAULT_STRATEGY:Mi,Z_DEFLATED:xi}=vr;function ji(e){this.options=Ci({level:Ui,method:xi,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mi},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 r=gi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Di)throw new Error(Cr[r]);if(t.header&&gi.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Si(t.dictionary):"[object ArrayBuffer]"===Li.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=gi.deflateSetDictionary(this.strm,e),r!==Di)throw new Error(Cr[r]);this._dict_set=!0}}function Bi(e,t){const r=new ji(t);if(r.push(e,!0),r.err)throw r.msg||Cr[r.err];return r.result}ji.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?wi:Ai,"string"==typeof e?r.input=Si(e):"[object ArrayBuffer]"===Li.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(i),r.next_out=0,r.avail_out=i),(o===Pi||o===Ni)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=gi.deflate(r,o),n===ki)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=gi.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Di;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},ji.prototype.onData=function(e){this.chunks.push(e)},ji.prototype.onEnd=function(e){e===Di&&(this.result=vi(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Vi={Deflate:ji,deflate:Bi,deflateRaw:function(e,t){return(t=t||{}).raw=!0,Bi(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,Bi(e,t)},constants:vr};const Fi=16209;var Ji=function(e,t){let r,i,n,o,a,s,c,u,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E;const I=e.state;r=e.next_in,S=e.input,i=r+(e.avail_in-5),n=e.next_out,E=e.output,o=n-(t-e.avail_out),a=n+(e.avail_out-257),s=I.dmax,c=I.wsize,u=I.whave,l=I.wnext,d=I.window,_=I.hold,p=I.bits,f=I.lencode,h=I.distcode,R=(1<<I.lenbits)-1,b=(1<<I.distbits)-1;e:do{p<15&&(_+=S[r++]<<p,p+=8,_+=S[r++]<<p,p+=8),g=f[_&R];t:for(;;){if(m=g>>>24,_>>>=m,p-=m,m=g>>>16&255,0===m)E[n++]=65535&g;else{if(!(16&m)){if(64&m){if(32&m){I.mode=16191;break e}e.msg="invalid literal/length code",I.mode=Fi;break e}g=f[(65535&g)+(_&(1<<m)-1)];continue t}for(C=65535&g,m&=15,m&&(p<m&&(_+=S[r++]<<p,p+=8),C+=_&(1<<m)-1,_>>>=m,p-=m),p<15&&(_+=S[r++]<<p,p+=8,_+=S[r++]<<p,p+=8),g=h[_&b];;){if(m=g>>>24,_>>>=m,p-=m,m=g>>>16&255,16&m){if(v=65535&g,m&=15,p<m&&(_+=S[r++]<<p,p+=8,p<m&&(_+=S[r++]<<p,p+=8)),v+=_&(1<<m)-1,v>s){e.msg="invalid distance too far back",I.mode=Fi;break e}if(_>>>=m,p-=m,m=n-o,v>m){if(m=v-m,m>u&&I.sane){e.msg="invalid distance too far back",I.mode=Fi;break e}if(T=0,O=d,0===l){if(T+=c-m,m<C){C-=m;do{E[n++]=d[T++]}while(--m);T=n-v,O=E}}else if(l<m){if(T+=c+l-m,m-=l,m<C){C-=m;do{E[n++]=d[T++]}while(--m);if(T=0,l<C){m=l,C-=m;do{E[n++]=d[T++]}while(--m);T=n-v,O=E}}}else if(T+=l-m,m<C){C-=m;do{E[n++]=d[T++]}while(--m);T=n-v,O=E}for(;C>2;)E[n++]=O[T++],E[n++]=O[T++],E[n++]=O[T++],C-=3;C&&(E[n++]=O[T++],C>1&&(E[n++]=O[T++]))}else{T=n-v;do{E[n++]=E[T++],E[n++]=E[T++],E[n++]=E[T++],C-=3}while(C>2);C&&(E[n++]=E[T++],C>1&&(E[n++]=E[T++]))}break}if(64&m){e.msg="invalid distance code",I.mode=Fi;break e}g=h[(65535&g)+(_&(1<<m)-1)]}}break}}while(r<i&&n<a);C=p>>3,r-=C,p-=C<<3,_&=(1<<p)-1,e.next_in=r,e.next_out=n,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=n<a?a-n+257:257-(n-a),I.hold=_,I.bits=p};const Gi=15,Hi=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]),Ki=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]),Wi=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]),zi=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 Yi=(e,t,r,i,n,o,a,s)=>{const c=s.bits;let u,l,d,_,p,f,h=0,R=0,b=0,g=0,m=0,C=0,v=0,T=0,O=0,S=0,E=null;const I=new Uint16Array(16),y=new Uint16Array(16);let L,A,P,N=null;for(h=0;h<=Gi;h++)I[h]=0;for(R=0;R<i;R++)I[t[r+R]]++;for(m=c,g=Gi;g>=1&&0===I[g];g--);if(m>g&&(m=g),0===g)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(b=1;b<g&&0===I[b];b++);for(m<b&&(m=b),T=1,h=1;h<=Gi;h++)if(T<<=1,T-=I[h],T<0)return-1;if(T>0&&(0===e||1!==g))return-1;for(y[1]=0,h=1;h<Gi;h++)y[h+1]=y[h]+I[h];for(R=0;R<i;R++)0!==t[r+R]&&(a[y[t[r+R]]++]=R);if(0===e?(E=N=a,f=20):1===e?(E=Hi,N=Ki,f=257):(E=Wi,N=zi,f=0),S=0,R=0,h=b,p=o,C=m,v=0,d=-1,O=1<<m,_=O-1,1===e&&O>852||2===e&&O>592)return 1;for(;;){L=h-v,a[R]+1<f?(A=0,P=a[R]):a[R]>=f?(A=N[a[R]-f],P=E[a[R]-f]):(A=96,P=0),u=1<<h-v,l=1<<C,b=l;do{l-=u,n[p+(S>>v)+l]=L<<24|A<<16|P}while(0!==l);for(u=1<<h-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,R++,0==--I[h]){if(h===g)break;h=t[r+a[R]]}if(h>m&&(S&_)!==d){for(0===v&&(v=m),p+=b,C=h-v,T=1<<C;C+v<g&&(T-=I[C+v],!(T<=0));)C++,T<<=1;if(O+=1<<C,1===e&&O>852||2===e&&O>592)return 1;d=S&_,n[d]=m<<24|C<<16|p-o}}return 0!==S&&(n[p+S]=h-v<<24|64<<16),s.bits=m,0};const{Z_FINISH:qi,Z_BLOCK:Zi,Z_TREES:Qi,Z_OK:Xi,Z_STREAM_END:$i,Z_NEED_DICT:en,Z_STREAM_ERROR:tn,Z_DATA_ERROR:rn,Z_MEM_ERROR:nn,Z_BUF_ERROR:on,Z_DEFLATED:an}=vr,sn=16180,cn=16190,un=16191,ln=16192,dn=16194,_n=16199,pn=16200,fn=16206,hn=16209,Rn=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function bn(){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 gn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<sn||t.mode>16211?1:0},mn=e=>{if(gn(e))return tn;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=sn,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,Xi},Cn=e=>{if(gn(e))return tn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,mn(e)},vn=(e,t)=>{let r;if(gn(e))return tn;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?tn:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,Cn(e))},Tn=(e,t)=>{if(!e)return tn;const r=new bn;e.state=r,r.strm=e,r.window=null,r.mode=sn;const i=vn(e,t);return i!==Xi&&(e.state=null),i};let On,Sn,En=!0;const In=e=>{if(En){On=new Int32Array(512),Sn=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(Yi(1,e.lens,0,288,On,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Yi(2,e.lens,0,32,Sn,0,e.work,{bits:5}),En=!1}e.lencode=On,e.lenbits=9,e.distcode=Sn,e.distbits=5},yn=(e,t,r,i)=>{let n;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)),i>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(n=o.wsize-o.wnext,n>i&&(n=i),o.window.set(t.subarray(r-i,r-i+n),o.wnext),(i-=n)?(o.window.set(t.subarray(r-i,r),0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0};var Ln={inflateReset:Cn,inflateReset2:vn,inflateResetKeep:mn,inflateInit:e=>Tn(e,15),inflateInit2:Tn,inflate:(e,t)=>{let r,i,n,o,a,s,c,u,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S=0;const E=new Uint8Array(4);let I,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(gn(e)||!e.output||!e.input&&0!==e.avail_in)return tn;r=e.state,r.mode===un&&(r.mode=ln),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,l=r.bits,d=s,_=c,O=Xi;e:for(;;)switch(r.mode){case sn:if(0===r.wrap){r.mode=ln;break}for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,E[0]=255&u,E[1]=u>>>8&255,r.check=mr(r.check,E,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=hn;break}if((15&u)!==an){e.msg="unknown compression method",r.mode=hn;break}if(u>>>=4,l-=4,T=8+(15&u),0===r.wbits&&(r.wbits=T),T>15||T>r.wbits){e.msg="invalid window size",r.mode=hn;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:un,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==an){e.msg="unknown compression method",r.mode=hn;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=hn;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=mr(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=mr(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=mr(r.check,E,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+=i[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=mr(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(p=r.length,p>s&&(p=s),p&&(r.head&&(T=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(o,o+p),T)),512&r.flags&&4&r.wrap&&(r.check=mr(r.check,i,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;p=0;do{T=i[o+p++],r.head&&T&&r.length<65536&&(r.head.name+=String.fromCharCode(T))}while(T&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=mr(r.check,i,p,o)),s-=p,o+=p,T)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;p=0;do{T=i[o+p++],r.head&&T&&r.length<65536&&(r.head.comment+=String.fromCharCode(T))}while(T&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=mr(r.check,i,p,o)),s-=p,o+=p,T)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+=i[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=hn;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=un;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}e.adler=r.check=Rn(u),u=0,l=0,r.mode=cn;case cn: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,en;e.adler=r.check=1,r.mode=un;case un:if(t===Zi||t===Qi)break e;case ln:if(r.last){u>>>=7&l,l-=7&l,r.mode=fn;break}for(;l<3;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(In(r),r.mode=_n,t===Qi){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=hn}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=hn;break}if(r.length=65535&u,u=0,l=0,r.mode=dn,t===Qi)break e;case dn:r.mode=16195;case 16195:if(p=r.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;n.set(i.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=un;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=i[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=hn;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=i[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,I={bits:r.lenbits},O=Yi(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,O){e.msg="invalid code lengths set",r.mode=hn;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],R=S>>>24,b=S>>>16&255,g=65535&S,!(R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(g<16)u>>>=R,l-=R,r.lens[r.have++]=g;else{if(16===g){for(y=R+2;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(u>>>=R,l-=R,0===r.have){e.msg="invalid bit length repeat",r.mode=hn;break}T=r.lens[r.have-1],p=3+(3&u),u>>>=2,l-=2}else if(17===g){for(y=R+3;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=R,l-=R,T=0,p=3+(7&u),u>>>=3,l-=3}else{for(y=R+7;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=R,l-=R,T=0,p=11+(127&u),u>>>=7,l-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=hn;break}for(;p--;)r.lens[r.have++]=T}}if(r.mode===hn)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=hn;break}if(r.lenbits=9,I={bits:r.lenbits},O=Yi(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,O){e.msg="invalid literal/lengths set",r.mode=hn;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},O=Yi(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,O){e.msg="invalid distances set",r.mode=hn;break}if(r.mode=_n,t===Qi)break e;case _n:r.mode=pn;case pn: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,Ji(e,_),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===un&&(r.back=-1);break}for(r.back=0;S=r.lencode[u&(1<<r.lenbits)-1],R=S>>>24,b=S>>>16&255,g=65535&S,!(R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(b&&!(240&b)){for(m=R,C=b,v=g;S=r.lencode[v+((u&(1<<m+C)-1)>>m)],R=S>>>24,b=S>>>16&255,g=65535&S,!(m+R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=m,l-=m,r.back+=m}if(u>>>=R,l-=R,r.back+=R,r.length=g,0===b){r.mode=16205;break}if(32&b){r.back=-1,r.mode=un;break}if(64&b){e.msg="invalid literal/length code",r.mode=hn;break}r.extra=15&b,r.mode=16201;case 16201:if(r.extra){for(y=r.extra;l<y;){if(0===s)break e;s--,u+=i[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],R=S>>>24,b=S>>>16&255,g=65535&S,!(R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(!(240&b)){for(m=R,C=b,v=g;S=r.distcode[v+((u&(1<<m+C)-1)>>m)],R=S>>>24,b=S>>>16&255,g=65535&S,!(m+R<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=m,l-=m,r.back+=m}if(u>>>=R,l-=R,r.back+=R,64&b){e.msg="invalid distance code",r.mode=hn;break}r.offset=g,r.extra=15&b,r.mode=16203;case 16203:if(r.extra){for(y=r.extra;l<y;){if(0===s)break e;s--,u+=i[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=hn;break}r.mode=16204;case 16204:if(0===c)break e;if(p=_-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=hn;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),h=r.window}else h=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=h[f++]}while(--p);0===r.length&&(r.mode=pn);break;case 16205:if(0===c)break e;n[a++]=r.length,c--,r.mode=pn;break;case fn:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=i[o++]<<l,l+=8}if(_-=c,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?mr(r.check,n,_,a-_):br(r.check,n,_,a-_)),_=c,4&r.wrap&&(r.flags?u:Rn(u))!==r.check){e.msg="incorrect data check",r.mode=hn;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+=i[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=hn;break}u=0,l=0}r.mode=16208;case 16208:O=$i;break e;case hn:O=rn;break e;case 16210:return nn;default:return tn}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<hn&&(r.mode<fn||t!==qi))&&yn(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?mr(r.check,n,_,e.next_out-_):br(r.check,n,_,e.next_out-_)),e.data_type=r.bits+(r.last?64:0)+(r.mode===un?128:0)+(r.mode===_n||r.mode===dn?256:0),(0===d&&0===_||t===qi)&&O===Xi&&(O=on),O},inflateEnd:e=>{if(gn(e))return tn;let t=e.state;return t.window&&(t.window=null),e.state=null,Xi},inflateGetHeader:(e,t)=>{if(gn(e))return tn;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Xi):tn},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,o;return gn(e)?tn:(i=e.state,0!==i.wrap&&i.mode!==cn?tn:i.mode===cn&&(n=1,n=br(n,t,r,0),n!==i.check)?rn:(o=yn(e,t,r,r),o?(i.mode=16210,nn):(i.havedict=1,Xi)))},inflateInfo:"pako inflate (from Nodeca project)"};var An=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 Pn=Object.prototype.toString,{Z_NO_FLUSH:Nn,Z_FINISH:wn,Z_OK:Dn,Z_STREAM_END:kn,Z_NEED_DICT:Un,Z_STREAM_ERROR:Mn,Z_DATA_ERROR:xn,Z_MEM_ERROR:jn}=vr;function Bn(e){this.options=Ci({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 r=Ln.inflateInit2(this.strm,t.windowBits);if(r!==Dn)throw new Error(Cr[r]);if(this.header=new An,Ln.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Si(t.dictionary):"[object ArrayBuffer]"===Pn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Ln.inflateSetDictionary(this.strm,t.dictionary),r!==Dn)))throw new Error(Cr[r])}Bn.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?wn:Nn,"[object ArrayBuffer]"===Pn.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(i),r.next_out=0,r.avail_out=i),o=Ln.inflate(r,a),o===Un&&n&&(o=Ln.inflateSetDictionary(r,n),o===Dn?o=Ln.inflate(r,a):o===xn&&(o=Un));r.avail_in>0&&o===kn&&r.state.wrap>0&&0!==e[r.next_in];)Ln.inflateReset(r),o=Ln.inflate(r,a);switch(o){case Mn:case xn:case Un:case jn:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===kn))if("string"===this.options.to){let e=Ii(r.output,r.next_out),t=r.next_out-e,n=Ei(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==Dn||0!==s){if(o===kn)return o=Ln.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Bn.prototype.onData=function(e){this.chunks.push(e)},Bn.prototype.onEnd=function(e){e===Dn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=vi(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:Vn,deflate:Fn,deflateRaw:Jn,gzip:Gn}=Vi;var Hn=Gn;var Kn,Wn=-1,zn="RongCloudSEIAI",Yn=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)}))},qn=function(t,r,i){return s(void 0,void 0,void 0,(function(){var n,o;return c(this,(function(a){return n=[],o=i.jwt||"",[2,new Promise((function(i,a){t.forEach((function(t){return s(void 0,void 0,void 0,(function(){var a,s,u;return c(this,(function(c){switch(c.label){case 0:return a=t.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(a,"/rtc/detector/ping?t=").concat((d=9999,(l=1e3)+Math.floor(Math.random()*(d-l)))),u={jwt:o},[4,r.httpReq({url:s,body:JSON.stringify(u),timeout:5e3,method:e.HttpMethod.POST})];case 1:return 200===c.sent().status&&n.push(t.clusterId),i(n),[2]}var l,d}))}))}))}))]}))}))},Zn=function(e,t){var r,i;if(!t)return"";try{i=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(n.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===i.strategy)return"";var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return"";var a=o[0];return a.detectorManager?a.detectorManager:""},Qn=function(t,r,i){return s(void 0,void 0,void 0,(function(){var n,o,a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:return n=Zn(r,i),o=i.jwt||"",a=120,s=0,u=i.ipType||0,l={jwt:o,ipType:u},[4,t.httpReq({url:"".concat(n,"/rtc/detector/servers"),body:JSON.stringify(l),headers:{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(vt.browser,"|").concat(vt.version),ClientVersion:"5.38.0-alpha.1","Client-Session-Id":Yn(),"Request-Id":Date.now().toString()},method:e.HttpMethod.POST})];case 1:return d=c.sent(),_=d.data&&JSON.parse(d.data).detectorAddrs||[],a=d.data&&JSON.parse(d.data).clientDetectMinute,s=d.data&&JSON.parse(d.data).resultCode,[2,{detectoraddrs:_,clientDetectMinute:a,status:s}]}}))}))};exports.RCRTCOperateSummarizationType=void 0,(Kn=exports.RCRTCOperateSummarizationType||(exports.RCRTCOperateSummarizationType={})).OPEN="2",Kn.CLOSE="1";function Xn(t){var r=t.method||e.HttpMethod.GET,i=t.timeout||6e4,n=t.headers,o=t.query,a=t.body,s=t.onProgress,c=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}(t.url,o),u=new XMLHttpRequest;if(u.open(r,c),n&&u.setRequestHeader)for(var l in n)u.setRequestHeader(l,n[l]);return function(e,t,r,i){return new Promise((function(n){e.onreadystatechange=function(){i?2===e.readyState?n({data:e.responseText,status:e.status,xhr:e}):4===e.readyState?i(e.responseText,!0):3===e.readyState&&i(e.responseText,!1):4===e.readyState&&n({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){n({status:e.status})},0!==t&&setTimeout((function(){e.abort(),n({status:e.status})}),t),e.send(r)}))}(u,i,a,s)}var $n,eo=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(vt.browser,"|").concat(vt.version),ClientVersion:"5.38.0-alpha.1","Client-Session-Id":Yn(),"Request-Id":Date.now().toString()}},to=function(){function t(t,r,i,n){void 0===n&&(n=5e3),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:n}),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()===e.RCConnectionStatus.CONNECTED&&this.isNededDetector()&&this.detectorMediaSever()}return Object.defineProperty(t.prototype,"isNededDetector",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._context.getNaviInfo();if(!e)return!1;var r=Zn(this._logger,e),i=e.jwt||"",n=Date.now(),o=!1;return 0===t.detectorTime?o=!1:t.detectValidMinute+t.detectorTime<n&&(o=!0),!(!r||!i||this._msUrl||o)}}),Object.defineProperty(t.prototype,"detectorMediaSever",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clearMSList();var e=this._context.getNaviInfo();this._startDetector(e)}}),Object.defineProperty(t.prototype,"_startDetector",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var r,i,n,o;return c(this,(function(a){switch(a.label){case 0:return[4,Qn(this._runtime,this._logger,e)];case 1:return r=a.sent(),i=r.detectoraddrs,n=r.clientDetectMinute,r.status!==exports.RCRTCCode.JWT_TIME_OUT?[3,3]:[4,this._context.getPluginContext().refetchNaviInfo()];case 2:return a.sent(),this.detectorMediaSever(),[2];case 3:return i.length?(o=t,[4,qn(i,this._runtime,e)]):[3,5];case 4:o.msInDetector=a.sent(),a.label=5;case 5:return t.detectorTime=Date.now(),t.detectValidMinute=60*n*1e3,[2]}}))}))}}),Object.defineProperty(t.prototype,"clearMSList",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._msList.length=0}}),Object.defineProperty(t.prototype,"getMsList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msUrl?[this._msUrl]:(this._sortMediaServiceList(),d([],l(this._msList),!1))}}),Object.defineProperty(t.prototype,"_sortMediaServiceList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.msInDetector[0],r=t.msInDetector.slice(1),i=function(e,t){var r,i;if(!e)return[];try{i=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(n.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===i.strategy)return[];var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return[];var a=o[0],s=[];return a.mediaServer&&s.push(a.mediaServer.replace(/^(https?:\/\/)?/,"https://")),a.backupMediaServer&&a.backupMediaServer.forEach((function(e){s.push(e.replace(/^(https?:\/\/)?/,"https://"))})),s}(this._context.getNaviInfo(),this._logger),o=i[0],a=i.slice(1),s=d(d([this._clusterId,e,o],l(r),!1),l(a),!1).filter((function(e){return!!e})).map((function(e){return e.replace(/^(https?:\/\/)?/,"https://")}));this._msList=d([],l(new Set(s)),!1),this._logger.info(n.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList)))}}),Object.defineProperty(t.prototype,"_openGzip",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=JSON.stringify(t),i=r.length,n=new Uint8Array(i),o=0;o<i;o++)n[o]=r.charCodeAt(o);var s;return{headers:e=a(a({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=Hn(n,s)}}}),Object.defineProperty(t.prototype,"_dealRequestSuccessResult",{enumerable:!1,configurable:!0,writable:!0,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}}}),Object.defineProperty(t.prototype,"_request",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,u,l,d){return s(this,void 0,void 0,(function(){var s,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I;return c(this,(function(c){switch(c.label){case 0:if(this._qualityMsList=[],_=(s={headers:r,body:i}).headers,p=s.body,0===(f=this.getMsList()).length)return this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),u),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(p.rtcFinger=this._rtcFinger),h=0,c.label=1;case 1:return h<f.length?(R=Date.now(),b="".concat(f[h]).concat(t),g=eo(),m=a(a({},g),_),C=/x-www-form-urlencoded/.test(m["Content-Type"])?p:JSON.stringify(p),v=g["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:b,"Request-Id":v}),u),T=void 0,O={url:b,body:C,headers:m,method:e.HttpMethod.POST,timeout:this._timeout},d?[4,Xn(a(a({},O),{onProgress:d}))]:[3,3]):[3,7];case 2:return T=c.sent(),[3,5];case 3:return[4,this._runtime.httpReq(a({},O))];case 4:T=c.sent(),c.label=5;case 5:if(S=T.status,E=T.data,I=T.xhr,l&&this._qualityMsList.push({rsdur:Date.now()-R,rsid:v,rscod:200===S?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:b}),200===S)return this._logger.info(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.SUCCESSED,url:b}),u),d?[2,{code:exports.RCRTCCode.SUCCESS,data:I}]:[2,this._dealRequestSuccessResult(E)];this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.FAILED,msg:"request error -> Request-Id: ".concat(v,", status: ").concat(S,", url: ").concat(b),timeout:this._timeout}),u),c.label=6;case 6:return h+=1,[3,1];case 7:return[2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList}]}}))}))}}),Object.defineProperty(t.prototype,"exchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n;return s(this,void 0,void 0,(function(){var o,a;return c(this,(function(s){switch(s.label){case 0:return[4,this._request("/exchange",e,t,r,i)];case 1:return(o=s.sent()).code===exports.RCRTCCode.SUCCESS&&(null===(n=o.data)||void 0===n?void 0:n.resultCode)===exports.RCRTCCode.SUCCESS&&(a=o.data.urls)&&(this._configUrl=a.configUrl),[2,o]}}))}))}}),Object.defineProperty(t.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/exit",e,{},t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"broadcastSubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._logger.createTraceId();return this._request("/broadcast/subscribe",e,t,r,!0)}}),Object.defineProperty(t.prototype,"broadcastExit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/broadcast/exit",e,{},t,!0)];case 1:return[2,{code:r.sent().code}]}}))}))}}),Object.defineProperty(t.prototype,"setMcuConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d,_,p,f,h,R,b;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:r}),i),this._configUrl?(s="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),u=eo(),l=a(a({},u),t),d=JSON.stringify(r),_=u["Request-Id"],[4,this._runtime.httpReq({url:s,headers:l,body:d,method:e.HttpMethod.POST})]):(this._logger.error(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),i),[2,{code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND}]);case 1:return p=c.sent(),f=p.status,h=p.data,200===f?(R=JSON.parse(h),(b=R.resultCode)===exports.RCRTCCode.SUCCESS?this._logger.info(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.SUCCESSED,"Request-Id":_}),i):this._logger.warn(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:b,"Request-Id":_}),i),[2,{code:b,res:R}]):(this._logger.error(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(_,", status: ").concat(f,", url: ").concat(s)}),i),[2,{code:exports.RCRTCCode.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(t.prototype,"getCDNResourceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s=eo(),u=a(a({},s),t),l=s["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(l,", url: ").concat(r),i),[4,this._runtime.httpReq({url:r,headers:u,method:e.HttpMethod.GET})];case 1:return d=c.sent(),_=d.status,p=d.data,200===_?(f=JSON.parse(p),this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:o.SUCCESSED,cdnPlayerUrl:null==f?void 0:f.data.pull_url}),i),[2,{code:f.resultCode,res:f}]):(this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REQUEST_FAILED}),i),[2,{code:exports.RCRTCCode.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(t.prototype,"updateASRStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._request("/rtc/media/v1/asr/update",e,t,r)];case 1:return[2,i.sent()]}}))}))}}),Object.defineProperty(t.prototype,"operateRealtimeTranslation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._request("/rtc/media/v1/asr/translation",e,t,r)];case 1:return[2,i.sent()]}}))}))}}),Object.defineProperty(t.prototype,"operateSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return i="/rtc/media/v1/ai/room/sum/".concat(t.status===exports.RCRTCOperateSummarizationType.OPEN?"start":"stop"),[4,this._request(i,e,t,r)];case 1:return[2,n.sent()]}}))}))}}),Object.defineProperty(t.prototype,"generateSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:r,endTime:i,config:{summarization:n.enableSummarization,summarizationDetails:n.enableSummarizationDetails,chapterSummary:n.enableChapterSummary,todoList:n.enableTodoList,hashtag:n.enableHashtag,language:n.destLang,format:n.format,custom:n.customPrompt}},[4,this._request("/rtc/media/v1/ai/room/sum/gen",s,u,a,!1,(function(e,t){o(e,t)}))];case 1:return l=c.sent(),d=l.code,_=l.data,p=null==_?void 0:_.getResponseHeader("x-code"),f=null==_?void 0:_.getResponseHeader("x-msg"),d===exports.RCRTCCode.SUCCESS&&p&&Number(p)!==exports.RCRTCCode.SUCCESS?[2,{code:Number(p),msg:f}]:[2,{code:d}]}}))}))}}),Object.defineProperty(t.prototype,"getASRContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s={"App-Key":this._context.getAppkey(),UserId:this._context.getCurrentId(),RoomId:e,"X-Stream":!0},u={taskId:t,startTime:r,endTime:i,language:a},[4,this._request("/rtc/media/v1/ai/room/sum/asr",s,u,o,!1,(function(e,t){n(e,t)}))];case 1:return l=c.sent(),d=l.code,_=l.data,p=null==_?void 0:_.getResponseHeader("x-code"),f=null==_?void 0:_.getResponseHeader("x-msg"),d===exports.RCRTCCode.SUCCESS&&p&&Number(p)!==exports.RCRTCCode.SUCCESS?[2,{code:Number(p),msg:f}]:[2,{code:d}]}}))}))}}),Object.defineProperty(t,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),t}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}($n||($n={}));var ro,io=function(e,t){return Math.round(8*t/e)},no=function(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.round(e*r)/r},oo=function(e,t){void 0===t&&(t=2),e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},ao=function(e,t,r,i){if(0===t)return 0;if(!r||!i)return no(e/t,3);var n=t-i;if(0===n)return 0;var o=e-r;return o<0||n<0?0:no(o/n,3)},so=function(e){var t=e.jitter,r=e.rtt,i=e.packetsLostRate;return!It(t)||!It(r)||0!==i};!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"}(ro||(ro={}));var co,uo=function(){function e(e,t,r,i,n,o){Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),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:{}})}return Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}}),Object.defineProperty(e.prototype,"updateBytesSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];i=t-o.bytesSent,n=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else i=t,n=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return io(n,i)}}),Object.defineProperty(e.prototype,"updateBytesRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];i=t-o.bytesRecv,n=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else i=t,n=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return io(n,i)}}),Object.defineProperty(e.prototype,"updateSenderPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var n=this._latestPacketsSent[e],o=n.packetsLost,a=n.packetsSent;i=ao(t,r,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:r}else i=ao(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return i}}),Object.defineProperty(e.prototype,"updateReceiverPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if(this._latestPacketsRecv[e]){var n=this._latestPacketsRecv[e],o=n.packetsLost,a=n.packetsRecv;i=ao(t,r+t,o,a+o)}else i=ao(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},i}}),Object.defineProperty(e.prototype,"clearLatestpacketsSent",{enumerable:!1,configurable:!0,writable:!0,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]}))}}),Object.defineProperty(e.prototype,"clearLatestPacketsRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}}),Object.defineProperty(e.prototype,"parseRTCStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i={};try{for(var n=u(e.entries()),o=n.next();!o.done;o=n.next()){var a=l(o.value,2),s=a[0],c=a[1];/codec/gi.test(c)&&s.includes("RTCCodec_")||(i[s]=c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i}}),Object.defineProperty(e.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={senders:[],receivers:[]};return this._logger.info(n.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:o.SUCCESSED,stats:e,reports:t})),t}}),Object.defineProperty(e.prototype,"isValidTranceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(i=this._rtcPeerConn.currentRemoteDescription)||void 0===i?void 0:i.sdp,o=e.ssrc;return!(null==n?void 0:n.split("\r\nm=").some((function(e){return e.includes(o)&&e.includes("a=inactive")})))}}),Object.defineProperty(e.prototype,"formatStateData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Object.values(e).reduce((function(e,t){return t.type===ro.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===ro.INBOUNDRTP?(e.inbound.push(t),e):t.type===ro.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===ro.TRANSPORT?(e.transport.push(t),e):t.type===ro.PEERCONNECTION?(e.connection.push(t),e):e}),{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}),e}(),lo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=this.formatStateData(e),n=i.outbound,o=i.remoteInbound,a=i.inbound,s=i.transport,c=i.connection,u={senders:[],receivers:[]},l=Math.floor(c[0].timestamp);u.timestamp=l;var d=0,_=0;d=(t=this.pickOutbound(n,e,d,l,_)).totalPacketsLost,_=t.bitrateSend,u.senders=t.senders,o.length>0&&u.senders.length>0&&this.pickRemoteInbound(o,u.senders,e);var p=0;if(d=(r=this.pickInbound(a,e,d,l,p)).totalPacketsLost,p=r.bitrateRecv,u.receivers=r.receivers,s.length>0){var f=s[0];this.pickRtcTransport(f,e,u,p,_,d)}return u}}),Object.defineProperty(t.prototype,"pickRtcTransport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,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,p=t[d],f=p.ip,h=p.port,R=p.networkType,b=t[_],g=b.ip,m=b.port,C=b.protocol;r.iceCandidatePair={IP:f,port:h,networkType:R,remoteIP:g,remotePort:m,protocol:C,bitrateRecv:i,bitrateSend:n,rtt:1e3*l,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},r.receivers.forEach((function(e){e.rtt=1e3*l}))}}}),Object.defineProperty(t.prototype,"pickRemoteInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this;e.forEach((function(e){var n,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter((function(e){return e.id===o}))[0];if(u&&!so(u)){var l=null===(n=i._store)||void 0===n?void 0:n.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var d=i._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=i.updateSenderPacketsLost(l,c,d)}}))}}),Object.defineProperty(t.prototype,"_getOutboundVideoAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[i])||void 0===o?void 0:o.frameWidth)||t[n].width,l=(null===(a=t[i])||void 0===a?void 0:a.frameHeight)||t[n].height,c=(null===(s=t[n])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:l}}}),Object.defineProperty(t.prototype,"pickOutbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){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,p=e.bytesSent,f=e.encoderImplementation,h=e.pliCount,R=e.nackCount,b=e.mid,g=e.trackId;if(void 0!==b&&(g=o.getTrackIdByMid(b)),g){var m=o._getOutboundVideoAttrs(e,t,u,g,l),C=m.frameRate,v=m.frameWidth,T=m.frameHeight,O=t[d],S=null,E=null,I=0;O&&(S=O.jitter,E=O.roundTripTime,I=O.packetsLost),r+=I;var y=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(y){var L=l?t[l].audioLevel:t[g].audioLevel,A=0;!o._latestPacketsSent[y]&&(o._latestPacketsSent[y]={}),O?A=o.updateSenderPacketsLost(y,I,_):o._latestPacketsSent[y].crtPacketsSent=_;var P=o.updateBytesSent(y,p,i);P<0&&(P=0),n+=P,a.push({id:c,trackId:y,kind:u,packetsLostRate:A,remoteResource:!1,audioLevel:L||0===L?oo(L):null,frameWidth:v,frameHeight:T,frameRate:C,bitrate:P,jitter:S?Math.round(1e3*S):S,rtt:E?Math.round(1e3*E):E,encoderImplementation:f,pliCount:h,nackCount:R,googFirsSent:Wn,samplingRate:Wn,googRenderDelayMs:Wn,trackState:Wn})}}}})),{totalPacketsLost:r,bitrateSend:n,senders:a}}}),Object.defineProperty(t.prototype,"_getInboundMediaAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===n?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[i].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[i].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[i].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}}),Object.defineProperty(t.prototype,"pickInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){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,p=e.kind,f=e.codecImplementationName,h=e.nackCount,R=e.pliCount,b=e.mid,g=e.id,m=e.trackId;if(void 0!==b&&(m=o.getTrackIdByMid(b)),m){var C=o._getInboundMediaAttrs(e,t,m,g,p),v=C.frameWidth,T=C.frameHeight,O=C.audioLevel;r+=c;var S=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),E=o.updateReceiverPacketsLost(S,c,u),I=o.updateBytesRecv(S,d,i);I<0&&(I=0),n+=I,a.push({trackId:S,kind:p,packetsLostRate:E,remoteResource:!0,audioLevel:O||0===O?oo(O):null,frameWidth:v,frameHeight:T,frameRate:_,bitrate:I,jitter:l?Math.round(1e3*l):0,codecImplementationName:f,nackCount:h,pliCount:R,rtt:null,samplingRate:Wn,googFirsReceived:Wn,googRenderDelayMs:Wn,trackState:Wn})}}})),{totalPacketsLost:r,bitrateRecv:n,receivers:a}}}),t}(uo),_o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return 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 r(t,e),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var n=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},p=_.jitter,f=_.roundTripTime,h=_.packetsLost,R=null===(i=this._store)||void 0===i?void 0:i.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=h;var b=0;!this._latestPacketsSent[R]&&(this._latestPacketsSent[R]={}),d?b=this.updateSenderPacketsLost(R,h,a):this._latestPacketsSent[R].crtPacketsSent=a;var g=0;"video"===n?s&&(g=Math.floor(s/1e3)):g=this.updateBytesSent(R,o,this._reportsData.timestamp),g<0&&(g=0),this._bitrateSend+=g,this._reportsData.senders.push({trackId:R,kind:n,packetsLostRate:b,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:g,jitter:p?Math.round(1e3*p):null,rtt:f,encoderImplementation:null,pliCount:l,nackCount:u,googFirsSent:Wn,samplingRate:Wn,googRenderDelayMs:Wn,trackState:Wn})}}}),Object.defineProperty(t.prototype,"_addSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=t.localId,n=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[i].ssrc),o=this._reportsData.senders.filter((function(e){return e.trackId===n}))[0];o&&so(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(n,t.packetsLost,this._latestPacketsSent[n].crtPacketsSent))}}),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var i=e.packetsLost,n=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+=i;var p=this.updateReceiverPacketsLost(_,i,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(_,n,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:_,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:l,pliCount:d,rtt:null,samplingRate:Wn,googFirsReceived:Wn,googRenderDelayMs:Wn,trackState:Wn})}}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e[t.localCandidateId],i=r.address,n=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:i,port:n,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,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 i=e[r],n=i.type;"outbound-rtp"===n&&this._pickSenderData(i,e,n),"remote-inbound-rtp"===n&&this._addSenderData(e,i),"inbound-rtp"===n&&this._pickReceiverData(i,n),"candidate-pair"===n&&"succeeded"===i.state&&this._pickIceCandidatePair(e,i)}return this._reportsData}}),t}(uo),po=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return 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 r(t,e),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var t;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"inbound-rtp")){var i=e.packetsLost,n=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,p=null===(t=r._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(p){r._totalPacketsLost+=i;var f=r.updateReceiverPacketsLost(p,i,n),h=r.updateBytesRecv(p,a,r._reportsData.timestamp);h<0&&(h=0),r._bitrateRecv+=h,r._reportsData.receivers.push({trackId:p,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:l||0===l?oo(l):null,frameWidth:_,frameHeight:d,frameRate:null,bitrate:h,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:Wn,googFirsReceived:Wn,googRenderDelayMs:Wn,trackState:Wn})}}}))}}),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var i;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var n=null===(i=r._store)||void 0===i?void 0:i.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,p=e.remoteId,f=e.packetsSent;if(n){var h=t[p],R=null,b=null,g=0;h&&(R=h.jitter,b=h.roundTripTime,g=h.packetsLost),r._totalPacketsLost+=g;var m=0;!r._latestPacketsSent[n]&&(r._latestPacketsSent[n]={}),h?m=r.updateSenderPacketsLost(n,g,f):r._latestPacketsSent[n].crtPacketsSent=f;var C=r.updateBytesSent(n,a,r._reportsData.timestamp);C<0&&(C=0),r._bitrateSend+=C,r._reportsData.senders.push({trackId:n,kind:o,packetsLostRate:m,remoteResource:!1,audioLevel:u||0===u?oo(u):null,frameWidth:d,frameHeight:l,frameRate:null,bitrate:C,jitter:R?Math.round(1e3*R):R,rtt:b?Math.round(1e3*b):b,encoderImplementation:t[_].mimeType,pliCount:s,nackCount:c,googFirsSent:Wn,samplingRate:Wn,googRenderDelayMs:Wn,trackState:Wn})}}}))}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.selectedCandidatePairId;if(r){var i=t[r],n=i.availableOutgoingBitrate,o=i.availableIncomingBitrate,a=i.currentRoundTripTime,s=i.localCandidateId,c=i.remoteCandidateId,u=t[s],l=u.address,d=u.port,_=t[c],p=_.address,f=_.port,h=_.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:d,networkType:null,remoteIP:p,remotePort:f,protocol:h,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:n,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach((function(e){e.rtt=1e3*a}))}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.formatStateData(e),r=t.outbound,i=t.inbound,n=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(i,e),n.length>0){var s=n[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}),t}(uo),fo=function(){function e(e,t,r){Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),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 i=this.getStreamIndex();this.spliteStreams(i)}return Object.defineProperty(e.prototype,"videoSdps",{get:function(){return this.videoStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioSdps",{get:function(){return this.audioStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"trimBlankLine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}}),Object.defineProperty(e.prototype,"getStreamIndex",{enumerable:!1,configurable:!0,writable:!0,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),d([],l(t),!1)}}),Object.defineProperty(e.prototype,"spliteStreams",{enumerable:!1,configurable:!0,writable:!0,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)}}}),Object.defineProperty(e,"clearInactiveOrRecvonly",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}),Object.defineProperty(e.prototype,"setHeaderBitrate",{enumerable:!1,configurable:!0,writable:!0,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))}}),Object.defineProperty(e.prototype,"setAudiosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.audioStreams=this.audioStreams.map((function(r){return t.setAudioItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(i){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(i)?r.setAudioItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(i){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(i)?r.setAudioItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setAudioItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var i=["$1","maxaveragebitrate=".concat(r.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,i.join(";"))}return this.addAudioBlineAS(t,r)}}),Object.defineProperty(e.prototype,"addAudioBlineAS",{enumerable:!1,configurable:!0,writable:!0,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))}}),Object.defineProperty(e.prototype,"setVideosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.videoStreams=this.videoStreams.map((function(r){return t.setVideoItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(i)?r.setVideoItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(i)?r.setVideoItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setVideoItemBitrate",{enumerable:!1,configurable:!0,writable:!0,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 i=["$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,i.join(";"))}return this.addVideoBlineAS(t,r)}}),Object.defineProperty(e.prototype,"addVideoBlineAS",{enumerable:!1,configurable:!0,writable:!0,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))}}),Object.defineProperty(e.prototype,"clearnSsrcWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(i){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(i)?r.clearSSRC(i,t):i})),this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(i)?r.clearSSRC(i,t):i})),this}}),Object.defineProperty(e.prototype,"clearSSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===bo.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===bo.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===bo.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}),Object.defineProperty(e,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1}),e}(),ho=function(){function e(){}return Object.defineProperty(e,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}}),Object.defineProperty(e,"isInit",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}}),Object.defineProperty(e,"decodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"decodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),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"}(co||(co={})),co.NB,co.NB,co.NB,co.NB,co.MB,co.MB,co.MB,co.MB,co.WB,co.WB,co.WB,co.WB,co.SWB,co.SWB,co.FB,co.FB,co.NB,co.NB,co.NB,co.NB,co.WB,co.WB,co.WB,co.WB,co.SWB,co.SWB,co.SWB,co.SWB,co.FB,co.FB,co.FB,co.FB;var Ro,bo,go=function(){function e(){}return Object.defineProperty(e,"splitSections",{enumerable:!1,configurable:!0,writable:!0,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")}))}}),Object.defineProperty(e,"getMediaSections",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitSections(t);return r.shift(),r}}),Object.defineProperty(e,"parseExtmap",{enumerable:!1,configurable:!0,writable:!0,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]}}}),Object.defineProperty(e,"splitLines",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.trim().split("\n").map((function(e){return e.trim()}))}}),Object.defineProperty(e,"parseMLine",{enumerable:!1,configurable:!0,writable:!0,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(" ")}}}),Object.defineProperty(e,"matchPrefix",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.splitLines(t).filter((function(e){return 0===e.indexOf(r)}))}}),Object.defineProperty(e,"parseMsid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i=e.matchPrefix(t,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=e.matchPrefix(t,"a=ssrc:").map((function(t){return e.parseSsrcMedia(t)})).filter((function(e){return"msid"===e.attribute}));return n.length>0&&n[0].value?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:{stream:"",track:""}}}),Object.defineProperty(e,"parseSsrcMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r}}),Object.defineProperty(e,"getMid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)}}),Object.defineProperty(e,"splitNaluData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=0;if(this.isIFrame(t)){var i=t.join(","),n=i.indexOf("0,0,0,1,101");-1===n&&(n=i.indexOf("0,0,0,1,37")),r=i.substring(0,n).split(",").length-1+4+8}else r=12;return{header:t.slice(0,r),payloadData:t.slice(r)}}}),Object.defineProperty(e,"deal0x03",{enumerable:!1,configurable:!0,writable:!0,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)}}),Object.defineProperty(e,"isIFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}}),Object.defineProperty(e,"parsePayloadTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.getMediaSections(t).find((function(t){return"audio"===e.parseMLine(t).kind}));if(r){var i=r.match(/a=rtpmap:(\d+)\s+(\S+)/g);i&&(e.payloadTypeCodecMap=i.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(e,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]}),e}();function mo(e,t){for(var r=0,i=t;i<e.length;){var n=e[i];if(r+=n,i++,255!==n)break}return{value:r,nextOffset:i}}function Co(e,t){if(t>=e.length)return null;var r=mo(e,t),i=r.value,n=r.nextOffset,o=mo(e,n),a=o.value;if(n=o.nextOffset,a<16)return null;if(n+a>e.length)return null;var s=e.slice(n,n+16),c=n+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===i?{payloadSize:a,uuid:s,content:l}:null}!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(Ro||(Ro={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(bo||(bo={}));var vo,To,Oo,So,Eo=function(){function e(e,t,r,i){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_onReceiveSeiListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e,"setSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=vt.browser,i=vt.version,o=vt.supportsUnifiedPlan;if(t.info(n.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:o,browser:r,version:i})),o)return/chrome/i.test(r)?i?void(this._sdpSemantics=i>92?"unified-plan":i<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=i<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}}),Object.defineProperty(e,"getSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e._sdpSemantics}}),Object.defineProperty(e.prototype,"setReceiveSeiListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._onReceiveSeiListener=e}}),Object.defineProperty(e.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._outboundStreams){var r=this._outboundStreams[t].getVideoTracks()[0];if(r){var i=/_tiny$/.test(t),n=ut(r),o=n.width,a=n.height;e.push({trackId:r.id,simulcast:i?$n.TINY:$n.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}}),Object.defineProperty(e.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:e=fo.trimBlankLine(e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._peer.setRemoteDescription({type:"answer",sdp:e})];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this._logger.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:o.FAILED,msg:t})),[2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED];case 4:return this._logger.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:o.SUCCESSED,sdp:e})),[2,exports.RCRTCCode.SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"getStatParsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return/chrome/i.test(vt.browser)?new lo(this,e,this._logger,t,r,i):/Firefox/i.test(vt.browser)?new _o(this,e,this._logger,t,r,i):/Safari/i.test(vt.browser)?new po(this,e,this._logger,t,r,i):null}}),Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return null}}),Object.defineProperty(e.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return fo.trimBlankLine(e)}}),Object.defineProperty(e.prototype,"_setupSenderTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt)if(Nt()){var t=e.createEncodedStreams(),r=t.readable,i=t.writable,o=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(o).pipeTo(i)}else this._logger.warn(n.L_A_SDP_STRATEGY_SET_SENDER_TRANSFORM_O,"not support encrypt")}}),Object.defineProperty(e.prototype,"_setupReceiverTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(Nt()){var t=e.createEncodedStreams(),r=t.readable,i=t.writable,o=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(o).pipeTo(i)}else this._logger.warn(n.L_A_SDP_STRATEGY_SET_RECEIVER_TRANSFORM_O,"not support encrypt")}}),Object.defineProperty(e.prototype,"_encodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=go.splitNaluData(e),r=t.header,i=t.payloadData,n=ho.encodeVideo(i),o=go.deal0x03(n,"encode");return new Uint8Array(d(d([],l(r),!1),l(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_decodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new Uint8Array(e),i=r.join(",").indexOf("0,0,0,1,6,5");if(-1!==i&&r.join(",").includes("84,128,131,151,240,35,71,75,183,247,79,50,181,78,6,172")){var n=r.join(",").slice(i);return null===(t=this._onReceiveSeiListener)||void 0===t||t.call(this,n),e}if(!this._useEncrypt)return e;var o=go.splitNaluData(e),a=o.header,s=o.payloadData,c=go.deal0x03(s,"decode"),u=ho.decodeVideo(c);return new Uint8Array(d(d([],l(a),!1),l(u),!1)).buffer}}),Object.defineProperty(e.prototype,"_handleAudioREDFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=function(e){for(var t=[],r=0;;){var i,n=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(n?(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),i=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:i,isPrimary:n,blockPType:o}),n)break}return t.forEach((function(t){var i=t.block.byteLength,n=e.slice(r,r+i);t.block.set(n),r+=i})),t}(new Uint8Array(e)),i=[],n=[],o=0;r.forEach((function(e){var r="decode"===t?ho.decodeAudio(e.block):ho.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=l(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,i.push(e.header),n.push(e.block)}));var a=new Uint8Array(o),s=0;return d(d([],l(i),!1),l(n),!1).forEach((function(e){a.set(e,s),s+=e.byteLength})),a.buffer}}),Object.defineProperty(e.prototype,"_handleOpusFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=new Uint8Array(e);return("encode"===t?ho.encodeAudio(r):ho.decodeAudio(r)).buffer}}),Object.defineProperty(e.prototype,"_encodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(i);else{var n=t.getMetadata().payloadType,o=go.payloadTypeCodecMap.filter((function(e){return e.payloadType===n}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(i,"encode"):"opus"===o?t.data=this._handleOpusFrame(i,"encode"):console.error("Unsupport audio payloadType: ".concat(n,", codec: ").concat(o))}r.enqueue(t)}}),Object.defineProperty(e.prototype,"_decodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(i);else if(this._useEncrypt){var n=t.getMetadata().payloadType,o=go.payloadTypeCodecMap.filter((function(e){return e.payloadType===n}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(i,"decode"):"opus"===o?t.data=this._handleOpusFrame(i,"decode"):console.error("Unsupport audio payloadType: ".concat(n,", codec: ").concat(o))}r.enqueue(t)}}),e}(),Io=function(e){function t(t,r){var i=e.call(this,r,Ro.PLANB,t)||this;return Object.defineProperty(i,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];d(d([],l(this.audioStreams),!1),l(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(video|audio)\b/),i=fo.clearInactiveOrRecvonly(t);r&&r[1]===Pe.AUDIO&&(e[1]=i),r&&r[1]===Pe.VIDEO&&(e[2]=i)}));var t=e.join("");return fo.trimBlankLine(t)}}),Object.defineProperty(t.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}}),Object.defineProperty(t.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}),t}(fo),yo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return r(t,e),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._localTracks.every((function(t){return t.getTrackId()!==e.getTrackId()}))&&this._localTracks.push(e);var t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),i=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);i.getTracks().forEach((function(e){e.kind===r.kind&&i.removeTrack(e)})),i.addTrack(r);var n=e.getTrackId(),o=this.senders[n];o?o.replaceTrack(r):(this.senders[n]=this._peer.addTrack(r,i),Object.defineProperty(r,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var r=e.getTrackId(),i=this.senders[r];i&&(i.replaceTrack(null),this._peer.removeTrack(i),delete this.senders[r])}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i;return c(this,(function(n){switch(n.label){case 0:return[4,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0})];case 1:for(r in t=n.sent(),this._outboundStreams)i=this._outboundStreams[r].id,t.sdp=t.sdp.replace(new RegExp(i,"g"),r);return t.sdp&&(t.sdp=this.resetSdp(t.sdp)),[4,this._peer.setLocalDescription(t)];case 2:return n.sent(),[2,{type:"offer",semantics:"plan-b",sdp:t.sdp}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t=this.resetSdp(t),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_getMaxRangeBitrate",{enumerable:!1,configurable:!0,writable:!0,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(),i=t.min,n=t.max,o=t.start;r.max=r.max<n?n:r.max,r.min=r.min>i?i:r.min,r.max===n?r.start=o:r.start=.7*r.max})),r}}),Object.defineProperty(t.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Io(this._logger,e),r=this._getMaxRangeBitrate(exports.RCMediaType.VIDEO_ONLY),i=this._getMaxRangeBitrate(exports.RCMediaType.AUDIO_ONLY);return t.setAudiosBitrate(i),t.setVideosBitrate(r),t.stringify()}}),t}(Eo),Lo=function(e){function t(t,r){return e.call(this,r,Ro.UNIFIEDPLAN,t)||this}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];d(d([],l(this.audioStreams),!1),l(this.videoStreams),!1).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 fo.trimBlankLine(t)}}),t}(fo),Ao=function(){function e(){Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e.instance||(e.instance=new e),e.instance}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.__streams.set(e,t),t}}),Object.defineProperty(e.prototype,"pickup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.get(e)}}),Object.defineProperty(e.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.delete(e)}}),Object.defineProperty(e.prototype,"streams",{get:function(){var e,t,r=new Map;try{for(var i=u(this.__streams.keys()),n=i.next();!n.done;n=i.next()){var o=n.value;r.set(o,this.pickup(o))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return 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 r(t,e),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}}),Object.defineProperty(t.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var t in this._recvTransceiver){if(this._recvTransceiver[t].mid===e)return t}return null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.getTrackId(),i=e.getStreamId(),n=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[i]||(this._outboundStreams[i]=new MediaStream);o.getTracks().forEach((function(e){e.kind===n.kind&&o.removeTrack(e)})),o.addTrack(n);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(n),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(n,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}Ao.getInstance().push(r,{msid:i,id:this._outboundStreams[i].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=e.getTrackId(),i=e.getStreamId();delete this._localTracks[r];var n=this._sendTransceiver[r];if(n){"closed"!==this._peer.connectionState&&(n.direction="inactive",this._peer.removeTrack(n.sender),n.sender.replaceTrack(null));var o=this._outboundStreams[i];(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(i,"_tiny")].removeTrack(c),c.stop()}}}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=_t(e).mediaType;this._recvTransceiver[e]=t;var i=r===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,n=i.findIndex((function(e){return e===t}));n>=0&&i.splice(n,1)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.slice(),i=this._subedTracks.slice();this._subedTracks=e.slice();for(var n=function(e){var t=r[e],n=i.findIndex((function(e){return e===t}));n>=0&&(r.splice(e,1),i.splice(n,1))},o=r.length-1;o>=0;o-=1)n(o);i.length&&i.forEach((function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var i=t._recvTransceiver[r];i&&(i.direction="inactive")}));var a={audio:0,video:0};r.length&&r.forEach((function(e){var r=e.isAudioTrack()?"audio":"video",i=t._recvTransceiver[e.getTrackId()];i?i.direction="recvonly":a[r]+=1}));for(o=this._recvAudio.length;o<a.audio;o+=1){var s=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(s),this._setupReceiverTransform(s.receiver)}for(o=this._recvVideo.length;o<a.video;o+=1){s=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(s),this._setupReceiverTransform(s.receiver)}}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n;return c(this,(function(o){switch(o.label){case 0:return[4,this._peer.createOffer({iceRestart:e})];case 1:for(i in t=o.sent(),r=t.sdp,this._outboundStreams)n=this._outboundStreams[i].id,r=r.replace(new RegExp(n,"g"),i);return r=(r=this.resetOfferSdp(r)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),t.sdp=r,[4,this._peer.setLocalDescription(t)];case 2:return o.sent(),[2,{type:"offer",semantics:"unified-plan",sdp:r}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,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")),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_genarateMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=null;return go.getMediaSections(e).forEach((function(e){go.parseExtmap(e);var n=go.parseMLine(e).kind,o=go.parseMsid(e).stream,a=go.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===n&&a&&(i=a)})),i}}),Object.defineProperty(t.prototype,"_setSenderTransceiverBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n=this._localTracks[t],o=null==n?void 0:n.getBitrate();i===Pe.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),i===Pe.VIDEO&&o&&e.setVideoBitrateWithMid(o,r)}}),Object.defineProperty(t.prototype,"_resetSenderTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;for(var i in this._sendTransceiver){var n=this._sendTransceiver[i],o=null===(r=n.sender.track)||void 0===r?void 0:r.kind,a=n.direction,s=n.mid;s||(s=this._genarateMid(e,i,o)),s&&(a===bo.SENDONLY&&this._setSenderTransceiverBitrate(t,i,s,o),a===bo.INACTIVE&&t.clearnSsrcWithMid(s,bo.INACTIVE))}}}),Object.defineProperty(t.prototype,"_resetRecvTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._recvTransceiver){var r=this._recvTransceiver[t],i=r.direction,n=r.mid;n&&i===bo.INACTIVE&&e.clearnSsrcWithMid(n,bo.RECVONLY)}}}),Object.defineProperty(t.prototype,"resetOfferSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Lo(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}}),Object.defineProperty(t.prototype,"resetAnswerSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new Lo(this._logger,e);for(var i in this._sendTransceiver){var n=this._sendTransceiver[i],o=n.mid;if(o){var a=this._localTracks[i],s=null==a?void 0:a.getBitrate(),c=null===(t=n.sender.track)||void 0===t?void 0:t.kind;c===Pe.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===Pe.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}),t}(Eo),No=function(e){function t(t,r,i,n,o,a,s,c){void 0===s&&(s=!1),void 0===c&&(c=!1);var u=e.call(this)||this;Object.defineProperty(u,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:s}),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=Eo.getSdpSemantics(),d="unified-plan"===l&&c&&Nt()&&ho.isInit(),_=u._rtcPeerConn=new RTCPeerConnection({sdpSemantics:l,encodedInsertableStreams:d});return u._sdpStrategy="plan-b"===l?new yo(t,u._logger,_,!1):new Po(t,u._logger,_,d),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 r(t,e),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.values(this.pubLocalTracks)}}),Object.defineProperty(t.prototype,"_decodeSeiData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=e.split(",").map((function(e){return Number(e)})),i=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])){if((i=t+(1===e[t+2]?3:4))>=e.length)break;if(6==(31&e[i])&&(o=Co(e,a=i+1)))return{payloadSize:o.payloadSize,content:o.content};t=i+1}else t++;else for(var r=0;r+4<=e.length;){var i,n=e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3];if(n<=0||r+4+n>e.length)break;if(6==(31&e[i=r+4])){var o,a=i+1;if(o=Co(e.subarray(a,r+4+n),0))return{payloadSize:o.payloadSize,content:o.content}}r+=4+n}return null}(new Uint8Array(r));if(null==i?void 0:i.content.length){var n=this._context.decodeAsrText(i.content,r);n.length&&this.emit(t.__INNER_SEI_CONTENT__,n)}}}),Object.defineProperty(t.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(n.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}}),Object.defineProperty(t.prototype,"startAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout((function(){t._reportHandle(),t.startAutoExecute(e)}),e)}}),Object.defineProperty(t.prototype,"stopAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reportStatsTimer)}}),Object.defineProperty(t.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r;return s(this,void 0,void 0,(function(){var i,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),[4,this._getStatsData()];case 1:a=c.sent(),s=a?this._createRCRTCStateReport(a).iceCandidatePair:null,this.emit(t.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:s}),"connected"===i?(this.emit(t.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==i&&"disconnected"!==i||this._handleRetry();try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===r||r.call(e,i)}catch(e){this._logger.error(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:o.FAILED,mag:e}))}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_handleRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t=this;return c(this,(function(r){switch(r.label){case 0:return this._inRetry?[2]:(this.clearReTryExchangeTimer(),this._inRetry=!0,[4,this._reTryExchange()]);case 1:return e=r.sent().code,this._inRetry=!1,e===exports.RCRTCCode.SUCCESS?[2]:(this._reTryExchangeTimer=setTimeout((function(){return t._handleRetry()}),15e3),[2])}}))}))}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var r=e.streams[0].id,i=e.receiver.track,n=[r,"audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");Object.defineProperty(i,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(n,e.transceiver),_t(n).tag!==zn&&this.emit(t.__INNER_EVENT_TRACK_READY__,e)}}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){return this._sdpStrategy.setBitrate(e,t,r),this._logger.info(n.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:o.SUCCESSED,max:e,min:t,start:r})),[2]}))}))}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return[4,this._sdpStrategy.createOffer(e)];case 1:return t=r.sent(),this._logger.info(n.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({offerSDP:t.sdp,sdpDemantics:t.semantics})),[2,t]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return void 0===t&&(t=!1),s(this,void 0,void 0,(function(){return c(this,(function(i){return go.parsePayloadTypes(null===(r=this._rtcPeerConn.localDescription)||void 0===r?void 0:r.sdp),this._firstConnectFromPub=t,[2,this._sdpStrategy.setRemoteAnswer(e)]}))}))}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.pubLocalTracks[e]||null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(n.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,"trackId: ".concat(e.getTrackId()))}}),Object.defineProperty(t.prototype,"removeLocalTrackById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:o.FAILED,msg:"track not found",trackId:e}))}}),Object.defineProperty(t.prototype,"removeAllLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach((function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=e.getTrackId();delete this.pubLocalTracks[r],this._sdpStrategy.removeLocalTrack(e,t),e.__innerSetPublished(!1),e.off(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var i="".concat(r,"_tiny"),o=this.getLocalTrack(i);o&&t&&(this._sdpStrategy.removeLocalTrack(o,t),delete this.pubLocalTracks[i],o.destroy()),this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:r}))}}),Object.defineProperty(t.prototype,"_updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}}),Object.defineProperty(t.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getOutboundVideoInfo()}}),Object.defineProperty(t.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&(r.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(We.__INNER_EVENT_MUTED_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.emit(We.__INNER_EVENT_DESTROY__,e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,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),a({},t)}))}}),Object.defineProperty(t.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,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),a({},t)}))}}),Object.defineProperty(t.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,i=e.senders,n=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)It(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(i),receivers:this._createReceiverReport(n)}}}),Object.defineProperty(t.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._rtcPeerConn.getStats()];case 1:return i=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(i),n=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=n,[2,n]}}))}))}}),Object.defineProperty(t.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,i,o,a;return s(this,void 0,void 0,(function(){var s,u,_,p;return c(this,(function(c){switch(c.label){case 0:return[4,this._getStatsData()];case 1:if(!(s=c.sent()))return[2];u=this._createRCRTCStateReport(s);try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onStateReport)||void 0===r||r.call(e,JSON.parse(JSON.stringify(u)))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(_=d(d([],l(s.receivers),!1),l(s.senders),!1).filter((function(e){return"audio"===e.kind})).map((function(e){return{trackId:e.trackId,audioLevel:e.audioLevel}})),this.emit(t.__INNER_AUDIOLEVEL_CHANGE__,_),this._isRoomAudience&&(null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)){p=this._getLiveAudioState();try{p.length&&(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onReportLiveAudioStates)||void 0===a||a.call(o,p))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_getLiveAudioState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this._rtcPeerConn.getReceivers().forEach((function(e){var r=e.getContributingSources();r.length&&t.push.apply(t,d([],l(r),!1))})),t.map((function(t){var r=t.source,i=t.audioLevel,n=e._store.getTrackIdBySSRC(r);if(!n)return{};var o=_t(n).userId;return{audioLevel:oo(i),userId:o,trackId:n}})).filter((function(e){return!!e.userId}))}}),Object.defineProperty(t.prototype,"_sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,i;return s(this,void 0,void 0,(function(){var n,o,a;return c(this,(function(s){switch(s.label){case 0:return(n=this._formatStatsData)?(o=n.senders,a=n.receivers,console.log("sendR3R4: senderTrackId: ".concat(null===(e=o[0])||void 0===e?void 0:e.trackId,", receiverTrackId: ").concat(null===(t=a[0])||void 0===t?void 0:t.trackId)),o.length?[4,null===(r=this._polarisReport)||void 0===r?void 0:r.sendR3Data(n)]:[3,2]):[2];case 1:s.sent(),s.label=2;case 2:return a.length?[4,null===(i=this._polarisReport)||void 0===i?void 0:i.sendR4Data(n)]:[3,4];case 3:s.sent(),s.label=4;case 4:return o.length=0,a.length=0,n=null,[2]}}))}))}}),Object.defineProperty(t.prototype,"__reportR3R4ToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return this._isDestroyed||(clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout((function(){return s(e,void 0,void 0,(function(){var e=this;return c(this,(function(t){return this._isDestroyed||this._sendR3R4Data().then((function(){e.__reportR3R4ToPolaris()})),[2]}))}))}),2e3)),[2]}))}))}}),Object.defineProperty(t.prototype,"getRTCPeerConn",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,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(n.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:o.SUCCESSED}))}}),Object.defineProperty(t.prototype,"clearReTryExchangeTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(t,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(t,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(t,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),Object.defineProperty(t,"__INNER_SEI_CONTENT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-sei-content"}),t}(e.EventEmitter),wo=function(){function e(e,t){Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"audioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(this._audioLevelChangeHandler){var r=[];e.forEach((function(e){var i=_t(e.trackId).userId,n=t._store.crtUserId===i?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);n&&r.push({track:n,audioLevel:e.audioLevel||0})})),this._audioLevelChangeHandler(r)}}}),Object.defineProperty(e.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioLevelChangeHandler=e}}),e}();exports.RCRTCLiveRole=void 0,(vo=exports.RCRTCLiveRole||(exports.RCRTCLiveRole={}))[vo.ANCHOR=1]="ANCHOR",vo[vo.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"}(To||(To={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}(Oo||(Oo={})),function(e){e[e.Destroy=40400]="Destroy"}(So||(So={}));var Do,ko=function(){function e(){}return Object.defineProperty(e.prototype,"priority",{get:function(){return Oo.LOW},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return To.UNKNOWN},enumerable:!1,configurable:!0}),e}(),Uo=function(){function t(e,t,r,i){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:i}),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})}return Object.defineProperty(t.prototype,"_next",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._busy=!1,this._execute()}}),Object.defineProperty(t.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t,r,i,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:if(this._isDestroyed||this._busy||0===this._queue.length)return[2];this._busy=!0,t=this._queue.shift(),r=t.command,i=t.resolve,a=this._logger.createTraceId(),c.label=1;case 1:return c.trys.push([1,3,,4]),this._logger.info(n.L_INVOKER_EXECUTE_T,"kind: ".concat(r.kind,", length: ").concat(this._queue.length),a),[4,r.execute(this._context,this._store,this)];case 2:return o=c.sent(),[3,4];case 3:return s=c.sent(),console.error(s),this._logger.error(n.L_INVOKER_EXECUTE_R,r.kind,a),this._next(),[2];case 4:return(u=o.code)!==exports.RCRTCCode.SUCCESS&&u!==e.ErrorCode.SUCCESS?this._logger.warn(n.L_INVOKER_EXECUTE_R,"code: ".concat(u,", kind: ").concat(r.kind),a):this._logger.info(n.L_INVOKER_EXECUTE_R,"kind: ".concat(r.kind,", Done"),a),i(o),this._next(),[2]}}))}))}}),Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,new Promise((function(r){if(t._logger.info(n.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:t._isDestroyed,kind:e.kind,length:t._queue.length})),t._isDestroyed)r({code:exports.RCRTCCode.NOT_IN_ROOM});else{var i=e.priority;if(i===Oo.LOW)t._queue.push({command:e,resolve:r});else{var o=t._queue.findIndex((function(e){return e.command.priority<i})),a=-1===o?t._queue.length-1:o;t._queue.splice(a,0,{command:e,resolve:r})}setTimeout((function(){t._execute()}),0)}}))]}))}))}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._isDestroyed||(this._logger.info(n.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach((function(t){t.resolve({code:e.abortCode})})),this._queue.length=0)}}),t}(),Mo=function(e){function t(t,r){return e.call(this,t.logger,t,r,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED)||this}return r(t,e),Object.defineProperty(t.prototype,"store",{get:function(){return this._context.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.destroy.call(this),this._store.removeRemoteTracks()}}),t}(Uo);!function(e){e.VOID="0",e.OPEN="2",e.CLOSE="1"}(Do||(Do={}));var xo,jo=function(){function e(e,t,r,i,n,o,a,s){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:s}),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:Do.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:""})}return Object.defineProperty(e.prototype,"getResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._roomResources[e]||this._asrSeiUris[e]}}),Object.defineProperty(e.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(e.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}}),Object.defineProperty(e.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteTracks}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(e.prototype,"getAllUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.keys(this._roomResources)}}),Object.defineProperty(e.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.getAllUserIds().filter((function(t){return t!==e.crtUserId}))}}),Object.defineProperty(e.prototype,"getSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subscribedList}}),Object.defineProperty(e.prototype,"getCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._collectSubscribeList}}),Object.defineProperty(e.prototype,"getPublishedResourceByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=_t(e),r=t.tag,i=t.userId;return r===zn?this._asrSeiUris[i][0]:this._roomResources[i].find((function(t){return dt(t)===e}))}}),Object.defineProperty(e.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._token}}),Object.defineProperty(e.prototype,"getCDNEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNEnable}}),Object.defineProperty(e.prototype,"getCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNUris}}),Object.defineProperty(e.prototype,"getRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomStatusVersion}}),Object.defineProperty(e.prototype,"getTrackIdBySSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._trackIdSSRCMap.get(e)}}),Object.defineProperty(e.prototype,"getRTCRequestHeader",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}}),Object.defineProperty(e.prototype,"getSupportNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._supportNtf}}),Object.defineProperty(e.prototype,"getASRIsAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this.getASRSeiUris().length}}),Object.defineProperty(e.prototype,"getASRStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._asrStatus}}),Object.defineProperty(e.prototype,"getASREnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._asrEnable}}),Object.defineProperty(e.prototype,"getSrcLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._srcLanguage}}),Object.defineProperty(e.prototype,"getASRSeiUris",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._asrSeiUris);return e.length?e[0]:[]}}),Object.defineProperty(e.prototype,"getIsStartRealTranslate",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isStartRealTranslate}}),Object.defineProperty(e.prototype,"getTranslationLang",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._translationLang}}),Object.defineProperty(e.prototype,"getSummarizationStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._summarizationStatusData||null}}),Object.defineProperty(e.prototype,"getNickName",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._nickName}}),e}(),Bo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.values(this._roomResources).forEach((function(t){t.forEach((function(t){var r=JSON.parse(t.uri),i=r.ssrc,n=r.resourceId;e._trackIdSSRCMap.set(i,n)}))}))}}),Object.defineProperty(t.prototype,"setTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._trackIdSSRCMap.set(e,t)}}),Object.defineProperty(t.prototype,"_initRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,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=dt(t),i=_t(r),n=i.tag,o=i.userId,a=i.mediaType===exports.RCMediaType.AUDIO_ONLY?new it(e._logger,n,o):new nt(e._logger,n,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[r]=a}))}}}),Object.defineProperty(t.prototype,"initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=Pt(e.version),this._roomResources=Lt(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(n.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}}),Object.defineProperty(t.prototype,"assignRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"setResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"removeRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"removeResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"addRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteTracks[e.getTrackId()]=e}}),Object.defineProperty(t.prototype,"removeRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}}),Object.defineProperty(t.prototype,"setCDNEnabel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._CDNEnable=e}}),Object.defineProperty(t.prototype,"setCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._CDNUris=e}}),Object.defineProperty(t.prototype,"resetSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._subscribedList).splice.apply(t,d([0,this._subscribedList.length],l(e),!1)),this.resetCollectSubscribeList(e)}}),Object.defineProperty(t.prototype,"resetCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,d([0,this._collectSubscribeList.length],l(e),!1))}}),Object.defineProperty(t.prototype,"setRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._roomStatusVersion=Pt(e)}}),Object.defineProperty(t.prototype,"setASRStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._asrStatus=e}}),Object.defineProperty(t.prototype,"setASREnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._asrEnable=e}}),Object.defineProperty(t.prototype,"setSrcLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._srcLanguage=e}}),Object.defineProperty(t.prototype,"setASRSeiUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.length){var t=e[0].msid.split("_")[0];this._asrSeiUris[t]=e}else this._asrSeiUris={}}}),Object.defineProperty(t.prototype,"addSeiRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e[0].msid.split("_"),r=t.pop(),i=t[0],n=new nt(this._logger,r,i);this.addRemoteTrack(n)}}),Object.defineProperty(t.prototype,"removeSeiRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.getASRSeiUris().length){var e=this.getASRSeiUris()[0],t=e.msid,r=e.mediaType,i="".concat(t,"_").concat(r);this.removeRemoteTrack(i)}}}),Object.defineProperty(t.prototype,"setIsStartRealTranslate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isStartRealTranslate=e}}),Object.defineProperty(t.prototype,"setTranslationLang",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._translationLang=e}}),Object.defineProperty(t.prototype,"setSummarizationStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._summarizationStatusData=e}}),Object.defineProperty(t.prototype,"setNickName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._nickName=e}}),t}(jo),Vo=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.UNPUBLISH_PREV},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return i=t.logger,a=t.context,s=r.getResourcesByUserId(r.crtUserId),u=s.slice(),s.length=0,l=i.createTraceId(),i.info(n.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:u}),l),[4,a.setRTCTotalRes(r.roomId,[ot(St.UNPUBLISH,u)],at([]),St.TOTAL_CONTENT_RESOURCE,at([]))];case 1:return(d=c.sent())!==e.ErrorCode.SUCCESS?i.error(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:o.FAILED,code:d}),l):i.info(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:o.SUCCESSED}),l),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(ko);exports.RTCMode=void 0,(xo=exports.RTCMode||(exports.RTCMode={}))[xo.RTC=0]="RTC",xo[xo.LIVE=2]="LIVE",xo[xo.CROSS_MUTI=7]="CROSS_MUTI",xo[xo.SIP=4]="SIP",xo[xo.CALL=5]="CALL";var Fo,Jo=function(t){function i(e,r,i,n,o,a,s,c,u){var l=t.call(this)||this;return Object.defineProperty(l,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(l,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(l,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(l,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(l,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(l,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(l,"srcLanguage",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(l,"nickName",{enumerable:!0,configurable:!0,writable:!0,value:u}),l}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.JOINROOM},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_getResultTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=n.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===exports.RTCMode.LIVE&&(e=n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}}),Object.defineProperty(i.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n=this;if(t.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(yt(t.getNaviInfo()))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),this.traceId),{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR};if(!e.validate("roomId",this.roomId,e.notEmptyString,!0))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("roomType",this.roomType,(function(e){return void 0!==exports.RTCMode[e]})))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("outerUserDatas",this.outerUserDatas,e.isObject,!1))return r.error(i,JSON.stringify({status:o.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(t){return e.validate("outerUserDatas.".concat(t),n.outerUserDatas[t],e.isString,!0)})))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.nickName&&(!e.validate("nickName",this.nickName,e.isString,!0)||this.nickName.length>64))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> nickName"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.srcLanguage&&(!e.validate("srcLanguage",this.srcLanguage,e.isString,!0)||this.srcLanguage.length>50))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> srcLanguage"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n,a,u,l;return s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I;return c(this,(function(c){switch(c.label){case 0:return s=Date.now(),d=t.context,_=t.service,p=t.logger,f=t.reportMediaActionLogger,h=this._getResultTag(),(R=this._validateParams(d,p,h).code)!==exports.RCRTCCode.SUCCESS?[2,{code:R}]:_.getMsList().length?(b=r.getSupportNtf(),[4,d.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,b)]):(p.error(h,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]);case 1:return g=c.sent(),m=g.code,C=g.data,f.reportQualityJoinRoomData(s,m,this.roomType,null==C?void 0:C.sessionId),m===e.ErrorCode.SUCCESS&&C?(r.initWithRoomData(C,this.traceId),this.nickName&&r.setNickName(this.nickName),this.srcLanguage&&r.setSrcLanguage(this.srcLanguage),r.getResourcesByUserId(r.crtUserId).length>0&&i.push(new Vo),(T=null===(n=C.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&r.setCDNUris(JSON.parse(T)[0]),(O=null===(a=C.roomInfo.filter((function(e){return"asr_status"===e.key}))[0])||void 0===a?void 0:a.value)&&r.setASRStatus(O),(S=null===(u=C.roomInfo.filter((function(e){return"sei_ai_uris"===e.key}))[0])||void 0===u?void 0:u.value)&&(I=JSON.parse(S)).length&&(r.setASRSeiUris(I),r.addSeiRemoteTrack(I)),(E=null===(l=C.roomInfo.filter((function(e){return"summarization"===e.key}))[0])||void 0===l?void 0:l.value)&&(I=JSON.parse(E),r.setSummarizationStatusData(I)),p.info(h,JSON.stringify({status:o.SUCCESSED,userId:r.crtUserId,roomId:this.roomId,sessionId:C.sessionId}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS,data:C}]):(v=40032===m?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:m,p.error(h,JSON.stringify({status:o.FAILED,code:v,msg:"joinRoom failed"}),this.traceId),[2,{code:v}])}}))}))}}),i}(ko);!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Fo||(Fo={}));var Go,Ho,Ko,Wo="PEER_CONNECTION_CLOSED_BY_EXCEPTION",zo="USER_JOIN",Yo="USER_LEAVE",qo="TRACKS_PUBLISH",Zo="TRACKS_UNPUBLISH",Qo="AUDIO_MUTE_CHANGE",Xo="VIDEO_MUTE_CHANGE",$o="CDN_ENABLE_CHANGE",ea="USER_STATE_CHANGE",ta="ASR_SEI_PUBLISH",ra="ASR_SEI_UNPUBLISH",ia="SUMMARIZATION_START",na="SUMMARIZATION_STOP",oa=function(e){function t(t,r,i,n,o,a,s,c){var u=e.call(this)||this;return Object.defineProperty(u,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"service",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"context",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"peer",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"store",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"getPushOtherRooms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u}return r(t,e),t}(e.EventEmitter);!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(Go||(Go={})),function(e){e.BEGIN="begin",e.END="end"}(Ho||(Ho={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(Ko||(Ko={}));var aa,sa=function(e){function t(t,r,i){var n=e.call(this)||this;return Object.defineProperty(n,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;return s(this,void 0,void 0,(function(){var r,n,o,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return r=e.service,n=e.context,[4,r.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas)];case 1:return o=c.sent(),s=o.code,u=o.data,l=o.qualityMsList,d={code:s,data:{data:u,qualityMsList:l}},_=null===(i=null==u?void 0:u.urls)||void 0===i?void 0:i.pull_url,t.roomMode===exports.RTCMode.LIVE&&_&&(p=JSON.parse(_),t.setCDNUris(p),(null==p?void 0:p.broadcast)===Ko.SPREAD&&(t.setCDNEnabel(!0),f=a(a({},p),{enableInnerCDN:!0}),pa(n,t.roomId,f))),[2,d]}}))}))}}),t}(ko);!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(aa||(aa={}));var ca=function(t){function i(e,r,i,n,o){void 0===n&&(n=aa.SUB);var a=t.call(this)||this;return Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:o}),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 r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.UPDATE_SUBSCRIBE_LIST},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var a=null==i?void 0:i.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),s=r.filter((function(e){return null==a?void 0:a.includes(e.track.getTrackId())})),c=r.filter((function(e){return!(null==a?void 0:a.includes(e.track.getTrackId()))}));t.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,subSuccessTrackIds:a,failedList:c}),this.traceId);var u=e.getRemoteTracks(),l=function(e){var t=s.some((function(t){return t.track.getTrackId()===e}));u[e].__innerSetSubscribed(t);var r=s.some((function(t){return t.track.getTrackId()===e&&t.subTiny}));u[e].isVideoTrack()&&u[e].__innerSetIsTinyTrack(r)};for(var d in u)l(d);return e.resetSubscribedList(s),c}}),Object.defineProperty(i.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,o=r.map((function(e){return e instanceof rt?{track:e}:a({},e)})),s={};return o=o.filter((function(r){var o=r.track.getTrackId();return e.getRemoteTrack(o)?!s[o]&&(s[o]=!0,!0):(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(o),i.traceId),!1)})).map((function(e){return a({},e)}))}}),Object.defineProperty(i.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.validate("tracks",r,(function(){return e.isArray(r)&&r.every((function(e){return e instanceof rt||e.track instanceof rt}))}),!0)?{code:exports.RCRTCCode.SUCCESS}:(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}}),Object.defineProperty(i.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){(null==r?void 0:r.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,r,t,this._trackMediaMap)}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A=this;return c(this,(function(c){switch(c.label){case 0:if(i=e.logger,s=e.peer,u=e.reportMediaActionLogger,l=e.context,this._actionStartTime=Date.now(),_=(d=this).tracks,p=d.forceReq,f=t.roomId,i.info(n.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(f,", forceReq: ").concat(p,", trackIds: ").concat(_.map(At)),this.traceId),(h=this._validateParams(i,_).code)!==exports.RCRTCCode.SUCCESS)return[2,{code:h}];if(R=this._getParams(t,i,_),b=t.getSubscribedList().map((function(e){return a({},e)})),!p){if(!Ca(R,b))return i.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}];b.length&&(g=b.map((function(e){return e.track})),i.warn(n.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:g.map((function(e){return e.getTrackId()}))}),this.traceId),m=t.getSubscribedList().filter((function(e){return g.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),t.resetSubscribedList(m))}return s.__reportR3R4ToPolaris(),s.clearReTryExchangeTimer(),s.updateSubRemoteTracks(R.map((function(e){return e.track}))),[4,da(R,!1,s,t,l)];case 1:return(C=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new sa(C,this.traceId,!0).execute(e,t,r)];case 2:return v=c.sent(),_.forEach((function(e){var t=e instanceof rt?e.getTrackId():e.track.getTrackId();A._trackMediaMap[t]=v.data.qualityMsList||[]})),T=this.fromCommand===aa.SUB?_:this.unsubTracks,v.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(u,v.code,T),i.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:v.code}),this.traceId),[2,{code:v.code}]):(O=v.data.data,S=O.sdp,E=O.resultCode,I=O.subscribedList,E!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(u,E,T),i.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:E}),this.traceId),[2,{code:E}]):(u.setPubOrSubSuccessTime(Date.now()),[4,s.setRemoteAnswer(S.sdp)]));case 3:return y=c.sent(),this._reportPubOrSubQualityData(u,y,T),y!==exports.RCRTCCode.SUCCESS?[2,{code:y}]:[2,(L=this._dealSubscribeResult(t,i,R,I)).length?{code:exports.RCRTCCode.SUCCESS,data:L}:{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(ko),ua=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.UNSUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d;return c(this,(function(c){return s=t.logger,u=t.polarisReport,l=this.tracks,e.validate("tracks",l,(function(){return e.isArray(l)&&l.length>0&&l.every((function(e){return e instanceof rt}))}),!0)?(s.info(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:l.map(At)}),this.traceId),d=r.getSubscribedList().map((function(e){return a({},e)})).filter((function(e){return l.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),u.sendR2(Go.SUBSCRIBE,Ho.END,l.map((function(e){return e.getTrackId()}))),[2,new ca(d,!1,this.traceId,aa.UNSUB,this.tracks).execute(t,r,i)]):(s.warn(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),i}(ko),la=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a;return c(this,(function(s){switch(s.label){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(n.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),[4,new ua(o,a).execute(e,t,r)];case 1:return s.sent(),o.forEach((function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())})),e.emit(Zo,o),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(ko);function da(e,t,r,i,n){var o;return s(this,void 0,void 0,(function(){var a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return a=(null===(o=n.getNaviInfo())||void 0===o?void 0:o.ipType)||0,[4,r.createOffer(t)];case 1:return s=c.sent(),u=i.getSrcLanguage(),l=i.getNickName(),d={resolutionInfo:r.getOutboundVideoInfo()},u&&Object.assign(d,{srcLanguage:u}),l&&Object.assign(d,{nickName:l}),[2,{asr_status:i.getASRStatus(),ipType:a,sdp:s,extend:JSON.stringify(d),subscribeList:e.filter((function(e){var t=e.track.getTrackId(),r=_t(t).userId,n=i.getResourcesByUserId(r);if(!n)return!1;var o=n.filter((function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)})).length;return o})).map((function(e){return{simulcast:e.subTiny?$n.TINY:$n.NORMAL,resolution:"",uri:i.getPublishedResourceByTrackId(e.track.getTrackId()).uri}})),switchstream:!1}]}}))}))}function _a(t,r,i){return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=t.logger.createTraceId(),t.logger.info(n.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:i}),a),[4,t.setRTCCDNUris(r,St.TOTAL_CONTENT_RESOURCE,JSON.stringify([i]))];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(t.logger.error(n.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(o.FAILED,", code: ").concat(s),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(t.logger.info(n.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(o.SUCCESSED),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}function pa(t,r,i){return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=t.logger.createTraceId(),t.logger.info(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(i),a),[4,t.setRTCData(r,"cdn_uris",JSON.stringify([i]),!0,Fo.ROOM)];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(t.logger.error(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(o.FAILED,", code: ").concat(s),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(t.logger.info(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(o.SUCCESSED),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}function fa(e,t){return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return r=t.roomId,i=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),[4,Promise.all([_a(e,r,i),pa(e,r,i)])];case 1:return n=o.sent(),[2,n.every((function(e){return e.code===exports.RCRTCCode.SUCCESS}))?{code:exports.RCRTCCode.SUCCESS}:{code:exports.RCRTCCode.SIGNAL_ERROR}]}}))}))}var ha=function(e,t,r,i){return s(void 0,void 0,void 0,(function(){var n,o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:for(a in n=e.crtUserId,o=[],i)o.push(a);s=0,c.label=1;case 1:return s<o.length?(u=o[s])===n?[3,3]:(l=i[u]).length?(d=l.map((function(t){return e.getRemoteTrack(dt(t))})),[4,new la(d).execute(t,e,r)]):[3,3]:[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}}))}))};function Ra(t,r,i,a,u,l){return s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L;return c(this,(function(c){switch(c.label){case 0:for(s=i.logger,d=r.roomId,_=r.roomMode,p=[],f={},h={},R={},b=Lt(t,d,s,l),g=Object.keys(b),m=r.getAllUserIds(),C=g.length-1;C>=0;C-=1)v=g[C],-1!==(T=m.indexOf(v))?(O=r.getResourcesByUserId(v),S=b[v],E=ht(O,S,!0),I=E.publishedList,y=E.modifiedList,L=E.unpublishedList,f[v]=ft(I),h[v]=ft(L),R[v]=ft(y),m.splice(T,1)):(p.push(v),f[v]=ft(b[v]));return m.length&&m.forEach((function(e){r.removeResourcesByUserId(e)})),r.assignRoomData(b),m.length?[4,ba(m,i,r,a,l)]:[3,2];case 1:c.sent(),i.emit(Yo,m),c.label=2;case 2:return p.length&&i.emit(zo,p),[4,ha(r,i,a,h)];case 3:return c.sent(),function(e,t,r){var i=t.logger;Object.keys(r).forEach((function(n){var o=r[n];if(0!==o.length){var a=o.map((function(t){var r=dt(t),n=_t(r),o=n.userId,a=n.tag,s=n.mediaType===exports.RCMediaType.AUDIO_ONLY?new it(i,a,o):new nt(i,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s}));a.length&&t.emit(qo,a)}}))}(r,i,f),function(e,t,r){Object.keys(r).forEach((function(i){r[i].forEach((function(r){var i=dt(r),n=e.getRemoteTrack(i);n.__innerSetRemoteMuted(0===r.state),n.isAudioTrack()?t.emit(Qo,n):t.emit(Xo,n)}))}))}(r,i,R),_===e.RTCMode.LIVE&&function(e,t,r,i){var a;if(!i)return void r.warn(n.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:o.FAILED,code:"",msg:"cdn_uris not found"}));var s=JSON.parse(i),c=(null===(a=t.getCDNUris())||void 0===a?void 0:a.enableInnerCDN)!==s.enableInnerCDN;t.setCDNUris(s),c&&e.emit($o,s.enableInnerCDN)}(i,r,s,u),[2]}}))}))}function ba(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o,a;return c(this,(function(s){switch(s.label){case 0:return o=[],a=[],e.forEach((function(e){o.push.apply(o,d([],l(r.getRemoteTracksByUserId(e)),!1)),a.push(e)})),o.length?[4,new ua(o,n).execute(t,r,i)]:[3,2];case 1:s.sent(),o.forEach((function(e){return r.removeRemoteTrack(e.getTrackId())})),s.label=2;case 2:return a.length&&a.forEach((function(e){return r.removeResourcesByUserId(e)})),[2]}}))}))}var ga,ma=function(e,t,r){var i=e.split("\r\nm"),n=r===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=i.filter((function(e){return e.includes("=".concat(n))&&e.includes(t)}))[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},Ca=function(e,t){var r=!1;return e.forEach((function(e){var i=t.findIndex((function(t){return t.track.getTrackId()===e.track.getTrackId()}));-1!==i?t.splice(i,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0})),t.length&&(r=!0),r},va=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return To.PARSE_USERSTATE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oo.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isPKRoomUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(a.extra&&a.extra.roomId!==e.roomId)return!0;if(1===Number(a.state)&&!e.getRemoteUserIds().includes(a.userId))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1}}),Object.defineProperty(t.prototype,"_dealAddUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o){var a=e.getResourcesByUserId(o);a||(i?r.upgrade.push(o):r.joined.push(o),t.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:o,msg:"user ".concat(i?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(o,a||[])}}),Object.defineProperty(t.prototype,"_dealReduceUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o){e.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:o,msg:"user ".concat(i?"downgrade":"left")}),this.traceId),i?t.downgrade.push(o):1!==Number(r)?t.offline.push(o):t.left.push(o)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,n={joined:[],left:[],offline:[],upgrade:[],downgrade:[]},0===(o=this.msgContent.users).length?[2,{code:exports.RCRTCCode.SUCCESS,data:n}]:this._isPKRoomUser(t,o)?[2,{code:exports.RCRTCCode.SUCCESS,data:n}]:(o.forEach((function(e){var r=e.userId;0===Number(e.state)?s._dealAddUser(t,i,n,e.switchRoleType,r):s._dealReduceUser(i,n,e.state,e.switchRoleType,r)})),(a=d(d(d([],l(n.left),!1),l(n.downgrade),!1),l(n.offline),!1)).length?[4,ba(a,e,t,r,this.traceId)]:[3,2]);case 1:c.sent(),c.label=2;case 2:return[2,{code:exports.RCRTCCode.SUCCESS,data:n}]}}))}))}}),t}(ko),Ta=function(e){function t(t,r,i,n,o){var a=e.call(this)||this;return Object.defineProperty(a,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return To.PARSE_REMOTERES},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return Oo.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealPublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p=this;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,a=e.reportMediaActionLogger,s=this._nowResources.map(dt),u=[],l=[],this._publishedList.forEach((function(e){var r=dt(e),n=s.indexOf(r),o=_t(r),a=o.userId,c=o.tag,d=o.mediaType;n>-1?p._nowResources[n]=e:p._nowResources.push(e);var _=t.getRemoteTrack(r);_?_.isSubscribed()&&u.push(_):(_=d===exports.RCMediaType.AUDIO_ONLY?new it(i,c,a):new nt(i,c,a),t.addRemoteTrack(_),l.push(_)),_.__innerSetRemoteMuted(0===e.state)})),u.length?(d=u.map((function(e){return e.getTrackId()})),[4,new ca(u,!0,this.traceId).execute(e,t,r)]):[3,2];case 1:(_=c.sent().code)!==exports.RCRTCCode.SUCCESS&&i.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:o.FAILED,trackIds:d,code:_}),this.traceId),c.label=2;case 2:return l.length&&e.emit(qo,l),a.reportQualityRecvPubMsgData(this.sentTime,this.senderId),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a;return c(this,(function(s){switch(s.label){case 0:for(i=this._unpublishedList.map(dt),n=this._nowResources.length-1;n>=0;n-=1)o=this._nowResources[n],i.includes(dt(o))&&this._nowResources.splice(n,1);return a=this._unpublishedList.map((function(e){var r=dt(e);return t.getRemoteTrack(r)})),[4,new la(a).execute(e,t,r)];case 1:return s.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModifiedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s,l,d,_;return c(this,(function(c){r=this._nowResources.map(dt);try{for(i=u(this._modifiedList),n=i.next();!n.done;n=i.next())o=n.value,a=dt(o),s=r.indexOf(a),this._nowResources[s].state=o.state,(l=t.getRemoteTrack(a)).__innerSetRemoteMuted(0===o.state),l.isAudioTrack()?e.emit(Qo,l):e.emit(Xo,l)}catch(e){d={error:e}}finally{try{n&&!n.done&&(_=i.return)&&_.call(i)}finally{if(d)throw d.error}}return[2]}))}))}}),Object.defineProperty(t.prototype,"_updateCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n=this.msgContent.cdn_uris[0],o=(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN)!==n.enableInnerCDN;t.setCDNUris(n),o&&e.emit($o,!!(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s,u,_,p,f,h;return c(this,(function(c){switch(c.label){case 0:if(i=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],o=this.senderId,a=this.messageType,!t.getRemoteUserIds().includes(o))return[2,{code:exports.RCRTCCode.SUCCESS}];switch(this._nowResources=t.getResourcesByUserId(o)||[],a){case St.MODIFY:(s=this._modifiedList).push.apply(s,d([],l(i),!1));break;case St.PUBLISH:(u=this._publishedList).push.apply(u,d([],l(i),!1));break;case St.UNPUBLISH:(_=this._unpublishedList).push.apply(_,d([],l(i),!1));break;case St.TOTAL_CONTENT_RESOURCE:n=ht(this._nowResources,i),(p=this._publishedList).push.apply(p,d([],l(n.publishedList),!1)),(f=this._unpublishedList).push.apply(f,d([],l(n.unpublishedList),!1)),(h=this._modifiedList).push.apply(h,d([],l(n.modifiedList),!1))}return this._publishedList.length?[4,this._dealPublishList(e,t,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return this._unpublishedList.length?[4,this._dealUnpublishList(e,t,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return this._modifiedList.length?[4,this._dealModifiedList(e,t)]:[3,6];case 5:c.sent(),c.label=6;case 6:return t.setResourcesByUserId(o,this._nowResources),t.roomMode!==exports.RTCMode.LIVE?[2,{code:exports.RCRTCCode.SUCCESS}]:this.msgContent.cdn_uris?(this._updateCDNUris(e,t),[2,{code:exports.RCRTCCode.SUCCESS}]):[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(ko),Oa=function(t){function i(e,r,i){var n=t.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R;return c(this,(function(c){return s=t.logger,u=t.polarisReport,d=(l=this).tracks,_=l.forceReq,e.validate("tracks",d,(function(){return e.isArray(d)&&d.length>0&&d.every((function(e){return e instanceof rt||e.track instanceof rt}))}),!0)?(s.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:d.map(At),forceReq:_}),this.traceId),p=r.getSubscribedList().map((function(e){return a({},e)})),f=d.map((function(e){return e instanceof rt?{track:e}:e})),h=!1,R=[],f.forEach((function(e){var t=e.track.getTrackId();R.push(t);var r=p.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:p.push(e),h=!0)})),h||_?(u.sendR2(Go.SUBSCRIBE,Ho.BEGIN,R),[2,new ca(p,!0,this.traceId).execute(t,r,i)]):(s.warn(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,msg:"repeat subscribe"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}])):(s.error(n.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),i}(ko),Sa=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.PUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.forEach((function(e){var r=e instanceof We?e:e.track;t.removeLocalTrackById(r.getTrackId())}))}}),Object.defineProperty(i.prototype,"_addLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o,a,s,l,d,_,p,f,h,R,b,g,m,C,v,T,O;return c(this,(function(c){switch(c.label){case 0:r=[],c.label=1;case 1:c.trys.push([1,10,11,12]),i=u(e),o=i.next(),c.label=2;case 2:if(o.done)return[3,9];if(a=o.value,l=(s=a instanceof We?{pubTiny:!1,track:a}:a).track,d=s.pubTiny,!l.isVideoTrack())return[3,7];if(!d)return[3,7];_=void 0,c.label=3;case 3:return c.trys.push([3,5,,6]),_=l.__innerGetMediaStreamTrack().clone(),p=d.frameRate||exports.RCFrameRate.FPS_15,f=d.resolution||exports.RCResolution.W176_H144,h=bt(f),R=h.width,b=h.height,g=Ct(p),[4,_.applyConstraints({width:R,height:b,frameRate:g})];case 4:return c.sent(),[3,6];case 5:return m=c.sent(),null==_||_.stop(),this._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(l.getTrackId(),", msg: ").concat(m.message),this._traceId),[3,9];case 6:return C=new Ye(this._logger,l.getTag(),l.getUserId(),_,!0),r.push(C),t.addLocalTrack(C),[3,7];case 7:t.addLocalTrack(l),c.label=8;case 8:return o=i.next(),[3,2];case 9:return[3,12];case 10:return v=c.sent(),T={error:v},[3,12];case 11:try{o&&!o.done&&(O=i.return)&&O.call(i)}finally{if(T)throw T.error}return[7];case 12:return[2,r]}}))}))}}),Object.defineProperty(i.prototype,"__publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b,g,m,C=this;return c(this,(function(c){switch(c.label){case 0:return s=e.peer,u=e.reportMediaActionLogger,l=e.context,t.roomId,d=[],r.forEach((function(e){var t=(e instanceof We?{track:e}:e).track;d.push(t)})),r.sort((function(e,t){return(e instanceof We?{track:e}:e).track.getBitrate().max-(t instanceof We?{track:t}:t).track.getBitrate().max})),s.getLocalTracks().length+function(e,t){var r=0;return e.forEach((function(e){var i=e instanceof We?e.getTrackId():e.track.getTrackId();t.getLocalTrack(i)||(e instanceof We?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))})),r}(r,s)>10?(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(At),msg:"publish track limit exceeded"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:d}]):[4,this._addLocalTracks(r,s)];case 1:return _=c.sent(),s.clearReTryExchangeTimer(),[4,da(t.getSubscribedList(),!1,s,t,l)];case 2:return(p=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new sa(p,this._traceId,!0).execute(e,t,i)];case 3:return f=c.sent(),d.forEach((function(e){var t=e.getTrackId();C._trackMediaMap[t]=f.data.qualityMsList||[]})),f.code!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(aa.PUB,this._actionStartTime,d,f.code,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,tracks:r.map(At),code:f.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,s),[2,{code:f.code,tracks:d}]):(h=f.data.data,R=h.sdp,b=h.resultCode,g=h.message,b!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(aa.PUB,this._actionStartTime,d,b,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,trackIds:r.map(At),code:b,msg:"exchange inner failed: ".concat(g)}),this._traceId),this._removePubFailedTracks(r,s),[2,{code:b,tracks:d}]):(u.setPubOrSubSuccessTime(Date.now()),[4,s.setRemoteAnswer(R.sdp,!0)]));case 4:return(m=c.sent())!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(aa.PUB,this._actionStartTime,d,m,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,trackIds:r.map(At),code:m,msg:"set remote answer error"}),this._traceId),[2,{code:m,tracks:d}]):(_.length&&this._updateTinyTrackIdSSRCMap(t,p.sdp.sdp,_),[2,a(a({code:b},f.data),{tracks:d})])}}))}))}}),Object.defineProperty(i.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var i=ma(t,r.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(i),r.getTrackId())}))}}),Object.defineProperty(i.prototype,"_dealPublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A,P,N,w;return c(this,(function(c){switch(c.label){case 0:return s=i.polarisReport,u=i.context,_=i.peer,p=i.reportMediaActionLogger,f=r.crtUserId,h=r.roomId,R="",b=r.getResourcesByUserId(f),g=d([],l(b),!1),[],C=t.tracks,t.code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(v=t.data,T=v.publishList,O=v.urls,S=v.mcuPublishList,R=null==O?void 0:O.liveUrl,T.map((function(e){return a({tag:e.msid.split("_").pop(),state:_.getLocalTrack(dt(e)).isLocalMuted()?0:1},e)})).forEach((function(e){var t=function(e,t){for(var r=!1,i=0,n=0;n<t.length;n++){var o=t[n];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){r=!0,i=n;break}}return{isInclude:r,index:i}}(e,g),r=t.isInclude,i=t.index;r?g.splice(i,1,e):g.push(e)})),E=(null==S?void 0:S.map((function(e){return a({tag:e.msid.split("_").pop(),state:1},e)})))||[],m=E,I=ht(b,g).publishedList,y=a(a({},r.getCDNUris()),{enableInnerCDN:r.getCDNEnable()}),L=y&&y.broadcast===Ko.SPREAD?JSON.stringify([y]):"",A=Date.now(),[4,u.setRTCTotalRes(h,[ot(St.PUBLISH,I)],at(g),St.TOTAL_CONTENT_RESOURCE,at(m),L)]);case 1:return P=c.sent(),p.reportPubOrSubQualityData(aa.PUB,this._actionStartTime,C,P,this._trackMediaMap,[{dur:Date.now()-A,cod:P}]),P!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:P,msg:"send publish streams notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(r.setResourcesByUserId(f,g),N=I.map((function(e){return dt(e)})),s.sendR2(Go.PUBLISH,Ho.BEGIN,N),I.forEach((function(e){_.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),w={code:exports.RCRTCCode.SUCCESS},R&&(w.liveUrl=R),[2,w])}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=t.peer,this._traceId=a.createTraceId(),this._logger=a,this._actionStartTime=Date.now(),u=this.tracks,e.validate("tracks",u,(function(){return e.isArray(u)&&u.length>0&&u.every((function(e){return e instanceof We||e.track instanceof We}))}),!0)?(this._logger.info(n.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:u.map(At)})),(u=u.filter((function(e){var t=(e instanceof We?{track:e}:e).track,r=t.isDestroyed();return r&&d._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),d._traceId),!r}))).length?(s.__reportR3R4ToPolaris(),s.clearReTryExchangeTimer(),[4,this.__publish(t,r,u,i)]):(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID}])):(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=c.sent(),[4,this._dealPublishRes(l,r,t)];case 2:return[2,c.sent()]}}))}))}}),i}(ko),Ea=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.UNPUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"__unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b,g,m,C=this;return c(this,(function(c){switch(c.label){case 0:return s=e.peer,u=e.polarisReport,l=e.logger,d=e.reportMediaActionLogger,_=e.context,p=i.map((function(e){return e.getTrackId()})),0===p.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})).length?[2,{code:exports.RCRTCCode.SUCCESS,tracks:i}]:(p.forEach((function(e){return s.removeLocalTrackById(e)})),u.sendR2(Go.PUBLISH,Ho.END,p),s.clearReTryExchangeTimer(),[4,da(t.getSubscribedList(),!1,s,t,_)]);case 1:return f=c.sent(),(h=e.getPushOtherRooms()).length&&(f.pushOtherRooms=h),[4,new sa(f,this._traceId,!0).execute(e,t,r)];case 2:return R=c.sent(),i.forEach((function(e){var t=e.getTrackId();C._trackMediaMap[t]=R.data.qualityMsList||[]})),R.code!==exports.RCRTCCode.SUCCESS?(d.reportPubOrSubQualityData(aa.UNPUB,this._actionStartTime,i,R.code,this._trackMediaMap),l.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:o.FAILED,code:R.code,trackIds:i.map(At),msg:"exchange failed"}),this._traceId),[2,{code:R.code,tracks:i}]):(b=R.data.data,g=b.resultCode,m=b.message,g!==exports.RCRTCCode.SUCCESS?(d.reportPubOrSubQualityData(aa.UNPUB,this._actionStartTime,i,R.data.data.resultCode,this._trackMediaMap),l.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:o.FAILED,code:g,trackIds:i.map(At),msg:"exchange inner failed: ".concat(m)}),this._traceId),[2,{code:g,tracks:i}]):[2,a(a({code:R.code},R.data),{tracks:i})])}}))}))}}),Object.defineProperty(i.prototype,"_dealUnpublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A;return c(this,(function(c){switch(c.label){case 0:return s=t.context,u=t.logger,_=t.peer,p=t.reportMediaActionLogger,f=s.getCurrentId(),h=r.roomId,R=[],[],g=i.tracks,m=i.code,C=i.data,m!==exports.RCRTCCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:m,msg:"unpublish failed"}),this._traceId),[2,{code:m}]):C?(v=C.mcuPublishList,T=g.map((function(e){return e.getTrackId()})),O=T.map(r.getPublishedResourceByTrackId.bind(r)).filter((function(e){return!!e})),R.push.apply(R,d([],l(O),!1)),S=v?v.map((function(e){return a({tag:e.msid.split("_").pop(),state:1},e)})):[],b=S,E=r.getResourcesByUserId(f),I=E.filter((function(e){return!R.includes(e)})),y=Date.now(),[4,s.setRTCTotalRes(h,[ot(St.UNPUBLISH,R)],at(I),St.TOTAL_CONTENT_RESOURCE,at(b))]):(u.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.SUCCESSED,msg:"unpublish list is empty "})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return L=c.sent(),p.reportPubOrSubQualityData(aa.UNPUB,this._actionStartTime,g,L,this._trackMediaMap,[{dur:Date.now()-y,cod:L}]),L!==e.ErrorCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.FAILED,code:L,msg:"send unpublish notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(u.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.SUCCESSED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:T}),this._traceId),A=i.data.sdp,[4,_.setRemoteAnswer(A.sdp)]);case 2:return c.sent(),r.setResourcesByUserId(f,I),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,this._actionStartTime=Date.now(),s=r.crtUserId,u=this.tracks,this._traceId=a.createTraceId(),e.validate("tracks",u,(function(){return u.every((function(e){return e.getUserId()===s&&e instanceof We}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:u.map(At)})),[4,this.__unpublish(t,r,i,u)]):(a.error(n.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=c.sent(),[4,this._dealUnpublishRes(t,r,l)];case 2:return[2,c.sent()]}}))}))}}),i}(ko),Ia=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.LOCAL_TRACK_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,a,s,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S;return c(this,(function(c){switch(c.label){case 0:i=t.logger,a=t.context,s=this.localTrack,l=s.getTrackId(),d=r.crtUserId,_=r.roomId,p=!s.isLocalMuted(),f=i.createTraceId(),i.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:p,trackId:this.localTrack.getTrackId()}),f),h=[{resourceId:l,enabled:p}],R=r.getResourcesByUserId(d),b=[],g=function(e){var t=dt(e),r=h.findIndex((function(e){return e.resourceId===t}));if(r>=0){var i=h[r].enabled;return e.state=i?1:0,b.push(e),"break"}};try{for(m=u(R),C=m.next();!C.done&&(v=C.value,"break"!==g(v));C=m.next());}catch(e){O={error:e}}finally{try{C&&!C.done&&(S=m.return)&&S.call(m)}finally{if(O)throw O.error}}return[4,a.setRTCTotalRes(_,[ot(St.MODIFY,b)],at(R),St.TOTAL_CONTENT_RESOURCE)];case 1:return(T=c.sent())!==e.ErrorCode.SUCCESS?(i.error(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:o.FAILED,code:T,msg:"signal error"}),f),[2,{code:T}]):(i.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:o.SUCCESSED}),f),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),i}(ko),ya=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.RETRY_EXCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return Oo.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f,h,R,b,g,m;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,o=e.peer,a=e.context,s=i.createTraceId(),i.info(n.L_RETRY_EXCHANGE_COMMAND_T),u=a.getCurrentId(),[4,da(t.getSubscribedList(),!0,o,t,a)];case 1:return(l=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new sa(l,s).execute(e,t,r)];case 2:return(d=c.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:d.code}]:(_=d.data.data,p=_.sdp,(f=_.resultCode)!==exports.RCRTCCode.SUCCESS?[2,{code:f}]:(o.clearReTryExchangeTimer(),[4,o.setRemoteAnswer(p.sdp)]));case 3:return(h=c.sent())!==exports.RCRTCCode.SUCCESS?[2,{code:h}]:(R=d.data.data.publishList||[],b=this._diffPublishListChange(R,t,o,u),g=b.plus,m=b.minus,g.length||m.length?[4,this._spreadPublishListUri(e,u,g,m,s)]:[3,5]);case 4:c.sent(),c.label=5;case 5:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"_diffPublishListChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n=t.getResourcesByUserId(i),o=JSON.parse(JSON.stringify(n));e.forEach((function(e){var t,i=e.mediaType,n=e.msid,s=o.findIndex((function(e){var t=e.mediaType,r=e.msid;return i===t&&n===r}));if(-1===s){var c=a({tag:n.split("_").pop(),state:(null===(t=r.getLocalTrack(dt(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(c)}else o[s].uri=e.uri}));var s=ht(n,o,!0),c=s.publishedList,u=s.unpublishedList;return t.setResourcesByUserId(i,o),{plus:c,minus:u}}}),Object.defineProperty(i.prototype,"_spreadPublishListUri",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u){return s(this,void 0,void 0,(function(){var s,l,d,_;return c(this,(function(c){switch(c.label){case 0:return s=t.store,l=t.logger,d=s.getResourcesByUserId(r),l.info(n.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:i,minus:a,allPublishList:d}),u),_=[],a.length&&_.push(ot(St.UNPUBLISH,a)),i.length&&_.push(ot(St.PUBLISH,i)),[4,t.context.setRTCTotalRes(s.roomId,_,at(d),St.TOTAL_CONTENT_RESOURCE)];case 1:return c.sent()===e.ErrorCode.SUCCESS?l.info(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(o.SUCCESSED),u):l.error(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(o.FAILED),u),[2]}}))}))}}),i}(ko);!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(ga||(ga={}));var La,Aa,Pa=function(t){function i(e,r,i,n){var o=t.call(this)||this;return Object.defineProperty(o,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.PULL_RTCROOM_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,l,d,_,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y,L,A,P;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=r.getRoomStatusVersion(),a.info(n.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:s}),this._traceId),this._targetPullVersion&&this._targetPullVersion<=s?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:o.SUCCESSED,msg:"the roomData has been pulled",localVersion:s,targetPullVersion:this._targetPullVersion}),this._traceId),[2,{code:e.ErrorCode.SUCCESS}]):[4,this._context.pullRTCRoomStatus(this._roomId,s)];case 1:return l=c.sent(),d=l.code,_=l.data,d!==e.ErrorCode.SUCCESS?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:o.FAILED,code:d}),this._traceId),[2,{code:d}]):(f=(p=_).bFullStatus,h=p.version,R=p.usersData,b=p.roomStatus,a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:f,version:Pt(h),usersData:R,roomStatus:b}),this._traceId),r.setRoomStatusVersion(h),f?(g=function(e){var t={users:{}},r="";return e.forEach((function(e){var i,n,o=e.userId,a=e.userData;t.users[o]={};var s=null===(i=a.filter((function(e){return"uris"===e.key}))[0])||void 0===i?void 0:i.value,c=null===(n=a.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value;r=c||r,t.users[o]={uris:s}})),{urisData:t,CDNUris:r&&JSON.stringify(JSON.parse(r)[0])}}(R),m=g.urisData,C=g.CDNUris,[4,Ra(m,r,t,i,C,this._traceId)]):[3,3]);case 2:return c.sent(),[2,{code:d}];case 3:c.trys.push([3,10,11,12]),v=u(b),T=v.next(),c.label=4;case 4:return T.done?[3,9]:(O=T.value).event!==ga.RESOURCECHANGE?[3,6]:(S=function(e){var t,r,i=e.userId,n=e.userData,o=function(e){return e.some((function(e){return"uris"===e.key||"cdn_uris"===e.key}))}(n);if(o){var a=null===(t=n.filter((function(e){return"uris"===e.key}))[0])||void 0===t?void 0:t.value,s=null===(r=n.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===r?void 0:r.value;return{userId:i,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}(O),S?(I=S.content,(E=S.userId)===r.crtUserId?[3,8]:[4,new Ta(I,St.TOTAL_CONTENT_RESOURCE,E,this._traceId).execute(t,r,i)]):[3,8]);case 5:return c.sent(),[3,8];case 6:return I=function(e){var t,r=e.userId,i=e.userData,n=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=i.filter((function(e){return"extra"===e.key}))[0])||void 0===t?void 0:t.value,state:n,switchRoleType:o}]}}(O),[4,new va(I,this._traceId).execute(t,r,i)];case 7:y=c.sent().data,t.emit(ea,y),c.label=8;case 8:return T=v.next(),[3,4];case 9:return[3,12];case 10:return L=c.sent(),A={error:L},[3,12];case 11:try{T&&!T.done&&(P=v.return)&&P.call(v)}finally{if(A)throw A.error}return[7];case 12:return[2,{code:d}]}}))}))}}),i}(ko),Na=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.ON_SIGNAL_RECONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return Oo.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return o=t.logger,a=t.peer,s=t.context,u=r.roomId,l=r.roomMode,d=o.createTraceId(),o.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,d),"closed"===a.getRTCPeerConn().connectionState?(o.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",d),t.emit(Wo),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,s.rtcPing(u,l)];case 1:return 40001!==c.sent().code?[3,5]:[4,this._joinRoom(t,r,i,d)];case 2:return c.sent()!==e.ErrorCode.SUCCESS?[3,4]:[4,this._restoreMediaServer(t,r,i)];case 3:c.sent(),c.label=4;case 4:return[3,7];case 5:return[4,new Pa(u,d,s).execute(t,r,i)];case 6:c.sent(),c.label=7;case 7:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"_joinRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){var u,l,d,_;return s(this,void 0,void 0,(function(){var s,p,f,h,R,b,g,m,C,v,T,O,S,E,I,y;return c(this,(function(c){switch(c.label){case 0:return s=t.context,p=t.logger,[4,s.joinRTCRoom(r.roomId,r.roomMode,this.livingType)];case 1:return f=c.sent(),h=f.code,R=f.data,h!==e.ErrorCode.SUCCESS?(p.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.FAILED,code:h,msg:"im reconnect joinRTCRoom failed"}),a),[2]):R?(b=null===(u=R.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===u?void 0:u.value,[4,Ra(R,r,t,i,b,a)]):(p.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),a),[2]);case 2:return c.sent(),(g=null===(l=R.roomInfo.filter((function(e){return"asr_status"===e.key}))[0])||void 0===l?void 0:l.value)&&r.setASRStatus(g),m=null===(d=R.roomInfo.filter((function(e){return"sei_ai_uris"===e.key}))[0])||void 0===d?void 0:d.value,C=r.getASRIsAvailable(),m&&((I=JSON.parse(m)).length?(C||t.emit(ta),r.setASRSeiUris(I),v=I[0],T=v.msid,O=v.mediaType,S="".concat(T,"_").concat(O),!r.getRemoteTrack(S)&&r.addSeiRemoteTrack(I)):(C&&t.emit(ra),r.removeSeiRemoteTrack(),r.setASRSeiUris(I))),(E=null===(_=R.roomInfo.filter((function(e){return"summarization"===e.key}))[0])||void 0===_?void 0:_.value)&&(I=JSON.parse(E),(y=r.getSummarizationStatusData())&&y.status!==I.status&&t.emit(I.status===exports.RCRTCOperateSummarizationType.OPEN?ia:na,I.taskId),r.setSummarizationStatusData(I)),p.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.SUCCESSED,roomData:R}),a),[2,h]}}))}))}}),Object.defineProperty(i.prototype,"_restoreMediaServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n;return c(this,(function(o){switch(o.label){case 0:return i=e.peer.getLocalTracks(),n=Object.values(t.getRemoteTracks()).filter((function(e){return!!e.isSubscribed()})),i.length?[4,new Sa(i).execute(e,t,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return i.length||!n.length?[3,4]:[4,new Oa(n,!0).execute(e,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),i}(ko),wa=1,Da=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"}(La||(La={})),exports.RCKickReason=void 0,(Aa=exports.RCKickReason||(exports.RCKickReason={}))[Aa.SERVER_KICK=1]="SERVER_KICK",Aa[Aa.OTHER_KICK=2]="OTHER_KICK",Aa[Aa.IM_DISCONNECTED=3]="IM_DISCONNECTED",Aa[Aa.IM_LOGOUT=4]="IM_LOGOUT",Aa[Aa.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED";var ka,Ua,Ma,xa,ja=function(){function e(e,t,r,i){var o=this;Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:i}),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,i){o._baseReportData=Object.assign(o._baseReportData,{snid:i});var s=a(a(a({},o._baseReportData),o._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});o._logger.__statistics(n.L_QS_JOIN_ROOM_S,JSON.stringify(s))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}}return Object.defineProperty(e.prototype,"reportQualityKickedData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=a(a(a({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?Da:wa});this._logger.__statistics(n.L_QS_KICKED_S,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o,s){var c=this;r.forEach((function(r){var u,l,d=r instanceof We||r instanceof rt?r:r.track,_=d.getTrackId(),p=_t(_).mediaType,f=!1;f=d instanceof We?!!d.isVideoTrack()&&(null===(l=(u=d).__isTiny)||void 0===l?void 0:l.call(u)):r.subTiny||!1;var h=a(a(a({},c._baseReportData),c._networkReportData),{resid:_,mtp:p,smct:f?$n.TINY:$n.NORMAL,stp:"Rongcloud"!==d.getTag()?1:0,cod:i,msas:o?o[_]:[],sigs:s,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":c._logger.__statistics(n.L_QS_PUBLISH_S,JSON.stringify(h));break;case"unpub":c._logger.__statistics(n.L_QS_UNPUBLISH_S,JSON.stringify(h));break;case"sub":c._logger.__statistics(n.L_QS_SUBSCRIBE_S,JSON.stringify(h));break;case"unsub":c._logger.__statistics(n.L_QS_UNSUBSCRIBE_S,JSON.stringify(h))}}))}}),Object.defineProperty(e.prototype,"reportQualityRecvPubMsgData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=a(a(a({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(n.L_QS_RECV_PUB_MSG_S,JSON.stringify(r))}}),Object.defineProperty(e.prototype,"setPubOrSubSuccessTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pubOrSubSuccessTime=e}}),Object.defineProperty(e.prototype,"reportIceFirstConnectData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=a(a(a({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?n.L_QS_PUB_ICE_STATUS_S:n.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(r,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"recordQualityIceStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this._peerCStatus||{},o=i.status,s=i.time;if(s){var c=e.IP,u=e.port,l=e.networkType,d=e.remoteIP,_=e.remotePort,p=a(a(a({},this._baseReportData),this._networkReportData),{dur:r-s,time:r,pices:La[o],ices:La[t],rcdts:[{ip:"".concat(d,":").concat(_)}],lcdts:[{ip:"".concat(c,":").concat(u),nttp:l}],cncdts:[]});console.log(n.L_QS_ICE_STATUS_S,p),this._logger.__statistics(n.L_QS_ICE_STATUS_S,JSON.stringify(p)),this._peerCStatus={status:t,time:r}}else this._peerCStatus={status:t,time:r}}}),e}();!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(ka||(ka={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(Ua||(Ua={})),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"}(Ma||(Ma={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(xa||(xa={}));var Ba,Va=function(){function t(e,t,r,i,n){void 0===n&&(n=Ua.MeetingOrAnchor),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:n})}return Object.defineProperty(t.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?[2,Ma.NOT_REPORT]:[4,this._context.setRTCState(this._roomId,t)];case 1:return r.sent()===e.ErrorCode.SUCCESS?[2,Ma.REPORT_SUCCESS]:[2,Ma.REPORT_FAIL]}}))}))}}),Object.defineProperty(t.prototype,"_getClientID",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=Rt(),this._runtime.localStorage.setItem(e,t)),t}}),Object.defineProperty(t.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(t.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var i=r.pop(),n=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i,n].join("_")}else{n=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n].join("_")}return t}}),Object.defineProperty(t.prototype,"_getBaseData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||Wn,bitrateRecv:(null==e?void 0:e.bitrateRecv)||Wn,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||Wn,localAddress:"".concat((null==e?void 0:e.IP)||Wn,":").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)||Wn,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||Wn,packetsLost:(null==e?void 0:e.totalPacketsLost)||Wn,deviceId:this._context.getCurrentId()}}}),Object.defineProperty(t.prototype,"_getAudioLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Wn}}),Object.defineProperty(t.prototype,"_getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Wn}}),Object.defineProperty(t.prototype,"_getPacketsLostRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Wn}}),Object.defineProperty(t.prototype,"_getFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Wn}}),Object.defineProperty(t.prototype,"_getResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(Wn)}}),Object.defineProperty(t.prototype,"_getJitter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Wn}}),Object.defineProperty(t.prototype,"_getNackCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Wn}}),Object.defineProperty(t.prototype,"_getPliCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Wn}}),Object.defineProperty(t.prototype,"_getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Wn}}),Object.defineProperty(t.prototype,"_getTrackState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e?this._crtRTCRoom.getLocalTrack(t):this._crtRTCRoom.getRemoteTrack(t);return(null==r?void 0:r.isLocalMuted())?ka.DISABLE:ka.ENABLE}}),Object.defineProperty(t.prototype,"sendR3Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.senders,i=this._getBaseData(t),n="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"),o=r.map((function(e){var t=e.trackId,r=e.audioLevel,i=e.samplingRate,n=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsSent,R=e.encoderImplementation,b=a._getPolarisTrackId(t),g=a._getRealResourceId(t);return{trackId:b,googCodecName:R||String(Wn),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(n),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(d),nackCount:a._getNackCount(_),pliCount:a._getPliCount(p),rtt:a._getRTT(f),googFirsSent:h,samplingRate:i,googRenderDelayMs:l,encoderImplementation:R||String(Wn),trackState:a._getTrackState(!0,g)}})),n+=o.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"),[4,this._send("".concat(n,"\r").concat(this._userRole))];case 1:return s.sent()!==Ma.REPORT_SUCCESS?[2,Ma.REPORT_FAIL]:[2,Ma.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.prototype,"sendR4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.receivers,i=this._getBaseData(t),n="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"),o=r.filter((function(e){return!!e.trackId})).map((function(e){var t=e.trackId,r=e.audioLevel,i=e.samplingRate,n=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsReceived,R=e.codecImplementationName,b=a._getPolarisTrackId(t),g=a._getRealResourceId(t);return{trackId:b,googCodecName:R||String(Wn),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(n),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(d),nackCount:a._getNackCount(_),pliCount:a._getPliCount(p),rtt:a._getRTT(f),googFirsReceived:h,samplingRate:i,googRenderDelayMs:l,codecImplementationName:R||String(Wn),trackState:a._getTrackState(!1,g)}})),n+=o.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"),[4,this._send("".concat(n,"\r").concat(this._userRole))];case 1:return s.sent()!==Ma.REPORT_SUCCESS?[2,Ma.REPORT_FAIL]:[2,Ma.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this._context.getCoreVersion(),r=(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platformn)||navigator.platform,i=vt.browser,n=vt.version,o=this._getClientID(),a="R1\t".concat("5.38.0-alpha.1","\t").concat(t,"\t").concat("web","\t").concat(r,"\t").concat(-1,"\t").concat(i,"\t").concat(n,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}}),Object.defineProperty(t.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this._getClientID(),n="R2\t".concat(e,"\t").concat(t,"\t").concat(i,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(n)}}),t}(),Fa=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"oldTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"newTrack",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f,h,R=this;return c(this,(function(c){switch(c.label){case 0:return i=e.peer,o=e.logger,this.oldTrack&&this.newTrack?[$e,Xe].every((function(e){return!(R.oldTrack instanceof e)}))?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):[$e,Xe].every((function(e){return!(R.newTrack instanceof e)}))?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"newTrack is not RCCameraVideoTrack or RCMicphoneAudioTrack"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(a=this.oldTrack.getSettings(),s=this.newTrack.getSettings(),u=this.oldTrack.getTrackId(),l=this.newTrack.getTrackId(),d=this.oldTrack.isAudioTrack()?"audio":"video",_=this.newTrack.isAudioTrack()?"audio":"video",o.info(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_T,JSON.stringify({oldTrackId:u,newTrackId:l,oldSettings:a,newSettings:s})),this.oldTrack.isPublished()?u!==l?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack trackId are different, oldTrackId: ".concat(u,", newTrackId: ").concat(l)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):d!==_?(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack and newTrack are not the same kind, oldTrackKind: ".concat(d,", newTrackKind: ").concat(_)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(null==a?void 0:a.deviceId)===(null==s?void 0:s.deviceId)?(o.error(n.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)),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(i.addLocalTrack(this.newTrack),p=(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")),p?[4,(new ya).execute(e,t,r)]:(f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),[2,{code:exports.RCRTCCode.SUCCESS}])):(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack is not published"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])):(o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"oldTrack or newTrack is empty"),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(h=c.sent()).code!==exports.RCRTCCode.SUCCESS?(i.removeLocalTrack(this.newTrack,!1),i.addLocalTrack(this.oldTrack),this.newTrack.destroy(),o.error(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"negotiation failed, code: ".concat(h.code)),[2,{code:h.code}]):(f&&f.destroy(),this.oldTrack.destroy(!1),this.newTrack.__innerSetPublished(!0),o.info(n.L_RTC_CLIENT_CHANGE_MEDIA_DEVICE_R,"changeMediaDevice success"),[2,{code:h.code}])}}))}))}}),t}(ko);!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(Ba||(Ba={}));var Ja,Ga=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"_type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return r(i,t),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return i=t.logger,o=t.context,a=t.service,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_T,"type: ".concat(this._type),this._traceId),(null==(s=o.getNaviInfo())?void 0:s.rtcAISwitch)===Ba.CLOSE?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}]):this._type===r.getASRStatus()?(this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}]):(u=r.roomId,[4,o.setRTCData(u,"asr_status",this._type.toString(),!0,e.RTCApiType.ROOM,{name:St.ASR_STATUS,content:JSON.stringify({asr_status:this._type.toString()})})]);case 1:return(l=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:l}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(r.setASRStatus(this._type),[4,a.updateASRStatus(r.getRTCRequestHeader(),{asr_status:this._type},this._traceId)]);case 2:return d=c.sent(),_=d.code,p=d.data,_!==exports.RCRTCCode.SUCCESS||(null==p?void 0:p.resultCode)!==exports.RCRTCCode.SUCCESS&&42200!==(null==p?void 0:p.resultCode)?(f=_!==exports.RCRTCCode.SUCCESS?_:null==p?void 0:p.resultCode,this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:f}),this._traceId),[2,{code:f}]):(this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_ASR_STATUS_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),i}(ko),Ha=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_enable",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return r(t,e),Object.defineProperty(t.prototype,"_updateSubSei",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n="".concat(e[0].msid,"_").concat(e[0].mediaType),o=r.getRemoteTrack(n);return this._enable?new Oa([o]).execute(t,r,i):new ua([o],this._traceId).execute(t,r,i)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,o=e.context,this._traceId=i.createTraceId(),this._logger=i,this._logger.info(n.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)===Ba.CLOSE?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}]):(s=t.getASRSeiUris()).length?[4,this._updateSubSei(s,e,t,r)]:(this._logger.info(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS,asrSeiUrisLength:0}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:u}),this._traceId),[2,{code:u}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ENABLE_ASR_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),t}(ko);!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=0]="CLOSE"}(Ja||(Ja={}));var Ka,Wa,za,Ya,qa=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_destLanguage",{enumerable:!0,configurable:!0,writable:!0,value:r}),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 r(t,e),Object.defineProperty(t.prototype,"_operateWithRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return void 0===r&&(r=3),void 0===i&&(i=3e3),s(this,void 0,void 0,(function(){var n,o,a,s;return c(this,(function(c){switch(c.label){case 0:n=1,c.label=1;case 1:if(!(n<=r))return[3,8];c.label=2;case 2:return c.trys.push([2,4,,5]),[4,t.operateRealtimeTranslation(e.getRTCRequestHeader(),{status:this._status},this._traceId)];case 3:return o=c.sent(),a=o.code,o.data,a===exports.RCRTCCode.SUCCESS?[2]:(console.warn("第 ".concat(n," 次调用失败,code=").concat(a)),[3,5]);case 4:return s=c.sent(),console.error("第 ".concat(n," 次调用异常:"),s),[3,5];case 5:return n<r?[4,new Promise((function(e){setTimeout(e,i)}))]:[3,7];case 6:c.sent(),c.label=7;case 7:return n++,[3,1];case 8:return[2]}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var r,i,o,a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:if(r=e.logger,i=e.service,o=e.context,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(n.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)===Ba.CLOSE)return this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}];if(this._status===Ja.OPEN){if(!this._destLanguage)return this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.PARAMS_ERROR}),this._traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}];if(!t.getASRSeiUris().length)return this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_START}]}return s={status:this._status},this._destLanguage&&(s.destLanguage=this._destLanguage),[4,i.operateRealtimeTranslation(t.getRTCRequestHeader(),s,this._traceId)];case 1:return u=c.sent(),l=u.code,d=u.data,this._status===Ja.CLOSE?(t.setIsStartRealTranslate(!1),this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),l!==exports.RCRTCCode.SUCCESS&&this._operateWithRetry(t,i),[2,{code:exports.RCRTCCode.SUCCESS}]):l!==exports.RCRTCCode.SUCCESS||(null==d?void 0:d.resultCode)!==exports.RCRTCCode.SUCCESS?(_=l!==exports.RCRTCCode.SUCCESS?l:null==d?void 0:d.resultCode,this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:_}),this._traceId),[2,{code:_}]):(t.setIsStartRealTranslate(!0),this._destLanguage&&t.setTranslationLang(this._destLanguage),this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.SUCCESS}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),t}(ko),Za=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_type",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(e){return t.setASRStatus(this._type),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(ko),Qa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_asrSeiUris",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"_setEnableAsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return(i=t.getASREnable())?[4,new Ha(this._asrSeiUris.length>0).execute(e,t,r)]:[3,2];case 1:n.sent(),t.setASREnable(i),n.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(t.prototype,"_onPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){e.emit(ta),t.setASRSeiUris(this._asrSeiUris),t.addSeiRemoteTrack(this._asrSeiUris),this._setEnableAsr(e,t,r)}}),Object.defineProperty(t.prototype,"_onUnPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return e.emit(ra),[4,this._setEnableAsr(e,t,r)];case 1:return i.sent(),t.removeSeiRemoteTrack(),t.setASRSeiUris(this._asrSeiUris),[2]}}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){return this._asrSeiUris.length?this._onPublish(e,t,r):this._onUnPublish(e,t,r),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(ko),Xa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"_isStart",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,o;return s(this,void 0,void 0,(function(){var r,a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return r=e.logger,a=e.context,s=e.service,this._traceId=r.createTraceId(),this._logger=r,this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_T,"isStart: ".concat(this._isStart),this._traceId),(null==(u=a.getNaviInfo())?void 0:u.rtcAISwitch)===Ba.CLOSE?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_AVAILABLE}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_AVAILABLE}]):t.getASRSeiUris().length?(null===(i=t.getSummarizationStatusData())||void 0===i?void 0:i.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._isStart||(null===(o=t.getSummarizationStatusData())||void 0===o?void 0:o.status)===exports.RCRTCOperateSummarizationType.CLOSE&&!this._isStart?(this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS,taskId:t.getSummarizationStatusData().taskId}]):(l={status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE},[4,s.operateSummarization(t.getRTCRequestHeader(),l,this._traceId)]):(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_REALTIME_TRANSLATION_R,JSON.stringify({code:exports.RCRTCCode.ASR_NOT_START}),this._traceId),[2,{code:exports.RCRTCCode.ASR_NOT_START}]);case 1:return d=c.sent(),_=d.code,p=d.data,_!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:_}),this._traceId),[2,{code:_}]):(t.setSummarizationStatusData({taskId:p.taskId,status:this._isStart?exports.RCRTCOperateSummarizationType.OPEN:exports.RCRTCOperateSummarizationType.CLOSE}),this._logger.info(n.L_ABSTRACT_ROOM_OPERATE_SUMMARIZATION_R,JSON.stringify({isStart:this._isStart,code:exports.RCRTCCode.SUCCESS,taskId:null==p?void 0:p.taskId}),this._traceId),[2,{code:exports.RCRTCCode.SUCCESS,taskId:null==p?void 0:p.taskId}])}}))}))}}),t}(ko),$a=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"_status",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"_taskId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return t.setSummarizationStatusData({status:this._status,taskId:this._taskId}),e.emit(this._status===exports.RCRTCOperateSummarizationType.OPEN?ia:na,this._taskId),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(ko),es="evt-leave",ts=function(t){function i(e,r,i,o,a,u,l,d,_,p){void 0===_&&(_=Yn()),void 0===p&&(p=!1);var f=t.call(this)||this;Object.defineProperty(f,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(f,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(f,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(f,"_service",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(f,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(f,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(f,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(f,"_onRecvPKMsg",{enumerable:!0,configurable:!0,writable:!0,value:null});var h=f._logger=f._context.logger;f._reportMediaActionLogger=new ja(h,f._roomId,f._clientSessionId,f._context.getCurrentId()),f._polarisReport=new Va(f._context,f._runtime,f._roomId,f);var R=f._context.getCurrentId(),b=new Bo(h,_,f._context.getAppkey(),i,R,o,l,d),g=f._peerConnection=new No(e,h,f._reTryExchange.bind(f),R,b,f._polarisReport,!1,p);f._setPeerConnectionListener();var m=f._executeCtx=new oa(h,f._service,e,r,g,b,f._polarisReport,f._reportMediaActionLogger);return m.getPushOtherRooms=function(){return f._getPushOtherRoomsParams()},f.setCommandEventListener(),f._invoker=new Mo(m,b),f._store=f._invoker.store,f._audioLevelReport=new wo(f._store,g),g.on(No.__INNER_AUDIOLEVEL_CHANGE__,f._audioLevelReport.audioLevelReport,f._audioLevelReport),f._pinger=new wt(f._context,f._roomId,o,f._initOptions.pingGap),f._pinger.onFailed=f.__kickoff.bind(f),f._pinger.onPingResult=f._handlePingResult.bind(f),f._context.registerRTCSignalListener((function(e){return s(f,void 0,void 0,(function(){var t,r,i,o,a;return c(this,(function(s){return t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,o=t.roomId,this._invoker.isDestroyed()?(this._logger.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),[2]):(2===i&&o===this._roomId&&(a=this._logger.createTraceId(),this._logger.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r)),[2])}))}))})),f}return r(i,t),Object.defineProperty(i.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(No.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(We.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(We.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(No.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(No.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,i=t.time,n=t.iceCandidatePair;e._reportMediaActionLogger.recordQualityIceStatusData(n,r,i)})),t.on(No.__INNER_SEI_CONTENT__,this._onReceiveAsrSeiContent,this)}}),Object.defineProperty(i.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(Wo,this._rtcpeerClosed,this),e.on(zo,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Yo,this._callAppListener.bind(this,"onUserLeave"),this),e.on(qo,this._onTrackPublish,this),e.on(Zo,this._onTrackUnpublish,this),e.on(Qo,this._onAudioMuteChange,this),e.on(Xo,this._onVideoMuteChange,this),e.on($o,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on(ea,this._dealUserAppListener,this),e.on(ta,this._callAppListener.bind(this,"onReceiveStartASR"),this),e.on(ra,this._callAppListener.bind(this,"onReceiveStopASR"),this),e.on(ia,this._callAppListener.bind(this,"onReceiveStartSummarization"),this),e.on(na,this._callAppListener.bind(this,"onReceiveStopSummarization"),this)}}),Object.defineProperty(i.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new Pa(e,t,this._context,r))];case 1:return i.sent(),[2]}}))}))}}),Object.defineProperty(i.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a,u){return s(this,void 0,void 0,(function(){var s,l,d;return c(this,(function(c){switch(c.label){case 0:return[4,this._invoker.push(new Jo(this._roomId,e,t,r,i,n,o,a,u))];case 1:return s=c.sent(),l=s.code,d=s.data,l!==exports.RCRTCCode.SUCCESS?[2,{code:l}]:(this._initWithRoomData(d.offlineKickTime),[2,{code:l,data:d}])}}))}))}}),Object.defineProperty(i.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}}),Object.defineProperty(i.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var r=this._logger.createTraceId();this._logger.info(n.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),r),this._startPullRTCRoomStatus(this._roomId,r,t)}this._callAppListener("onPing",e)}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._logger.warn(n.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),e.assert("max",t,(function(t){return e.isNumber(t)&&t>Math.max(r||1,200)}),!0),e.assert("min",r,(function(r){return e.isNumber(r)&&r>=1&&(!e.isNumber(t)||r<t)}),!0),e.assert("start",i,(function(i){return e.isNumber(i)&&i>r&&i<=t})),this._peerConnection.setBitrate(t,r,i)}}),Object.defineProperty(i.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,i=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=this._store.getRemoteTrack(i);a?(a.__innerSetMediaStreamTrack(r),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackReady",trackId:a.getTrackId()})),this._callAppListener("onTrackReady",a)):this._logger.warn(n.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(i.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(i.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(i.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(r===this._roomId){this._logger.info(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var i=e.content;switch(e.messageType){case St.KICK:this.__kickoff(!0,i);break;case St.STATE:this._stateHandle(i,t);break;case St.MODIFY:case St.PUBLISH:case St.UNPUBLISH:case St.TOTAL_CONTENT_RESOURCE:this._resourceHandle(i,e.messageType,e.senderUserId,e.sentTime,t);break;case St.ASR_STATUS:this._invoker.push(new Za(i.asr_status));break;case St.ASR_SEI:this._invoker.push(new Qa(JSON.parse(i.sei_ai_uris||"[]")));break;case St.SUMMARIZATION_STATUS:this._invoker.push(new $a(i.status,i.taskId));break;case St.ROOM_NOTIFY:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case St.USER_NOTIFY:this._logger.warn(n.L_OLD_DAILY_RECORD_O,"TODO: ".concat(St.USER_NOTIFY));break;case St.PK_INVITE:case St.PK_CANCEL_INVITE:case St.PK_INVITE_TIMEOUT:case St.PK_INVITE_ANSWER:case St.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case St.OTHER_ROOM_OFFLINE:break;default:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,i,e.senderUserId,e.messageUId)}}else this._logger.warn(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:o.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(i.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a=this;return c(this,(function(s){return this._invoker.isDestroyed()||(this._logger.warn(n.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(es),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===a._context.getCurrentId()&&(i=e.type,r=e.kickExtra,a._reportMediaActionLogger.reportQualityKickedData(i))})),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:i,kickExtra:r})),this._callAppListener("onKickOff",e,i,r)),[2]}))}))}}),Object.defineProperty(i.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(es),this._leaveHandle(!0),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(i.prototype,"_onReceiveAsrSeiContent",{enumerable:!1,configurable:!0,writable:!0,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)}))}}),Object.defineProperty(i.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o;return c(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new Ta(e,t,r,n,i)),[2]}))}))}}),Object.defineProperty(i.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(i.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new va(e,t))];case 1:return r=n.sent(),i=r.data,this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(i.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=this,a=e.left,s=e.joined,c=e.upgrade,u=e.downgrade,_=e.offline,p=d([],l(s),!1),f=d([],l(a),!1);(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)?(null==c||c.forEach((function(e){i._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.ANCHOR})),i._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.ANCHOR)})),null==u||u.forEach((function(e){i._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.AUDIENCE})),i._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.AUDIENCE)}))):(p.push.apply(p,d([],l(c),!1)),f.push.apply(f,d([],l(u),!1))),_.length&&((null===(r=this._appListener)||void 0===r?void 0:r.onUserOffline)?(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserOffline",offline:_})),this._callAppListener("onUserOffline",_)):f.push.apply(f,d([],l(_),!1))),p.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserJoin",allJoined:p})),this._callAppListener("onUserJoin",p)),f.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserLeave",allLeft:f})),this._callAppListener("onUserLeave",f))}}),Object.defineProperty(i.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(i.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(i.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(i.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,d([],l(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(i.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(i.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(i.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a;return c(this,(function(s){switch(s.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:t,content:r}),i),[4,this._context.sendMessage(e.ConversationType.RTC_ROOM,this._roomId,{messageType:t,content:r,isStatusMessage:!0})];case 1:return(a=s.sent().code)!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:o.FAILED,code:a}),i),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:o.SUCCESSED,name:t,content:r}),i),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return void 0===a&&(a=!1),s(this,void 0,void 0,(function(){var s,u;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:t,value:r,message:i,isInner:a}),s),[4,this._context.setRTCData(this._roomId,t,r,a,Fo.ROOM,i)];case 1:return(u=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.FAILED,code:u}),s),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,roomId:this._roomId,key:t,value:r,message:i,isInner:a}),s),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,message:r,isInner:i}),a),[4,this._context.removeRTCData(this._roomId,t,i,Fo.ROOM,r)];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.FAILED,code:s}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,roomId:this._roomId,keys:t,message:r,isInner:i}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return void 0===t&&(t=[]),void 0===r&&(r=!1),s(this,void 0,void 0,(function(){var i,a,s,u;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,isInner:r}),i),[4,this._context.getRTCData(this._roomId,t,r,Fo.ROOM)];case 1:return a=c.sent(),s=a.code,u=a.data,s!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(s),i),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,data:u}),i),[2,{code:exports.RCRTCCode.SUCCESS,data:u}])}}))}))}}),Object.defineProperty(i.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Fo.PERSON,r)}}),Object.defineProperty(i.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Fo.PERSON,t)}}),Object.defineProperty(i.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Fo.PERSON)}}),Object.defineProperty(i.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(i.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(i.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(i.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:(this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._store.isMainRoom?[4,this._quitAllPKRoom()]:[3,4];case 3:t.sent(),t.label=4;case 4:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 5:return t.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(i.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}}),Object.defineProperty(i.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Ye&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(i.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new Ia(e))];case 1:return r=i.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(i.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Sa(e))]}))}))}}),Object.defineProperty(i.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){return[]}}),Object.defineProperty(i.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new ya)}}),Object.defineProperty(i.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Ea(e))]}))}))}}),Object.defineProperty(i.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=_t(e).userId;return!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find((function(t){return dt(t)===e})))}}),Object.defineProperty(i.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Oa(e,void 0,void 0))]}))}))}}),Object.defineProperty(i.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){return t=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_UNSUBSCRIBE_O,void 0,t),[2,this._invoker.push(new ua(e,t))]}))}))}}),Object.defineProperty(i.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new ca(e,!0,this._logger.createTraceId()))]}))}))}}),Object.defineProperty(i.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(i.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(i.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(i.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e,this.asrIsAvailable()&&this._executeCtx.emit(ta);var t=this.getSummarizationStatusData();t&&(null==t?void 0:t.status)===exports.RCRTCOperateSummarizationType.OPEN&&this._executeCtx.emit(ia,t.taskId)}}),Object.defineProperty(i.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}}),Object.defineProperty(i.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(i.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._invoker.push(new Na(e))}}),Object.defineProperty(i.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(i.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(i.prototype,"_registerPKMsgListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._onRecvPKMsg=e}}),Object.defineProperty(i.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2]}))}))}}),Object.defineProperty(i.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.clientSessionId}}),Object.defineProperty(i.prototype,"changeMediaDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this._invoker.push(new Fa(e,t))]}))}))}}),Object.defineProperty(i.prototype,"startASR",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ga(Do.OPEN))}}),Object.defineProperty(i.prototype,"stopASR",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Ga(Do.CLOSE))}}),Object.defineProperty(i.prototype,"asrIsAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getASRIsAvailable()}}),Object.defineProperty(i.prototype,"setEnableASR",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._invoker.push(new Ha(e))}}),Object.defineProperty(i.prototype,"startRealtimeTranslation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._invoker.push(new qa(Ja.OPEN,e))}}),Object.defineProperty(i.prototype,"stopRealtimeTranslation",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new qa(Ja.CLOSE))}}),Object.defineProperty(i.prototype,"startSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Xa(!0))}}),Object.defineProperty(i.prototype,"stopSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Xa(!1))}}),Object.defineProperty(i.prototype,"getSummarizationStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSummarizationStatusData()}}),i}(e.EventEmitter),rs=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return To.MCUCONFIG_FLUSH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n,o,a;return s(this,void 0,void 0,(function(){var r,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return r=e.context,s=e.service,u={"App-Key":r.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:r.getCurrentId(),SessionId:t.getSessionId()},[4,s.setMcuConfig(u,this.data)];case 1:return l=c.sent(),d=l.code,_=l.res,d!==exports.RCRTCCode.SUCCESS?[2,{code:d}]:(_.pull_url&&t.setCDNUris(JSON.parse(_.pull_url)),p=this.cdnValues,d===exports.RCRTCCode.SUCCESS&&((null===(n=null===(i=p.output)||void 0===i?void 0:i.video.normal)||void 0===n?void 0:n.width)||(null===(a=null===(o=p.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&fa(r,t),[2,{code:d,data:_}])}}))}))}}),t}(ko);exports.BackgroundPictureFillMode=void 0,(Ka=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[Ka.CROP=1]="CROP",Ka[Ka.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(Wa=exports.MixLayoutMode||(exports.MixLayoutMode={}))[Wa.CUSTOMIZE=1]="CUSTOMIZE",Wa[Wa.SUSPENSION=2]="SUSPENSION",Wa[Wa.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(za=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[za.CROP=1]="CROP",za[za.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"}(Ya||(Ya={}));var is,ns=function(){return{version:2,mode:exports.MixLayoutMode.SUSPENSION}},os=function(){function t(e,t,r){Object.defineProperty(this,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_isValidTrackId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_values",{enumerable:!0,configurable:!0,writable:!0,value:ns()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._executeCtx.logger}return Object.defineProperty(t.prototype,"setHostVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=_t(e),r=t.mediaType,i=t.tag,a=t.userId;return r!==exports.RCMediaType.VIDEO_ONLY?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=pt(a,i),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,videoTrackId:e})),this)}}),Object.defineProperty(t.prototype,"setMixLayoutMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.MixLayoutMode.CUSTOMIZE,exports.MixLayoutMode.SUSPENSION,exports.MixLayoutMode.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:o.SUCCESSED,mode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:o.SUCCESSED,msg:"mode: ".concat(e," is invalid")})),this)}}),Object.defineProperty(t.prototype,"_addOutputValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r="normal");var i=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var n=i.video;if("normal"!==r&&"tiny"!==r)if("backgroundColor"!==r)if("exparams"!==r){if("backgroundPicture"===r){var o=n.backgroundPicture||(n.backgroundPicture={fillMode:exports.BackgroundPictureFillMode.CROP,picture:[]});Object.assign(o,t)}}else n.exparams={renderMode:t};else n.backgroundColor=t;else{var a=n[r]||(n[r]={});Object.assign(a,t)}}else i.audio={bitrate:t};else i.cdn=t}}),Object.defineProperty(t.prototype,"setOutputVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!gt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:o.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=bt(e),r=t.width,i=t.height;return this._addOutputValue("video",{width:r,height:i},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:o.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!mt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:o.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Ct(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:o.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e.isNumber(t)||t<=0?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputTinyVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!gt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:o.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=bt(e),r=t.width,i=t.height;return this._addOutputValue("video",{width:r,height:i},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:o.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!mt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:o.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=Ct(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:o.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e.isNumber(t)||t<=0?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputVideoRenderMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.MixVideoRenderMode.CROP,exports.MixVideoRenderMode.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:o.SUCCESSED,renderMode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"setOutputAudioBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isNumber(t)&&t>0?(this._addOutputValue("audio",t),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this)}}),Object.defineProperty(t.prototype,"setOutputBackgroundColor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?(this._addOutputValue("video",e,"backgroundColor"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:o.SUCCESSED,color:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:o.FAILED,msg:"params error -> color: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s){var c,u,l;if(!e.isHttpUrl(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([r,i,a,s].some((function(t){return!e.isNumber(t)||t<0||t>1})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(r,", y: ").concat(i,", w: ").concat(a,", h: ").concat(s)})),this;var d=(null===(l=null===(u=null===(c=this._values.output)||void 0===c?void 0:c.video)||void 0===u?void 0:u.backgroundPicture)||void 0===l?void 0:l.picture)||[];return d.push({uri:t,w:a,h:s,x:r,y:i}),this._addOutputValue("video",{picture:d},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.SUCCESSED,uri:t,x:r,y:i,w:a,h:s})),this}}),Object.defineProperty(t.prototype,"removeOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a;if(!e.isHttpUrl(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(t)})),this;var s=null===(a=null===(i=null===(r=this._values.output)||void 0===r?void 0:r.video)||void 0===i?void 0:i.backgroundPicture)||void 0===a?void 0:a.picture;return s&&(s=s.filter((function(e){return e.uri!==t})),this._addOutputValue("video",{pictures:s},"backgroundPicture")),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.SUCCESSED,uri:t})),this}}),Object.defineProperty(t.prototype,"clearOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"setOutputBackgroundPictureFillMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.BackgroundPictureFillMode.CROP,exports.BackgroundPictureFillMode.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.SUCCESSED,fillMode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a=/^rtmp:\/\/.+/;if(!e.isArray(t)||0===t.length||t.some((function(e){return!a.test(e)})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> urls: ".concat(t.join(","))})),this;var s=(null===(i=null===(r=this._values.output)||void 0===r?void 0:r.cdn)||void 0===i?void 0:i.concat())||[],c=!1;return t.forEach((function(e){s.some((function(t){return t.pushurl===e}))||(c=!0,s.push({pushurl:e}))})),s.length>5?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(t.length)})),this):(c&&this._addOutputValue("cdn",s),this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.SUCCESSED,urls:t})),this)}}),Object.defineProperty(t.prototype,"removePublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a=/^rtmp:\/\/.+/;if(!e.isArray(t)||0===t.length||t.some((function(e){return!a.test(e)})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.FAILED,msg:"params error -> urls: ".concat(t.join(","))})),this;for(var s=(null===(i=null===(r=this._values.output)||void 0===r?void 0:r.cdn)||void 0===i?void 0:i.concat())||[],c=s.length-1;c>=0;c-=1){var u=s[c].pushurl,l=t.indexOf(u);l>=0&&(t.splice(l,1),s.splice(c,1))}return this._addOutputValue("cdn",s),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.SUCCESSED,urls:t})),this}}),Object.defineProperty(t.prototype,"clearPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("cdn",[]),this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O),this}}),Object.defineProperty(t.prototype,"addCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s){if(!e.notEmptyString(t)||!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e.isNumber(r)||!e.isNumber(i))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params x or y is error -> x: ".concat(r,", y: ").concat(i)})),this;if([a,s].some((function(t){return!e.isNumber(t)||t<0})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params width or height error -> width: ".concat(a,", height: ").concat(s)})),this;var c=_t(t),u=c.userId,l=c.tag;if(c.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(t," is not video")})),this;var d=pt(u,l),_=this._values.input||(this._values.input={}),p=_.video||(_.video=[]);return p.some((function(e){return e.height===s&&e.width===a&&e.stream_id===d&&e.user_id===u&&e.x===r&&e.y===i}))?(this._logger.warn(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"Duplicate configuration item place ignored"})),this):(p.push({user_id:u,stream_id:d,x:r,y:i,width:a,height:s}),this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.SUCCESSED,trackId:t,x:r,y:i,width:a,height:s})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=_t(e),r=t.userId,i=t.tag;if(t.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var a=pt(r,i),s=this._values.input;return(null==s?void 0:s.video)&&s.video.length>0&&(s.video=s.video.filter((function(e){return e.stream_id===a}))),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this}}),Object.defineProperty(t.prototype,"clearCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._values.input;return null==e||delete e.video,this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O),this}}),Object.defineProperty(t.prototype,"setCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return e.some((function(e){return t._isValidTrackId(e)}))?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map((function(e){var t=_t(e),r=t.userId,i=t.tag;return{stream_id:pt(r,i),user_id:r}})),this._values.inputFilterMode=Ya.AUDIO_INPUT_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.SUCCESSED,trackIds:e})),this)}}),Object.defineProperty(t.prototype,"addCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),r=t.audio||(t.audio=[]),i=_t(e),a=i.userId,s=i.tag,c=pt(a,s);return r.some((function(e){return e.stream_id===c&&e.user_id===a}))?(this._logger.warn(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(r.push({user_id:a,stream_id:c}),this._values.inputFilterMode=Ya.AUDIO_INPUT_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.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(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var r=_t(e),i=r.userId,a=r.tag,s=pt(i,a);return t.audio=t.audio.filter((function(e){return i!==e.user_id||s!==e.stream_id})),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this}}),Object.defineProperty(t.prototype,"clearCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._values.input;return(null==e?void 0:e.audio)&&delete e.audio,this._values.inputFilterMode=Ya.AUDIO_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O),this}}),Object.defineProperty(t.prototype,"addPictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s,c){if(!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e.isHttpUrl(r))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(r)})),this;if([i,a,s,c].some((function(t){return!e.isNumber(t)||t<0||t>1}))||i+s>1||a+c>1)return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(i,", y: ").concat(a,", w: ").concat(s,", h: ").concat(c)})),this;var u=_t(t),l=u.userId,d=u.tag,_=pt(l,d),p=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,f=p.filter((function(e){return e.streamId===_}))[0];return f?f.picture.push({uri:r,w:s,h:c,x:i,y:a}):p.push({streamId:_,picture:[{uri:r,w:s,h:c,x:i,y:a}]}),this._values.waterMark.singleScreen=p,this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.SUCCESSED,trackId:t,uri:r,x:i,y:a,w:s,h:c,singleScreen:p})),this}}),Object.defineProperty(t.prototype,"clearPictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen=[],this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"removePictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!e.notEmptyString(t)||!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;var i=_t(t),a=i.userId,s=i.tag,c=pt(a,s);return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen.forEach((function(e){e.streamId===c&&(e.picture=e.picture.filter((function(e){return e.uri!==r})))})),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:o.SUCCESSED,trackId:t,uri:r})),this}}),Object.defineProperty(t.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._values=ns(),this._logger.info(n.L_MCU_CONFIG_BUILDER_RESET_O),this}}),Object.defineProperty(t.prototype,"flush",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return void 0===e&&(e=!0),s(this,void 0,void 0,(function(){var t,r;return c(this,(function(i){switch(i.label){case 0:return t=JSON.parse(JSON.stringify(this._values)),[4,this._invoker.push(new rs(t,this._values))];case 1:return r=i.sent().code,e&&(this._values=ns()),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"__innerGetValues",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.parse(JSON.stringify(this._values))}}),t}();exports.RCLivingType=void 0,(is=exports.RCLivingType||(exports.RCLivingType={}))[is.VIDEO=0]="VIDEO",is[is.AUDIO=1]="AUDIO";var as,ss=function(e){function t(t,r,i){var n=e.call(this)||this;return Object.defineProperty(n,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(t,e),Object.defineProperty(t.prototype,"_exchangeWithPushOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p,f,h;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,a=e.peer,s=e.context,a.getLocalTracks().length?(u=a,[4,da(t.getSubscribedList(),!1,u,t,s)]):(i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.SUCCESSED,msg:"have not published resource"}),this.traceId),[2]);case 1:return l=c.sent(),d=e.getPushOtherRooms(),l.pushOtherRooms=d,[4,new sa(l,this.traceId,!0).execute(e,t,r)];case 2:return(_=c.sent()).code!==exports.RCRTCCode.SUCCESS?(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,code:_.code,pushOtherRooms:d}),this.traceId),[2]):(p=_.data.data,f=p.sdp,(h=p.resultCode)!==exports.RCRTCCode.SUCCESS?(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,code:h,pushOtherRooms:d}),this.traceId),[2]):(i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.SUCCESSED,pushOtherRooms:d}),this.traceId),u.setRemoteAnswer(f.sdp),[2]))}}))}))}}),Object.defineProperty(t.prototype,"kind",{get:function(){return To.EXCHANGE_WITH_PUSH_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a;return c(this,(function(s){switch(s.label){case 0:return i=e.logger,a=this.roomId,i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_T,a),this.roomPKHandler?this.roomPKHandler.getPKInfo(a)?[4,this._exchangeWithPushOtherRoom(e,t,r)]:(i.warn(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,msg:"PKInfo not exist"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]):(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return s.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(ko),cs=function(t){function i(e,r,i,n,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"room",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"isQuitPK",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.LEAVE_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"quitRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b;return c(this,(function(c){switch(c.label){case 0:return s=t.logger,u=t.context,s.info(n.L_QUIT_PK_T,"roomId: ".concat(r),a),this._PKInfo[r]?(l=this._PKInfo[r],d=l.inviterRoomId,_=l.inviteeRoomId,p=l.inviterUserId,f=l.inviteSessionId,h={inviteeRoomId:_,inviterRoomId:d,userId:i.crtUserId},R={roomId:i.roomId,endRoomId:r,sessionId:f,content:JSON.stringify(h),keys:["".concat(d,"|").concat(p)]},[4,u.endRoomPK(R)]):(s.warn(n.L_QUIT_PK_R,"status: ".concat(o.FAILED,", msg: pkinfo is empty"),a),[2]);case 1:return(b=c.sent())!==e.ErrorCode.SUCCESS?(s.error(n.L_QUIT_PK_R,"status: ".concat(o.FAILED,", code: ").concat(b),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(s.info(n.L_QUIT_PK_R,"status: ".concat(o.SUCCESSED),a),delete this._PKInfo[r],[2])}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,s=(a=this).room,u=a.isQuitPK,l=s.getRoomId(),i.info(n.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:l,isQuitPK:u}),this.traceId),[4,s.__destroy(!0)];case 1:return c.sent(),delete this._joinedPKRooms[l],[4,new ss(l,this.pkHandler,this.traceId).execute(e,t,r)];case 2:return c.sent(),u&&this.quitRoomPK(e,l,t,this.traceId),i.info(n.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:o.SUCCESSED}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(ko),us=function(){function t(e,t,r,i,n,o,a,s,c,u){Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_mainLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_registerPKMsgListener",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_onJoinedPKRoom",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),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()}return Object.defineProperty(t.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(t.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,i={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[r]=t,this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:i})),this._callAppListener("onRequestJoinOtherRoom",i)}}),Object.defineProperty(t.prototype,"_onCancelInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,i={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[r],this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:i})),this._callAppListener("onCancelRequestOtherRoom",i)}}),Object.defineProperty(t.prototype,"_onInviteTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"_onInviteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.answerCode,r=e.inviteContent,i=r.inviteSessionId,o=r.inviterUserId,a=r.inviterRoomId,s=r.inviteeUserId,c=r.inviterUserAutoMix,u=r.inviteeUserAutoMix,l=r.inviteeRoomId,d={agree:1===t,inviterRoomId:a,inviterUserId:o,inviteeRoomId:l,inviteeUserId:s,extra:r.extra};this._PKInfo[l]=this._PKInfo[l]||{inviteSessionId:i,inviterRoomId:a,inviterUserId:o,inviterUserAutoMix:c,inviteeRoomId:l},this._PKInfo[l].inviteeUserAutoMix=u,this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:d})),this._callAppListener("onResponseJoinOtherRoom",d)}}),Object.defineProperty(t.prototype,"createLeaveOtherRoomCommand",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return new cs(this,e,this._PKInfo,this._joinedPKRooms,t,r)}}),Object.defineProperty(t.prototype,"_onPKEnd",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return t=e.inviteInfo,r=t.inviteeRoomId,i=t.inviterRoomId,o=t.userId,a=i===this._mainRoomId?r:i,s={endRoomId:a,endUserId:o},u=this._joinedPKRooms[a],l=this._logger.createTraceId(),this._logger.info(n.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,l),u?[4,this._invoker.push(this.createLeaveOtherRoomCommand(u,!0,l))]:[3,2];case 1:c.sent(),c.label=2;case 2:return delete this._PKInfo[a],this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:s})),this._callAppListener("onFinishOtherRoom",s),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onRecvPKMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content;switch(e.messageType){case St.PK_INVITE:this._onInvite(t);break;case St.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case St.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case St.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case St.PK_END:this._onPKEnd(t)}}}),Object.defineProperty(t.prototype,"registerRoomPKEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(t.prototype,"requestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:t,inviteeUserId:r,options:i}),a),e.validate("inviteeRoomId",t,e.notEmptyString,!0)&&e.validate("inviteeUserId",r,e.notEmptyString,!0)?(s=Yn(),u=!e.isBoolean(null==i?void 0:i.autoMix)||(null==i?void 0:i.autoMix),l={inviteSessionId:s,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:u,inviteeRoomId:t,inviteeUserId:r,inviteeTimeoutTime:this._inviteTimeout,extra:(null==i?void 0:i.extra)||""},d={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:r,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(l),inviteSessionId:s},[4,this._context.requestRoomPK(d)]):(this._logger.error(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(_=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:_}),a),[2,{code:_}]):(this._PKInfo[t]={inviteSessionId:s,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:u,inviteeRoomId:t},this._logger.info(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"cancelRequestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:t,inviteeUserId:r,extra:i}),a),e.validate("inviteeRoomId",t,e.notEmptyString,!0)&&e.validate("inviteeUserId",r,e.notEmptyString,!0)?this._PKInfo[t]?(s={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:t,inviteeUserId:r,extra:i||""},u={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:r,inviteSessionId:this._PKInfo[t].inviteSessionId,inviteInfo:JSON.stringify(s)},[4,this._context.cancelRoomPK(u)]):(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"The request to connect with ".concat(r," user in room ").concat(t," is not initiated")}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(l=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:l}),a),[2,{code:l}]):(this._logger.info(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),a),delete this._PKInfo[t],[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"responseJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,R,b;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:t,inviterUserId:r,agree:i,options:a}),s),e.validate("inviterRoomId",t,e.notEmptyString,!0)&&e.validate("inviterUserId",r,e.notEmptyString,!0)?this._PKInfo[t]?(u=this._PKInfo[t],l=u.inviteSessionId,d=u.inviterUserAutoMix,_=!e.isBoolean(null==a?void 0:a.autoMix)||(null==a?void 0:a.autoMix),p={inviteSessionId:l,inviterRoomId:t,inviterUserId:r,inviterUserAutoMix:d,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:_},f=Object.assign(p,{inviterUserAutoMix:d}),h=i?Object.assign(p,{MultiRoomKey:"".concat(t,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(f)}):p,!e.isUndefined(null==a?void 0:a.extra)&&Object.assign(h,{extra:a.extra}),R={agree:i,roomId:this._mainRoomId,inviteSessionId:l,inviteRoomId:t,inviteUserId:r,content:JSON.stringify(h),key:"".concat(t,"|").concat(this._mainRoomId),value:JSON.stringify(p)},[4,this._context.responseRoomPK(R)]):(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"User ".concat(r," in room ").concat(t," did not send a request for connection")}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(b=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:b}),s),[2,{code:b}]):(this._logger.info(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),s),this._PKInfo[t].inviteeUserAutoMix=_,[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"joinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:t}),r),e.validate("roomId",t,e.notEmptyString,!0)?this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),r),[2,{code:exports.RCRTCCode.SIGNAL_DISCONNECTED}]):this._joinedPKRooms[t]?(this._logger.warn(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):(i=exports.RCLivingType.VIDEO,a={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},[4,(s=new hs(this._context,this._runtime,t,this._service,this._initOptions,i,!1,!1,this._clientSessionId)).__innerInit(exports.RTCMode.LIVE,void 0,i,a)]):(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:u}),r),[2,{code:u}]):(this._joinedPKRooms[t]=s,[4,this._onJoinedPKRoom(t,r)]);case 2:return c.sent(),this._logger.info(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),r),[2,{room:s,code:exports.RCRTCCode.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}]}}))}))}}),Object.defineProperty(t.prototype,"leaveOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){return r=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,r),[2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,r))]}))}))}}),Object.defineProperty(t.prototype,"getPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._PKInfo[e]}}),Object.defineProperty(t.prototype,"getAllPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._PKInfo}}),Object.defineProperty(t.prototype,"getJoinedPKRooms",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._joinedPKRooms}}),t}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(as||(as={}));var ls,ds=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"enable",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.ENABLE_INNER_CDN},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=t.context,u=this.enable,a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:r.roomId,enable:u})),r.isMainRoom?e.isBoolean(u)?(r.setCDNEnabel(u),l={version:2,output:{inCDNModel:u?as.OPEN:as.STOP}},[4,new rs(l,this.cdnValues).execute(t,r,i)]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> enable"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return(d=c.sent().code)!==exports.RCRTCCode.SUCCESS?(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:d,msg:"signal error"})),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(_=r.getCDNUris())&&_.broadcast!==Ko.SPREAD?(a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.SUCCESSED,enable:u})),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,fa(s,r)];case 2:return(p=c.sent().code)===exports.RCRTCCode.SUCCESS?(a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.SUCCESSED,enable:u})),[2,{code:exports.RCRTCCode.SUCCESS}]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:p})),[2,{code:p}])}}))}))}}),i}(ko);!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(ls||(ls={}));var _s,ps,fs=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return To.RTC_IDENTITY_CHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return s(this,void 0,void 0,(function(){var o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return[4,t.context.rtcIdentityChange(r.roomId,ls.ViewerToAnchor,this.livingType)];case 1:return o=c.sent(),a=o.code,s=o.data,a===e.ErrorCode.SUCCESS&&s?(r.initWithRoomData(s,this.traceId),r.getResourcesByUserId(r.crtUserId).length>0&&i.push(new Vo),(u=null===(n=s.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&r.setCDNUris(JSON.parse(u)[0]),[2,{code:a,data:s}]):[2,{code:a}]}}))}))}}),i}(ko),hs=function(t){function i(e,r,i,n,o,a,s,c,u){var l=t.call(this,e,r,i,exports.RTCMode.LIVE,n,o,s,c,u)||this;return Object.defineProperty(l,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:a}),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 os(l._executeCtx,l._invoker,l._isValidResourceId.bind(l)),l}return r(i,t),Object.defineProperty(i.prototype,"_initRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._store.isMainRoom){var r=(i=this._roomId,n=e.roomInfo,o={},n.forEach((function(e){var t=JSON.parse(e.value),r=t.inviterRoomId,n=t.inviteeRoomId;o[i===r?n:r]=JSON.parse(e.value)})),o);this._roomPKHandler=new us(this._invoker,r,this._context,this._runtime,this._service,this._initOptions,this,t.prototype._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var i,n,o}}),Object.defineProperty(i.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(r,i,a,u,l,d){return s(this,void 0,void 0,(function(){var s,_,p;return c(this,(function(c){switch(c.label){case 0:return e.validate("livingType",a,(function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO}))?[4,t.prototype.__innerInit.call(this,r,i,a,u,l,d)]:(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType"}),d),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return s=c.sent(),_=s.code,p=s.data,_===exports.RCRTCCode.SUCCESS&&p&&this._initRoomPKHandler(p),[2,{code:_,data:p}]}}))}))}}),Object.defineProperty(i.prototype,"__innerInitByIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a;return c(this,(function(s){switch(s.label){case 0:return[4,this._invoker.push(new fs(this._livingType,t))];case 1:return r=s.sent(),i=r.code,a=r.data,i===e.ErrorCode.SUCCESS&&a?(this._initRoomPKHandler(a),this._initWithRoomData(a.offlineKickTime),this._logger.info(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomData:a}),t)):this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:i}),t),[2,i]}}))}))}}),Object.defineProperty(i.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._store.isMainRoom?[2,t.prototype.publish.call(this,e)]:(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(i.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._store.isMainRoom?[2,t.prototype.unpublish.call(this,e)]:(this._logger.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(i.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=_t(e).userId,n=!!(null===(t=this._store.getResourcesByUserId(i))||void 0===t?void 0:t.find((function(t){return dt(t)===e}))),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==exports.RCRTCCode.SUCCESS||!s)return n;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach((function(e){u.push.apply(u,d([],l(e.getRemoteTracks()),!1))})),r=u.some((function(t){return e===t.getTrackId()})),n||r}}),Object.defineProperty(i.prototype,"getLivingType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._livingType}}),Object.defineProperty(i.prototype,"getMCUConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(n.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(i.prototype,"enableInnerCDN",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new ds(this._mcuConfigBuilder.__innerGetValues(),e))]}))}))}}),Object.defineProperty(i.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n,o){return s(this,void 0,void 0,(function(){return c(this,(function(a){return t.prototype._resourceHandle.call(this,e,r,i,n,o),[2]}))}))}}),Object.defineProperty(i.prototype,"__getCDNEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return!!(null===(e=this._store.getCDNUris())||void 0===e?void 0:e.enableInnerCDN)}}),Object.defineProperty(i.prototype,"__getCDNPushMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._store.getCDNUris())||void 0===e?void 0:e.push_mode}}),Object.defineProperty(i.prototype,"_onJoinedPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._invoker.push(new ss(e,this._roomPKHandler,t)),[2]}))}))}}),Object.defineProperty(i.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];if(!this.isMainRoom()||!this._roomPKHandler)return e;var t=this._roomPKHandler.getJoinedPKRooms();for(var r in t){var i=t[r].getSessionId(),n=this._roomPKHandler.getPKInfo(r);if(n){var o=n.inviterUserAutoMix,a=n.inviteeUserAutoMix,s=n.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:r,sessionId:i,autoMix:c?!!o:!!a})}}return e}}),Object.defineProperty(i.prototype,"getRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?(this._logger.info(n.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:o.SUCCESSED})),{code:exports.RCRTCCode.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(n.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:o.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})}}),Object.defineProperty(i.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t;return c(this,(function(r){for(t in e=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(e[t]);return this._logger.info(n.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:o.SUCCESSED,roomIds:Object.keys(e)})),[2]}))}))}}),Object.defineProperty(i.prototype,"isMainRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom}}),i}(ts),Rs=function(e){function t(t,r,i,n,o,a,s){return void 0===a&&(a=exports.RTCMode.RTC),void 0===s&&(s=!1),e.call(this,t,r,i,a,n,o,!1,!1,Yn(),s)||this}return r(t,e),t}(ts),bs=function(){function 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})}return Object.defineProperty(e.prototype,"checkToStart",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t,r,i,n,o;return c(this,(function(a){switch(a.label){case 0:if(0===this.queue.length||this.locked)return[2];this.locked=!0,e=this.queue.shift(),t=e.resolve,r=e.task,i=e.reject,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r()];case 2:return n=a.sent(),t(n),[3,4];case 3:return o=a.sent(),i(o),[3,4];case 4:return this.locked=!1,this.checkToStart(),[2]}}))}))}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=new Promise((function(t,i){r.queue.push({resolve:t,task:e,reject:i})}));return this.checkToStart(),i}}),e}(),gs=new bs,ms=function(e,t){return void 0===t&&(t=""),gs.push(e,t)},Cs=function(){function t(e,t,r){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),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:Yn()}),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 to(t,e,r.mediaServer),this._logger=this._context.logger,this._store=new Bo(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,exports.RTCMode.LIVE)}return Object.defineProperty(t.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o;return c(this,(function(a){switch(a.label){case 0:return r=this._crtUserId,this._rtcToken?[3,2]:[4,this._context.getRTCToken(r,exports.RTCMode.LIVE,t)];case 1:if(i=a.sent(),n=i.code,o=i.data,n!==e.ErrorCode.SUCCESS)return[2,{code:exports.RCRTCCode.SIGNAL_ERROR}];this._rtcToken=o.rtcToken,a.label=2;case 2:return[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}}]}}))}))}}),Object.defineProperty(t.prototype,"_clearSubscribeInfo",{enumerable:!1,configurable:!0,writable:!0,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}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return this._fromRetry=!0,[4,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny)];case 1:return(t=r.sent().code)===exports.RCRTCCode.SUCCESS&&(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer()),[2,{code:t}]}}))}))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var n=this;return c(this,(function(o){return[2,ms((function(){return n.__subscribe(e,t,r,i)}),"audience-client-sub")]}))}))}}),Object.defineProperty(t.prototype,"__subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){var u;return void 0===a&&(a=!1),s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,R,b,g,m,C,v,T=this;return c(this,(function(c){switch(c.label){case 0:return this._logger.info(n.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:t,livingType:r,mediaType:i,subTiny:a})),s=[],yt(this._context.getNaviInfo())?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"})),[2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,tracks:s}]):(!this._fromRetry&&(null===(u=this._pc)||void 0===u||u.clearReTryExchangeTimer()),this._fromRetry=!1,e.isString(t)?[exports.RCLivingType.AUDIO,exports.RCLivingType.VIDEO].includes(r)?[exports.RCMediaType.AUDIO_ONLY,exports.RCMediaType.VIDEO_ONLY,exports.RCMediaType.AUDIO_VIDEO].includes(i)?this._liveUrl&&this._liveUrl!==t?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),[2,{code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s}]):(this._pc||(this._pc=new No(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,this._store,void 0,!1),this._pc.on(No.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.registerReportListener(this._reportListener),this._pc.__reportR3R4ToPolaris()),this._liveUrl=t,[4,this._getReqHeaders(r)]):(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(i)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]):(this._logger.error("livingType is invalid: ".concat(r)),this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType: ".concat(r)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]):(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(t)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]));case 1:return l=c.sent(),d=l.code,_=l.headers,d!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:d,msg:"getRTCToken failed"})),[2,{code:d,tracks:s}]):(p="rc_mcu_".concat(Date.now()),f="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new it(this._logger,f,p),new nt(this._logger,f,p)),this._pc.updateSubRemoteTracks(this._subTracks.slice())),[4,this._pc.createOffer(!0)]);case 2:return h=c.sent(),R={sdp:h,liveUrl:t,mediaType:i,simulcast:a?$n.TINY:$n.NORMAL,switchstream:!1},[4,this._service.broadcastSubscribe(_,R)];case 3:return(b=c.sent()).code!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:b.code})),[2,{code:b.code,tracks:s}]):(g=b.data).resultCode!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:g.resultCode,msg:g.message})),[2,{code:g.resultCode,tracks:s}]):(this._livingType=r,this._mediaType=i,this._subTiny=a,m=g.sdp,C=g.subscribedList,this._subscribedList=C,v=[],C.forEach((function(e){var t=e.mediaType,r=T._subTracks[t];v.push(r),r.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(m.sdp),v&&this._updateTrackIdSSRCMap(m.sdp,v),this._logger.info(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,liveUrl:t})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:v}])}}))}))}}),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;t.forEach((function(t){var i=t.getTrackId(),n=_t(i).mediaType,o=r._subscribedList.filter((function(e){return e.mediaType===n}))[0].msid,a=ma(e,o,n);r._store.setTrackIdSSRCMap(Number(a),i)}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,ms((function(){return e.__unsubscribe()}),"audience-client-unsub")]}))}))}}),Object.defineProperty(t.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return s(this,void 0,void 0,(function(){var t,r;return c(this,(function(i){switch(i.label){case 0:return this._logger.info(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T,JSON.stringify({liveUrl:this._liveUrl})),null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl?[4,this._getReqHeaders()]:(this._logger.warn(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return t=i.sent().headers,[4,this._service.broadcastExit(t)];case 2:return(r=i.sent().code)!==exports.RCRTCCode.SUCCESS?this._logger.error(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:r})):(this._logger.info(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"registerTrackEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=e.receiver.track,o="audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY,a=this._subTracks[o];a.__innerSetMediaStreamTrack(i);try{this._logger.info(n.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(a.getTrackId())),null===(r=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===r||r.call(t,a)}catch(e){this._logger.error(n.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}),t}();exports.RCInnerCDNPullKind=void 0,(_s=exports.RCInnerCDNPullKind||(exports.RCInnerCDNPullKind={})).RTMP="rtmp",_s.FLV="flv",_s.HLS="hls",exports.RCInnerCDNPullIsHttps=void 0,(ps=exports.RCInnerCDNPullIsHttps||(exports.RCInnerCDNPullIsHttps={}))[ps.NOT_HTTPS=0]="NOT_HTTPS",ps[ps.HTTPS=1]="HTTPS";var vs,Ts=a(a({},bt(exports.RCResolution.W176_H144)),{frameRate:Ct(exports.RCFrameRate.FPS_15)}),Os=function(){function t(e,t,r,i,n,o,a){void 0===a&&(a=Yn());var u=this;Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:a}),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 Va(this._context,this._runtime,this._roomId,this,Ua.Audience),this._reportMediaActionLogger=new ja(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new to(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var l=this._store=new Bo(this._logger,a,e.getAppkey(),i,this._crtUserId,exports.RTCMode.LIVE),d=this._pc=new No(this._context,this._logger,this._reTryExchange.bind(this),this._crtUserId,l,this._polarisReport,!0);this._audioLevelReport=new wo(this._store,d),d.on(No.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener((function(e){return s(u,void 0,void 0,(function(){var t,r,i,n;return c(this,(function(o){return t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,n=t.roomId,1===i&&this._startPull(n,r),[2]}))}))})),this._setInitData()}return Object.defineProperty(t.prototype,"_startPull",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return this._isPulling?[2]:(this._isPulling=!0,this._pullTime>r?(this._isPulling=!1,[2]):(i=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),i),[4,this._context.pullRTCRoomEntry(t)]));case 1:return a=c.sent(),s=a.code,u=a.data,s===e.ErrorCode.SUCCESS&&(this._isPulling=!1,this._pullTime=(null==u?void 0:u.syncTime)||0,l=(null==u?void 0:u.kvEntries)||[],this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(o.SUCCESSED,", kvEntries: ").concat(JSON.stringify(l)),i),this.singalDataChange(l,t,i)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(o.FAILED,", code: ").concat(s),i),[2]}}))}))}}),Object.defineProperty(t.prototype,"_setInitData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(e,t,r){var i=t.filter((function(e){return"RC_RTC_SESSIONID"===e.key}))[0],n=i?i.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 i=t.mediaType,n=t.tag,o=i===exports.RCMediaType.AUDIO_ONLY?new it(r,n,"",e):new nt(r,n,"",e);c.push(o)}));var u=[],_=[];a.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,d([],l(t),!1)),t.forEach((function(e){var t=e.mediaType,i=e.tag,n=e.msid.split("_");n.pop();var o=n.join("_"),a=t===exports.RCMediaType.AUDIO_ONLY?new it(r,i,o):new nt(r,i,o);_.push(a)}))}));var p=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:n,remoteUserIds:o||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:_,remoteMCUTracks:c,remoteTracks:d(d([],l(_),!1),l(c),!1),CDNUris:p||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),r=t.sessionId,i=t.remoteUserIds,n=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=r,this._roomAnchorList=i,a.forEach((function(t){e._remoteTracks[t.getTrackId()]=t})),this._CDNUris=s,n.forEach((function(t){var r=t.msid.split("_")[0];e._roomAnchorRes[r]?e._roomAnchorRes[r].push(t):e._roomAnchorRes[r]=[t];var i=JSON.parse(t.uri),n=i.ssrc,o=i.resourceId;e._store.setTrackIdSSRCMap(n,o)})),o.forEach((function(t){var r=t.mediaType,i=t.tag,n=[e._roomId,i,r].join("_");e._roomRes[n]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,n)})),n.forEach((function(t){var r=dt(t);e._roomRes[r]=t}))}}),Object.defineProperty(t.prototype,"_assertRoomDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this._destroyed)return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}}),Object.defineProperty(t.prototype,"singalDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,a=this;if(t===this._roomId){var s=[],c=null===(i=e.filter((function(e){return"RC_CDN"===e.key}))[0])||void 0===i?void 0:i.value;c&&this._diffCDNUris(JSON.parse(JSON.parse(c).cdn_uris)[0],r),e.forEach((function(e){var t=e.key,i=e.value,n=e.uid;if(-1!==t.indexOf("RC_RES_")){var o=JSON.parse(i||"{}"),c=JSON.parse(o.mcu_uris||"[]"),u=JSON.parse(o.uris||"[]");return s.push.apply(s,d([],l(c),!1)),void a._diffAnchorResource(u,n,r)}if("RC_ANCHOR_LIST"===t){var _=JSON.parse(i||"[]");a._diffAnchorList(_,r)}})),this._diffRoomResource(s,r)}else this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:o.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),r)}}),Object.defineProperty(t.prototype,"_diffAnchorList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=e.filter((function(e){return r._roomAnchorList.indexOf(e)<0})),n=this._roomAnchorList.filter((function(t){return e.indexOf(t)<0}));i.length>0&&this._handleNewJoinedAnchor(i,t),n.length>0&&this._handleLeftedAnchor(n,t)}}),Object.defineProperty(t.prototype,"_handleNewJoinedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;(r=this._roomAnchorList).push.apply(r,d([],l(e),!1)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}}),Object.defineProperty(t.prototype,"_handleLeftedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i=this;return c(this,(function(o){switch(o.label){case 0:return this._roomAnchorList=this._roomAnchorList.filter((function(t){return!e.includes(t)})),r=[],e.forEach((function(e){r.push.apply(r,d([],l(i.getRemoteTracksByUserId(e)),!1)),delete i._roomAnchorRes[e]})),r.length?[4,this.unsubscribe(r)]:[3,2];case 1:o.sent(),r.forEach((function(e){return delete i._remoteTracks[e.getTrackId()]})),o.label=2;case 2:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e),[2]}}))}))}}),Object.defineProperty(t.prototype,"_diffRoomResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o,a=this;return c(this,(function(s){return r=[],i=[],o=[],e.forEach((function(e){var t=dt(e),i=_t(t),n=i.tag,s=i.mediaType,c=[a._roomId,n,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 it(a._logger,n,"",a._roomId):new nt(a._logger,n,"",a._roomId);r.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])})),r.length>0&&(this._logger.info(n.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),[2]}))}))}}),Object.defineProperty(t.prototype,"_dealPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return i=e.map(dt),a=[],s=[],t.forEach((function(t){var r=dt(t),n=i.indexOf(r),o=_t(r),c=o.userId,u=o.tag,l=o.mediaType,_=JSON.parse(t.uri).ssrc;d._store.setTrackIdSSRCMap(_,r),n>-1?e[n]=t:e.push(t);var p=d._remoteTracks[r];d._roomRes[r]=t,p?p.isSubscribed()&&a.push(p):(p=l===exports.RCMediaType.AUDIO_ONLY?new it(d._logger,u,c):new nt(d._logger,u,c),d._remoteTracks[r]=p,s.push(p)),p.__innerSetRemoteMuted(0===t.state)})),a.length?(u=a.map((function(e){return e.getTrackId()})),[4,ms((function(){return d._subscribeHandle(a,!0)}))]):[3,2];case 1:(l=c.sent().code)!==exports.RCRTCCode.SUCCESS&&this._logger.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:o.FAILED,trackIds:u,code:l})),c.label=2;case 2:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:s.map((function(e){return e.getTrackId()}))}),r),this._callAppListener("onAnchorTrackPublish",s),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c(this,(function(c){switch(c.label){case 0:for(i=t.map(dt),n=e.length-1;n>=0;n-=1)o=e[n],i.includes(dt(o))&&e.splice(n,1);return a=t.map((function(e){var t=dt(e);return s._remoteTracks[t]})),[4,this._onUserUnpublish(a,"onAnchorTrackUnpublish",r)];case 1:return c.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModified",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,o,a=e.map(dt);try{for(var s=u(t),c=s.next();!c.done;c=s.next()){var l=c.value,d=dt(l);e[a.indexOf(d)].state=l.state;var _=this._remoteTracks[d];_.__innerSetRemoteMuted(0===l.state);var p=_.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:p,trackId:_.getTrackId()}),r),this._callAppListener(p,_)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}}),Object.defineProperty(t.prototype,"_diffAnchorResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),n=ht(i,e),o=n.publishedList,a=n.unpublishedList,s=n.modifiedList,o.length?[4,this._dealPublished(i,o,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return a.length?[4,this._dealUnpublished(i,a,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return s.length&&this._dealModified(i,s,r),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onUserUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i=this;return c(this,(function(o){switch(o.label){case 0:return[4,this.unsubscribe(e)];case 1:return o.sent(),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(n.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),[2]}}))}))}}),Object.defineProperty(t.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,ms((function(){return s(e,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return[4,this._createSubscribeParams(this._subscribedList,{},!0)];case 1:return e=c.sent().reqBody,[4,this._exchangeHandle(e)];case 2:return(t=c.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(r=t.data,i=r.sdp,(n=r.resultCode)!==exports.RCRTCCode.SUCCESS?[2,{code:n}]:(this._pc.clearReTryExchangeTimer(),(o=this._subscribedList.filter((function(e){return e.track.isMCUTrack()}))).length>0&&(a=o[0].track.getTrackId(),s=null===(l=this._roomRes[a])||void 0===l?void 0:l.msid,u=[this._roomId,"RongCloudRTC"].join("_"),i.sdp=i.sdp.replace(new RegExp(s,"g"),u)),[4,this._pc.setRemoteAnswer(i.sdp)]));case 3:return[2,{code:c.sent()}]}}))}))}),"audience-retry-exchange")]}))}))}}),Object.defineProperty(t.prototype,"_createSubscribeParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return[4,this._pc.createOffer(r)];case 1:return i=s.sent(),n={resolutionInfo:[]},o={min:0,max:0},Object.keys(t).forEach((function(e){var r=t[e];[r.mediaStream,r.tinyStream].forEach((function(t,r){var a,s=1===r?[e,"tiny"].join("_"):e;i.sdp=null===(a=i.sdp)||void 0===a?void 0:a.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===r,l=u?ut(c):Ts,d=l.width,_=l.height,p=l.frameRate;n.resolutionInfo.push({trackId:c.id,simulcast:u?$n.NORMAL:$n.TINY,resolution:"".concat(d,"x").concat(_)});var f=De(d,_),h=Ue(p);o.min+=f.minBitrate*h,o.max+=f.maxBitrate*h}}))})),[2,{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?$n.TINY:$n.NORMAL,resolution:"",uri:a._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:o,offer:i}]}}))}))}}),Object.defineProperty(t.prototype,"_subscribeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var s,u,l,d,_,p;return c(this,(function(c){return s=Date.now(),u=i?aa.SUB:void 0,l=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:t.map(At),forceReq:r}),l),this._assertRoomDestroyed()?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),l),this._reportPubOrSubQualityData(s,t,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,u),[2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}]):e.validate("tracks",t,(function(){return e.isArray(t)&&t.length>0&&t.every((function(e){return e instanceof rt||e.track instanceof rt}))}),!0)?(this._pc.__reportR3R4ToPolaris(),this._pc.registerReportListener(this._reportListener),this._addPeerCEvent(),d=this._subscribedList.map((function(e){return a({},e)})),_=t.map((function(e){return e instanceof rt?{track:e}:e})),p=[],_.forEach((function(e){var t=e.track.getTrackId();p.push(t);var r=d.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:d.push(e))})),this._polarisReport.sendR2(Go.SUBSCRIBE,Ho.BEGIN,p),[2,this._updateSubListHandle(d,l,s,u,!0)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),l),this._reportPubOrSubQualityData(s,t,exports.RCRTCCode.PARAMS_ERROR,u),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_addPeerCEvent",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._pc.on(No.__INNER_EVENT_TRACK_READY__,(function(t){var r=t.streams[0].id,i=t.receiver.track,o=[r,"audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=e._remoteTracks[o];a?(a.__innerSetMediaStreamTrack(i),e._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:a.getTrackId()})),e._callAppListener("onTrackReady",a)):e._logger.warn(n.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(i.id))})),this._pc.once(No.__INNER_ICE_CONNECTED__,(function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")}),this),this._pc.on(No.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,i=t.time,n=t.iceCandidatePair;n&&e._reportMediaActionLogger.recordQualityIceStatusData(n,r,i)}))}}),Object.defineProperty(t.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,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}}}),Object.defineProperty(t.prototype,"_exchangeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}}),Object.defineProperty(t.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,a=this,s=null==t?void 0:t.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),c=e.filter((function(e){if(e.track.isMCUTrack()){var t=a._roomRes[e.track.getTrackId()],r="".concat(t.msid,"_").concat(t.mediaType);return s.includes(r)}return null==s?void 0:s.includes(e.track.getTrackId())})),u=null==c?void 0:c.map((function(e){return"".concat(e.track.getTrackId())})),_=e.filter((function(e){return!(null==u?void 0:u.includes(e.track.getTrackId()))})),p=function(e){var t=c.some((function(t){return t.track.getTrackId()===e}));f._remoteTracks[e].__innerSetSubscribed(t)},f=this;for(var h in this._remoteTracks)p(h);return(i=this._subscribedList).splice.apply(i,d([0,this._subscribedList.length],l(c),!1)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.SUCCESSED,subSuccessTrackIds:s,failedList:_}),r),_}}),Object.defineProperty(t.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.map((function(e){return e instanceof rt?{track:e}:a({},e)})),r={};return t=t.filter((function(e){var t=e.track.getTrackId();return!r[t]&&(r[t]=!0,!0)})).map((function(e){return a({},e)}))}}),Object.defineProperty(t.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){i&&this._reportMediaActionLogger.reportPubOrSubQualityData(i,e,t,r,this._trackMediaMap)}}),Object.defineProperty(t.prototype,"_updateSubListHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,u){var l;return void 0===u&&(u=!1),s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R,b,g,m,C,v,T=this;return c(this,(function(c){switch(c.label){case 0:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(At),forceReq:u}),t),s=this._getParams(e),d=this._subscribedList.map((function(e){return a({},e)})),u||Ca(s,d)?(this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(s.map((function(e){return e.track}))),[4,this._createSubscribeParams(s,{},!1)]):(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.SUCCESSED,msg:"repeat subscribe"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return _=c.sent().reqBody,[4,this._exchangeHandle(_)];case 2:return p=c.sent(),d.length&&(f=[],d.forEach((function(e){f.push(e.track.getTrackId())})),null===(l=this._pc.reportParser)||void 0===l||l.clearLatestPacketsRecv(f)),e.forEach((function(e){var t=e instanceof rt?e.getTrackId():e.track.getTrackId();T._trackMediaMap[t]=p.qualityMsList||[]})),p.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(r,e,p.code,i),this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:p.code}),t),[2,{code:p.code}]):(h=p.data,R=h.sdp,b=h.resultCode,g=h.message,m=h.subscribedList,b!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(r,e,b,i),this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:b,msg:g}),t),[2,{code:b}]):(s.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var r=T._roomRes[t.getTrackId()].msid,i=_t(t.getTrackId()),n=i.tag,o=[i.userId,n].join("_");R.sdp=R.sdp.replace(new RegExp(r,"g"),o)}})),[4,this._pc.setRemoteAnswer(R.sdp)]));case 3:return C=c.sent(),this._reportPubOrSubQualityData(r,e,C,i),C!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:C,msg:"set remote answer error"}),t),[2,{code:C}]):[2,(v=this._dealSubscribeResult(s,m,t)).length?{code:exports.RCRTCCode.SUCCESS,failedList:v}:{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_diffCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o;return c(this,(function(a){return this._CDNUris.url&&!e.url?(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoDisable"}),t),this._callAppListener("onCDNInfoDisable"),this._CDNUris=e,[2]):((!this._CDNUris||!this._CDNUris.url&&e.url)&&(this._logger.info(n.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(n.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,[2])}))}))}}),Object.defineProperty(t.prototype,"_getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l,d,_,p,f,h,R,b,g,m,C;return c(this,(function(c){switch(c.label){case 0:return r=e.w,i=e.h,a=e.fps,s=this._initOptions.pullInnerCDNProtocol||exports.RCInnerCDNPullKind.FLV,u=this._initOptions.pullInnerCDNUseHttps===exports.RCInnerCDNPullIsHttps.NOT_HTTPS?exports.RCInnerCDNPullIsHttps.NOT_HTTPS:exports.RCInnerCDNPullIsHttps.HTTPS,this._CDNUris.url?(l={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},d=[],_=this._CDNUris,p=_.w,f=void 0===p?0:p,h=_.h,f/(void 0===h?1:h)>1?(r&&d.push("w=".concat(r)),i&&d.push("h=".concat(i))):(r&&d.push("h=".concat(r)),i&&d.push("w=".concat(i))),a&&d.push("fps=".concat(a)),d.push("kind=".concat(s)),d.push("is_https=".concat(u)),R=d.join("&"),b="".concat(this._CDNUris.url,"?"),R&&(b+=R),[4,this._service.getCDNResourceInfo(l,b,t)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),[2,{code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY}]);case 1:return g=c.sent(),m=g.code,C=g.res,m!==exports.RCRTCCode.SUCCESS?[2,{code:m}]:[2,{code:m,CDNPlayUrl:null==C?void 0:C.data.pull_url}]}}))}))}}),Object.defineProperty(t.prototype,"getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){return r=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),r),e&&!gt(e)?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> resolution"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):t&&!mt(t)?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> fps"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(i=e?bt(e):{width:null,height:null},a=i.width,s=i.height,u=t?Ct(t):null,l={},a&&(l.w=a),s&&(l.h=s),u&&(l.fps=u),[2,this._getCDNPlayUrl(l,r)])}))}))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,ms((function(){return t._subscribeHandle(e,!1,!0)}),"audience-sub")]}))}))}}),Object.defineProperty(t.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,s,u;return c(this,(function(c){return r=Date.now(),i=aa.UNSUB,s=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:t.map((function(e){return e.getTrackId()}))}),s),this._assertRoomDestroyed()?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),[2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}]):e.validate("tracks",t,(function(){return e.isArray(t)&&t.length>0&&t.every((function(e){return e instanceof rt}))}),!0)?(u=this._subscribedList.map((function(e){return a({},e)})).filter((function(e){return t.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),this._polarisReport.sendR2(Go.SUBSCRIBE,Ho.END,t.map((function(e){return e.getTrackId()}))),[2,this._updateSubListHandle(u,s,r,i,!1)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,ms((function(){return t.__unsubscribe(e)}),"audience-unsub")]}))}))}}),Object.defineProperty(t.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return s(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return this._destroyed?[2]:(this._destroyed=!0,e?[4,this._context.quitLivingRoomAsAudience(this._roomId)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[4,this._service.broadcastExit(this._getReqHeaders())];case 3:return r.sent(),null===(t=this._pc)||void 0===t||t.destroy(),this._context.registerRTCSignalListener(),[2]}}))}))}}),Object.defineProperty(t.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{}}}),Object.defineProperty(t.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,t),[4,this._context.joinLivingRoomAsAudience(this._roomId,exports.RTCMode.LIVE)];case 1:return r.sent().code!==e.ErrorCode.SUCCESS&&this._logger.error(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(o.FAILED),t),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(o.SUCCESSED),t),[2]}}))}))}}),Object.defineProperty(t.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(t.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(t.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtUserId}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(t.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomAnchorList}}),Object.defineProperty(t.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}}),Object.defineProperty(t.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[],r=[];for(var i in this._remoteTracks){if(2===r.length)break;var n=this._remoteTracks[i];n.isMCUTrack()&&r.push(n)}return this._roomAnchorList.forEach((function(r){t.push.apply(t,d([],l(e.getRemoteTracksByUserId(r)),!1))})),d(d([],l(r),!1),l(t),!1)}}),Object.defineProperty(t.prototype,"getRemoteRTCTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()||e.push(r)}return e}}),Object.defineProperty(t.prototype,"getRemoteMCUTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()&&e.push(r)}return e}}),Object.defineProperty(t.prototype,"getCDNInfo",{enumerable:!1,configurable:!0,writable:!0,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}}}),Object.defineProperty(t.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),t}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(vs||(vs={}));var Ss,Es,Is=function(){function t(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),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=e.logger}return Object.defineProperty(t.prototype,"_getMediaStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t="getUserMedia"),s(this,void 0,void 0,(function(){var r,i,o;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=this.setConstraintsConfig(e),[4,navigator.mediaDevices[t](r)];case 1:return i=a.sent(),[2,{code:exports.RCRTCCode.SUCCESS,stream:i}];case 2:return o=a.sent(),this._logger.error(n.L_GET_MEDIA_STREAM_E,JSON.stringify({name:o.name,message:o.message})),"Permission denied"===o.message?[2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED}]:"Permission denied by system"===o.message?[2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED}]:[3,3];case 3:return[2,{code:"getUserMedia"===t?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED}]}}))}))}}),Object.defineProperty(t.prototype,"_getMediaStreamErrorReason",{enumerable:!1,configurable:!0,writable:!0,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}}),Object.defineProperty(t.prototype,"setConstraintsConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;if((null==e?void 0:e.audio)&&!this._isElectron){"boolean"==typeof e.audio&&(e.audio={});var i=null===(r=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===r?void 0:r.call(t);(null==i?void 0:i.noiseSuppression)&&(e.audio.noiseSuppression=!!i.noiseSuppression),(null==i?void 0:i.autoGainControl)&&(e.audio.autoGainControl=!!i.autoGainControl),(null==i?void 0:i.echoCancellation)&&(e.audio.echoCancellation=!!i.echoCancellation),this._logger.info(n.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(i)))}return e}}),Object.defineProperty(t.prototype,"createMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return st(e)?(r=this._context.getCurrentId())?[4,this._getMediaStream({audio:{deviceId:(null==t?void 0:t.micphoneId)?{exact:null==t?void 0:t.micphoneId}:void 0,sampleRate:null==t?void 0:t.sampleRate,noiseSuppression:null==t?void 0:t.noiseSuppression,echoCancellation:null==t?void 0:t.echoCancellation,autoGainControl:null==t?void 0:t.autoGainControl}})]:(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return i=c.sent(),a=i.stream,(s=i.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:s,msg:this._getMediaStreamErrorReason(s)})),[2,{code:s}]):(u=a.getAudioTracks()[0],l=new Xe(this._logger,e,r,u),this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:l.getTrackId()})),[2,{code:s,track:l}])}}))}))}}),Object.defineProperty(t.prototype,"createCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var r,i,a,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return st(e)?(r=this._context.getCurrentId())?(i=gt(null==t?void 0:t.resolution)?t.resolution:exports.RCResolution.W640_H480,a=bt(i),s=a.width,u=a.height,[4,this._getMediaStream({video:{deviceId:(null==t?void 0:t.cameraId)?{exact:null==t?void 0:t.cameraId}:void 0,frameRate:Ct((null==t?void 0:t.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:s,max:s},height:{ideal:u,max:u},facingMode:null==t?void 0:t.faceMode}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return l=c.sent(),d=l.stream,(_=l.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:_,msg:this._getMediaStreamErrorReason(_)})),[2,{code:_}]):(p=d.getVideoTracks()[0],[4,this._applyVideoAspectRatio(p,s,u)]);case 2:return c.sent(),f=new $e(this._logger,e,r,p),this._logger.info(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:f.getTrackId()})),[2,{code:_,track:f}]}}))}))}}),Object.defineProperty(t.prototype,"createMicrophoneAndCameraTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p,f,h,R,b,g,m;return c(this,(function(c){switch(c.label){case 0:return i=[],st(e)?(a=this._context.getCurrentId())?(s=gt(null===(r=null==t?void 0:t.video)||void 0===r?void 0:r.resolution)?t.video.resolution:exports.RCResolution.W640_H480,u=bt(s),l=u.width,d=u.height,_=null==t?void 0:t.audio,p=null==t?void 0:t.video,[4,this._getMediaStream({video:{deviceId:(null==p?void 0:p.cameraId)?{exact:null==p?void 0:p.cameraId}:void 0,frameRate:Ct((null==p?void 0:p.frameRate)||exports.RCFrameRate.FPS_15),width:{ideal:l,max:l},height:{ideal:d,max:d},facingMode:null==p?void 0:p.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}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:i}]);case 1:if(f=c.sent(),h=f.stream,(R=f.code)!==exports.RCRTCCode.SUCCESS)return this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:R,msg:this._getMediaStreamErrorReason(R)})),[2,{code:R,tracks:i}];b=h.getTracks(),g=0,c.label=2;case 2:return g<b.length?"video"!==(m=b[g]).kind?[3,4]:[4,this._applyVideoAspectRatio(m,l,d)]:[3,6];case 3:return c.sent(),i.push(new $e(this._logger,e,a,m)),[3,5];case 4:i.unshift(new Xe(this._logger,e,a,m)),c.label=5;case 5:return g++,[3,2];case 6:return this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:i.map((function(e){return e.getTrackId()}))})),[2,{code:R,tracks:i}]}}))}))}}),Object.defineProperty(t.prototype,"createScreenVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return[4,this._createScreenTracks(e,!1,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,t)];case 1:return(r=i.sent()).code===exports.RCRTCCode.SUCCESS?[2,{code:r.code,track:r.tracks[0]}]:[2,r]}}))}))}}),Object.defineProperty(t.prototype,"createScreenWithAudioTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),s(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this._createScreenTracks(e,!0,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,t)]}))}))}}),Object.defineProperty(t.prototype,"_createScreenTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p,f,h,R,b,g;return c(this,(function(c){switch(c.label){case 0:return st(e)?(a=this._context.getCurrentId())?Ot()?(s=/macintosh|mac os x/i.test(navigator.userAgent),u=(!this._isElectron||!s)&&t,l=gt(null==i?void 0:i.resolution)?i.resolution:exports.RCResolution.W1280_H720,this._isElectron?[4,this._createElectronScreenStream(t,r,l,null==i?void 0:i.chromeMediaSourceId)]:[3,2]):(this._logger.error(n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),[2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT}]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return f=c.sent(),[3,4];case 2:return[4,this._createWebScreenStream(t,l,null==i?void 0:i.frameRate)];case 3:f=c.sent(),c.label=4;case 4:return _=(d=f).stream,(p=d.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(r,JSON.stringify({status:o.FAILED,code:p,msg:this._getMediaStreamErrorReason(p)})),[2,{code:p}]):(h=_.getVideoTracks()[0],R=new et(this._logger,e,a,h),b=[R],u&&(g=_.getAudioTracks()[0])&&b.push(new tt(this._logger,e,a,g)),this._logger.info(r,JSON.stringify({status:o.SUCCESSED,trackIds:b.map((function(e){return e.getTrackId()}))})),[2,{code:p,tracks:b}])}}))}))}}),Object.defineProperty(t.prototype,"_createElectronScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){var a,u;return s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h;return c(this,(function(c){return s=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&s&&t&&this._logger.warn(r,JSON.stringify({status:o.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),l=(!this._isElectron||!s)&&t,!this._isElectron||e.isUndefined(n)||e.isString(n)?(d=bt(i),_=d.width,p=d.height,f={mandatory:{chromeMediaSourceId:n,chromeMediaSource:"desktop",minWidth:_,maxWidth:_,minHeight:p,maxHeight:p}},!n&&this._isElectron&&(null===(a=f.mandatory)||void 0===a||delete a.chromeMediaSourceId),h=null,l&&this._isElectron&&(null===(u=f.mandatory)||void 0===u||delete u.chromeMediaSourceId,h={mandatory:{chromeMediaSource:"desktop"}}),[2,this._getMediaStream({video:f,audio:h||l},"getUserMedia")]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_createWebScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a;return c(this,(function(s){return i=bt(t),n=i.width,o=i.height,a={frameRate:Ct(r||exports.RCFrameRate.FPS_15),width:n,height:o},[2,this._getMediaStream({video:a,audio:e},"getDisplayMedia")]}))}))}}),Object.defineProperty(t.prototype,"createLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){return st(e)?t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind?(r=this._context.getCurrentId())?(i=new ze(this._logger,e,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:i.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"createLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){return st(e)?t&&t instanceof MediaStreamTrack&&"video"===t.kind?(r=this._context.getCurrentId())?(i=new Ye(this._logger,e,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:i.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"_validateCreateLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!st(t))return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!Tt())return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var i=r instanceof File?URL.createObjectURL(r):r;return e.isHttpUrl(i)||/^blob:/.test(i)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:i}:(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}}),Object.defineProperty(t.prototype,"createLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){return s(this,void 0,void 0,(function(){var a,s,u=this;return c(this,(function(c){return(a=this._validateCreateLocalFileTracks(e,r)).code!==exports.RCRTCCode.SUCCESS?[2,a]:(s=this._context.getCurrentId(),[2,new Promise((function(r){var c=document.createElement("video");(null==i?void 0:i.withoutAudio)&&(c.muted=!0),c.onloadedmetadata=function(){var a,d=[];try{var _=c.mozCaptureStream?"mozCaptureStream":"captureStream";a=c[_]()}catch(e){u._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:d})}var p=l(t.getTracksWithOptions(a,i),2),f=p[0],h=p[1];f&&d.push(new Qe(u._logger,e,s,f,c)),h&&d.push(new Ze(u._logger,e,s,h,c)),0===d.length&&(c.pause(),c.src=""),c.onerror=null,u._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:d.map((function(e){return e.getTrackId()}))})),r({code:exports.RCRTCCode.SUCCESS,tracks:d})},c.onerror=function(){u._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.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:[]})},c.src=a.url,c.loop=!0,c.play()}))])}))}))}}),Object.defineProperty(t.prototype,"createLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){return s(this,void 0,void 0,(function(){var a,s,u,d,_;return c(this,(function(c){return a=[],st(e)?r instanceof MediaStream?(s=this._context.getCurrentId())?(u=l(t.getTracksWithOptions(r,i),2),d=u[0],_=u[1],d&&a.push(new ze(this._logger,e,s,d)),_&&a.push(new Ye(this._logger,e,s,_)),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:a.map((function(e){return e.getTrackId()}))})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:a}])}))}))}}),Object.defineProperty(t,"getTracksWithOptions",{enumerable:!1,configurable:!0,writable:!0,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}}),Object.defineProperty(t.prototype,"_applyVideoAspectRatio",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:if(i=e.getSettings(),s=i.width,u=i.height,s===t&&u===r)return[2];l=t/r>=1?{width:{ideal:s,max:s}}:{height:{ideal:u,max:u}},c.label=1;case 1:return c.trys.push([1,3,,4]),[4,e.applyConstraints(a(a({},l),{aspectRatio:{ideal:t/r}}))];case 2:return c.sent(),this._logger.info(n.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:o.SUCCESSED,msg:"apply aspectRatio success -> ".concat(t," / ").concat(r)})),[3,4];case 3:return d=c.sent(),this._logger.warn(n.L_RTC_CLIENT_APPLY_VIDEO_ASPECT_RATIO_O,JSON.stringify({status:o.FAILED,msg:"apply aspectRatio error -> ".concat(JSON.stringify(d))})),[3,4];case 4:return[2]}}))}))}}),t}(),ys=function(t){function i(e,r,i){var n=t.call(this,e)||this;return Object.defineProperty(n,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(n,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Eo.setSdpSemantics(i.sdpSemantics||"unified-plan",n._logger),n._service=new to(n._runtime,n._context,n._options.mediaServer,n._options.timeout),n._context.registerConnectionStateChangeListener(n._onIMStatusChange.bind(n)),n._context.registerDestroyListener(n._onIMUninit.bind(n)),n._context.registerMessageListener(n._handleMessage.bind(n)),n._context.getPluginContext().onnavidatachange=n.naviDataChange.bind(n),n}return r(i,t),Object.defineProperty(i.prototype,"_handleMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.conversationType!==e.ConversationType.RTC_ROOM)return!1;var r=this._logger.createTraceId();this._crtRoom instanceof hs&&this._getJoinedPKRoomList().forEach((function(e){e.__parseInnerMessage(t,r)}));return this._logger.info(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:o.SUCCESSED,message:t}),r),this._crtRoom?(this._crtRoom.__parseInnerMessage(t,r),!0):(this._logger.warn(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:o.FAILED,message:"the crtRoom is empty"}),r),!0)}}),Object.defineProperty(i.prototype,"naviDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.clearMSList(),this._service.isNededDetector()&&this._service.detectorMediaSever()}}),Object.defineProperty(i.prototype,"_getJoinedPKRoomList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,r=e.roomPKHandler;if(t===exports.RCRTCCode.SUCCESS&&r){var i=r.getJoinedPKRooms()||{};return Object.values(i)}return[]}}),Object.defineProperty(i.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(i.prototype,"joinCrossRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return void 0===n&&(n=exports.RTCMode.CROSS_MUTI),s(this,void 0,void 0,(function(){return c(this,(function(i){return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:exports.RTCMode.CROSS_MUTI})]}))}))}}),Object.defineProperty(i.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return void 0===n&&(n=exports.RTCMode.RTC),s(this,void 0,void 0,(function(){return c(this,(function(i){return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{mode:n,joinType:t,userData:r})]}))}))}}),Object.defineProperty(i.prototype,"joinRTCRoomWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s=this;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(i=this._crtRoom=new Rs(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt)).__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 1:return(a=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:a}]):(i.once(es,(function(){s._crtRoom=null})),[2,{code:a,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()}])}}))}))}}),Object.defineProperty(i.prototype,"joinLivingRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,a){return s(this,void 0,void 0,(function(){var a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:r,outerUserDatas:i}),a),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),a),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(s=this._crtRoom=new hs(this._context,this._runtime,e,this._service,this._options,t,!1,!0)).__innerInit(exports.RTCMode.LIVE,r,t,void 0,i,a)];case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:u}]):(s.once(es,(function(){d._crtRoom=null})),l={code:u,room:s,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},s.__getCDNPushMode()===vs.MANUAL&&Object.assign(l,{CDNEnable:s.__getCDNEnable()}),[2,l])}}))}))}}),Object.defineProperty(i.prototype,"getAudienceClient",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._audience||(this._audience=new Cs(this._context,this._runtime,this._options)),this._logger.info(n.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}}),Object.defineProperty(i.prototype,"_onIMStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(this._logger.info(n.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:t,code:r,desc:e.RCConnectionStatus[t]})),t===e.RCConnectionStatus.SUSPENDED&&r===e.ErrorCode.RC_CONN_REDIRECTED&&this._service.clearMSList(),t===e.RCConnectionStatus.DISCONNECTED){if(this._crtRoom){var i=exports.RCKickReason.IM_DISCONNECTED;r===e.ErrorCode.RC_DISCONN_KICK?i=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:2===r&&(i=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:i}]})}}else if(t===e.RCConnectionStatus.CONNECTED){if(this._service.isNededDetector()&&this._service.detectorMediaSever(),this._crtRoom instanceof hs)this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()}));this._crtRoom&&this._crtRoom.__onReconnected()}}}),Object.defineProperty(i.prototype,"_onIMUninit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._logger.info(n.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"TODO -> on IM client ondestroy"})),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}}),Object.defineProperty(i.prototype,"leaveRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),r),this._crtRoom?[4,this._crtRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:o.FAILED,msg:"Room does not exist, without leave"}),r),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return i.sent(),this._service.isNededDetector()&&this._service.detectorMediaSever(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomId:null===(t=this._crtRoom)||void 0===t?void 0:t.getRoomId()}),r),this._crtRoom=null,[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:t,livingType:r}),i),this._service.isNededDetector()&&this._service.detectorMediaSever(),yt(this._context.getNaviInfo())?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),i),[2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR}]):e.validate("roomId",t,e.notEmptyString,!0)&&e.validate("livingType",r,(function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO}))?this._crtAudienceLivingRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),i),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):this._service.getMsList().length?[4,this._context.joinLivingRoomAsAudience(t,exports.RTCMode.LIVE,r)]:(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),i),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]):(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),i),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return a=c.sent(),s=a.code,u=a.data,s!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:s,msg:"signal error -> audience join room"}),i),[2,{code:exports.RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}]):(l=Yn(),d=new Os(this._context,this._runtime,this._options,t,u,r,l),this._crtAudienceLivingRoom=d,this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.SUCCESSED,roomData:u}),i),[2,{room:d,code:exports.RCRTCCode.SUCCESS,userIds:d.getRemoteUserIds(),RTCTracks:d.getRemoteRTCTracks(),MCUTracks:d.getRemoteMCUTracks(),CDNUris:d.getCDNInfo()}])}}))}))}}),Object.defineProperty(i.prototype,"leaveLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e.getRoomId(),userId:this._context.getCurrentId()}),t),this._crtAudienceLivingRoom?this._crtAudienceLivingRoom!==e?(this._logger.error(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),t),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):[4,this._crtAudienceLivingRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,msg:"Room does not exist, without leave"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return r.sent(),this._crtAudienceLivingRoom=null,this._logger.info(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.SUCCESSED}),t),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"upgradeToAnchorRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l=this;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,r),e.validate("room",t,(function(){return t instanceof Os}),!0)?(i=t.getRoomId(),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:i}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(a=this._crtRoom=new hs(this._context,this._runtime,i,this._service,this._options,t.livingType,!0,!0,t.getClientSessionId())).__innerInitByIdentityChange(r)]):(this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(this._crtRoom=null,[2,{code:s}]):(a.once(es,(function(){l._crtRoom=null})),[4,this._crtAudienceLivingRoom.__destroy(!1)]);case 2:return c.sent(),this._crtAudienceLivingRoom=null,u={room:a,code:exports.RCRTCCode.SUCCESS,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()},a.__getCDNPushMode()===vs.MANUAL&&Object.assign(u,{CDNEnable:a.__getCDNEnable()}),[2,u]}}))}))}}),Object.defineProperty(i.prototype,"downgradeToAudienceRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:t._roomId,userId:this._context.getCurrentId()}),r),t.isMainRoom()?e.validate("room",t,(function(){return t instanceof hs}),!0)?this._crtAudienceLivingRoom?(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,this._context.rtcIdentityChange(t._roomId,ls.AnchorToViewer,t.getLivingType())]:(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),r),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return i=c.sent(),a=i.code,s=i.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),r),[2,{code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}]):(this._logger.info(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomData:s}),r),u=t.getClientSessionId(),l=new Os(this._context,this._runtime,this._options,t._roomId,s,t.getLivingType(),u),this._crtAudienceLivingRoom=l,this._crtRoom.__destroy(!1),this._crtRoom=null,[2,{room:l,code:exports.RCRTCCode.SUCCESS,userIds:l.getRemoteUserIds(),RTCTracks:l.getRemoteRTCTracks(),MCUTracks:l.getRemoteMCUTracks(),CDNUris:l.getCDNInfo()}])}}))}))}}),Object.defineProperty(i.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t,r,i,a,s;return c(this,(function(c){switch(c.label){case 0:return t=this._logger.createTraceId(),r=this._context.getCurrentId(),this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:r}),t),[4,this._context.getRTCJoinedUserInfo(r)];case 1:return i=c.sent(),a=i.code,s=i.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:o.FAILED,code:a}),t),[2,{code:a}]):(this._logger.info(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:o.SUCCESSED,roomInfo:s}),t),[2,{code:exports.RCRTCCode.SUCCESS,data:s}])}}))}))}}),Object.defineProperty(i.prototype,"generateSummarization",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u,l){return void 0===i&&(i=0),void 0===a&&(a=0),s(this,void 0,void 0,(function(){var s,d,_,p,f,h,R;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_T,JSON.stringify({roomId:t,taskId:r,startTime:i,endTime:a,config:u,contentBlock:l}),s),e.validate("roomId",t,e.notEmptyString,!0)?e.validate("taskId",r,e.notEmptyString,!0)?!e.isNumber(i)||i<0?(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):!e.isNumber(a)||a<0?(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):e.validate("config",u,e.isObject,!0)?(d=function(t){if("destLang"in t&&!e.isString(t.destLang))return{isValid:!1,key:"destLang"};if("customPrompt"in t&&!e.isString(t.customPrompt))return{isValid:!1,key:"customPrompt"};if("enableSummarization"in t&&!e.isBoolean(t.enableSummarization))return{isValid:!1,key:"enableSummarization"};if("enableSummarizationDetails"in t&&!e.isBoolean(t.enableSummarizationDetails))return{isValid:!1,key:"enableSummarizationDetails"};if("enableChapterSummary"in t&&!e.isBoolean(t.enableChapterSummary))return{isValid:!1,key:"enableChapterSummary"};if("enableTodoList"in t&&!e.isBoolean(t.enableTodoList))return{isValid:!1,key:"enableTodoList"};if("enableHashtag"in t&&!e.isBoolean(t.enableHashtag))return{isValid:!1,key:"enableHashtag"};if("format"in t&&void 0===exports.RCRTCGenerateSummarizationFormat[t.format])return{isValid:!1,key:"format"};var r=t.enableSummarization||t.enableSummarizationDetails||t.enableChapterSummary||t.enableTodoList||t.enableHashtag;return t.customPrompt||r?{isValid:!0,key:""}:{isValid:!1,key:"at least one of the summary features must be enabled"}}(u),_=d.isValid,p=d.key,_||this._logger.warn(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config.".concat(p)}),s),[4,this._service.generateSummarization(t,r,i,a,u,l,s)]):(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> config"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return f=c.sent(),h=f.code,R=f.msg,h!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.FAILED,code:h,msg:R}),s),[2,{code:h}]):(this._logger.info(n.L_RTC_CLIENT_GENERATE_SUMMARIZATION_R,JSON.stringify({status:o.SUCCESSED}),s),[2,{code:h}])}}))}))}}),Object.defineProperty(i.prototype,"getASRContent",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u,l){return void 0===i&&(i=0),void 0===a&&(a=0),s(this,void 0,void 0,(function(){var s,d,_,p;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_GET_ASR_CONTENT_T,JSON.stringify({roomId:t,taskId:r,startTime:i,endTime:a,destLang:l,contentBlock:u}),s),e.validate("roomId",t,e.notEmptyString,!0)?e.validate("taskId",r,e.notEmptyString,!0)?!e.isNumber(i)||i<0?(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> startTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):!e.isNumber(a)||a<0?(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> endTime"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):e.validate("destLang",l,e.isString,!1)?[4,this._service.getASRContent(t,r,i,a,u,s,l)]:(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> destLang"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> taskId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return d=c.sent(),_=d.code,p=d.msg,_!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.FAILED,code:_,msg:p}),s),[2,{code:_}]):(this._logger.info(n.L_RTC_CLIENT_GET_ASR_CONTENT_R,JSON.stringify({status:o.SUCCESSED}),s),[2,{code:_}])}}))}))}}),i}(Is);exports.RTCJoinType=void 0,(Ss=exports.RTCJoinType||(exports.RTCJoinType={}))[Ss.KICK=0]="KICK",Ss[Ss.REFUSE=1]="REFUSE";var Ls,As="rtcRJoin_data",Ps="rtcRExit",Ns="rtcRInfo",ws="rtcUData",Ds="rtcUDel",ks="rtcSetData",Us="userSetData",Ms="rtcQryData",xs="rtcDelData",js="rtcToken",Bs="rtcUserState",Vs="rtcUList",Fs="viewerJoinR",Js="viewerExitR",Gs="rtcPullKv",Hs="rtcIdentityChange",Ks="rtcInvite",Ws="rtcCancelInvite",zs="rtcInviteAnswer",Ys="rtcEndInvite",qs="rtcQueryJoined",Zs="rtcPullRoomStatus",Qs="reportsdk",Xs="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"}(Ls||(Ls={}));var $s,ec=((Es={})[Ls.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"],Es[Ls.RtcOutput]=["version"],Es[Ls.RtcUserListOutput]=["users","token","sessionId","roomInfo","version"],Es[Ls.SetUserStatusInput]=["status"],Es[Ls.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Es[Ls.RtcUserSetDataInput]=["valueInfo","objectName","content"],Es[Ls.RtcDataInput]=["interior","target","key","objectName","content"],Es[Ls.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Es[Ls.MCFollowInput]=["state"],Es[Ls.RtcTokenOutput]=["rtcToken"],Es[Ls.RtcQryOutput]=["outInfo"],Es[Ls.RtcQryUserOutDataInput]=["userId"],Es[Ls.RtcUserOutDataOutput]=["user"],Es[Ls.RtcQueryListInput]=["order"],Es[Ls.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Es[Ls.RtcValueInfo]=["key","value"],Es[Ls.RtcKeyDeleteInput]=["key"],Es[Ls.RtcNotifyMsg]=["type","time","roomId"],Es[Ls.RtcPullKV]=["timestamp","roomId"],Es[Ls.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Es[Ls.RtcQueryUserJoinedInput]=["userId"],Es[Ls.RtcQueryUserJoinedOutput]=["info"],Es[Ls.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Es[Ls.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Es[Ls.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Es[Ls.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Es[Ls.RtcRoomStatusInput]=["version"],Es[Ls.RtcRoomStatusOutput]=["bFullStatus","version","usersData","roomStatus"],Es[Ls.RtcReportSDKInput]=["sdkInfo"],Es[Ls.RtcPBPolaris]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"],Es[Ls.RtcPBR1Info]=["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"],Es[Ls.RtcPBR2Info]=["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"],Es[Ls.RtcPBR3Info]=["info"],Es[Ls.RtcPBR4Info]=["info"],Es[Ls.RtcPBStatusInfo]=["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"],Es[Ls.RtcPBStreamInfo]=["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"],Es[Ls.AsrTextMsg]=["bms","t","isEnd","msgId","lang"],Es[Ls.AsrResTextMsg]=["type","uid","asr"],Es),tc="\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(Ls.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(Ls.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(Ls.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(Ls.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(Ls.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Ls.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(Ls.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(Ls.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(Ls.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(Ls.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Ls.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(Ls.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Ls.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(Ls.RtcQryOutput,"{\n repeated ").concat(Ls.RtcValueInfo," outInfo=1;\n }\n message ").concat(Ls.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(Ls.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(Ls.RtcUserSetDataInput," {\n repeated ").concat(Ls.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Ls.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(Ls.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(Ls.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(Ls.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Ls.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(Ls.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Ls.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(Ls.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(Ls.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(Ls.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(Ls.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(Ls.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(Ls.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(Ls.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(Ls.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(Ls.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(Ls.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(Ls.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(Ls.RtcPBR1Info," r1Info = 10;\n optional ").concat(Ls.RtcPBR2Info," r2Info = 11;\n optional ").concat(Ls.RtcPBR3Info," r3Info = 12;\n optional ").concat(Ls.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(Ls.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(Ls.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(Ls.RtcPBR3Info," {\n required ").concat(Ls.RtcPBStatusInfo," info = 1;\n }\n message ").concat(Ls.RtcPBR4Info," {\n required ").concat(Ls.RtcPBStatusInfo," info = 1;\n }\n message ").concat(Ls.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(Ls.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(Ls.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(Ls.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(Ls.AsrResTextMsg," {\n optional int32 type = 1; //1 为语音识别,后续会扩展其它类型\n required string uid = 2; //对应转写的用户Id\n repeated ").concat(Ls.AsrTextMsg," asr = 3; //识别出的结果列表\n }\n}\n"),rc=function(e,t,r,i,n,o,a){var s=n?Object.keys(n).map((function(t){return e.encode(Ls.RtcValueInfo,{key:t,value:n[t]},!0)})):void 0,c=o?Object.keys(o).map((function(t){return e.encode(Ls.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(Ls.RtcInput,{roomType:t,broadcastType:r,joinType:i,innerDatas:s,outerDatas:c,supportNtf:a})},ic=function(t,r){var i=t.decode(Ls.RtcUserListOutput,r),n=i.users,o=i.token,a=i.sessionId,s=i.roomInfo,c=i.entries,u=i.offlineKickTime,l=void 0===u?60:u,d=i.codeFormat,_=i.roomCreateTime,p=i.userJoinTime,f=i.version,h={};return e.forEach(n,(function(t){var r=t.userId,i=t.userData,n={};e.forEach(i,(function(e){var t=e.key,r=e.value;n[t]=r})),h[r]=n})),{users:h,token:o,sessionId:a,roomInfo:s,kvEntries:c,offlineKickTime:l,codeFormat:d,roomCreateTime:Pt(_),userJoinTime:Pt(p),version:f}};!function(e){e[e.SUBTITLE=1]="SUBTITLE",e[e.TRANSLATION=2]="TRANSLATION"}($s||($s={}));var nc,oc=function(){function t(e,t,r){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n,o,a,u){return s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,R,b,g,m,C,v,T;return c(this,(function(c){switch(c.label){case 0:return s=rc(this.codec,r,i,n,o,a,u),[4,this.context.rtcSignaling(t,As,!0,s)];case 1:return l=c.sent(),d=l.code,_=l.buffer,d===e.ErrorCode.SUCCESS&&_?(p=ic(this.codec,_),f=p.users,h=p.token,R=p.sessionId,b=p.roomInfo,g=p.kvEntries,m=p.offlineKickTime,C=p.roomCreateTime,v=p.userJoinTime,T=p.version,this.roomCreateTime=C,this.userJoinTime=v,[2,{code:d,data:{users:f,token:h,sessionId:R,roomInfo:b,kvEntries:g,offlineKickTime:m,version:T}}]):[2,{code:d,data:p}]}}))}))}}),Object.defineProperty(t.prototype,"quitRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(Ls.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,Ps,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(Ls.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,Ns,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o&&(a=this.codec.decode(Ls.RtcRoomInfoOutput,o)),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(Ls.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,ws,!0,r)];case 1:return i=c.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o&&(s=ic(this.codec,o),a={users:s.users}),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(t.prototype,"removeRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this.codec.encode(Ls.RtcKeyDeleteInput,{key:t}),[4,this.context.rtcSignaling(e,Ds,!1,r)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){return s(this,void 0,void 0,(function(){var a;return c(this,(function(s){switch(s.label){case 0:return a=this.codec.encode(Ls.RtcSetDataInput,{interior:i,target:n,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.context.rtcSignaling(e,ks,!1,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCTotalRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){return s(this,void 0,void 0,(function(){var a,s,u=this;return c(this,(function(c){switch(c.label){case 0:return a={objectName:i,content:[],valueInfo:[this.codec.encode(Ls.RtcValueInfo,{key:"uris",value:r},!0)]},t.forEach((function(e){var t=u.codec.encode(Ls.RtcValueInfo,{key:e.name,value:e.content},!0);a.content.push(t)})),n&&a.valueInfo.push(this.codec.encode(Ls.RtcValueInfo,{key:"mcu_uris",value:n},!0)),o&&a.valueInfo.push(this.codec.encode(Ls.RtcValueInfo,{key:"cdn_uris",value:o},!0)),s=this.codec.encode(Ls.RtcUserSetDataInput,a),[4,this.context.rtcSignaling(e,Us,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return i=this.codec.encode(Ls.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(Ls.RtcValueInfo,{key:"cdn_uris",value:r},!0)}),[4,this.context.rtcSignaling(e,Us,!0,i)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){return s(this,void 0,void 0,(function(){var o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return o=this.codec.encode(Ls.RtcDataInput,{interior:i,target:n,key:r}),[4,this.context.rtcSignaling(t,Ms,!0,o)];case 1:return a=c.sent(),s=a.code,u=a.buffer,s===e.ErrorCode.SUCCESS&&u?(l=this.codec.decode(Ls.RtcQryOutput,u).outInfo,d={},l.forEach((function(e){d[e.key]=e.value})),[2,{code:s,data:d}]):[2,{code:s}]}}))}))}}),Object.defineProperty(t.prototype,"removeRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o;return c(this,(function(a){switch(a.label){case 0:return o=this.codec.encode(Ls.RtcDataInput,{interior:r,target:i,key:t,objectName:(null==n?void 0:n.name)||"",content:(null==n?void 0:n.content)||""}),[4,this.context.rtcSignaling(e,xs,!1,o)];case 1:return[2,a.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){return c(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCToken",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=rc(this.codec,r,i),[4,this.context.rtcSignaling(t,js,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=this.codec.decode(Ls.RtcTokenOutput,s).rtcToken,[2,{code:a,data:{rtcToken:u}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"setRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this.codec.encode(Ls.MCFollowInput,{state:t}),[4,this.context.rtcSignaling(e,Bs,!0,r)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCStateByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){var o;return s(this,void 0,void 0,(function(){var s,u,l;return c(this,(function(c){switch(c.label){case 0:s=function(e,t,r){var i=t.type,n=t.appKey,o=t.sessionId,s=t.roomId,c=t.roomCreateTime,u=t.userId,l=t.userRole,d=t.joinTime,_=t.signalDataCenter,p=t.r1Info,f=t.r2Info,h=t.r3Info,R=t.r4Info,b={type:i,appKey:n,sessionId:o,roomId:s,roomCreateTime:c,userId:u,userRole:l,joinTime:d,signalDataCenter:_};if(r===xa.R1&&p){var g=e.encode(Ls.RtcPBR1Info,p,!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r1Info:g}))}if(r===xa.R2&&f){var m=e.encode(Ls.RtcPBR2Info,f,!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r2Info:m}))}if(r===xa.R3&&h){var C=(S=h.info).streams,v=Array.isArray(C)&&C.map((function(t){return t&&e.encode(Ls.RtcPBStreamInfo,t,!0)})),T=e.encode(Ls.RtcPBStatusInfo,a(a({},S),{streams:v}),!0),O=e.encode(Ls.RtcPBR3Info,{info:T},!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r3Info:O}))}if(r===xa.R4&&R){C=(S=R.info).streams,v=Array.isArray(C)&&C.map((function(t){return t&&e.encode(Ls.RtcPBStreamInfo,t,!0)})),T=e.encode(Ls.RtcPBStatusInfo,a(a({},S),{streams:v}),!0);var S,E=e.encode(Ls.RtcPBR4Info,{info:T},!0);return e.encode(Ls.RtcPBPolaris,a(a({},b),{r4Info:E}))}return{}}(this.codec,i,n),u=t,/^https:\/\//.test(t)||(u="https://".concat(t)),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(u,"/rtc/logserver/polaris"),body:s,method:e.HttpMethod.POST,headers:{jwt:(null===(o=this.context.getNaviInfo())||void 0===o?void 0:o.jwt)||""},timeout:2e3})];case 2:if(!(l=c.sent()).data)throw new Error("http request fail");return[2,JSON.parse(l.data).resultCode];case 3:return c.sent(),[2,Ma.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(Ls.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,Vs,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o?(a=ic(this.codec,o),[2,{code:n,data:a}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return n=rc(this.codec,r,i),[4,this.context.rtcSignaling(t,Fs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=this.codec.decode(Ls.RtcViewerJoinedOutput,s),l=u.rtcToken,d=u.entries,_=u.roomCreateTime,p=u.userJoinTime,this.roomCreateTime=Pt(_),this.userJoinTime=Pt(p),[2,{code:a,data:{token:l,kvEntries:d}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"quitLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(Ls.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,Js,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"rtcIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(Ls.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:i,identityChangeType:r,needSysChatroom:!1}),[4,this.context.rtcSignaling(t,Hs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=ic(this.codec,s),[2,{code:a,data:u}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"requestRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,n=e.inviteTimeout,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(Ls.RtcInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:i,timeoutTime:n,inviteInfo:o}),[4,this.context.rtcSignaling(a,Ks,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"cancelRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,n=e.inviteInfo,o=e.roomId,a=this.codec.encode(Ls.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:i,inviteInfo:n}),[4,this.context.rtcSignaling(o,Ws,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"responseRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return t=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,n=e.content,o=e.key,a=e.value,s=e.agree,u=e.roomId,l=this.codec.encode(Ls.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:r,inviteSessionId:i,content:n,key:o,value:a,answerCode:s?1:0}),[4,this.context.rtcSignaling(u,zs,!0,l)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"endRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return t=e.endRoomId,r=e.sessionId,i=e.content,n=e.keys,o=e.roomId,a=this.codec.encode(Ls.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:r,inviteContent:i,inviteRoomKeys:n}),[4,this.context.rtcSignaling(o,Ys,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCJoinedUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(Ls.RtcQueryUserJoinedInput,{userId:t}),[4,this.context.rtcSignaling("",qs,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o?(a=this.codec.decode(Ls.RtcQueryUserJoinedOutput,o).info||[],[2,{code:n,data:a.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Pt(e.joinTime)}}))}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,s,u,l;return c(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(Ls.RtcPullKV,{timestamp:0,roomId:t}),[4,this.context.rtcSignaling(t,Gs,!0,r)];case 1:return i=c.sent(),n=i.code,o=i.buffer,n!==e.ErrorCode.SUCCESS?[2,{code:n}]:(s=this.codec.decode(Ls.RtcKVOutput,o),u=s.entries,l=s.syncTime,u=(u||[]).map((function(e){return a(a({},e),{timestamp:Pt(e.timestamp)})})),[2,{code:n,data:{kvEntries:u,syncTime:Pt(l)}}])}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this.codec.encode(Ls.RtcRoomStatusInput,{version:r}),[4,this.context.rtcSignaling(t,Zs,!0,i)];case 1:return n=c.sent(),o=n.code,a=n.buffer,o!==e.ErrorCode.SUCCESS?[2,{code:o}]:(s=this.codec.decode(Ls.RtcRoomStatusOutput,a),[2,{code:o,data:s}])}}))}))}}),Object.defineProperty(t.prototype,"decodeRtcNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.decode(Ls.RtcNotifyMsg,e),r=t.time,i=t.type,n=t.roomId;return{time:Pt(r),type:i,roomId:n}}}),Object.defineProperty(t.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCurrentId()}}),Object.defineProperty(t.prototype,"getNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getNaviInfo()}}),Object.defineProperty(t.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getConnectionStatus()}}),Object.defineProperty(t.prototype,"getAppkey",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getAppkey()}}),Object.defineProperty(t.prototype,"webRtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(Ls.RtcInput,{roomType:r,broadcastType:i}),[4,this.context.rtcSignaling(t,Xs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a!==e.ErrorCode.SUCCESS?[2,{code:a}]:((u=this.codec.decode(Ls.RtcOutput,s)).version=Pt(u.version),[2,{code:a,data:u}])}}))}))}}),Object.defineProperty(t.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return/Electron/.test(navigator.userAgent)?this.context.rtcPingResVersion(e,t,r):this.webRtcPing(e,t,r)}}),Object.defineProperty(t.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.context.sendMessage(e,t,r)}}),Object.defineProperty(t.prototype,"registerRTCSignalListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.registerRTCSignalListener(e)}}),Object.defineProperty(t.prototype,"registerConnectionStateChangeListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onconnectionstatechange=e}}),Object.defineProperty(t.prototype,"registerDisconnectListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondisconnect=e}}),Object.defineProperty(t.prototype,"registerDestroyListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondestroy=e}}),Object.defineProperty(t.prototype,"registerMessageListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onmessage=e}}),Object.defineProperty(t.prototype,"getCoreVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCoreVersion()}}),Object.defineProperty(t.prototype,"getPluginContext",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context}}),Object.defineProperty(t.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.encode(Ls.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Qs,!0,t)}}),Object.defineProperty(t.prototype,"decodeAsrText",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;try{r=this.codec.decode(Ls.AsrResTextMsg,e)}catch(r){console.error("decodeAsrText error",{error:r,seiFrameData:e.join(","),seiOriginData:t.join(",")})}var i=r||{asr:[]},n=i.type,o=i.uid;return i.asr.map((function(e){var t=e.bms,r=e.t,i=e.isEnd,s=e.msgId,c=e.lang,u={userID:o,timeUTC:t,msg:r,msgId:s,isEnd:i};return n===$s.SUBTITLE?u:a(a({},u),{destLangCode:c})}))}}),t}();!function(e){e.RTC="RTC"}(nc||(nc={})),e.VersionManage.add("rtclib","5.38.0-alpha.1");var ac={tag:"RCRTC",verify:function(t){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("5.36.1")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '").concat("5.36.1","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(t,r,i){void 0===i&&(i={});var o=t.createLogger("RCRTC",nc.RTC);if(i.logLevel&&o.setOutputLevel(i.logLevel),o.warn(n.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.38.0-alpha.1",Commit:"0828c6a022873ab0cb30d904d24eea6e70084bd2","browserInfo.browser":vt.browser,"browserInfo.supportsUnifiedPlan":vt.supportsUnifiedPlan,"browserInfo.version":vt.version})),e.assert("options",i,e.AssertRules.OBJECT,!0),e.assert("options.mediaServer",i.mediaServer,(function(t){return!(!e.isHttpUrl(t)||"https:"===location.protocol&&!/^https/.test(t))})),e.assert("options.timeout",i.timeout,(function(t){return e.isNumber(t)&&t>=5e3&&t<=3e4})),e.assert("options.pingGap",i.pingGap,(function(t){return e.isNumber(t)&&t>=3e3&&t<=1e4})),i.AAAWorklet){e.assert("options.AAAWorklet",i.AAAWorklet,e.AssertRules.OBJECT,!0);var a=i.AAAWorklet,s=a.scriptUrl,c=a.wasmUrl;e.assert("AAAWorklet.scriptUrl",s,e.AssertRules.STRING,!0),e.assert("AAAWorklet.wasmUrl",c,e.AssertRules.STRING,!0),Ke.SCRIPT_URL=s,Ke.WASM_URL=c}return i.encryptor&&(e.assert("options.encrypt",i.encryptor,e.AssertRules.OBJECT,!0),e.assert("options.encrypt.decodeAudio",i.encryptor.decodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.decodeVideo",i.encryptor.decodeVideo,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeAudio",i.encryptor.encodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeVideo",i.encryptor.encodeVideo,(function(e){return"function"==typeof e}),!0),ho.init(i.encryptor,o)),new ys(new oc(t,o,t.createCodec(ec,tc)),r,i)}},sc={transResolution:bt,transFrameRate:Ct,parseTrackId:_t,ifSupportLocalFileTrack:Tt,ifSupportScreenShare:Ot};exports.RCAbstractRoom=ts,exports.RCAudienceClient=Cs,exports.RCAudienceLivingRoom=Os,exports.RCCameraVideoTrack=$e,exports.RCLivingRoom=hs,exports.RCLocalAudioTrack=ze,exports.RCLocalFileAudioTrack=Qe,exports.RCLocalFileTrack=qe,exports.RCLocalFileVideoTrack=Ze,exports.RCLocalTrack=We,exports.RCLocalVideoTrack=Ye,exports.RCMCUConfigBuilder=os,exports.RCMediaStreamCapture=Is,exports.RCMicphoneAudioTrack=Xe,exports.RCRTCClient=ys,exports.RCRTCRoom=Rs,exports.RCRemoteAudioTrack=it,exports.RCRemoteTrack=rt,exports.RCRemoteVideoTrack=nt,exports.RCScreenAudioTrack=tt,exports.RCScreenVideoTrack=et,exports.RCTag={DEFAULT:"RongCloudRTC"},exports.RCTrack=Ve,exports.device=Me,exports.helper=sc,exports.installer=ac;
|