| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- !function(){var e=["MESSAGES"];function t(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(u){return void n(u)}a.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var s=e.apply(n,r);function a(e){t(s,i,o,a,c,"next",e)}function c(e){t(s,i,o,a,c,"throw",e)}a(void 0)}))}}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(c){a=!0,i=c}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(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 a(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 c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=u(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},c.apply(this,arguments)}function u(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}function d(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&&l(e,t)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=m(e);if(t){var i=m(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){if(t&&("object"===S(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function C(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=E(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function E(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.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,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function S(e){return S="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},S(e)}var I=document.createElement("style");I.innerHTML="._liveHeader_8nata_1{padding:0 40px 0 20px;height:var(--header-bar-height);background:var(--live-main-color);box-shadow:0 0 2px rgba(0,0,0,.25),0 0 6px 2px rgba(0,0,0,.1);display:flex;justify-content:space-between;align-items:center;color:var(--live-color);overflow:overlay}._liveHeader_8nata_1 ._liveLogo_8nata_12{height:36px;width:36px;padding-right:10px}._liveHeader_8nata_1 ._liveHeaderLeft_8nata_17{display:flex;align-items:center;font-weight:700;font-size:22px}._liveHeader_8nata_1 ._liveHeaderLeft_8nata_17 ._liveHeaderLeftIcon_8nata_23{display:inherit;align-items:inherit}._liveHeader_8nata_1 ._liveHeaderLeft_8nata_17 ._liveHeaderLeftText_8nata_27{padding-left:20px}._avatarWrapper_8nata_30{display:flex;align-items:center;color:var(--live-color);font-weight:500;font-size:18px}._avatarWrapper_8nata_30 ._userAvatar_8nata_37{width:34px;height:34px}._avatarWrapper_8nata_30 span{padding-left:8px}._header_22t18_1{display:flex;justify-content:space-between;align-items:center;padding:13px 19px;height:var(--header-height);box-sizing:border-box}._header_22t18_1>._title_22t18_9{font-size:18px;font-weight:400}.el-message-box{border-color:transparent;background-color:var(--live-main-color)}.el-message-box__header{background-color:var(--live-backound-color);color:var(--live-color)}.el-message-box__title,.el-message-box__container,.el-message-box__headerbtn .el-message-box__close{color:var(--live-color)}._action-bar_4c7vc_1{box-sizing:border-box;height:var(--action-bar-height);padding:14px 22px;display:flex;align-items:center;justify-content:space-between}._action-bar_4c7vc_1 button{overflow:hidden}._bar-btn_4c7vc_12{display:flex;flex-direction:column;align-items:center;color:var(--live-color);font-size:14px}._bar-btn_4c7vc_12 ._bar-btn-text_4c7vc_19{padding-top:6px;line-height:20px}._bar-btn_4c7vc_12+._bar-btn_4c7vc_12{margin-left:25px}.el-dialog{margin-bottom:10vh}.el-dialog .el-dialog__header{background:var(--live-main-color);padding:15px 20px}.el-dialog .el-dialog__header .el-dialog__title,.el-dialog .el-dialog__header .el-dialog__headerbtn .el-dialog__close{color:#fff}.el-dropdown__popper.el-popper{border-color:var(--live-main-color)!important}.el-dropdown__popper.el-popper[role=tooltip] .el-popper__arrow:before{border-color:var(--live-main-color);background-color:var(--live-main-color)}.el-slider{--el-slider-height: 2px;--el-slider-button-size: 14px;--el-slider-button-wrapper-offset: -17px;--el-slider-main-bg-color: var(--live-text-color)}.el-slider__button{border-color:var(--live-color);background-color:var(--live-text-color)}.el-dropdown-menu{background-color:var(--live-main-color);color:var(--live-color);border-radius:2px}.el-dropdown-menu .el-dropdown-menu__item{color:inherit}.el-dropdown-menu .el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--live-main-color);color:var(--live-color)}._volumeSlider_4c7vc_68{display:flex;align-items:center;padding:0 12px;width:195px;height:55px;background-color:var(--live-main-color);border-color:var(--live-main-color)}._volumeSlider_4c7vc_68 ._volumeIcon_4c7vc_77{width:14px;height:15px;padding-right:8px}._btnInner_4c7vc_82{display:flex;align-items:center;justify-content:center;width:60px;height:32px;background:rgba(94,98,109,.33);border-radius:16px}._shareWrap_9b5uw_1{background:#f9f9f9;padding:16px}._shareWrap_9b5uw_1 h2{font-size:18px;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#333;line-height:25px;margin-bottom:18px}._shareWrap_9b5uw_1 h4{font-size:16px;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#333;line-height:28px}._shareWrap_9b5uw_1 p{font-size:16px;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#333;line-height:30px}._shareBtn_9b5uw_27{height:48px;background:var(--color-primary);border-radius:32px;width:192px;color:#fff;margin:24px auto 0;text-align:center;line-height:48px;font-size:20px;cursor:pointer}._container_19awp_1{position:absolute;top:50%;left:50%;display:flex;background-color:var(--tips-backound-color);color:var(--live-color);border-radius:8px;transform:translate(-50%,-50%)}._container_19awp_1>div{padding:32px 100px;text-align:center;width:360px;box-sizing:border-box}._container_19awp_1>div svg{width:74px;height:68px}._container_19awp_1>div ._title_19awp_21{font-size:20px;margin-top:15px}._container_19awp_1>div ._tips_19awp_25{font-size:14px;color:var(--tips-color);margin-top:5px}._main_1b4ip_1{--header-height: 68px;--action-bar-height: 88px;width:calc(100% - 385px);background-color:var(--live-backound-color);color:var(--live-color);display:flex;flex-direction:column;height:calc(100vh - var(--header-bar-height));overflow:hidden}._main_1b4ip_1 ._video_1b4ip_12{width:100%;max-height:calc(100vh - var(--header-bar-height) - var(--header-height) - var(--action-bar-height));flex:1;background-color:var(--video-backound-color);position:relative}._main_1b4ip_1 ._video_1b4ip_12 video{width:100%;height:100%}._container_jmhhf_1{width:385px!important;height:calc(100vh - var(--header-bar-height));background-color:var(--live-main-color)}._dataCount_jmhhf_6{text-align:center;margin:16px 16px 0;border-radius:2px;background-color:var(--message-color);display:flex;justify-content:space-around;align-items:center;height:120px;color:var(--live-color)}._dataCount_jmhhf_6 ._num_jmhhf_17{font-size:24px;font-weight:700;padding-bottom:16px}._dataCount_jmhhf_6 ._text_jmhhf_22{display:flex;font-size:14px}._dataCount_jmhhf_6 ._dataIcon_jmhhf_26{padding-right:5px;width:20px;height:20px}._tabContainer_jmhhf_31 ._tabIcon_jmhhf_31{margin-right:6px;width:20px;height:20px}._tabContainer_jmhhf_31 .el-tabs__header{margin-bottom:0}._tabContainer_jmhhf_31 .el-tabs__nav-wrap:after{background-color:var(--message-color)}._tabContainer_jmhhf_31 .el-tabs__nav{padding:12px 0;width:100%;text-align:center}._tabContainer_jmhhf_31 .el-tabs__item{color:var(--live-color);font-size:16px;padding:0 31px}._tabContainer_jmhhf_31 .el-tabs__item.is-active{color:#00fff0}._tabContainer_jmhhf_31 .el-tabs__active-bar{background-color:#00fff0}._tabContent_jmhhf_58{--message-bar-height: 88px;position:relative;height:calc(100vh - var(--header-bar-height) - var(--message-bar-height) - 216px);padding-bottom:var(--message-bar-height)}._tabContent_jmhhf_58 ._tabList_jmhhf_64{height:calc(100vh - var(--header-bar-height) - var(--message-bar-height) - 276px);overflow:auto}._message_4zab7_1 ._buttonGroup_4zab7_1{display:flex;align-items:center;background:rgba(99,108,132,.1);padding:15px 16px}._message_4zab7_1 .el-button--info{--el-button-text-color: var(--live-color);--el-button-hover-text-color: var(--live-light-color);--el-button-disabled-text-color: var(--el-text-color-placeholder);background-color:var(--message-color);border-color:var(--message-color)}._sendMessage_p2cnx_1{position:fixed;bottom:0;height:88px;width:353px;display:flex;align-items:center;padding:0 16px}._sendMessage_p2cnx_1 ._form_p2cnx_10{display:flex;align-items:center;width:100%;background-color:var(--message-color);border-radius:60px}._sendMessage_p2cnx_1 .el-input{border-radius:60px;overflow:hidden;font-size:16px}._sendMessage_p2cnx_1 .el-input__inner{height:46px;line-height:46px;padding-left:20px;background-color:transparent;border:0;color:var(--live-color)}._sendMessage_p2cnx_1 .el-button{border:0;background-color:#00a79d;height:46px;line-height:46px;border-radius:46px;color:var(--live-color);font-weight:600;padding:0 23px;font-size:16px}._sendMessage_p2cnx_1 .el-button.is-disabled{background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}._itemContent_7upzu_1{padding:16px 16px 5px;display:flex;color:var(--live-color)}._itemContent_7upzu_1>img{width:28px;height:28px;margin-right:8px}._itemInfo_7upzu_11{width:100%}._itemName_7upzu_14{display:flex;justify-content:space-between;align-items:center;padding-top:3px;padding-bottom:8px}._itemName_7upzu_14 ._userName_7upzu_21{font-size:16px;line-height:22px;display:flex;align-items:center;font-weight:500}._itemName_7upzu_14 ._name-style_7upzu_28{line-height:24px;background:#575B61;border-radius:12px;color:#fff;padding:0 8px}._itemName_7upzu_14 ._rightTime_7upzu_35{font-size:12px}._itemName_7upzu_14 .el-tag--default{border-radius:20px;margin-left:8px}._itemText_7upzu_42{font-size:14px;line-height:20px}._itemText_7upzu_42._active_7upzu_46{color:var(--live-text-color)}._joinText_7upzu_49{display:flex;justify-content:space-between;align-items:center}._joinText_7upzu_49 ._join_7upzu_49{display:flex;align-items:center}._btn_7upzu_58{font-size:13px;line-height:20px;background-color:var(--live-light-color);border-color:var(--live-light-color);text-align:center;padding:3px 15px 1px;border-radius:2px;cursor:pointer;color:var(--live-color);text-decoration:none}._btn_7upzu_58._downBtn_7upzu_70{background-color:transparent;border-color:var(--live-light-color);color:var(--live-light-color)}._loadingStyle_7upzu_75{position:absolute;left:0;right:0;top:0;bottom:0}._empty-container_1svqd_1{height:100%;width:100%;text-align:center;color:#a4a6a9;font-size:14px;padding:20px 0}._empty-container_1svqd_1 ._icon_1svqd_9{width:126px;height:89px;margin-bottom:8px}._container_13n1h_1{display:flex}._home_13n1h_4{--header-bar-height: 76px}\n",document.head.appendChild(I),System.register(["./index-legacy.15f3307d.js","./vendor-legacy.d78ec485.js"],(function(t){"use strict";var r,u,l,p,y,E,T,I,b,k,w,O,N,A,M,P,x,L,U,D,V,B,F,j,H,K,q,G;return{setters:[function(e){r=e.s,u=e.r,l=e.a},function(e){p=e.j,y=e.n,E=e.d,T=e.i,I=e.f,b=e.l,k=e.p,w=e.t,O=e.u,N=e.v,A=e.x,M=e.r,P=e.y,x=e.z,L=e.A,U=e.B,D=e.C,V=e.D,B=e.F,F=e.G,j=e.H,H=e.I,K=e.J,q=e.K,G=e.L}],execute:function(){var Y,J,W="_liveHeader_8nata_1",z="_liveLogo_8nata_12",Q="_liveHeaderLeft_8nata_17",X="_liveHeaderLeftIcon_8nata_23",Z="_liveHeaderLeftText_8nata_27",$="_avatarWrapper_8nata_30",ee="_userAvatar_8nata_37";!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(J||(J={}));var te,ne,re=J,ie=["https://nav.cn.ronghub.com","https://nav2-cn.ronghub.com"],oe=["wsproxy.cn.ronghub.com","wsap-cn.ronghub.com"],se=["cometproxy-cn.ronghub.com","mini-cn.ronghub.com"],ae={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0},"RC:FileMsg":{isCounted:!0,isPersited:!0},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1}},ce=["RC:TypSts","RC:InterceptMsg"];!function(e){e.WEBSOCKET="websocket",e.COMET="comet"}(te||(te={}));var ue=function(e){return ne||(ne={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),ne},de=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),le=function(){function e(e,t){var n,r=t?"RCV4-"+t:"RCV4-";this._rootStorage=ue(e);var i=this._rootStorage.get(r)||{};this._cache=new de(((n={})[r]=i,n)),this._storageKey=r}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),he=function(e,t){return(he=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function pe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}he(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var fe,ge,me=function(){return(me=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function ve(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function _e(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function ye(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e}!function(e){function t(t){return e.call(this,"TODO => "+t)||this}pe(t,e)}(Error);var Re=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e.replace(r,(function(e){return e.toUpperCase()}))},Ce=function(e,t){void 0===t&&(t="utf-8");var n,r=0;if("utf-16"===t)for(var i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<=65535?2:4;else for(i=0,o=e.length;i<o;i++)r+=(n=e.charCodeAt(i))<127?1:n<=2047?2:n<=65535?3:4;return r},Ee=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return e+"="+t[e]})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},Te=function(e){return e.match(/\d+(\.\d+){2}/)[0]};!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=1e3]="NONE"}(fe||(fe={})),function(e){e.IM="IM",e.RTC="RTC"}(ge||(ge={}));var Se="RC_Logs";var Ie,be=function(){function e(){}return e.init=function(){if("undefined"!=typeof window&&window&&window.indexedDB){var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(e){console.warn("open indexDB request failed "+e.target.error)},t.onsuccess=function(t){e._db=t.target.result,e._db&&(e._db.onclose=function(t){var n;console.warn("The database "+(null===(n=e._db)||void 0===n?void 0:n.name)+" has unexpectedly closed.",t),e._db=null,e._instance=null},e._db.onerror=function(t){var n;console.warn("The database "+(null===(n=e._db)||void 0===n?void 0:n.name)+" has opening error.",t),e._db=null,e._instance=null},e._db.onabort=function(t){var n;console.warn("The database "+(null===(n=e._db)||void 0===n?void 0:n.name)+" has opening aborted.",t),e._db=null,e._instance=null}),e._instance=new e},t.onupgradeneeded=function(t){e._db=t.target.result,function(e){var t=e.target.result;1===e.oldVersion&&t.deleteObjectStore(Se),function(e,t,n){var r;if(!e.objectStoreNames.contains(t)){var i=me({},n.objectStoreParams);r=e.createObjectStore(t,i),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){r.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,Se,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}(t)}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(r){if(e._db){var i=e._db.transaction([t],"readwrite"),o=i.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),i.oncomplete=function(e){r(!0)},i.onerror=function(e){r(!1)}}else r(!1)}))},e.prototype.getRangeData=function(t,n,r,i){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(r,i),c=s.index(n),u=[],d=c.openCursor(a);d.onsuccess=function(e){var t=e.target.result;t?(u.push(t.value),t.continue()):o(u)},d.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=function(t,n){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readonly").objectStore(t).count();r.onsuccess=function(){n(r.result)},r.onerror=function(e){console.error(e),n(0)}}else n(0)}))},e.prototype.removeFirstData=function(t,n,r){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readwrite").objectStore(t),o=i.getAllKeys(IDBKeyRange.lowerBound(0),r);o.onsuccess=function(){var e=o.result;e.length>0&&(i.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e}(),ke=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)}))},we=function(){var e=ke();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e};!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.RTC_ROOM=12]="RTC_ROOM"}(Ie||(Ie={}));var Oe,Ne=Ie;!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"}(Oe||(Oe={}));var Ae,Me,Pe=Oe,xe=function(e){return"string"==typeof e},Le=function(e){return"boolean"==typeof e},Ue=function(e){return"number"==typeof e&&!isNaN(e)},De=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Ve=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},Be=function(e){return xe(e)&&e.length>0},Fe=function(e){return"[object Object]"===Object.prototype.toString.call(e)},je=function(e){return"[object Function]"===Object.prototype.toString.call(e)},He=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Ke=function(e){return"[object Null]"===Object.prototype.toString.call(e)},qe=function(e){return xe(e)&&/https?:\/\//.test(e)},Ge=function(e){for(var t in e)return!0;return!1},Ye=function(e){return Ue(e)&&Object.prototype.hasOwnProperty.call(Pe,e)},Je=((Ae={})[fe.DEBUG]=console.debug.bind(console),Ae[fe.INFO]=console.info.bind(console),Ae[fe.WARN]=console.warn.bind(console),Ae[fe.ERROR]=console.error.bind(console),Ae[fe.FATAL]=console.log.bind(console),Ae),We=function(e){return xe(e)||Ue(e)||He(e)||Le(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e)},ze=function(){function e(e,t,n){this.tag=e,this.type=t,this.initiator=n,this._outLevel=fe.WARN,this.debug=this.log.bind(this,fe.DEBUG),this.info=this.log.bind(this,fe.INFO),this.warn=this.log.bind(this,fe.WARN),this.error=this.log.bind(this,fe.ERROR),this.fatal=this.log.bind(this,fe.FATAL)}return e.init=function(t){e.userId=t},e.reset=function(){e.userId=""},e.prototype._defaultStdout=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];Je[e].apply(Je,ye([t+":"],n))},e.prototype.__pushLocalLog=function(t,n,r){var i;i=this.type?this.type:["RCRTCLog","RCCall","RCRTC","RTC-A"].includes(this.tag)?ge.RTC:ge.IM;var o=Date.now();Ce(n)>=1e3&&(n=function(e,t,n){if(void 0===n&&(n="utf-8"),!e)return"";var r="utf-8"===n?3:2,i=0,o=0,s="";for(o=0;o<e.length;o++){if(e.charCodeAt(o)>255?i+=r:i++,i>1e3)return s;s+=e.charAt(o)}return e}(n));var s=JSON.stringify({message:n,userId:e.userId}).replace(/"/g,'""'),a=/^[\w]+-[\w]+-[\w]+?/.test(r)?r:(this.initiator||"L")+"-"+r+"-O",c={sessionId:e.sessionId,time:o,level:4-t,content:e.sessionId+","+Date.now()+","+i+","+(4-t)+","+a+',"'+s+'"\n',userId:e.userId};e.databaseLogList.push(c),(e.databaseLogList.length>=100||t===fe.FATAL)&&this.__insertLogIntoDatabase()},e.prototype.__insertLogIntoDatabase=function(){return ve(this,void 0,void 0,(function(){var t,n,r;return _e(this,(function(i){switch(i.label){case 0:return t=ye([],e.databaseLogList),e.databaseLogList=[],(n=be.getInstance())?[4,n.addList(Se,t)]:[3,3];case 1:return r=i.sent(),[4,n.getCount(Se,"time")];case 2:return i.sent()>1e5&&n.removeFirstData(Se,"time",2e3),[2,r];case 3:return[2,!1]}}))}))},e.prototype.setLogLevel=function(e){this._outLevel="number"!=typeof e?fe.WARN:e},e.prototype.setLogStdout=function(e){this._logStdout=e},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e>fe.DEBUG&&this.__pushLocalLog(e,t.map(We).join(" "),this.tag),!(e<this._outLevel)){var r=(new Date).toISOString()+"["+this.tag+"]["+fe[e]+"]",i=r+" - "+t.map(We).join(" ");this._logStdout?this._logStdout(e,i):this._stdout?this._stdout(e,i):this._defaultStdout.apply(this,ye([e,r],t))}},e.prototype.reportLog=function(t,n,r){this.__pushLocalLog(4-t,r,n);var i=JSON.stringify({message:r}).replace(/"/g,'""');i='"'+i+'"';var o={level:t,content:[e.sessionId,Date.now(),this.type,t,n,i].join()+"\n"};e.realTimeLogList.push(o),e.realTimeLogList.length>=600&&(e.realTimeLogList=e.realTimeLogList.slice(-500))},e.prototype.set=function(e,t){this.warn("logger.set has being deprecated!")},e.prototype.setStdout=function(e){this._stdout=e},e.prototype.__clearRealTimeLog=function(){e.realTimeLogList=[]},e.databaseLogList=[],e.realTimeLogList=[],e.sessionId=we(),e.userId="",e}(),Qe=new ze("RCLog"),Xe=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,c=o.listener;a&&r.splice(i,1);try{c.call.apply(c,ye([s],t))}catch(e){Qe.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}();!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(Me||(Me={}));var Ze,$e=Me;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.SUCCESS=0]="SUCCESS",e[e.RC_MSG_UNAUTHORIZED=20406]="RC_MSG_UNAUTHORIZED",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_CLEAR_ERROR=34007]="CONVER_CLEAR_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CLEAR_HIS_TIME_ERROR=34011]="CLEAR_HIS_TIME_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.GET_MESSAGE_BY_ID_ERROR=61001]="GET_MESSAGE_BY_ID_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.CLOSE_BEFORE_OPEN=51001]="CLOSE_BEFORE_OPEN",e[e.ALREADY_IN_USE=51002]="ALREADY_IN_USE",e[e.INVALID_CHANNEL_NAME=51003]="INVALID_CHANNEL_NAME",e[e.VIDEO_CONTAINER_IS_NULL=51004]="VIDEO_CONTAINER_IS_NULL",e[e.DELETE_MESSAGE_ID_IS_NULL=61001]="DELETE_MESSAGE_ID_IS_NULL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT"}(Ze||(Ze={}));var et,nt=Ze;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT"}(et||(et={}));var rt,it=et,ot=0,st=3,at=4,ct=6,ut=8,dt=9,lt=10,ht=12,pt=13,ft=16,gt=17,mt=18;!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(rt||(rt={}));var vt,_t=rt;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(vt||(vt={}));var yt,Rt=vt;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(yt||(yt={}));var Ct,Et=yt;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(Ct||(Ct={}));var Tt,St=Ct;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(Tt||(Tt={}));var It,bt=Tt;!function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(It||(It={}));var kt,wt,Ot,Nt,At=It;!function(e){
- /*!
- 全局敏感词:命中了融云内置的全局敏感词
- */
- e[e.GLOBAL=1]="GLOBAL",
- /*!
- 自定义敏感词拦截:命中了客户在融云自定义的敏感词
- */
- e[e.CUSTOM=2]="CUSTOM",
- /*!
- 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
- */
- e[e.THIRD_PARTY=3]="THIRD_PARTY"}(kt||(kt={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE"}(wt||(wt={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Ot||(Ot={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Nt||(Nt={}));var Mt,Pt,xt,Lt={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Mt||(Mt={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Pt||(Pt={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(xt||(xt={}));var Ut,Dt,Vt={engine:"5.1.1"},Bt=function(){function e(){}return e.add=function(e,t){Vt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return Qe.warn("The validation engine version '"+e+"' is invalid!"),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Vt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Vt},e}();!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID"}(Dt||(Dt={}));var Ft,jt,Ht,Kt,qt,Gt=((Ut={})[Dt.STRING]=Be,Ut[Dt.ONLY_STRING]=xe,Ut[Dt.NUMBER]=Ue,Ut[Dt.BOOLEAN]=function(e){return"boolean"==typeof e},Ut[Dt.OBJECT]=Fe,Ut[Dt.ARRAY]=De,Ut[Dt.CALLBACK]=function(e){var t=!0;return Fe(e)||(t=!1),(e=e||{}).onSuccess&&!je(e.onSuccess)&&(t=!1),e.onError&&!je(e.onError)&&(t=!1),t},Ut[Dt.CHANNEL_ID]=function(e){var t=!1;return xe(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Ut),Yt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return pe(t,e),t}(Error),Jt=function(e,t,n,r){if(void 0===r&&(r=!1),!Wt(e,t,n,r))throw new Yt("'"+e+"' is invalid: "+JSON.stringify(t))},Wt=function(e,t,n,r){void 0===r&&(r=!1),n=Gt[n]||n;var i=r&&!n(t)||!r&&!(He(t)||null===t||n(t));return i&&Qe.error("'"+e+"' is invalid: "+JSON.stringify(t)),!i},zt=function(e){if(!Fe(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{"+t.length+"}$"),t),16)},Qt=function(e,t){var n={},r={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:r};try{var i=JSON.parse(e);null==i||i.forEach((function(e){var t,i,o,s,a=Object.keys(e);if(0!==a.length){var c=a[0];switch(c){case"HW":return void(r.channelIdHW=null===(t=e[c])||void 0===t?void 0:t.channelId);case"MI":return void(r.channelIdMi=null===(i=e[c])||void 0===i?void 0:i.channelId);case"OPPO":return void(r.channelIdOPPO=null===(o=e[c])||void 0===o?void 0:o.channelId);case"VIVO":return void(r.typeVivo=null===(s=e[c])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[c]["thread-id"],n.apnsCollapseId=e[c]["apns-collapse-id"],n.category=e[c].category,void(n.richMediaUri=e[c].richMediaUri);case"FCM":r.googleConfig={collapseKey:e[c].collapse_key||"",imageUrl:e[c].imageUrl||"",priority:e[c].priority||""}}}}))}catch(t){Qe.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:r}},Xt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&n<=128&&n>=1},Zt=function(e){var t=e.length;return t<=4096&&t>=1},$t=function(e,t,n){t=t||function(){};var r=(n=n||{}).isReverse;Fe(e)&&function(){for(var n in e)t(e[n],n,e)}(),(De(e)||xe(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()},en=function(e,t){return $t(e,(function(n,r){e[r]=t(n,r)})),e},tn=function(e,t){var n=[];return $t(e,(function(e){n.push(e)})),-1!==function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return $t(e,(function(e,r){t===e&&(n=r)})),n}(n,t)},nn=function(e){return JSON.parse(JSON.stringify(e))},rn=function(){return"undefined"!=typeof RCCppEngine},on=function(e){switch(e){case st:return nt.SERVER_UNAVAILABLE;case at:return nt.RC_CONN_USER_OR_PASSWD_ERROR;case ct:return nt.RC_CONN_REDIRECTED;case ut:return nt.RC_CONN_APP_BLOCKED_OR_DELETED;case dt:return nt.RC_CONN_USER_BLOCKED;case lt:return nt.RC_CONN_USER_OR_PASSWD_ERROR;case ht:return nt.HOSTNAME_ERROR;case pt:return nt.HAS_OHTER_SAME_CLIENT_ON_LINE;case ft:return nt.RC_APP_AUTH_NOT_PASS;case gt:return nt.RC_OTP_USED;case mt:return nt.RC_PLATFORM_ERROR;default:return nt.RC_NET_UNAVAILABLE}},sn=function(e){var t={},n=JSON.parse(e);return $t(n,(function(e,n){t[n]=e.v})),t},an={_delayTime:0,setTime:function(e){var t=(new Date).getTime();an._delayTime=t-e},getTime:function(){var e=an._delayTime;return(new Date).getTime()-e}},cn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n};!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(Ft||(Ft={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(jt||(jt={})),function(e){e.CONN_ACK="ConnAckMessage",e.DISCONNECT="DisconnectMessage",e.PING_REQ="PingReqMessage",e.PING_RESP="PingRespMessage",e.PUBLISH="PublishMessage",e.PUB_ACK="PubAckMessage",e.QUERY="QueryMessage",e.QUERY_CON="QueryConMessage",e.QUERY_ACK="QueryAckMessage"}(Ht||(Ht={})),function(e){e.PUB="pub",e.QUERY="qry"}(Kt||(Kt={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(qt||(qt={}));var un,dn=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=Ft.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=Ft.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1;var i=e>0;e&&i&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=r)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,(e|=this.qos<<1)|(this._dup?8:0)},e}(),ln=function(){function e(){}return e.writeUTF=function(e,t){var n=[],r=0;if(xe(e))for(var i=0,o=e.length;i<o;i++){var s=e.charCodeAt(i);s>=0&&s<=127?(r+=1,n.push(s)):s>=128&&s<=2047?(r+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(r+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(i=0,o=n.length;i<o;i++)n[i]>255&&(n[i]&=255);return t?n:r<=255?[0,r].concat(n):[r>>8,255&r].concat(n)},e.readUTF=function(e){for(var t,n,r=[],i=-1,o=e,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&a)&&(a=(a^=192)<<6|128^o[++i])),!isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),hn=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0"+r),t+=r}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return ln.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),pn=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=ln.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),fn="UpStreamMessage",gn="PushExtra",mn="DownStreamMessage",vn="DownStreamMessages",_n="SessionsAttQryInput",yn="SessionsAttOutput",Rn="SyncRequestMsg",Cn="ChrmPullMsg",En="NotifyMsg",Tn="HistoryMsgInput",Sn="HistoryMsgOuput",In="RelationQryInput",bn="RelationsOutput",kn="DeleteSessionsInput",wn="SessionInfo",On="DeleteSessionsOutput",Nn="RelationsInput",An="DeleteMsgInput",Mn="CleanHisMsgInput",Pn="SessionMsgReadInput",xn="ChrmInput",Ln="ChrmOutput",Un="QueryChatRoomInfoInput",Dn="QueryChatRoomInfoOutput",Vn="RtcInput",Bn="RtcUserListOutput",Fn="SetUserStatusInput",jn="RtcSetDataInput",Hn="RtcUserSetDataInput",Kn="RtcDataInput",qn="RtcSetOutDataInput",Gn="MCFollowInput",Yn="RtcTokenOutput",Jn="RtcQryOutput",Wn="RtcQryUserOutDataInput",zn="RtcUserOutDataOutput",Qn="RtcQueryListInput",Xn="RtcRoomInfoOutput",Zn="RtcValueInfo",$n="RtcKeyDeleteInput",er="GetQNupTokenInput",tr="GetQNupTokenOutput",nr="GetQNdownloadUrlInput",rr="GetDownloadUrlInput",ir="GetQNdownloadUrlOutput",or="GetDownloadUrlOutput",sr="SetChrmKV",ar="SetChrmKVS",cr="DeleteChrmKVS",ur="ChrmKVOutput",dr="ChrmKVSOutput",lr="ChrmKVSOutputEntity",hr="QueryChrmKV",pr="SetUserSettingInput",fr="SetUserSettingOutput",gr="PullUserSettingInput",mr="PullUserSettingOutput",vr="UserSettingNotification",_r="SessionReq",yr="SessionStates",Rr="SessionState",Cr="SessionStateItem",Er="SessionStateModifyReq",Tr="SessionStateModifyResp",Sr="GrpReadReceiptMsg",Ir="GrpReadReceiptQryReq",br="GrpReadReceiptQryResp",kr="GrpMsgReadUser",wr="SessionTagAddInput",Or="SessionTagItem",Nr="SessionTagDelInput",Ar="SessionDisTagReq",Mr="ReportSDKInput",Pr="ReportSDKOutput",xr="RtcNotifyMsg",Lr="RtcPullKV",Ur="RtcKVOutput",Dr="RtcQueryUserJoinedInput",Vr="RtcQueryUserJoinedOutput",Br="RtcViewerJoinedOutput",Fr="RtcInviteInput",jr="RtcCancelInviteInput",Hr="RtcInviteAnswerInput",Kr="RtcEndInviteInput",qr=((un={})[fn]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],un[vn]=["list","syncTime","finished"],un[mn]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel"],un[gn]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],un[_n]=["nothing"],un[yn]=["inboxTime","sendboxTime","totalUnreadCount"],un[Rn]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime"],un[Cn]=["syncTime","count"],un[En]=["type","time","chrmId"],un[Tn]=["targetId","time","count","order","busChannel"],un[Sn]=["list","syncTime","hasMsg"],un[In]=["type","count","startTime","order"],un[bn]=["info"],un[kn]=["sessions"],un[wn]=["type","channelId","busChannel"],un[On]=["nothing"],un[Nn]=["type","msg","count","busChannel","startTime","endTime"],un[An]=["type","conversationId","msgs","busChannel"],un[Mn]=["targetId","dataTime","conversationType","busChannel"],un[Pn]=["type","msgTime","channelId"],un[xn]=["nothing"],un[Ln]=["nothing","sessionId","joinTime"],un[Un]=["count","order"],un[Dn]=["userTotalNums","userInfos"],un[er]=["type","key","httpMethod","queryString"],un[nr]=["type","key","fileName"],un[rr]=["type","key","fileName"],un[tr]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],un[ir]=["downloadUrl"],un[or]=["downloadUrl"],un[sr]=["entry","bNotify","notification","type"],un[ar]=["entry","bNotify","notification","type"],un[cr]=["entry","bNotify","notification","type"],un[ur]=["entries","bFullUpdate","syncTime"],un[dr]=["timestamp","errorKeys"],un[lr]=["key","errorCode"],un[hr]=["timestamp"],un[pr]=["version","value"],un[fr]=["version","reserve"],un[gr]=["version","reserve"],un[mr]=["items","version"],un.UserSettingItem=["targetId","type","key","value","version","status","tags"],un[_r]=["time"],un[yr]=["version","state"],un[Rr]=["type","channelId","time","stateItem","busChannel"],un[Cr]=["sessionStateType","value","tags"],un[Er]=["version","state"],un[Tr]=["version"],un[Sr]=["msgId","busChannel"],un[Ir]=["msgId","busChannel"],un[br]=["totalMemberNum","list"],un[kr]=["readTime","userId"],un[wr]=["version","tags"],un[Or]=["tagId","name","createdTime","isTop"],un[Nr]=["version","tags"],un[Ar]=["tagId"],un[vr]=["version","reserve"],un[Mr]=["sdkInfo"],un[Pr]=["nothing"],un[Vn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],un[Bn]=["users","token","sessionId","roomInfo"],un[Fn]=["status"],un[jn]=["interior","target","key","value","objectName","content"],un[Hn]=["valueInfo","objectName","content"],un[Kn]=["interior","target","key","objectName","content"],un[qn]=["target","valueInfo","objectName","content"],un[Gn]=["state"],un[Yn]=["rtcToken"],un[Jn]=["outInfo"],un[Wn]=["userId"],un[zn]=["user"],un[Qn]=["order"],un[Xn]=["roomId","roomData","userCount","list"],un[Zn]=["key","value"],un[$n]=["key"],un[xr]=["type","time","roomId"],un[Lr]=["timestamp","roomId"],un[Ur]=["entries","bFullUpdate","syncTime"],un[Dr]=["userId"],un[Vr]=["info"],un[Fr]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],un[jr]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],un[Hr]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],un[Kr]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],un),Gr={},Yr=function(e){var t=qr[e];Gr[e]=function(){for(var e={},n={getArrayData:function(){return e}},r=function(r){var i=t[r],o="set"+Re(i,0,1);n[o]=function(t){e[i]=t}},i=0;i<t.length;i++)r(i);return n},Gr[e].decode=function(e){var t={};xe(e)&&(e=JSON.parse(e));var n=function(n){var r="get"+Re(n,0,1);t[n]=e[n],t[r]=function(){return e[n]}};for(var r in e)n(r);return t}};for(var Jr in qr)Yr(Jr);Gr.getModule=function(e){return Gr[e]()};var Wr,zr,Qr,Xr,Zr,$r="\npackage Modules;\nmessage probuf {\n message "+Fn+"\n {\n optional int32 status=1;\n }\n\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message "+En+" {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message "+Rn+" {\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 }\n message "+fn+" {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string userId = 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 }\n message "+gn+" {\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 "+vn+" {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n }\n message "+mn+" {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes 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; // 该消息所属会话的业务标识,限制20字符以内\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 }\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 = "+Pe.IMAGE+";\n audio = "+Pe.AUDIO+";\n video = "+Pe.VIDEO+";\n file = "+Pe.FILE+";\n }\n message "+er+" {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n }\n message "+nr+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+rr+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+tr+" {\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 optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\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 optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n }\n message "+ir+" {\n required string downloadUrl = 1;\n }\n message "+or+" {\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 "+xn+" {\n required int32 nothing = 1;\n }\n message "+Ln+" {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n }\n message "+Cn+" {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message "+In+"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message "+Nn+"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n optional string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message "+bn+"\n {\n repeated RelationInfo info = 1;\n }\n message RelationInfo\n {\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 }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message "+Mn+"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message "+Un+"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message "+Dn+"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message "+Gn+"\n {\n required string state = 1;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\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 {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message "+Tn+"\n {\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; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message "+Sn+"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message "+Qn+"{\n optional int32 order=1;\n }\n\n message "+$n+"{\n repeated string key=1;\n }\n\n message "+Zn+"{\n required string key=1;\n required string value=2;\n }\n\n message RtcUserInfo{\n required string userId=1;\n repeated "+Zn+" userData=2; //用户资源信息\n }\n\n message "+Bn+"{\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 }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated "+Zn+" roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message "+Vn+"{\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 }\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message "+Jn+"{\n repeated "+Zn+" outInfo=1;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message "+Kn+"{\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 "+jn+"{\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 "+Hn+" {\n repeated "+Zn+" valueInfo = 1;\n required string objectName = 2;\n repeated "+Zn+" content = 3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n }\n message "+Yn+"{\n required string rtcToken=1;\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message "+qn+"{\n required targetType target=1;\n repeated "+Zn+" valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message "+Wn+"{\n repeated string userId = 1;\n }\n message "+zn+"{\n repeated RtcUserInfo user = 1;\n }\n message "+_n+"{\n required int32 nothing = 1;\n }\n message "+yn+"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message "+Pn+"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message "+kn+"\n {\n repeated SessionInfo sessions = 1;\n }\n message "+wn+"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message "+On+"\n {\n optional int32 nothing=1;\n }\n message "+An+"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message DeleteMsg\n {\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 }\n message "+sr+" {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+ar+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+cr+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+ur+" {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message "+dr+" {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n }\n message "+lr+"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message "+hr+" {\n required int64 timestamp = 1;\n }\n message "+pr+" {\n required int64 version=1;\n required string value=2;\n }\n message "+fr+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+gr+" {\n required int64 version=1;\n optional bool reserve=2;\n }\n message "+mr+" {\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 "+_r+" {\n required int64 time = 1;\n }\n message "+yr+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+Rr+" {\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 "+Cr+" {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message "+Er+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+Tr+" {\n required int64 version=1;\n }\n message "+Sr+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+Ir+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+br+" {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message "+kr+" {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message "+wr+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Or+" {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message "+Nr+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Ar+" {\n repeated string tagId=1;\n }\n message "+vr+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+Mr+' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message '+Pr+"\n {\n optional int32 nothing=1; //占位\n }\n message "+xr+" \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message "+Lr+"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message "+Ur+"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \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 enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message "+Dr+"\n {\n required string userId = 1;\n }\n message "+Vr+"\n {\n repeated RtcJoinedInfo info = 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 "+Br+"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message "+Fr+"\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 "+jr+"\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 "+Hr+"\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 "+Kr+"\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}\n",ei=(Wr=$r,function(e,t){var n,r,i={};return i.ByteBuffer=e,i.c=e,n=e,i.Long=t||null,i.VERSION="5.0.1",i.WIRE_TYPES={},i.WIRE_TYPES.VARINT=0,i.WIRE_TYPES.BITS64=1,i.WIRE_TYPES.LDELIM=2,i.WIRE_TYPES.STARTGROUP=3,i.WIRE_TYPES.ENDGROUP=4,i.WIRE_TYPES.BITS32=5,i.PACKABLE_WIRE_TYPES=[i.WIRE_TYPES.VARINT,i.WIRE_TYPES.BITS64,i.WIRE_TYPES.BITS32],i.TYPES={int32:{name:"int32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},uint64:{name:"uint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.UZERO:void 0},sint64:{name:"sint64",wireType:i.WIRE_TYPES.VARINT,defaultValue:i.Long?i.Long.ZERO:void 0},bool:{name:"bool",wireType:i.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:i.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:i.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:i.WIRE_TYPES.BITS64,defaultValue:i.Long?i.Long.ZERO:void 0},float:{name:"float",wireType:i.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:i.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:i.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:i.WIRE_TYPES.STARTGROUP,defaultValue:null}},i.MAP_KEY_TYPES=[i.TYPES.int32,i.TYPES.sint32,i.TYPES.sfixed32,i.TYPES.uint32,i.TYPES.fixed32,i.TYPES.int64,i.TYPES.sint64,i.TYPES.sfixed64,i.TYPES.uint64,i.TYPES.fixed64,i.TYPES.bool,i.TYPES.string,i.TYPES.bytes],i.ID_MIN=1,i.ID_MAX=536870911,i.convertFieldsToCamelCase=!1,i.populateAccessors=!0,i.populateDefaults=!0,i.Util=function(){var e={};return e.IS_NODE=!("object"!=("undefined"==typeof process?"undefined":S(process))||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),i.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]*)+$/,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},i.DotProto=function(e,t){function n(e,n){var r=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,r,i,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++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("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,(s=(o=function(e){this.tn=new c(e),this.proto3=!1}).prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||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(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)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),r=!1;break;case"enum":this._parseEnum(n),r=!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()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},s._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},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)},s._parseServiceRPC=function(e){var n,r,i="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.response_stream=!0,o=this.tn.next()),r.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},s._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!t.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,i){var o,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,o),!/^[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(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,r,i,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},s._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()},s._parseEnum=function(e){var r,i={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},s._parseExtensionRanges=function(){var t,n,i,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=r(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},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},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(i,i.Lang),i.Reflect=function(t){function r(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function i(e,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,c,u,d,l,h,p,f,g,m,v,_,y,R,C={},E=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},T=E.prototype;return T.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},T.toString=function(e){return(e?this.className+" ":"")+this.fqn()},T.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},C.T=E,(s=(o=function(e,t,n,r,i){E.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"}).prototype=Object.create(E.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.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)},s.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},s.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof C.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof C.T&&(!t||n instanceof C.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},s.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof C.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,i={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],i[n]=r;return i},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},C.Namespace=o,c=(a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)}).prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new n(0):e.defaultValue},c.verifyValue=function(n){var i,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(S(n),"not an integer"),n>4294967295?0|n:n;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof n||n==n&&n%1!=0)&&a(S(n),"not an integer"),n<0?n>>>0:n;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return r(n,!1)}catch(e){a(S(n),e.message)}else a(S(n),"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return r(n,!0)}catch(e){a(S(n),e.message)}else a(S(n),"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof n&&a(S(n),"not a boolean"),n;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof n&&a(S(n),"not a number"),n;case t.TYPES.string:return"string"==typeof n||n&&n instanceof String||a(S(n),"not a string"),""+n;case t.TYPES.bytes:return e.isByteBuffer(n)?n:e.wrap(n);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==n)return i[s].id;if(i[s].id==n)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof n||n==n&&n%1!=0)&&a(S(n),"not an integer"),(n>4294967295||n<0)&&a(S(n),"not in range for uint32"),n;a(n,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(n&&"object"==S(n)||a(S(n),"object expected"),n instanceof this.resolvedType.clazz)return n;if(n instanceof t.Builder.Message){for(s in o={},n)n.hasOwnProperty(s)&&(o[s]=n[s]);n=o}return new this.resolvedType.clazz(n)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+n+" (undefined type "+this.type+")")},c.calculateLength=function(e,r){if(null===r)return 0;var i;switch(this.type){case t.TYPES.int32:return r<0?n.calculateVarint64(r):n.calculateVarint32(r);case t.TYPES.uint32:return n.calculateVarint32(r);case t.TYPES.sint32:return n.calculateVarint32(n.zigZagEncode32(r));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return n.calculateVarint64(r);case t.TYPES.sint64:return n.calculateVarint64(n.zigZagEncode64(r));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return n.calculateVarint32(r);case t.TYPES.double:return 8;case t.TYPES.string:return i=n.calculateUTF8Bytes(r),n.calculateVarint32(i)+i;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");return n.calculateVarint32(r.remaining())+r.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(r),n.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(r))+n.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")},c.encodeValue=function(e,r,i){var o,s;if(null===r)return i;switch(this.type){case t.TYPES.int32:r<0?i.writeVarint64(r):i.writeVarint32(r);break;case t.TYPES.uint32:i.writeVarint32(r);break;case t.TYPES.sint32:i.writeVarint32ZigZag(r);break;case t.TYPES.fixed32:i.writeUint32(r);break;case t.TYPES.sfixed32:i.writeInt32(r);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(r);break;case t.TYPES.sint64:i.writeVarint64ZigZag(r);break;case t.TYPES.fixed64:i.writeUint64(r);break;case t.TYPES.sfixed64:i.writeInt64(r);break;case t.TYPES.bool:"string"==typeof r?i.writeVarint32("false"===r.toLowerCase()?0:!!r):i.writeVarint32(r?1:0);break;case t.TYPES.enum:i.writeVarint32(r);break;case t.TYPES.float:i.writeFloat32(r);break;case t.TYPES.double:i.writeFloat64(r);break;case t.TYPES.string:i.writeVString(r);break;case t.TYPES.bytes:if(r.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+r.remaining()+" bytes remaining");o=r.offset,i.writeVarint32(r.remaining()),i.append(r),r.offset=o;break;case t.TYPES.message:s=(new n).LE(),this.resolvedType.encode(r,s),i.writeVarint32(s.offset),i.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(r,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+r+" (unknown type)")}return i},c.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(i=e.clone()).limit=i.offset+o,e.offset+=o,i;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},c.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return n.fromBinary(e)}},c.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},C.Element=a,(d=(u=function(e,t,n,r,i,s){o.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null}).prototype=Object.create(o.prototype)).build=function(r){var i,o,s,a;if(this.clazz&&!r)return this.clazz;for(i=function(t,r){function i(e,r,o,s){var a,c,u,d,l,h,p;if(null===e||"object"!=S(e))return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(n.isByteBuffer(e))return r?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return c=[],e.forEach((function(e,t){c[t]=i(e,r,o,s)})),c;if(c={},e instanceof t.Map){for(d=(u=e.entries()).next();!d.done;d=u.next())c[e.keyElem.valueToString(d.value[0])]=i(d.value[1],r,o,e.valueElem.resolvedType);return c}for(p in l=e.$type,h=void 0,e)e.hasOwnProperty(p)&&(c[p]=l&&(h=l.getChild(p))?i(e[p],r,o,h.resolvedType):i(e[p],r,o));return c}var o,s,a=r.getChildren(t.Reflect.Message.Field),c=r.getChildren(t.Reflect.Message.OneOf),u=function e(i){var o,s,u,d;for(t.Builder.Message.call(this),o=0,s=c.length;s>o;++o)this[c[o].name]=null;for(o=0,s=a.length;s>o;++o)this[(u=a[o]).name]=u.repeated?[]:u.map?new t.Map(u):null,!u.required&&"proto3"!==r.syntax||null===u.defaultValue||(this[u.name]=u.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===i||"object"!=S(i)||!("function"!=typeof i.encode||i instanceof e)||Array.isArray(i)||i instanceof t.Map||n.isByteBuffer(i)||i instanceof ArrayBuffer||t.Long&&i instanceof t.Long)for(o=0,s=arguments.length;s>o;++o)void 0!==(d=arguments[o])&&this.$set(a[o].name,d);else this.$set(i)},d=u.prototype=Object.create(t.Builder.Message.prototype);for(d.add=function(e,n,i){var o=r._fieldsByName[e];if(!i){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");n=o.verifyValue(n,!0)}return null===this[e]&&(this[e]=[]),this[e].push(n),this},d.$add=d.add,d.set=function(e,n,i){var o,s,a;if(e&&"object"==S(e)){for(o in i=n,e)e.hasOwnProperty(o)&&void 0!==(n=e[o])&&this.$set(o,n,i);return this}if(s=r._fieldsByName[e],i)this[e]=n;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=n=s.verifyValue(n)}return s&&s.oneof&&(a=this[s.oneof.name],null!==n?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},d.$set=d.set,d.get=function(e,n){if(n)return this[e];var i=r._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.name]},d.$get=d.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||r.builder.options.populateAccessors&&function(e){var t,n,i,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),n=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===r.getChild("set"+o)&&(d["set"+o]=n),null===r.getChild("set_"+t)&&(d["set_"+t]=n),null===r.getChild("get"+o)&&(d["get"+o]=i),null===r.getChild("get_"+t)&&(d["get_"+t]=i)}(s);return d.encode=function(t,n){var i,o;"boolean"==typeof t&&(n=t,t=void 0),i=!1,t||(t=new e,i=!0),o=t.littleEndian;try{return r.encode(this,t.LE(),n),(i?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},u.encode=function(e,t,n){return new u(e).encode(t,n)},d.calculate=function(){return r.calculate(this)},d.encodeDelimited=function(e){var t,i=!1;return e||(e=new n,i=!0),t=(new n).LE(),r.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},d.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},d.toArrayBuffer=d.encodeAB,d.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},d.toBuffer=d.encodeNB,d.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},d.toBase64=d.encode64,d.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},d.toHex=d.encodeHex,d.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},d.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},u.decode=function(e,t){var i,o;"string"==typeof e&&(e=n.wrap(e,t||"base64")),i=(e=n.isByteBuffer(e)?e:n.wrap(e)).littleEndian;try{return o=r.decode(e.LE()),e.LE(i),o}catch(t){throw e.LE(i),t}},u.decodeDelimited=function(e,t){var i,o,s;if("string"==typeof e&&(e=n.wrap(e,t||"base64")),(e=n.isByteBuffer(e)?e:n.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=r.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},u.decode64=function(e){return u.decode(e,"base64")},u.decodeHex=function(e){return u.decode(e,"hex")},u.decodeJSON=function(e){return new u(JSON.parse(e))},d.toString=function(){return r.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:r.buildOpt()}),Object.defineProperty(d,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:r}),Object.defineProperty(d,"$type",{value:r})),u}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof g||o instanceof u||o instanceof _){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof v))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},d.encode=function(e,t,n){var r,i,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)i=e[(r=this._fields[o]).name],r.required&&null===i?null===c&&(c=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},d.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;o>i;++i){if(n=e[(t=this._fields[i]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},d.decode=function(e,n,r){var o,s,a,c,u,d,l,h,p,f,g,m;for(n="number"==typeof n?n:-1,u=e.offset,d=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?d[c.name].push(c.decode(s,e)):c.map?(h=c.decode(s,e),d[c.name].set(h[0],h[1])):(d[c.name]=c.decode(s,e),c.oneof&&(null!==(p=d[c.oneof.name])&&p!==c.name&&(d[p]=null),d[c.oneof.name]=c.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:l=e.readVarint32(),e.offset+=l;break;case t.WIRE_TYPES.STARTGROUP:for(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(f=0,g=this._fields.length;g>f;++f)if(null===d[(c=this._fields[f]).name])if("proto3"===this.syntax)d[c.name]=c.defaultValue;else{if(c.required)throw(m=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=d,m;t.populateDefaults&&null!==c.defaultValue&&(d[c.name]=c.defaultValue)}return d},C.Message=u,(h=(l=function(e,n,r,i,o,s,a,c,d,l){E.call(this,e,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=d||null,this.syntax=l||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=t.Util.toCamelCase(this.name))}).prototype=Object.create(E.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},h.verifyValue=function(e,n){var r,i,o;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===e)return this.required&&r(S(e),"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(S(e),"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],i=0;i<e.length;i++)o.push(this.element.verifyValue(e[i]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(S(e),"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(S(e),"no array expected"),this.element.verifyValue(e))},h.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},h.encode=function(e,r,i){var o,s,a,c,u;if(null===this.type||"object"!=S(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return r;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.ensureCapacity(r.offset+=1),s=r.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],r);a=r.offset-s,(c=n.calculateVarint32(a))>1&&(u=r.slice(s,r.offset),s+=c-1,r.offset=s,r.append(u)),r.writeVarint32(a,s-c)}else for(o=0;o<e.length;o++)r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],r);else this.map?e.forEach((function(e,i){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r.writeVarint32(o),r.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,r),r.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,r)}),this):this.hasWirePresence(e,i)&&(r.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,r))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},h.calculate=function(e,r){var i,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=S(this.type))throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);i+=n.calculateVarint32(s),i+=s}else for(o=0;o<e.length;o++)i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,r){var o=n.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+n.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i+=n.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=n.calculateVarint32(o),i+=o}),this):this.hasWirePresence(e,r)&&(i+=n.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},h.decode=function(e,n,r){var i,o,s,c,u,d,l;if(!(!this.map&&e==this.type.wireType||!r&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(c=a.defaultFieldValue(this.keyType),i=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(e=7&(d=u.readVarint32()),1==(l=d>>>3))c=this.keyElement.decode(u,e,l);else{if(2!==l)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,e,l)}return[c,i]}return this.element.decode(n,e,this.id)},C.Message.Field=l,(p=function(e,t,n,r,i,o,s){l.call(this,e,t,n,null,r,i,o,s),this.extension}).prototype=Object.create(l.prototype),C.Message.ExtensionField=p,f=function(e,t,n){E.call(this,e,t,n),this.fields=[]},C.Message.OneOf=f,(g=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null}).getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(g.prototype=Object.create(o.prototype)).build=function(e){var n,r,i,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,o=(r=this.getChildren(g.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},C.Enum=g,(m=function(e,t,n,r){E.call(this,e,t,n),this.className="Enum.Value",this.id=r}).prototype=Object.create(E.prototype),C.Enum.Value=m,(v=function(e,t,n,r){E.call(this,e,t,n),this.field=r}).prototype=Object.create(E.prototype),C.Extension=v,((_=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null}).prototype=Object.create(o.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(e,t){var r,i=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=i.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(r=0;r<s.length;r++)!function(e){o[e.name]=function(r,i){try{try{r=e.resolvedRequestType.clazz.decode(n.wrap(r))}catch(e){if(!(e instanceof TypeError))throw e}if(null===r||"object"!=S(r))throw Error("Illegal arguments");r instanceof e.resolvedRequestType.clazz||(r=new e.resolvedRequestType.clazz(r)),this.rpcImpl(e.fqn(),r,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:i[e.name].$options}))}(s[r]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),i}(t,this)},C.Service=_,((y=function(e,t,n,r){E.call(this,e,t,n),this.className="Service.Method",this.options=r||{}}).prototype=Object.create(E.prototype)).buildOpt=s.buildOpt,C.Service.Method=y,(R=function(e,t,n,r,i,o,s,a){y.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null}).prototype=Object.create(y.prototype),C.Service.RPCMethod=R,C}(i),i.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&void 0===e.values&&void 0===e.rpc},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!=S(e.rpc)||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.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 n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,s,a,c;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),i.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=S(e.options))throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],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&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){r.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,s,a,c,u,d,l,h="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==S(n)){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(h="\\"),o=i+h+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==S(n)?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(h="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),h="\\"):s=".":s=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=s+h+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(d=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(d+""),u):this.import(e.DotProto.Parser.parse(d),u)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+c+"."+n}))):this.import(t.imports[c],n+"_import"+c):this.import(t.imports[c]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),l=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){l.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=l),t.enums&&(this.create(t.enums),this.ptr=l),t.services&&(this.create(t.services),this.ptr=l),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var r;if(null==this.ptr||"object"==S(this.ptr.type))return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.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(!(r=(this.ptr instanceof n.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=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.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]}}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(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}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: "+S(this.ptr)+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,r;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(t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(i,i.Lang,i.Reflect),i.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,i,o,s;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}}),n)for(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,i.Reflect),i.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),i.loadJson(i.DotProto.Parser.parse(e),t,n)},i.protoFromString=i.loadProto,i.loadProtoFile=function(e,t,n){if(t&&"object"==S(t)?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==S(e)?e.root+"/"+e.file:e);return null===r?null:i.loadProto(r,n,e)},i.protoFromFile=i.loadProtoFile,i.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=i.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=i.populateAccessors),new i.Builder(e)},i.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==S(t)||(t=i.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},i.loadJsonFile=function(e,t,n){if(t&&"object"==S(t)?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return i.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,i.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=i.Util.fetch("object"==S(e)?e.root+"/"+e.file:e);return null===r?null:i.loadJson(JSON.parse(r),n,e)},r=Wr,i.loadProto(r,void 0,"").build("Modules").probuf}(function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,d=-7,l=n?i-1:0,h=n?-1:1,p=e[t+l];for(l+=h,o=p&(1<<-d)-1,p>>=-d,d+=a;d>0;o=256*o+e[t+l],l+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=r;d>0;s=256*s+e[t+l],l+=h,d-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,d=(1<<u)-1,l=d>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=d?(a=0,s=d):s+l>=1?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+p]=255&s,p+=f,s/=256,u-=8);e[n+p-f]|=128*g}var o,s,a,c,u,d=function e(t,n,r){if(void 0===t&&(t=e.DEFAULT_CAPACITY),void 0===n&&(n=e.DEFAULT_ENDIAN),void 0===r&&(r=e.DEFAULT_NOASSERT),!r){if((t|=0)<0)throw RangeError("Illegal capacity");n=!!n,r=!!r}this.buffer=0===t?s:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=n,this.noAssert=r};return d.VERSION="5.0.1",d.LITTLE_ENDIAN=!0,d.BIG_ENDIAN=!1,d.DEFAULT_CAPACITY=16,d.DEFAULT_ENDIAN=d.BIG_ENDIAN,d.DEFAULT_NOASSERT=!1,d.Long=e||null,(o=d.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,d.accessor=function(){return Uint8Array},d.allocate=function(e,t,n){return new d(e,t,n)},d.concat=function(e,t,n,r){var i,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,s=0,a=e.length;a>s;++s)d.isByteBuffer(e[s])||(e[s]=d.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new d(0,n,r);for(u=new d(i,n,r),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},d.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},d.type=function(){return ArrayBuffer},d.wrap=function(e,t,n,r){var i,s;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return d.fromBase64(e,n);case"hex":return d.fromHex(e,n);case"binary":return d.fromBinary(e,n);case"utf8":return d.fromUTF8(e,n);case"debug":return d.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=S(e))throw TypeError("Illegal buffer");if(d.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new d(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new d(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new d(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)i.view[s]=e[s]}return i},o.writeBitSet=function(e,t){var n,r,i,o,s,a,c=void 0===t;if(c&&(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)}for(r=t,o=(i=e.length)>>3,s=0,t+=this.writeVarint32(i,t);o--;)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(i>s){for(a=0,n=0;i>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,s,a,c=void 0===e;for(c&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;i--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.readBytes=function(e,t){var n,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)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,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)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(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)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,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)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(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)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,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)}return(t+=2)>(n=this.buffer.byteLength)&&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},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,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)}return(t+=2)>(n=this.buffer.byteLength)&&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},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,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)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,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)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=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 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)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,i,o=void 0===t;if(o&&(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)}return n=0,r=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,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=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),i=new e(n,r,!1),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=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 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)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,i,o=void 0===t;if(o&&(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)}return n=0,r=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,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=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),i=new e(n,r,!0),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,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)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(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)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,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)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(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)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,d.MAX_VARINT32_BYTES=5,d.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},d.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},d.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,r,i,o=void 0===t;if(o&&(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)}for((t+=r=d.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(d.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,i,o=void 0===e;if(o&&(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)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(0!=(128&t));return r|=0,o?(this.offset=e,r):{value:r,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==S(t)?t.value=d.zigZagDecode32(t.value):t=d.zigZagDecode32(t),t},e&&(d.MAX_VARINT64_BYTES=10,d.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},d.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()},d.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()},o.writeVarint64=function(t,n){var r,i,o,s,a,c=void 0===n;if(c&&(n=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 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)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=d.calculateVarint64(t),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return c?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(d.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,s,a,c=void 0===t;if(c&&(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)}if(n=t,r=0,i=0,o=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===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))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=d.zigZagDecode64(n.value):n=d.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))throw RangeError("Illegal str: Contains NULL-characters");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)}return i=u.calculateUTF16asUTF8(t(e))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(e){var t,r,i,o=void 0===e;if(o&&(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)}return t=e,i=-1,u.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=n(),!0),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");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)}if(i=n,r=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+r,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r):(this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-i},o.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(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)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,d.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},d.METRICS_CHARS="c",d.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,o,s=void 0===n;if(s&&(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)}return i=n,r=u.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,d.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},d.calculateString=d.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},o.readUTF8String=function(e,t,r){var i,o,s,a,c;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=d.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+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)}if(s=0,a=r,t===d.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,u.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(t===d.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(c=r+e,u.decodeUTF8toUTF16(function(){return c>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");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)}if(o=n,r=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=d.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(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)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,d.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,i,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(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)}return e instanceof d||(e=d.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new d(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,r,i;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 0===e&&t===this.buffer.byteLength?this:0==(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=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(e===t)return new d(0,this.littleEndian,this.noAssert);var n=t-e,r=new d(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o,s;if(!this.noAssert&&!d.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0==(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=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 n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.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},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,i,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(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)}return e instanceof d||(e=d.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;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)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.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},o.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},o.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 n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},c=function(){var e,t,n={},r=[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],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,o,s;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(s=i[r])&&n(r),t(o<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(s=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.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 c.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},d.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new d(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},d.btoa=function(e){return d.fromBinary(e).toBase64()},d.atob=function(e){return d.fromBase64(e).toBinary()},o.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 n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},d.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new d(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},d.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new d(0|(o+1)/3,t,n),a=0,c=0,u=!1,l=!1,h=!1,p=!1,f=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(l||h||p){f=!0;break}l=h=p=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(l||p){f=!0;break}l=p=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(l||h){f=!0;break}l=h=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(l){f=!0;break}l=!0}s.offset=c,u=!1;break;case"]":if(!n){if(p||h){f=!0;break}p=h=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(p){f=!0;break}p=!0}s.limit=c,u=!1;break;case"'":if(!n){if(h){f=!0;break}h=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){f=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=i,u=!0}if(f)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!l||!p)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.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 n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},d.fromHex=function(e,t,n){var r,i,o,s,a;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(i=e.length,o=new d(0|i/2,t),s=0,a=0;i>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,r=0;return e.UTF16toUTF8(t,(function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4})),[n,r]}};return e}(),o.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{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},d.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new d(u.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){i.view[o++]=e})),i.limit=o,i},d}(zr=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,o;return t?(o=(e>>>=0)>=0&&e<256)&&(r=c[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?g:f;if(t){if(e<0)return g;if(e>=l)return R}else{if(-h>=e)return C;if(e+1>=h)return y}return e<0?r(-e,t).neg():i(0|e%d,0|e/d,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,c,d,l,h;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(e.substring(1),t,n).neg();for(s=r(u(n,8)),a=f,c=0;c<e.length;c+=8)d=Math.min(8,e.length-c),l=parseInt(e.substring(c,c+d),n),d<8?(h=r(u(n,d)),a=a.mul(h).add(r(l))):a=(a=a.mul(s)).add(r(l));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var a,c,u,d,l,h,p,f,g,m,v,_,y,R,C,E;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},c={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,u=Math.pow,e.fromString=o,e.fromValue=s,h=(l=(d=4294967296)*d)/2,p=n(16777216),f=n(0),e.ZERO=f,g=n(0,!0),e.UZERO=g,m=n(1),e.ONE=m,v=n(1,!0),e.UONE=v,_=n(-1),e.NEG_ONE=_,y=i(-1,2147483647,!1),e.MAX_VALUE=y,R=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=R,C=i(0,-2147483648,!1),e.MIN_VALUE=C,(E=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},E.toString=function(e){var t,n,i,o,s,a,c,d;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(C)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),d=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}},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(){var e,t;if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&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==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(e){return t(e)||(e=s(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=s(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?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(m)},E.neg=E.negate,E.add=function(e){var n,r,o,a,c,u,d,l,h,p,f;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,d=e.low>>>16,l=0,h=0,p=0,f=0,p+=(f+=a+(65535&e.low))>>>16,h+=(p+=o+d)>>>16,l+=(h+=r+u)>>>16,l+=n+c,i((p&=65535)<<16|(f&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},E.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},E.sub=E.subtract,E.multiply=function(e){var n,o,a,c,u,d,l,h,g,m,v,_;return this.isZero()?f:(t(e)||(e=s(e)),e.isZero()?f:this.eq(C)?e.isOdd()?C:f:e.eq(C)?this.isOdd()?C:f:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,d=65535&e.high,l=e.low>>>16,g=0,m=0,v=0,_=0,v+=(_+=c*(h=65535&e.low))>>>16,m+=(v+=a*h)>>>16,v&=65535,m+=(v+=c*l)>>>16,g+=(m+=o*h)>>>16,m&=65535,g+=(m+=a*l)>>>16,m&=65535,g+=(m+=c*d)>>>16,g+=n*h+o*l+a*d+c*u,i((v&=65535)<<16|(_&=65535),(g&=65535)<<16|(m&=65535),this.unsigned)))},E.mul=E.multiply,E.divide=function(e){var n,i,o,a,c,d,l;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:f;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return v;o=g}else{if(this.eq(C))return e.eq(m)||e.eq(_)?C:e.eq(C)?m:(n=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?m:_:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(C))return this.unsigned?g:f;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();o=f}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),l=(d=r(n)).mul(e);l.isNegative()||l.gt(i);)l=(d=r(n-=c,this.unsigned)).mul(e);d.isZero()&&(d=m),o=o.add(d),i=i.sub(l)}return o},E.div=E.divide,E.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},E.mod=E.modulo,E.not=function(){return i(~this.low,~this.high,this.unsigned)},E.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},E.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},E.xor=function(e){return t(e)||(e=s(e)),i(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?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(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?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0==(e&=63)?this:(n=this.high,e<32?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:i(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,255&t>>>8,255&t>>>16,255&t>>>24,255&e,255&e>>>8,255&e>>>16,255&e>>>24]},E.toBytesBE=function(){var e=this.high,t=this.low;return[255&e>>>24,255&e>>>16,255&e>>>8,255&e,255&t>>>24,255&t>>>16,255&t>>>8,255&t]},e}()),zr));ei.getModule=function(e){var t=new ei[e];return t.getArrayData=function(){var e=t.toArrayBuffer();return Ve(e)?[].slice.call(new Int8Array(e)):e},t};var ti,ni={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},ri="qryRelationR",ii="cleanPMsg",oi="cleanGMsg",si="cleanCMsg",ai="cleanSMsg",ci="qryPMsg",ui="qryCHMsg",di=((Qr={}).ppMsgP=Ne.PRIVATE,Qr.pgMsgP=Ne.GROUP,Qr.chatMsg=Ne.CHATROOM,Qr.pcMsgP=Ne.CUSTOMER_SERVICE,Qr),li=((Xr={})[Ne.PRIVATE]=ci,Xr[Ne.GROUP]="qryGMsg",Xr[Ne.CHATROOM]=ui,Xr[Ne.CUSTOMER_SERVICE]="qryCMsg",Xr[Ne.SYSTEM]="qrySMsg",Xr),hi=((Zr={})[Ne.PRIVATE]=ii,Zr[Ne.GROUP]=oi,Zr[Ne.CUSTOMER_SERVICE]=si,Zr[Ne.SYSTEM]=ai,Zr),pi=function(){function e(e){this._codec="websocket"===e?ei:Gr,this._connectType=e}return e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[vn]=i._formatSyncMessages,r[mn]=i._formatReceivedMessage,r[fn]=i._formatSentMessage,r[Sn]=i._formatHistoryMessages,r[bn]=i._formatConversationList,r[Dn]=i._formatChatRoomInfos,r[Bn]=i._formatRTCUserList,r[Jn]=i._formatRTCData,r[ur]=i._formatChatRoomKVList,r[mr]=i._formatUserSetting,r[yr]=i._formatConversationStatus,r[br]=i._formatGrpReadReceiptQryResp,r[fr]=i._formatSetUserSettingOutput,r[vr]=i._formatUserSettingNotification,r[Ur]=i._formatRTCRoomKVList,r[Yn]=i._formatRTCAuidenceJoinRoomData,r[Vr]=i._formatRTCJoinedUserInfo,r)[t];try{o=e.length>0&&i._codec[t].decode(e),Fe(o)&&(o=function(e){for(var t in e)Fe(e[t])&&(e[t]=zt(e[t]));return e}(o)),je(s)&&(o=s.call(this,o,n))}catch(n){Qe.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Ve(n)?new Uint8Array(n):n;return ln.readUTF(i.subarray(t,r))}catch(e){Qe.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){Qe.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(He(o)||null===o)&&(e.finished=!0),e.syncTime=zt(i),e.list=en(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){var n=(t=t||{}).currentUserId,r=t.connectedTime,i=e.content,o=e.fromUserId,s=e.type,a=e.groupId,c=e.status,u=e.dataTime,d=e.classname,l=e.msgId,h=e.extraContent,p=e.pushContent,f=e.pushExt,g=e.configFlag,m=(e.direction||$e.RECEIVE)===$e.SEND,v=function(e){var t=re.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?re.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(c),_=v.isPersited,y=v.isCounted,R=v.isMentioned,C=v.disableNotification,E=v.receivedStatus,T=v.canIncludeExpansion,S=[Ne.GROUP,Ne.CHATROOM,Ne.RTC_ROOM].indexOf(s)>-1?a:o,I=m?n:o,b=zt(u),k=b<r,w=s===Ne.CHATROOM,O=this._formatBytes(i),N={};if(f&&(N=Qt(f.pushConfigs,f.pushId)),O.user){var A=O.user,M=A.portrait,P=A.portraitUri,x=M||P;x&&(O.user.portrait=O.user.portraitUri=x)}var L,U=me(me({},N),{pushTitle:null==f?void 0:f.title,pushContent:p,pushData:p,disablePushTitle:!!g&&Boolean(4&g),forceShowDetailContent:!!g&&Boolean(8&g),templateId:null==f?void 0:f.templateId}),D=m?$e.SEND:$e.RECEIVE;return w&&o===n&&(D=$e.SEND),h&&(L={},L=sn(h)),{conversationType:s,targetId:S,senderUserId:I,messageType:d,messageUId:l,isPersited:_,isCounted:y,isMentioned:R,sentTime:b,isOffLineMessage:k,messageDirection:D,receivedTime:an.getTime(),disableNotification:C,receivedStatus:E,canIncludeExpansion:T,content:O,expansion:L,configFlag:g,pushConfig:U,channelId:e.busChannel||""}},e.prototype._formatSentMessage=function(e,t){var n,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,c=e.pushExt,u=e.pushContent,d=e.configFlag,l=t.signal,h=t.currentUserId,p=l.date,f=l.topic,g=l.targetId,m=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),v=m.isPersited,_=m.isCounted,y=m.disableNotification,R=m.canIncludeExpansion,C=di[f]||Ne.PRIVATE,E=tn(ni,f),T=this._formatBytes(r),S=g;i===_t.RECALL&&(C=T.conversationType||C,S=T.targetId||g),a&&(n={},n=sn(a));var I={};c&&(I=Qt(c.pushConfigs,c.pushId));var b=me(me({},I),{pushTitle:null==c?void 0:c.title,pushContent:u,pushData:u,disablePushTitle:!!d&&Boolean(4&d),forceShowDetailContent:!!d&&Boolean(8&d),templateId:null==c?void 0:c.templateId});return{conversationType:C,targetId:S,messageType:i,messageUId:s,isPersited:v,isCounted:_,isStatusMessage:E,senderUserId:h,content:this._formatBytes(r),sentTime:1e3*p,receivedTime:an.getTime(),messageDirection:$e.SEND,isOffLineMessage:!1,disableNotification:y,canIncludeExpansion:R,expansion:n,pushConfig:b,channelId:e.busChannel||""}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=zt(e.syncTime),c=[];return $t(i,(function(e){var r=n._formatReceivedMessage(e,t);r.targetId=s,c.push(r)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},e.prototype._formatConversationList=function(e,t){var n=this,r=e.info,i=t.afterDecode||function(){};return(r=en(r,(function(e){var r=e.msg,o=e.userId,s=e.type,a=e.unreadCount,c=e.busChannel,u=null;r&&((u=n._formatReceivedMessage(r,t)).targetId=o);var d={targetId:o,conversationType:s,unreadMessageCount:a,latestMessage:u,channelId:c||""};return i(d)||d})))||[]},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:en(n,(function(e){var t=e.id,n=e.time;return{id:t,time:zt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=en(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,s=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?bt.DELETE:bt.UPDATE}}(r);return{key:t,value:n,isAutoDelete:s.isAutoDelete,isOverwrite:s.isOverwrite,type:s.type,userId:o,timestamp:zt(i)}})),isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return $t(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=zt(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=zt(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return $t(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,s=e.busChannel,a=Rt.CLOSE,c=!1,u=[];$t(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case 1:a="1"===n?Rt.OPEN:Rt.CLOSE;break;case 2:c="1"===n;break;case 3:u=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,isTop:c,updatedTime:zt(i),tags:u,channelId:s||""})})),n},e.prototype._formatRTCUserList=function(e){var t=e.users,n=e.token,r=e.sessionId,i=e.roomInfo,o=e.entries,s={};return $t(t,(function(e){var t=e.userId,n=e.userData,r={};$t(n,(function(e){var t=e.key,n=e.value;r[t]=n})),s[t]=r})),{users:s,token:n,sessionId:r,roomInfo:i,kvEntries:o}},e.prototype._formatRTCData=function(e){var t=e.outInfo,n={};return $t(t,(function(e){n[e.key]=e.value})),n},e.prototype._formatRTCRoomInfo=function(e){var t=e.roomId,n=e.userCount,r=e.roomData,i={id:t,total:n};return $t(r,(function(e){i[e.key]=e.value})),i},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=zt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatRTCRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return{kvEntries:t=(t=t||[]).map((function(e){var t=e.timestamp;return Object.assign(e,{timestamp:zt(t)})})),isFullUpdate:n,syncTime:r}},e.prototype._formatRTCAuidenceJoinRoomData=function(e){return e},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:zt(e.joinTime)}}))},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(_n);return e.setNothing(1),e.getArrayData()},e.prototype._getUpMsgModule=function(e,t){var n,r,i,o="comet"===this._connectType,s=(e.conversationType,t.messageType),a=t.isMentioned,c=t.mentionedType,u=t.mentionedUserIdList,d=t.content,l=t.pushContent,h=t.pushData,p=t.directionalUserIdList,f=t.isFilerWhiteBlacklist,g=t.isVoipPush,m=t.canIncludeExpansion,v=t.expansion,_=t.pushConfig,y=t.channelId;Ne.GROUP;var R=this._codec.getModule(fn),C=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),E=_||{},T=E.pushTitle,S=E.pushContent,I=E.pushData,b=E.iOSConfig,k=E.androidConfig,w=E.templateId,O=E.disablePushTitle,N=E.forceShowDetailContent,A=0;R.setSessionId(C),a&&d&&(d.mentionedInfo={userIdList:(null===(n=d.mentionedInfo)||void 0===n?void 0:n.userIdList)||u||[],type:(null===(r=d.mentionedInfo)||void 0===r?void 0:r.type)||c||Et.ALL,mentionedContent:(null===(i=d.mentionedInfo)||void 0===i?void 0:i.mentionedContent)||""});var M=S||l||"",P=I||h||"";if(M&&R.setPushText(M),P&&R.setAppData(P),p&&R.setUserId(p),A|=g?1:0,A|=f?2:0,A|=O?4:0,A|=N?8:0,R.setConfigFlag(A),R.setClassname(s),d.user&&d.user.portraitUri&&(d.user.portrait=d.user.portraitUri),R.setContent(JSON.stringify(d)),m&&v){var x={};$t(v,(function(e,t){x[t]={v:e}})),R.setExtraContent(JSON.stringify(x))}if(_){var L=this._codec.getModule(gn);if(T&&L.setTitle(T),b&&k){var U=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,i=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,d=t.googleConfig,l={};l["thread-id"]=n||"",l["apns-collapse-id"]=r||"",l.category=i||"",l.richMediaUri=o||"";var h={};h.collapse_key=null==d?void 0:d.collapseKey,h.imageUrl=null==d?void 0:d.imageUrl;var p=null==d?void 0:d.priority;p&&!["high","normal"].includes(p)&&(p="normal"),h.priority=p;var f=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||""}},{APNS:l},{FCM:h}];return JSON.stringify(f)}(b,k);L.setPushConfigs(U)}(null==k?void 0:k.notificationId)&&L.setPushId(null==k?void 0:k.notificationId),L.setTemplateId(w||""),R.setPushExt(o?L.getArrayData():L)}return He(y)||R.setBusChannel(y),R},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,r=this._codec.getModule(Rn);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Cn);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,r=t.order,i=t.timestamp,o=t.channelId,s=this._codec.getModule(Tn);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(In);return r.setType(1),r.setCount(t),r.setStartTime(n),r.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,i=e.order;t=t||0,r=r||0,i=i||0;var o=this._codec.getModule(In);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(i),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=this._codec.getModule(Nn);return r.setType(t),r.setBusChannel(n),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(kn),r=[];return $t(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(wn);o.setType(n),o.setChannelId(i),r.push(o)})),n.setSessions(r),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var i=this._codec.getModule(An),o=[];return $t(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(o),i.setBusChannel(r),i.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n){var r=this._codec.getModule(Mn);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,r=e.targetId,i=t.timestamp,o=this._codec.getModule(Pn);return i=i||+new Date,o.setType(n),o.setChannelId(r),o.setMsgTime(i),o.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(xn);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Un);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r){var i=this._codec.getModule(er);return i.setType(e),i.setKey(t),i.setHttpMethod(n),i.setQueryString(r),i.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r="comet"===this._connectType,i=this._codec.getModule(sr),o=t.key,s=t.value,a=t.notificationExtra,c=t.isSendNotification,u=t.type||bt.UPDATE,d=cn(t,u),l={key:o,value:s||"",uid:n};if(He(d)||(l.status=d),i.setEntry(l),c){var h={conversationType:Ne.CHATROOM,targetId:e},p={key:o,value:s,extra:a,type:u},f=this._getUpMsgModule(h,{messageType:_t.CHRM_KV_NOTIFY,content:p,isPersited:!1,isCounted:!1});r?i.setNotification(f.getArrayData()):i.setNotification(f),i.setBNotify(!0),i.setType(Ne.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){this._connectType;var r=this._codec.getModule(ar),i=t.entries,o=t.type||bt.UPDATE,s=cn(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n};He(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(hr);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(gr);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(_r);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e){var t=this,n="comet"===this._connectType,r=this._codec.getModule(Er),i=an.getTime(),o=[];return $t(e,(function(e){var r=t._codec.getModule(Rr),s=e.conversationType,a=e.targetId,c=e.notificationStatus,u=e.isTop,d=e.channelId,l=[];r.setType(s),r.setChannelId(a),r.setTime(i),r.setBusChannel(d);var h=c===Rt.OPEN,p={};He(c)||(p[1]=h),He(u)||(p[2]=u),$t(p,(function(e,r){if(!He(e)){var i=t._codec.getModule(Cr);e=e?"1":"0",i.setSessionStateType(Number(r)),i.setValue(e);var o=n?i.getArrayData():i;l.push(o)}})),r.setStateItem(l);var f=n?r.getArrayData():r;o.push(f)})),r.setVersion(i),r.setState(o),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(Sr);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(wr),o=[];return e.forEach((function(e){var t=n._codec.getModule(Or);t.setTagId(e.tagId),t.setName(e.tagName),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(Sr);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Nr),o=[];return e.forEach((function(e){var t=n._codec.getModule(Or);t.setTagId(e),o.push(r?t.getArrayData():t)})),i.setTags(o),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Ar);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r="comet"===this._connectType,i=this._codec.getModule(Er),o=[];return t.forEach((function(t){var i=n._codec.getModule(Rr),s=n._codec.getModule(Cr),a=[];e.forEach((function(e){var t=n._codec.getModule(Or);t.setTagId(e.tagId),He(e.isTop)||t.setIsTop(e.isTop),a.push(r?t.getArrayData():t)})),s.setSessionStateType(3),s.setValue(JSON.stringify(a)),s.setTags(a),i.setType(t.conversationType),i.setChannelId(t.targetId),i.setTime(Date.now()),i.setStateItem([r?s.getArrayData():s]),o.push(r?i.getArrayData():i)})),i.setState(o),i.setVersion(an.getTime()),i.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Mr);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeJoinRTCRoom=function(e,t,n){var r=this._codec.getModule(Vn);return e=e||0,r.setRoomType(e),He(t)||r.setBroadcastType(t),He(n)||r.setJoinType(n),r.getArrayData()},e.prototype.encodeQuitRTCRoom=function(){return this._codec.getModule(Fn).getArrayData()},e.prototype.encodeSetRTCData=function(e,t,n,r,i){var o=this._codec.getModule(jn);if(o.setInterior(n),o.setTarget(r),o.setKey(e),o.setValue(t),i){i.name&&o.setObjectName(i.name);var s=i.content;s&&(Fe(s)&&(s=JSON.stringify(s)),o.setContent(s))}return o.getArrayData()},e.prototype.encodeUserSetRTCData=function(e,t,n,r){var i=this,o="comet"===this._connectType,s=this._codec.getModule(Hn);s.setObjectName(n);var a=this._codec.getModule(Zn);a.setKey(e.name),a.setValue(e.content),o?s.setContent([a.getArrayData()]):s.setContent(a);var c=[];return["uris","mcu_uris"].forEach((function(e){var n=i._codec.getModule(Zn);n.setKey(e);var s="uris"===e?t:r;n.setValue(s),o?c.push(n.getArrayData()):c.push(n)})),s.setValueInfo(c),s.getArrayData()},e.prototype.encodeUserSetRTCCDNUris=function(e,t){this._connectType;var n=this._codec.getModule(Hn);n.setObjectName(e);var r=this._codec.getModule(Zn);return r.setKey("cdn_uris"),r.setValue(t),n.setValueInfo(r),n.getArrayData()},e.prototype.encodeGetRTCData=function(e,t,n){var r=this._codec.getModule(Kn);return r.setInterior(t),r.setTarget(n),r.setKey(e),r.getArrayData()},e.prototype.encodeRemoveRTCData=function(e,t,n,r){var i=this._codec.getModule(Kn);i.setInterior(t),i.setTarget(n),i.setKey(e);var o=(r=r||{}).name,s=r.content;return!He(o)&&i.setObjectName(o),He(s)||(Fe(s)&&(s=JSON.stringify(s)),i.setContent(s)),i.getArrayData()},e.prototype.encodeSetRTCOutData=function(e,t,n){var r=this._codec.getModule(qn);r.setTarget(t),De(e)||(e=[e]),$t(e,(function(t,n){t.key=t.key?t.key.toString():t.key,t.value=t.value?t.value.toString():t.value,e[n]=t})),r.setValueInfo(e);var i=(n=n||{}).name,o=n.content;return!He(i)&&r.setObjectName(i),He(o)||(Fe(o)&&(o=JSON.stringify(o)),r.setContent(o)),r.getArrayData()},e.prototype.ecnodeGetRTCOutData=function(e){var t=this._codec.getModule(Wn);return t.setUserId(e),t.getArrayData()},e.prototype.encodeSetRTCState=function(e){var t=this._codec.getModule(Gn);return t.setState(e),t.getArrayData()},e.prototype.encodeGetRTCRoomInfo=function(){var e=this._codec.getModule(Qn);return e.setOrder(2),e.getArrayData()},e.prototype.encodeSetRTCUserInfo=function(e,t){var n=this._codec.getModule(Zn);return n.setKey(e),n.setValue(t),n.getArrayData()},e.prototype.encodeRemoveRTCUserInfo=function(e){var t=this._codec.getModule($n);return t.setKey(e),t.getArrayData()},e.prototype.encodeIdentityChangeInfo=function(e,t,n){void 0===n&&(n=!1);var r=this._codec.getModule(Vn);return r.setRoomType(wt.LIVE),t&&r.setBroadcastType(t),r.setIdentityChangeType(e),r.setNeedSysChatroom(n),r.getArrayData()},e.prototype.encodePullRTCRoomKV=function(e,t){var n=this._codec.getModule(Lr);return n.setTimestamp(t),n.setRoomId(e),n.getArrayData()},e.prototype.encodeQueryUserJoinedInfo=function(e){var t=this._codec.getModule(Dr);return t.setUserId(e),t.getArrayData()},e.prototype.encodeRequestRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=this._codec.getModule(Fr);return s.setInvitedRoomId(t),s.setInvitedUserId(n),s.setInviteSessionId(r),s.setTimeoutTime(i),s.setInviteInfo(o),s.getArrayData()},e.prototype.encodeCancelRoomPK=function(e){var t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=this._codec.getModule(jr);return o.setInvitedRoomId(t),o.setInvitedUserId(n),o.setInviteSessionId(r),o.setInviteInfo(i),o.getArrayData()},e.prototype.encodeResponseRoomPK=function(e){var t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree?1:0,c=this._codec.getModule(Hr);return c.setInviteUserId(t),c.setInviteRoomId(n),c.setInviteSessionId(r),c.setContent(i),c.setKey(o),c.setValue(s),c.setAnswerCode(a),c.getArrayData()},e.prototype.encodeEndRoomPK=function(e){var t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=this._codec.getModule(Kr);return o.setInviteRoomId(t),o.setInviteSessionId(n),o.setInviteContent(r),o.setInviteRoomKeys(i),o.getArrayData()},e}(),fi=function(e,t){this._watcher=t,this.codec=new pi(e)},gi=function(e,t){return e&&t?t+"_"+e:e||Date.now()},mi=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return gi(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),vi=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new dn(e,!1,Ft.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return gi(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new pn;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),_i=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return pe(t,e),t.prototype.readMessage=function(e,n,r){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(r===qt.V4){var i=e.readByte();1&i&&(this.userId=e.readUTF()),2&i&&e.readUTF(),4&i&&(this.timestamp=e.readLong()),8&i&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var o=e.readUTF();Qe.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(mi),yi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.DISCONNECT,t.status=0,t}return pe(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(mi),Ri=function(e){function t(){var t=e.call(this,jt.PING_REQ)||this;return t._name=Ht.PING_REQ,t}return pe(t,e),t.prototype.writeMessage=function(e){},t}(vi),Ci=function(e){function t(t){var n=e.call(this,t)||this;return n._name=Ht.PING_RESP,n}return pe(t,e),t}(mi),Ei=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return pe(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(mi),Ti=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return pe(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)},t}(vi),Si=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Kt.PUB,t}return pe(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}(Ei),Ii=function(e){function t(t,n,r){var i=e.call(this,jt.PUBLISH)||this;return i._name=Ht.PUBLISH,i.syncMsg=!1,i.identifier=Kt.PUB,i.topic=t,i.data=xe(n)?ln.writeUTF(n):n,i.targetId=r,i}return pe(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Ti),bi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=Kt.PUB,t.topic="",t.targetId="",t}return pe(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}(Ei),ki=function(e){function t(t){var n=e.call(this,jt.PUB_ACK)||this;return n._name=Ht.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return pe(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Ti),wi=function(e){function t(t,n,r){var i=e.call(this,jt.QUERY)||this;return i.name=Ht.QUERY,i.identifier=Kt.QUERY,i.topic=t,i.data=xe(n)?ln.writeUTF(n):n,i.targetId=r,i}return pe(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(Ti),Oi=function(e){function t(t){var n=e.call(this,jt.QUERY_CONFIRM)||this;return n._name=Ht.QUERY_CON,n.messageId=t,n}return pe(t,e),t}(Ti),Ni=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=Ht.QUERY_ACK,t.status=0,t.identifier=Kt.QUERY,t.topic="",t.targetId="",t}return pe(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}(Ei),Ai=function(e){var t,n=e.type;switch(n){case jt.CONN_ACK:t=new _i(e);break;case jt.PUBLISH:(t=new Si(e)).syncMsg=e.syncMsg;break;case jt.PUB_ACK:t=new bi(e);break;case jt.QUERY_ACK:t=new Ni(e);break;case jt.SUB_ACK:case jt.UNSUB_ACK:case jt.PING_RESP:t=new Ci(e);break;case jt.DISCONNECT:t=new yi(e);break;default:t=new mi(e),Qe.error("No support for deserializing "+n+" messages")}return t};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.addSeTag=73]="addSeTag",e[e.delSeTag=74]="delSeTag",e[e.addTag=75]="addTag",e[e.delTag=76]="delTag",e[e.disTag=77]="disTag",e[e.reportsdk=78]="reportsdk",e[e.rtcInvite=79]="rtcInvite",e[e.rtcCancelInvite=80]="rtcCancelInvite",e[e.rtcInviteAnswer=81]="rtcInviteAnswer",e[e.rtcEndInvite=82]="rtcEndInvite"}(ti||(ti={}));var Mi,Pi=ti,xi=function(e,t,n,r){return ve(void 0,void 0,void 0,(function(){var i;return _e(this,(function(o){return i=0,e.forEach((function(o){return ve(void 0,void 0,void 0,(function(){var s,a;return _e(this,(function(c){switch(c.label){case 0:return s=t+"://"+o+"/ping?r="+(9999,1e3+Math.floor(8999*Math.random())),Qe.debug("start ping",s),[4,n.httpReq({url:s,timeout:5e3})];case 1:return a=c.sent(),Qe.debug("end ping",i,s,a.status),i++,r({finished:i===e.length,code:a.status,host:o}),[2]}}))}))})),[2]}))}))},Li=function(e,t,n,r,i,o,s,a){return e+"://"+t+"/websocket?appId="+n+"&token="+encodeURIComponent(r)+"&sdkVer="+o+"&pid="+s+"&apiVer="+(i.isFromUniapp?"uniapp":"normal")+(i.connectPlatform?"&platform="+i.connectPlatform:"")+(a?"&protocolVer="+a:"")},Ui=function(e){return[Pi.ppMsgS,Pi.pgMsgS,Pi.chatMsgS].map((function(e){return Pi[e]})).indexOf(e)>=0};!function(e){e[e.REDIRECT=0]="REDIRECT",e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.REMOTE_CLOSE=3]="REMOTE_CLOSE",e[e.LOGOUT=4]="LOGOUT",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW"}(Mi||(Mi={}));var Di,Vi=function(e,t){Qe.info("websocket send -> messageId: "+e.messageId);var n=e.getBufferData();t.send(n.buffer)},Bi=function(e){function t(t,n){var r=e.call(this,"websocket",n)||this;return r._runtime=t,r._socket=null,r._messageIds={},r._syncMessageIds={},r._failedCount=0,r.ALLOW_FAILED_TIMES=2,r._timer=null,r._idCount=0,r._generateMessageId=function(){return r._idCount>=65535&&(r._idCount=0),++r._idCount},r}return pe(t,e),t.prototype.connect=function(e,t,n,r,i,o){return ve(this,void 0,void 0,(function(){var s=this;return _e(this,(function(a){return[2,new Promise((function(a){var c=[],u=0,d=!1,l=!1,h=function n(){return ve(s,void 0,void 0,(function(){var s;return _e(this,(function(u){switch(u.label){case 0:return 0===c.length||d?[2]:(d=!0,[4,this._connect(e,t,c.shift(),r,i,o)]);case 1:if((s=u.sent())===nt.SUCCESS)this._checkAlive(),a(s);else if(s===ct)a(s);else{if(l&&0===c.length)return a(on(s)),[2];d=!1,n()}return[2]}}))}))};i=Te(i),s._watcher.status(it.CONNECTING),xi(n,r,s._runtime,(function(e){var t=e.code,n=e.finished,r=e.host;l=n,200===t&&(c.push(r),u++,h()),n&&0===u&&(Qe.error("No valid websocket server hosts!"),a(nt.RC_SOCKET_NOT_CREATED))}))}))]}))}))},t.prototype._connect=function(e,t,n,r,i,o){return ve(this,void 0,void 0,(function(){var s,a,c,u,d,l=this;return _e(this,(function(h){switch(h.label){case 0:return s=r.replace("http","ws"),a=Li(s,n,e,t,this._runtime,i,"",o),Qe.debug("conenct start -> "+a),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(a),u=function(e){l._timer&&(clearTimeout(l._timer),l._timer=null),l._socket===c&&(l._socket=null,l._watcher.status(e))},[4,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),r=new hn(n),i=r.readByte(),o=new dn(i),s=Ai(o);return s.read(r,n.length-1,t),s}(t,o);if(n instanceof Ci&&l._pingResolve)return l._pingResolve(nt.SUCCESS),void(l._pingResolve=void 0);if(n instanceof _i)return Qe.debug("recv connect ack -> "+n.status),n.status!==ot?(Qe.warn("connect failed: "+n.status),void e(n.status)):(Qe.info("connect success -> "+a),l.connectedTime=n.timestamp,l.userId=n.userId||"",l._idCount=n.messageId,void e(nt.SUCCESS));if(n instanceof yi){var r=n.status;switch(Qe.warn("recv disconnect signal -> status: "+r),r){case Mi.BLOCK:l._watcher.status(it.BLOCKED);break;case Mi.OTHER_DEVICE_LOGIN:l._watcher.status(it.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Mi.REDIRECT_NEW:case Mi.REDIRECT:l._watcher.status(it.REDIRECT);break;default:l._watcher.status(it.DISCONNECT_BY_SERVER)}}else l._onReceiveSignal(n)}else Qe.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var r in Qe.warn("websocket closed! code:",t,"reason:",n),u(it.CONNECTION_CLOSED),l._messageIds){var i=l._messageIds[r];delete l._messageIds[r],i(nt.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){var n;for(var r in Qe.error("websocket error!",null===(n=t)||void 0===n?void 0:n.stack),u(it.WEBSOCKET_ERROR),l._messageIds){var i=l._messageIds[r];delete l._messageIds[r],i(nt.RC_NET_CHANNEL_INVALID)}e(nt.NETWORK_ERROR)})),c.onOpen((function(){return Qe.debug("websocket open =>",a)})),setTimeout((function(){e(nt.TIMEOUT)}),5e3)}))];case 1:return(d=h.sent())===nt.SUCCESS?this._socket=c:(Qe.warn("connect result -> code: "+d+", url: "+a),c.close()),[2,d]}}))}))},t.prototype._checkAlive=function(){var e;return ve(this,void 0,void 0,(function(){var t,n=this;return _e(this,(function(r){switch(r.label){case 0:return this._socket?(Qe.debug("send ping ->"),this.sendOnly(new Ri),[4,new Promise((function(e){n._pingResolve=e,n._timer&&clearTimeout(n._timer),n._timer=setTimeout((function(){n._pingResolve=void 0,e(nt.TIMEOUT)}),15e3)}))]):[2];case 1:return(t=r.sent())!==nt.SUCCESS?(this._failedCount+=1,Qe.warn("ping failed count: "+this._failedCount+", code: "+t),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,Qe.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._watcher.status(it.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(Qe.debug("recv pong <-"),this._failedCount=0,setTimeout((function(){return n._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a=this;return _e(this,(function(c){switch(c.label){case 0:return t=e.messageId,e.header&&e.header.qos!==Ft.AT_MOST_ONCE&&(e instanceof Si&&!e.syncMsg&&(Qe.debug("send pubAck -> "+t),this.sendOnly(new ki(t))),e instanceof Ni&&(Qe.debug("send queryCon -> "+t),this.sendOnly(new Oi(t)))),t>0&&(e instanceof bi||e instanceof Ni)&&(Qe.debug("recv ack -> messageId: "+t),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(r=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],r(e))),e instanceof Si?(i=e.syncMsg,(o=e.topic)===Pi[Pi.userSetData]?[2]:!i||Ui(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=c.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),c.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&Vi(e,this._socket)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),ve(this,void 0,void 0,(function(){var i,o,s,a=this;return _e(this,(function(c){switch(c.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,Vi(e,this._socket),[4,new Promise((function(e){a._messageIds[i]=e,setTimeout((function(){a._messageIds[i]&&delete a._messageIds[i],e()}),r)}))]):[3,2];case 1:return(o=c.sent())?o instanceof Ni||o instanceof bi?(s=t&&o.data?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(Qe.warn("send failed -> message: "+i+", respPBName: "+t+", status: "+o.status),[2,{code:o.status,data:t&&o.data?s:null}]):[2,{code:nt.SUCCESS,data:s}]):[2,{code:o}]:(Qe.warn("send timeout -> message: "+i+", respPBName: "+t+", timeout: "+r),[2,{code:nt.TIMEOUT}]);case 2:return[2,{code:nt.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(it.DISCONNECTED))},t}(fi);!function(e){e.GET="GET",e.POST="POST"}(Di||(Di={}));var Fi=function(e){function t(t,n){var r=e.call(this,"comet",n)||this;return r._runtime=t,r._messageIds={},r._syncMessageIds={},r._idCount=0,r._generateMessageId=function(){return++r._idCount},r._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),r}return pe(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=xe(e.data)?JSON.parse(e.data):e.data;return n?!De(n)||($t(n,(function(e){return ve(t,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d,l,h=this;return _e(this,(function(p){switch(p.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new dn(t),r=Ai(n);for(var i in e)r[i]=e[i];return r}(e),r=n.messageId,i=n._header,o=n.status,n.identifier,s=i&&i.qos!==Ft.AT_MOST_ONCE,r&&n.getIdentifier&&((a=this._messageIds[r])&&a(n),this._syncMessageIds[r]&&this._syncMessageIds[r](n)),s&&(n instanceof Si&&!n.syncMsg&&(c=new ki(r),this.sendOnly(c)),n instanceof Ni&&(c=new Oi(r),this.sendOnly(c))),n instanceof yi){switch(o){case Mi.OTHER_DEVICE_LOGIN:this._watcher.status(it.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case Mi.BLOCK:this._watcher.status(it.BLOCKED);break;case Mi.REDIRECT_NEW:case Mi.REDIRECT:this._watcher.status(it.REDIRECT);break;default:this._watcher.status(it.DISCONNECT_BY_SERVER)}return[2]}return n instanceof Si?(u=n.syncMsg,d=n.topic,!u||Ui(d)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){h._syncMessageIds[r]=e}))]):[3,2];case 1:l=p.sent(),delete this._syncMessageIds[r],this._watcher.signal(n,l),p.label=2;case 2:return[2]}}))}))})),!0):(Qe.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i;return _e(this,(function(o){switch(o.label){case 0:return t=(new Date).getTime(),n=e+"://"+this._domain+"/pullmsg.js?sessionid="+this._sessionid+"×trap="+t+"&pid="+this._pid,[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return r=o.sent(),i=this.handleCometRes(r),this._isDisconnected||(i?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(it.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,r,i,o){return ve(this,void 0,void 0,(function(){var o,s,a,c,u=this;return _e(this,(function(d){return i=Te(i),this._protocol=r,this._isDisconnected=!1,this._watcher.status(it.CONNECTING),o=[],s=0,a=!1,c=!1,[2,new Promise((function(d){var l=function n(){return ve(u,void 0,void 0,(function(){var s;return _e(this,(function(u){switch(u.label){case 0:return 0===o.length||a?[2]:(a=!0,[4,this._connect(e,t,o.shift(),r,i)]);case 1:if((s=u.sent())===nt.SUCCESS)this._startPullSignal(r),d(s);else if(s===ct)d(s);else{if(c&&0===o.length)return d(on(s)),[2];a=!1,n()}return[2]}}))}))};u._watcher.status(it.CONNECTING),xi(n,r,u._runtime,(function(e){var t=e.code,n=e.finished,r=e.host;c=n,200===t&&(o.push(r),s++,l()),n&&0===s&&(Qe.error("No valid websocket server hosts!"),d(nt.RC_SOCKET_NOT_CREATED))}))}))]}))}))},t.prototype._connect=function(e,t,n,r,i){return ve(this,void 0,void 0,(function(){var o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(Qe.error("handle comet res -> res: "+JSON.stringify(e||{})),!1):!!e.data&&(function(e){if(Fe(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?Fe(e.data)?e.data:JSON.parse(e.data):(Qe.error("received data is not a validJson",e.data),!1))},s=Li(r,n,e,t,this._runtime,i,this._pid),this.sendConnectTime=Date.now(),Qe.debug("conenct start -> "+s),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=u.sent(),c=o(a),this._domain=n,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp):Qe.warn("connect result -> code: "+(null==c?void 0:c.status)+", url: "+s),[2,null==c?void 0:c.status]}}))}))},t.prototype.sendCometData=function(e,t){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d;return _e(this,(function(l){switch(l.label){case 0:return n=(t=this)._domain,r=t._sessionid,i=t._pid,o=e.messageId,s=e.topic,a=e.targetId,e.identifier,c=e.getHeaderFlag(),u=s?this._protocol+"://"+n+"/websocket?messageid="+o+"&header="+c+"&sessionid="+r+"&topic="+s+"&targetid="+a+"&pid="+i:this._protocol+"://"+n+"/websocket?messageid="+o+"&header="+c+"&sessionid="+r+"&pid="+i,[4,this._runtime.httpReq({url:u,method:Di.POST,body:e.getCometData()})];case 1:return d=l.sent(),this.handleCometRes(d),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),ve(this,void 0,void 0,(function(){var i,o,s,a=this;return _e(this,(function(c){switch(c.label){case 0:return i=this._generateMessageId(),e.messageId=i,this.sendCometData(e),[4,new Promise((function(e){a._messageIds[i]=e,setTimeout((function(){delete a._messageIds[i],e()}),r)}))];case 1:return(o=c.sent())?(s=t&&o.data?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?s:null}]:[2,{code:nt.SUCCESS,data:s}]):[2,{code:nt.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(it.DISCONNECTED)},t}(fi),ji=function(e){return["navi",e].join("_")},Hi=function(){function e(e,t){this._runtime=e,this._options=t,this._naviInfo=null,this._appkey=this._options.appkey,this._apiVersion=Te(this._options.apiVersion)}return e.prototype.getInfo=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o;return _e(this,(function(s){switch(s.label){case 0:return n&&this._clear(e),(i=function(e,t,n){var r,i,o=ji(e);try{var s=n.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();return i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5}))),0===i.length?n.removeItem(o):n.setItem(o,JSON.stringify(i)),(null===(r=i.find((function(e){return e.token===t})))||void 0===r?void 0:r.naviInfo)||null}(this._appkey,e,this._runtime.localStorage))?(this._naviInfo=i,[2,i]):(o=this._options.navigators.slice(),t.length&&t.forEach((function(e){o.indexOf(e)<0&&o.unshift(e)})),[4,this._reqNavi(o,this._appkey,e,r)]);case 1:return(i=s.sent())?(this._naviInfo=i,this.setNaviInfo2Cache(e,i),[2,i]):[2,i]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){this._naviInfo=t,function(e,t,n,r){var i,o=ji(e);try{var s=r.getItem(o);i=s?JSON.parse(s):[]}catch(e){i=[]}var a=Date.now();i.length>0&&(i=i.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),i.push({timestamp:a,naviInfo:n,token:t}),r.setItem(o,JSON.stringify(i))}(this._appkey,e,t,this._runtime.localStorage)},e.prototype.getInfoFromCache=function(e){return this._naviInfo},e.prototype._clear=function(e){!function(e,t,n){var r,i=ji(e);try{var o=n.getItem(i);r=o?JSON.parse(o):[]}catch(e){r=[]}var s=Date.now();r.length>0&&(r=r.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===r.length?n.removeItem(i):n.setItem(i,JSON.stringify(r))}(this._appkey,e,this._runtime.localStorage)},e}(),Ki=function(e,t,n){return[e,t,n].join("_")},qi=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=Ki("inbox",this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=Ki("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=Ki("outbox",this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=Ki("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),Gi={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Yi=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=r===bt.DELETE,c=s===o,u=!this._isExisted(n),d=a?this._remove:this._add;(t||i||c||u)&&d.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)})),Qe.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),Ji=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return ve(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return _e(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(r=Gi.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===nt.SUCCESS?(Gi.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Gi.clear(e);var t=this._storeCaches[e];t&&t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var r=this._storeCaches[e];Ge(r)||(r=new Yi(e,n)),r.setEntries(t),this._storeCaches[e]=r},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),Wi=function(){function e(e,t,n,r){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=r,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-"+this._appkey+"-"+this._userId}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(ne){Qe.error("parse rejoined chrm infos error -> "+t),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],Ge(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),zi="converStatusChanged",Qi=function(){function e(e,t,n){this._eventEmitter=new Xe,this._pullQueue=[],this._isPulling=!1,this._storage=ue(e.runtime),this._appkey=t,this._currentUserId=n,this._engine=e,this._storagePullTimeKey="con-s-"+t+"-"+n}return e.prototype._set=function(e){var t=this;if(!He(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(zi,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return ve(this,void 0,void 0,(function(){var e,t,n,r;return _e(this,(function(i){switch(i.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=i.sent(),n=t.code,r=t.data,n===nt.SUCCESS?(this._isPulling=!1,this._set(r),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(zi,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(zi,(function(e){}))},e}(),Xi={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},Zi={};for(var $i in Xi){var eo=Xi[$i].keyName;Zi[eo]=$i}var to,no=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var r="con-"+t+"-"+n;this.storage=new le(e,r),this._localStore=new le(e,"CONVER-"+t+"-"+n)}return e.prototype._getStoreKey=function(e,t,n){return n+"_"+e+"_"+t},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:Ne.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,r=e.targetId,i=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,c=e.channelId,u=this._getStoreKey(n,r,c),d=this._localStore.get(u)||{},l=Zi.mentionedInfo,h=Zi.hasMentioned,p=d[l]||{},f=p.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===Ne.GROUP&&((g.userIdList||[]).forEach((function(e){e===t._currentUserId&&f.indexOf(a)<0&&f.push(a)})),g.type===Et.ALL&&f.indexOf(a)<0&&f.push(a)),i===_t.RECALL&&n===Ne.GROUP){var m=f.indexOf(a);m>=0&&f.splice(m,1)}g={userIdList:f,type:(null==g?void 0:g.type)||p.type},0!==f.length?(d[l]=g,d[h]=!0):(delete d[l],delete d[h]),Ge(d)?this._localStore.set(u,d):this._localStore.remove(u)}},e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=Zi[s],c=n[s];if(!He(a)&&!He(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(c===Xi[a].defaultVal||"tags"===s&&!Ge(c))delete o[a];else if("tags"===s){var u=c;for(var d in u)u[d].isTop||delete u[d].isTop;o[a]=c}else o[a]=c;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}Ge(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in Xi){var a=Xi[s],c=a.keyName,u=a.defaultVal;o[c]=i[s]||nn(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=t[r];for(var a in s){var c=Xi[a],u=c.keyName,d=c.defaultVal;o[u]=s[a]||nn(d)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=e[n];for(var c in a){var u=Xi[c],d=u.keyName,l=u.defaultVal;s[d]=a[c]||nn(l)}for(var h in s.tags){He(t[h])&&(t[h]=[]);var p=Object.assign({},s,{conversationType:i,targetId:o});delete p.tags,t[h].push(p)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_"+t;this._localStore.set(n,e[t])}}catch(e){Qe.error("adaptOldStore error: "+e.message)}},e}(),ro=[Ne.PRIVATE,Ne.GROUP,Ne.SYSTEM,Ne.PUBLIC_SERVICE,Ne.APP_PUBLIC_SERVICE],io="conversationChanged",oo="conTagStatusChanged",so=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Xe,this._draftMap={},this._appkey=t,this._loginUserId=n,this._store=new no(e.runtime,t,n),this._statusManager=new Qi(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(io,(function(e){r(e)})),this._eventEmitter.on(oo,(function(){i()}))}return e.prototype._calcUnreadCount=function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=s===$e.SEND&&a===this._loginUserId,u=r===_t.RECALL,d=Fe(n),l=!1,h={},p=t.lastUnreadTime||0,f=t.unreadMessageCount||0;return p>i||c||(o&&(t.unreadMessageCount=f+1,t.lastUnreadTime=i,l=!0),u&&d&&p>=n.sentTime&&f&&(t.unreadMessageCount=f-1,l=!0),l&&(h.unreadMessageCount={val:t.unreadMessageCount,time:i})),{hasChanged:l,localConversation:t,updateItems:h}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=(e.messageDirection,e.isMentioned),i=e.sentTime;$e.SEND;var o=Fe(n),s=!1,a={};return r&&o&&n.mentionedInfo&&(t.hasMentioned=!0,s=!0,a.hasMentioned={val:!0,time:i},a.mentionedInfo={val:n.mentionedInfo,time:i}),{hasChanged:s,localConversation:t,updateItems:a}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===$e.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===Et.ALL||(a||[]).includes(this._loginUserId)){i=!0;var c=t.unreadMentionedCount||0;t.unreadMentionedCount=c+1}}return{hasChanged:i,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Fe(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i=t+"_"+n,o=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var o in i)if(!n[o]||i[o].isTop!==n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,o=e.notificationStatus,s=e.isTop,a=e.tags,c=e.channelId,u={},d={};He(o)||(d.notificationStatus={time:i,val:o}),He(s)||(d.isTop={time:i,val:s}),He(a)||(d.tags={time:i,val:a},null==a||a.forEach((function(e){u[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,u,c),this._store.set(n,r,{notificationStatus:o,isTop:s,tags:u},c),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:d,channelId:c}),t&&this._notifyConversationChanged()},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(io,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(oo),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId;if(ro.indexOf(r)>=0){var a=!1,c=this._store.get(r,o,s),u={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,c),i=r.hasChanged,o=r.localConversation,s=r.updateItems;a=a||i,u=me(me({},u),s),c=nn(o)})),a&&this._store.set(r,o,c,s),this._store.updateMentionedData(e),i){var d=this._store.get(r,o,s);d.updatedItems=me({latestMessage:{time:e.sentTime,val:e}},u),d.latestMessage=e;var l=Object.assign(d,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(l)}(a||i)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,o=e.notificationStatus,s=e.conversationType;r=r||0,(n||1!==o)&&(t.length>0?t.includes(Number(s))&&(i+=Number(r)):i+=Number(r))})),i},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus;(t||1!==i)&&(n=n||0,r+=Number(n))})),r},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,r){void 0===r&&(r=!0);var i=this._store.get(e,t,n),o=i.unreadMessageCount,s=i.hasMentioned,a={};if(o&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var c=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(c),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,e._store.set(t.conversationType,t.targetId,t,t.channelId))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,r){var i=e+"_"+t+"_"+r;this._draftMap[i]=n},e.prototype.getDraft=function(e,t,n){var r=e+"_"+t+"_"+n;return this._draftMap[r]},e.prototype.clearDraft=function(e,t,n){var r=e+"_"+t+"_"+n;delete this._draftMap[r]},e.prototype.addTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;i=Object.assign(i,n),this._store.set(e,t,{tags:i},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;n.forEach((function(e){delete i[e]})),this._store.set(e,t,{tags:i},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===Rt.OPEN})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).unreadMentionedCount||0},e.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t},e}(),ao=function(){function e(e,t,n,r){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-"+t+"-"+n,this._storagePullTimeKey="us-s-"+t+"-"+n,this._storage=ue(e.runtime),this._engine=e,this._tagWatcherFunc=r}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return ve(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=c.sent(),n=t.code,r=t.data,n!==nt.SUCCESS||He(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,He(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),co=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._miniConnectUrl="",r._connectType=n.connectionType,r}return pe(t,e),t.prototype._formatJSONPUrl=function(e,t,n,r){return e+"/"+(this._runtime.isSupportSocket()&&"websocket"===this._connectType?"navi":"cometnavi")+".js?appId="+n+"&token="+encodeURIComponent(t)+"&callBack="+r+"&v="+this._apiVersion+"&r="+Date.now()},t.prototype.getInfo=function(t,n,r){var i;return ve(this,void 0,void 0,(function(){var o;return _e(this,(function(s){return this._runtime.useNavi||(void 0,o=this._runtime.isSupportSocket()&&"websocket"===this._connectType?oe.join(","):se.join(","),this._miniConnectUrl=(null===(i=this._options.miniCMPProxy)||void 0===i?void 0:i.length)?this._options.miniCMPProxy.join(","):o||"",n=[]),[2,e.prototype.getInfo.call(this,t,n,r)]}))}))},t.prototype._reqNavi=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l;return _e(this,(function(h){switch(h.label){case 0:r="getServerEndpoint",i=0,o=e.length,h.label=1;case 1:return i<o?(s=this._formatJSONPUrl(e[i],n,t,r),Qe.debug("req navi => "+s),[4,this._runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(200!==(a=h.sent()).status)return 403===a.status?Qe.error("request navi error: "+nt.RC_CONN_USER_OR_PASSWD_ERROR):401===a.status&&Qe.error("request navi error: "+nt.RC_CONN_APP_BLOCKED_OR_DELETED),[3,3];try{return c=a.data.match(/{[\d\D]+}/),0===(u=c&&c[0]?c[0]:"").indexOf('{\\"code\\":')&&(u=JSON.parse('"'+u+'"')),l=JSON.parse(u),d=/^https/.test(s)?"https":"http",l.protocol=d,this._runtime.useNavi||(l.server="",l.backupServer=this._miniConnectUrl,l.logSwitch=0),[2,l]}catch(e){Qe.error("parse navi err =>",e)}h.label=3;case 3:return i+=1,[3,1];case 4:return this._runtime.useNavi?[2,null]:[2,l={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl}]}}))}))},t}(Hi),uo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return ve(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return _e(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,o===nt.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),lo=function(e,t){return["send_msg",e,t].join("_")},ho=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=lo(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=lo(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=lo(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))},e}(),po=function(e){var t="RCDeviceId",n=ue(e),r="",i=n.get(t);return i?r=i:(r=we(),n.set(t,r)),r};(to={})[Ne.PRIVATE]=Pi.qryPMsg,to[Ne.GROUP]=Pi.qryGMsg,to[Ne.CHATROOM]=Pi.qryCHMsg,to[Ne.CUSTOMER_SERVICE]=Pi.qryCMsg,to[Ne.SYSTEM]=Pi.qrySMsg;var fo=[Pi[Pi.recallMsg],Pi[Pi.ppMsgS],Pi[Pi.pgMsgS],Pi[Pi.ppMsgP],Pi[Pi.pgMsgP],Pi[Pi.chatMsg],Pi[Pi.pcMsgP],Pi[Pi.prMsgS]],go=function(e,t,n,r,i,o){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:$e.SEND,isCounted:!!n.isCounted,isMentioned:!!n.isMentioned,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:!!n.isPersited,messageUId:r,sentTime:i,receivedTime:0,disableNotification:!!n.disableNotification,isStatusMessage:!!n.isStatusMessage,canIncludeExpansion:!!n.canIncludeExpansion,expansion:n.canIncludeExpansion?n.expansion:null,receivedStatus:re.UNREAD,pushConfig:n.pushConfig,channelId:n.channelId}},mo=function(e){function t(t,n,r){var i=e.call(this,t,n,r)||this;return i._customMessageType={},i._reconnectTimer=-1,i._pullOfflineFinished=!1,i._connectedTime=0,i._localConnectedTime=0,i._pullingMsg=!1,i._pullQueue=[],i._chrmsQueue={},i._latestSyncTimestamp=0,i._intervalTimer=-1,i._letterbox=new qi(t,r.appkey),i._sendMessageStore=new ho(t,r.appkey),i._chrmEntryHandler=new Ji(i),i}return pe(t,e),t.prototype._createNavi=function(){return new co(this.runtime,this._options)},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a=this;return _e(this,(function(c){switch(c.label){case 0:return n=[],this._naviInfo=t,t.server?n.push(t.server):Qe.warn("navi.server is invalid"),(r=t.backupServer)&&r.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(Qe.error("navi invaild.",n),[2,nt.UNKNOWN]):(i=this.runtime.createDataChannel({status:function(r){a._connectionStatusHandler(r,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=qt.V3,1===t.openAnti&&(o=qt.V4),[4,i.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=c.sent())===nt.SUCCESS?(this._channel=i,this.currentUserId=i.userId,this._connectedTime=i.connectedTime,this._localConnectedTime=Math.floor((Date.now()+i.sendConnectTime)/2),this._watcher.status(it.CONNECTED),this._pullOfflineFinished=!1,this._conversationManager=new so(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new ao(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new uo(this),this._joinedChrmManager=new Wi(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval()):i.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,r){if(Qe.warn("connection status changed:",e),e!==it.CONNECTING)if(e!==it.CONNECTED){if(this._channel&&e!==it.DISCONNECTED)return e===it.BLOCKED||e===it.KICKED_OFFLINE_BY_OTHER_CLIENT||e===it.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==it.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,r)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i=this;return _e(this,(function(o){switch(o.label){case 0:return this._channel?(r=qt.V3,1===this._naviInfo.openAnti&&(r=qt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,r)]):[2];case 1:return o.sent()===nt.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(it.CONNECTED),this._rejoinChrm(),Qe.__insertLogIntoDatabase(),[2]):(this._watcher.status(it.WEBSOCKET_UNAVAILABLE),this._reconnectTimer=setTimeout((function(){i._reconnectTimer=-1,i._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=Pi[r];if(i)switch(i){case Pi.s_ntf:Qe.info("recv s_ntf -> signal.messageId: "+e.messageId),this._pullMsg(e);break;case Pi.s_msg:this._receiveMsg(e);break;case Pi.s_cmd:this._receiveStateNotify(e);break;case Pi.s_us:this._receiveSettingNotify(e);break;case Pi.rtc_ntf:this._receiveRtcKv(e)}else Qe.error("unknown topic:",r)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,En),r=n.time,i=n.type,o=n.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(o,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId})}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,vr)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,xr),r=n.time,i=n.type,o=n.roomId;if(1===i)this._rtcKVManager.pullEntry(o,r)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,r=t.del,i=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})},t.prototype._receiveSyncMsg=function(e,t){var n;if(fo.includes(e.topic)){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,fn,{currentUserId:this.currentUserId,signal:e});r=this._handleMsgProperties(r),t&&(r.sentTime=t.timestamp,r.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||r.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),r.messageType!==_t.EXPANSION_NOTIFY?(r.messageType===_t.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(r.conversationType,r.targetId,r.channelId),this._conversationManager.setConversationCacheByMessage(r,!0),this._watcher.batchMessage([r])):this._receiveMessageExpansion(r))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,En),n=t.type,r=t.chrmId,i=t.time;if(Qe.info("s_ntf -> type: "+n+", chrmId: "+r+", time: "+i),2===n){var o=this._chrmsQueue[r];if(!o)return;o.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()}},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval(),this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncMsg=function(){return ve(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,c,u,d,l,h,p,f=this;return _e(this,(function(g){switch(g.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),Qe.info("pullMsg -> sendboxTime: "+e+", inboxTime: "+t),n=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t}),r=new wi(Pi[Pi.pullMsg],n,this.currentUserId),[4,this._channel.send(r,vn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return i=g.sent(),o=i.code,s=i.data,this._latestSyncTimestamp=Date.now(),o===nt.SUCCESS&&s?(a=s.list,c=s.finished,u=s.syncTime,Qe.info("pullMsg success -> syncTime: "+u+", finished: "+c),d=0,l=[],a.forEach((function(e){if(e.messageDirection===$e.SEND&&(d=Math.max(e.sentTime,d),f._sendMessageStore.getSendMessageMap()[e.messageUId]))f._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==_t.EXPANSION_NOTIFY){if(e.messageType===_t.SYNC_READ_STATUS){if(e.senderUserId!==f.currentUserId)return;f._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=f._handleMsgProperties(e);f._conversationManager.setConversationCacheByMessage(t,!0),l.push(t)}else f._receiveMessageExpansion(e)})),this._watcher.batchMessage(l),this._letterbox.setInboxTime(u,this.currentUserId),this._letterbox.setOutboxTime(d,this.currentUserId),this._sendMessageStore.removeByTimestamp(d),this._pullingMsg=!1,h=this._pullQueue.filter((function(e){return e>u})),this._pullQueue.length=0,(p=this._pullQueue).push.apply(p,h),c&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),(!c||h.length>0)&&this._syncMsg(),[2]):(Qe.warn("pullMsg failed -> code:",o,", data: ",s),this._pullingMsg=!1,[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel&&!this._pullingMsg)if(this._pullQueue.length>0)this._syncMsg();else{var t=this._channel.codec.decodeByPBName(e.data,mn,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});(t=this._handleMsgProperties(t)).senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(t.messageUId,t.sentTime),t.isStatusMessage||t.senderUserId===this.currentUserId||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==_t.EXPANSION_NOTIFY?t.messageType===_t.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,i=e.isCounted,o=e.isPersited,s=e.isStatusMessage,a=r in ae,c=r in this._customMessageType;if(n=a?ae[r]:c?this._customMessageType[r]:{isCounted:!Ke(i)&&i,isPersited:!Ke(o)&&o},Object.assign(e,{isCounted:n.isCounted,isPersited:n.isPersited,isStatusMessage:ce.includes(r)}),t&&(e.isStatusMessage=s),!t){var u=e.content.user;if(u){var d=u.portrait,l=u.portraitUri,h=d||l;h&&(u.portrait=u.portraitUri=h)}}return e},t.prototype.getHistoryMessage=function(e,t,n,r,i,o){return void 0===o&&(o=""),ve(this,void 0,void 0,(function(){var s,a,c,u,d,l,h,p,f;return _e(this,(function(g){switch(g.label){case 0:return a=(s=this).currentUserId,c=s._channel,u=li[e]||ci,d=1===r&&0===n,c?(l=c.codec.encodeGetHistoryMsg(t,{timestamp:n,count:d?2:r,order:i,channelId:o}),[4,c.send(new wi(u,l,a),Sn,{currentUserId:a,connectedTime:c.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return h=g.sent(),(p=h.code)!==nt.SUCCESS?[2,{code:p}]:(f=h.data,d&&2===f.list.length&&(f.hasMore=!0,0===i?f.list.shift():f.list.pop()),[2,{code:p,data:{list:f.list,hasMore:f.hasMore}}]);case 2:return[2,{code:nt.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){Qe.debug("reportSDKInfo ->",e);var r=n.codec.encodeReportSDKInfo(JSON.stringify(e)),i=new wi(Pi[Pi.reportsdk],r,t);n.send(i).then((function(e){var t=e.code;t!==nt.SUCCESS&&Qe.warn("reportSDKInfo failed -> code: "+t)}))}},t.prototype.deleteRemoteMessage=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o,s,a,c,u,d;return _e(this,(function(l){switch(l.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,r),c=new wi("delMsg",a,o),[4,s.send(c)]):[3,2];case 1:return u=l.sent(),d=u.code,nt.SUCCESS,[2,d];case 2:return[2,nt.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o,s,a,c,u,d,l;return _e(this,(function(h){switch(h.label){case 0:return o=(i=this).currentUserId,(s=i._channel)?(a=s.codec.encodeClearMessages(t,n,r),c=hi[e],u=new wi(c,a,o),[4,s.send(u)]):[3,2];case 1:return d=h.sent(),l=d.code,nt.SUCCESS,[2,l];case 2:return[2,nt.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),ve(this,void 0,void 0,(function(){var i,o,s,a,c,u,d,l,h=this;return _e(this,(function(p){switch(p.label){case 0:return o=(i=this).currentUserId,s=i._channel,t=t||Ne.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),c=new wi(ri,a,o),[4,s.send(c,bn,{currentUserId:o,connectedTime:s.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=h._conversationManager.get(t,n,r);return Object.assign(e,i),e}})]):[3,2];case 1:return u=p.sent(),d=u.code,l=u.data,d!==nt.SUCCESS?[2,{code:d}]:[2,{code:d,data:l}];case 2:return[2,{code:nt.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return(r=this._channel)?(i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new wi("delRelation",i,t),[4,r.send(o)]):[3,2];case 1:return s=c.sent(),Qe.info("RemoveConversation =>",s),a=s.code,nt.SUCCESS,[2,a];case 2:return[2,nt.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:nt.CONVER_GET_ERROR}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==nt.SUCCESS?[2,{code:nt.CONVER_GET_ERROR}]:(a=(null==s?void 0:s.list[0])||null,c={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:a,notificationStatus:r.notificationStatus||Rt.CLOSE,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},[2,{code:nt.SUCCESS,data:c}])}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:nt.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getUnreadCount(e,t,n);return Promise.resolve({code:nt.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(nt.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(nt.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(nt.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:nt.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(nt.SUCCESS)},t.prototype.pullConversationStatus=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeGetConversationStatus(e),o=new wi(Pi[Pi.pullSeAtts],i,r),[4,n.send(o,yr)]):[3,2];case 1:return s=u.sent(),a=s.code,c=s.data,a!==nt.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}];case 2:return[2,{code:nt.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d=this;return _e(this,(function(l){switch(l.label){case 0:return n=(t=this).currentUserId,(r=t._channel)?(i=r.codec.encodeSetConversationStatus(e),o=new wi("setSeAtt",i,n),[4,r.send(o,Tr)]):[3,2];case 1:return s=l.sent(),a=s.code,c=s.data,a===nt.SUCCESS?(u=c,e.forEach((function(e){d._conversationManager.addStatus(me(me({},e),{updatedTime:u.version}),!0)})),[2,a]):[2,a];case 2:return[2,nt.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u;return _e(this,(function(d){switch(d.label){case 0:return(r=this._channel)?(i=r.codec.encodeJoinOrQuitChatRoom(),o=new wi(n?"joinChrmR":"joinChrm",i,e),[4,r.send(o,Ln)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return s=d.sent(),a=s.code,c=s.data,a===nt.SUCCESS&&(u=c.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,u),this._naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t)),[2,a]}}))}))},t.prototype._rejoinChrm=function(){return ve(this,void 0,void 0,(function(){var e,t,n,r,i,o;return _e(this,(function(s){switch(s.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,s.label=1;case 1:return r<t.length?(i=t[r],[4,this._joinChrm(i,e[i]||10,!0)]):[3,4];case 2:(o=s.sent())===nt.SUCCESS?this._watcher.chatroom({rejoinedRoom:{chatroomId:i,count:e[i]}}):this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:o}}),s.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l,h,p,f;return _e(this,(function(g){switch(g.label){case 0:return this._channel?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._channel.codec.encodeChrmSyncMsg(o,t),a=new wi(Pi[Pi.chrmPull],s,e),[4,this._channel.send(a,vn,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})])):[2];case 1:return c=g.sent(),u=c.code,d=c.data,r.pulling=!1,u===nt.SUCCESS&&d?(l=d.list,h=d.syncTime,p=d.finished,r.timestamp=n?Math.max(h,n):h,r.queue=r.queue.filter((function(e){return e>h})),f=[],l.forEach((function(e){e.sentTime<o||f.push(e)})),this._watcher.batchMessage(f),(!p||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(Qe.warn("pull chatroom msg failed, code:",u,", data:",d),[2])}}))}))},t.prototype.joinChatroom=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._joinChrm(e,t,!1)]}))}))},t.prototype.joinExistChatroom=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._joinChrm(e,t,!0)]}))}))},t.prototype.quitChatroom=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o;return _e(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),r=new wi("exitChrm",n,e),[4,t.send(r)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return i=s.sent(),(o=i.code)===nt.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return(r=this._channel)?(i=r.codec.encodeGetChatRoomInfo(t,n),o=new wi(Pi[Pi.queryChrmI],i,e),[4,r.send(o,Dn)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==nt.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o,s,a,c,u;return _e(this,(function(d){switch(d.label){case 0:return(i=this._channel)?(o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new wi(ui,o,e),[4,i.send(s,Sn,{conversation:{targetId:e}})]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return a=d.sent(),c=a.code,u=a.data,c!==nt.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u;return _e(this,(function(d){switch(d.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodeModifyChatRoomKV(e,t,i),s=t.type===bt.UPDATE?"setKV":"delKV",a=new wi(s,o,e),[4,r.send(a)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return c=d.sent(),(u=c.code)===nt.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},i),[2,u]):[2,u]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,d,l,h,p;return _e(this,(function(f){switch(f.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===bt.UPDATE?"setKVS":"delKVS",a=new wi(s,o,e),[4,r.send(a,dr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return c=f.sent(),u=c.code,-1!==[nt.SUCCESS,nt.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)&&(l=[],delete(h=Object.assign({},t)).entries,t.entries.forEach((function(e){l.push(Object.assign({},e,h))})),u===nt.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(p=c.data,Qe.warn("设置失败的属性:",p.errorKeys),d=p.errorKeys,p&&Array.isArray(p.errorKeys)&&p.errorKeys.forEach((function(e){var t=l.findIndex((function(t){return e.key===t.key}));-1!==t&&l.splice(t,1)}))),Qe.warn("设置成功的属性:",l),this._chrmEntryHandler.setLocal(e,{kvEntries:l,syncTime:(new Date).getTime()},i)),[2,{code:u,data:d}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.type=bt.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.type=bt.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.type=bt.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.type=bt.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.type=bt.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.type=bt.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:nt.SUCCESS,data:n})]:[3,1];case 1:return(r=this._channel)?(i=r.codec.encodePullChatRoomKV(0),o=new wi(Pi[Pi.pullKV],i,e),[4,r.send(o,ur)]):[2,Promise.reject({code:nt.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&void 0!==(c=a.kvEntries.find((function(e){return e.key===t})))?[2,Promise.resolve({code:nt.SUCCESS,data:null==c?void 0:c.value})]:[2,Promise.resolve({code:nt.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:nt.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(r={},i=n.codec.encodePullChatRoomKV(0),o=new wi(Pi[Pi.pullKV],i,e),[4,n.send(o,ur)]):[2,Promise.reject({code:nt.RC_NET_CHANNEL_INVALID})];case 2:return s=c.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(r[e.key]=e.value||"")})),[2,Promise.resolve({code:nt.SUCCESS,data:r})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,d,l;return _e(this,(function(h){switch(h.label){case 0:return r=(n=this)._channel,i=n.currentUserId,r?(o=r.codec.encodePullChatRoomKV(t),s=new wi(Pi[Pi.pullKV],o,e),[4,r.send(s,ur)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return a=h.sent(),c=a.code,u=a.data,c===nt.SUCCESS?(Qe.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,u,i),Qe.info("Save into cache success!"),d=u.kvEntries,l=[],d.length>0&&(d.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp;l.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:l})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype.sendMessage=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l,h;return _e(this,(function(p){switch(p.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),r=!![Ne.PRIVATE,Ne.GROUP].includes(e)&&n.isStatusMessage,i=r?function(e){var t;return(t={},t[Ne.PRIVATE]=Pi.ppMsgS,t[Ne.GROUP]=Pi.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[Ne.PRIVATE]=Pi.ppMsgP,t[Ne.GROUP]=Pi.pgMsgP,t[Ne.CHATROOM]=Pi.chatMsg,t[Ne.CUSTOMER_SERVICE]=Pi.pcMsgP,t[Ne.RTC_ROOM]=Pi.prMsgS,t)[e]}(e)||Pi.ppMsgP,r&&(n.isPersited=!1,n.isCounted=!1),o=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(s=new Ii(Pi[i],o,t)).setHeaderQos(Ft.AT_LEAST_ONCE),r?(this._channel.sendOnly(s),[2,{code:nt.SUCCESS,data:go(e,t,me({},n),"",0,this.currentUserId)}]):(a=Date.now()-this._localConnectedTime+this._connectedTime,c=go(e,t,me({},n),"",a,this.currentUserId),[4,this._channel.send(s)])):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return u=p.sent(),d=u.code,l=u.data,d!==nt.SUCCESS?[2,{code:d,data:c}]:(h=l,this._sendMessageStore.setMessage(h.messageUId,h.timestamp),c.sentTime=h.timestamp,c.messageUId=h.messageUId,this._conversationManager.setConversationCacheByMessage(c,!0),[2,{code:nt.SUCCESS,data:c}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return ve(this,void 0,void 0,(function(){var s,a,c,u,d,l,h,p,f,g;return _e(this,(function(m){switch(m.label){case 0:return this._channel?(s=i.user,a={content:{conversationType:e,targetId:t,messageUId:n,sentTime:r,user:s},messageType:"RC:RcCmd",disableNotification:null==i?void 0:i.disableNotification,pushConfig:null==i?void 0:i.pushConfig,pushContent:(null===(o=i.pushConfig)||void 0===o?void 0:o.pushContent)||i.pushContent||"",channelId:i.channelId},c=Pi[Pi.recallMsg],u=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},a),(d=new Ii(c,u,this.currentUserId)).setHeaderQos(Ft.AT_LEAST_ONCE),[4,this._channel.send(d)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return l=m.sent(),h=l.code,p=l.data,h!==nt.SUCCESS?[2,{code:h}]:(f=p,this._sendMessageStore.setMessage(f.messageUId,f.timestamp),g=go(e,t,me(me({},a),{isPersited:!0}),f.messageUId,f.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(g,!0),[2,{code:nt.SUCCESS,data:g}])}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i;return _e(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeReadReceipt(t,n),i=new wi(Pi[Pi.rrMsg],r,e),[4,this._channel.send(i)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i;return _e(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeMessageReader(t,n),i=new wi(Pi[Pi.rrList],r,e),[4,this._channel.send(i,br)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return ve(this,void 0,void 0,(function(){var t,n;return _e(this,(function(r){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new wi(Pi[Pi.pullUS],t,this.currentUserId),[2,this._channel.send(n,mr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o,s,a,c,u;return _e(this,(function(d){switch(d.label){case 0:return this._channel?(i=r&&"uploads"!==r?t||"":function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=ke(),i=function(e){e=e||"-";var t=new Date;return""+t.getFullYear()+e+(t.getMonth()+1)+e+t.getDate()}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s="."+a[a.length-1]}return e+"__RC-"+i+"_"+n+"_"+o+r+s}(e,t),o=this._channel.codec.encodeGetFileToken(e,i,n||"",r||""),s=new wi(Pi[Pi.qnTkn],o,this.currentUserId),[4,this._channel.send(s,tr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return a=d.sent(),c=a.code,u=a.data,u=Object.assign(u,{fileName:i}),c===nt.SUCCESS?[2,{code:c,data:u}]:[2,{code:c}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o,s,a,c,u,d,l,h;return _e(this,(function(p){switch(p.label){case 0:return this._channel?("",o="",s="",t===St.QINIU?(o=nr,s=ir):(o=rr,s=or),i=t===St.QINIU?Pi[Pi.qnUrl]:t===St.AWS?Pi[Pi.s3Url]:t===St.STC?Pi[Pi.stcUrl]:Pi[Pi.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,r),c=new wi(i,a,this.currentUserId),[4,this._channel.send(c,s)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return u=p.sent(),d=u.code,l=u.data,h=l,d===nt.SUCCESS?[2,{code:d,data:h}]:[2,{code:d}]}}))}))},t.prototype.disconnect=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval()},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,r){this._customMessageType[e]={isPersited:t,isCounted:n}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new wi(Pi[Pi.addSeTag],n,this.currentUserId),[4,this._channel.send(r,fr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==nt.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([me(me({},e),{createdTime:a})],a),[2,{code:nt.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),r=new wi(Pi[Pi.delSeTag],n,this.currentUserId),[4,this._channel.send(r,fr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==nt.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:nt.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),r=new wi(Pi[Pi.addSeTag],n,this.currentUserId),[4,this._channel.send(r,fr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==nt.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:nt.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return ve(this,void 0,void 0,(function(){var e,t;return _e(this,(function(n){return e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag(),e.forEach((function(e){e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),[2,{code:nt.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s=this;return _e(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new wi(Pi[Pi.addTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:nt.TAG_NOT_EXIST}]:[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return(i=a.sent().code)!==nt.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:nt.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o=this;return _e(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new wi(Pi[Pi.delTag],n,this.currentUserId),[4,this._channel.send(r)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return(i=s.sent().code)!==nt.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:nt.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return ve(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return this._channel?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new wi(Pi[Pi.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return(c=u.sent().code)!==nt.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:nt.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l;return _e(this,(function(h){switch(h.label){case 0:return i=(r=this).currentUserId,(o=r._channel)?(s=o.codec.encodeOldConversationList({count:n,type:Ne.PRIVATE,startTime:t}),a=new wi(ri,s,i),[4,o.send(a,bn,{currentUserId:i,connectedTime:o.connectedTime})]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return c=h.sent(),u=c.code,d=c.data,l=this._conversationHasTagFilter(e,d),Qe.info("GetConversationListByTag",l),u!==nt.SUCCESS?[2,{code:u}]:[2,{code:u,data:l}]}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,r=[],i=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,c=n._conversationManager.get(o,s,a),u=c.hasMentioned,d=c.mentionedInfo,l=c.lastUnreadTime,h=c.notificationStatus,p=c.isTop,f=c.tags,g=c.unreadMessageCount,m=f&&f[e];if(m){var v=me(me({},t),{hasMentioned:u,mentionedInfo:d,lastUnreadTime:l,notificationStatus:h,isTop:p,unreadMessageCount:g});m.isTop?r.push(me(me({},v),{isTopInTag:!0})):i.push(me(me({},v),{isTopInTag:!1}))}})),ye(ye([],r.sort(o)),i.sort(o))},t.prototype.getUnreadCountByTag=function(e,t){return ve(this,void 0,void 0,(function(){var n;return _e(this,(function(r){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:nt.SUCCESS,data:n}]):[2,{code:nt.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l,h;return _e(this,(function(p){switch(p.label){case 0:return this._channel?(r=t.targetId,i=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(c=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._channel.codec.encodeUpdateConversationTag(a,[t]),d=new wi(Pi[Pi.addTag],u,this.currentUserId),[4,this._channel.send(d)]):[2,{code:nt.NO_TAG_IN_CONVER}]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return(l=p.sent().code)!==nt.SUCCESS?[2,{code:l}]:((h={})[e]={},s&&(h[e].isTop=!0),this._conversationManager.addTagStatus(i,r,h,o),[2,{code:nt.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return ve(this,void 0,void 0,(function(){var n,r,i,o;return _e(this,(function(s){if(!this._channel)return[2,{code:nt.RC_NET_CHANNEL_INVALID}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(t=r[o])||void 0===t?void 0:t.tagName});return[2,{code:nt.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:nt.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:nt.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t=this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId);return Promise.resolve({code:nt.SUCCESS,data:t})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:nt.SUCCESS,data:e})},t.prototype.joinRTCRoom=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o;return _e(this,(function(s){return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n,r),o=new wi(Pi[Pi.rtcRJoin_data],i,e),[2,this._channel.send(o,Bn)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return ve(this,void 0,void 0,(function(){var t,n;return _e(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new wi(Pi[Pi.rtcRExit],t,e),[4,this._channel.send(n)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i;return _e(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new wi(Pi[Pi.rtcPing],r,e),[4,this._channel.send(i)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return ve(this,void 0,void 0,(function(){var t,n;return _e(this,(function(r){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new wi(Pi[Pi.rtcRInfo],t,e),[2,this._channel.send(n,Xn)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o;return _e(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new wi(Pi[Pi.rtcUData],t,e),[4,this._channel.send(n,Bn)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return r=s.sent(),i=r.code,o=r.data,[2,{code:i,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i;return _e(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeSetRTCUserInfo(t,n),i=new wi(Pi[Pi.rtcUPut],r,e),[4,this._channel.send(i)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return ve(this,void 0,void 0,(function(){var n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),r=new Ii(Pi[Pi.rtcUDel],n,e),[4,this._channel.send(r)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return ve(this,void 0,void 0,(function(){var s,a;return _e(this,(function(c){switch(c.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,r,i,o),a=new Ii(Pi[Pi.rtcSetData],s,e),[4,this._channel.send(a)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return ve(this,void 0,void 0,(function(){var o,s;return _e(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,r,i),s=new wi(Pi[Pi.userSetData],o,e),[4,this._channel.send(s)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i;return _e(this,(function(o){switch(o.label){case 0:return this._channel?(r=this._channel.codec.encodeUserSetRTCCDNUris(t,n),i=new wi(Pi[Pi.userSetData],r,e),[4,this._channel.send(i)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){if(!this._channel)return Promise.resolve({code:nt.RC_NET_CHANNEL_INVALID});var i=this._channel.codec.encodeGetRTCData(t,n,r),o=new wi(Pi[Pi.rtcQryData],i,e);return this._channel.send(o,Jn)},t.prototype.removeRTCData=function(e,t,n,r,i){return ve(this,void 0,void 0,(function(){var o,s;return _e(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,r,i),s=new Ii(Pi[Pi.rtcDelData],o,e),[4,this._channel.send(s)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i;return _e(this,(function(o){return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new wi(Pi[Pi.rtcToken],r,e),[2,this._channel.send(i,Yn)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return ve(this,void 0,void 0,(function(){var n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),r=new wi(Pi[Pi.rtcUserState],n,e),[4,this._channel.send(r)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:nt.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new wi(Pi[Pi.rtcUList],t,e);return this._channel.send(n,Bn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=wt.LIVE),ve(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d;return _e(this,(function(l){switch(l.label){case 0:return this._channel?(r=this._channel.codec.encodeJoinRTCRoom(t,n),i=new wi(Pi[Pi.viewerJoinR],r,e),[4,this._channel.send(i,Br)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return o=l.sent(),s=o.code,a=o.data,s!==nt.SUCCESS?[2,{code:s}]:(u=(c=a).rtcToken,d=c.entries,[2,{code:s,data:{token:u,kvEntries:d}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return ve(this,void 0,void 0,(function(){var t,n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new wi(Pi[Pi.viewerExitR],t,e),[4,this._channel.send(n)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return ve(this,void 0,void 0,(function(){var r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return this._channel?(r=this._channel.codec.encodeIdentityChangeInfo(t,n),i=new wi(Pi[Pi.rtcIdentityChange],r,e),[4,this._channel.send(i,Bn)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s!==nt.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u;return _e(this,(function(d){switch(d.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(Qe.info("audience in room start pull KV"),i=n.codec.encodePullRTCRoomKV(e,0),o=new wi(Pi[Pi.rtcPullKv],i,r),[4,n.send(o,Ur)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return s=d.sent(),a=s.code,c=s.data,Qe.info("audience in room end pull KV, code: "+a+", data: "+JSON.stringify(c||{})),a===nt.SUCCESS?(u=c.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:a,data:c}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c;return _e(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,r=t.currentUserId,n?(i=n.codec.encodeQueryUserJoinedInfo(e),o=new wi(Pi[Pi.rtcQueryJoined],i,r),[4,n.send(o,Vr)]):[2,{code:nt.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a===nt.SUCCESS?[2,{code:a,data:c}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return po(this.runtime)},t.prototype.requestRoomPK=function(e){return ve(this,void 0,void 0,(function(){var t,n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new wi(Pi[Pi.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.cancelRoomPK=function(e){return ve(this,void 0,void 0,(function(){var t,n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new wi(Pi[Pi.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.responseRoomPK=function(e){return ve(this,void 0,void 0,(function(){var t,n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new wi(Pi[Pi.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.endRoomPK=function(e){return ve(this,void 0,void 0,(function(){var t,n,r;return _e(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new wi(Pi[Pi.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,nt.RC_NET_CHANNEL_INVALID];case 1:return r=i.sent().code,this._rtcKVManager.reset(),[2,r]}}))}))},t.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Promise.resolve({code:nt.EXTRA_METHOD_UNDEFINED})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.removeFromBlacklist=function(e){throw new Error("Method not implemented.")},t.prototype.getBlacklist=function(){throw new Error("Method not implemented.")},t.prototype.getBlacklistStatus=function(e){throw new Error("Method not implemented.")},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.getConversationNotificationStatus=function(e,t,n){var r=this._conversationManager.get(e,t,n);return r?Promise.resolve({code:nt.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:nt.CONVER_GET_ERROR})},t.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this.getHistoryMessage(e,t,n,r,i,o)},t}((function(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this.currentUserId="",this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this.navi=this._createNavi()})),vo=function(){function e(e){this._context=e}return e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._context.registerMessageType(e,t,n,r)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e}(),_o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return pe(t,e),t.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},t.prototype.joinRTCRoom=function(e,t,n,r){return this._context.joinRTCRoom(e,t,n,r)},t.prototype.quitRTCRoom=function(e){return this._context.quitRTCRoom(e)},t.prototype.rtcPing=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return this._context.getRTCRoomInfo(e)},t.prototype.getRTCUserInfoList=function(e){return this._context.getRTCUserInfoList(e)},t.prototype.getRTCUserInfo=function(e){return this._context.getRTCUserInfo(e)},t.prototype.setRTCUserInfo=function(e,t,n){return this._context.setRTCUserInfo(e,t,n)},t.prototype.removeRTCUserInfo=function(e,t){return this._context.removeRTCUserInfo(e,t)},t.prototype.setRTCData=function(e,t,n,r,i,o){return this._context.setRTCData(e,t,n,r,i,o)},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return this._context.setRTCTotalRes(e,t,n,r,i)},t.prototype.setRTCCDNUris=function(e,t,n){return this._context.setRTCCDNUris(e,t,n)},t.prototype.getRTCData=function(e,t,n,r){return this._context.getRTCData(e,t,n,r)},t.prototype.removeRTCData=function(e,t,n,r,i){return this._context.removeRTCData(e,t,n,r,i)},t.prototype.setRTCOutData=function(e,t,n,r){return this._context.setRTCOutData(e,t,n,r)},t.prototype.getRTCOutData=function(e,t){return this._context.getRTCOutData(e,t)},t.prototype.getRTCToken=function(e,t,n){return this._context.getRTCToken(e,t,n)},t.prototype.setRTCState=function(e,t){return this._context.setRTCState(e,t)},t.prototype.getRTCUserList=function(e){return this._context.getRTCUserList(e)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._context.joinLivingRoomAsAudience(e,t,n)},t.prototype.quitLivingRoomAsAudience=function(e){return this._context.quitLivingRoomAsAudience(e)},t.prototype.rtcIdentityChange=function(e,t,n){return this._context.rtcIdentityChange(e,t,n)},t.prototype.requestRoomPK=function(e){return this._context.requestRoomPK(e)},t.prototype.cancelRoomPK=function(e){return this._context.cancelRoomPK(e)},t.prototype.responseRoomPK=function(e){return this._context.responseRoomPK(e)},t.prototype.endRoomPK=function(e){return this._context.endRoomPK(e)},t}(vo),yo=function(){function e(){}return e.compress=function(e){for(var t=this,n={},r=0;r<e.length-1;r++){var i=e.charAt(r)+e.charAt(r+1);n.hasOwnProperty(i)?n[i].push(r):n[i]=[r]}for(var o=[],s=[],a=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),r=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(r+n)}else{var i=String.fromCharCode(t.dataType.Normal|e.length);o.push(i)}o.push(e)}},c=0;c<e.length;){var u=t.indexOf(n,e,c);if(u.length<2)s.push(e.charAt(c++));else if(u.length<4)s.push(e.substr(c,u.length)),c+=u.length;else{var d=t.numberEncode(c-u.offset),l=t.numberEncode(u.length);if(d.length+l.length>=u.length)s.push(e.substr(c,u.length)),c+=u.length;else{a();var h=String.fromCharCode(t.dataType.Compressed|d.length<<2|l.length);o.push(h+d+l),c+=u.length}}}a();var p=t.numberEncode(e.length),f=String.fromCharCode(t.dataType.Tail|p.length);return o.push(f+p),o.join("")},e.uncompress=function(e){var t=this,n=0,r="";e:do{var i=e.charCodeAt(n++),o=i&t.dataType.Mark,s=15&i,a=void 0;switch(o){case t.dataType.Compressed:var c=s>>2,u=3&s;if(0===c||0===u)throw new Error("Data parsing error,at "+n);var d=t.numberDecode(e.substr(n,c)),l=t.numberDecode(e.substr(n+=c,u));if((d=r.length-d)+l>r.length)throw new Error("Data parsing error,at "+n);n+=u,r+=r.substr(d,l);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==r.length)throw console.log(r.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),r+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:r+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);r+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n<e.length);return r},e.indexOf=function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var o=t.length-n,s=0,a=i.length;s<a;s++){var c=i[s],u=n-c;if(!(u>this.max)){var d=Math.min(o,u);if(d<=r.length)break;if(!(r.length>2&&t.charAt(c+r.length-1)!==t.charAt(n+r.length-1))){for(var l=2,h=l;h<d&&t.charAt(c+h)===t.charAt(n+h);h++)l++;l>=r.length&&(r.length=l,r.offset=c)}}}return r},e.numberEncode=function(e){var t=this,n=[],r=0;do{r=e%t.scale,n.push(t.chars.charAt(r)),e=(e-r)/t.scale}while(e>0);return n.join("")},e.numberDecode=function(e){for(var t=0,n=0,r=e.length-1;r>=0;r--){if(-1===(n=this.chars.indexOf(e.charAt(r))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t},e.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),Ro=1,Co=!1,Eo="undefined"!=typeof location&&"https://"===location.protocol?"https://":"http://",To=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=po(e.runtime),this.logSwitch=e.logSwitch;var t=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 o in i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}}(e.runtime);this.deviceInfo=t.type+"|"+t.version+"|"+ze.sessionId,this.startReport()}return e.init=function(t){return Co=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.startReport=function(){var e=this;if(this.logSwitch&&Co){var t=this.itv*Math.pow(2,Ro-1);Ro<this.times&&Ro++,setTimeout((function(){e.reportRealtimeLog()}),1e3*t)}},e.prototype.reportRealtimeLog=function(){var e=this,t=ze.realTimeLogList.filter((function(t){return t.level<=e.level}));if(0!==t.length){var n=yo.compress(t.map((function(e){return e.content})).join("")),r=""+Eo+this.logUrl+"?version="+this.info.version+"&appkey="+this.info.appkey+"&userId="+this.info.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web";this.info.runtime.httpReq({method:"POST",url:r,body:n}).then((function(t){Qe.__clearRealTimeLog(),Qe.debug("report real-time log success");var n=t.data;n&&(n=JSON.parse(n),e.itv=n.nextTime,e.level=n.level,e.logSwitch=n.logSwitch,Ro=1),e.startReport()})).catch((function(t){Qe.debug("report real-time log error -> "+t),e.startReport()}))}else this.startReport()},e.prototype.reportFullLog=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d,l=this;return _e(this,(function(h){switch(h.label){case 0:return t=e.startTime,n=e.endTime,r=e.platform,i=e.logId,o=e.uri,s=be.getInstance(),Qe.debug("received report log msg, "+r.toLowerCase(),s),"web"===r.toLowerCase()&&s?t>n?(Qe.warn("report error: The start time("+t+") cannot be greater than the end time("+t+")"),[2]):[4,Qe.__insertLogIntoDatabase()]:[2];case 1:return h.sent(),[4,s.getRangeData(Se,"time",t,n)];case 2:return a=(a=h.sent()).filter((function(e){return!e.userId||e.userId===l.info.userId})),c=yo.compress(a.map((function(e){return e.content})).join("")||"no data"),u=1,(d=function(){if(!(u>3)&&Co){var e=o||l.logUrl,t=""+Eo+e+"?version="+l.info.version+"&appkey="+l.info.appkey+"&userId="+l.info.userId+"&logId="+i+"&deviceId="+l.deviceId+"&deviceInfo="+l.deviceInfo+"&platform=Web",n=5e3*(u-1);u++,setTimeout((function(){Co&&l.info.runtime.httpReq({url:t,method:"POST",body:c}).then((function(){Qe.debug("report full log success!")})).catch((function(e){d(),Qe.warn("report full log error -> "+e)}))}),n)}})(),[2]}}))}))},e.prototype.distroy=function(){Ro=1,Co=!1},e}();function So(e){return Object.assign({},e)}var Io,bo=function(){function e(e,t){var n;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this.coreVersion="5.1.1",this._versionInfo={},this._typingInfo={},this._isInternalConnected=!1,this._connectionStatus=it.DISCONNECTED,this._canRedirectConnect=!1,this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=Object.assign({},t),this.appkey=this._options.appkey,this.apiVersion=this._options.apiVersion,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length&&(n=this._options.navigators).push.apply(n,ie);var r={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this)};this._engine=rn()?new RCCppEngine(e,r,this._options):new mo(e,r,this._options)}return e.init=function(t,n){return Qe.setLogLevel(n.logLevel),Qe.setLogStdout(n.logStdout),(n.indexDBSwitch||He(n.indexDBSwitch))&&be.init(),Qe.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(Qe.error("Repeat initialize!"),this._context):(Qe.warn("RCEngine Commit:","41dbe38d1b376ca0a791b23ed94be291e3f92e81"),this._context=new e(t,n),Qe.__insertLogIntoDatabase(),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return Qe.warn("Repeat install plugin: "+e.tag),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new _o(this):new vo(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(n,this._runtime,t)}catch(e){Qe.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&this._pluginContextQueue.push(n),r&&(this._pluginInstanseMap[e.tag]=r),r},e.prototype._handleRedirect=function(){return ve(this,void 0,void 0,(function(){var e=this;return _e(this,(function(t){switch(t.label){case 0:return Qe.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return t.sent().code!==nt.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(),setTimeout((function(){e._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return e===it.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(),this._handleRedirect()):e===it.BLOCKED||e===it.KICKED_OFFLINE_BY_OTHER_CLIENT||e===it.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect()):e===it.CONNECTING?this._handleConnecting():e===it.CONNECTED?this._handleConnected():e===it.DISCONNECTED?this._handleDisconnect():e===it.NETWORK_UNAVAILABLE&&this._handleSuspend(),this._connectionStatus=e,(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(){this._watcher.onDisconnect&&this._watcher.onDisconnect()},e.prototype._handleSuspend=function(){this._watcher.onSuspend&&this._watcher.onSuspend()},e.prototype._messageReceiver=function(e,t,n){var r,i,o;if((e.conversationType===Ne.RTC_ROOM||Object.prototype.hasOwnProperty.call(Lt,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message(So(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==_t.TYPING_STATUS||(this._addTypingInfo(So(e)),!this._watcher.typingState))if(e.messageType!==_t.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==_t.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(So(e))}catch(e){return Qe.error("plugin error =>",e),!1}})))if("RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return this._watcher.message&&this._watcher.message(So(e),t,n),e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic;s&&Array.isArray(s[this._engine.currentUserId])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[this._engine.currentUserId])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId});else{var a=e.content,c=a.startTime,u=a.endTime,d=a.platform,l=a.logId,h=a.uri,p=a.packageName,f={startTime:parseInt(c),endTime:parseInt(u),platform:d,logId:l,uri:h,packageName:p};null===(i=To.getInstance())||void 0===i||i.reportFullLog(f)}}else if("function"==typeof this._watcher.chatroomState){var g={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){g[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:g,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(r={},r[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?At.QUIT:At.JOIN,r),chatroomId:e.targetId}})},e.prototype._batchMessageReceiver=function(e,t,n){var r=this,i=[];e.forEach((function(e){var o=r._messageReceiver(e,t,n);o&&i.push(o)})),i.length&&this._watcher.batchMessage&&this._watcher.batchMessage(i)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=je(r)||Fe(r)?r:void 0}}))},e.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,o=e.channelId,s=i.typingContentType,a=n+"#"+r+"#"+(o||"");this._typingInfo[a]||(this._typingInfo[a]=[]);var c=this._typingInfo[a].findIndex((function(e){return e.userId===t}));c>=0&&this._typingInfo[a][c].messageType===s?this._typingInfo[a][c].timestamp=Date.now():(c>=0&&this._typingInfo[a].splice(c,1),this._typingInfo[a].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}if(e._typingChangedList.length>0){var r=e._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));e._typingStatusListener(r),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.currentUserId},e.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t){return void 0===t&&(t=!1),ve(this,void 0,void 0,(function(){var n,r,i,o,s,a;return _e(this,(function(c){switch(c.label){case 0:return this._connectionStatus===it.CONNECTED?[2,{code:nt.SUCCESS,userId:this._engine.currentUserId}]:this._connectionStatus===it.CONNECTING?[2,{code:nt.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:nt.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,n=e.split("@"),r=n[1],i=r?r.split(";").map((function(e){return/^https?:/.test(e)?e:"https://"+e})):[],[4,this._engine.navi.getInfo(this._getTokenWithoutNavi(),i,t,this._options.checkCA)]);case 1:return(o=c.sent())?1===(null==o?void 0:o.type)?[2,{code:nt.PACKAGE_ENVIRONMENT_ERROR}]:(s=Bt.getInfo(),[4,this._engine.connect(this._getTokenWithoutNavi(),o)]):[2,{code:nt.RC_NAVI_RESOURCE_ERROR}];case 2:return a=c.sent(),Qe.__insertLogIntoDatabase(),a!==ct?[3,4]:(this._connectionStatus=it.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,c.sent()];case 4:return a===nt.SUCCESS&&(Qe.info("connect success, userId: "+this._engine.currentUserId),1!==(null==o?void 0:o.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(s),To.init({runtime:this._runtime,logSwitch:(null==o?void 0:o.logSwitch)||0,logPolicy:JSON.parse((null==o?void 0:o.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:this._engine.currentUserId}),ze.init(this._engine.currentUserId),this._isInternalConnected=!0),a!==nt.SUCCESS||rn()||1===o.openUS&&this._pullUserSettings(),a!==nt.SUCCESS&&(this._connectionStatus=it.CONNECTION_CLOSED),[2,{code:a,userId:this._engine.currentUserId}]}}))}))},e.prototype._pullUserSettings=function(){return ve(this,void 0,void 0,(function(){return _e(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,null===(e=To.getInstance())||void 0===e||e.distroy(),Qe.__insertLogIntoDatabase(),ze.reset(),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){Qe.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(){return this._isInternalConnected?Promise.resolve({code:nt.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.navi.getInfoFromCache(this._getTokenWithoutNavi())},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._engine.registerMessageType(e,t,n,r)},e.prototype.sendMessage=function(e,t,n,r){var i=this.getInfoFromCache();if(1===((null==i?void 0:i.grpRRVer)||0)&&n.messageType===_t.READ_RECEIPT_RESPONSE)return Promise.resolve({code:nt.READ_RECEIPT_ERROR});var o=JSON.stringify(n.content);return Ce(o)>131072?Promise.resolve({code:nt.RC_MSG_CONTENT_EXCEED_LIMIT}):this._engine.sendMessage(e,t,n,r)},e.prototype.sendExpansionMessage=function(e){return ve(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,d,l,h,p,f;return _e(this,(function(g){switch(g.label){case 0:if(t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,!e.canIncludeExpansion)return[2,{code:nt.MESSAGE_KV_NOT_SUPPORT}];if(c=!1,u=!1,d=!1,Fe(s))for(h in l=Object.keys(s).length,c=l>20,s)if(p=s[h],u=xe(h)&&!/^[A-Za-z0-9_=+-]+$/.test(h),(d=h.length>32||p.length>64)||u)break;return c||d?[2,{code:nt.EXPANSION_LIMIT_EXCEET}]:u?[2,{code:nt.BIZ_ERROR_INVALID_PARAMETER}]:(f={mid:i},s&&(f.put=s),o&&(f.del=o),a&&(f.removeAll=1),[4,this._engine.sendMessage(n,r,{content:f,messageType:_t.EXPANSION_NOTIFY,channelId:t})]);case 1:return[2,{code:g.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return ve(this,void 0,void 0,(function(){var r;return _e(this,(function(i){return 0===((null==(r=this.getInfoFromCache())?void 0:r.grpRRVer)||0)?[2,{code:nt.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,n)]}))}))},e.prototype.getMessageReader=function(e,t,n){return ve(this,void 0,void 0,(function(){var r;return _e(this,(function(i){return 0===((null==(r=this.getInfoFromCache())?void 0:r.grpRRVer)||0)?[2,{code:nt.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){Qe.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=To.getInstance())||void 0===e||e.distroy(),ze.reset()},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,s){return void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===s&&(s=""),this._engine.getHistoryMessage(e,t,n,r,i,o,s||"")},e.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),void 0===i&&(i=""),this._engine.getConversationList(e,t,n,r,i)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),this._engine.removeConversation(e,t,n)},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[Ne.PRIVATE,Ne.GROUP,Ne.SYSTEM,Ne.PUBLIC_SERVICE],!!n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(e,t,n)},e.prototype.setConversationStatus=function(e,t,n,r,i){void 0===i&&(i="");var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){return void 0===r&&(r=""),this._engine.saveConversationMessageDraft(e,t,n,r)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)},e.prototype.deleteRemoteMessage=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessage(e,t,n,r)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)},e.prototype.joinChatroom=function(e,t){return void 0===t&&(t=10),this._engine.joinChatroom(e,t)},e.prototype.joinExistChatroom=function(e,t){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,r=t.value;return Xt(n)&&Zt(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(nt.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,o=r.value;if(!Xt(i)||!Zt(o))return Promise.resolve({code:nt.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.setChatroomEntries(e,t)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return Xt(n)&&Zt(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(nt.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Xt(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(nt.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!Xt(r))return Promise.resolve({code:nt.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Xt(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(nt.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,r){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===r&&(r=0),this._engine.getChatroomHistoryMessages(e,r,t,n)},e.prototype.getFileToken=function(e,t,n,r){return ve(this,void 0,void 0,(function(){var i,o,s,a,c,u,d;return _e(this,(function(l){switch(l.label){case 0:return i=this.getInfoFromCache(),o=(null==i?void 0:i.bosAddr)||"",s=(null==i?void 0:i.uploadServer)||"",a=(null==i?void 0:i.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r)];case 1:return c=l.sent(),u=c.code,d=c.data,u===nt.SUCCESS?[2,Promise.resolve(Object.assign(d,{bos:o,qiniu:s,ossConfig:a}))]:[2,Promise.reject(u)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r,i){return void 0===i&&(i=St.QINIU),ve(this,void 0,void 0,(function(){var o,s,a;return _e(this,(function(c){switch(c.label){case 0:return(null==r?void 0:r.isBosRes)?[2,Promise.resolve(r)]:[4,this._engine.getFileUrl(e,i,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===nt.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return ve(this,void 0,void 0,(function(){return _e(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return t.length>1e3?[2,Promise.reject(nt.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return ve(this,void 0,void 0,(function(){return _e(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return ve(this,void 0,void 0,(function(){return _e(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.callExtra=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this._engine).callExtra.apply(t,ye([e],n))},e.prototype.clearConversations=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){switch(n.label){case 0:return[4,this._engine.clearConversations(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.setUserStatusListener=function(e,t){return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){Qe.error(e)}}))},e.prototype.addToBlacklist=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return ve(this,void 0,void 0,(function(){return _e(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return ve(this,void 0,void 0,(function(){return _e(this,(function(r){return[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),ve(this,void 0,void 0,(function(){return _e(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,r,i)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),ve(this,void 0,void 0,(function(){return _e(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return ve(this,void 0,void 0,(function(){return _e(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return ve(this,void 0,void 0,(function(){return _e(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return ve(this,void 0,void 0,(function(){return _e(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setUserStatus=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return ve(this,void 0,void 0,(function(){return _e(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,r){return void 0===t&&(t=[]),void 0===n&&(n=""),ve(this,void 0,void 0,(function(){return _e(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,i,o,s){return void 0===s&&(s=""),ve(this,void 0,void 0,(function(){return _e(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getConversationNotificationStatus=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(e,t,n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.joinRTCRoom=function(e,t,n,r){return this._engine.joinRTCRoom(e,t,n,r)},e.prototype.quitRTCRoom=function(e){return this._engine.quitRTCRoom(e)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.getRTCRoomInfo=function(e){return this._engine.getRTCRoomInfo(e)},e.prototype.getRTCUserInfoList=function(e){return this._engine.getRTCUserInfoList(e)},e.prototype.getRTCUserInfo=function(e){return this._engine.getRTCUserInfo(e)},e.prototype.setRTCUserInfo=function(e,t,n){return this._engine.setRTCUserInfo(e,t,n)},e.prototype.removeRTCUserInfo=function(e,t){return this._engine.removeRTCUserInfo(e,t)},e.prototype.setRTCData=function(e,t,n,r,i,o){return this._engine.setRTCData(e,t,n,r,i,o)},e.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),this._engine.setRTCTotalRes(e,t,n,r,i)},e.prototype.setRTCCDNUris=function(e,t,n){return this._engine.setRTCCDNUris(e,t,n)},e.prototype.getRTCData=function(e,t,n,r){return this._engine.getRTCData(e,t,n,r)},e.prototype.removeRTCData=function(e,t,n,r,i){return this._engine.removeRTCData(e,t,n,r,i)},e.prototype.setRTCOutData=function(e,t,n,r){return this._engine.setRTCOutData(e,t,n,r)},e.prototype.getRTCOutData=function(e,t){return this._engine.getRTCOutData(e,t)},e.prototype.getRTCToken=function(e,t,n){return this._engine.getRTCToken(e,t,n)},e.prototype.setRTCState=function(e,t){return this._engine.setRTCState(e,t)},e.prototype.getRTCUserList=function(e){return this._engine.getRTCUserList(e)},e.prototype.joinLivingRoomAsAudience=function(e,t,n){return this._engine.joinLivingRoomAsAudience(e,t,n)},e.prototype.quitLivingRoomAsAudience=function(e){return this._engine.quitLivingRoomAsAudience(e)},e.prototype.rtcIdentityChange=function(e,t,n){return this._engine.rtcIdentityChange(e,t,n)},e.prototype.getRTCJoinedUserInfo=function(e){return this._engine.getRTCJoinedUserInfo(e)},e.prototype.requestRoomPK=function(e){return this._engine.requestRoomPK(e)},e.prototype.cancelRoomPK=function(e){return this._engine.cancelRoomPK(e)},e.prototype.responseRoomPK=function(e){return this._engine.responseRoomPK(e)},e.prototype.endRoomPK=function(e){return this._engine.endRoomPK(e)},e}();!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Io||(Io={}));
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- var ko=function(e,t){return ko=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ko(e,t)},wo=function(){return wo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},wo.apply(this,arguments)};function Oo(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function No(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var Ao,Mo=new ze("RCIM"),Po=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,r=t.length;n<r;n++)if(!e[t[n]])return!1;return!0}(uni))},xo=Po(),Lo={tag:"browser",httpReq:function(e){var t=e.method||Di.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Ee(e.url,i);return new Promise((function(e){var i,a=(i="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&i?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),c="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(t,s),r&&a.setRequestHeader)for(var u in r)a.setRequestHeader(u,r[u]);if(c){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==S(o)?JSON.stringify(o):o;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){return e({status:a.status||0})}),n),a.send(o)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||Mo.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:xo,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,r=t.reason;e(n,r)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close(e,t)}}},createDataChannel:function(e,t){return this.isSupportSocket()&&"websocket"===t?new Bi(this,e):new Fi(this,e)}},Uo=Po(),Do=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){Mo.error(e)}}},Vo={setItem:Do("setStorageSync"),getItem:Do("getStorageSync"),removeItem:Do("removeStorageSync"),clear:Do("clearStorageSync")},Bo={tag:"wechat",httpReq:function(e){var t=e.method||Di.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Ee(e.url,i);return new Promise((function(e){wx.request({url:s,method:t,headers:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:nt.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:Vo,sessionStorage:Vo,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Uo,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Bi(this,e):new Fi(this,e)}},Fo=Po(),jo=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return my[e].apply(my,t)}catch(e){Mo.error(e)}}},Ho={setItem:jo("setStorageSync"),getItem:jo("getStorageSync"),removeItem:jo("removeStorageSync"),clear:jo("clearStorageSync")},Ko={tag:"alipay",httpReq:function(e){var t=e.method||Di.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Ee(e.url,i),a=e.dataType||"json";return new Promise((function(e){my.request({url:s,method:t,headers:r,timeout:n,data:o,dataType:a,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:nt.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:Ho,sessionStorage:Ho,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Fo,createDataChannel:function(e,t){return"websocket"===t?new Bi(this,e):new Fi(this,e)}},qo=Po(),Go=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("tt",tt),tt[e].apply(tt,t)}catch(e){Mo.error(e)}}},Yo={setItem:Go("setStorageSync"),getItem:Go("getStorageSync"),removeItem:Go("removeStorageSync"),clear:Go("clearStorageSync")},Jo={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:qo,localStorage:Yo,sessionStorage:Yo,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Bi(this,e):new Fi(this,e)}},Wo=Po(),zo=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("swan",swan),swan[e].apply(swan,t)}catch(e){Mo.error(e)}}},Qo={setItem:zo("setStorageSync"),getItem:zo("getStorageSync"),removeItem:zo("removeStorageSync"),clear:zo("clearStorageSync")},Xo={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Wo,localStorage:Qo,sessionStorage:Qo,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},r={data:JSON.stringify(n),status:e.statusCode};t(r)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Bi(this,e):new Fi(this,e)}},Zo=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){Mo.error(e)}}},$o={setItem:Zo("setStorageSync"),getItem:Zo("getStorageSync"),removeItem:Zo("removeStorageSync"),clear:Zo("clearStorageSync")},es={tag:"uniapp",httpReq:function(e){var t=e.method||Di.GET,n=e.timeout||6e4,r=e.headers,i=e.query,o=e.body,s=Ee(e.url,i);return new Promise((function(e){uni.request({url:s,method:t,headers:r,timeout:n,data:o,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:nt.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:$o,sessionStorage:$o,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},r=uni.connectSocket(n);return{onClose:function(e){r.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){r.onError((function(t){e(t.errMsg)}))},onMessage:function(e){r.onMessage((function(t){e(t.data)}))},onOpen:function(e){r.onOpen(e)},send:function(e){r.send({data:e})},close:function(e,t){r.close({code:e,reason:t})}}},createDataChannel:function(e,t){return"websocket"===t?new Bi(this,e):new Fi(this,e)}},ts=function(e){return e&&e.canIUse&&e.getSystemInfo},ns="undefined"!=typeof uni&&ts(uni)?function(){switch({}.VUE_APP_PLATFORM){case"app-plus":return es;case"mp-baidu":return Xo;case"mp-toutiao":return Jo;case"mp-alipay":return Ko;case"mp-weixin":return Bo;default:return Lo}}():"undefined"!=typeof wx&&ts(wx)?Bo:"undefined"!=typeof my&&ts(my)?Ko:"undefined"!=typeof tt&&ts(tt)?Jo:"undefined"!=typeof swan&&ts(swan)?Xo:Lo;function rs(e){var t=e.conversationType,n=e.channelId,r=e.messageType,i=e.content,o=e.senderUserId,s=e.targetId,a=e.sentTime,c=e.receivedTime,u=e.messageUId,d=e.messageDirection,l=e.isPersited,h=e.isCounted,p=e.isOffLineMessage,f=e.canIncludeExpansion,g=e.expansion,m=e.receivedStatus,v=e.disableNotification,_=e.isMentioned,y=e.isStatusMessage,R=e.readReceiptInfo,C=e.pushConfig,E=e.messageId;return m||(m=re.UNREAD),{messageType:r,channelId:n||"",content:i,senderUserId:o,targetId:s,conversationType:t,sentTime:a,receivedTime:c,messageUId:u,messageDirection:d,isPersited:l,isCounted:h,isOffLineMessage:p,isMentioned:_,disableNotification:v,isStatusMessage:y,canIncludeExpansion:f,expansion:g,receivedStatus:m,readReceiptInfo:R,pushConfig:C,messageId:E}}!function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",e.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",e.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",e.CONVERSATION="CONVERSATION",e.CHATROOM="CHATROOM",e.EXPANSION="EXPANSION",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.TAG="TAG",e.CONVERSATION_TAG="CONVERSATION_TAG",e.TYPING_STATUS="TYPING_STATUS",e.MESSAGE_BLOCKED="MESSAGE_BLOCKED"}(Ao||(Ao={}));var is,os=function(e){function t(n){var r=e.call(this)||this;if(t.imClient)return Mo.error("Please do not repeatedly perform the init method"),t.imClient;Jt("options.navigators",n.navigators,(function(e){return De(e)&&(0===e.length||e.every(qe))}));var i=null==n?void 0:n.connectType;return i?te.WEBSOCKET!==i&&te.COMET!==i&&(Mo.warn("RongIMLib connectionType must be "+te.WEBSOCKET+" or "+te.COMET),i=te.WEBSOCKET):i=te.WEBSOCKET,r._context=bo.init(ns,{appkey:n.appkey,apiVersion:"5.1.1",navigators:n.navigators||[],miniCMPProxy:n.customCMP||[],connectionType:i,logLevel:n.logLevel,logStdout:n.logStdout,indexDBSwitch:n.indexDBSwitch,checkCA:n.checkCA}),r.watch(),t.imClient=r,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}ko(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,t={onConnecting:function(){e.emit(Ao.CONNECTING)},onConnected:function(){e.emit(Ao.CONNECTED)},onDisconnect:function(){e.emit(Ao.DISCONNECT)},onSuspend:function(){e.emit(Ao.SUSPEND)},batchMessage:function(t){e.emit(Ao.MESSAGES,{messages:t.map((function(e){return rs(e)}))})},typingState:function(t){e.emit(Ao.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,r){e.emit(Ao.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:r})},messageReceiptRequest:function(t,n,r){e.emit(Ao.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n,senderUserId:r})},messageReceiptResponse:function(t,n,r){e.emit(Ao.MESSAGE_RECEIPT_RESPONSE,{conversation:t,receivedUserId:n,messageUIdList:r})},conversationState:function(t){var n=t.map((function(e){return{conversation:{conversationType:e.conversationType,latestMessage:e.latestMessage?rs(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,hasMentioned:e.hasMentioned,mentionedInfo:e.mentionedInfo,lastUnreadTime:e.lastUnreadTime,notificationStatus:e.notificationStatus,isTop:e.isTop,channelId:e.channelId,unreadMentionedCount:e.unreadMentionedCount},updatedItems:e.updatedItems}}));e.emit(Ao.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(Ao.CHATROOM,t)},expansion:function(t){e.emit(Ao.EXPANSION,t)},pullFinished:function(){e.emit(Ao.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(Ao.TAG)},conversationTagChanged:function(){e.emit(Ao.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(Ao.MESSAGE_BLOCKED,t)}};this.context.assignWatcher(t)},t}(Xe),ss={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:nt.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},as={},cs={};for(var us in ss){var ds=ss[us],ls=ds.code;as[ls]=us,cs[ls]=ds}ss.ROAMING_SERVICE_UNAVAILABLE.code;function hs(e,t){return null==is?void 0:is.context.install(e,t)}function ps(e){return Oo(this,void 0,void 0,(function(){var t;return No(this,(function(n){switch(n.label){case 0:return Jt("token",e,Dt.STRING,!0),Mo.warn("RongIMLib Version: 5.1.1, Commit: 756868a83166be55e30e49e5685b1644456ea30f"),[4,is.context.connect(e,!0)];case 1:return(t=n.sent()).code===nt.SUCCESS?[2,{code:t.code,data:{userId:t.userId}}]:[2,{code:t.code,msg:as[t.code]}]}}))}))}function fs(e,t,n){is.on(e,t,n)}function gs(e,t){return Oo(this,void 0,void 0,(function(){var n,r;return No(this,(function(i){switch(i.label){case 0:return Jt("options.count",t.count,Dt.NUMBER,!0),n="id:"+e,Mo.debug("join chatroom ->"+n),[4,os.imClient.context.joinChatroom(e,t.count)];case 1:return(r=i.sent())!==nt.SUCCESS?(Mo.warn("join chatroom fail ->code+:"+as[r]+","+n),[2,{code:r,msg:as[r]}]):[2,{code:r}]}}))}))}var ms=function(e,t,n,r){void 0===n&&(n=!0),void 0===r&&(r=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=r};function vs(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n=!0),function(r){return new ms(e,r,t,n)}}var _s,ys,Rs=vs("RC:ImgMsg"),Cs=vs("RC:HQVCMsg"),Es=vs("RC:SightMsg"),Ts=vs("RC:TxtMsg"),Ss=vs("RC:CombineMsg"),Is=vs("RC:FileMsg");vs("RC:GIFMsg"),vs("RC:VcMsg"),vs("RC:LBSMsg"),vs("RC:ReferenceMsg"),vs("RC:ImgTextMsg");var bs={qiniu:function(e,t,n,r){var i,o="https://"+t.uploadHost.qiniu;i=Ns()+ks[0][1]||o,ks.shift();var s=new XMLHttpRequest;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),s.onreadystatechange=function(){if(4===s.readyState){var i=s.responseText||"{}";(i=JSON.parse(i)).filename=t.uniqueValue,i.uploadMethod=St?St.QINIU:"",200===s.status?n.onCompleted(i):ks.length?bs[ks[0][0]](e,t,n,r):n.onError("upload fail")}},t.isChunk&&(i=function(e,t){var n="";return Os(t,(function(e,t){"token"!==e&&(n+=(n?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t))})),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e}(i+="/mkblk/"+e.size,t.multi_parmas)),s.open(t.method,i,!0),n.onOpen(s),t.stream&&s.setRequestHeader("authorization","UpToken "+t.multi_parmas.token),Os(t.headers,(function(e,t){s.setRequestHeader(e,t)})),s.send(e)},baidu:function(e,t,n,r){if(console.log(r,t),r.size>ws)throw new Error("the file size is over 5GB!");var i=t||{};t=t||ys;var o=new XMLHttpRequest,s=Ns();if(i.uploadHost.bos||i.bosUploadPath){var a=s+ks[0][1]+i.bosUploadPath;ks.shift();var c=i.bosHeader||{},u={filename:t.uniqueValue||r.uniqueName,name:r.name,downloadUrl:a,isBosRes:!0};o.upload&&t.support_options&&(o.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)}),o.onreadystatechange=function(){if(4===o.readyState){var i=o.responseText||"{}";(i=JSON.parse(i)).filename=t.uniqueValue,200===o.status?n.onCompleted(u,!0):ks.length?bs[ks[0][0]](e,t,n,r):n.onError("upload fail")}},o.open(t.method,a,!0),o.setRequestHeader("authorization",c.bosToken),o.setRequestHeader("x-bce-date",c.bosDate),o.send(r)}},aliyun:function(e,t,n,r){if(r.size>ws)throw new Error("the file size is over 5GB!");var i=new FormData;i.set("file",e.get("file")),i.set("key",e.get("key")),i.set("token",e.get("token"));var o=ks[0][1];ks.shift(),e=e||_s,t=(t=t||{})||ys;var s=new XMLHttpRequest,a=Ns()+t.ossBucketName+"."+o;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),s.onreadystatechange=function(){if(4===s.readyState){var e=s.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=St?St.ALI:"",200===s.status?n.onCompleted(e):ks.length?bs[ks[0][0]](i,t,n,r):n.onError("upload fail")}},s.open(t.method,a,!0),console.log("ali:url",a);var c=t.aliHeader||{};e.set("OSSAccessKeyId",c.osskeyId),e.set("policy",c.ossPolicy),e.set("Signature",c.ossSign),e.set("success_action_status",200),e.delete("key"),e.append("key",t.uploadFileName),e.delete("file"),e.append("file",r),s.send(e)},s3:function(e,t,n,r){var i=new FormData,o=new XMLHttpRequest,s=Ns(),a=ks[0][1],c=s+t.s3BucketName+"."+a;console.log("uploadS3:url",c),ks.shift(),o.upload&&t.support_options&&(o.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),o.onreadystatechange=function(){if(4===o.readyState){var i=o.responseText||"{}";if((i=JSON.parse(i)).name=t.uniqueValue,i.filename=t.uploadFileName,i.uploadMethod=St.AWS,console.log("UploadMethod:",St),200===o.status||204===o.status)n.onCompleted(i);else if(ks.length){var s=new FormData;s.set("file",e.get("file")),s.set("key",e.get("key")),s.set("token",e.get("token")),bs[ks[0][0]](s,t,n,r)}else n.onError("upload fail")}},o.open(t.method,c,!0);var u=t?t.s3Header:{},d=r&&r.type;"text/html"===d?i.set("Content-Disposition","inline;"):i.set("Content-Disposition","attachment;"),i.set("Content-Type",d),i.set("x-amz-credential",u.s3Credential),i.set("x-amz-algorithm",u.s3Algorithm),i.set("x-amz-date",u.s3Date),i.set("policy",u.s3Policy),i.set("x-amz-signature",u.s3Signature),i.set("key",t.uploadFileName),i.set("file",r),o.send(i)},stc:function(e,t,n,r){new FormData;var i=new XMLHttpRequest;Ns();var o="https://"+ks[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;ks.shift(),i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)}),i.onreadystatechange=function(){if(4===i.readyState){var o=i.responseText||"{}";if((o=JSON.parse(o)).name=t.uniqueValue,o.filename=t.uploadFileName,o.uploadMethod=St?St.STC:"",200===i.status||204===i.status)n.onCompleted(o);else if(ks.length){var s=new FormData;s.set("file",e.get("file")),s.set("key",e.get("key")),s.set("token",e.get("token")),bs[ks[0][0]](s,t,n,r)}else n.onError("upload fail")}},i.open("PUT",o,!0);var s=t?t.stcHeader:{};i.setRequestHeader("Content-Type",r.type),"text/html"===r.type?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attachment;"),i.setRequestHeader("Authorization",s.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",s.stcContentSha256),i.setRequestHeader("x-amz-date",s.stcDate),i.send(r)}},ks=[],ws=5368709120;function Os(e,t){for(var n in e)t(n,e[n])}function Ns(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}var As={form:function(e,t){var n=new FormData;if(t.unique_key){var r=e.name.substr(e.name.lastIndexOf(".")),i=Ms()+r;n.append(t.unique_key,i),t.uniqueValue=i}return n.append(t.file_data_name,e),Ps(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var r=e.name.substr(e.name.lastIndexOf(".")),i=Ms()+r;n[t.unique_key]=i,t.uniqueValue=i}return n[t.file_data_name]=e,Ps(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function Ms(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function Ps(e,t){for(var n in e)t(n,e[n])}var xs,Ls=0;function Us(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:As.form,genUId:Ms};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e),this.setOptions=function(e){var t=this;Ps(e,(function(e,n){t.options[e]=n}))},console.log("options",e),this.upload=function(e,t){if(e){var n=this;!function(e,t,n){if(_s=e,ys=t,ks=[],t.ossConfig){var r,i,o=JSON.parse(t.ossConfig),s="",a=[];o.forEach((function(e){var t=Number(e.p)-1;for(var n in e)"aliyun"===n&&(s=e[n]),"s3"===n&&(r=e[n]),"stc"===n&&(i=e[n]),"p"!==n&&(a[t]=[n,e[n]])})),a.forEach((function(e){e&&ks.push(e)})),o.length!==ks.length&&(ks=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",s],["s3",r],["stc",i]])}else ks=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];var c;if(t.ossConfig){var u=t&&JSON.parse(t.ossConfig);Array.isArray(u)||(u=[]),c=u.find((function(e){return Object.keys(e).includes("stc")}))}if(c&&1===parseInt(c.p)&&e.size>=4194304)!function(e,t,n){var r,i,o=e&&e.type||"text/plain",s=o.indexOf("image")>-1?1:4,a=Math.ceil(e.size/t.stc_chunk_size),c=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(c)||(c=[]);var u=c.find((function(e){return Object.keys(e).includes("stc")})),d="uploads";os.imClient.getFileToken(s,r,"POST",d).then((function(e){r=e.fileName,i="https://"+u.stc+"/"+t.stcBucketName+"/"+r,console.log("uploadStcMultipart:url",i);var s=new XMLHttpRequest;s.open("POST",i+"?"+d,!0),"text/html"===o?s.setRequestHeader("Content-Disposition","inline;"):s.setRequestHeader("Content-Disposition","attacshment;"),s.setRequestHeader("Authorization",e&&e.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),s.setRequestHeader("x-amz-date",e&&e.stcDate),s.setRequestHeader("Content-Type",o),s.send(),s.onreadystatechange=function(e){if(4===s.readyState){var t=s.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===s.status||204===s.status?function(e){for(var t=[],n=1;n<=a;n++)t.push(f(e,n));p(e,t)}(Array.isArray(t)&&t[1]):n.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){n.onError("uploadStcMultipart:"+e)}));var l=[],h=new Map;function p(c,u){u&&Array.isArray(u)&&0!==u.length&&Promise.all(u).then((function(){var u="uploadId="+c;if(h.size===a)os.imClient.context.getFileToken(s,r,"POST",u).then((function(r){console.log("onSuccess",r),console.log("onSuccess:uploadId",c);var s=new XMLHttpRequest;s.open("POST",i+"?"+u,!0),s.setRequestHeader("Authorization",r&&r.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",r&&r.stcContentSha256),s.setRequestHeader("x-amz-date",r&&r.stcDate),s.setRequestHeader("Content-Type",o);var a="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",d=Array.from(h.keys()||[]).sort((function(e,t){return e-t}));console.log("keys",d),d.map((function(e){a+="<Part><ETag>".concat(h.get(e),"</ETag><PartNumber>").concat(e,"</PartNumber></Part>")})),a+="</CompleteMultipartUpload>",s.send(a),console.log("xml",a),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var r={};r.name=e.name,r.filename=t.uploadFileName,r.uploadMethod=St.STC,n.onCompleted(r)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var d,g=[],m=C(l);try{for(m.s();!(d=m.n()).done;){var v=d.value;g.push(f(c,v))}}catch(_){m.e(_)}finally{m.f()}p(c,g)}}),(function(e){console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t,r=[],i=C(l);try{for(i.s();!(t=i.n()).done;){var o=t.value;r.push(f(c,o))}}catch(s){i.e(s)}finally{i.f()}p(c,r)}))}function f(n,a){return new Promise((function(c,u){var d="partNumber="+a+"&uploadId="+n;os.imClient.context.getFileToken(s,r,"PUT",d).then((function(n){console.log("signature "+a+" onSuccess",n);var r=e&&e.slice((a-1)*t.stc_chunk_size,a*t.stc_chunk_size);console.log("fileChunk:size",r.size);var s=new XMLHttpRequest;s.open("PUT",i+"?"+d,!0),s.setRequestHeader("Authorization",n&&n.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),s.setRequestHeader("x-amz-date",n&&n.stcDate),s.setRequestHeader("Content-Type",o),s.send(r),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var e=s.getResponseHeader("etag");console.log("etag:"+a,e),h.set(a,e),c(e)}else l.includes(a)||l.push(a),u(a)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(a)||l.push(a),u(a)}))}))}}(e,t,n);else{var d=t.data(e,t);bs[ks[0][0]](d,t,n,e)}}(e,this.options,{onProgress:function(e,n,r){xs=e,r?xs=Ls+e/n*(n-Ls):Ls=xs,t.onProgress(xs,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var Ds,Vs,Bs=function(e){return new Us(e)},Fs=function(e,t){!function(e,t,n){var r=document.createElement("canvas"),i=r.getContext("2d"),o=new Image;o.onload=function(){var s=function(e,t,n){var r,i,o,s=e<t,a=0,c=0;return(s?t/e:e/t)>n.scale?(s?(i=100,c=((o=t/(r=e/100))-n.maxHeight)/2):(o=100,a=((i=e/(r=t/100))-n.maxWidth)/2),{w:i,h:o,x:-a,y:-c}):(s?(r=t/n.maxHeight,o=n.maxHeight,i=e/r):(r=e/n.maxWidth,i=n.maxWidth,o=t/r),{w:i,h:o,x:-a,y:-c})}(o.width,o.height,t);r.width=s.w>t.maxWidth?t.maxWidth:s.w,r.height=s.h>t.maxHeight?t.maxHeight:s.h,i.drawImage(o,s.x,s.y,s.w,s.h);try{var a=r.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");a=a.replace(c,""),n(a)}catch(e){throw new Error(e)}},o.src="string"==typeof e?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)}(e.file,e.compress,t)},js=function(e,t){if(e.getToken)e.getToken((function(n,r){r=r||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=r.bos,e.ossConfig=r.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=r.bosDate,e.bosHeader.bosToken=r.bosToken,e.bosUploadPath=r.path,e.aliHeader={},e.aliHeader.osskeyId=r.osskeyId,e.aliHeader.ossPolicy=r.ossPolicy,e.aliHeader.ossSign=r.ossSign,e.ossBucketName=r.ossBucketName,e.uploadFileName=r.fileName,e.s3Header={},e.s3Header.s3Credential=r.s3Credential,e.s3Header.s3Algorithm=r.s3Algorithm,e.s3Header.s3Date=r.s3Date,e.s3Header.s3Policy=r.s3Policy,e.s3Header.s3Signature=r.s3Signature,e.s3BucketName=r.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=r.stcAuthorization,e.stcHeader.stcContentSha256=r.stcContentSha256,e.stcHeader.stcDate=r.stcDate,e.stcBucketName=r.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n),console.log("data",r);var i=Bs(e);t(i)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Bs(e);t(n)}},Hs=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var r=e.compressThumbnail||Fs;e.compress?r(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Ks=function(e){var t=this;this.instance=e,this.upload=function(e,n){Hs({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},qs=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var r={file:e,compress:n.cfg};Hs(r,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Gs=function(e,t){js(e,(function(e){var n=new Ks(e);t(n)}))},Ys=function(e,t){js(e,(function(n){var r={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},i=new qs(n,r);t(i)}))};function Js(e){return Ds=Ds||new AudioContext,new Promise((function(t,n){Ds.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Ws(e,t,n){return Oo(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,d,l;return No(this,(function(h){switch(h.label){case 0:return n=n||{},t instanceof ms==0?(Mo.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,ss.ILLGAL_PARAMS]):(Jt("conversation.channelId",null==e?void 0:e.channelId,Dt.CHANNEL_ID),r=e.conversationType,i=e.targetId,o=e.channelId,s="conversationType:"+r+",targetId:"+i,Mo.debug("send message ->"+s),(a=Object.assign(n,t)).channelId=o||"",[4,os.imClient.context.sendMessage(r,i,a)]);case 1:return c=h.sent(),u=c.code,d=c.data,u===nt.SUCCESS?(l=rs(d),[2,{code:u,data:l}]):(Mo.warn("send message fail ->"+u+":"+as[u]+","+s),[2,{code:u,msg:as[u],data:rs({isMentioned:!!n.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(null==n?void 0:n.disableNotification),canIncludeExpansion:!!(null==n?void 0:n.canIncludeExpansion),expansion:(null==n?void 0:n.expansion)||null,conversationType:r,targetId:i,channelId:o||"",senderUserId:os.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:$e.SEND,isOffLineMessage:!1,sentTime:(null==d?void 0:d.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:re.UNREAD})}])}}))}))}function zs(e,t){return function(n,r,i,o){return new Promise((function(s){var a;!function(e,t,n,r){var i,o=this;if(void 0===t&&(t=Pe.FILE),i=t===Pe.IMAGE?Pe.IMAGE:Pe.FILE,!Vs){Vs="upload.qiniup.com";var s=os.imClient.context.getInfoFromCache();if(s&&s.ossConfig)try{var a=JSON.parse(s.ossConfig).find((function(e){return void 0!==e.qiniu}));a&&(Vs=a.qiniu)}catch(e){}}var c=wo({domain:Vs,getToken:function(e){os.imClient.context.getFileToken(i).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},r);(i===Pe.IMAGE?Ys:Gs)(c,(function(r){r.upload(e,{onProgress:function(e,t){var r,i=Math.floor(e/t*100);null===(r=n.onProgress)||void 0===r||r.call(n,i)},onCompleted:function(r){return Oo(o,void 0,void 0,(function(){var o=this;return No(this,(function(s){return function(e,t,n,r,i){return Jt("fileType",e,Ye,!0),Jt("filename",t,Dt.STRING),Jt("saveName",n,Dt.STRING),Jt("serverType",i,Dt.NUMBER),new Promise((function(o){os.imClient.context.getFileUrl(e,t,n,r,i).then((function(e){o({code:nt.SUCCESS,data:e})})).catch((function(e){o({code:e})}))}))}(i,r.filename,r.name,r,r.uploadMethod).then((function(s){return Oo(o,void 0,void 0,(function(){var o,a;return No(this,(function(c){return 0!==s.code?(n.onFail(s),[2]):((o=s.data).type=e.type,o.name=r.name||r.filename,t===Pe.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Js).then((function(e){Object.assign(o,e),n.onSuccess(o)}),(function(){n.onSuccess(o)})):((a=new FileReader).onload=function(){a.result?Js(a.result).then((function(e){Object.assign(o,e),n.onSuccess(o)}),(function(){n.onSuccess(o)})):n.onSuccess(o)},a.onerror=function(){o.duration=0,n.onSuccess(o)},a.readAsArrayBuffer(e)),[2]):(i===Pe.IMAGE&&(o.thumbnail=r.thumbnail),n.onSuccess(o),[2]))}))}))})).catch((function(e){n.onFail(e)})),[2]}))}))},onError:function(e){n.onFail(e)}})}))}(r.file,e,{onProgress:null==i?void 0:i.onProgress,onSuccess:function(e){var a,c=(null===(a=null==i?void 0:i.onComplete)||void 0===a?void 0:a.call(i,{url:e.downloadUrl}))||t(e,r);Ws(n,c,o).then(s)},onFail:function(e){s({code:nt.UPLOAD_FILE_FAILED,msg:e||nt[nt.UPLOAD_FILE_FAILED]})}},(null===(a=o)||void 0===a?void 0:a.thumbnailConfig)||{})}))}}function Qs(e,t,n,r){return Jt("messageType",e,Dt.STRING,!0),Jt("isPersited",t,Dt.BOOLEAN,!0),Jt("isCounted",n,Dt.BOOLEAN,!0),os.imClient.context.registerMessageType(e,t,n,r),vs(e,t,n)}
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- function Xs(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}zs(Pe.FILE,(function(e,t){return new Is({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),zs(Pe.IMAGE,(function(e,t){return new Rs({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),zs(Pe.AUDIO,(function(e,t){return new Cs({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),zs(Pe.SIGHT,(function(e,t){return new Es({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})})),zs(Pe.COMBINE_HTML,(function(e,t){return new Ss({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})})),Bt.add("imlib","5.1.1"),Bt.validEngine("~5.1.1")||Mo.error("The current engine version '"+Bt.getInfo().engine+"' error,imlib required engine version at least '~5.1.1'.");var Zs,$s,ea=new ze("RCRTC");!function(e){e[e.SUCCESS=1e4]="SUCCESS",e[e.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",e[e.PARAMS_ERROR=50001]="PARAMS_ERROR",e[e.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",e[e.NOT_IN_ROOM=50003]="NOT_IN_ROOM",e[e.SERVICE_INVALID=50004]="SERVICE_INVALID",e[e.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",e[e.SIGNAL_ERROR=53001]="SIGNAL_ERROR",e[e.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",e[e.REQUEST_FAILED=53004]="REQUEST_FAILED",e[e.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",e[e.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",e[e.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",e[e.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",e[e.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",e[e.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",e[e.PERMISSION_DENIED=53012]="PERMISSION_DENIED",e[e.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",e[e.INVALID_TAGS=53014]="INVALID_TAGS",e[e.INVALID_USER_ID=53015]="INVALID_USER_ID",e[e.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",e[e.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",e[e.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",e[e.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",e[e.TRACK_NOT_READY=53020]="TRACK_NOT_READY",e[e.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",e[e.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",e[e.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",e[e.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",e[e.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",e[e.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",e[e.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",e[e.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",e[e.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",e[e.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM"}(Zs||(Zs={})),function(e){e[e.JOIN_REFUSED=40032]="JOIN_REFUSED"}($s||($s={}));var ta=function(){function e(){_(this,e),this.queue=[],this.locked=!1}return R(e,[{key:"checkToStart",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==this.queue.length&&!this.locked){e.next=2;break}return e.abrupt("return");case 2:return this.locked=!0,t=this.queue.shift(),n=t.resolve,r=t.task,i=t.reject,e.prev=4,e.next=7,r();case 7:o=e.sent,n(o),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),i(e.t0);case 14:this.locked=!1,this.checkToStart();case 15:case"end":return e.stop()}}),e,this,[[4,11]])})))}},{key:"push",value:function(e){var t=this,n=new Promise((function(n,r){t.queue.push({resolve:n,task:e,reject:r})}));return this.checkToStart(),n}}]),e}(),na=new ta,ra=function(e){return na.push(e)},ia=!0,oa=!0;function sa(e,t,n){var r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function aa(e,t,n){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);var r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(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 ca(e){return"boolean"!=typeof e?new Error("Argument type: "+S(e)+". Please use a boolean."):(ia=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function ua(e){return"boolean"!=typeof e?new Error("Argument type: "+S(e)+". Please use a boolean."):(oa=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function da(){if("object"==("undefined"==typeof window?"undefined":S(window))){if(ia)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function la(e,t){oa&&console.warn(e+" is deprecated, please use "+t+" instead.")}function ha(e){return"[object Object]"===Object.prototype.toString.call(e)}function pa(e){return ha(e)?Object.keys(e).reduce((function(t,n){var r=ha(e[n]),i=r?pa(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,v({},n,i))}),{}):e}function fa(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?fa(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((function(t){fa(e,e.get(t),n)}))})))}function ga(e,t,n){var r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(n){n.type===r&&n.trackId===t.id&&fa(e,n,i)}))})),i}var ma=da;function va(e,t){var n=e&&e.navigator;if(n.mediaDevices){var r=function(e){if("object"!=S(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(n){if("require"!==n&&"advanced"!==n&&"mediaSource"!==n){var r="object"==S(e[n])?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];var o={};"number"==typeof r.ideal?(o[i("min",n)]=r.ideal,t.optional.push(o),(o={})[i("max",n)]=r.ideal,t.optional.push(o)):(o[i("",n)]=r.ideal,t.optional.push(o))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach((function(e){void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==S(e.audio)){var o=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==S(e.video)){var s=e.video.facingMode;s=s&&("object"==S(s)?s:{ideal:s});var a,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?a=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(a=["front"]),a)return n.mediaDevices.enumerateDevices().then((function(t){var n=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return a.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!n&&t.length&&a.includes("back")&&(n=t[t.length-1]),n&&(e.video.deviceId=s.exact?{exact:n.deviceId}:{ideal:n.deviceId}),e.video=r(e.video),ma("chrome: "+JSON.stringify(e)),i(e)}));e.video=r(e.video)}return ma("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:function(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,(function(e){n.webkitGetUserMedia(e,t,(function(e){r&&r(o(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){var s=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(o(e))}))}))}}}}function _a(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function ya(e){if("object"==S(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var n=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)})),t.stream.getTracks().forEach((function(r){var i;i=e.RTCPeerConnection.prototype.getReceivers?n.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],n.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else aa(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ra(e){if("object"==S(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var 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()};var n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){n._senders.push(t(n,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var n=t._senders.find((function(t){return t.track===e}));n&&t._senders.splice(t._senders.indexOf(n),1)}))}}else if("object"==S(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ca(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,n=Array.prototype.slice.call(arguments),r=n[0],i=n[1],o=n[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var s=function(e){var t={};return e.result().forEach((function(e){var n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){n[t]=e.stat(t)})),t[n.id]=n})),t},a=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(a(s(e)))};return t.apply(this,[c,r])}return new Promise((function(n,r){t.apply(e,[function(e){n(a(s(e)))},r])})).then(i,o)}}}function Ea(e){if("object"==S(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return ga(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var r=e.RTCPeerConnection.prototype.getReceivers;r&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=r.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),aa(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return ga(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,n,r,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(n?r=!0:n=e),e.track===o})),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Ta(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();n.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(n){var r=t._shimmedLocalStreams[n].indexOf(e);-1!==r&&t._shimmedLocalStreams[n].splice(r,1),1===t._shimmedLocalStreams[n].length&&delete t._shimmedLocalStreams[n]})),i.apply(this,arguments)}}function Sa(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Ta(e);var n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=n.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var n=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(n.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}r.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var s=this._streams[n.id];if(s)s.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var a=new e.MediaStream([t]);this._streams[n.id]=a,this._reverseStreams[a.id]=n,this.addStream(a)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],r=v({},t,(function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[function(n){var r=a(e,n);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):n.apply(this,arguments).then((function(t){return a(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=s.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,n=this;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");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){n._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=n._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function a(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}function c(e,t){var n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:n})}}function Ia(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],r=v({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function ba(e,t){aa(e,"negotiationneeded",(function(e){var n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}var ka,wa,Oa=Object.freeze({__proto__:null,shimMediaStream:_a,shimOnTrack:ya,shimGetSendersWithDtmf:Ra,shimGetStats:Ca,shimSenderReceiverGetStats:Ea,shimAddTrackRemoveTrackWithNative:Ta,shimAddTrackRemoveTrack:Sa,shimPeerConnection:Ia,fixNegotiationNeeded:ba,shimGetUserMedia:va,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((function(t){var r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),Na=(ka=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((function(e){return 0===e.indexOf(n)}))},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==S(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var o=r[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){var a=t.parseRtpMap(s),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(a.parameters=c.length?t.parseFmtp(c[0]):{},a.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(a.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){n.headerExtensions.push(t.parseExtmap(e))})),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var i=0;return n.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),s=-1!==i.fecMechanisms.indexOf("ULPFEC"),a=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=a.length>0&&a[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var s=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){var n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var o=t.writeRtpDescription(e.kind,n);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s="msid:"+i.id+" "+e.rtpSender.track.id+"\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:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t},ka(wa={exports:{}}),wa.exports);function Aa(e,t,n,r,i){var o=Na.writeRtpDescription(e.kind,t);if(o+=Na.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=Na.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=s;var a="msid:"+(r?r.id:"-")+" "+s+"\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:"+Na.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+Na.localCName+"\r\n"),o}function Ma(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var o=r(e.parameters.apt,n),s=r(t.parameters.apt,i);return o&&s&&o.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach((function(r){for(var o=0;o<t.codecs.length;o++){var s=t.codecs[o];if(r.name.toLowerCase()===s.name.toLowerCase()&&r.clockRate===s.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&s.parameters.apt&&!i(r,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(r.numChannels,s.numChannels),n.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter((function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}})),n}function Pa(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function xa(e,t){var n=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return n||e.addRemoteCandidate(t),!n}function La(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}function Ua(e){var t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch((function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))}))}}function Da(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 Va(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var n=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){n.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){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);var r=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var o=new Event("track");o.track=n,o.receiver=r,o.transceiver={receiver:r},o.streams=i,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){r[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw La("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||n?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(n=!0,!0)})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var o=n.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=Na.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw La("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw La("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach((function(t){n.addTrack(t,e)}));else{var r=e.clone();e.getTracks().forEach((function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",(function(e){n.enabled=e.enabled}))})),r.getTracks().forEach((function(e){n.addTrack(e,r)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw La("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find((function(e){return e.rtpSender===t}));if(!n)throw La("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var n=t.getSenders().find((function(t){return t.track===e}));n&&t.removeTrack(n)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:n};var s=e.candidate,a=!s||0===Object.keys(s).length;if(a)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),s.component=1,s.ufrag=i.getLocalParameters().usernameFragment;var c=Na.writeCandidate(s);o.candidate=Object.assign(o.candidate,Na.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=Na.getMediaSections(r._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=a?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",r._localDescription.sdp=Na.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),a||r._dispatchEvent("icecandidate",o),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=Ma(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:Na.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(La("TypeError",'Unsupported type "'+e.type+'"'));if(!Pa("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(La("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=Na.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=Na.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=Na.splitSections(r._remoteDescription.sdp),n=t.shift();var i=Na.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var o=r.transceivers[t],s=o.iceGatherer,a=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,d=o.remoteCapabilities;if(!(Na.isRejected(e)&&0===Na.matchPrefix(e,"a=bundle-only").length||o.rejected)){var l=Na.getIceParameters(e,n),h=Na.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(o.mid,t),"new"===a.state&&a.start(s,l,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var p=Ma(u,d);r._transceive(o,p.codecs.length>0,!1)}}))}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(La("TypeError",'Unsupported type "'+i.type+'"'));if(!Pa("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(La("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var s={};o.remoteStreams.forEach((function(e){s[e.id]=e}));var a=[],c=Na.splitSections(i.sdp),u=c.shift(),d=Na.matchPrefix(u,"a=ice-lite").length>0,l=Na.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=l;var h=Na.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=Na.splitLines(r),p=Na.getKind(r),f=Na.isRejected(r)&&0===Na.matchPrefix(r,"a=bundle-only").length,g=h[0].substr(2).split(" ")[2],m=Na.getDirection(r,u),v=Na.parseMsid(r),_=Na.getMid(r)||Na.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===g||"UDP/DTLS/SCTP"===g))o.transceivers[c]={mid:_,kind:p,protocol:g,rejected:!0};else{var y,R,C,E,T,S,I,b,k;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var w,O,N=Na.parseRtpParameters(r);f||(w=Na.getIceParameters(r,u),(O=Na.getDtlsParameters(r,u)).role="client"),I=Na.parseRtpEncodingParameters(r);var A=Na.parseRtcpParameters(r),M=Na.matchPrefix(r,"a=end-of-candidates",u).length>0,P=Na.matchPrefix(r,"a=candidate:").map((function(e){return Na.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&l&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||f)"answer"!==i.type||f||(R=(y=o.transceivers[c]).iceGatherer,C=y.iceTransport,E=y.dtlsTransport,T=y.rtpReceiver,S=y.sendEncodingParameters,b=y.localCapabilities,o.transceivers[c].recvEncodingParameters=I,o.transceivers[c].remoteCapabilities=N,o.transceivers[c].rtcpParameters=A,P.length&&"new"===C.state&&(!d&&!M||l&&0!==c?P.forEach((function(e){xa(y.iceTransport,e)})):C.setRemoteCandidates(P)),l&&0!==c||("new"===C.state&&C.start(R,w,"controlling"),"new"===E.state&&E.start(O)),!Ma(y.localCapabilities,y.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&y.sendEncodingParameters[0].rtx&&delete y.sendEncodingParameters[0].rtx,o._transceive(y,"sendrecv"===m||"recvonly"===m,"sendrecv"===m||"sendonly"===m),!T||"sendrecv"!==m&&"sendonly"!==m?delete y.rtpReceiver:(k=T.track,v?(s[v.stream]||(s[v.stream]=new e.MediaStream),n(k,s[v.stream]),a.push([k,T,s[v.stream]])):(s.default||(s.default=new e.MediaStream),n(k,s.default),a.push([k,T,s.default]))));else{(y=o.transceivers[c]||o._createTransceiver(p)).mid=_,y.iceGatherer||(y.iceGatherer=o._createIceGatherer(c,l)),P.length&&"new"===y.iceTransport.state&&(!M||l&&0!==c?P.forEach((function(e){xa(y.iceTransport,e)})):y.iceTransport.setRemoteCandidates(P)),b=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(b.codecs=b.codecs.filter((function(e){return"rtx"!==e.name}))),S=y.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var x,L=!1;"sendrecv"===m||"sendonly"===m?(L=!y.rtpReceiver,T=y.rtpReceiver||new e.RTCRtpReceiver(y.dtlsTransport,p),L&&(k=T.track,v&&"-"===v.stream||(v?(s[v.stream]||(s[v.stream]=new e.MediaStream,Object.defineProperty(s[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(k,"id",{get:function(){return v.track}}),x=s[v.stream]):(s.default||(s.default=new e.MediaStream),x=s.default)),x&&(n(k,x),y.associatedRemoteMediaStreams.push(x)),a.push([k,T,x]))):y.rtpReceiver&&y.rtpReceiver.track&&(y.associatedRemoteMediaStreams.forEach((function(t){var n=t.getTracks().find((function(e){return e.id===y.rtpReceiver.track.id}));n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)})),y.associatedRemoteMediaStreams=[]),y.localCapabilities=b,y.remoteCapabilities=N,y.rtpReceiver=T,y.rtcpParameters=A,y.sendEncodingParameters=S,y.recvEncodingParameters=I,o._transceive(o.transceivers[c],!1,L)}}})),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(s).forEach((function(t){var n=s[t];if(n.getTracks().length){if(-1===o.remoteStreams.indexOf(n)){o.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout((function(){o._dispatchEvent("addstream",i)}))}a.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(o,t,i,[n])}))}})),a.forEach((function(e){e[2]||r(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(La("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter((function(e){return"audio"===e.kind})).length,i=n.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(r=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(n.transceivers.forEach((function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var s=Na.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var o=r.track,s=r.kind,a=r.mid||Na.generateIdentifier();r.mid=a,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(s);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===s&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,s)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(s+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){s+=Aa(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),s+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,s+="a="+Na.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(s+="a=end-of-candidates\r\n"))}));var a=new e.RTCSessionDescription({type:"offer",sdp:s});return Promise.resolve(a)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(La("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(La("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=Na.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=Na.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach((function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var s;e.stream&&("audio"===e.kind?s=e.stream.getAudioTracks()[0]:"video"===e.kind&&(s=e.stream.getVideoTracks()[0]),s&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var a=Ma(e.localCapabilities,e.remoteCapabilities);!a.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=Aa(e,a,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(r,i){if(!n._remoteDescription)return i(La("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var s=0;s<n.transceivers.length;s++)if(n.transceivers[s].mid===e.sdpMid){o=s;break}var a=n.transceivers[o];if(!a)return i(La("OperationError","Can not add ICE candidate"));if(a.rejected)return r();var c=Object.keys(e.candidate).length>0?Na.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===o||o>0&&a.iceTransport!==n.transceivers[0].iceTransport)&&!xa(a.iceTransport,c))return i(La("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=Na.getMediaSections(n._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=Na.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=Na.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=Na.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)})),!n)throw La("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&r.push(e[t].getStats())}))})),Promise.all(r).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i}(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&la("RTCIceServer.url","RTCIceServer.urls");var r="string"==typeof t;return r&&(t=[t]),t=t.filter((function(e){if(0===e.indexOf("stun:"))return!1;var t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!n?(n=!0,!0):t&&!n})),delete e.url,e.urls=r?t[0]:t,!!t.length}}))}(e.iceServers,t.version),da("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function Ba(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var Fa=Object.freeze({__proto__:null,shimPeerConnection:Va,shimReplaceTrack:Ba,shimGetUserMedia:Ua,shimGetDisplayMedia:Da});function ja(e,t){var n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){la("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){var i=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},o=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(e){return"object"==S(e)&&"object"==S(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},r&&r.prototype.getSettings){var s=r.prototype.getSettings;r.prototype.getSettings=function(){var e=s.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(r&&r.prototype.applyConstraints){var a=r.prototype.applyConstraints;r.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==S(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[e])}}}}function Ha(e){"object"==S(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ka(e,t){if("object"==S(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var n=e.RTCPeerConnection.prototype[t],r=v({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],s=e[2];return r.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,r){e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(o,s)}}}function qa(e){if("object"==S(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n});var n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function Ga(e){if("object"==S(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,n=t.apply(this,[]);return n.forEach((function(t){return t._pc=e})),n}),aa(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Ya(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;la("removeStream","removeTrack"),this.getSenders().forEach((function(n){n.track&&e.getTracks().includes(n.track)&&t.removeTrack(n)}))})}function Ja(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Wa(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach((function(e){if("rid"in e&&!/^[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")}));var r=t.apply(this,arguments);if(n){var i=r.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return r})}}function za(e){if("object"==S(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Qa(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,n=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(n,e)})).finally((function(){n.setParametersPromises=[]})):t.apply(this,arguments)}}}function Xa(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,n=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return t.apply(n,e)})).finally((function(){n.setParametersPromises=[]})):t.apply(this,arguments)}}}var Za=Object.freeze({__proto__:null,shimOnTrack:Ha,shimPeerConnection:Ka,shimSenderGetStats:qa,shimReceiverGetStats:Ga,shimRemoveStream:Ya,shimRTCDataChannel:Ja,shimAddTransceiver:Wa,shimGetParameters:za,shimCreateOffer:Qa,shimCreateAnswer:Xa,shimGetUserMedia:ja,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function $a(e){if("object"==S(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)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=this,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){n._localStreams?n._localStreams.includes(e)||n._localStreams.push(e):n._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var n=this._localStreams.indexOf(e);if(-1!==n){this._localStreams.splice(n,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function ec(e){if("object"==S(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:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function tc(e){if("object"==S(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};var a=function(e,t,n){var r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){var r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){var r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}}function nc(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var n=t.mediaDevices,r=n.getUserMedia.bind(n);t.mediaDevices.getUserMedia=function(e){return r(rc(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function rc(e){return e&&void 0!==e.video?Object.assign({},e,{video:pa(e.video)}):e}function ic(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){for(var r=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(la("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[i])}e.iceServers=r}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function oc(e){"object"==S(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function sc(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var n=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveAudio||n||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"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 ac(e){"object"!=S(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var cc=Object.freeze({__proto__:null,shimLocalStreamsAPI:$a,shimRemoteStreamsAPI:ec,shimCallbacksAPI:tc,shimGetUserMedia:nc,shimConstraints:rc,shimRTCIceServerUrls:ic,shimTrackEventTransceiver:oc,shimCreateOfferLegacy:sc,shimAudioContext:ac});function uc(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==S(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),r=Na.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,aa(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function dc(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var n=function(e){if(!e||!e.sdp)return!1;var t=Na.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Na.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var n=parseInt(t[1],10);return n!=n?-1:n},i=function(e){var n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},o=function(e,n){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var i=Na.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),a=e.sdpSemantics;"plan-b"===a&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){var c,u=r(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return s.apply(this,arguments)}}}function lc(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return n(e,this),e},aa(e,"datachannel",(function(e){return n(e.channel,e.target),e}))}function n(e,t){var n=e.send;e.send=function(){var r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}}function hc(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(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((function(e){var n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}}function pc(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"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 n.apply(this,arguments)}}}function fc(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}var gc,mc,vc,_c=Object.freeze({__proto__:null,shimRTCIceCandidate:uc,shimMaxMessageSize:dc,shimSendThrowTypeError:lc,shimConnectionState:hc,removeExtmapAllowMixed:pc,shimAddIceCandidateNullOrEmpty:fc}),yc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},r=da,i=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var n=e.navigator;if(n.mozGetUserMedia)t.browser="firefox",t.version=sa(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=sa(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=sa(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=sa(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(t),o={browserDetails:i,commonShim:_c,extractVersion:sa,disableLog:ca,disableWarnings:ua};switch(i.browser){case"chrome":if(!Oa||!Ia||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=Oa,fc(t,i),va(t,i),_a(t),Ia(t,i),ya(t),Sa(t,i),Ra(t),Ca(t),Ea(t),ba(t,i),uc(t),hc(t),dc(t,i),lc(t),pc(t,i);break;case"firefox":if(!Za||!Ka||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=Za,fc(t,i),ja(t,i),Ka(t,i),Ha(t),Ya(t),qa(t),Ga(t),Ja(t),Wa(t),za(t),Qa(t),Xa(t),uc(t),hc(t),dc(t,i),lc(t);break;case"edge":if(!Fa||!Va||!n.shimEdge)return r("MS edge shim is not included in this adapter release."),o;r("adapter.js shimming edge."),o.browserShim=Fa,Ua(t),Da(t),Va(t,i),Ba(t),dc(t,i),lc(t);break;case"safari":if(!cc||!n.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=cc,fc(t,i),ic(t),sc(t),tc(t),$a(t),ec(t),oc(t),nc(t),ac(t),uc(t),dc(t,i),lc(t),pc(t,i);break;default:r("Unsupported browser!")}return o}({window:"undefined"==typeof window?void 0:window});!function(e){e.FPS_10="FPS_10",e.FPS_15="FPS_15",e.FPS_24="FPS_24",e.FPS_30="FPS_30"}(gc||(gc={})),function(e){e.W176_H132="W176_H132",e.W176_H144="W176_H144",e.W256_H144="W256_H144",e.W320_H180="W320_H180",e.W240_H240="W240_H240",e.W320_H240="W320_H240",e.W480_H360="W480_H360",e.W640_H360="W640_H360",e.W480_H480="W480_H480",e.W640_H480="W640_H480",e.W720_H480="W720_H480",e.W1280_H720="W1280_H720",e.W1920_H1080="W1920_H1080"}(mc||(mc={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_VIDEO=2]="AUDIO_VIDEO"}(vc||(vc={}));var Rc=(v(Y={},mc.W176_H132,{width:176,height:132,maxBitrate:150,minBitrate:80}),v(Y,mc.W176_H144,{width:176,height:144,maxBitrate:160,minBitrate:80}),v(Y,mc.W256_H144,{width:256,height:144,maxBitrate:240,minBitrate:120}),v(Y,mc.W320_H180,{width:320,height:180,maxBitrate:280,minBitrate:120}),v(Y,mc.W240_H240,{width:240,height:240,maxBitrate:280,minBitrate:120}),v(Y,mc.W320_H240,{width:320,height:240,maxBitrate:400,minBitrate:120}),v(Y,mc.W480_H360,{width:480,height:360,maxBitrate:650,minBitrate:150}),v(Y,mc.W640_H360,{width:640,height:360,maxBitrate:800,minBitrate:180}),v(Y,mc.W480_H480,{width:480,height:480,maxBitrate:800,minBitrate:180}),v(Y,mc.W640_H480,{width:640,height:480,maxBitrate:900,minBitrate:200}),v(Y,mc.W720_H480,{width:720,height:480,maxBitrate:1e3,minBitrate:200}),v(Y,mc.W1280_H720,{width:1280,height:720,maxBitrate:2200,minBitrate:250}),v(Y,mc.W1920_H1080,{width:1920,height:1080,maxBitrate:4e3,minBitrate:400}),Y),Cc=function(e,t){var n=e*t,r=Number.MAX_VALUE,i=null;for(var o in Rc){var s=Rc[o],a=Math.abs(s.width*s.height-n);a<r&&(i=s,r=a)}return i},Ec={10:1,15:1,24:1.5,30:1.5},Tc=function(e){var t=Number.MAX_VALUE,n=1;for(var r in Ec){var i=Math.abs(e-parseInt(r));i<t&&(t=i,n=Ec[r])}return n},Sc=function(){return Xs(void 0,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return e.t0=function(e){return"videoinput"===e.kind},e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}}),e)})))},Ic=function(){return Xs(void 0,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return e.t0=function(e){return"audioinput"===e.kind},e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}}),e)})))},bc=function(){return Xs(void 0,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return e.t0=function(e){return"audiooutput"===e.kind},e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}}),e)})))},kc=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s){var a;return _(this,n),(a=t.call(this))._tag=e,a._userId=r,a._kind=i,a._isLocalTrack=o,a._roomId=s,a._localMuted=!1,a._remoteMuted=!1,a._streamId=[a._userId||a._roomId,a._tag].join("_"),a._id=[a._streamId,a.isAudioTrack()?0:1].join("_"),a}return R(n,[{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:"getTag",value:function(){return this._tag}},{key:"isLocalTrack",value:function(){return this._isLocalTrack}},{key:"isVideoTrack",value:function(){return"video"===this._kind}},{key:"isAudioTrack",value:function(){return"audio"===this._kind}},{key:"isReady",value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}},{key:"__innerSetMediaStreamTrack",value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,n=t.getTracks()[0];n&&t.removeTrack(n),e?t.addTrack(e):this._element&&(this._element.pause(),this._element.srcObject=null)}},{key:"_setLocalMuted",value:function(e){this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e}},{key:"mute",value:function(){ea.info("set ".concat(this._id," enabled: false")),this._setLocalMuted(!0)}},{key:"unmute",value:function(){ea.info("set ".concat(this._id," enabled: true")),this._setLocalMuted(!1)}},{key:"isLocalMuted",value:function(){return this._localMuted}},{key:"isMCUTrack",value:function(){return Boolean(this._roomId)}},{key:"isOwnerMuted",value:function(){return this._remoteMuted}},{key:"play",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._msTrack){n.next=2;break}return n.abrupt("return",(ea.warn("the track is not ready to play -> id: ".concat(this._id)),{code:Zs.TRACK_NOT_READY}));case 2:if("ended"===this._msTrack.readyState&&ea.warn("the track's readyState is 'ended' -> id: ".concat(this._id)),!(null==t?void 0:t.volume)){n.next=6;break}if(Ue(null==t?void 0:t.volume)){n.next=5;break}return n.abrupt("return",(ea.error("".concat(null==t?void 0:t.volume," is not a number, the valid range of options.volume is 0-100")),{code:Zs.PARAMS_ERROR}));case 5:(null==t?void 0:t.volume)<0&&(t.volume=0,ea.warn("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,ea.warn("the valid range of options.volume is 0-100, the value of volume has been set 100"));case 6:if(!(null==t?void 0:t.audioDeviceId)){n.next=13;break}return n.next=9,bc();case 9:if(n.t0=function(e){return e.deviceId},n.t1=t.audioDeviceId,n.sent.map(n.t0).includes(n.t1)){n.next=13;break}return n.abrupt("return",(ea.error("the options.audioDeviceId is invalid --\x3e ".concat(t.audioDeviceId)),{code:Zs.PARAMS_ERROR}));case 13:if(!(r=this.isVideoTrack())||e&&e instanceof HTMLVideoElement){n.next=16;break}return n.abrupt("return",(ea.error("the video track need an <video> to play -> id: ".concat(this._id)),{code:Zs.VIDEO_TRACK_MISS_MEDIA_ELEMENT}));case 16:if(this._element=r?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;ea.debug("HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.ondurationchange=function(e){var t;ea.debug("HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onloadedmetadata=function(e){var t;ea.debug("HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onloadeddata=function(e){var t;ea.debug("HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onabort=function(e){var t;ea.info("HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.oncanplay=function(e){var t;ea.info("HTMLMediaElement oncanplay -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(i._id))},this._element.onvolumechange=function(e){var t,n=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));ea.info("HTMLMediaElement onvolumechange -> volume: ".concat(n,", trackId: ").concat(i._id))},this._element.srcObject=this._msStream,this._element.autoplay=!0,r&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),r||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=(null==t?void 0:t.volume)/100),n.prev=17,!(null==t?void 0:t.audioDeviceId)||r){n.next=23;break}return n.next=21,this._element.setSinkId(t.audioDeviceId);case 21:n.next=24;break;case 23:this._element.play();case 24:n.next=29;break;case 26:return n.prev=26,n.t2=n.catch(17),n.abrupt("return","No permission to use requested device"===n.t2.message?(ea.error("setSinkId failed -> ".concat(n.t2.message)),{code:Zs.NO_PERMISSION_TO_USE_REQUESTED_DEVICE}):(ea.error(n.t2),{code:Zs.TRACK_PLAY_ERROR}));case 29:return n.abrupt("return",{code:Zs.SUCCESS});case 30:case"end":return n.stop()}}),n,this,[[17,26]])})))}},{key:"__innerDestroy",value:function(){this.__innerSetMediaStreamTrack(void 0)}},{key:"__releaseMediaElement",value:function(){this._element&&(this._element.remove(),this._element.srcObject=null)}}]),n}(Xe),wc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){var s;return _(this,n),(s=t.call(this,e,r,i,!0))._isPublished=!1,s.__innerSetMediaStreamTrack(o),o.onended=function(){o.onended=null,s.emit(n.EVENT_LOCAL_TRACK_END,f(s)),s.removeAll(n.EVENT_LOCAL_TRACK_END)},s}return R(n,[{key:"_setLocalMuted",value:function(e){var t=this._localMuted!==e;c(m(n.prototype),"_setLocalMuted",this).call(this,e),this._remoteMuted=this._localMuted,t&&this.emit(n.__INNER_EVENT_MUTED_CHANGE__,this)}},{key:"__innerSetPublished",value:function(e){this._isPublished=e}},{key:"isPublished",value:function(){return this._isPublished}},{key:"destroy",value:function(){var e;ea.info("track is destroyed -> trackId: ".concat(this.getTrackId())),null===(e=this._msTrack)||void 0===e||e.stop(),c(m(n.prototype),"__innerDestroy",this).call(this),this.isAudioTrack()&&c(m(n.prototype),"__releaseMediaElement",this).call(this),this.emit(n.__INNER_EVENT_DESTROY__,this)}},{key:"setBitrate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!Ue(e)||!Ue(t)||!Ue(n)||e<=0||t<=0||e<t?ea.error("setBitrate params error ->"):this._bitrateInfo={max:e,min:t,start:n}}},{key:"getBitrate",value:function(){var e,t,n=this._msTrack?Jc(this._msTrack):{min:0,max:0},r=n.min,i=n.max;return{min:(null===(e=this._bitrateInfo)||void 0===e?void 0:e.min)||r,max:(null===(t=this._bitrateInfo)||void 0===t?void 0:t.max)||i}}}]),n}(kc);wc.EVENT_LOCAL_TRACK_END="local-track-end",wc.__INNER_EVENT_MUTED_CHANGE__="inner-muted-change",wc.__INNER_EVENT_DESTROY__="inner-destroy";var Oc=function(e){d(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"audio",i)}return R(n,[{key:"setBitrate",value:function(e,t,n){ea.warn("`setBitrate` invalid for audio track")}},{key:"getBitrate",value:function(){return{start:32,max:32,min:32}}}]),n}(wc),Nc=function(e){d(n,e);var t=h(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _(this,n),(o=t.call(this,e,r,"video",i))._isTiny=s,o}return R(n,[{key:"__isTiny",value:function(){return this._isTiny}},{key:"getStreamId",value:function(){var e=c(m(n.prototype),"getStreamId",this).call(this);return this._isTiny?"".concat(e,"_tiny"):e}},{key:"getTrackId",value:function(){var e=c(m(n.prototype),"getTrackId",this).call(this);return this._isTiny?"".concat(e,"_tiny"):e}}]),n}(wc),Ac=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s){var a;return _(this,n),(a=t.call(this,e,r,i,o))._resource=s,n.__innerSetMapping(a.getTrackId(),s),a}return R(n,[{key:"destroy",value:function(){this.isAudioTrack()&&this.mute(),n.__innerRemoveMapping(this.getTrackId(),this._resource),c(m(n.prototype),"destroy",this).call(this)}}],[{key:"__innerSetMapping",value:function(e,t){var n=this._mapping.get(t)||[];n.push(e),this._mapping.set(t,n)}},{key:"__innerRemoveMapping",value:function(e,t){var n,r,i=null===(n=this._mapping.get(t))||void 0===n?void 0:n.filter((function(t){return t!==e}));i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(r=t.parentNode)||void 0===r||r.removeChild(t))}}]),n}(wc);Ac._mapping=new Map;var Mc,Pc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){return _(this,n),t.call(this,e,r,"video",i,o)}return R(n)}(Ac),xc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){return _(this,n),t.call(this,e,r,"audio",i,o)}return R(n,[{key:"_setLocalMuted",value:function(e){this._resource&&(this._resource.muted=e),c(m(n.prototype),"_setLocalMuted",this).call(this,e)}},{key:"play",value:function(){return this._setLocalMuted(!1),Promise.resolve({code:Zs.SUCCESS})}}]),n}(Ac),Lc=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Oc),Uc=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Nc),Dc=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n)}(Nc),Vc=function(e){d(n,e);var t=h(n);function n(e,r,i,o){var s;return _(this,n),(s=t.call(this,e,r,i,!1,o))._isSubscribed=!1,s}return R(n,[{key:"__innerSetRemoteMuted",value:function(e){this._remoteMuted=e}},{key:"__innerSetSubscribed",value:function(e){this._isSubscribed=e}},{key:"isSubscribed",value:function(){return this._isSubscribed}}]),n}(kc),Bc=function(e){d(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"audio",i)}return R(n)}(Vc),Fc=function(e){d(n,e);var t=h(n);function n(e,r,i){return _(this,n),t.call(this,e,r,"video",i)}return R(n)}(Vc),jc=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},Hc=function(e){return JSON.stringify(e)},Kc=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},qc="http:"!==location.protocol||["localhost","127.0.0.1"].includes(location.hostname),Gc=function(e){if(void 0===e)return 0;if(Ue(e))return e;var t=e;return t.exact||t.ideal||t.max||0},Yc=function(e){var t=e.getConstraints();return{width:Gc(t.width),height:Gc(t.height),frameRate:Gc(t.frameRate)}},Jc=function(e){var t=Yc(e),n=t.width,r=t.height,i=t.frameRate,o=Cc(n,r),s=Tc(i);return{min:o.minBitrate*s,max:o.maxBitrate*s}},Wc=function(e){return[e.msid,e.mediaType].join("_")},zc=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},Qc=function(e,t){return[e,t].join("_")},Xc=function(e){return e.map((function(e){return Object.assign({},e)}))},Zc=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e.slice();var r=[],i=[],o=[];return t.forEach((function(t){var i=Wc(t),s=e.findIndex((function(e){return Wc(e)===i}));if(n&&(s=e.findIndex((function(e){return e.uri===t.uri}))),-1!==s){var a=e[s];a.uri!==t.uri?r.push(t):a.state!==t.state&&o.push(t),e.splice(s,1)}else r.push(t)})),i.push.apply(i,a(e)),{publishedList:r,unpublishedList:i,modifiedList:o}},$c=function(e){var t=e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),n=s(t,2);return{width:n[0],height:n[1]}},eu=function(e){return!!mc[e]},tu=function(e){return!!gc[e]},nu=function(e){return parseInt(e.replace("FPS_",""))},ru={browser:(Mc=yc.browserDetails).browser,version:Mc.version,supportsUnifiedPlan:!1!==Mc.supportsUnifiedPlan};function iu(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function ou(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var su,au,cu=function(e){return"[object Null]"===Object.prototype.toString.call(e)},uu=function(e){return 1===e.type},du=function(e){var t={},n=Object.keys(e.users);return n.length&&n.forEach((function(n){var r=[],i=e.users[n];if(i.uris)try{r.push.apply(r,a(JSON.parse(i.uris)))}catch(e){ea.warn("invalid user data -> userId: ".concat(n,", userData: ").concat(i))}t[n]=r})),t};!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"}(su||(su={})),function(e){e.SUCCESS="Success",e.FAIL="Fail"}(au||(au={}));var lu,hu=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;_(this,e),this._roomId=t,this._roomMode=n,this._context=r,this._gap=i,this._latestTimestamp=Date.now(),this._timer=null}return R(e,[{key:"start",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._timer||(this._timer=setInterval(this._loop.bind(this),this._gap));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"_loop",value:function(){var e,t,n;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,new Promise((function(e){s._context.rtcPing(s._roomId,s._roomMode).then(e).catch((function(t){ea.error("rtcping receive unknown error -> ".concat(t)),e(nt.UNKNOWN)})),setTimeout(e,1e4,nt.TIMEOUT)}));case 2:if(i=r.sent,o=Date.now(),i!==nt.SUCCESS){r.next=6;break}return r.abrupt("return",(this._latestTimestamp=o,void(null===(e=this.onPingResult)||void 0===e||e.call(this,au.SUCCESS))));case 6:null===(t=this.onPingResult)||void 0===t||t.call(this,au.FAIL),ea.warn("rtcping failed -> code: ".concat(i)),(40003===i||o-this._latestTimestamp>6e4)&&(this.stop(),null===(n=this.onFailed)||void 0===n||n.call(this,40003===i));case 7:case"end":return r.stop()}}),r,this)})))}},{key:"stop",value:function(){this._timer&&(clearInterval(this._timer),this._timer=null)}}]),e}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(lu||(lu={}));var pu,fu,gu,mu,vu,_u=function(e,t){return Math.round(8*t/e)},yu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=Math.pow(10,t);return Math.round(e*n)/n},Ru=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;e>1&&(e/=32767);var n=Math.pow(10,t);return Math.ceil(e*n)},Cu=function(e,t,n,r){if(0===t)return 0;if(!n||!r)return yu(e/t,3);var i=t-r;if(0===i)return 0;var o=e-n;return o<0||i<0?0:yu(o/i,3)},Eu=function(e){var t=e.jitter,n=e.rtt,r=e.packetsLostRate;return!cu(t)||!cu(n)||0!==r},Tu=function(){function e(t,n){_(this,e),this._rtcPeerConn=t,this._sdpSemantics=n,this._latestPacketsSent={},this._latestBytesSent={},this._latestBytesRecv={},this._latestPacketsRecv={}}return R(e,[{key:"updateBytesSent",value:function(e,t,n){var r,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];r=t-o.bytesSent,i=n-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:n}}else r=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:n};return _u(i,r)}},{key:"updateBytesRecv",value:function(e,t,n){var r,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];r=t-o.bytesRecv,i=n-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n}}else r=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:n};return _u(i,r)}},{key:"updateSenderPacketsLost",value:function(e,t,n){var r;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var i=this._latestPacketsSent[e],o=i.packetsLost,s=i.packetsSent;r=Cu(t,n,o,s),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?s:n}else r=Cu(t,n),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=n;return r}},{key:"updateReceiverPacketsLost",value:function(e,t,n){var r;if(this._latestPacketsRecv[e]){var i=this._latestPacketsRecv[e],o=i.packetsLost,s=i.packetsRecv;r=Cu(t,n+t,o,s+o)}else r=Cu(t,n);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:n},r}},{key:"clearLatestpacketsSent",value:function(e){var t=this;e.forEach((function(e){if(parseInt(e.split("_").pop())===vc.VIDEO_ONLY){var n="".concat(e,"_tiny");delete t._latestPacketsSent[n],delete t._latestBytesSent[n]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]}))}},{key:"clearLatestPacketsRecv",value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}},{key:"parseRTCStatsReport",value:function(e){for(var t=e.keys(),n={},r=t.next();!r.done;){var i=r.value,o=e.get(i);/^RTCCodec_/.test(i)||(n[i]=o),r=t.next()}return n}},{key:"formatRCRTCStateReport",value:function(e){return{senders:[],receivers:[]}}},{key:"getAudioLevelList",value:function(e){return[]}},{key:"getResourceIdByParseSdp",value:function(e){var t,n,r,i=e.ssrc,o=e.kind||e.mediaType,s=null===(t=this._rtcPeerConn.currentLocalDescription)||void 0===t?void 0:t.sdp,a=null===(n=this._rtcPeerConn.currentRemoteDescription)||void 0===n?void 0:n.sdp;r="unified-plan"===this._sdpSemantics?new RegExp("a=msid:(.*?) "):new RegExp("a=ssrc:".concat(i," msid:(.*?) "));var c=null==s?void 0:s.split("\r\nm="),u=null==c?void 0:c.filter((function(e){return e.includes("a=ssrc:".concat(i))}))[0],d=null==u?void 0:u.match(r),l=d?d[1]:"";if(l)return"".concat(l,"_").concat("video"===o?1:0);var h=null==a?void 0:a.split("\r\nm="),p=null==h?void 0:h.filter((function(e){return e.includes("a=ssrc:".concat(i))}))[0],f=null==p?void 0:p.match(r);return l=f?f[1]:"","".concat(l,"_").concat("video"===o?1:0)}},{key:"isValidSender",value:function(e){var t,n=null===(t=this._rtcPeerConn.currentLocalDescription)||void 0===t?void 0:t.sdp,r=e.ssrc;return!(null==n?void 0:n.split("\r\nm=").some((function(e){return e.includes(r)&&e.includes("a=inactive")})))}},{key:"isValidReceiver",value:function(e){var t,n=null===(t=this._rtcPeerConn.currentRemoteDescription)||void 0===t?void 0:t.sdp,r=e.ssrc;return!(null==n?void 0:n.split("\r\nm=").some((function(e){return e.includes(r)&&e.includes("a=inactive")})))}}]),e}(),Su=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"formatRCRTCStateReport",value:function(e){var t=this,n={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);n.timestamp=r;var i=Object.keys(e),o=0,s=0;i.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var a=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidSender(a)){var c=a.id,u=a.kind,d=(a.transportId,a.mediaSourceId),l=a.remoteId,h=a.packetsSent,p=a.bytesSent,f=a.trackId,g=a.encoderImplementation,m=a.pliCount,v=a.nackCount;a.firCount;if(f){var _=a.framesPerSecond,y=a.frameWidth,R=a.frameHeight;"video"!==u||y||R||_||(y=e[f].frameWidth,R=e[f].frameHeight,_=d?e[d].framesPerSecond:null);var C=e[l],E=null,T=null,S=0;C&&(E=C.jitter,T=C.roundTripTime,S=C.packetsLost),o+=S;var I=t.getResourceIdByParseSdp(a),b=d?e[d].audioLevel:e[f].audioLevel,k=null;!t._latestPacketsSent[I]&&(t._latestPacketsSent[I]={}),C?k=t.updateSenderPacketsLost(I,S,h):t._latestPacketsSent[I].crtPacketsSent=h;var w=t.updateBytesSent(I,p,r);w<0&&(w=0),s+=w,n.senders.push({id:c,trackId:I,kind:u,packetsLostRate:k,remoteResource:!1,audioLevel:b||0===b?Ru(b):null,frameWidth:y,frameHeight:R,frameRate:_,bitrate:w,jitter:E?Math.round(1e3*E):E,rtt:T,encoderImplementation:g,pliCount:m,nackCount:v,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}}})),i.filter((function(e){return/RTCRemoteInboundRtp(Video|Audio)Stream_/.test(e)})).forEach((function(r){var i=e[r],o=i.localId,s=i.jitter,a=i.roundTripTime,c=i.packetsLost,u=n.senders.filter((function(e){return e.id===o}))[0];if(u&&!Eu(u)){var d=t.getResourceIdByParseSdp(e[u.id]);u.jitter=Math.round(1e3*s),u.rtt=a;var l=t._latestPacketsSent[d].crtPacketsSent;u.packetsLostRate=t.updateSenderPacketsLost(d,c,l)}}));var a=0;i.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var s=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(s)){var c=s.trackId,u=s.packetsLost,d=s.packetsReceived,l=s.jitter,h=s.bytesReceived,p=s.framesPerSecond,f=s.kind,g=s.codecImplementationName,m=s.nackCount,v=s.pliCount;if(c){var _=s.frameWidth,y=s.frameHeight,R=s.audioLevel;"video"===f?_||y||(_=e[c].frameWidth,y=e[c].frameHeight):R||(R=e[c].audioLevel),o+=u;var C=t.getResourceIdByParseSdp(s),E=t.updateReceiverPacketsLost(C,u,d),T=t.updateBytesRecv(C,h,r);T<0&&(T=0),a+=T,n.receivers.push({trackId:C,kind:f,packetsLostRate:E,remoteResource:!0,audioLevel:R||0===R?Ru(R):null,frameWidth:_,frameHeight:y,frameRate:p,bitrate:T,jitter:l?Math.round(1e3*l):0,codecImplementationName:g,nackCount:m,pliCount:v,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}}}));var c=i.filter((function(e){return/^RTCTransport_/.test(e)}))[0];if(c){var u=e[c].selectedCandidatePairId;if(u){var d=e[u],l=d.availableOutgoingBitrate,h=d.availableIncomingBitrate,p=d.currentRoundTripTime,f=d.localCandidateId,g=d.remoteCandidateId,m=e[f],v=m.ip,_=m.port,y=m.networkType,R=e[g],C=R.ip,E=R.port,T=R.protocol;n.iceCandidatePair={IP:v,port:_,networkType:y,remoteIP:C,remotePort:E,protocol:T,bitrateRecv:a,bitrateSend:s,rtt:1e3*p,availableOutgoingBitrate:l,availableIncomingBitrate:h,totalPacketsLost:o},n.receivers.forEach((function(e){e.rtt=p}))}}return n}},{key:"getAudioLevelList",value:function(e){var t=this,n=[],r=Object.keys(e);return r.filter((function(e){return/^RTCOutboundRTPAudioStream_/.test(e)})).forEach((function(r){var i,o=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidSender(o)){var s=o.mediaSourceId,a=o.trackId,c=t.getResourceIdByParseSdp(o),u=s&&e[s]?e[s].audioLevel:(null===(i=e[a])||void 0===i?void 0:i.audioLevel)||null;n.push({trackId:c,audioLevel:u||0===u?Ru(u):null})}})),r.filter((function(e){return/^RTCInboundRTPAudioStream_/.test(e)})).forEach((function(r){var i=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(i)){var o=i.trackId,s=i.audioLevel||e[o].audioLevel,a=t.getResourceIdByParseSdp(i);n.push({trackId:a,audioLevel:s||0===s?Ru(s):null})}})),n}}]),n}(Tu),Iu=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"formatRCRTCStateReport",value:function(e){var t=this,n=+new Date,r={senders:[],receivers:[],timestamp:n},i=0,o=0,s=0;for(var a in e){var c=e[a],u=c.type;if("outbound-rtp"===u){if("unified-plan"===this._sdpSemantics&&!this.isValidSender(c))continue;c.id;var d=c.kind,l=c.bytesSent,h=c.packetsSent,p=c.bitrateMean,f=c.framerateMean,g=c.nackCount,m=c.pliCount,v=c.remoteId,_=v?e[v]:{jitter:null,roundTripTime:null,packetsLost:0},y=_.jitter,R=_.roundTripTime,C=_.packetsLost,E=this.getResourceIdByParseSdp(c);i+=C;var T=null;!this._latestPacketsSent[E]&&(this._latestPacketsSent[E]={}),v?T=this.updateSenderPacketsLost(E,C,h):this._latestPacketsSent[E].crtPacketsSent=h;var S=0;"video"===d?p&&(S=Math.floor(p/1e3)):S=this.updateBytesSent(E,l,n),S<0&&(S=0),o+=S,r.senders.push({trackId:E,kind:d,packetsLostRate:T,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(f),bitrate:S,jitter:y?Math.round(1e3*y):null,rtt:R,encoderImplementation:null,pliCount:m,nackCount:g,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}if("remote-inbound-rtp"===u&&function(){var n=c.localId,i=t.getResourceIdByParseSdp(e[n]),o=r.senders.filter((function(e){return e.trackId===i}))[0];o&&Eu(o)&&(o.jitter=Math.round(1e3*c.jitter),o.rtt=c.rtt,o.packetsLostRate=t.updateSenderPacketsLost(i,c.packetsLost,t._latestPacketsSent[i].crtPacketsSent))}(),"inbound-rtp"===u){if("unified-plan"===this._sdpSemantics&&!this.isValidReceiver(c))continue;c.id;var I=c.packetsLost,b=c.bytesReceived,k=c.packetsReceived,w=c.jitter,O=c.framerateMean,N=c.kind,A=c.bitrateMean,M=c.nackCount,P=c.pliCount,x=this.getResourceIdByParseSdp(c);i+=I;var L=this.updateReceiverPacketsLost(x,I,k),U=0;"video"===N?A&&(U=Math.floor(A/1e3)):U=this.updateBytesRecv(x,b,n),U<0&&(U=0),s+=U,r.receivers.push({trackId:x,kind:N,packetsLostRate:L,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(O),bitrate:U,jitter:w?Math.round(1e3*w):null,codecImplementationName:null,nackCount:M,pliCount:P,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}if("candidate-pair"===u&&"succeeded"===c.state){var D=e[c.localCandidateId],V=D.address,B=D.port,F=e[c.remoteCandidateId],j=F.address,H=F.port,K=F.protocol;r.iceCandidatePair={IP:V,port:B,networkType:null,remoteIP:j,remotePort:H,protocol:K,bitrateRecv:s,bitrateSend:o,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:i}}}return r.iceCandidatePair&&(r.iceCandidatePair.bitrateSend=o),r.iceCandidatePair&&(r.iceCandidatePair.bitrateRecv=s),r}},{key:"getAudioLevelList",value:function(e){var t=[];for(var n in e){var r=e[n],i=r.type;if("outbound-rtp"===i){if("unified-plan"===this._sdpSemantics&&!this.isValidSender(r))continue;if("video"===r.kind)continue;var o=this.getResourceIdByParseSdp(r);t.push({trackId:o,audioLevel:null})}if("inbound-rtp"===i){if("unified-plan"===this._sdpSemantics&&!this.isValidReceiver(r))continue;if("video"===r.kind)continue;var s=this.getResourceIdByParseSdp(r);t.push({trackId:s,audioLevel:null})}}return t}}]),n}(Tu),bu=function(e){d(n,e);var t=h(n);function n(){return _(this,n),t.apply(this,arguments)}return R(n,[{key:"formatRCRTCStateReport",value:function(e){var t=this,n={senders:[],receivers:[]},r=Math.floor(e.RTCPeerConnection.timestamp);n.timestamp=r;var i=Object.keys(e),o=0,s=0;i.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var o=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidSender(o)){var a=t.getResourceIdByParseSdp(o),c=o.mediaType,u=(o.transportId,o.remoteId,o.packetsSent,o.bytesSent),d=o.trackId,l=o.encoderImplementation,h=o.pliCount,p=o.nackCount;o.firCount;if(d){var f=e[d],g=f.audioLevel,m=f.frameHeight,v=f.frameWidth,_=t.updateBytesSent(a,u,r);_<0&&(_=0),s+=_,n.senders.push({trackId:a,kind:c,packetsLostRate:null,remoteResource:!1,audioLevel:g||0===g?Ru(g):null,frameWidth:v,frameHeight:m,frameRate:null,bitrate:_,jitter:null,rtt:null,encoderImplementation:l,pliCount:h,nackCount:p,googFirsSent:-1,samplingRate:-1,googRenderDelayMs:-1,trackState:-1})}}}));var a=0;i.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(i){var s=e[i];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(s)){var c=s.trackId,u=s.packetsLost,d=s.packetsReceived,l=s.jitter,h=s.bytesReceived,p=s.mediaType,f=s.nackCount,g=s.pliCount,m=t.getResourceIdByParseSdp(s);if(c){var v=e[c],_=v.frameHeight,y=v.frameWidth,R=v.audioLevel;o+=u;var C=t.updateReceiverPacketsLost(m,u,d),E=t.updateBytesRecv(m,h,r);E<0&&(E=0),a+=E,n.receivers.push({trackId:m,kind:p,packetsLostRate:C,remoteResource:!0,audioLevel:R||0===R?Ru(R):null,frameWidth:y,frameHeight:_,frameRate:null,bitrate:E,jitter:l,codecImplementationName:null,nackCount:f,pliCount:g,rtt:null,samplingRate:-1,googFirsReceived:-1,googRenderDelayMs:-1,trackState:-1})}}}));var c=i.filter((function(e){return/^RTCTransport_/.test(e)}))[0];if(c){var u=e[c].selectedCandidatePairId;if(u){var d=e[u],l=d.availableOutgoingBitrate,h=d.availableIncomingBitrate,p=d.currentRoundTripTime,f=d.localCandidateId,g=d.remoteCandidateId,m=e[f],v=m.address,_=m.port,y=e[g],R=y.address,C=y.port,E=y.protocol;n.iceCandidatePair={IP:v||null,port:_,networkType:null,remoteIP:R,remotePort:C,protocol:E,bitrateRecv:a,bitrateSend:s,rtt:1e3*p,availableOutgoingBitrate:l,availableIncomingBitrate:h,totalPacketsLost:o},n.receivers.forEach((function(e){e.rtt=p}))}}return n}},{key:"getAudioLevelList",value:function(e){var t=this,n=[],r=Object.keys(e);return r.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(r){var i=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidSender(i)){var o=i.trackId;if("video"!==i.mediaType){var s=t.getResourceIdByParseSdp(i),a=e[o];n.push({trackId:s,audioLevel:a||0===a?Ru(a):null})}}})),r.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(r){var i=e[r];if("unified-plan"!==t._sdpSemantics||t.isValidReceiver(i)){var o=i.trackId,s=i.mediaType;if(o&&"video"!==s){var a=e[o].audioLevel,c=t.getResourceIdByParseSdp(i);n.push({trackId:c,audioLevel:a||0===a?Ru(a):null})}}})),n}}]),n}(Tu),ku=function(){function e(t){_(this,e),this._peer=t,this._outboundStreams={}}return R(e,[{key:"getOutboundVideoInfo",value:function(){var e=[];for(var t in this._outboundStreams){var n=this._outboundStreams[t].getVideoTracks()[0];if(n){var r=/_tiny$/.test(t),i=Yc(n),o=i.width,s=i.height;e.push({trackId:n.id,simulcast:r?lu.TINY:lu.NORMAL,resolution:"".concat(o,"x").concat(s)})}}return e}},{key:"setRemoteAnswer",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=e.replace(/\s+\r\n/g,"\r\n"),t.prev=1,t.next=4,this._peer.setRemoteDescription({type:"answer",sdp:e});case 4:t.next=9;break;case 6:return t.prev=6,t.t0=t.catch(1),t.abrupt("return",(ea.error(t.t0),Zs.SET_REMOTE_DESCRIPTION_FAILED));case 9:return t.abrupt("return",Zs.SUCCESS);case 10:case"end":return t.stop()}}),t,this,[[1,6]])})))}},{key:"getStatParsr",value:function(e,t){return/chrome/i.test(ru.browser)?new Su(e,t):/Firefox/i.test(ru.browser)?new Iu(e,t):/Safari/i.test(ru.browser)?new bu(e,t):null}}],[{key:"setSdpSemantics",value:function(e){var t=ru.browser,n=ru.version;ru.supportsUnifiedPlan?/chrome/i.test(t)?this._sdpSemantics=n>92?"unified-plan":n<72?"plan-b":e:/firefox/i.test(t)?this._sdpSemantics="unified-plan":/safari/i.test(t)?this._sdpSemantics=n<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan":this._sdpSemantics="plan-b"}},{key:"getSdpSemantics",value:function(){return e._sdpSemantics}}]),e}(),wu=function(e){d(n,e);var t=h(n);function n(){var e;return _(this,n),(e=t.apply(this,arguments)).senders={},e._localTracks=[],e}return R(n,[{key:"addLocalTrack",value:function(e){this._localTracks.includes(e)||this._localTracks.push(e);var t=e.getStreamId(),n=e.__innerGetMediaStreamTrack(),r=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);r.getTracks().forEach((function(e){e.kind===n.kind&&r.removeTrack(e)})),r.addTrack(n);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(n):this.senders[i]=this._peer.addTrack(n,r)}},{key:"removeLocalTrack",value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var n=e.getTrackId(),r=this.senders[n];r&&(r.replaceTrack(null),this._peer.removeTrack(r),delete this.senders[n])}},{key:"updateSubRemoteTracks",value:function(e){}},{key:"updateRecvTransceiverMap",value:function(e,t){}},{key:"setBitrate",value:function(e,t,n){this._maxBitrate=e,this._minBitrate=t,this._startBitrate=n||.7*e}},{key:"createOffer",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 2:for(r in n=t.sent,this._outboundStreams)i=this._outboundStreams[r].id,n.sdp=n.sdp.replace(new RegExp(i,"g"),r);return t.next=6,this._peer.setLocalDescription(n);case 6:return t.abrupt("return",{type:"offer",semantics:"plan-b",sdp:n.sdp});case 7:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){var t=0,r=0;this._localTracks.forEach((function(e){var n=e.getBitrate(),i=n.min,o=n.max;r+=i,t+=o})),t=this._maxBitrate&&this._maxBitrate>0?Math.min(t,this._maxBitrate):t,r=this._minBitrate&&this._minBitrate>0?Math.max(r,this._minBitrate):r;var i=this._startBitrate||Math.round(.7*t),o="b=AS:".concat(t);e=e.replace(/[\r\n]+m=video[^\r\n]+/,(function(e){return"".concat(e,"\r\n").concat(o)}));var s=[";x-google-min-bitrate=".concat(r),";x-google-max-bitrate=".concat(t),";x-google-start-bitrate=".concat(i)].join("");return e=e.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,(function(e){return e+s})),c(m(n.prototype),"setRemoteAnswer",this).call(this,e)}}]),n}(ku),Ou=function(e){d(n,e);var t=h(n);function n(){var e;return _(this,n),(e=t.apply(this,arguments))._sendTransceiver={},e._localTracks={},e._recvAudio=[],e._recvVideo=[],e._recvTransceiver={},e._subedTracks=[],e}return R(n,[{key:"setBitrate",value:function(e,t,n){ea.warn("the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}},{key:"addLocalTrack",value:function(e){var t=e.getTrackId(),n=e.getStreamId(),r=e.__innerGetMediaStreamTrack();this._localTracks[t]=e;var i=this._outboundStreams[n]||(this._outboundStreams[n]=new MediaStream);i.getTracks().forEach((function(e){e.kind===r.kind&&i.removeTrack(e)})),i.addTrack(r);var o=this._sendTransceiver[t];o?(o.sender.replaceTrack(r),o.direction="sendonly"):this._sendTransceiver[t]=this._peer.addTransceiver(r,{direction:"sendonly",streams:[i]})}},{key:"removeLocalTrack",value:function(e){var t=e.getTrackId(),n=e.getStreamId();e.__innerGetMediaStreamTrack(),delete this._localTracks[t];var r=this._sendTransceiver[t];if(r){r.direction="inactive",this._peer.removeTrack(r.sender),r.sender.replaceTrack(null);var i=this._outboundStreams[n];(e.isAudioTrack()?i.getAudioTracks():i.getVideoTracks()).forEach((function(e){return i.removeTrack(e)}));var o=this._sendTransceiver["".concat(t,"_tiny")];if(o&&"inactive"!==o.direction){o.direction="inactive";var s=o.sender,a=s.track;this._peer.removeTrack(s),s.replaceTrack(null),this._outboundStreams["".concat(n,"_tiny")].removeTrack(a),a.stop()}}}},{key:"updateRecvTransceiverMap",value:function(e,t){var n=zc(e).mediaType;this._recvTransceiver[e]=t;var r=n===vc.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=r.findIndex((function(e){return e===t}));i>=0&&r.splice(i,1)}},{key:"updateSubRemoteTracks",value:function(e){var t=this,n=e.slice(),r=this._subedTracks.slice();this._subedTracks=e.slice();for(var i=function(e){var t=n[e],i=r.findIndex((function(e){return e===t}));i>=0&&(n.splice(e,1),r.splice(i,1))},o=n.length-1;o>=0;o-=1)i(o);r.length&&r.forEach((function(e){var n=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var r=t._recvTransceiver[n];r&&(r.direction="inactive")}));var s={audio:0,video:0};n.length&&n.forEach((function(e){var n=e.isAudioTrack()?"audio":"video",r=t._recvTransceiver[e.getTrackId()];r?r.direction="recvonly":s[n]+=1}));for(var a=this._recvAudio.length;a<s.audio;a+=1)this._recvAudio.push(this._peer.addTransceiver("audio",{direction:"recvonly"}));for(var c=this._recvVideo.length;c<s.video;c+=1)this._recvVideo.push(this._peer.addTransceiver("video",{direction:"recvonly"}))}},{key:"createOffer",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._peer.createOffer({iceRestart:e});case 2:for(i in n=t.sent,r=n.sdp,this._outboundStreams)o=this._outboundStreams[i].id,r=r.replace(new RegExp(o,"g"),i);return r=function(e){return e.split(/\r\n(?=m=)/).map((function(e){return function(e){return/a=(recvonly|inactive)/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/g,""):e}(e)})).join("\r\n")}(r),r=r.replace(/a=ice-options:trickle/g,"a=ice-options:trickle\r\na=ice-options:renomination"),n.sdp=r,t.next=10,this._peer.setLocalDescription(n);case 10:return t.abrupt("return",{type:"offer",semantics:"unified-plan",sdp:r});case 11:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){var t=this;e=e.split(/\r\n(?=m=)/).map((function(e){var n,r=e.match(/a=mid:[^\s]+/);if(!r)return e;var i=r[0].replace("a=mid:",""),o="";for(var s in t._sendTransceiver)if(t._sendTransceiver[s].mid===i){o=s;break}if(!o)return e;var a=null===(n=t._localTracks[o])||void 0===n?void 0:n.getBitrate();if(!a)return e;var c=a.max,u=a.min,d=c&&c>0?a.start||.7*c:0,l=[];if(c&&c>0&&l.push(";x-google-max-bitrate=".concat(c)),u&&u>0&&l.push(";x-google-min-bitrate=".concat(u)),d>0&&l.push(";x-google-start-bitrate=".concat(d)),0===l.length)return e;var h=l.join("");return e.replace(/[\r\n]+[^\r\n]+profile-level-id[^\r\n]+/g,(function(e){return e+h}))})).join("\r\n");var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(e)&&(ea.warn("answer sdp invalid -> ".concat(JSON.stringify(e))),e=e.replace(r,"\r\n")),c(m(n.prototype),"setRemoteAnswer",this).call(this,e)}}]),n}(ku),Nu=function(e){d(n,e);var t=h(n);function n(e,r){var i;_(this,n),(i=t.call(this))._reTryExchange=e,i._polarisReport=r,i.pubLocalTracks={},i._reTryExchangeTimer=null,i._reportStatsTimer=null,i._reportListener=null;var o=ku.getSdpSemantics(),s=i._rtcPeerConn=new RTCPeerConnection({sdpSemantics:o});return i._sdpStrategy="plan-b"===o?new wu(s):new Ou(s),i._rtcPeerConn.oniceconnectionstatechange=i._onICEConnectionStateChange.bind(f(i)),i._rtcPeerConn.onconnectionstatechange=i._onConnectionStateChange.bind(f(i)),i._rtcPeerConn.ontrack=i._onTrackReady.bind(f(i)),i.reportParser=i._sdpStrategy.getStatParsr(i._rtcPeerConn,o),i}return R(n,[{key:"getLocalTracks",value:function(){return Object.values(this.pubLocalTracks)}},{key:"_onConnectionStateChange",value:function(){ea.info("onconnectionstatechange -> ".concat(this._rtcPeerConn.connectionState))}},{key:"_onICEConnectionStateChange",value:function(){var e,t;ea.info("oniceconnectionstatechange -> ".concat(this._rtcPeerConn.iceConnectionState)),"connected"===this._rtcPeerConn.iceConnectionState&&(this._reportStatsTimer&&clearInterval(this._reportStatsTimer),this._reportStatsTimer=setInterval(this._reportHandle.bind(this),1e3)),"failed"!==this._rtcPeerConn.iceConnectionState&&"disconnected"!==this._rtcPeerConn.iceConnectionState||(ea.warn("iceconenction state is `failed`, exchange SDP to try again."),this._reTryExchange(),this._reTryExchangeTimer=setInterval(this._reTryExchange,15e3));try{null===(t=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===t||t.call(e,this._rtcPeerConn.iceConnectionState)}catch(e){ea.error("onICEConnectionStateChange error",e)}}},{key:"_onTrackReady",value:function(e){if(e.streams.length){var t=[e.streams[0].id,"audio"===e.receiver.track.kind?vc.AUDIO_ONLY:vc.VIDEO_ONLY].join("_");this._updateRecvTransceiverMap(t,e.transceiver),this.emit(n.__INNER_EVENT_TRACK_READY__,e)}}},{key:"setBitrate",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this._sdpStrategy.setBitrate(e,t,n);case 1:case"end":return r.stop()}}),r,this)})))}},{key:"createOffer",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._sdpStrategy.createOffer(e);case 2:return n=t.sent,t.abrupt("return",(ea.debug("offer -> ".concat(JSON.stringify(n.sdp))),n));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"setRemoteAnswer",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(ea.debug("answer -> ".concat(JSON.stringify(e))),this._sdpStrategy.setRemoteAnswer(e)));case 1:case"end":return t.stop()}}),t,this)})))}},{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(wc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(wc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(wc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(wc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}},{key:"removeLocalTrackById",value:function(e){var t=this.getLocalTrack(e);t&&this.removeLocalTrack(t)}},{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=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(wc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(wc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var n="".concat(t,"_tiny"),r=this.getLocalTrack(n);r&&(this._sdpStrategy.removeLocalTrack(r),delete this.pubLocalTracks[n],r.destroy())}},{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){var t=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));t&&(t.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(wc.__INNER_EVENT_MUTED_CHANGE__,e)}},{key:"_onLocalTrackDestroied",value:function(e){this.emit(wc.__INNER_EVENT_DESTROY__,e)}},{key:"registerReportListener",value:function(e){this._reportListener=e}},{key:"_createRCRTCStateReport",value:function(e){var t=JSON.parse(JSON.stringify(e)),n=t.timestamp,r=t.iceCandidatePair,i=t.senders,o=t.receivers;for(var s in null==r||delete r.totalPacketsLost,r)cu(r[s])&&delete r[s];return{timestamp:n,iceCandidatePair:r,senders:i.map((function(e){var t={};return e.trackId&&(t.trackId=e.trackId),e.kind&&(t.kind=e.kind),(e.packetsLostRate||0===e.packetsLostRate)&&(t.packetsLostRate=e.packetsLostRate),t.remoteResource=e.remoteResource,(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),(e.bitrate||0===e.bitrate)&&(t.bitrate=e.bitrate),e.jitter&&(t.jitter=e.jitter),t})),receivers:o.map((function(e){var t={};return e.trackId&&(t.trackId=e.trackId),e.kind&&(t.kind=e.kind),(e.packetsLostRate||0===e.packetsLostRate)&&(t.packetsLostRate=e.packetsLostRate),t.remoteResource=e.remoteResource,(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),(e.bitrate||0===e.bitrate)&&(t.bitrate=e.bitrate),e.jitter&&(t.jitter=e.jitter),t}))}}},{key:"_getStatsData",value:function(){var e,t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._rtcPeerConn.getStats();case 2:return r=n.sent,i=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(r),n.abrupt("return",null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(i));case 5:case"end":return n.stop()}}),n,this)})))}},{key:"getAudioLevelReportData",value:function(){var e,t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._rtcPeerConn.getStats();case 2:if(r=n.sent,i=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(r)){n.next=6;break}return n.abrupt("return",[]);case 6:return n.abrupt("return",null===(t=this.reportParser)||void 0===t?void 0:t.getAudioLevelList(i));case 7:case"end":return n.stop()}}),n,this)})))}},{key:"_reportHandle",value:function(){var e,t,n;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._getStatsData();case 2:if(i=r.sent){r.next=5;break}return r.abrupt("return");case 5:(i.senders.length||i.receivers.length)&&(null===(e=this._polarisReport)||void 0===e||e.sendR3R4Data(i)),o=this._createRCRTCStateReport(i),null===(n=null===(t=this._reportListener)||void 0===t?void 0:t.onStateReport)||void 0===n||n.call(t,o);case 8:case"end":return r.stop()}}),r,this)})))}},{key:"getRTCPeerConn",value:function(){return this._rtcPeerConn}},{key:"destroy",value:function(){this.clear(),this.clearReTryExchangeTimer(),this._reportStatsTimer&&(clearInterval(this._reportStatsTimer),this._reportStatsTimer=null),this.registerReportListener(null),this._rtcPeerConn.close(),this.reportParser=null}},{key:"clearReTryExchangeTimer",value:function(){clearInterval(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}]),n}(Xe);Nu.__INNER_EVENT_TRACK_READY__="inner-track-ready",function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(pu||(pu={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(fu||(fu={}));var Au=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:fu.MeetingOrAnchor;_(this,e),this._context=t,this._runtime=n,this._roomId=r,this._crtRTCRoom=i,this._userRole=o}return R(e,[{key:"_send",value:function(e){this._context.getConnectionStatus()===it.CONNECTED&&this._context.setRTCState(this._roomId,e)}},{key:"_getClientID",value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=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=e.replace(/-/g,"")+"0",e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.join("")}(e=parseInt(e,16)),e.length>22&&(e=e.slice(0,22)),e}(),this._runtime.localStorage.setItem(e,t)),t}},{key:"_getRealResourceId",value:function(e){var t=e,n=e.indexOf("_tiny");return n>-1&&(t=e.slice(0,n)),t}},{key:"_getPolarisTrackId",value:function(e){var t="",n=e.split("_");if(e.includes("_tiny")){var r=n.pop(),i=parseInt(n.pop())===vc.AUDIO_ONLY?"audio":"video",o=n.pop();t=[n.join("_"),o,r,i].join("_")}else{var s=parseInt(n.pop())===vc.AUDIO_ONLY?"audio":"video",a=n.pop();t=[n.join("_"),a,s].join("_")}return t}},{key:"sendR3R4Data",value:function(e){var t=this,n=e.iceCandidatePair,r=e.senders,i=e.receivers,o=(null==n?void 0:n.bitrateSend)||-1,s=(null==n?void 0:n.bitrateRecv)||-1,a=(null==n?void 0:n.networkType)||"unknown",c=(null==n?void 0:n.rtt)||-1,u="".concat((null==n?void 0:n.IP)||-1,":").concat(null==n?void 0:n.port),d=(null==n||n.remoteIP,null==n||n.remotePort,(null==n?void 0:n.availableIncomingBitrate)||-1),l=(null==n?void 0:n.availableOutgoingBitrate)||-1,h=(null==n?void 0:n.totalPacketsLost)||-1,p=this._context.getCurrentId(),f="R3\t".concat(o,"\t-1\t-1\t-1\t").concat(a,"\t").concat(c,"\t").concat(u,"\t").concat(d,"\t").concat(l,"\t").concat(h,"\t").concat(p,"\r"),g="R4\t".concat(s,"\t-1\t-1\t-1\t").concat(a,"\t").concat(c,"\t").concat(u,"\t").concat(d,"\t").concat(l,"\t").concat(h,"\t").concat(p,"\r"),m=r.map((function(e){var n,r=e.trackId,i=e.audioLevel,o=e.samplingRate,s=e.bitrate,a=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,d=e.frameHeight,l=e.googRenderDelayMs,h=e.jitter,p=e.nackCount,f=e.pliCount,g=e.rtt,m=e.googFirsSent,v=e.encoderImplementation,_=t._getPolarisTrackId(r),y=t._getRealResourceId(r);return{trackId:_,googCodecName:v||String(-1),audioLevel:i||0===i?i:-1,bitrate:s||0===s?s:-1,packetsLostRate:a||0===a?a:-1,frameRate:c||-1,resolution:u&&d?"".concat(u," * ").concat(d):"-1",jitter:h||-1,nackCount:p||0===p?p:-1,pliCount:f||0===f?f:-1,rtt:g||-1,googFirsSent:m,samplingRate:o,googRenderDelayMs:l,encoderImplementation:v||String(-1),trackState:(null===(n=t._crtRTCRoom.getLocalTrack(y))||void 0===n?void 0:n.isLocalMuted())?pu.DISABLE:pu.ENABLE}})),v=i.filter((function(e){return!!e.trackId})).map((function(e){var n,r=e.trackId,i=e.audioLevel,o=e.samplingRate,s=e.bitrate,a=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,d=e.frameHeight,l=e.googRenderDelayMs,h=e.jitter,p=e.nackCount,f=e.pliCount,g=e.rtt,m=e.googFirsReceived,v=e.codecImplementationName,_=t._getPolarisTrackId(r),y=t._getRealResourceId(r);return{trackId:_,googCodecName:v||String(-1),audioLevel:i||0===i?i:-1,bitrate:s||0===s?s:-1,packetsLostRate:a||0===a?a:-1,frameRate:c||-1,resolution:u&&d?"".concat(u," * ").concat(d):"-1",jitter:h||-1,nackCount:p||0===p?p:-1,pliCount:f||0===f?f:-1,rtt:g||-1,googFirsReceived:m,samplingRate:o,googRenderDelayMs:l,codecImplementationName:v||String(-1),trackState:(null===(n=t._crtRTCRoom.getRemoteTrack(y))||void 0===n?void 0:n.isLocalMuted())?pu.DISABLE:pu.ENABLE}}));f+=m.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"),e.senders.length&&this._send(f+"\r".concat(this._userRole)),g+=v.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"),e.receivers.length&&this._send(g+"\r".concat(this._userRole))}},{key:"sendR1",value:function(){var e="R1\t5.3.1\t".concat(this._context.getCoreVersion(),"\tweb\t").concat(navigator.platform,"\t-1\t").concat(ru.browser,"\t").concat(ru.version,"\t").concat(this._getClientID(),"\t").concat(this._userRole);this._send(e)}},{key:"sendR2",value:function(e,t,n){var r="R2\t".concat(e,"\t").concat(t,"\t").concat(this._getClientID(),"\r").concat(n.join("\t"),"\r").concat(this._userRole);this._send(r)}}]),e}();!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(gu||(gu={})),function(e){e.BEGIN="begin",e.END="end"}(mu||(mu={}));var Mu=function(){function e(t){_(this,e),this._room=t,this._audioLevelChangeHandler=null,this._timer=null,this._pc=this._room.__getPC()}return R(e,[{key:"_audioLevelReport",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("new"!==this._pc.getRTCPeerConn().iceConnectionState&&this._audioLevelChangeHandler){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._pc.getAudioLevelReportData();case 4:e.t0=function(e){var t=od.parseTrackId(e.trackId).userId;return{track:n._room.getCrtUserId()===t?n._room.getLocalTrack(e.trackId):n._room.getRemoteTrack(e.trackId),audioLevel:e.audioLevel||0}},e.t1=function(e){return e.track},t=e.sent.map(e.t0).filter(e.t1),this._audioLevelChangeHandler(t);case 8:case"end":return e.stop()}}),e,this)})))}},{key:"onAudioLevelChange",value:function(e,t){t<300||t>1e3?ea.error('the valid range of onAudioLevelChange params "gap" is: > 300 && < 1000'):e?(this._audioLevelChangeHandler=e,this._timer=setInterval(this._audioLevelReport.bind(this),t)):this._audioLevelChangeHandler=null}},{key:"clearAudioLevelReportTimer",value:function(){this._timer&&(clearInterval(this._timer),this._timer=null)}}]),e}();!function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(vu||(vu={}));var Pu,xu,Lu,Uu=function(e){return e instanceof kc?e.getTrackId():e.track.getTrackId()},Du=function(){function e(t,n,r,i,o,s,a,c,u,d){var l=this;_(this,e),this._context=t,this._runtime=n,this._roomId=r,this._roomMode=o,this._service=s,this._initOptions=a,this._ntfClearRoomItem=c,this._isMainRoom=d,this._remoteTracks={},this._subscribedList=[],this._destroyed=!1,this.msgTaskQueue=new ta,this._appListener=null,this._onRecvPKMsg=null,this._token=i.token,this._sessionId=i.sessionId,this._roomResources=u?{}:du(i),this._initRemoteTracks();var h=this._context.getCurrentId(),p=this._roomResources[h]=this._roomResources[h]||[];ea.debug("room data -> ".concat(JSON.stringify(this._roomResources))),p.length>0&&ra((function(){return l._unpublishPrev(p)})),u&&this._afterChangedRole(i),this._pinger=new hu(r,this._roomMode,t,this._initOptions.pingGap),this._pinger.onFailed=this._kickoff.bind(this),this._pinger.onPingResult=this._handlePingResult.bind(this),this._pinger.start(),this._polarisReport=new Au(this._context,this._runtime,this._roomId,this),this._polarisReport.sendR1(),this._pc=new Nu(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(Nu.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.on(wc.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),this._pc.on(wc.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this)}return R(e,[{key:"_initRemoteTracks",value:function(){var e=this,t=this._context.getCurrentId();for(var n in this._roomResources){var r=this._roomResources[n];n!==t&&0!==r.length&&r.forEach((function(t){var n=Wc(t),r=zc(n),i=r.tag,o=r.userId,s=r.mediaType===vc.AUDIO_ONLY?new Bc(i,o):new Fc(i,o);s.__innerSetRemoteMuted(0===t.state),e._remoteTracks[n]=s}))}}},{key:"_handlePingResult",value:function(e){this._callAppListener("onPing",e)}},{key:"setBitrate",value:function(e,t,n){ea.warn("`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),Jt("max",e,(function(e){return Ue(e)&&e>Math.max(t||1,200)}),!0),Jt("min",t,(function(t){return Ue(t)&&t>=1&&(!Ue(e)||t<e)}),!0),Jt("start",n,(function(n){return Ue(n)&&n>t&&n<=e})),this._pc.setBitrate(e,t,n)}},{key:"_onTrackReady",value:function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?vc.AUDIO_ONLY:vc.VIDEO_ONLY].join("_"),i=this._remoteTracks[r];i?(i.__innerSetMediaStreamTrack(n),this._callAppListener("onTrackReady",i)):ea.warn("cannot found remote track ".concat(n.id))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){ea.error(e)}}},{key:"_onUserUnpublish",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.unsubscribe(e);case 2:e.forEach((function(e){e.__innerDestroy(),delete n._remoteTracks[e.getTrackId()]})),this._onTrackUnpublish(e);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_onTrackUnpublish",value:function(e){this._callAppListener("onTrackUnpublish",e)}},{key:"_unpublishPrev",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.slice(),e.length=0,ea.info("unpublish uris prev login: ".concat(JSON.stringify(n))),t.next=4,this._context.setRTCTotalRes(this._roomId,jc(su.UNPUBLISH,n),Hc([]),su.TOTAL_CONTENT_RESOURCE,Hc([]));case 4:(r=t.sent)!==nt.SUCCESS?ea.error("unpublish prev uris failed -> code: ".concat(r)):ea.debug("unpublish uris prev login succeed");case 6:case"end":return t.stop()}}),t,this)})))}},{key:"__parseInnerMessage",value:function(e){var t=this,n=e.targetId;if(e.conversationType!==Ne.RTC_ROOM)return!1;if(n!==this._roomId)return!0;ea.info("recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId));var r=e.content;switch(e.messageType){case su.KICK:this._kickoff(!0,r);break;case su.STATE:this.msgTaskQueue.push((function(){return t._stateHandle(r)}));break;case su.MODIFY:case su.PUBLISH:case su.UNPUBLISH:case su.TOTAL_CONTENT_RESOURCE:this.msgTaskQueue.push((function(){return t._resourceHandle(r,e.messageType,e.senderUserId)}));break;case su.ROOM_NOTIFY:this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case su.USER_NOTIFY:ea.warn("TODO: ".concat(su.USER_NOTIFY));break;case su.PK_INVITE:case su.PK_CANCEL_INVITE:case su.PK_INVITE_TIMEOUT:case su.PK_INVITE_ANSWER:case su.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case su.OTHER_ROOM_OFFLINE:break;default:this._callAppListener("onMessageReceive",e.messageType,e.content,e.senderUserId,e.messageUId)}return!0}},{key:"_kickoff",value:function(e,t){var n,r=this;ea.warn("onKickOff -> byServer: ".concat(e)),this._ntfClearRoomItem(),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===r._context.getCurrentId()&&(n=e.type)})),this._callAppListener("onKickOff",e,n)}},{key:"_rtcpeerClosed",value:function(){this._ntfClearRoomItem(),this._leaveHandle(!0),this._callAppListener("onRTCPeerConnectionCloseByException")}},{key:"_resourceHandle",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,d,l,h,p,f,g,m,v,_,y,R,C,E,T,S,I,b,k=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",void ea.warn("room has been destroyed. -> roomId: ".concat(this._roomId)));case 2:if(i=e.uris,!e.ignore&&i){r.next=5;break}return r.abrupt("return");case 5:o=[],s=[],c=[],d=this._roomResources[n]||(this._roomResources[n]=[]),r.t0=t,r.next=r.t0===su.MODIFY?10:r.t0===su.PUBLISH?12:r.t0===su.UNPUBLISH?14:r.t0===su.TOTAL_CONTENT_RESOURCE?16:17;break;case 10:return c.push.apply(c,a(i)),r.abrupt("break",17);case 12:return o.push.apply(o,a(i)),r.abrupt("break",17);case 14:return s.push.apply(s,a(i)),r.abrupt("break",17);case 16:u=Zc(d,i),o.push.apply(o,a(u.publishedList)),s.push.apply(s,a(u.unpublishedList)),c.push.apply(c,a(u.modifiedList));case 17:if(!(o.length>0)){r.next=28;break}if(l=d.map(Wc),h=[],p=[],o.forEach((function(e){var t=Wc(e),n=l.indexOf(t),r=zc(t),i=r.userId,o=r.tag,s=r.mediaType;n>-1?d[n]=e:d.push(e);var a=k._remoteTracks[t];a?a.isSubscribed()&&h.push(a):(a=s===vc.AUDIO_ONLY?new Bc(o,i):new Fc(o,i),k._remoteTracks[t]=a,p.push(a)),a.__innerSetRemoteMuted(0===e.state)})),!h.length){r.next=27;break}return f=h.map((function(e){return e.getTrackId()})),ea.debug("resub tracks -> ".concat(JSON.stringify(f))),r.next=24,ra((function(){return k.__subscribe(h,!0)}));case 24:g=r.sent,(m=g.code)!==Zs.SUCCESS&&ea.error("resub tracks failed -> code: ".concat(m,", ids: ").concat(JSON.stringify(f)));case 27:this._onTrackPublish(p);case 28:if(!(s.length>0)){r.next=34;break}for(v=s.map(Wc),_=d.length-1;_>=0;_-=1)y=d[_],v.includes(Wc(y))&&d.splice(_,1);return R=s.map((function(e){var t=Wc(e);return k._remoteTracks[t]})),r.next=34,this._onUserUnpublish(R);case 34:if(c.length>0)for(C=d.map(Wc),E=0;E<c.length;E+=1)T=c[E],S=Wc(T),I=C.indexOf(S),d[I].state=T.state,(b=this._remoteTracks[S]).__innerSetRemoteMuted(0===T.state),b.isAudioTrack()?this._onAudioMuteChange(b):this._onVideoMuteChange(b);case 35:case"end":return r.stop()}}),r,this)})))}},{key:"_onTrackPublish",value:function(e){this._callAppListener("onTrackPublish",e)}},{key:"_stateHandle",value:function(e){var t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,c,u,d,l,h,p=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(0!==(r=e.users).length){n.next=3;break}return n.abrupt("return");case 3:if(i=[],o=[],s=[],c=[],r.forEach((function(e){0==+e.state?(ea.debug("user joined -> ".concat(e.userId)),p._roomResources[e.userId]||(e.switchRoleType?s.push(e.userId):i.push(e.userId)),p._roomResources[e.userId]=p._roomResources[e.userId]||[]):(ea.debug("user left -> ".concat(e.userId)),e.switchRoleType?c.push(e.userId):o.push(e.userId))})),u=[].concat(i,s),!(d=[].concat(o,c)).length){n.next=15;break}if(l=[],h=[],d.forEach((function(e){l.push.apply(l,a(p.getRemoteTracksByUserId(e))),h.push(e)})),n.t0=l.length,!n.t0){n.next=14;break}return n.next=13,this.unsubscribe(l);case 13:l.forEach((function(e){return delete p._remoteTracks[e.getTrackId()]}));case 14:h.length&&h.forEach((function(e){return delete p._roomResources[e]}));case 15:if(!(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)){n.next=17;break}return n.abrupt("return",(s.length&&s.forEach((function(e){return p._callAppListener("onSwitchRole",e,vu.ANCHOR)})),c.length&&c.forEach((function(e){return p._callAppListener("onSwitchRole",e,vu.AUDIENCE)})),i.length&&this._callAppListener("onUserJoin",i),void(o.length&&this._callAppListener("onUserLeave",o))));case 17:u.length&&this._callAppListener("onUserJoin",u),d.length&&this._callAppListener("onUserLeave",d);case 18:case"end":return n.stop()}}),n,this)})))}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"__getPC",value:function(){return this._pc}},{key:"getRemoteUserIds",value:function(){var e=this._context.getCurrentId();return Object.keys(this._roomResources).filter((function(t){return t!==e}))}},{key:"getRemoteTracks",value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(n){t.push.apply(t,a(e.getRemoteTracksByUserId(n)))})),t}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"sendMessage",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._context.sendMessage(Ne.RTC_ROOM,this._roomId,{messageType:e,content:t,isStatusMessage:!0});case 2:return r=n.sent,i=r.code,n.abrupt("return",i!==nt.SUCCESS?(ea.error("send message failed -> code: ".concat(i)),{code:Zs.SIGNAL_ERROR}):{code:Zs.SUCCESS});case 5:case"end":return n.stop()}}),n,this)})))}},{key:"setRoomAttribute",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._context.setRTCData(this._roomId,e,t,r,Mt.ROOM,n);case 2:return o=i.sent,i.abrupt("return",o!==nt.SUCCESS?(ea.error("SetRoomAttributeValue Failed: ".concat(o)),{code:Zs.SIGNAL_ERROR}):{code:Zs.SUCCESS});case 4:case"end":return i.stop()}}),i,this)})))}},{key:"deleteRoomAttributes",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._context.removeRTCData(this._roomId,e,n,Mt.ROOM,t);case 2:return i=r.sent,r.abrupt("return",i!==nt.SUCCESS?(ea.error("DeleteRoomAttribute Failed: ".concat(i)),{code:Zs.SIGNAL_ERROR}):{code:Zs.SUCCESS});case 4:case"end":return r.stop()}}),r,this)})))}},{key:"getRoomAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._context.getRTCData(this._roomId,e,t,Mt.ROOM);case 2:return r=n.sent,i=r.code,o=r.data,n.abrupt("return",i!==nt.SUCCESS?(ea.error("GetRoomAttributes Failed: ".concat(i)),{code:Zs.SIGNAL_ERROR}):{code:Zs.SUCCESS,data:o});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"_setUserAttributeValue",value:function(e,t,n){return this._context.setRTCData(this._roomId,e,t,!1,Mt.PERSON,n)}},{key:"_deleteUserAttributes",value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Mt.PERSON,t)}},{key:"_getUserAttributes",value:function(e){return this._context.getRTCData(this._roomId,e,!1,Mt.PERSON)}},{key:"isDestroyed",value:function(){return this._destroyed}},{key:"__destroy",value:function(e){return this._leaveHandle(e)}},{key:"_leaveHandle",value:function(e){var t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=this._destroyed,n.t0){n.next=18;break}if(this._destroyed=!0,null===(t=this._audioLevelReport)||void 0===t||t.clearAudioLevelReportTimer(),n.t1=e,!n.t1){n.next=8;break}return n.next=8,this._context.quitRTCRoom(this._roomId);case 8:if(this._isMainRoom&&this._quitAllPKRoom(),this._pc.removeAllLocalTrack(),this._pinger.stop(),n.t2=this._isMainRoom,!n.t2){n.next=15;break}return n.next=15,this._service.exit(this._getRTCReqestHeaders());case 15:this._pc.destroy(),this._polarisReport=null,this._removeRemoteTracks();case 18:case"end":return n.stop()}}),n,this)})))}},{key:"_onLocalTrackDestroied",value:function(e){e instanceof Nc&&e.__isTiny()||this.unpublish([e])}},{key:"_onLocalTrackMuted",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.getTrackId(),r=this._context.getCurrentId(),i=[{resourceId:n,enabled:!e.isLocalMuted()}],o=this._roomResources[r]||[],s=[],a=function(e){var t=o[e],n=Wc(t),r=i.findIndex((function(e){return e.resourceId===n}));if(r>=0){var a=i[r].enabled;return t.state=a?1:0,s.push(t),"break"}},c=0;case 3:if(!(c<o.length)){t.next=10;break}if("break"!==a(c)){t.next=7;break}return t.abrupt("break",10);case 7:c+=1,t.next=3;break;case 10:return t.next=12,ra((function(){return d._context.setRTCTotalRes(d._roomId,jc(su.MODIFY,s),Hc(o),su.TOTAL_CONTENT_RESOURCE)}));case 12:(u=t.sent)!==nt.SUCCESS&&ea.error("notice `track.enabled` change failed -> code: "+u);case 14:case"end":return t.stop()}}),t,this)})))}},{key:"_removePubFailedTracks",value:function(e){var t=this;e.forEach((function(e){var n=e instanceof wc?e:e.track;ea.debug("remove pub failed track from peerconnection -> trackId: ".concat(n.getTrackId())),t._pc.removeLocalTrackById(n.getTrackId())}))}},{key:"publish",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n.__publish(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__publish",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d,l,h,p,f,g,m,v,_,y,R,C=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._isMainRoom||!(this instanceof Wu)){t.next=2;break}return t.abrupt("return",(ea.error("the `publish` is disabled in PK room "),{code:Zs.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(!this._assertRoomDestroyed()){t.next=4;break}return t.abrupt("return",(ea.error("publish failed, room has been destroyed. -> roomId: ".concat(this._roomId)),{code:Zs.ROOM_HAS_BEEN_DESTROYED}));case 4:if(Wt("tracks",e,(function(){return De(e)&&e.length>0&&e.every((function(e){return e instanceof wc||e.track instanceof wc}))}),!0)){t.next=6;break}return t.abrupt("return",(ea.error("publish failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:Zs.PARAMS_ERROR}));case 6:if(n=this._context.getCurrentId(),!(this._pc.getLocalTracks().length+function(e){var t=0;return e.forEach((function(e){e instanceof wc?t++:e.pubTiny&&e.track.isVideoTrack()?t+=2:t++})),t}(e)>10)){t.next=9;break}return t.abrupt("return",(ea.error("publish failed, tracks limit exceeded -> roomId: ".concat(this._roomId)),{code:Zs.PUBLISH_TRACK_LIMIT_EXCEEDED}));case 9:return ea.debug("publish tracks -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Uu))),e.forEach((function(e){var t=e instanceof wc?{pubTiny:!1,track:e}:e,n=t.track,r=t.pubTiny;if(C._pc.addLocalTrack(n),n.isVideoTrack()&&r){var i;try{i=n.__innerGetMediaStreamTrack().clone();var o=r.frameRate||gc.FPS_15,s=r.resolution||mc.W176_H144,a=$c(s),c=a.width,u=a.height,d=nu(o);i.applyConstraints({width:c,height:u,frameRate:d})}catch(r){return null==i||i.stop(),void ea.warn("pubTiny failed -> id: ".concat(n.getTrackId(),", msg: ").concat(r.message))}C._pc.addLocalTrack(new Nc(n.getTag(),n.getUserId(),i,!0))}})),this._pc.clearReTryExchangeTimer(),t.next=12,this._createExchangeParams(this._subscribedList,!1);case 12:return r=t.sent,(i=this._getPushOtherRoomsParams())&&(r.pushOtherRooms=i),t.next=17,this._exchangeHandle(r);case 17:if((o=t.sent).code===Zs.SUCCESS){t.next=20;break}return t.abrupt("return",(ea.error("publish failed -> roomId: ".concat(this._roomId,", code: ").concat(o.code)),this._removePubFailedTracks(e),{code:o.code}));case 20:if(s=o.data,a=s.publishList,c=s.sdp,u=s.resultCode,d=s.message,l=s.urls,h=s.mcuPublishList,u===Zs.SUCCESS){t.next=23;break}return t.abrupt("return",(ea.error("publish failed -> roomId: ".concat(this._roomId,", code: ").concat(u,", msg: ").concat(d)),this._removePubFailedTracks(e),{code:u}));case 23:return t.next=25,this._pc.setRemoteAnswer(c.sdp);case 25:if((p=t.sent)===Zs.SUCCESS){t.next=28;break}return t.abrupt("return",{code:p});case 28:return f=this._roomResources[n],g=a.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:C._getResourceState(Wc(e))},e)})),m=Zc(f,g),v=m.publishedList,_=(null==h?void 0:h.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)})))||[],t.next=35,this._context.setRTCTotalRes(this._roomId,jc(su.PUBLISH,v),Hc(g),su.TOTAL_CONTENT_RESOURCE,Hc(_));case 35:if((y=t.sent)===nt.SUCCESS){t.next=38;break}return t.abrupt("return",(ea.error("send publish streams notification failed: ".concat(y)),{code:Zs.SIGNAL_ERROR}));case 38:return this._roomResources[n]=g,R=v.map((function(e){return Wc(e)})),t.abrupt("return",(this._polarisReport&&this._polarisReport.sendR2(gu.PUBLISH,mu.BEGIN,R),e.forEach((function(e){(e instanceof wc?{track:e}:e).track.__innerSetPublished(!0)})),ea.debug("publish success: ".concat(R.join(","))),this._roomMode===wt.LIVE?{code:Zs.SUCCESS,liveUrl:null==l?void 0:l.liveUrl}:{code:Zs.SUCCESS}));case 41:case"end":return t.stop()}}),t,this)})))}},{key:"_getPushOtherRoomsParams",value:function(){if(this instanceof Wu){var e=this.getRoomPKHandler(),t=e.code,n=e.roomPKHandler,r=[];if(t===Zs.SUCCESS&&n){var i=n.getJoinedPKRooms();for(var o in i){var s=i[o].getSessionId(),a=n.getPKInfo(o);if(!a)return;var c=a.inviterUserAutoMix,u=a.inviteeUserAutoMix,d=a.inviterUserId,l=this._context.getCurrentId()===d;r.push({roomId:o,sessionId:s,autoMix:l?!!c:!!u})}}return r}}},{key:"_reTryExchange",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ra((function(){return Xs(t,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._createExchangeParams(this._subscribedList,!0);case 2:return t=e.sent,(n=this._getPushOtherRoomsParams())&&(t.pushOtherRooms=n),e.next=7,this._exchangeHandle(t);case 7:if((r=e.sent).code===Zs.SUCCESS){e.next=10;break}return e.abrupt("return",(ea.error("reTryExchange failed: ".concat(r.code)),{code:r.code}));case 10:if(i=r.data,o=i.sdp,(s=i.resultCode)===Zs.SUCCESS){e.next=13;break}return e.abrupt("return",(ea.error("reTryExchange failed: ".concat(s)),{code:s}));case 13:return this._pc.clearReTryExchangeTimer(),e.next=16,this._pc.setRemoteAnswer(o.sdp);case 16:return a=e.sent,e.abrupt("return",a!==Zs.SUCCESS?{code:a}:void 0);case 18:case"end":return e.stop()}}),e,this)})))}));case 1:case"end":return e.stop()}}),e)})))}},{key:"_exchangeHandle",value:function(e){return this._service.exchange(this._getRTCReqestHeaders(),e)}},{key:"_getRTCReqestHeaders",value:function(){return{"App-Key":this._context.getAppkey(),RoomId:this._roomId,Token:this._token,RoomType:this._roomMode,UserId:this._context.getCurrentId()}}},{key:"_createExchangeParams",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._pc.createOffer(t);case 2:return n.t0=n.sent,n.t1=JSON.stringify({resolutionInfo:this._pc.getOutboundVideoInfo()}),n.t2=e.filter((function(e){var t=e.track.getTrackId(),n=zc(t).userId;if(!r._roomResources[n])return!1;var i=r._roomResources[n].filter((function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)})).length;return i})).map((function(e){return{simulcast:e.subTiny?lu.TINY:lu.NORMAL,resolution:"",uri:r._getResourceById(e.track.getTrackId()).uri}})),n.t3=!1,n.abrupt("return",{sdp:n.t0,extend:n.t1,subscribeList:n.t2,switchstream:n.t3});case 7:case"end":return n.stop()}}),n,this)})))}},{key:"_getResourceState",value:function(e){var t;return(null===(t=this.getLocalTrack(e))||void 0===t?void 0:t.isLocalMuted())?0:1}},{key:"unpublish",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n.__unpublish(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unpublish",value:function(e){var t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l,h,p,f,g,m,v,_,y,R=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._isMainRoom||!(this instanceof Wu)){n.next=2;break}return n.abrupt("return",(ea.error("the `unpublish` is disabled in PK room "),{code:Zs.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(!this._assertRoomDestroyed()){n.next=4;break}return n.abrupt("return",(ea.warn("room has been destroyed, no need to unpublish tracks -> roomId: ".concat(this._roomId)),{code:Zs.SUCCESS}));case 4:if(r=this._context.getCurrentId(),Wt("tracks",e,(function(){return e.every((function(e){return e.getUserId()===r&&e instanceof wc}))}),!0)){n.next=7;break}return n.abrupt("return",(ea.warn("unpublish failed, tracks is invalid -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Uu))),{code:Zs.PARAMS_ERROR}));case 7:if(i=e.map((function(e){return e.getTrackId()})),o=i.map(this._getResourceById.bind(this)).filter((function(e){return!!e})),0!==o.length){n.next=10;break}return n.abrupt("return",{code:Zs.SUCCESS});case 10:return s=this._roomResources[r].filter((function(e){return!o.includes(e)})),i.forEach((function(e){return R._pc.removeLocalTrackById(e)})),null===(t=this._polarisReport)||void 0===t||t.sendR2(gu.PUBLISH,mu.END,i),this._pc.clearReTryExchangeTimer(),n.next=14,this._createExchangeParams(this._subscribedList,!1);case 14:return a=n.sent,(c=this._getPushOtherRoomsParams())&&(a.pushOtherRooms=c),n.next=19,this._exchangeHandle(a);case 19:if((u=n.sent).code===Zs.SUCCESS){n.next=22;break}return n.abrupt("return",(ea.error("exchange failed -> code: ".concat(u.code)),{code:u.code}));case 22:return d=u.data,l=d.publishList,h=d.sdp,p=d.resultCode,f=d.message,g=d.mcuPublishList,p!==Zs.SUCCESS&&ea.error("unpublish streams failed -> code: ".concat(p,", msg: ").concat(f)),m=g?g.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:1},e)})):[],n.next=27,this._context.setRTCTotalRes(this._roomId,jc(su.UNPUBLISH,o),Hc(s),su.TOTAL_CONTENT_RESOURCE,Hc(m));case 27:if((v=n.sent)===nt.SUCCESS){n.next=30;break}return n.abrupt("return",(ea.error("send unpublish notification failed:",v),{code:Zs.SIGNAL_ERROR}));case 30:return ea.debug("unpublish success -> tracks: ".concat(i.join(","))),n.next=33,this._pc.setRemoteAnswer(h.sdp);case 33:if((_=n.sent)===Zs.SUCCESS){n.next=36;break}return n.abrupt("return",{code:_});case 36:return y=l.map((function(e){return Object.assign({tag:e.msid.split("_").pop(),state:R._getResourceState(Wc(e))},e)})),n.abrupt("return",(this._roomResources[r]=y,{code:Zs.SUCCESS}));case 38:case"end":return n.stop()}}),n,this)})))}},{key:"_getResourceById",value:function(e){var t=zc(e).userId;return this._roomResources[t].find((function(t){return Wc(t)===e}))}},{key:"_isValidResourceId",value:function(e){var t,n=zc(e).userId;return!!(null===(t=this._roomResources[n])||void 0===t?void 0:t.find((function(t){return Wc(t)===e})))}},{key:"subscribe",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n.__subscribe(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__subscribe",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",(ea.error("subscribe failed, room has been destroyed -> roomId: ".concat(this._roomId)),{code:Zs.ROOM_HAS_BEEN_DESTROYED}));case 2:if(Wt("tracks",e,(function(){return De(e)&&e.length>0&&e.every((function(e){return e instanceof Vc||e.track instanceof Vc}))}),!0)){r.next=4;break}return r.abrupt("return",(ea.error("subscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:Zs.PARAMS_ERROR}));case 4:return ea.info("subscribe -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Uu))),i=this._subscribedList.map((function(e){return Object.assign({},e)})),o=e.map((function(e){return e instanceof Vc?{track:e}:e})),s=!1,a=[],r.abrupt("return",(o.forEach((function(e){var t=e.track.getTrackId();a.push(t);var n=i.find((function(e){return e.track.getTrackId()===t}));n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:i.push(e),s=!0)})),s||n?(null===(t=this._polarisReport)||void 0===t||t.sendR2(gu.SUBSCRIBE,mu.BEGIN,a),this._updateSubListHandle(i,!0)):{code:Zs.SUCCESS}));case 9:case"end":return r.stop()}}),r,this)})))}},{key:"unsubscribe",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n.__unsubscribe(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unsubscribe",value:function(e){var t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._assertRoomDestroyed()){n.next=2;break}return n.abrupt("return",(ea.warn("room has beed destroyed, no need to unsubscribe tracks -> roomId: ".concat(this._roomId)),{code:Zs.SUCCESS}));case 2:if(Wt("tracks",e,(function(){return De(e)&&e.length>0&&e.every((function(e){return e instanceof Vc}))}),!0)){n.next=4;break}return n.abrupt("return",(ea.error("unsubscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:Zs.PARAMS_ERROR}));case 4:return ea.info("unsubscribe -> roomId: ".concat(this._roomId,", tracks: ").concat(e.map(Uu))),r=this._subscribedList.map((function(e){return Object.assign({},e)})).filter((function(t){return!e.includes(t.track)})),n.abrupt("return",(null===(t=this._polarisReport)||void 0===t||t.sendR2(gu.SUBSCRIBE,mu.END,e.map((function(e){return e.getTrackId()}))),this._updateSubListHandle(r,!1)));case 7:case"end":return n.stop()}}),n,this)})))}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed){return ea.warn("This room has been destroyed. Please use `RCRTCClient.joinRTCRoom` or `RCRTCClient.joinLivingRoom` to catch another instance."),Zs.ROOM_HAS_BEEN_DESTROYED}}},{key:"getLocalTrack",value:function(e){return this._pc.getLocalTrack(e)}},{key:"getLocalTracks",value:function(){return this._pc.getLocalTracks()}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]||null}},{key:"updateSubList",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n._updateSubListHandle(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"_updateSubListHandle",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,c,u,d,l,h,p,f,g,m,v,_,y,R,C,E,T=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!this._assertRoomDestroyed()){n.next=2;break}return n.abrupt("return",{code:Zs.ROOM_HAS_BEEN_DESTROYED});case 2:if(Wt("resources",e,(function(){return De(e)&&e.every((function(e){return e instanceof Vc||e.track instanceof Vc}))}),!0)){n.next=4;break}return n.abrupt("return",(ea.error("update sublist failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:Zs.PARAMS_ERROR}));case 4:if(ea.info("update subscribe list -> roomId: ".concat(this._roomId,", forceReq: ").concat(t,", tracks: ").concat(e.map(Uu))),i=e.map((function(e){return e instanceof Vc?{track:e}:Object.assign({},e)})),o={},i=i.filter((function(e){var t=e.track.getTrackId();return T._remoteTracks[t]?!o[t]&&(o[t]=!0):(ea.warn("track cannot found in room -> trackId: ".concat(t)),!1)})).map((function(e){return Object.assign({},e)})),s=this._subscribedList.map((function(e){return Object.assign({},e)})),t){n.next=13;break}if(c=!1,i.forEach((function(e){var t=s.findIndex((function(t){return t.track===e.track}));-1!==t?s.splice(t,1)[0].subTiny!==e.subTiny&&(c=!0):c=!0})),s.length&&(c=!0),c){n.next=13;break}return n.abrupt("return",{code:Zs.SUCCESS});case 13:return this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(i.map((function(e){return e.track}))),n.next=16,this._createExchangeParams(i,!1);case 16:return u=n.sent,(d=this._getPushOtherRoomsParams())&&(u.pushOtherRooms=d),n.next=21,this._exchangeHandle(u);case 21:if(l=n.sent,h=i.map((function(e){return e.track.getTrackId()})),l.code===Zs.SUCCESS){n.next=25;break}return n.abrupt("return",{code:l.code});case 25:if(p=l.data,f=p.sdp,g=p.resultCode,p.message,m=p.subscribedList,g===Zs.SUCCESS){n.next=28;break}return n.abrupt("return",(ea.error("change subscribe list failed: ".concat(g)),{code:g}));case 28:return ea.debug("subscribe success: ".concat(h.join(","))),n.next=31,this._pc.setRemoteAnswer(f.sdp);case 31:if((v=n.sent)===Zs.SUCCESS){n.next=34;break}return n.abrupt("return",{code:v});case 34:for(E in _=null==m?void 0:m.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),y=i.filter((function(e){return null==_?void 0:_.includes(e.track.getTrackId())})),R=i.filter((function(e){return!(null==_?void 0:_.includes(e.track.getTrackId()))})),C=function(e){var t=y.some((function(t){return t.track.getTrackId()===e}));T._remoteTracks[e].__innerSetSubscribed(t)},this._remoteTracks)C(E);return n.abrupt("return",((r=this._subscribedList).splice.apply(r,[0,this._subscribedList.length].concat(a(y))),R.length?{code:Zs.SUCCESS,failedList:R}:{code:Zs.SUCCESS}));case 38:case"end":return n.stop()}}),n,this)})))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"registerReportListener",value:function(e){this._pc.registerReportListener(e)}},{key:"onAudioLevelChange",value:function(e,t){var n;null===(n=this._audioLevelReport)||void 0===n||n.clearAudioLevelReportTimer(),this._audioLevelReport=new Mu(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}},{key:"__onReconnected",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d,l,h,p,f,g,m,v,_,y,R,C,E,T,S=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("closed"!==this._pc.getRTCPeerConn().connectionState){t.next=2;break}return t.abrupt("return",(ea.warn("RTCPeerConnection closed. Please rejoin room to restore services."),void this._rtcpeerClosed()));case 2:return t.next=4,this._context.joinRTCRoom(this._roomId,this._roomMode,e);case 4:if(n=t.sent,r=n.code,i=n.data,r===nt.SUCCESS){t.next=9;break}return t.abrupt("return",void ea.error("RTC __onReconnected getRTCRoomInfo failed: ".concat(r)));case 9:ea.debug("RTC __onReconnected getRTCRoomInfo success: ".concat(JSON.stringify(i))),o=[],s={},a={},c={},u=du(i),d=Object.keys(u),l=Object.keys(this._roomResources),h=d.length-1;case 12:if(!(h>=0)){t.next=22;break}if(p=d[h],-1!==(f=l.indexOf(p))){t.next=17;break}return o.push(p),s[p]=Xc(u[p]),t.abrupt("continue",19);case 17:g=this._roomResources[p],m=u[p],v=Zc(g,m,!0),_=v.publishedList,y=v.modifiedList,R=v.unpublishedList,s[p]=Xc(_),a[p]=Xc(R),c[p]=Xc(y),l.splice(f,1);case 19:h-=1,t.next=12;break;case 22:l.length&&l.forEach((function(e){delete S._roomResources[e]})),Object.assign(this._roomResources,u),l.length&&this._callAppListener("onUserLeave",l),o.length&&this._callAppListener("onUserJoin",o),t.t0=regeneratorRuntime.keys(a);case 24:if((t.t1=t.t0()).done){t.next=33;break}if(C=t.t1.value,!(E=a[C]).length){t.next=31;break}return T=E.map((function(e){return S._remoteTracks[Wc(e)]})),t.next=31,this._onUserUnpublish(T);case 31:t.next=24;break;case 33:return t.abrupt("return",(Object.keys(s).forEach((function(e){var t=s[e];if(0!==t.length){var n=t.map((function(e){var t=Wc(e),n=zc(t),r=n.userId,i=n.tag,o=n.mediaType,s=S._remoteTracks[t]=o===vc.AUDIO_ONLY?new Bc(i,r):new Fc(i,r);return s.__innerSetRemoteMuted(0===e.state),s}));S._onTrackPublish(n)}})),Object.keys(c).forEach((function(e){c[e].forEach((function(e){var t=Wc(e),n=S._remoteTracks[t];n.__innerSetRemoteMuted(0===e.state),n.isAudioTrack()?S._onAudioMuteChange(n):S._onVideoMuteChange(n)}))})),{data:i}));case 34:case"end":return t.stop()}}),t,this)})))}},{key:"_onAudioMuteChange",value:function(e){this._callAppListener("onAudioMuteChange",e)}},{key:"_onVideoMuteChange",value:function(e){this._callAppListener("onVideoMuteChange",e)}},{key:"_afterChangedRole",value:function(e){}},{key:"_removeRemoteTracks",value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}},{key:"_registerPKMsgListener",value:function(e){this._onRecvPKMsg=e}},{key:"_quitAllPKRoom",value:function(){}}]),e}();!function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Pu||(Pu={})),function(e){e[e.CUSTOMIZE=1]="CUSTOMIZE",e[e.SUSPENSION=2]="SUSPENSION",e[e.ADAPTATION=3]="ADAPTATION"}(xu||(xu={})),function(e){e[e.CROP=1]="CROP",e[e.WHOLE=2]="WHOLE"}(Lu||(Lu={}));var Vu,Bu,Fu,ju,Hu=function(){return{version:1,mode:xu.SUSPENSION}},Ku=function(){function e(t,n,r){_(this,e),this._onFlush=t,this._isValidTrackId=n,this._sendCDNInfoSignal=r,this._values=Hu()}return R(e,[{key:"setHostVideoTrack",value:function(e){if(!this._isValidTrackId(e))return ea.error("setHostVideoTrack failed: videoTrackId is invalid -> ".concat(e)),this;var t=zc(e),n=t.mediaType,r=t.tag,i=t.userId;return n!==vc.VIDEO_ONLY?(ea.error("setHostVideoTrack failed: kind of resource is not 'video' -> ".concat(e)),this):(this._values.host_stream_id=Qc(i,r),this)}},{key:"setMixLayoutMode",value:function(e){return[xu.CUSTOMIZE,xu.SUSPENSION,xu.ADAPTATION].includes(e)?(this._values.mode=e,this):(ea.error("layout mode is invalid: ".concat(e)),this)}},{key:"_addOutputValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal",r=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var i=r.video;if("normal"!==n&&"tiny"!==n)if("backgroundColor"!==n)if("exparams"!==n){if("backgroundPicture"===n){var o=i.backgroundPicture||(i.backgroundPicture={fillMode:Pu.CROP,picture:[]});Object.assign(o,t)}}else i.exparams={renderMode:t};else i.backgroundColor=t;else{var s=i[n]||(i[n]={});Object.assign(s,t)}}else r.audio={bitrate:t};else r.cdn=t}},{key:"setOutputVideoResolution",value:function(e){if(!eu(e))return ea.warn("setOutputVideoResolution failed: `resolution` is invalid"),this;var t=$c(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"normal"),this}},{key:"setOutputVideoFPS",value:function(e){if(!tu(e))return ea.warn("setOutputVideoFPS failed: `fps` is invalid"),this;var t=nu(e);return this._addOutputValue("video",{fps:t},"normal"),this}},{key:"setOutputVideoBitrate",value:function(e){return!Ue(e)||e<=0?ea.error("bitrate is invalid: ".concat(e)):this._addOutputValue("video",{bitrate:e},"normal"),this}},{key:"setOutputTinyVideoResolution",value:function(e){if(!eu(e))return ea.warn("setOutputTinyVideoResolution failed: `resolution` is invalid"),this;var t=$c(e),n=t.width,r=t.height;return this._addOutputValue("video",{width:n,height:r},"tiny"),this}},{key:"setOutputTinyVideoFPS",value:function(e){if(!tu(e))return ea.warn("setOutputTinyVideoFPS failed: `fps` is invalid"),this;var t=nu(e);return this._addOutputValue("video",{fps:t},"tiny"),this}},{key:"setOutputTinyVideoBitrate",value:function(e){return!Ue(e)||e<=0?ea.error("bitrate is invalid: ".concat(e)):this._addOutputValue("video",{bitrate:e},"tiny"),this}},{key:"setOutputVideoRenderMode",value:function(e){return[Lu.CROP,Lu.WHOLE].includes(e)?this._addOutputValue("video",e,"exparams"):ea.error("renderMode is invalid: ".concat(e)),this}},{key:"setOutputAudioBitrate",value:function(e){return Ue(e)&&e>0?this._addOutputValue("audio",e):ea.error("bitrate is invalid: ".concat(e)),this}},{key:"setOutputBackgroundColor",value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?this._addOutputValue("video",e,"backgroundColor"):ea.error("color is invalid: ".concat(e)),this}},{key:"addOutputBackgroundPicture",value:function(e,t,n,r,i){var o,s,a;if(!qe(e))return ea.error("uri is invalid: ".concat(e)),this;if([t,n,r,i].some((function(e){return!Ue(e)||e<0||e>1})))return ea.error("some attrs of (x, y, w, h) is invalid: ".concat(t,", ").concat(n,", ").concat(r,", ").concat(i)),this;var c=(null===(a=null===(s=null===(o=this._values.output)||void 0===o?void 0:o.video)||void 0===s?void 0:s.backgroundPicture)||void 0===a?void 0:a.picture)||[];return c.push({uri:e,w:r,h:i,x:t,y:n}),this._addOutputValue("video",{picture:c},"backgroundPicture"),this}},{key:"removeOutputBackgroundPicture",value:function(e){var t,n,r;if(!qe(e))return ea.error("uri is invalid: ".concat(e)),this;var i=null===(r=null===(n=null===(t=this._values.output)||void 0===t?void 0:t.video)||void 0===n?void 0:n.backgroundPicture)||void 0===r?void 0:r.picture;return i&&(i=i.filter((function(t){return t.uri!==e})),this._addOutputValue("video",{pictures:i},"backgroundPicture")),this}},{key:"clearOutputBackgroundPicture",value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this}},{key:"setOutputBackgroundPictureFillMode",value:function(e){return[Pu.CROP,Pu.WHOLE].includes(e)?this._addOutputValue("video",{fillMode:e},"backgroundPicture"):ea.error("fillMode is invalid: ".concat(e)),this}},{key:"addPublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!De(e)||0===e.length||e.some((function(e){return!r.test(e)})))return ea.error("urls is invalid: ".concat(e)),this;var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=!1;return e.forEach((function(e){i.some((function(t){return t.pushurl===e}))||(o=!0,i.push({pushurl:e}))})),i.length>5?(ea.error("publish stream url no more than 5"),this):(o&&this._addOutputValue("cdn",i),this)}},{key:"removePublishStreamUrls",value:function(e){var t,n,r=/^rtmp:\/\/.+/;if(!De(e)||0===e.length||e.some((function(e){return!r.test(e)})))return ea.error("urls is invalid: ".concat(e)),this;for(var i=(null===(n=null===(t=this._values.output)||void 0===t?void 0:t.cdn)||void 0===n?void 0:n.concat())||[],o=i.length-1;o>=0;o-=1){var s=i[o].pushurl,a=e.indexOf(s);a>=0&&(e.splice(a,1),i.splice(o,1))}return this._addOutputValue("cdn",i),this}},{key:"clearPublishStreamUrls",value:function(){return this._addOutputValue("cdn",[]),this}},{key:"addCustomizeLayoutVideo",value:function(e,t,n,r,i){if(!this._isValidTrackId(e))return ea.error("trackId is invalid: ".concat(e)),this;if(!Ue(t)||!Ue(n))return ea.error("some attrs of (x, y) is invalid: ".concat(t,", ").concat(n)),this;if([r,i].some((function(e){return!Ue(e)||e<0})))return ea.error("some attrs of (width, height) is invalid: ".concat(r,", ").concat(i)),this;var o=zc(e),s=o.userId,a=o.tag;if(o.mediaType!==vc.VIDEO_ONLY)return ea.error("kind of resource is not 'video': ".concat(e)),this;var c=Qc(s,a);return(this._values.input||(this._values.input={video:[]})).video.push({user_id:s,stream_id:c,x:t,y:n,width:r,height:i}),this}},{key:"removeCustomizeLayoutVideo",value:function(e){if(!this._isValidTrackId(e))return ea.error("trackId is invalid: ".concat(e)),this;var t=zc(e),n=t.userId,r=t.tag;if(t.mediaType!==vc.VIDEO_ONLY)return ea.error("kind of resource is not 'video': ".concat(e)),this;var i=Qc(n,r),o=this._values.input||(this._values.input={video:[]});return o.video=o.video.filter((function(e){return e.stream_id===i})),this}},{key:"clearCustomizeLayoutVideo",value:function(){return(this._values.input||(this._values.input={video:[]})).video=[],this}},{key:"flush",value:function(){var e,t,n,r;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,s,a;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o=JSON.parse(JSON.stringify(this._values)),i.next=3,this._onFlush(o);case 3:return s=i.sent,a=s.code,i.abrupt("return",(a===Zs.SUCCESS&&((null===(t=null===(e=this._values.output)||void 0===e?void 0:e.video.normal)||void 0===t?void 0:t.width)||(null===(r=null===(n=this._values.output)||void 0===n?void 0:n.video.normal)||void 0===r?void 0:r.fps))&&this._sendCDNInfoSignal(),this._values=Hu(),{code:a}));case 6:case"end":return i.stop()}}),i,this)})))}}]),e}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(Vu||(Vu={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(Bu||(Bu={})),function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(Fu||(Fu={})),function(e){e[e.VIDEO=0]="VIDEO",e[e.AUDIO=1]="AUDIO"}(ju||(ju={}));var qu,Gu,Yu=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)}))},Ju=function(){function e(t,n,r,i,o,s,a,c){_(this,e),this._context=t,this._runtime=n,this._service=r,this._initOptions=i,this._mainLivingRoom=o,this._registerPKMsgListener=s,this._onJoinedPKRoom=a,this._onLeavePKRoom=c,this._inviteTimeout=30,this._PKInfo={},this._appListener=null,this._joinedPKRooms={},this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}return R(e,[{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){ea.error(e)}}},{key:"_onInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r=t.inviterUserId,i=t.extra,o={inviterRoomId:n,inviterUserId:r};i&&Object.assign(o,{extra:i}),this._PKInfo[n]=t,this._callAppListener("onRequestJoinOtherRoom",o)}},{key:"_onCancelInvite",value:function(e){var t=e.inviteInfo||{},n=t.inviterRoomId,r=t.inviterUserId,i=t.extra,o={inviterRoomId:n,inviterUserId:r};i&&Object.assign(o,{extra:i}),delete this._PKInfo[n],this._callAppListener("onCancelRequestOtherRoom",o)}},{key:"_onInviteTimeout",value:function(e){}},{key:"_onInviteAnswer",value:function(e){var t=e.answerCode,n=e.inviteContent,r=e.inviteeUserAutoMix,i=n.inviterUserId,o=n.inviterRoomId,s=n.inviteeUserId,a=n.inviteeRoomId,c=(n.extra,{agree:1===t,inviterRoomId:o,inviterUserId:i,inviteeRoomId:a,inviteeUserId:s});this._PKInfo[a].inviteeUserAutoMix=r,this._callAppListener("onResponseJoinOtherRoom",c)}},{key:"_onPKEnd",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviteInfo,r=n.inviteeRoomId,i=n.inviterRoomId,o=n.userId,s=i===this._mainRoomId?r:i,a={endRoomId:s,endUserId:o},t.next=3,this.leaveOtherRoom(this._joinedPKRooms[s]);case 3:delete this._PKInfo[s],this._callAppListener("onFinishOtherRoom",a);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"_onRecvPKMsg",value:function(e){e.targetId;var t=e.content;switch(e.messageType){case su.PK_INVITE:this._onInvite(t);break;case su.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case su.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case su.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case su.PK_END:this._onPKEnd(t)}}},{key:"registerRoomPKEventListener",value:function(e){this._appListener=e}},{key:"requestJoinOtherRoom",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a,c;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Wt("inviteeRoomId",e,Be,!0)&&Wt("inviteeUserId",t,Be,!0)){r.next=2;break}return r.abrupt("return",{code:Zs.PARAMS_ERROR});case 2:return ea.debug("requestRoomPK -> inviteeRoomId: ".concat(e,"; inviteeUserId: ").concat(t,"; options: ").concat(JSON.stringify(n||{}))),i=Yu(),o=!Le(null==n?void 0:n.autoMix)||(null==n?void 0:n.autoMix),s={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e,inviteeUserId:t,inviteeTimeoutTime:this._inviteTimeout,extra:(null==n?void 0:n.extra)||""},a={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(s),inviteSessionId:i},ea.debug("requestRoomPK -> params: ".concat(JSON.stringify(a))),r.next=7,this._context.requestRoomPK(a);case 7:return c=r.sent,r.abrupt("return",c!==nt.SUCCESS?(ea.error("requestRoomPK failed: ".concat(c)),{code:c}):(ea.debug("requestRoomPK success"),this._PKInfo[e]={inviteSessionId:i,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:o,inviteeRoomId:e},{code:Zs.SUCCESS}));case 9:case"end":return r.stop()}}),r,this)})))}},{key:"cancelRequestJoinOtherRoom",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Wt("inviteeRoomId",e,Be,!0)&&Wt("inviteeUserId",t,Be,!0)){r.next=2;break}return r.abrupt("return",{code:Zs.PARAMS_ERROR});case 2:if(this._PKInfo[e]){r.next=4;break}return r.abrupt("return",(ea.error("未发起过与 ".concat(e," 房间内 ").concat(t," 连麦的请求")),{code:Zs.PARAMS_ERROR}));case 4:return ea.debug("canceRequestJoinPK -> inviteeRoomId: ".concat(e,"; inviteeUserId: ").concat(t,"; extra: ").concat(n)),i={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:e,inviteeUserId:t,extra:n||""},o={roomId:this._mainRoomId,invitedRoomId:e,invitedUserId:t,inviteSessionId:this._PKInfo[e].inviteSessionId,inviteInfo:JSON.stringify(i)},ea.debug("canceRequestJoinPK -> params: ".concat(JSON.stringify(o))),r.next=9,this._context.cancelRoomPK(o);case 9:return s=r.sent,r.abrupt("return",s!==nt.SUCCESS?(ea.error("canceRequestJoinPK failed: ".concat(s)),{code:s}):(ea.debug("canceRequestJoinPK success"),delete this._PKInfo[e],{code:Zs.SUCCESS}));case 11:case"end":return r.stop()}}),r,this)})))}},{key:"responseJoinOtherRoom",value:function(e,t,n,r){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,s,a,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(Wt("inviterRoomId",e,Be,!0)&&Wt("inviterUserId",t,Be,!0)){i.next=2;break}return i.abrupt("return",{code:Zs.PARAMS_ERROR});case 2:if(this._PKInfo[e]){i.next=4;break}return i.abrupt("return",(ea.error("".concat(e," 房间内的 ").concat(t," 未发起过连麦请求")),{code:Zs.PARAMS_ERROR}));case 4:return ea.debug("responseRoomPK -> inviterRoomId: ".concat(e,"; inviterUserId: ").concat(t,"; agree: ").concat(n,"; options: ").concat(JSON.stringify(r||{}))),o=this._PKInfo[e],s=o.inviteSessionId,a=o.inviterUserAutoMix,c=!Le(null==r?void 0:r.autoMix)||(null==r?void 0:r.autoMix),u={inviteSessionId:s,inviterRoomId:e,inviterUserId:t,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:c},d=Object.assign(u,{inviterUserAutoMix:a}),l=n?Object.assign(u,{MultiRoomKey:"".concat(e,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(d)}):u,!He(null==r?void 0:r.extra)&&Object.assign(l,{extra:r.extra}),h={agree:n,roomId:this._mainRoomId,inviteSessionId:s,inviteRoomId:e,inviteUserId:t,content:JSON.stringify(l),key:"".concat(e,"|").concat(t),value:JSON.stringify(u)},ea.debug("responseRoomPK -> params: ".concat(JSON.stringify(h))),i.next=11,this._context.responseRoomPK(h);case 11:return p=i.sent,i.abrupt("return",p!==nt.SUCCESS?(ea.error("responseRoomPK failed: ".concat(p)),{code:p}):(ea.debug("responseRoomPK success"),this._PKInfo[e].inviteeUserAutoMix=c,{code:Zs.SUCCESS}));case 13:case"end":return i.stop()}}),i,this)})))}},{key:"_quitRoomPK",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._PKInfo[e],r=n.inviterRoomId,i=n.inviteeRoomId,o=n.inviterUserId,s={inviteeRoomId:i,inviterRoomId:r,userId:this._context.getCurrentId()},a={roomId:this._mainRoomId,endRoomId:e,sessionId:this._PKInfo[e].inviteSessionId,content:JSON.stringify(s),keys:["".concat(r,"|").concat(o)]},ea.debug("quitRoomPK -> params: ".concat(JSON.stringify(a))),t.next=4,this._context.endRoomPK(a);case 4:return c=t.sent,t.abrupt("return",c!==nt.SUCCESS?(ea.error("quitRoomPK failed: ".concat(c)),{code:Zs.SIGNAL_ERROR}):(ea.debug("quitRoomPK success"),delete this._PKInfo[e],{code:Zs.SUCCESS}));case 6:case"end":return t.stop()}}),t,this)})))}},{key:"_relaseCrtRoom",value:function(){}},{key:"joinOtherRoom",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Wt("roomId",e,Be,!0)){t.next=2;break}return t.abrupt("return",{code:Zs.PARAMS_ERROR});case 2:if(this._context.getConnectionStatus()===it.CONNECTED){t.next=4;break}return t.abrupt("return",{code:Zs.SIGNAL_DISCONNECTED});case 4:if(ea.debug("joinPKRoom, roomId: ".concat(e)),!this._joinedPKRooms[e]){t.next=6;break}return t.abrupt("return",{code:Zs.REPERT_JOIN_ROOM});case 6:return n=ju.VIDEO,t.next=9,this._context.joinRTCRoom(e,wt.LIVE,n);case 9:if(r=t.sent,i=r.code,o=r.data,i===nt.SUCCESS){t.next=14;break}return t.abrupt("return",(ea.error("joinRoom failed -> code: ".concat(i)),{code:i}));case 14:return ea.debug("JoinPKRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),s=new Wu(this._context,this._runtime,e,o,this._service,this._initOptions,this._relaseCrtRoom.bind(this),n,!1,!1),t.abrupt("return",(this._joinedPKRooms[e]=s,this._onJoinedPKRoom(e,s),{room:s,code:Zs.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}));case 17:case"end":return t.stop()}}),t,this)})))}},{key:"leaveOtherRoom",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",ra((function(){return Xs(r,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.getRoomId(),ea.debug("leavePKRoom -> userId: ".concat(this._context.getCurrentId()," , roomId: ").concat(r)),n.next=4,e.__destroy(!0);case 4:return delete this._joinedPKRooms[r],this._onLeavePKRoom(r),n.abrupt("return",this._PKInfo[r]?(t&&this._quitRoomPK(r),{code:Zs.SUCCESS}):{code:Zs.SUCCESS});case 7:case"end":return n.stop()}}),n,this)})))})));case 1:case"end":return n.stop()}}),n)})))}},{key:"getPKInfo",value:function(e){return this._PKInfo[e]}},{key:"getJoinedPKRooms",value:function(){return this._joinedPKRooms}}]),e}(),Wu=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s,a,u,d){var l,h,p,g=arguments.length>8&&void 0!==arguments[8]&&arguments[8],v=arguments.length>9?arguments[9]:void 0;_(this,n),(h=t.call(this,e,r,i,o,wt.LIVE,s,a,u,g,v))._livingType=d,h._isMainRoom=v,h._CDNUris=null,h._CDNEnable=!1,h._mcuConfigBuilder=new Ku(h._onMCUConfigFlush.bind(f(h)),h._isValidResourceId.bind(f(h)),h._sendCDNInfoSignal.bind(f(h))),h._isMainRoom&&(h._roomPKHandler=new Ju(e,r,s,a,f(h),c((l=f(h),m(n.prototype)),"_registerPKMsgListener",l).bind(f(h)),h._onJoinedPKRoom.bind(f(h)),h._onLeavePKRoom.bind(f(h))));var y=null===(p=o.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===p?void 0:p.value;return y&&(h._CDNUris=JSON.parse(y)[0]),h}return R(n,[{key:"_isValidResourceId",value:function(e){var t,n,r=zc(e).userId,i=!!(null===(t=this._roomResources[r])||void 0===t?void 0:t.find((function(t){return Wc(t)===e}))),o=this.getRoomPKHandler(),s=o.code,c=o.roomPKHandler;if(s!==Zs.SUCCESS||!c)return i;var u=c.getJoinedPKRooms(),d=[];return Object.values(u).map((function(e){d.push.apply(d,a(e.getRemoteTracks()))})),n=d.some((function(t){return e===t.getTrackId()})),i||n}},{key:"getLivingType",value:function(){return this._livingType}},{key:"getMCUConfigBuilder",value:function(){return this._isMainRoom?this._mcuConfigBuilder:(ea.error("the `getMCUConfigBuilder` is disabled in PK room "),{code:Zs.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_onMCUConfigFlush",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={"App-Key":this._context.getAppkey(),Token:this._token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},t.next=3,this._service.setMcuConfig(n,e);case 3:return r=t.sent,i=r.code,o=r.res,t.abrupt("return",i!==Zs.SUCCESS?(ea.error("set MCU config failed: ".concat(i)),{code:i}):(ea.info("set MCU config success"),o.pull_url&&(this._CDNUris=JSON.parse(o.pull_url)),{code:i,res:o}));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"__onReconnected",value:function(){var e,t,r=this,i=Object.create(null,{__onReconnected:{get:function(){return c(m(n.prototype),"__onReconnected",r)}}});return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.__onReconnected.call(this,this._livingType);case 2:if((r=n.sent)&&r.data){n.next=5;break}return n.abrupt("return");case 5:if(o=r.data.roomInfo,s=null===(e=o.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===e?void 0:e.value,s){n.next=8;break}return n.abrupt("return");case 8:a=JSON.parse(s),(null===(t=this._CDNUris)||void 0===t?void 0:t.enableInnerCDN)!==a.enableInnerCDN&&this._callAppListener("onCDNEnableChange",a.enableInnerCDN),this._CDNUris=a;case 10:case"end":return n.stop()}}),n,this)})))}},{key:"enableInnerCDN",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._isMainRoom){t.next=2;break}return t.abrupt("return",(ea.error("the `enableInnerCDN` is disabled in PK room "),{code:Zs.THE_FUNCTION_IS_DISABLED_IN_PKROOM}));case 2:if(Le(e)){t.next=4;break}return t.abrupt("return",(ea.error("`enable` is invalid"),{code:Zs.PARAMS_ERROR}));case 4:return this._CDNEnable=e,n={version:2,output:{inCDNModel:e?Vu.OPEN:Vu.STOP}},t.next=8,this._onMCUConfigFlush(n);case 8:if(r=t.sent,(i=r.code)===Zs.SUCCESS){t.next=12;break}return t.abrupt("return",(ea.error("enableInnerCDN failed -> code: ".concat(i)),{code:Zs.SIGNAL_ERROR}));case 12:if(!this._CDNUris||this._CDNUris.broadcast===Bu.SPREAD){t.next=14;break}return t.abrupt("return",(ea.info("enableInnerCDN succeed"),{code:Zs.SUCCESS}));case 14:return t.next=16,ra((function(){return Xs(a,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._sendCDNInfoSignal());case 1:case"end":return e.stop()}}),e,this)})))}));case 16:return o=t.sent,s=o.code,t.abrupt("return",s===Zs.SUCCESS?(ea.info("enableInnerCDN succeed"),{code:Zs.SUCCESS}):(ea.error("enableInnerCDN failed -> code: ".concat(s)),{code:s}));case 19:case"end":return t.stop()}}),t,this)})))}},{key:"_sendCDNInfoSignal",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._CDNUris=Object.assign({},this._CDNUris,{enableInnerCDN:this._CDNEnable}),e.next=3,Promise.all([this._spreadCDNInfo(this._CDNUris),this._setRoomCDNInfo(this._CDNUris)]);case 3:if(e.t0=function(e){return e.code===Zs.SUCCESS},!e.sent.every(e.t0)){e.next=8;break}e.t1={code:Zs.SUCCESS},e.next=9;break;case 8:e.t1={code:Zs.SIGNAL_ERROR};case 9:return e.abrupt("return",e.t1);case 10:case"end":return e.stop()}}),e,this)})))}},{key:"_spreadCDNInfo",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._context.setRTCCDNUris(this._roomId,su.TOTAL_CONTENT_RESOURCE,JSON.stringify([e]));case 2:return n=t.sent,t.abrupt("return",n!==nt.SUCCESS?(ea.error("spreadCDNInfo failed -> code: ".concat(n)),{code:Zs.SIGNAL_ERROR}):(ea.info("spreadCDNInfo succeed"),{code:Zs.SUCCESS}));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_setRoomCDNInfo",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._context.setRTCData(this._roomId,"cdn_uris",JSON.stringify([e]),!0,Mt.ROOM);case 2:return n=t.sent,t.abrupt("return",n!==nt.SUCCESS?(ea.error("setRoomCDNInfo failed -> code: ".concat(n)),{code:Zs.SIGNAL_ERROR}):(ea.info("setRoomCDNInfo succeed"),{code:Zs.SUCCESS}));case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_resourceHandle",value:function(e,t,r){var i,o=this,s=Object.create(null,{_resourceHandle:{get:function(){return c(m(n.prototype),"_resourceHandle",o)}}});return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:s._resourceHandle.call(this,e,t,r),e.cdn_uris&&((null===(i=this._CDNUris)||void 0===i?void 0:i.enableInnerCDN)!==e.cdn_uris[0].enableInnerCDN&&this._callAppListener("onCDNEnableChange",!this.__getCDNEnable()),this._CDNUris=e.cdn_uris[0]);case 1:case"end":return n.stop()}}),n,this)})))}},{key:"_exchangeHandle",value:function(e){var t,n,r;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o,s;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._service.exchange(this._getRTCReqestHeaders(),e);case 2:return o=i.sent,s=null===(n=null===(t=o.data)||void 0===t?void 0:t.urls)||void 0===n?void 0:n.pull_url,i.abrupt("return",o.code===Zs.SUCCESS&&s?(this._CDNUris=JSON.parse(s),(null===(r=this._CDNUris)||void 0===r?void 0:r.broadcast)===Bu.SPREAD&&(this._CDNEnable=!0,this._sendCDNInfoSignal()),o):o);case 5:case"end":return i.stop()}}),i,this)})))}},{key:"_afterChangedRole",value:function(e){var t=this,n=du(e),r=this._context.getCurrentId(),i=Object.keys(n);setTimeout((function(){var o,s,a,c=i.filter((function(e){return e!==r}));for(var u in c.length>0&&t._callAppListener("onUserJoin",c),n)u!==r&&t._resourceHandle({uris:n[u]},su.TOTAL_CONTENT_RESOURCE,u);(null===(o=e.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===o?void 0:o.value)&&(null===(s=t._CDNUris)||void 0===s?void 0:s.push_mode)===Fu.MANUAL&&t._callAppListener("onCDNEnableChange",null===(a=t._CDNUris)||void 0===a?void 0:a.enableInnerCDN)}))}},{key:"__getCDNEnable",value:function(){var e;return null===(e=this._CDNUris)||void 0===e?void 0:e.enableInnerCDN}},{key:"__getCDNPushMode",value:function(){var e;return null===(e=this._CDNUris)||void 0===e?void 0:e.push_mode}},{key:"_onJoinedPKRoom",value:function(e,t){var n=this.getRoomPKHandler(),r=n.code,i=n.roomPKHandler;if(r===Zs.SUCCESS&&i){if(!i.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}},{key:"_onLeavePKRoom",value:function(e){var t=this.getRoomPKHandler(),n=t.code,r=t.roomPKHandler;if(n===Zs.SUCCESS&&r){if(!r.getPKInfo(e))return;this._exchangeWithPushOtherRoom()}}},{key:"_exchangeWithPushOtherRoom",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,s,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getLocalTracks().length){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._createExchangeParams(this._subscribedList,!1);case 4:return t=e.sent,(n=this._getPushOtherRoomsParams())&&(t.pushOtherRooms=n),e.next=9,this._exchangeHandle(t);case 9:if((r=e.sent).code===Zs.SUCCESS){e.next=12;break}return e.abrupt("return",(ea.error("reTryExchange failed: ".concat(r.code)),{code:r.code}));case 12:if(i=r.data,o=i.sdp,(s=i.resultCode)===Zs.SUCCESS){e.next=15;break}return e.abrupt("return",(ea.error("exchange with pushOtherRoom failed: ".concat(s)),{code:s}));case 15:return e.next=17,this._pc.setRemoteAnswer(o.sdp);case 17:return a=e.sent,e.abrupt("return",a!==Zs.SUCCESS?{code:a}:void 0);case 19:case"end":return e.stop()}}),e,this)})))}},{key:"getRoomPKHandler",value:function(){return this._isMainRoom?{code:Zs.SUCCESS,roomPKHandler:this._roomPKHandler}:(ea.error("the `getRoomPKHandler` is disabled in PK room "),{code:Zs.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}},{key:"_quitAllPKRoom",value:function(){var e=this._roomPKHandler.getJoinedPKRooms();for(var t in e){var n=e[t];this._roomPKHandler.leaveOtherRoom(n)}}}]),n}(Du),zu=function(e){d(n,e);var t=h(n);function n(e,r,i,o,s,a,c){return _(this,n),t.call(this,e,r,i,o,wt.RTC,s,a,c,!1)}return R(n)}(Du),Qu=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(ru.browser,"|").concat(ru.version),ClientVersion:"5.3.1","Client-Session-Id":Yu(),"Request-Id":Date.now().toString()}},Xu=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;_(this,e),this._runtime=t,this._context=n,this._msUrl=r,this._timeout=i,this._msInNavi=[],this._failedMs=[],this._rtcFinger=void 0,this._clusterId="",this._configUrl=""}return R(e,[{key:"getNaviMS",value:function(){var e,t;return this._msUrl?[this._msUrl]:this._clusterId?["https://".concat(this._clusterId)]:(0===this._msInNavi.length&&(0===this._failedMs.length?(e=this._msInNavi).push.apply(e,a(function(e){var t,n;if(!e)return[];try{n=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(t){return ea.warn("parse `voipCallInfo` of navi failed: "+e.voipCallInfo),[]}if(0===n.strategy)return[];var r=null===(t=n.callEngine)||void 0===t?void 0:t.filter((function(e){return 4===e.engineType}));if(!r||0===r.length)return[];var i=r[0],o=[];return i.mediaServer&&o.push(i.mediaServer.replace(/^(https?:\/\/)?/,"https://")),i.backupMediaServer&&i.backupMediaServer.forEach((function(e){o.push(e.replace(/^(https?:\/\/)?/,"https://"))})),o}(this._context.getNaviInfo()))):((t=this._msInNavi).push.apply(t,a(this._failedMs)),this._failedMs.length=0)),this._msInNavi.map((function(e){return e.trim()})))}},{key:"_request",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==(i=this.getNaviMS()).length){r.next=3;break}return r.abrupt("return",{code:Zs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 3:this._rtcFinger&&(n.rtcFinger=this._rtcFinger),o=0;case 5:if(!(o<i.length)){r.next=20;break}return c="".concat(i[o]).concat(e),u=Qu(),ea.debug("request -> Request-Id: ".concat(u["Request-Id"],", url: ").concat(c)),r.next=10,this._runtime.httpReq({url:c,body:JSON.stringify(n),headers:Object.assign(Object.assign({},u),t),method:Di.POST,timeout:this._timeout});case 10:if(d=r.sent,l=d.status,h=d.data,200!==l){r.next=16;break}return p=JSON.parse(h),r.abrupt("return",(p.rtcFinger&&(this._rtcFinger=p.rtcFinger),p.clusterId&&(this._clusterId=p.clusterId),ea.debug("request success -> Request-Id: ".concat(u["Request-Id"])),{code:Zs.SUCCESS,data:p}));case 16:ea.warn("request failed -> Request-Id: ".concat(u["Request-Id"],", status: ").concat(l,", url: ").concat(c)),(s=this._failedMs).push.apply(s,a(this._msInNavi.splice(o,1)));case 17:o+=1,r.next=5;break;case 20:return r.abrupt("return",{code:Zs.REQUEST_FAILED});case 21:case"end":return r.stop()}}),r,this)})))}},{key:"exchange",value:function(e,t){var n;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._request("/exchange",e,t);case 2:return(i=r.sent).code===Zs.SUCCESS&&(null===(n=i.data)||void 0===n?void 0:n.resultCode)===Zs.SUCCESS&&(o=i.data.urls)&&(this._configUrl=o.configUrl),r.abrupt("return",i);case 5:case"end":return r.stop()}}),r,this)})))}},{key:"exit",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._request("/exit",e,{});case 2:return n=t.sent,r=n.code,t.abrupt("return",r);case 5:case"end":return t.stop()}}),t,this)})))}},{key:"broadcastSubscribe",value:function(e,t){return this._request("/broadcast/subscribe",e,t)}},{key:"broadcastExit",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._request("/broadcast/exit",e,{});case 2:return n=t.sent,r=n.code,t.abrupt("return",{code:r});case 5:case"end":return t.stop()}}),t,this)})))}},{key:"setMcuConfig",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this._configUrl){n.next=2;break}return n.abrupt("return",{code:Zs.MCU_SERVER_NOT_FOUND});case 2:return r="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),i=Qu(),ea.debug("request -> Request-Id: ".concat(i["Request-Id"],", url: ").concat(r)),n.next=6,this._runtime.httpReq({url:r,headers:Object.assign(Object.assign({},i),e),body:JSON.stringify(t),method:Di.POST});case 6:if(o=n.sent,s=o.status,a=o.data,200!==s){n.next=13;break}return ea.debug("request success -> Request-Id: ".concat(i["Request-Id"])),c=JSON.parse(a),n.abrupt("return",{code:c.resultCode,res:c});case 13:return n.abrupt("return",{code:Zs.REQUEST_FAILED});case 14:case"end":return n.stop()}}),n,this)})))}},{key:"getCDNResourceInfo",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Qu(),n.next=3,this._runtime.httpReq({url:t,headers:Object.assign(Object.assign({},r),e),method:Di.GET});case 3:if(i=n.sent,o=i.status,s=i.data,200!==o){n.next=9;break}return a=JSON.parse(s),n.abrupt("return",{code:a.resultCode,res:a});case 9:return n.abrupt("return",(ea.warn("request failed -> Request-Id: ".concat(r["Request-Id"],", status: ").concat(o,", url: ").concat(t)),{code:Zs.REQUEST_FAILED}));case 10:case"end":return n.stop()}}),n,this)})))}}]),e}(),Zu=function(){function e(t,n,r){_(this,e),this._context=t,this._rtcToken="",this._liveUrl="",this._subTracks=[],this._livingType=null,this._mediaType=null,this._subTiny=!1,this._fromRetry=!1,this._appListener=null,this._service=new Xu(n,t,r.mediaServer)}return R(e,[{key:"_getReqHeaders",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this._context.getCurrentId(),r=n,this._rtcToken){t.next=10;break}return t.next=4,this._context.getRTCToken(r,wt.LIVE,e);case 4:if(i=t.sent,o=i.code,s=i.data,o===nt.SUCCESS){t.next=9;break}return t.abrupt("return",(ea.error("getRTCToken failed: ".concat(o)),{code:Zs.SIGNAL_ERROR}));case 9:this._rtcToken=s.rtcToken;case 10:return t.abrupt("return",{code:Zs.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:n,RoomId:r,RoomType:wt.LIVE,Token:this._rtcToken}});case 11:case"end":return t.stop()}}),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(){var e;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._fromRetry=!0,t.next=3,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny);case 3:n=t.sent,n.code===Zs.SUCCESS&&(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer());case 6:case"end":return t.stop()}}),t,this)})))}},{key:"subscribe",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function i(){var o=this;return regeneratorRuntime.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",ra((function(){return o.__subscribe(e,t,n,r)})));case 1:case"end":return i.stop()}}),i)})))}},{key:"__subscribe",value:function(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function o(){var s,a,c,u,d,l,h,p,f,g,m,v,_=this;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(s=[],!uu(this._context.getNaviInfo())){o.next=3;break}return o.abrupt("return",{code:Zs.PACKAGE_ENVIRONMENT_ERROR,tracks:s});case 3:if(!this._fromRetry&&(null===(r=this._pc)||void 0===r||r.clearReTryExchangeTimer()),this._fromRetry=!1,xe(e)){o.next=5;break}return o.abrupt("return",(ea.error("liveUrl is invalid: ".concat(e)),{code:Zs.PARAMS_ERROR,tracks:s}));case 5:if([ju.AUDIO,ju.VIDEO].includes(t)){o.next=7;break}return o.abrupt("return",(ea.error("livingType is invalid: ".concat(t)),{code:Zs.PARAMS_ERROR,tracks:s}));case 7:if([vc.AUDIO_ONLY,vc.VIDEO_ONLY,vc.AUDIO_VIDEO].includes(n)){o.next=9;break}return o.abrupt("return",(ea.error("mediaType is invalid: ".concat(n)),{code:Zs.PARAMS_ERROR,tracks:s}));case 9:if(!this._liveUrl||this._liveUrl===e){o.next=11;break}return o.abrupt("return",{code:Zs.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s});case 11:return this._pc||(this._pc=new Nu(this._reTryExchange.bind(this)),this._pc.on(Nu.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this.registerReportListener(this._reportListener)),this._liveUrl=e,o.next=14,this._getReqHeaders(t);case 14:if(a=o.sent,c=a.code,u=a.headers,c===Zs.SUCCESS){o.next=19;break}return o.abrupt("return",{code:c,tracks:s});case 19:return d="rc_mcu_".concat(Date.now()),l="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new Bc(l,d),new Fc(l,d)),this._pc.updateSubRemoteTracks(this._subTracks.slice())),o.next=23,this._pc.createOffer(!0);case 23:return o.t0=o.sent,o.t1=e,o.t2=n,o.t3=i?lu.TINY:lu.NORMAL,o.t4=!1,h={sdp:o.t0,liveUrl:o.t1,mediaType:o.t2,simulcast:o.t3,switchstream:o.t4},o.next=31,this._service.broadcastSubscribe(u,h);case 31:if((p=o.sent).code===Zs.SUCCESS){o.next=34;break}return o.abrupt("return",(ea.error("andience subscribe failed: ".concat(p.code)),{code:p.code,tracks:s}));case 34:if((f=p.data).resultCode===Zs.SUCCESS){o.next=37;break}return o.abrupt("return",(ea.error("andience subscribe failed! code: ".concat(f.resultCode,"; message: ").concat(f.message)),{code:f.resultCode,tracks:s}));case 37:return ea.debug("andience subscribe success: ".concat(e)),this._livingType=t,this._mediaType=n,this._subTiny=i,g=f.sdp,m=f.subscribedList,v=[],o.abrupt("return",(m.forEach((function(e){var t=e.mediaType,n=_._subTracks[t];v.push(n),n.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(g.sdp),{code:Zs.SUCCESS,tracks:v}));case 40:case"end":return o.stop()}}),o,this)})))}},{key:"unsubscribe",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ra((function(){return t.__unsubscribe()})));case 1:case"end":return e.stop()}}),e)})))}},{key:"__unsubscribe",value:function(){var e;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl){t.next=2;break}return t.abrupt("return",{code:Zs.SUCCESS});case 2:return t.next=4,this._getReqHeaders();case 4:return n=t.sent,r=n.headers,t.next=8,this._service.broadcastExit(r);case 8:return i=t.sent,o=i.code,t.abrupt("return",(o!==Zs.SUCCESS?ea.error("broadcast unsubscribe failed: ".concat(o)):ea.debug("broadcast unsubscribe success"),this._clearSubscribeInfo(),{code:o}));case 11:case"end":return t.stop()}}),t,this)})))}},{key:"registerReportListener",value:function(e){var t;this._reportListener=e,null===(t=this._pc)||void 0===t||t.registerReportListener(e)}},{key:"registerTrackEventListener",value:function(e){this._appListener=e}},{key:"_onTrackReady",value:function(e){var t,n,r=e.receiver.track,i="audio"===r.kind?vc.AUDIO_ONLY:vc.VIDEO_ONLY,o=this._subTracks[i];o.__innerSetMediaStreamTrack(r);try{null===(n=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===n||n.call(t,o)}catch(e){ea.error(e)}}}]),e}();!function(e){e.RTMP="rtmp",e.FLV="flv",e.HLS="hls"}(qu||(qu={})),function(e){e[e.NOT_HTTPS=0]="NOT_HTTPS",e[e.HTTPS=1]="HTTPS"}(Gu||(Gu={}));var $u,ed=Object.assign(Object.assign({},$c(mc.W176_H144)),{frameRate:nu(gc.FPS_15)}),td=function(){function e(t,n,r,i,o,s){var a=this;_(this,e),this._context=t,this._runtime=n,this._initOptions=r,this._roomId=i,this._joinResData=o,this._livingType=s,this._roomAnchorList=[],this._roomRes={},this._roomAnchorRes={},this._remoteTracks={},this._appListener=null,this._subscribedList=[],this._sessionId="",this._destroyed=!1,this._setInitData(),this._service=new Xu(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout),this._polarisReport=new Au(this._context,this._runtime,this._roomId,this,fu.Audience),this._polarisReport.sendR1(),this._pc=new Nu(this._reTryExchange.bind(this),this._polarisReport),this._pc.on(Nu.__INNER_EVENT_TRACK_READY__,(function(e){var t=e.streams[0].id,n=e.receiver.track,r=[t,"audio"===n.kind?vc.AUDIO_ONLY:vc.VIDEO_ONLY].join("_"),i=a._remoteTracks[r];i?(i.__innerSetMediaStreamTrack(n),a._callAppListener("onTrackReady",i)):ea.warn("cannot found RCRemoteTrack:",n.id)})),this._context.onrtcdatachange=this.singalDataChange.bind(this)}return R(e,[{key:"_setInitData",value:function(){var e=this,t=function(e,t){var n=t.filter((function(e){return"RC_RTC_SESSIONID"===e.key}))[0],r=n?n.value:"",i=t.filter((function(e){return"RC_ANCHOR_LIST"===e.key})).map((function(e){return JSON.parse(e.value||"[]")}))[0],o=t.filter((function(e){return e.key.includes("RC_RES_")})).map((function(e){return JSON.parse(e.value||"{}")})),s=o.length?JSON.parse(o[0].mcu_uris||"[]"):[],c=[];s.forEach((function(t){var n=t.mediaType,r=t.tag,i=n===vc.AUDIO_ONLY?new Bc(r,"",e):new Fc(r,"",e);c.push(i)}));var u=[],d=[];o.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,a(t)),t.forEach((function(e){var t=e.mediaType,n=e.tag,r=e.msid.split("_")[0],i=t===vc.AUDIO_ONLY?new Bc(n,r):new Fc(n,r);d.push(i)}))}));var l=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:r,remoteUserIds:i||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:d,remoteMCUTracks:c,remoteTracks:[].concat(d,c),CDNUris:l||{}}}(this._roomId,this._joinResData.kvEntries),n=t.sessionId,r=t.remoteUserIds,i=t.remoteRTCUris,o=t.remoteMUCUris,s=t.remoteTracks,c=t.CDNUris;this._sessionId=n,this._roomAnchorList=r,s.forEach((function(t){e._remoteTracks[t.getTrackId()]=t})),this._CDNUris=c,i.forEach((function(t){var n=t.msid.split("_")[0];e._roomAnchorRes[n]?e._roomAnchorRes[n].push(t):e._roomAnchorRes[n]=[t]})),o.forEach((function(t){var n=t.mediaType,r=t.tag,i=[e._roomId,r,n].join("_");e._roomRes[i]=t})),i.forEach((function(t){var n=Wc(t);e._roomRes[n]=t}))}},{key:"_assertRoomDestroyed",value:function(){if(this._destroyed){return ea.warn("This room has been destroyed. Please use `RCRTCClient.joinLivingRoomAsAudience` to catch another instance."),Zs.ROOM_HAS_BEEN_DESTROYED}}},{key:"singalDataChange",value:function(e,t){var n,r=this;if(t===this._roomId){ea.debug("singalDataChange -> singalData:",JSON.stringify(e||{}));var i=[],o=null===(n=e.filter((function(e){return"RC_CDN"===e.key}))[0])||void 0===n?void 0:n.value;o&&this._diffCDNUris(JSON.parse(JSON.parse(o).cdn_uris)[0]),e.forEach((function(e){var t=e.key,n=e.value,o=(e.timestamp,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 i.push.apply(i,a(c)),void r._diffAnchorResource(u,o)}if("RC_ANCHOR_LIST"===t){var d=JSON.parse(n||"[]"),l=r._diffAnchorList(d),h=l.joinUserIds,p=l.leftUserIds;h.length>0&&r._handleNewJoinedAnchor(h),p.length>0&&r._handleLeftedAnchor(p)}})),this._diffRoomResource(i)}else ea.warn("singalDataChange -> not the current room data: data roomId: ".concat(t,", current roomId: ").concat(this._roomId))}},{key:"_diffAnchorList",value:function(e){var t=this,n=e.filter((function(e){return t._roomAnchorList.indexOf(e)<0}));return{leftUserIds:this._roomAnchorList.filter((function(t){return e.indexOf(t)<0})),joinUserIds:n}}},{key:"_handleNewJoinedAnchor",value:function(e){var t;(t=this._roomAnchorList).push.apply(t,a(e)),this._callAppListener("onAnchorJoin",e)}},{key:"_handleLeftedAnchor",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._roomAnchorList=this._roomAnchorList.filter((function(t){return!(e.indexOf(t)>-1)})),n=[],e.forEach((function(e){n.push.apply(n,a(r.getRemoteTracksByUserId(e))),delete r._roomAnchorRes[e]})),t.t0=n.length,!t.t0){t.next=8;break}return t.next=7,this.unsubscribe(n);case 7:n.forEach((function(e){return delete r._remoteTracks[e.getTrackId()]}));case 8:this._callAppListener("onAnchorLeave",e);case 9:case"end":return t.stop()}}),t,this)})))}},{key:"_diffRoomResource",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=[],r=[],i=[],e.forEach((function(e){var t=Wc(e),r=zc(t),s=(r.userId,r.tag),a=r.mediaType,c=[o._roomId,s,a].join("_");if(!o._remoteTracks[c]){var u=a===vc.AUDIO_ONLY?new Bc(s,"",o._roomId):new Fc(s,"",o._roomId);n.push(u),o._remoteTracks[c]=u,o._roomRes[u.getTrackId()]=e}i.push(c)})),Object.keys(this._remoteTracks).forEach((function(e){i.indexOf(e)<0&&o._remoteTracks[e].isMCUTrack()&&r.push(o._remoteTracks[e])})),n.length>0&&this._callAppListener("onTrackPublish",n),r.length>0&&this._onUserUnpublish(r,"onTrackUnpublish");case 2:case"end":return t.stop()}}),t,this)})))}},{key:"_diffAnchorResource",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l,h,p,f,g,m,v,_,y,R,C,E,T,S=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),i=Zc(r,e),o=i.publishedList,s=i.unpublishedList,a=i.modifiedList,!o.length){n.next=12;break}if(c=r.map(Wc),u=[],d=[],o.forEach((function(e){var t=Wc(e),n=c.indexOf(t),i=zc(t),o=i.userId,s=i.tag,a=i.mediaType;n>-1?r[n]=e:r.push(e);var l=S._remoteTracks[t];S._roomRes[t]=e,l?l.isSubscribed()&&u.push(l):(l=a===vc.AUDIO_ONLY?new Bc(s,o):new Fc(s,o),S._remoteTracks[t]=l,d.push(l)),l.__innerSetRemoteMuted(0===e.state)})),!u.length){n.next=11;break}return l=u.map((function(e){return e.getTrackId()})),ea.debug("resub tracks -> ".concat(JSON.stringify(l))),n.next=8,ra((function(){return S._subscribeHandle(u,!0)}));case 8:h=n.sent,(p=h.code)!==Zs.SUCCESS&&ea.error("resub tracks failed -> code: ".concat(p,", ids: ").concat(JSON.stringify(l)));case 11:this._callAppListener("onAnchorTrackPublish",d);case 12:if(!s.length){n.next=18;break}for(f=s.map(Wc),g=r.length-1;g>=0;g-=1)m=r[g],f.includes(Wc(m))&&r.splice(g,1);return v=s.map((function(e){var t=Wc(e);return S._remoteTracks[t]})),n.next=18,this._onUserUnpublish(v,"onAnchorTrackUnpublish");case 18:if(a.length)for(_=r.map(Wc),y=0;y<a.length;y++)R=a[y],C=Wc(R),E=_.indexOf(C),r[E].state=R.state,(T=this._remoteTracks[C]).__innerSetRemoteMuted(0===R.state),T.isAudioTrack()?this._callAppListener("onAudioMuteChange",T):this._callAppListener("onVideoMuteChange",T);case 19:case"end":return n.stop()}}),n,this)})))}},{key:"_onUserUnpublish",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.unsubscribe(e);case 2:e.forEach((function(e){r._subscribedList=r._subscribedList.filter((function(t){return t.track.getTrackId()!==e.getTrackId()})),delete r._roomRes[e.getTrackId()],e.__innerDestroy(),delete r._remoteTracks[e.getTrackId()]})),this._callAppListener(t,e);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"_callAppListener",value:function(e){var t,n=null===(t=this._appListener)||void 0===t?void 0:t[e];if(n)try{for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];n.apply(void 0,i)}catch(e){ea.error(e)}}},{key:"_reTryExchange",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ra((function(){return Xs(t,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r,i,o,s,a,c,u,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._createSubscribeParams(this._subscribedList,{},!0);case 2:return n=e.sent,r=n.reqBody,e.next=6,this._exchangeHandle(r);case 6:if((i=e.sent).code===Zs.SUCCESS){e.next=9;break}return e.abrupt("return",(ea.error("reTryExchange failed: ".concat(i.code)),{code:i.code}));case 9:if(o=i.data,s=o.sdp,(a=o.resultCode)===Zs.SUCCESS){e.next=12;break}return e.abrupt("return",(ea.error("reTryExchange failed: ".concat(a)),{code:a}));case 12:return this._pc.clearReTryExchangeTimer(),c=this._subscribedList.filter((function(e){return e.track.isMCUTrack()})),c.length>0&&(u=c[0].track.getTrackId(),d=null===(t=this._roomRes[u])||void 0===t?void 0:t.msid,l=[this._roomId,"RongCloudRTC"].join("_"),s.sdp=s.sdp.replace(new RegExp(d,"g"),l)),e.next=17,this._pc.setRemoteAnswer(s.sdp);case 17:return h=e.sent,e.abrupt("return",h!==Zs.SUCCESS?{code:h}:void 0);case 19:case"end":return e.stop()}}),e,this)})))}));case 1:case"end":return e.stop()}}),e)})))}},{key:"_createSubscribeParams",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this._pc.createOffer(n);case 2:return i=r.sent,o={resolutionInfo:[]},s={min:0,max:0},Object.keys(t).forEach((function(e){var n=t[e];[n.mediaStream,n.tinyStream].forEach((function(t,n){var r,a=1===n?[e,"tiny"].join("_"):e;i.sdp=null===(r=i.sdp)||void 0===r?void 0:r.replace(new RegExp(t.id,"g"),a);var c=t.getVideoTracks()[0];if(c){var u=0===n,d=u?Yc(c):ed,l=d.width,h=d.height,p=d.frameRate;o.resolutionInfo.push({trackId:c.id,simulcast:u?lu.NORMAL:lu.TINY,resolution:"".concat(l,"x").concat(h)});var f=Cc(l,h),g=Tc(p);s.min+=f.minBitrate*g,s.max+=f.maxBitrate*g}}))})),r.abrupt("return",{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?lu.TINY:lu.NORMAL,resolution:"",uri:a._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:s,offer:i});case 7:case"end":return r.stop()}}),r,this)})))}},{key:"_subscribeHandle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,a;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",{code:Zs.ROOM_HAS_BEEN_DESTROYED});case 2:if(Wt("tracks",e,(function(){return De(e)&&e.length>0&&e.every((function(e){return e instanceof Vc||e.track instanceof Vc}))}),!0)){r.next=4;break}return r.abrupt("return",{code:Zs.PARAMS_ERROR});case 4:return i=this._subscribedList.map((function(e){return Object.assign({},e)})),o=e.map((function(e){return e instanceof Vc?{track:e}:e})),s=!1,a=[],r.abrupt("return",(o.forEach((function(e){var t=e.track.getTrackId();a.push(t);var n=i.find((function(e){return e.track.getTrackId()===t}));n&&n.subTiny===e.subTiny||(n?n.subTiny=e.subTiny:i.push(e),s=!0)})),s||n?(null===(t=this._polarisReport)||void 0===t||t.sendR2(gu.SUBSCRIBE,mu.BEGIN,a),this._updateSubListHandle(i,!0)):{code:Zs.SUCCESS}));case 8:case"end":return r.stop()}}),r,this)})))}},{key:"_getReqHeaders",value:function(){var e=this._context.getCurrentId();return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:wt.LIVE,UserId:e,"Session-Id":this._sessionId}}},{key:"_exchangeHandle",value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}},{key:"_updateSubListHandle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,s,c,u,d,l,h,p,f,g,m,v,_,y,R,C,E,T,S,I,b=this;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this._assertRoomDestroyed()){r.next=2;break}return r.abrupt("return",{code:Zs.ROOM_HAS_BEEN_DESTROYED});case 2:if(Wt("resources",e,(function(){return De(e)&&e.every((function(e){return e instanceof Vc||e.track instanceof Vc}))}),!0)){r.next=4;break}return r.abrupt("return",{code:Zs.PARAMS_ERROR});case 4:if(o=e.map((function(e){return e instanceof Vc?{track:e}:Object.assign({},e)})),s={},o=o.filter((function(e){var t=e.track.getTrackId();return!s[t]&&(s[t]=!0)})).map((function(e){return Object.assign({},e)})),c=this._subscribedList.map((function(e){return Object.assign({},e)})),n){r.next=12;break}if(u=!1,o.forEach((function(e){var t=c.findIndex((function(t){return t.track===e.track}));-1!==t?c.splice(t,1)[0].subTiny!==e.subTiny&&(u=!0):u=!0})),c.length&&(u=!0),u){r.next=12;break}return r.abrupt("return",{code:Zs.SUCCESS});case 12:return this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(o.map((function(e){return e.track}))),r.next=15,this._createSubscribeParams(o,{},!1);case 15:return d=r.sent,l=d.reqBody,r.next=19,this._exchangeHandle(l);case 19:if(h=r.sent,c.length&&(p=[],c.forEach((function(e){p.push(e.track.getTrackId())})),null===(t=this._pc.reportParser)||void 0===t||t.clearLatestPacketsRecv(p)),h.code===Zs.SUCCESS){r.next=23;break}return r.abrupt("return",{code:h.code});case 23:if(f=h.data,g=f.sdp,m=f.resultCode,v=f.message,_=f.subscribedList,m===Zs.SUCCESS){r.next=26;break}return r.abrupt("return",(ea.error("change subscribe list failed:",v,m),{code:m}));case 26:return o.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var n=b._roomRes[t.getTrackId()].msid,r=zc(t.getTrackId()),i=r.tag,o=[r.userId,i].join("_");g.sdp=g.sdp.replace(new RegExp(n,"g"),o)}})),r.next=29,this._pc.setRemoteAnswer(g.sdp);case 29:if((y=r.sent)===Zs.SUCCESS){r.next=32;break}return r.abrupt("return",{code:y});case 32:for(I in R=null==_?void 0:_.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),C=o.filter((function(e){if(e.track.isMCUTrack()){var t=b._roomRes[e.track.getTrackId()],n="".concat(t.msid,"_").concat(t.mediaType);return R.includes(n)}return null==R?void 0:R.includes(e.track.getTrackId())})),E=null==C?void 0:C.map((function(e){return"".concat(e.track.getTrackId())})),T=o.filter((function(e){return!(null==E?void 0:E.includes(e.track.getTrackId()))})),S=function(e){var t=C.some((function(t){return t.track.getTrackId()===e}));b._remoteTracks[e].__innerSetSubscribed(t)},this._remoteTracks)S(I);return r.abrupt("return",((i=this._subscribedList).splice.apply(i,[0,this._subscribedList.length].concat(a(C))),T.length?{code:Zs.SUCCESS,failedList:T}:{code:Zs.SUCCESS}));case 36:case"end":return r.stop()}}),r,this)})))}},{key:"_diffCDNUris",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._CDNUris.url||e.url){t.next=2;break}return t.abrupt("return",(this._callAppListener("onCDNInfoDisable"),void(this._CDNUris=e)));case 2:(!this._CDNUris||!this._CDNUris.url&&e.url)&&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,r=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,i=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(n||r||i)&&this._callAppListener("onCDNInfoChange",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),this._CDNUris=e;case 5:case"end":return t.stop()}}),t,this)})))}},{key:"_getCDNPlayUrl",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o,s,a,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.w,r=e.h,i=e.fps,o=this._initOptions.pullInnerCDNProtocol||qu.FLV,s=this._initOptions.pullInnerCDNUseHttps===Gu.NOT_HTTPS?Gu.NOT_HTTPS:Gu.HTTPS,this._CDNUris.url){t.next=3;break}return t.abrupt("return",(ea.error("cdn_uris url is empty, the anchor need to open or push CDN, code: ".concat(Zs.CDN_RESOURCE_IS_EMPTY)),{code:Zs.CDN_RESOURCE_IS_EMPTY}));case 3:return a={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._context.getCurrentId(),SessionId:this.getSessionId()},c=[],n&&c.push("w=".concat(n)),r&&c.push("h=".concat(r)),i&&c.push("fps=".concat(i)),c.push("kind=".concat(o)),c.push("is_https=".concat(s)),u=c.join("&"),d="".concat(this._CDNUris.url,"?"),u&&(d+=u),t.next=10,this._service.getCDNResourceInfo(a,d);case 10:return l=t.sent,h=l.code,p=l.res,t.abrupt("return",h!==Zs.SUCCESS?(ea.error("getCDNPlayUrl failed: ".concat(h)),{code:h}):(ea.info("getCDNPlayUrl success: ".concat(null==p?void 0:p.data.pull_url)),{code:h,CDNPlayUrl:null==p?void 0:p.data.pull_url}));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"getCDNPlayUrl",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!e||eu(e)){n.next=2;break}return n.abrupt("return",(ea.error("`resolution` is invalid"),{code:Zs.PARAMS_ERROR}));case 2:if(!t||tu(t)){n.next=4;break}return n.abrupt("return",(ea.error("`fps` is invalid"),{code:Zs.PARAMS_ERROR}));case 4:return r=e?$c(e):{width:null,height:null},i=r.width,o=r.height,s=t?nu(t):null,a={},n.abrupt("return",(i&&(a.w=i),o&&(a.h=o),s&&(a.fps=s),this._getCDNPlayUrl(a)));case 6:case"end":return n.stop()}}),n,this)})))}},{key:"subscribe",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n._subscribeHandle(e,!1)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__unsubscribe",value:function(e){var t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Wt("tracks",e,(function(){return De(e)&&e.length>0&&e.every((function(e){return e instanceof Vc}))}),!0)){n.next=2;break}return n.abrupt("return",(ea.error("unsubscribe failed, tracks is invalid -> roomId: ".concat(this._roomId)),{code:Zs.PARAMS_ERROR}));case 2:return r=this._subscribedList.map((function(e){return Object.assign({},e)})).filter((function(t){return!e.includes(t.track)})),n.abrupt("return",(null===(t=this._polarisReport)||void 0===t||t.sendR2(gu.SUBSCRIBE,mu.END,e.map((function(e){return e.getTrackId()}))),this._updateSubListHandle(r,!1)));case 4:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",ra((function(){return n.__unsubscribe(e)})));case 1:case"end":return t.stop()}}),t)})))}},{key:"__destroy",value:function(e){var t;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=this._destroyed,n.t0){n.next=13;break}if(this._destroyed=!0,null===(t=this._audioLevelReport)||void 0===t||t.clearAudioLevelReportTimer(),n.t1=e,!n.t1){n.next=8;break}return n.next=8,this._context.quitLivingRoomAsAudience(this._roomId);case 8:return n.next=10,this._service.broadcastExit(this._getReqHeaders());case 10:this._pc.destroy(),this._polarisReport=null,this._context.onrtcdatachange=function(){};case 13:case"end":return n.stop()}}),n,this)})))}},{key:"getRemoteTrack",value:function(e){return this._remoteTracks[e]}},{key:"__getPC",value:function(){return this._pc}},{key:"getLocalTrack",value:function(e){return{}}},{key:"__onReconnected",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._context.joinLivingRoomAsAudience(this._roomId,wt.LIVE);case 2:t=e.sent,t.code!==nt.SUCCESS&&ea.error("join living room error when on reconnected");case 5:case"end":return e.stop()}}),e,this)})))}},{key:"registerRoomEventListener",value:function(e){this._appListener=e}},{key:"onAudioLevelChange",value:function(e,t){var n;null===(n=this._audioLevelReport)||void 0===n||n.clearAudioLevelReportTimer(),this._audioLevelReport=new Mu(this),this._audioLevelReport.onAudioLevelChange(e,t||1e3)}},{key:"registerReportListener",value:function(e){var t;null===(t=this._pc)||void 0===t||t.registerReportListener(e)}},{key:"getRoomId",value:function(){return this._roomId}},{key:"getCrtUserId",value:function(){return this._context.getCurrentId()}},{key:"getSessionId",value:function(){return this._sessionId}},{key:"getRemoteUserIds",value:function(){return this._roomAnchorList}},{key:"getRemoteTracksByUserId",value:function(e){var t=[];for(var n in this._remoteTracks){var r=this._remoteTracks[n];r.getUserId()===e&&t.push(r)}return t}},{key:"getRemoteTracks",value:function(){var e=this,t=[],n=[];for(var r in this._remoteTracks){if(2===n.length)break;var i=this._remoteTracks[r];i.isMCUTrack()&&n.push(i)}return this._roomAnchorList.forEach((function(n){t.push.apply(t,a(e.getRemoteTracksByUserId(n)))})),[].concat(n,t)}},{key:"getRemoteRTCTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()||e.push(n)}return e}},{key:"getRemoteMCUTracks",value:function(){var e=[];for(var t in this._remoteTracks){var n=this._remoteTracks[t];n.isMCUTrack()&&e.push(n)}return e}},{key:"getCDNInfo",value:function(){return this._CDNUris.w?{resolution:"W".concat(this._CDNUris.w,"_H").concat(this._CDNUris.h),fps:"FPS_".concat(this._CDNUris.fps),CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}}]),e}(),nd=function(e,t){var n=[];return n[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],n[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],n},rd=function(){function e(t,n,r){_(this,e),this._context=t,this._runtime=n,this._options=r,this._crtRoom=null,this._audience=null,this._crtAudienceLivingRoom=null,ku.setSdpSemantics(r.sdpSemantics||"plan-b"),this._service=new Xu(this._runtime,this._context,this._options.mediaServer,this._options.timeout),this._context.onconnectionstatechange=this._onIMStatusChange.bind(this),this._context.ondisconnect=this._onIMDisconnect.bind(this),this._context.ondestroy=this._onIMUninit.bind(this),this._context.onmessage=this._handleMessage.bind(this)}return R(e,[{key:"_handleMessage",value:function(e){var t;return e.conversationType===Ne.RTC_ROOM&&(this._crtRoom instanceof Wu&&this._getJoinedPKRoomList().forEach((function(t){t.__parseInnerMessage(e)})),null===(t=this._crtRoom)||void 0===t||t.__parseInnerMessage(e),!0)}},{key:"_getJoinedPKRoomList",value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,n=e.roomPKHandler;if(t===Zs.SUCCESS&&n){var r=n.getJoinedPKRooms()||{};return Object.values(r)}return[]}},{key:"getCurrentId",value:function(){return this._context.getCurrentId()}},{key:"joinRTCRoom",value:function(e,t){var n=this;return ra((function(){return n._joinRTCRoom(e,t)}))}},{key:"_joinRTCRoom",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!uu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:Zs.PACKAGE_ENVIRONMENT_ERROR});case 2:if(Wt("roomId",e,Be,!0)){n.next=4;break}return n.abrupt("return",{code:Zs.PARAMS_ERROR});case 4:if(!this._crtRoom){n.next=6;break}return n.abrupt("return",{code:Zs.REPERT_JOIN_ROOM});case 6:if(this._context.getConnectionStatus()===it.CONNECTED){n.next=8;break}return n.abrupt("return",{code:Zs.SIGNAL_DISCONNECTED});case 8:if(this._service.getNaviMS().length){n.next=10;break}return n.abrupt("return",{code:Zs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 10:return ea.debug("joinRoom -> roomId: ".concat(e,"; joinType: ").concat(t||xt.KICK)),n.next=13,this._context.joinRTCRoom(e,wt.RTC,void 0,t);case 13:if(r=n.sent,i=r.code,o=r.data,i===nt.SUCCESS){n.next=19;break}return ea.error("joinRoom failed -> code: ".concat(i)),n.abrupt("return",{code:i===$s.JOIN_REFUSED?Zs.SIGNAL_JOIN_RTC_ROOM_REFUSED:i});case 19:return ea.debug("joinRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),s=new zu(this._context,this._runtime,e,o,this._service,this._options,this._releaseCrtRoomObj.bind(this)),n.abrupt("return",(this._crtRoom=s,{room:s,code:Zs.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}));case 22:case"end":return n.stop()}}),n,this)})))}},{key:"joinLivingRoom",value:function(e,t){var n=this;return ra((function(){return n._joinLivingRoom(e,t)}))}},{key:"_joinLivingRoom",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!uu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:Zs.PACKAGE_ENVIRONMENT_ERROR});case 2:if(Wt("roomId",e,Be,!0)&&Wt("livingType",t,(function(e){return e===ju.AUDIO||e===ju.VIDEO}))){n.next=4;break}return n.abrupt("return",{code:Zs.PARAMS_ERROR});case 4:if(!this._crtRoom){n.next=6;break}return n.abrupt("return",{code:Zs.REPERT_JOIN_ROOM});case 6:if(this._context.getConnectionStatus()===it.CONNECTED){n.next=8;break}return n.abrupt("return",{code:Zs.SIGNAL_DISCONNECTED});case 8:if(this._service.getNaviMS().length){n.next=10;break}return n.abrupt("return",{code:Zs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 10:return ea.debug("joinRoom, roomId: ".concat(e)),n.next=13,this._context.joinRTCRoom(e,wt.LIVE,t);case 13:if(r=n.sent,i=r.code,o=r.data,i===nt.SUCCESS){n.next=18;break}return n.abrupt("return",(ea.error("joinRoom failed -> code: ".concat(i)),{code:i}));case 18:return ea.debug("JoinRoom success -> userId: ".concat(this._context.getCurrentId(),", roomId: ").concat(e,", data: ").concat(JSON.stringify(o))),s=new Wu(this._context,this._runtime,e,o,this._service,this._options,this._releaseCrtRoomObj.bind(this),t,!1,!0),this._crtRoom=s,a={room:s,code:Zs.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},n.abrupt("return",(s.__getCDNPushMode()===Fu.MANUAL&&Object.assign(a,{CDNEnable:s.__getCDNEnable()}),a));case 23:case"end":return n.stop()}}),n,this)})))}},{key:"getAudienceClient",value:function(){return this._audience||(this._audience=new Zu(this._context,this._runtime,this._options)),this._audience}},{key:"_onIMStatusChange",value:function(e){ea.debug("signal server connection state change: ".concat(e)),e===it.CONNECTED&&(this._crtRoom instanceof Wu&&this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()})),this._crtRoom&&this._crtRoom.__onReconnected())}},{key:"_onIMDisconnect",value:function(){ea.debug("TODO -> on IM disconnect")}},{key:"_onIMUninit",value:function(){ea.debug("TODO -> on IM client ondestroy")}},{key:"leaveRoom",value:function(e){var t=this;return ra((function(){return t._leaveRoom(e)}))}},{key:"_leaveRoom",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._crtRoom){e.next=8;break}return e.next=3,this._crtRoom.__destroy(!0);case 3:ea.debug("quitRTCRoom -> userId: ".concat(this._context.getCurrentId()," , roomId: ").concat(this._crtRoom.getRoomId())),this._crtRoom=null,e.t0={code:Zs.SUCCESS},e.next=9;break;case 8:e.t0={code:Zs.SUCCESS};case 9:return e.abrupt("return",e.t0);case 10:case"end":return e.stop()}}),e,this)})))}},{key:"_releaseCrtRoomObj",value:function(){this._crtRoom=null}},{key:"_getMediaStream",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"getUserMedia";return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,navigator.mediaDevices[t](e);case 3:return r=n.sent,n.abrupt("return",{code:Zs.SUCCESS,stream:r});case 7:if(n.prev=7,n.t0=n.catch(0),"Permission denied"!==n.t0.message){n.next=11;break}return n.abrupt("return",{code:Zs.PERMISSION_DENIED});case 11:ea.error("get user media failed -> ".concat(n.t0.message));case 12:return n.abrupt("return",{code:"getUserMedia"===t?Zs.GET_USER_MEDIA_FAILED:Zs.GET_DISPLAY_MEDIA_FAILED});case 13:case"end":return n.stop()}}),n,null,[[0,7]])})))}},{key:"createMicrophoneAudioTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",t=arguments.length>1?arguments[1]:void 0;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Kc(e)){n.next=2;break}return n.abrupt("return",{code:Zs.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:Zs.INVALID_USER_ID});case 5:return n.next=7,this._getMediaStream({audio:{deviceId:null==t?void 0:t.micphoneId,sampleRate:null==t?void 0:t.sampleRate}});case 7:if(i=n.sent,o=i.stream,(s=i.code)===Zs.SUCCESS){n.next=12;break}return n.abrupt("return",{code:s});case 12:return a=o.getAudioTracks()[0],n.abrupt("return",{code:s,track:new Lc(e,r,a)});case 14:case"end":return n.stop()}}),n,this)})))}},{key:"createCameraVideoTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",t=arguments.length>1?arguments[1]:void 0;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Kc(e)){n.next=2;break}return n.abrupt("return",{code:Zs.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:Zs.INVALID_USER_ID});case 5:return i=eu(null==t?void 0:t.resolution)?t.resolution:mc.W640_H480,o=$c(i),s=o.width,a=o.height,n.next=11,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:nu((null==t?void 0:t.frameRate)||gc.FPS_15),width:s,height:a,facingMode:null==t?void 0:t.faceMode}});case 11:if(c=n.sent,u=c.stream,(d=c.code)===Zs.SUCCESS){n.next=16;break}return n.abrupt("return",{code:d});case 16:return l=u.getVideoTracks()[0],n.abrupt("return",{code:d,track:new Uc(e,r,l)});case 18:case"end":return n.stop()}}),n,this)})))}},{key:"createMicrophoneAndCameraTracks",value:function(){var e,t,n,r,i,o,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"RongCloudRTC",a=arguments.length>1?arguments[1]:void 0;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function c(){var u,d,l,h,p,f,g,m,v;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(u=[],Kc(s)){c.next=3;break}return c.abrupt("return",{code:Zs.INVALID_TAGS,tracks:u});case 3:if(d=this._context.getCurrentId()){c.next=6;break}return c.abrupt("return",{code:Zs.INVALID_USER_ID,tracks:u});case 6:return l=eu(null===(e=null==a?void 0:a.video)||void 0===e?void 0:e.resolution)?a.video.resolution:mc.W640_H480,h=$c(l),p=h.width,f=h.height,c.next=12,this._getMediaStream({video:{deviceId:null===(t=null==a?void 0:a.video)||void 0===t?void 0:t.cameraId,frameRate:nu((null===(n=null==a?void 0:a.video)||void 0===n?void 0:n.frameRate)||gc.FPS_15),width:p,height:f,facingMode:null===(r=null==a?void 0:a.video)||void 0===r?void 0:r.faceMode},audio:{deviceId:null===(i=null==a?void 0:a.audio)||void 0===i?void 0:i.micphoneId,sampleRate:null===(o=null==a?void 0:a.audio)||void 0===o?void 0:o.sampleRate}});case 12:return g=c.sent,m=g.stream,v=g.code,c.abrupt("return",(v!==Zs.SUCCESS||m.getTracks().forEach((function(e){"video"===e.kind?u.push(new Uc(s,d,e)):u.unshift(new Lc(s,d,e))})),{code:v,tracks:u}));case 16:case"end":return c.stop()}}),c,this)})))}},{key:"createScreenVideoTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"screenshare",t=arguments.length>1?arguments[1]:void 0;return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s,a,c,u,d,l,h,p;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Kc(e)){n.next=2;break}return n.abrupt("return",{code:Zs.INVALID_TAGS});case 2:if(r=this._context.getCurrentId()){n.next=5;break}return n.abrupt("return",{code:Zs.INVALID_USER_ID});case 5:if(ou()){n.next=7;break}return n.abrupt("return",{code:Zs.BROWSER_NOT_SUPPORT});case 7:if(!(i=/Electron/.test(navigator.userAgent))||(null==t?void 0:t.chromeMediaSourceId)){n.next=10;break}return n.abrupt("return",{code:Zs.PARAMS_ERROR});case 10:return o=eu(null==t?void 0:t.resolution)?t.resolution:mc.W1280_H720,s=$c(o),a=s.width,c=s.height,u=i?{mandatory:{chromeMediaSourceId:t.chromeMediaSourceId,chromeMediaSource:"desktop",minWidth:a,maxWidth:a,minHeight:c,maxHeight:c}}:{frameRate:nu((null==t?void 0:t.frameRate)||gc.FPS_15),width:a,height:c},n.next=17,this._getMediaStream({video:u,audio:!1},i?"getUserMedia":"getDisplayMedia");case 17:if(d=n.sent,l=d.stream,(h=d.code)===Zs.SUCCESS){n.next=22;break}return n.abrupt("return",{code:h});case 22:return p=l.getVideoTracks()[0],n.abrupt("return",{code:h,track:new Dc(e,r,p)});case 24:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalAudioTrack",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Kc(e)){n.next=2;break}return n.abrupt("return",{code:Zs.INVALID_TAGS});case 2:if(t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind){n.next=4;break}return n.abrupt("return",{code:Zs.CREATE_CUSTOM_TRACK_FAILED});case 4:return r=this._context.getCurrentId(),n.abrupt("return",r?{code:Zs.SUCCESS,track:new Oc(e,r,t)}:{code:Zs.INVALID_USER_ID});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalVideoTrack",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Kc(e)){n.next=2;break}return n.abrupt("return",{code:Zs.INVALID_TAGS});case 2:if(t&&"[object MediaStreamTrack]"===t.toString()&&"video"===t.kind){n.next=4;break}return n.abrupt("return",{code:Zs.CREATE_CUSTOM_TRACK_FAILED});case 4:return r=this._context.getCurrentId(),n.abrupt("return",r?{code:Zs.SUCCESS,track:new Nc(e,r,t)}:{code:Zs.INVALID_USER_ID});case 6:case"end":return n.stop()}}),n,this)})))}},{key:"createLocalFileTracks",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Kc(e)){r.next=2;break}return r.abrupt("return",{code:Zs.INVALID_TAGS,tracks:[]});case 2:if(iu()){r.next=4;break}return r.abrupt("return",{code:Zs.BROWSER_NOT_SUPPORT,tracks:[]});case 4:if(i=t instanceof File?URL.createObjectURL(t):t,qe(i)||/^blob:/.test(i)){r.next=7;break}return r.abrupt("return",(ea.warn("createLocalFileTracks failed: params error -> url: ".concat(i)),{code:Zs.PARAMS_ERROR,tracks:[]}));case 7:return o=this._context.getCurrentId(),r.abrupt("return",o?new Promise((function(t){var r=document.createElement("video");(null==n?void 0:n.withoutAudio)&&(r.muted=!0),r.onloadedmetadata=function(){var a,c=[];try{var u=r.mozCaptureStream?"mozCaptureStream":"captureStream";a=r[u]()}catch(e){ea.error("create RCLocalFileTrack failed, captureSteam error. -> url: ".concat(i)),ea.error(e),t({code:Zs.CREATE_FILE_TRACK_FAILED,tracks:c})}var d=s(nd(a,n),2),l=d[0],h=d[1];l&&c.push(new xc(e,o,l,r)),h&&c.push(new Pc(e,o,h,r)),0===c.length&&(r.pause(),r.src=""),r.onerror=null,t({code:Zs.SUCCESS,tracks:c})},r.onerror=function(){ea.error("create RCLocalFileTrack failed -> url: ".concat(i)),t({code:Zs.CREATE_FILE_TRACK_FAILED,tracks:[]})},r.src=i,r.loop=!0,r.play()})):{code:Zs.INVALID_USER_ID,tracks:[]});case 9:case"end":return r.stop()}}),r,this)})))}},{key:"createLocalTracks",value:function(e,t,n){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function r(){var i,o,a,c,u,d;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=[],Kc(e)){r.next=3;break}return r.abrupt("return",{code:Zs.INVALID_TAGS,tracks:i});case 3:if(t instanceof MediaStream){r.next=5;break}return r.abrupt("return",{code:Zs.PARAMS_ERROR,tracks:i});case 5:if(o=this._context.getCurrentId()){r.next=8;break}return r.abrupt("return",{code:Zs.INVALID_USER_ID,tracks:i});case 8:return a=nd(t,n),c=s(a,2),u=c[0],d=c[1],r.abrupt("return",(u&&i.push(new Oc(e,o,u)),d&&i.push(new Nc(e,o,d)),{code:Zs.SUCCESS,tracks:i}));case 10:case"end":return r.stop()}}),r,this)})))}},{key:"joinLivingRoomAsAudience",value:function(e,t){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function n(){var r,i,o,s;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!uu(this._context.getNaviInfo())){n.next=2;break}return n.abrupt("return",{code:Zs.PACKAGE_ENVIRONMENT_ERROR});case 2:if(Wt("roomId",e,Be,!0)&&Wt("livingType",t,(function(e){return e===ju.AUDIO||e===ju.VIDEO}))){n.next=4;break}return n.abrupt("return",{code:Zs.PARAMS_ERROR});case 4:if(!this._crtAudienceLivingRoom){n.next=6;break}return n.abrupt("return",{code:Zs.REPERT_JOIN_ROOM});case 6:if(this._service.getNaviMS().length){n.next=8;break}return n.abrupt("return",{code:Zs.NOT_OPEN_VIDEO_AUDIO_SERVER});case 8:return n.next=10,this._context.joinLivingRoomAsAudience(e,wt.LIVE,t);case 10:if(r=n.sent,i=r.code,o=r.data,i===nt.SUCCESS){n.next=15;break}return n.abrupt("return",(ea.error("audienceJoinLivingRoomError:",i),{code:Zs.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}));case 15:return ea.info("joinLivingRoomAsAudience success, room data: ".concat(JSON.stringify(o))),s=new td(this._context,this._runtime,this._options,e,o,t),n.abrupt("return",(this._crtAudienceLivingRoom=s,{room:s,code:Zs.SUCCESS,userIds:s.getRemoteUserIds(),RTCTracks:s.getRemoteRTCTracks(),MCUTracks:s.getRemoteMCUTracks(),CDNUris:s.getCDNInfo()}));case 18:case"end":return n.stop()}}),n,this)})))}},{key:"leaveLivingRoomAsAudience",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this._crtAudienceLivingRoom){t.next=12;break}if(this._crtAudienceLivingRoom===e){t.next=5;break}t.t1={code:Zs.PARAMS_ERROR},t.next=9;break;case 5:return t.next=7,this._crtAudienceLivingRoom.__destroy(!0);case 7:this._crtAudienceLivingRoom=null,t.t1={code:Zs.SUCCESS};case 9:t.t0=t.t1,t.next=13;break;case 12:t.t0={code:Zs.SUCCESS};case 13:return t.abrupt("return",t.t0);case 14:case"end":return t.stop()}}),t,this)})))}},{key:"upgradeToAnchorRoom",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Wt("room._roomId",e._roomId,Be,!0)){t.next=2;break}return t.abrupt("return",{code:Zs.PARAMS_ERROR});case 2:if(!this._crtRoom){t.next=4;break}return t.abrupt("return",{code:Zs.REPERT_JOIN_ROOM});case 4:return t.next=6,this._context.rtcIdentityChange(e._roomId,Pt.ViewerToAnchor,e._livingType);case 6:if(n=t.sent,r=n.code,i=n.data,r===nt.SUCCESS){t.next=11;break}return t.abrupt("return",(ea.error("change room identity error",r),{code:Zs.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}));case 11:return t.next=13,this._crtAudienceLivingRoom.__destroy(!1);case 13:return o=new Wu(this._context,this._runtime,e._roomId,i,this._service,this._options,this._releaseCrtRoomObj.bind(this),e._livingType,!0,!0),t.abrupt("return",(this._crtRoom=o,this._crtAudienceLivingRoom=null,{room:o,code:Zs.SUCCESS,userIds:e.getRemoteUserIds(),tracks:o.getRemoteTracks()}));case 15:case"end":return t.stop()}}),t,this)})))}},{key:"downgradeToAudienceRoom",value:function(e){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,r,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Wt("room._roomId",e._roomId,Be,!0)){t.next=2;break}return t.abrupt("return",{code:Zs.PARAMS_ERROR});case 2:if(!this._crtAudienceLivingRoom){t.next=4;break}return t.abrupt("return",{code:Zs.REPERT_JOIN_ROOM});case 4:return t.next=6,this._context.rtcIdentityChange(e._roomId,Pt.AnchorToViewer,e.getLivingType());case 6:if(n=t.sent,r=n.code,i=n.data,r===nt.SUCCESS){t.next=11;break}return t.abrupt("return",(ea.error("change room identity error",r),{code:Zs.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}));case 11:return ea.info("downgradeToAudienceRoom success, room data: ".concat(JSON.stringify(i))),o=new td(this._context,this._runtime,this._options,e._roomId,i,e.getLivingType()),t.abrupt("return",(this._crtAudienceLivingRoom=o,this._crtRoom.__destroy(!1),this._crtRoom=null,{room:o,code:Zs.SUCCESS,userIds:o.getRemoteUserIds(),RTCTracks:o.getRemoteRTCTracks(),MCUTracks:o.getRemoteMCUTracks(),CDNUris:o.getCDNInfo()}));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"getJoinedRoomInfo",value:function(){return Xs(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._context.getRTCJoinedUserInfo(this._context.getCurrentId());case 2:return t=e.sent,n=t.code,r=t.data,e.abrupt("return",n!==nt.SUCCESS?(ea.error("getJoinedUserInfo error",n),{code:Zs.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}):{code:Zs.SUCCESS,data:r});case 6:case"end":return e.stop()}}),e,this)})))}}]),e}();!function(e){e[e.SERVER_KICK=1]="SERVER_KICK",e[e.OTHER_KICK=2]="OTHER_KICK"}($u||($u={}));var id={tag:"RCRTC",verify:function(e){return"browser"!==e.tag?(ea.error("RCRTC Plugin is not support the runtime '".concat(e.tag,"'")),!1):qc?(Bt.add("plugin-rtc","5.3.1"),!!Bt.validEngine("5.1.0")||(ea.error("The current engine version '".concat(Bt.getInfo().engine,"' error, plugin-rtc required engine version at least '5.1.0'.")),!1)):(ea.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ea.setLogLevel(n.logLevel),ea.setLogStdout(n.logStdout),ea.warn("RCRTC Version: 5.3.1, Commit: e1af0f5ccb06a0084c94e1219d8af54c9793c06b"),ea.warn("browserInfo.browser -> ".concat(ru.browser)),ea.warn("browserInfo.supportsUnifiedPlan -> ".concat(ru.supportsUnifiedPlan)),ea.warn("browserInfo.version -> ".concat(ru.version)),Jt("options.mediaServer",n.mediaServer,(function(e){return!(!qe(e)||"https:"===location.protocol&&!/^https/.test(e))})),Jt("options.timeout",n.timeout,(function(e){return Ue(e)&&e>=5e3&&e<=3e4})),Jt("options.pingGap",n.pingGap,(function(e){return Ue(e)&&e>=3e3&&e<=1e4})),new rd(e,t,n)}},od={transResolution:$c,transFrameRate:nu,parseTrackId:zc,ifSupportLocalFileTrack:iu,ifSupportScreenShare:ou};var sd={"RC:Chatroom:Welcome":"Welcome","RC:TxtMsg":"Text","RC:Chatroom:Barrage":"Barrage","RC:Chatroom:Like":"Like","RC:Chatroom:SeatsCtrl":"SeatsCtrl","RC:Chatroom:ChatBan":"ChatBan","RC:Chatroom:SeatApply":"SeatApply","RC:Chatroom:SeatResponse":"SeatResponse","RM:RTC:TrackUnpublish":"TrackUnpublish","RM:RTC:SwitchRole":"SwitchRole","RM:RTC:UserLeave":"UserLeave","RC:Chatroom:Leave":"Leave"},ad=function(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}}}(),cd=p({roomUid:"LIVE-2112263-12345",imConnectStatus:"connecting",screenShareStatus:!1,videoRef:y(null),rtcClient:null,joinedRoom:null,mediaStreamTrack:[],mediaStreams:null,videoStatus:"init",microphones:[],cameras:[],selectedCamera:null,selectedMicrophone:null,likeCount:0,lastLikeCount:0,activeTracks:{},allowSeatsCtrl:!0,allowChatCtrl:!0,deviceStatus:{microphone:"init",camera:"init",screen:"init"}}),ud=cd;!function(e){is=is||new os(e)}({appkey:"c9kqb3rdc451j"});var dd=Qs("RC:Chatroom:SeatsCtrl",!0,!0),ld=Qs("RC:Chatroom:ChatBan",!0,!0),hd=Qs("RC:Chatroom:SeatApply",!0,!0),pd=Qs("RC:Chatroom:SeatResponse",!0,!0),fd=Ao,gd=(fd.MESSAGES,o(fd,e));fs(fd.MESSAGES,(function(e){console.log(e,"收到消息");var t,n=C(e.messages);try{for(n.s();!(t=n.n()).done;){var r=t.value;sd[r.messageType]&&ad.emit(sd[r.messageType],i(i({},r.content),{},{$EventMessage:r}))}}catch(o){n.e(o)}finally{n.f()}}));for(var md=function(){var e=_d[vd];fs(e,(function(t){console.log(e,t),ad.emit(e,{$EventMessage:null})}))},vd=0,_d=Object.values(gd);vd<_d.length;vd++)md();fs(fd.CONNECTING,(function(){console.log("connecting"),cd.imConnectStatus="connecting"})),fs(fd.CONNECTED,(function(){console.log("connected"),cd.imConnectStatus="connected"})),fs(fd.DISCONNECT,(function(){console.log("disconnect"),cd.imConnectStatus="disconnect"}));var yd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ps(t);case 3:return r=e.sent,cd.rtcClient=hs(id,{}),console.log("connect success",null===(n=r.data)||void 0===n?void 0:n.userId),e.abrupt("return",r);case 9:throw e.prev=9,e.t0=e.catch(0),e.t0;case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}(),Rd=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!cd.rtcClient){e.next=9;break}return e.next=3,Id("screen");case 3:n=e.sent,r=cd.activeTracks.camera,null===(t=cd.joinedRoom)||void 0===t||t.unpublish([r]),bd([n],"screen"),cd.videoRef&&n.play(cd.videoRef),null==n||n.on(wc.EVENT_LOCAL_TRACK_END,(function(e){cd.screenShareStatus=!1,e.destroy(),bd([r],"camera"),cd.videoRef&&r.play(cd.videoRef)}));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Cd=function(){var e=n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ic();case 2:return t=e.sent,cd.microphones=t,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ed=function(){var e=n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Sc();case 2:return t=e.sent,cd.cameras=t,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Td=function(e){cd.selectedCamera=e},Sd=function(e){cd.selectedMicrophone=e},Id=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,s,a,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null,"microphone"!==t){e.next=7;break}return e.next=4,null===(o=cd.rtcClient)||void 0===o?void 0:o.createMicrophoneAudioTrack("RongCloudRTC",{micphoneId:null===(s=cd.selectedMicrophone)||void 0===s?void 0:s.deviceId});case 4:r=e.sent,e.next=16;break;case 7:if("camera"!==t){e.next=13;break}return e.next=10,null===(a=cd.rtcClient)||void 0===a?void 0:a.createCameraVideoTrack("RongCloudRTC",{cameraId:null===(c=cd.selectedCamera)||void 0===c?void 0:c.deviceId,faceMode:"user",frameRate:gc.FPS_15,resolution:mc.W1280_H720});case 10:r=e.sent,e.next=16;break;case 13:return e.next=15,null==cd||null===(u=cd.rtcClient)||void 0===u?void 0:u.createScreenVideoTrack();case 15:r=e.sent;case 16:return i=null===(n=r)||void 0===n?void 0:n.track,r.code===Zs.PERMISSION_DENIED?cd.deviceStatus[t]="denied":cd.deviceStatus[t]="granted",e.abrupt("return",i);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),bd=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,i,o,s,a,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!(c.length>2&&void 0!==c[2])||c[2],i=C(t);try{for(i.s();!(o=i.n()).done;)s=o.value,cd.activeTracks[n]=s}catch(u){i.e(u)}finally{i.f()}if(!r){e.next=6;break}return e.next=6,null===(a=cd.joinedRoom)||void 0===a?void 0:a.publish(t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),kd=function(){var e=n(regeneratorRuntime.mark((function e(t,n){var r,i,o,s,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=!(a.length>2&&void 0!==a[2])||a[2],i=C(t);try{for(i.s();!(o=i.n()).done;)o.value.destroy(),cd.activeTracks[n]=null}catch(c){i.e(c)}finally{i.f()}if(!r){e.next=6;break}return e.next=6,null===(s=cd.joinedRoom)||void 0===s?void 0:s.unpublish(t);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),wd=function(){var e=n(regeneratorRuntime.mark((function e(t,n,r){var i,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,gs(t,{count:-1});case 2:return e.next=4,null===(i=cd.rtcClient)||void 0===i?void 0:i.joinLivingRoom(t,n);case 4:if((null==(s=e.sent)?void 0:s.code)==Zs.SUCCESS){e.next=7;break}throw Error("加入房间失败");case 7:return null===(o=s.room)||void 0===o||o.registerRoomEventListener(r),e.abrupt("return",s);case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Od=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,r,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("stream"===cd.videoStatus){e.next=2;break}throw Error("当前无视频流");case 2:if(!cd.joinedRoom){e.next=23;break}return e.next=6,Id("microphone");case 6:return r=e.sent,console.log(r),e.next=10,Id("camera");case 10:return i=e.sent,e.next=13,bd([i],"camera");case 13:return cd.videoStatus="liveing",e.next=16,bd([r],"microphone");case 16:return e.next=18,null===(t=cd.joinedRoom)||void 0===t?void 0:t.getMCUConfigBuilder();case 18:return o=e.sent,e.next=21,null===(n=o.setOutputVideoRenderMode)||void 0===n?void 0:n.call(o,Lu.WHOLE);case 21:return e.next=23,o.flush();case 23:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Nd=function(){var e=n(regeneratorRuntime.mark((function e(){var t,n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.post("/api-im/user/statusImUser",{data:{os:"PC",status:2,userId:null===(t=r.user)||void 0===t?void 0:t.id}});case 2:for(n in cd.videoStatus="stopped",cd.activeTracks)Object.prototype.hasOwnProperty.call(cd.activeTracks,n)&&(i=cd.activeTracks[n])&&kd([i],n);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ad=function(){var e=n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(cd.likeCount===cd.lastLikeCount&&0!==cd.likeCount){e.next=9;break}return e.prev=1,e.next=4,u.get("/api-web/imLiveBroadcastRoom/syncLike",{hideLoading:!0,hideMessage:!0,params:{likeNum:cd.likeCount,roomUid:cd.roomUid}});case 4:cd.lastLikeCount=cd.likeCount,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:setTimeout((function(){Ad()}),6e4);case 10:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}(),Md=function(){var e,t,n,i;return{id:null===(e=r.user)||void 0===e?void 0:e.speakerId,name:null===(t=r.user)||void 0===t?void 0:t.speakerName,userId:null===(n=r.user)||void 0===n?void 0:n.speakerId,userName:null===(i=r.user)||void 0===i?void 0:i.speakerName}},Pd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>1&&void 0!==s[1]?s[1]:"text",i=null,t){e.next=4;break}return e.abrupt("return");case 4:if(o={conversationType:Ne.CHATROOM,targetId:null===(n=cd.joinedRoom)||void 0===n?void 0:n._roomId},"text"===r?i=new Ts({user:Md(),content:t}):"SeatsCtrl"===r?i=new dd(t):"ChatBan"===r?i=new ld(t):"SeatApply"===r?i=new hd(t):"SeatResponse"===r&&(i=new pd(t)),i){e.next=8;break}return e.abrupt("return");case 8:return console.log(i),e.next=11,Ws(o,i);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),xd=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(o.length>1&&void 0!==o[1])||o[1],"microphone"!==t||!cd.activeTracks[t]){e.next=5;break}null===(r=cd.activeTracks[t])||void 0===r||r.unmute(),e.next=11;break;case 5:return e.next=7,Id(t);case 7:return i=e.sent,e.next=10,bd([i],t,n);case 10:cd.videoRef&&i.play(cd.videoRef);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ld=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(i.length>1&&void 0!==i[1])||i[1],r=cd.activeTracks[t],"microphone"===t){e.next=8;break}return e.next=5,kd([r],t,n);case 5:null==r||r.destroy(),e.next=9;break;case 8:null==r||r.mute();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ud=function(){var e=n(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=cd.activeTracks[t],r="liveing"===cd.videoStatus,n?Ld(t,r):xd(t,r);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Dd=E({methods:{loginOut:function(){var e=this;return n(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,u.post("/api-auth/exit",{data:{}});case 3:Ld("camera"),Ld("microphone"),T.success("退出成功"),l(),e.$router.push({path:"/login",query:i({},e.$route.query)}),t.next=12;break;case 10:t.prev=10,t.t0=t.catch(0);case 12:case"end":return t.stop()}}),t,null,[[0,10]])})))()}},render:function(){var e,t,n,i=this;return I("div",{class:W},[I("div",{class:Q},[I("div",{class:X},[I("img",{class:z,src:null===(e=r.user)||void 0===e?void 0:e.tenantLogo,alt:""},null),null===(t=r.user)||void 0===t?void 0:t.tenantName]),I("div",{class:Z},[b("《"),null===(n=r.user)||void 0===n?void 0:n.roomTitle,b("》")])]),I(k,{trigger:"hover"},{default:function(){var e;return[I("div",{class:$},[I("img",{class:ee,src:"/src/assets/home/placehorder-icon.png"},null),I("span",null,[null===(e=r.user)||void 0===e?void 0:e.speakerName])])]},dropdown:function(){return I(w,null,{default:function(){return[I(O,{command:"1",onClick:i.loginOut},{default:function(){return[I("span",null,[b("安全退出")])]}})]}})}})])}}),Vd="_header_22t18_1",Bd="_title_22t18_9",Fd=E({name:"LiveBroadcastHeader",methods:{startLive:function(){return n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,N.confirm("是否确认开始直播?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:return e.next=5,Od();case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,null,[[0,7]])})))()},closeLive:function(){return n(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,N.confirm("是否确认结束直播?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"});case 3:return e.next=5,u.post("/api-im/user/statusImUser",{data:{os:"IOS",status:"2",userid:null===(t=r.user)||void 0===t?void 0:t.id}});case 5:return e.next=7,Nd();case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}}),e,null,[[0,9]])})))()}},render:function(){var e;return I("div",{class:Vd},[I("h3",{class:Bd},[b("直播内容:"),null===(e=r.user)||void 0===e?void 0:e.liveRemark]),"liveing"===ud.videoStatus?I(A,{type:"danger",color:"#EA4132",onClick:this.closeLive},{default:function(){return[b("关闭直播")]}}):I(A,{type:"primary",color:"#01A79E",onClick:this.startLive},{default:function(){return[b("开始直播")]}})])}}),jd="_action-bar_4c7vc_1",Hd="_bar-btn_4c7vc_12",Kd="_bar-btn-text_4c7vc_19",qd="_volumeSlider_4c7vc_68",Gd="_volumeIcon_4c7vc_77",Yd="_btnInner_4c7vc_82",Jd={shareWrap:"_shareWrap_9b5uw_1",shareBtn:"_shareBtn_9b5uw_27"},Wd=E({name:"LiveBroadcastSharePreview",props:["form"],data:function(){return{detail:{roomTitle:"",liveStartTime:"",liveRemark:""},url:"http://www.baidu.com"}},methods:{copyText:function(){},shareImage:function(){}},render:function(){return I("div",{id:"preview"},["1"===this.form.preTemplate?I("div",{class:"first"},[I("h2",null,[this.form.roomTitle]),I("p",{class:"teacher"},[b("主讲人:"),this.form.teacherName]),I("img",{src:"./images/icon1.png",class:"icon",alt:""},null),I("div",{class:"preCore"},[I("img",{src:"./images/start.png",class:"start",alt:""},null),I("p",{class:"title"},[b("开播时间")]),I("p",{class:"time"},[this.form.liveStartTime]),I("p",{class:"title"},[b("直播内容")]),I("div",{class:"content"},[I("img",{class:"pre",src:"./images/icon5.png",alt:""},null),I("img",{class:"end",src:"./images/icon4.png",alt:""},null),this.form.liveRemark])]),I("div",{class:"bottom"},[I("img",{class:"logo",src:"./images/logo.png",alt:""},null),I("div",{class:"code"},[I("div",null,[I(M("vue-qr"),{text:this.url,style:"width: 100%; margin='0'"},null)])])])]):null,"2"===this.form.preTemplate?I("div",{class:"second"},[I("h2",null,[this.form.roomTitle]),I("p",{class:"teacher"},[b("主讲人:"),this.form.teacherName]),I("img",{src:"./images/icon2.png",class:"icon",alt:""},null),I("div",{class:"preCore"},[I("img",{src:"./images/start.png",class:"start",alt:""},null),I("p",{class:"title"},[b("开播时间")]),I("p",{class:"time"},[this.form.liveStartTime]),I("p",{class:"title"},[b("直播内容")]),I("div",{class:"content"},[I("img",{class:"pre",src:"./images/icon5.png",alt:""},null),I("img",{class:"end",src:"./images/icon4.png",alt:""},null),this.form.liveRemark])]),I("div",{class:"bottom"},[I("img",{class:"logo",src:"./images/logo.png",alt:""},null),I("div",{class:"code"},[I("div",null,[I(M("vue-qr"),{text:this.url,style:"width: 100%;margin='0'"},null)])])])]):null,"3"===this.form.preTemplate?I("div",{class:"third"},[I("h2",null,[this.form.roomTitle]),I("p",{class:"teacher"},[b("主讲人:"),this.form.teacherName]),I("img",{src:"./images/icon3.png",class:"icon",alt:""},null),I("div",{class:"preCore"},[I("img",{src:"./images/start.png",class:"start",alt:""},null),I("p",{class:"title"},[b("开播时间")]),I("p",{class:"time"},[this.form.liveStartTime]),I("p",{class:"title"},[b("直播内容")]),I("div",{class:"content"},[I("img",{class:"pre",src:"./images/icon5.png",alt:""},null),I("img",{class:"end",src:"./images/icon4.png",alt:""},null),this.form.liveRemark])]),I("div",{class:"bottom"},[I("img",{class:"logo",src:"./images/logo.png",alt:""},null),I("div",{class:"code"},[I("div",null,[I(M("vue-qr"),{text:this.url,style:"width: 100% margin:0"},null)])])])]):null])}}),zd=E({name:"LiveBroadcastShare",data:function(){return{form:{shareType:"2"},detail:{roomTitle:"",liveStartTime:"",liveRemark:""}}},mounted:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var n,r,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=JSON.parse(sessionStorage.getItem("details")||"")){t.next=10;break}return r=sessionStorage.getItem("roomUid"),t.next=5,u.get("/api-web/imLiveBroadcastRoom/queryRoom",{params:{roomUid:r}});case 5:o=t.sent,sessionStorage.setItem("details",o.data),e.detail=i({},o.data),t.next=11;break;case 10:e.detail=i({},n);case 11:case"end":return t.stop()}}),t)})))()},methods:{copyText:function(){},shareImage:function(){},changeRafdio:function(e){this.form.shareType=e}},render:function(){var e=this;return I("div",null,[I(P,{model:this.form,ref:"form",class:Jd.form},{default:function(){return[I(x,{label:"分享方式"},{default:function(){return[I(L,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("1")},label:"1"},{default:function(){return[b("链接分享")]}}),I(L,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("2")},label:"2"},{default:function(){return[b("二维码分享")]}}),I(L,{modelValue:e.form.shareType,onChange:function(){e.changeRafdio("3")},label:"3"},{default:function(){return[b("群聊分享")]}})]}})]}}),I("div",null,["1"===this.form.shareType?I("div",{class:"linkWrap"},[I("div",{class:Jd.shareWrap},[I("h2",null,[b("乐团老师邀请您参与直播课!")]),I("h4",null,[this.detail.roomTitle]),I("p",null,[b("直播时间:"),this.detail.liveStartTime]),I("p",null,[b("直播内容:"),this.detail.liveRemark]),I("p",null,[b("直播地址:")])]),I("div",{class:Jd.shareBtn,onClick:this.copyText},[b("复制分享内容")])]):null]),"2"===this.form.shareType?I("div",{class:Jd.codeWrap},[I("div",{class:Jd.shareWrap},[I(Wd,{form:this.detail},null)]),I("div",{class:Jd.shareBtn,onClick:this.shareImage},[b("复制分享内容")])]):null,"3"==this.form.shareType?I("div",{class:Jd.groupWrap},null):null])}});function Qd(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!U(e)}var Xd,Zd,$d=E({name:"LiveBroadcast-ActionBar",data:function(){return{volume:30,barStatus:{camera:!1,volume:!1,microphone:!1,screen:!1,share:!1},shareVisiable:!1}},computed:{isCameraDisabled:function(){return this.barStatus.camera&&"denied"!==ud.deviceStatus.camera},isMicrophoneDisabled:function(){return this.barStatus.microphone&&"denied"!==ud.deviceStatus.microphone},isVolumeDisabled:function(){return this.barStatus.volume&&0===this.volume}},methods:{startShare:function(){console.log("调用"),this.shareVisiable=!0},volumeChange:function(e){this.volume=e,function(e){cd.videoRef&&(cd.videoRef.volume=e/100)}(e)}},render:function(){var e=this;return I("div",{class:jd,id:"action-bar"},[I("div",{style:{display:"flex"}},[I("div",{class:Hd},[I("div",{class:Yd},[I(M("SvgIcon"),{onClick:function(){e.barStatus.camera=!e.barStatus.camera,Ud("camera")},name:this.isCameraDisabled?"bar-camera-disabled":"bar-camera",style:{width:"22px",cursor:"pointer"}},null),I(k,{placement:"top",onCommand:Td},{default:function(){return[I("div",{class:Hd,style:{height:"32px"}},[I(M("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){var e;return I(w,null,Qd(e=ud.cameras.map((function(e){return I(O,{command:e},{default:function(){return[e.label]}})})))?e:{default:function(){return[e]}})}})]),I("span",{class:Kd},[b("摄像头")])]),I("div",{class:Hd},[I("div",{class:Yd},[I(M("SvgIcon"),{onClick:function(){e.barStatus.volume=!e.barStatus.volume,e.volume=0},name:this.isVolumeDisabled?"bar-volume-disabled":"bar-volume",style:{width:"22px",cursor:"pointer"}},null),I(k,{placement:"top-start","popper-options":{boundariesElement:"#action-bar",gpuAcceleration:!1}},{default:function(){return[I("div",{class:Hd,style:{height:"32px"}},[I(M("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){return I("div",{class:qd},[I(M("SvgIcon"),{class:Gd,name:"message-voice",color:"#fff"},null),I(D,{modelValue:e.volume,onInput:e.volumeChange,size:"small"},null)])}})]),I("span",{class:Kd},[b("音量调节")])]),I("div",{class:Hd,onClick:Rd},[I("div",{class:Yd},[I(M("SvgIcon"),{name:"bar-screen-share",style:{width:"22px",cursor:"pointer"}},null)]),I("span",{class:Kd},[b("屏幕共享")])]),I("div",{class:Hd},[I("div",{class:Yd},[I(M("SvgIcon"),{onClick:function(){var t="liveing"===ud.videoStatus;e.barStatus.microphone=!e.barStatus.microphone,e.barStatus.microphone?Ld("microphone",t):xd("microphone",t)},name:this.isMicrophoneDisabled?"bar-mike-disabled":"bar-mike",style:{width:"22px",cursor:"pointer"}},null),I(k,{placement:"top-start","popper-options":{boundariesElement:"#action-bar",gpuAcceleration:!1},onCommand:Sd},{default:function(){return[I("div",{class:Hd,style:{height:"32px"}},[I(M("SvgIcon"),{name:"bar-arrow-down",style:{width:"18px"}},null)])]},dropdown:function(){var e;return I(w,null,Qd(e=ud.microphones.map((function(e){return I(O,{command:e},{default:function(){return[e.label]}})})))?e:{default:function(){return[e]}})}})]),I("span",{class:Kd},[b("麦克风")])])]),I("div",{style:{display:"flex"},onClick:this.startShare},[I("div",{class:Hd},[I("div",{class:Yd},[I(M("SvgIcon"),{name:"bar-share",style:{width:"22px",cursor:"pointer"}},null)]),I("span",{class:Kd},[b("分享")])])]),I(V,{width:"510px","append-to-body":!0,modelValue:this.shareVisiable,title:"分享","before-close":function(){e.shareVisiable=!1}},{default:function(){return[I(zd,null,null)]}})])}}),el={container:"_container_19awp_1",title:"_title_19awp_21",tips:"_tips_19awp_25"},tl=E({name:"VideoStatus",render:function(){return I("div",{class:el.container},["denied"===ud.deviceStatus.camera?I("div",{class:el.denied},[I(M("SvgIcon"),{name:"camera-status",class:el.icon},null),I("p",{class:el.title},[b("摄像头被禁用")]),I("p",{class:el.tips},[b("请授权允许访问摄像头")])]):null,"init"===ud.deviceStatus.camera?I("div",{class:el.init},[I(M("SvgIcon"),{name:"camera-status",class:el.icon},null),I("p",{class:el.title},[b("请完成摄像头授权")]),I("p",{class:el.tips},[b("请授权允许访问摄像头")])]):null])}}),nl=function(){var e=n(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator){e.next=2;break}throw new Error("浏览器版本过低");case 2:if(t){e.next=4;break}return e.abrupt("return",[]);case 4:return e.abrupt("return",(n||[]).map((function(e){return t.removeTrack(e)})));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),rl="_main_1b4ip_1",il="_video_1b4ip_12",ol=y(null),sl=E({name:"LiveBroadcast",mounted:function(){var e=this;return n(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.initializeRoom(),Ad(),ad.on(sd["RC:Chatroom:Like"],e.onLikeMessage);case 3:case"end":return t.stop()}}),t)})))()},beforeUnmount:function(){ad.off(sd["RC:Chatroom:Like"],this.onLikeMessage)},methods:{onLikeMessage:function(e){ud.likeCount+=e.counts},initializeRoom:function(){return n(regeneratorRuntime.mark((function e(){var t,i,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.user){e.next=2;break}throw Error("请先登录");case 2:return e.prev=2,e.next=5,yd(null===(t=r.user)||void 0===t?void 0:t.imToken);case 5:return ud.videoRef=ol.value,e.next=8,Cd();case 8:return e.next=10,Ed();case 10:return Td(ud.cameras[0]),Sd(ud.microphones[0]),e.next=14,Id("camera");case 14:return Zd=e.sent,ud.videoRef&&Zd.play(ud.videoRef),e.next=18,bd([Zd],"camera");case 18:return e.next=20,Id("microphone");case 20:return Xd=e.sent,ud.videoRef&&Xd.play(ud.videoRef),console.log(ud.deviceStatus),ud.videoStatus="stream",e.next=26,wd(null===(i=r.user)||void 0===i?void 0:i.roomUid,ju.VIDEO,{onMessageReceive:function(e,t){console.log(e,t)},onKickOff:function(e){console.log(e)},onTrackPublish:function(e){return n(regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==o||null===(n=o.room)||void 0===n?void 0:n.subscribe(e);case 2:r=t.sent,console.log(r),null!=r&&r.code&&r.code!==Zs.SUCCESS&&console.log("资源订阅失败 ->",r.code);case 5:case"end":return t.stop()}}),t)})))()},onTrackUnpublish:function(e){console.log(e),ad.emit(sd["RM:RTC:TrackUnpublish"],e)},onSwitchRole:function(e,t){ad.emit(sd["RM:RTC:SwitchRole"],{userId:e,role:t})},onTrackReady:function(e){e.isAudioTrack()&&e.play()},onUserJoin:function(e){console.log("onUserJoin",e)},onUserLeave:function(e){ad.emit(sd["RM:RTC:UserLeave"],e),console.log("onUserLeave",e)}});case 26:(o=e.sent).room&&o.code===Zs.SUCCESS&&(ud.joinedRoom=o.room),e.next=34;break;case 30:e.prev=30,e.t0=e.catch(2),ud.videoStatus="error",console.log(e.t0);case 34:case"end":return e.stop()}}),e,null,[[2,30]])})))()},closeLive:function(){nl(ud.mediaStreams,ud.mediaStreamTrack),ud.videoStatus="stopped"}},render:function(){return I("div",{class:rl},[I(Fd,null,null),I("div",{class:il},[I("video",{ref:ol},null),I(tl,null,null)]),I($d,null,null)])}}),al="_container_jmhhf_1",cl="_dataCount_jmhhf_6",ul="_num_jmhhf_17",dl="_text_jmhhf_22",ll="_dataIcon_jmhhf_26",hl="_tabContainer_jmhhf_31",pl="_tabIcon_jmhhf_31",fl="_tabContent_jmhhf_58",gl="_tabList_jmhhf_64",ml="_message_4zab7_1",vl="_buttonGroup_4zab7_1",_l=E({name:"message",data:function(){return{options:"ALL"}},methods:{SeatsCtrl:function(){return n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pd(i({seatBan:ud.allowSeatsCtrl},Md()),"SeatsCtrl");case 2:ud.allowSeatsCtrl=!ud.allowSeatsCtrl;case 3:case"end":return e.stop()}}),e)})))()},ChatBan:function(){return n(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pd(i({chatBan:ud.allowChatCtrl},Md()),"ChatBan");case 2:ud.allowChatCtrl=!ud.allowChatCtrl;case 3:case"end":return e.stop()}}),e)})))()}},render:function(){return I("div",{class:ml},[I("div",{class:vl},[I(A,{type:ud.allowChatCtrl?"info":"primary",onClick:this.ChatBan},{default:function(){return[ud.allowChatCtrl?"全体禁言":"关闭全体禁言"]}}),I(A,{type:ud.allowSeatsCtrl?"info":"primary",onClick:this.SeatsCtrl},{default:function(){return[ud.allowSeatsCtrl?"禁止连麦":"关闭禁止连麦"]}})])])}}),yl="_sendMessage_p2cnx_1",Rl="_form_p2cnx_10",Cl=p({messageList:[],joinList:{},lookList:[]}),El=Cl,Tl=function(e){Cl.messageList.push(e)},Sl=function(e,t){Cl.joinList[e]=t},Il=function(e){delete Cl.joinList[e]},bl=E({data:function(){return{message:""}},methods:{sendMessage:function(){var e=this;return n(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Pd(e.message);case 3:n=Md(),Tl({id:n.id,name:n.name,content:e.message,isSelf:!0,sendTime:B(new Date).format("HH:mm:ss")}),e.message="",t.next=10;break;case 8:t.prev=8,t.t0=t.catch(0);case 10:case"end":return t.stop()}}),t,null,[[0,8]])})))()}},render:function(){var e=this;return I("div",{class:yl},[I("div",{class:Rl},[I(F,{modelValue:this.message,onInput:function(t){return e.message=t},placeholder:"请输入消息"},null),I(A,{disabled:!this.message,onClick:this.sendMessage,round:!0,type:"primary"},{default:function(){return[b("发送")]}})])])}}),kl="_itemContent_7upzu_1",wl="_itemInfo_7upzu_11",Ol="_itemName_7upzu_14",Nl="_userName_7upzu_21",Al="_name-style_7upzu_28",Ml="_rightTime_7upzu_35",Pl="_itemText_7upzu_42",xl="_active_7upzu_46",Ll="_joinText_7upzu_49",Ul="_join_7upzu_49",Dl="_btn_7upzu_58",Vl="_downBtn_7upzu_70",Bl="_loadingStyle_7upzu_75",Fl={"empty-container":"_empty-container_1svqd_1",icon:"_icon_1svqd_9"},jl=E({props:{text:{type:String,default:"暂无数据"},icon:{type:String,default:"noData-no-message"}},render:function(){return I("div",{class:Fl["empty-container"]},[I(M("SvgIcon"),{name:this.icon,class:[Fl.icon]},null),I("p",{class:Fl["empty-text"]},[this.text])])}}),Hl=E({data:function(){return{joinList:{},loadingJoin:!1}},computed:{count:function(){var e=0;for(var t in El.joinList){if(Object.prototype.hasOwnProperty.call(El.joinList,t))if(3===El.joinList[t].type&&(e+=1),e>3)break}return e}},mounted:function(){ad.on(sd["RC:Chatroom:SeatApply"],this.onSeatApply),ad.on(sd["RC:Chatroom:SeatResponse"],this.onSeatApply),ad.on(sd["RM:RTC:UserLeave"],this.onSeatApply),ad.on(sd["RM:RTC:SwitchRole"],this.onSwitchRole)},methods:{onSeatApply:function(e){if(Array.isArray(e)){var t,n=C(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;console.log("onSeatApply",r),Il(r)}}catch(i){n.e(i)}finally{n.f()}}else 3===e.type&&Sl(e.audienceId,{name:e.audienceName,id:e.audienceId,type:e.type}),4===e.type&&El.joinList[e.audienceId]&&Il(e.audienceId)},agree:function(e){var t,n;if(!(this.count>3)){var o=i(i({},e),{},{audienceName:e.name,audienceId:e.id,teacherId:null===(t=r.user)||void 0===t?void 0:t.id,teacherName:null===(n=r.user)||void 0===n?void 0:n.speakerName,type:1});Sl(e.id,o),Pd(o,"SeatResponse")}},refuse:function(e){var t,n,o=i(i({},e),{},{audienceName:e.name,audienceId:e.id,teacherId:null===(t=r.user)||void 0===t?void 0:t.id,teacherName:null===(n=r.user)||void 0===n?void 0:n.speakerName,type:5});Sl(e.id,o),Pd(o,"SeatApply")},onSwitchRole:function(e){El.joinList[e.userId]&&2===e.role&&Il(e.userId)}},render:function(){var e=this,t=Object.values(El.joinList);return I("div",{style:{minHeight:"100%",position:"relative"}},[t.length>0?t.map((function(t){return I("div",{class:kl},[I("div",{class:wl},[I("div",{class:Ol},[I("p",{class:Nl},[I("span",{class:Al},[t.name]),3===t.type?I("p",{style:{paddingLeft:"10px"}},[b("申请连麦")]):I("p",{style:{paddingLeft:"10px",color:"var(--live-text-color)"}},[b("正在连麦")])]),3===t.type?I("div",{class:Ll},[I("div",{class:Ul},null),I(A,{size:"small",type:"primary",disabled:e.count>3,class:Dl,onClick:function(){return e.agree(t)}},{default:function(){return[b("上麦")]}})]):I("div",{class:Ll},[I("div",{class:Ul},null),I(A,{size:"small",plain:!0,class:[Dl,Vl],onClick:function(){return e.refuse(t)}},{default:function(){return[b("下麦")]}})])])])])})):this.loadingJoin?I("div",{class:Bl},[I("div",{class:"el-loading-mask",style:"background-color: rgba(0, 0, 0, 0.8);"},[I("div",{class:"el-loading-spinner"},[I("svg",{class:"circular",viewBox:"25 25 50 50"},[I("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"},null)])])])]):I(jl,{style:{paddingTop:"120px"},text:"暂无学员发起连麦!",icon:"noData-no-join"},null)])}}),Kl=E({data:function(){return{lookList:[],loadingLook:!1}},mounted:function(){var e=this;this.loadingLook=!0,ad.on(sd["RC:Chatroom:Welcome"],this.onWelcome),ad.on(sd["RC:Chatroom:SeatResponse"],this.onSeatResponse),ad.on(sd["RM:RTC:SwitchRole"],this.onSwitchRole),setTimeout((function(){e.loadingLook=!1}))},methods:{_init:function(){return n(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=sessionStorage.getItem("roomUid"),e.next=4,u.get("/api-web/imLiveBroadcastRoom/queryRoomUserInfo",{params:{roomUid:t}});case 4:n=e.sent,console.log("_init",n),e.next=10;break;case 8:e.prev=8,e.t0=e.catch(0);case 10:case"end":return e.stop()}}),e,null,[[0,8]])})))()},onSeatResponse:function(e){if(console.log("onSeatResponse",e,"lookList"),3==e.type){El.lookList.forEach((function(t){t.id==e.audienceId&&(t.type=1)}));var t,n,i=El.joinList[e.audienceId];if(console.log(El.joinList),i)El.joinList[e.audienceId].type=1;else Sl(e.audienceId,{id:e.audienceId,name:e.audienceName,audienceId:e.audienceId,audienceName:e.audienceName,teacherId:null===(t=r.user)||void 0===t?void 0:t.id,teacherName:null===(n=r.user)||void 0===n?void 0:n.speakerName,type:1})}},onWelcome:function(e){if(console.log(e),e&&e.user){var t=B(e.$EventMessage.sentTime||new Date).format("HH:mm:ss"),n={name:e.user.name,id:e.user.id,sendTime:t},r=!1;El.lookList.forEach((function(e){e.id===n.id&&(r=!0)})),r||function(e){Cl.lookList.push(e)}(n),this.loadingLook=!1}},onUpLook:function(e){return n(regeneratorRuntime.mark((function t(){var n,i,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o={audienceName:e.name,audienceId:e.id,teacherId:null===(n=r.user)||void 0===n?void 0:n.id,teacherName:null===(i=r.user)||void 0===i?void 0:i.speakerName,type:1},t.next=4,Pd(o,"SeatApply");case 4:t.next=8;break;case 6:t.prev=6,t.t0=t.catch(0);case 8:case"end":return t.stop()}}),t,null,[[0,6]])})))()},onDownLook:function(e){return n(regeneratorRuntime.mark((function t(){var n,o,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:try{s=i(i({},e),{},{audienceName:e.name,audienceId:e.id,teacherId:null===(n=r.user)||void 0===n?void 0:n.id,teacherName:null===(o=r.user)||void 0===o?void 0:o.speakerName,type:5}),Sl(e.id,s),Pd(s,"SeatApply")}catch(a){}case 1:case"end":return t.stop()}}),t)})))()},onSwitchRole:function(e){console.log(e,"onSwitchRole look-modal"),2===e.role&&El.lookList.forEach((function(t){t.id==e.userId&&(t.type=1)}))}},render:function(){var e=this;return I("div",null,[El.lookList.length>0?El.lookList.map((function(t){return I("div",{class:kl},[I("div",{class:wl},[I("div",{class:Ol},[I("p",{class:Nl},[t.name]),1!==t.type?I(A,{size:"small",type:"primary",class:Dl,onClick:function(){return e.onUpLook(t)}},{default:function(){return[b("上麦")]}}):I(A,{size:"small",plain:!0,class:[Dl,Vl],onClick:function(){return e.onDownLook(t)}},{default:function(){return[b("下麦")]}})])])])})):this.loadingLook?I("div",{class:Bl},[I("div",{class:"el-loading-mask",style:"background-color: rgba(0, 0, 0, 0.8);"},[I("div",{class:"el-loading-spinner"},[I("svg",{class:"circular",viewBox:"25 25 50 50"},[I("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"},null)])])])]):I(jl,{style:{paddingTop:"120px"},text:"暂无学员观看!",icon:"noData-no-user"},null)])}}),ql=E({data:function(){return{messageList:[],loadingMessage:!1}},mounted:function(){var e=this;this.loadingMessage=!0,ad.on(sd["RC:TxtMsg"],this.onMessage),ad.on(sd["RC:Chatroom:Like"],this.onLike),setTimeout((function(){e.loadingMessage=!1}),2e3),this.scrollToBottom()},beforeUnmount:function(){ad.off(sd["RC:TxtMsg"],this.onMessage),ad.off(sd["RC:Chatroom:Like"],this.onLike)},methods:{onLike:function(e){if(e&&e.user){var t,n=B(e.$EventMessage.sentTime||new Date).format("HH:mm:ss");console.log(e,"like");var r={name:null===(t=e.user)||void 0===t?void 0:t.name,id:e.user.id,isSelf:!1,content:"给您点了"+e.counts+"个赞",sendTime:n};Tl(r),this.loadingMessage=!1}this.scrollToBottom()},onMessage:function(e){if(e&&e.user){var t,n=B(e.$EventMessage.sentTime||new Date).format("HH:mm:ss"),i={name:null===(t=e.user)||void 0===t?void 0:t.name,id:e.user.id,isSelf:!1,content:e.content,sendTime:n};e.user.id===r.user.speakerId&&(i.isSelf=!0),Tl(i),this.loadingMessage=!1}this.scrollToBottom()},scrollToBottom:function(){this.$nextTick((function(){var e,t;null===(e=document.querySelector("#tabList"))||void 0===e||e.scrollTo(0,(null===(t=document.querySelector("#messageList"))||void 0===t?void 0:t.scrollHeight)||0)}))}},render:function(){return I("div",{style:{minHeight:"100%",position:"relative"},id:"messageList"},[El.messageList.length>0?El.messageList.map((function(e){return I("div",{class:kl},[I("div",{class:wl},[I("div",{class:Ol},[I("p",{class:Nl},[I("span",{class:Al},[e.name]),e.isSelf?I(j,{effect:"dark",color:"#01A79E"},{default:function(){return[b("主讲人")]}}):null]),I("p",{class:Ml},[e.sendTime])]),I("div",{class:[Pl,e.isSelf?xl:null]},[e.content])])])})):this.loadingMessage?I("div",{class:Bl},[I("div",{class:"el-loading-mask",style:"background-color: rgba(0, 0, 0, 0.8);"},[I("div",{class:"el-loading-spinner"},[I("svg",{class:"circular",viewBox:"25 25 50 50"},[I("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"},null)])])])]):I(jl,{style:{paddingTop:"120px"},text:"暂无学员互动!",icon:"noData-no-message"},null)])}}),Gl=E({name:"LiveMessage",data:function(){return{modelIndex:"message"}},mounted:function(){var e;ud.likeCount=(null===(e=r.user)||void 0===e?void 0:e.likeNum)||0},methods:{tabChange:function(e){this.modelIndex=e.props.name}},render:function(){var e,t=this;return I("div",{class:al},[I("div",{class:cl},[I("div",null,[I("p",{class:ul},[null===(e=r.user)||void 0===e?void 0:e.likeNum]),I("p",{class:dl},[I(M("SvgIcon"),{name:"message-look",color:"#fff",class:ll},null),b("当前观看")])]),I("div",null,[I("p",{class:ul},[ud.likeCount]),I("p",{class:dl},[I(M("SvgIcon"),{name:"message-giveUp",color:"#fff",class:ll},null),b("累计点赞")])])]),I(H,{modelValue:this.modelIndex,"onTab-click":this.tabChange,class:hl},{default:function(){return[I(K,{name:"message"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(M("SvgIcon"),{name:"message-message",color:"message"===t.modelIndex?"#00FFF0":"#fff",class:pl},null),b("聊天")])}}),I(K,{name:"join"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(M("SvgIcon"),{name:"message-evenEtc",color:"join"===t.modelIndex?"#00FFF0":"#fff",class:pl},null),b("连麦")])}}),I(K,{name:"look"},{label:function(){return I("span",{style:{display:"flex",alignItems:"center"}},[I(M("SvgIcon"),{name:"message-look",color:"look"===t.modelIndex?"#00FFF0":"#fff",class:pl},null),b("观看")])}})]}}),I("div",{class:fl},[I(_l,null,null),I("div",{class:gl,id:"tabList"},[q(I(ql,null,null),[[G,"message"===this.modelIndex]]),q(I(Hl,null,null),[[G,"join"===this.modelIndex]]),q(I(Kl,null,null),[[G,"look"===this.modelIndex]])]),I(bl,null,null)])])}}),Yl="_container_13n1h_1",Jl="_home_13n1h_4";t("default",E({render:function(){return I("div",{class:Jl},[I(Dd,null,null),I("div",{class:Yl},[I(sl,null,null),I(Gl,null,null)])])}}))}}}))}();
|